Homework Solution - Set 5 Due: Friday 10/03/08

Similar documents
CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

p-adic Egyptian Fractions

First Midterm Examination

Name Ima Sample ASU ID

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

1 From NFA to regular expression

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

First Midterm Examination

Parse trees, ambiguity, and Chomsky normal form

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Formal languages, automata, and theory of computation

Minimal DFA. minimal DFA for L starting from any other

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

1 Nondeterministic Finite Automata

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Lecture 08: Feb. 08, 2019

MATH 573 FINAL EXAM. May 30, 2007

Harvard University Computer Science 121 Midterm October 23, 2012

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Finite Automata-cont d

Automata and Languages

Improper Integrals. The First Fundamental Theorem of Calculus, as we ve discussed in class, goes as follows:

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS 275 Automata and Formal Language Theory

CS 330 Formal Methods and Models

Homework 3 Solutions

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Theoretical foundations of Gaussian quadrature

1.4 Nonregular Languages

Theory of Computation Regular Languages

Coalgebra, Lecture 15: Equations for Deterministic Automata

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum

CSE396 Prelim I Answer Key Spring 2017

State Minimization for DFAs

1 Structural induction

Lecture 3: Equivalence Relations

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Revision Sheet. (a) Give a regular expression for each of the following languages:

Bases for Vector Spaces

Math 4310 Solutions to homework 1 Due 9/1/16

CHAPTER 1 Regular Languages. Contents

W. We shall do so one by one, starting with I 1, and we shall do it greedily, trying

Improper Integrals, and Differential Equations

NON-DETERMINISTIC FSA

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

USA Mathematical Talent Search Round 1 Solutions Year 21 Academic Year

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Polynomial Approximations for the Natural Logarithm and Arctangent Functions. Math 230

Convert the NFA into DFA

1.3 Regular Expressions

QUADRATIC RESIDUES MATH 372. FALL INSTRUCTOR: PROFESSOR AITKEN

MTH 505: Number Theory Spring 2017

Designing finite automata II

UNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3

Recursively Enumerable and Recursive. Languages

September 13 Homework Solutions

Quadratic Forms. Quadratic Forms

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Linear Inequalities. Work Sheet 1

Solutions Problem Set 2. Problem (a) Let M denote the DFA constructed by swapping the accept and non-accepting state in M.

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

Lecture 2 : Propositions DRAFT

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

CSCI FOUNDATIONS OF COMPUTER SCIENCE

Lecture 3: Curves in Calculus. Table of contents

3 Regular expressions

set is not closed under matrix [ multiplication, ] and does not form a group.

Handout: Natural deduction for first order logic

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

(e) if x = y + z and a divides any two of the integers x, y, or z, then a divides the remaining integer

Let's start with an example:

Regular expressions, Finite Automata, transition graphs are all the same!!

Fundamental Theorem of Calculus

and that at t = 0 the object is at position 5. Find the position of the object at t = 2.

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

2.4 Linear Inequalities and Interval Notation

1 Structural induction, finite automata, regular expressions

MAA 4212 Improper Integrals

CS 330 Formal Methods and Models

Mathematics Number: Logarithms

Lecture 09: Myhill-Nerode Theorem

20 MATHEMATICS POLYNOMIALS

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

0.1 THE REAL NUMBER LINE AND ORDER

Closure Properties of Regular Languages

Chapter 6 Techniques of Integration

Transcription:

CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution - et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte non-finl. 1 2 No unions necessry, so eliminte stte 1. 2 Perform union on loops of stte 2. 2 Eliminte stte 2. No finl unions necessry. ( ) 1

(), 1 2 Add new strt stte nd finl stte. Mke originl finl sttes non-finl. 1 2, Perform union on edge from stte 1 to stte 2. 1 2 Eliminte stte 1. 2 ( ) Perform unions on edges from stte to stte 2 nd from stte to the finl stte. 2

2 ( ) Eliminte stte 2. ( ) (( ) ) No unions necessry, so eliminte stte. ( ) ((( ) ) ) ( ) Perform union on remining edges. ( ) ((( ) ) ) ( ) 2. Textook, Pge 88, Exercise 1.29. () A 1 = {0 n 1 n 2 n n 0} Condensed proof:

Proof. uppose A 1 is regulr. Let p e the pumping length given y the pumping lemm. Choose s = 0 p 1 p 2 p. By the lemm, xy p nd y > 0 therefore p 0 so s A 1. Clerly, s p thus s = xyz for some x, y nd z. ince xy p, xy cnnot extend eyond the first p symols of s, mening xy =0 k where 1 k p. Let us write x = 0, y = 0, z = 0 c 1 p 2 p. The numer of 0 s, 1 s nd 2 s in s re given y + + c = p. Leti =0suchthts = xy i z = xz. Thenumerof1 s in s is p wheres the numer of 0 s in s is + c. ors A, thenumerof0 s in s must equl the numer of 1 s in s,nmely + c = p. ustituting for p, wehve + c = + + c with equlity holding when = 0. Becuse y > 0nd y =, >0, thus s / A, contrdiction. Therefore A 1 is non-regulr. Detiled proof: Proof. We wnt to prove the lnguge A 1 is non-regulr. In order to use the pumping lemm, we must ssume A 1 is regulr, since the lemm only pplies to regulr lnguges. The gol is to show our ssumption leds to contrdiction, mening the ssumption is flse nd therefore the opposite must e true. ince our ssumption is tht A 1 is regulr, the opposite of this ssumption is A 1 is non-regulr, which is precisely wht we wnt to show. Once we ssume A 1 is regulr, the lemm provides us with the pumping length, p. We re now free to choose word s which elongs to A 1 nd hs length p. If we choose s ppropritely, we should e le to pump up the size of s in the mnner descried y the pumping lemm nd show the resulting word, s,does not elong to A 1. ince the lemm sttes ll such words should lso elong to the lnguge, this would e contrdiction, leding us to our conclusion tht A 1 is non-regulr. or s to e word in A 1, it must follow the form given y the definition ove. Due to the mnner in which A 1 is defined, to otin unique word, we must fix vlue for n. Given some creful thought, we cn gretly reduce the numer of cses we need to consider sed on the vlue we choose for n. To understnd the ville choices, let us oserve the effects pumping will hve on the word s. If we select s to e lrge enough word from the lnguge, the pumping lemm sttes s cn e divided into three prts s = xyz. rom this division, the lemm descries n infinite set of words of the form s = xy i z where s must lso elong to the lnguge for ny i 0. Depending on the size of y nd likewise where y flls within the word s, we will hve one of the following representtive forms for y (where 1 k p): 4

y = 0 k y = 1 k y = 2 k y = 0 k 1 k y = 1 k 2 k y = 0 k 1 n 2 k This mens we hve t lest six different cses to consider if we llow the size nd position of y to e ritrry (with the exception y > 0). However, we re not forced to llow this much vrition in the structure of y. In fct, using the third condition of the pumping lemm, xy p, we effectively limit oth the size nd position of y within the word s. urthermore, depending on the word we choose for s (the vlue we choose for n), we cn lso limit the symols which my pper in y nd hence the relevnce of ech form of y in the ove list. Given the form of the words in A 1, setting n llows us to control the numer of 0 s in the prefix of s. Ifwesetn p, the entire string xy must consist entirely of 0 s since xy consists of no more thn the first p symols of s, ll of which re now 0. Hence, y tkes on single form, nmely y = 0 k where 1 k p. o,yusing condition three nd choosing n ppropritely (specificlly, we will let n = p), we hve nrrowed the numer of cses we need to consider to single cse! Once we select the word s = 0 p 1 p 2 p, for the word to e useful in the context ofthelemm,itmusteevidentthts A 1 nd s p. We hve nerly proved tht s A 1. Wht remins to e shown is n 0. This follows from the conditions y > 0nd xy p. We hve n = p xy y > 0, thus n>0 nd, trivilly, n 0. Lstly, it is esy to show tht s p. ince s =p>p, s p. Now tht it is cler s A 1 nd s p, the lemm llows us to divide s into s = xyz for some x, y nd z. We cn write the representtive forms of x, y nd z s follows: x = 0 y = 0 z = 0 c 1 p 2 p We hve lredy indicted tht x nd y consist entirely of 0 s. As for the form of z, since xy p nd there re p leding 0 s in s, if xy <pthere will e some leftover 0 s which crry over into z, hence the 0 c.(therestofz is just the reminder of s.) urthermore, since the 0 s distriuted cross x, y nd z re from the p leding 0 s of s, + + c must sum to p. At this point, we focus our ttention on the new word, s = xy i z,sprovidedy the lemm. The difference etween s nd s is the numer of times the sustring y 5

is llowed to repet. or s, y simply ppers once ut for s, y is llowed to repet ny numer of times. A prticulr instnce of s cn e chosen y fixing the vlue for i. Preferly, we would like vlue for i other thn 1, s i =1wouldmke s = s nd we re trying to construct word which is not in A 1 (recll s needed to e word in A 1 ). The simplest vlue we cn choose for i is i =0. Inthiscse, s = xz. We must now show xz / A 1 in order to form contrdiction with the pumping lemm. (The first condition of the lemm sttes xy i z A 1 for ll i 0.) Recll the representtive forms of x nd z. x = 0 nd z = 0 c 1 p 2 p. One wy to show xz / A 1 is y showing the numer of 0 s in xz does not equl the numer of 1 s in xz since the definition of A 1 requires these quntities to e equl. By the forms of x nd z, it is pprent the numer of 0 s in xz is given y + c nd the numer of 1 s is given y p. Rememering tht + + c = p, we cn determine when the two quntities re equl. + c = p + c = + + c 0= If we cn show tht cnnot possily e 0, then our proof is complete. ortuntely, we cn demonstrte this fct using the condition y > 0. Replcing y with its representtive form, we otin 0 > 0. More or less y definition, 0 = nd therefore >0. o, it follows cnnot e 0, mening the numer of 0 s in xz cnnot equl the numer of 1 s. Thus, xz / A 1 nd since this forms contrdiction with the clims of the pumping lemm, our supposition tht A 1 is regulr must e incorrect. Hence, we conclude A 1 is non-regulr. () A 2 = {www w {, } } Proof. uppose A 2 is regulr. Let p e the pumping length given y the pumping lemm. Choose s = www where w = p. Clerly, s A 2 nd s p, thuss = xyz for some x, y nd z. ince xy p, xy cnnot extend eyond the first p symols of s, mening xy = k where 1 k p. Letuswritex =, y =, z = c p p. The numer of s in ech w is given y ++c = p. Leti =0nds = xy i z = xz. or reference, let xz = w 1 w 2 w where w 1 = c nd w 2 = w = p.thenumer of s in w 2 nd w re ech p wheres the numer of s in w 1 is + c. or s A, thenumerof s in w 1 must equl the numer of s in w 2 nd w,nmely + c = p. ustituting for p, wehve + c = + + c with equlity holding when = 0. Becuse y > 0nd y =, >0, thus s / A, contrdiction. Therefore A 2 is non-regulr. 6

(c) A = { 2n n 0} NOTE: n is ssumed to e n integer. Proof. uppose A is regulr. Let p e the pumping length given y the pumping lemm. Choose s = 2n. By the lemm, xy p nd y > 0 therefore p 0nd s A. Clerly, s =2 p p, thuss = xyz for some x, y nd z. Let us write x =, y =, z = c. The numer of s in s is + + c =2 p. Let i =2nd s = xy i z = xyyz. Thenumerof s in s, denoted # (s ), is +2 + c =2 p +. ince y > 0nd y =, >0. rom 2 p = + + c<+2 + c, we conclude 2 p < # (s ). ustituting for on the right-hnd side of +2 + c =2 p +, we find +2 + c =2 p +2 p c. ince xy p, c = xyz xy 2 p p>0, we hve +2 + c<2 p+1,thus# (s ) < 2 p+1. Becuse 2 p < # (s ) < 2 p+1,# (s )isnot n even power of 2 nd s / A, contrdiction. Therefore A is non-regulr. 7