Grammars (part II) Prof. Dan A. Simovici UMB

Size: px
Start display at page:

Download "Grammars (part II) Prof. Dan A. Simovici UMB"

Transcription

1 rammars (part II) Prof. Dan A. Simovici UMB 1 / 1

2 Outline 2 / 1

3 Length-Increasing vs. Context-Sensitive rammars Theorem The class L 1 equals the class of length-increasing languages. 3 / 1

4 Length-Increasing vs. Context-Sensitive rammars Proof Clearly, every type-1 grammar is length-increasing. Therefore, as we observed earlier, L 1 is included in the class of length-increasing languages. To prove the converse inclusion, consider a length-increasing grammar = (A N, A T, S, P). We can assume that every production of P that contains a terminal symbol is of the form X a. 4 / 1

5 Length-Increasing vs. Context-Sensitive rammars Proof (cont d) Let π : α β P be a production such that α = X 0 X n 1, β = Y 0 Y m 1. If n = 1, then π is already a context-sensitive production. Therefore, suppose that 2 n m. By hypothesis, X 0,..., X n 1, Y 0,..., Y m 1 are nonterminals. Consider n new nonterminals Z π 0,..., Z π n 1 and the set of productions P π that consists of: X 0 X n 1 Z π 0 X 1 X n 1 Z π 0 X 1 X n 1 Z π 0 Z π 1 X 2 X n 1. Z π 0 Z π 1 Z π n 2 X n 1 Z π 0 Z π 1 Z π n 1 Y n Y m 1 Z π 0 Z π 1 Z π n 1 Y n Y m 1 Y 0 Z π 1 Z π n 1 Y n Y m 1 Y 0 Z π 1 Z π n 1 Y n Y m 1 Y 0 Y 1 Z π n 1 Y n Y m 1. Y 0 Y 1 Z π n 1 Y n Y m 1 Y 0 Y 1 Y n 1 Y n Y m 1. The set P π consists of context-sensitive productions. 5 / 1

6 Length-Increasing vs. Context-Sensitive rammars Proof (cont d) Let P 1 be the set of productions that consists of {P α β 2 α β } and the productions of the form X β or S λ (whenever such productions belong to P). Consider the context-sensitive grammar 1 = (A N A, A T, S, P 1 ), where A consists of all new nonterminal symbols introduced when the production sets P π were constructed. 6 / 1

7 Length-Increasing vs. Context-Sensitive rammars Proof (cont d) Note that a derivation step in that consists of the application of a production π : α β with 2 α β corresponds to the successive application of the productions of P π in 1 ; conversely, the productions of P π can be applied only in this order in a derivation in 1, and they simulate a step in a derivation in that makes use of the production π. A step that uses a production X β or S λ is the same in both and 1. Thus, S x if and only if S 1 x, so L() = L( 1 ). This shows that the class of length-increasing languages is included in L 1. 7 / 1

8 Length-Increasing vs. Context-Sensitive rammars Example Let = ({S, X, Y, X a, X b, X c }, {a, b, c}, S, P ) be the length-increasing previously constructed grammar. The set of productions P 1 consists of: The context-sensitive productions in P, namely: π 0 : S X a X b X c, π 1 : S X a XX b X c, π 7 : X a a, π 8 : X b b π 9 : X c c 8 / 1

9 Length-Increasing vs. Context-Sensitive rammars Example (cont d) Each remaining production in P generates the following productions: For π 2 : XX b X b X, include the productions: π 10 : XX b Z 0 X b π 11 : Z 0 X b Z 0 Z 1 π 12 : Z 0 Z 1 X b Z 1 π 13 : X b Z 1 X b X For π 3 : XX c YX b X c X c, include the productions: π 14 : XX c Z 2 X c π 15 : Z 2 X c Z 2 Z 3 X c X c π 16 : Z 2 Z 3 X c X c YZ 3 X c X c π 17 : YZ 3 X c X c YX b X c X c 9 / 1

10 Length-Increasing vs. Context-Sensitive rammars Example (cont d) For π 4 : X by YX b, include the productions: π 18 : X b Y Z 4 Y π 19 : Z 4 Y Z 4 Z 5 π 20 : Z 4 Z 5 YZ 5 π 21 : YZ 5 YX b For π 5 : X ay X a X a X, include the productions: π 22 : X a Y Z 6 Y π 23 : Z 6 Y Z 6 Z 7 X π 24 : Z 6 Z 7 X X a Z 7 X π 25 : X a Z 7 X X a X a X 10 / 1

11 Length-Increasing vs. Context-Sensitive rammars Finally, for π 6 : X ay X a X a, include the productions: π 26 : X a Y Z 8 Y π 27 : Z 8 Y Z 8 Z 9 π 28 : Z 8 Z 9 X a Z 9 π 29 : X a Z 9 X a X a This gives the context-sensitive grammar: 1 = ({S, X, Y, X a, X b, X c } {Z i 0 i 10}, {a, b, c}, S, {π 0, π 1, π 7, π 8, π 9} {π j 10 j 29}. that generates the language L = {a n b n c n n N}. This implies that L is a context-sensitive language. 11 / 1

12 Length-Increasing vs. Context-Sensitive rammars Theorem The classes L 0, L 1, L 2 are closed with respect to the reversal operation; in other words, if L L i, then L R L i for i {0, 1, 2}. 12 / 1

13 Length-Increasing vs. Context-Sensitive rammars Proof Let = (A N, A T, S, P) be a grammar, and let P R = {α R β R α β P}. Define R = (A N, A T, S, P R ). If is of type i, then so is R for i {0, 1, 2}. Further, we have γ γ if and only if γ R R γ R, as can be shown by induction on the length of the two derivations. Thus, S w if and only if S = S R R w R. This shows that L( R ) = L() R, so L() R has the same type as the language L(). 13 / 1

14 Closure Properties of Classes of Languages Theorem Each of the classes L i of Chomsky s hierarchy contains the class of finite languages, for i {0, 1, 2}. Proof. Let L = {u 0,..., u n 1 } be a finite, nonempty language over an alphabet A. The grammar = ({S}, A, S, {S u 0,..., S u n 1 }) is of type 3 and, therefore, of type 2, 1, and 0. If L =, then L is generated by the grammar = ({S}, A, S, {S S}) that is, again, of type / 1

15 Closure Properties of Classes of Languages Theorem If L is a language of type i, where i {0, 1}, then so is the language K, where K = L {λ}. Proof. If L is a type-1 language, then there exists a type-1 grammar = (A N, A T, S, P) such that L() = L. If λ L, the production S λ belongs to P, and S does not occur in the right member of any production. The language K is generated by the type-1 grammar = (A N, A T, S, P {S λ}). If λ L, we have K = L. If L is of type 0 and λ L, let P be the set of productions obtained from P by replacing all erasure productions α λ with Y α Y and αy Y for every Y A N A T. The grammar (A N, A T, S, P ) generates the language K, so K is a type-0 language. 15 / 1

16 Closure Properties of Classes of Languages Theorem L i is closed with respect to union, for i {0, 1, 2, 3}. Proof. Suppose that L, L are two languages of type i that are generated by the grammars = (A N, A T, S, P) and = (A N, A T, S, P ), respectively, where A N A N =. Consider the grammar = (A N A N {S 0}, A T, S, P P {S 0 S, S 0 S }), where S 0 is a new nonterminal symbol such that S 0 A N A N. Note that the grammar is of the same type i as the grammars and. To complete the proof, we need to show that L L = L( ). 16 / 1

17 Closure Properties of Classes of Languages Proof (cont d) Consider the grammar = (A N A N {S 0}, A T, S, P P {S 0 S, S 0 S }), where S 0 is a new nonterminal symbol such that S 0 A N A N. Note that the grammar is of the same type i as the grammars and. To complete the proof, we need to show that L L = L( ). Let x L L. If x L, then S x, so S 0 S x which shows that x L( ). The case when x L is entirely similar and is left to the reader. Thus, L L L( ). 17 / 1

18 Closure Properties of Classes of Languages Proof (cont d) Conversely, suppose that x L( ). We have S 0 x. If the first production applied in this derivation is S 0 S, then the derivation can be written as S 0 S x. The last part of this derivation S x uses only productions from P since A N A N = implies P P =. Therefore, we have S x, so x L(). Similarly, if the first production applied is S 0 S, then x L( ). Therefore, L( ) L() L( ), hence L( ) = L() L( ). 18 / 1

19 Closure Properties of Classes of Languages Closure with respect to Lemma The classes L 0 and L 1 are closed with respect to the operation. Proof. We must prove that if L L i, then L L i for i {0, 1}. Let us assume initially that λ L. Let = (A N, A T, S, P) be a grammar of type 0 or type 1 that generates the language L. We can assume that terminal symbols do not occur in the left member of any production of P. Let S 0, S 1 be new symbols such that S 0, S 1 A N, and let = (A N {S 0, S 1 }, A T, S 0, P ) be the grammar whose set of productions is P = P {S 0 λ, S 0 S, S 0 S 1 S} {S 1 a S 1 Sa a A T } {S 1 a Sa a A T }. 19 / 1

20 Closure Properties of Classes of Languages Proof (cont d) If is of type 1, then so is. We have L n L( ) for n N. Let x L n. If n = 0 we have x = λ, and x L( ) because S 0 λ is in P. Suppose now that x = x 0 x 1... x n 1, where x 0,..., x n 1 L for n 1. We have S x j for 0 j n 1, and the same derivations are valid in because P P. Thus, we can put together the following derivation in the grammar : S 0 S 1 S S 1 x n 1 S 1 Sx n 1 S 1 x n 2 x n 1. S 1 Sx 2 x n 1 S 1 x 1 x n 1 Sx 1 x n 1 x 0 x 1 x n 1 = x. 20 / 1

21 Closure Properties of Classes of Languages Proof (cont d) This proves that x L( ). Thus, L = n N Ln L( ). Observe that the regeneration of the symbol S is made possible in the above derivation by the fact that the words x j are not null (which puts S 1 adjacent with terminal symbols, thereby allowing the application of the productions S 1 a S 1 Sa). 21 / 1

22 Closure Properties of Classes of Languages Proof (cont d) Conversely, let x L( ). There exists a derivation S 0 x. If we write this derivation explicitly, S 0 α 1 α n 1 = x, we have to consider three cases: Case 1: If the first production applied in this derivation is S 0 λ, then x = λ, so x L. Case 2: If the first production applied is S 0 S, then we have S x, and the same derivation is valid in, which shows that x L() = L. 22 / 1

23 Closure Properties of Classes of Languages Proof (cont d) Case 3: If the first production applied is S 0 S 1 S, then each word α l in the above derivation falls into one of the following two cases: Case 3a: α l is of the form S 1 β 1 β k, where k 1, S β q for 1 q k, and the first symbol of each of the words β 2,..., β k is a terminal. Case 3b: α l is of the form β 0 β 1 β k, where k 1, the first symbol of each β p is a terminal for p 1, and S β p for 0 p k. 23 / 1

24 Closure Properties of Classes of Languages Proof (cont d) This argument is by induction on l 1. It is clear that α 1 falls in Case 3a. Suppose that α h satisfies the conditions of either Case 3a or Case 3b. Since the productions of P do not have terminal symbols in their left members, their application may involve only one word β i. This guarantees that if α h+1 was obtained through the application of a production in P, then α h+1 satisfies one of the conditions of the previous cases. The same conclusion can be reached if α h+1 was obtained by applying a production of the form S 1 a S 1 Sa or S 1 a Sa. 24 / 1

25 Closure Properties of Classes of Languages Proof (cont d) The existence of the derivation S 0 x A T implies that x is a word of the form 3b. Therefore x can be written as a product, x = β 0 β k, where k 1, and S β p for 0 p k. Since every word β 0, β 1,..., β k A T it follows that β 0, β 1,..., β k L(). Thus, x (L()) k+1 L() which implies L( ) L(). If λ L, then consider the language K = L {λ}. The language K is of the same type as L and, by the above argument, so is K. Since K = L we obtain the desired closure property. 25 / 1

26 Closure Properties of Classes of Languages Lemma The class L 2 is closed with respect to the operation. Proof. Let L be a context-free language generated by the type-2 grammar = (A N, A T, S, P). Suppose that S 0 is a new nonterminal symbol and consider the type-2 grammar = (A N {S 0 }, A T, S 0, P {S 0 λ, S 0 S 0 S}). It is easy to verify that L( ) = L, so L L / 1

27 Closure Properties of Classes of Languages Lemma The class L 3 is closed with respect to the operation. Proof. Let L L 3 such that L = L(), where = (A N, A T, S, P) is a type-3 grammar. Define the set of productions P 1 = {X us X u P}. Consider the type-3 grammar = (A N {S 0 }, A T, S 0, P P 1 {S 0 λ, S 0 S}), where S 0 be a new nonterminal symbol, S 0 A N. It is easy to verify that L( ) = L, so L L / 1

28 Closure Properties of Classes of Languages Theorem The classes L i are closed with respect to the operation for i {0, 1, 2, 3}. Proof. This follows from the previous lemmas. 28 / 1

29 Closure Properties of Classes of Languages Corollary The classes L i are closed with respect to the + operation for i {0, 1, 2, 3}. Proof. Let L i be one of the classes of Chomsky s hierarchy, and let L L i. Note that { L + L if λ L = L {λ} if λ L. In all cases L + L i. 29 / 1

30 Closure Properties of Classes of Languages Lemma The classes L 0 and L 2 are closed with respect to the product operation. Proof. Let L, L be two languages of type i, and let = (A N, A T, S, P), = (A N, A T, S, P ) be two grammars of type i such that L() = L and L( ) = L, where i {0, 2}. Without any loss of generality, we can assume that A N A N =. If S 0 is a new symbol, S 0 A N A N, then the grammar p = (A N A N {S 0}, A T, S 0, P P {S 0 SS }) is also of type i. We claim that L( p ) = LL. 30 / 1

31 Closure Properties of Classes of Languages Proof (cont d) Let x LL. We can write x = uv for some u L and v L. By hypothesis, S u and S v, so S 0 p SS p us p uv = x. Thus, x L( p ). 31 / 1

32 Closure Properties of Classes of Languages Conversely, suppose that x L p. There is a derivation S 0 p SS p x. Since A N and A N are disjoint sets, the sets of productions P and P are disjoint. Therefore, the productions of p used to transform S into a word over A T belong to P, while the ones used to rewrite S belong to P. Thus, we can write x = uv, where S u and S v, which implies x LL. 32 / 1

33 Closure Properties of Classes of Languages Lemma The class L 1 is closed with respect to the product operation. Proof. Let L, L be two languages in L 1. If neither L nor L contains the null word, we may assume that both languages are generated by type-1 grammars that have no erasure rules. It is easy to see that, in this case, the construction of the grammar p given in the proof of previous Lemma yields a type-1 grammar, so LL belongs to L / 1

34 Closure Properties of Classes of Languages Proof cont d Suppose now that λ L or λ L. By The languages L 1 = L {λ} and L 1 = L {λ} also belong to L 1 and, by the previous argument L 1 L 1 L 1. We need to consider the cases summarized below. Case λ L λ L L L LL 1 yes no L 1 {λ} L 1 L 1 L 1 L 1 2 no yes L 1 L 1 {λ} L 1L 1 L 1 3 yes yes L 1 {λ} L 1 {λ} L 1L 1 L 1 L 1 {λ} In each case, we have LL L / 1

35 Closure Properties of Classes of Languages Lemma The class L 3 is closed with respect to the product operation. Proof. Let L, L be two languages in L 3 and assume that L, L are generated by the grammars = (A N, A T, S, P) and = (A N, A T, S, P ), respectively. Without loss of generality, we may assume that A N A N = ; this also implies P P =. Consider the set of productions P 1 = {X uy X uy P} {X us X u P}, which is obtained from P by replacing every production X u by a production X us. 35 / 1

36 Closure Properties of Classes of Languages Proof cont d The type-3 grammar 1 = (A N A N, A T A T, S, P 1 P ) generates the language LL. Indeed, if x L() and y L( ), then S x and S y. Since P was replaced by P 1 in 1, we have S xs. Note that 1 we also have S 1 y. Combining the last two derivations we can write S xy, so LL L( 1 ) / 1

37 Closure Properties of Classes of Languages Proof cont d Conversely, let z L( 1 ). We have S 1 z. This derivation begins with a symbol from A N and must eventually use a production from P since, otherwise, nonterminal symbols cannot be erased. Therefore, the last derivation can be written as S 1 us 1 uv = z, where u A T and v A T. This implies the existence of the derivations S 1 us and S 1 v. Note that the first derivation corresponds to S u; the second corresponds to S v. Thus, u L(), v L( ), and this implies z = uv LL. Therefore, L( 1 ) LL. 37 / 1

38 Closure Properties of Classes of Languages Theorem Each of the classes L i is closed with respect to the product operation. Proof. Follows from previous lemmas. 38 / 1

39 Properties of Type-2 rammars Theorem Let = (A N, A T, S, P) be a context-free grammar. If n X 0 X k 1 α, where X 0,..., X k 1 A N A T and α (A N A T ), then we can write α = α 0 α k 1, where X i n i α i for 0 i k 1 and 0 i k 1 n i = n. Proof. We use an argument by induction on n, n 0. For n = 0, we have α i = X i for 0 i k 1, and the statement is obviously true; in this case, n 0 = = n k 1 = / 1

40 Properties of Type-2 rammars Proof cont d Assume that the statement is true for derivations of length n, and let X 0 X k 1 n+1 α. If X 0 X k 1 n γ α, by the inductive hypothesis, we have n i γ = γ 0 γ k 1, where X i {ni 0 i k 1} = n. γ i for 0 i k 1 and 40 / 1

41 Properties of Type-2 rammars Proof cont d Let Y β be the production applied in the last step γ α. Y occurs in one of the words γ 0,..., γ k 1, say, γ j. In this case, we can write γ j = γ j Y γ j and α can be written as α = α 0 α k 1, where α i = γ i for n j 0 i j 1, and j + 1 i k 1, X j γ j γ j βγ j = α j, which proves the statement. 41 / 1

42 Properties of Type-2 rammars Definition A derivation γ 0 γ 1 γ n in a context-free grammar = (A N, A T, S, P) is complete if γ n A T. Note that if X 0 X k 1 α is a complete derivation in, then every derivation that results from splitting this derivation is also complete. 42 / 1

43 Properties of Type-2 rammars Example Let = (A N, A T, S 0, P) be a context-free grammar, where A N = {S 0, S 1, S 2 }, A T = {a, b}, and P contains the following productions: S 0 as 2, S 0 bs 1, S 1 a, S 1 as 0, S 1 bs 1 S 1, S 2 b, S 2 bs 0, S 2 as 2 S / 1

44 Properties of Type-2 rammars Example cont d We prove that L() consists of all nonnull words over {a, b} that contain an equal number of a s and b s. Recall that n X (α) is the number of occurrences of symbol X in the word α. We will show by strong induction on p, p 1, that 1 if n a (u) = n b (u) = p, then S 0 u; 2 if n a (u) = n b (u) + 1 = p, then S 1 u; 3 if n b (u) = n a (u) + 1 = p, then S 2 u. 44 / 1

45 Properties of Type-2 rammars Example cont d In the first case, for p = 1, we have either u = ab or u = ba; hence, we have either S 0 as 2 ab or S 0 bs 1 ba. For the second case, u = a, and we have S 1 u = b, is similar. a; the third case, for 45 / 1

46 Properties of Type-2 rammars Example cont d Suppose that the statement holds for p n. Again, we consider three cases for the word u: 1 n a (u) = n b (u) = n + 1; 2 if n a (u) = n b (u) + 1 = n + 1; 3 if n b (u) = n a (u) + 1 = n + 1. In the first case, we may have four situations: 1 1. u = abt, where t {a, b} and n a (t) = n b (t) = n, 1 2. u = bat, where t {a, b} and n a (t) = n b (t) = n, 1 3. u = aav with n b (v) = n + 1 and n a (v) = n 1, or 1 4. u = bbw with n a (w) = n + 1 and n b (w) = n / 1

47 Properties of Type-2 rammars Example cont d By the inductive hypothesis, we have S 0 t, and therefore, we obtain one of the following derivations: S 0 as 2 abs 0 abt = u, S 0 bs 1 bas 0 bat = u, for the cases (1 1 ) and (1 2 ), respectively. 47 / 1

48 Properties of Type-2 rammars Example cont d On the other hand, if u = aav, we can write v = v v, where v is the shortest prefix of v, where the number of bs exceeds the number of as. Clearly, we must have n b (v ) = n a (v ) + 1 = n, and therefore, n b (v ) = n a (v ) + 1 = n, where n + n = n + 1. By the inductive hypothesis, we have S 2 v, S 2 v ; hence, S 0 as 2 aas 2 S 2 aav v = u, which concludes the argument for (1 3 ). We leave to the reader the similar arguments for the remaining cases. This allows us to conclude that every word that contains an equal number of a s and b s belongs to L(). 48 / 1

49 Properties of Type-2 rammars Example cont d To prove the reverse inclusion, we justify the following implications: 1 If S 0 n α, then n a (α) + n S1 (α) = n b (α) + n S2 (α). 2 If S 1 n α, then n a (α) + n S1 (α) = n b (α) + n S2 (α) If S 2 n α, then n a (α) + n S1 (α) + 1 = n b (α) + n S2 (α). The proof is by strong induction on n, where n 1. For n = 1, the verification is immediate. For instance, if S 1 α, we have α = a, α = as 0, or α = bs 1 S 1 ; in every case, the equality is satisfied. 49 / 1

50 Properties of Type-2 rammars Example cont d Suppose that the implications hold for derivations no longer than n. n+1 If S 0 α, the first production applied in the derivation is S 0 as 2 or S 0 bs 1. In the first case, we have α = aβ, where S 2 n β, and by the inductive hypothesis, we have n a (β) + n S1 (β) + 1 = n b (β) + n S2 (β), so n a (α) + n S1 (α) = n a (β) n S1 (β) = n b (β) + n S2 (β) = n b (α) + n S2 (α). The second case has a similar treatment. 50 / 1

51 Properties of Type-2 rammars Example cont d n+1 If S 1 α, we have three possibilities. (a) If the first production of the derivation is S 1 a, then α = a and the equality corresponding to this case is obviously satisfied. (b) If the first production is S 1 as 0, we can write α = aβ, where S 0 n β; hence, n a (β) + n S1 (β) = n b (β) + n S2 (β), so n a (α) + n S1 (α) = n a (β) n S1 (β) = n b (β) + n S2 (β) + 1 = n b (α) + n S2 (α) / 1

52 Properties of Type-2 rammars Example cont d (c) If the derivation begins with S 1 bs 1 S 1 we can write α = bβγ, where S 1 p β and S 1 q γ, where p, q n. By the inductive hypothesis, n a (β) + n S1 (β) = n b (β) + n S2 (β) + 1, and n a (γ) + n S1 (γ) = n b (γ) + n S2 (γ) + 1. Consequently, n a (α) + n S1 (α) = n a (β) + n a (γ) + n S1 (β) + n S1 (γ) = n b (β) + n S2 (β) n b (γ) + n S2 (γ) + 1 = n b (α) + n S2 (α) + 1. The case of the derivation S 2 α can be treated in a similar manner. 52 / 1

53 Properties of Type-2 rammars Example cont d Let u L(). From the existence of the derivation S 0 u we obtain n a (u) = n b (u), which shows that L() {x {a, b} n a (x) = n b (x)}. 53 / 1

Grammars (part I) Prof. Dan A. Simovici UMB

Grammars (part I) Prof. Dan A. Simovici UMB rammars (part I) Prof. Dan A. Simovici UMB 1 / 36 Outline 1 rammars and Chomsky s Hierachy 2 Productions and Derivations in rammars 3 Chomsky s Hierachy 4 Equivalent rammars 2 / 36 Outline Language classes

More information

Context-Free languages (part II)

Context-Free languages (part II) Context-Free languages (part II) Prof. Dan A. Simovici UMB 1 / 31 Outline 1 Chomsky Normal Form 2 Derivation Trees 2 / 31 Chomsky Normal Form Definition A context-free grammar G = (A N, A T, S, P) is in

More information

Finite Automata and Regular Languages (part III)

Finite Automata and Regular Languages (part III) Finite Automata and Regular Languages (part III) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Nondeterministic finite automata can be further generalized by allowing transitions between states without

More information

Chapter 6. Properties of Regular Languages

Chapter 6. Properties of Regular Languages Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is

More information

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Section Summary. Relations and Functions Properties of Relations. Combining Relations Chapter 9 Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations Closures of Relations (not currently included

More information

Notes on Pumping Lemma

Notes on Pumping Lemma Notes on Pumping Lemma Finite Automata Theory and Formal Languages TMV027/DIT321 Ana Bove, March 5th 2018 In the course we see two different versions of the Pumping lemmas, one for regular languages and

More information

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Definition: A binary relation R from a set A to a set B is a subset R A B. Example: Chapter 9 1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R A B. Example: Let A = {0,1,2} and B = {a,b} {(0, a), (0, b), (1,a), (2, b)} is a relation from A to B.

More information

Fundamentele Informatica II

Fundamentele Informatica II Fundamentele Informatica II Answer to selected exercises 5 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 5.1.a (q 0, ab, Z 0 ) (q 1, b,

More information

Context Free Language Properties

Context Free Language Properties Context Free Language Properties Knowing that the context free languages are exactly those sets accepted by nondeterministic pushdown automata provides us a bit of information about them. We know that

More information

Cographs; chordal graphs and tree decompositions

Cographs; chordal graphs and tree decompositions Cographs; chordal graphs and tree decompositions Zdeněk Dvořák September 14, 2015 Let us now proceed with some more interesting graph classes closed on induced subgraphs. 1 Cographs The class of cographs

More information

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers. 1. For each of the following statements indicate whether it is true or false. For the false ones (if any), provide a counter example. For the true ones (if any) give a proof outline. (a) Union of two non-regular

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Introduction to Theory of Computing

Introduction to Theory of Computing CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages

More information

Power of controlled insertion and deletion

Power of controlled insertion and deletion Power of controlled insertion and deletion Lila Kari Academy of Finland and Department of Mathematics 1 University of Turku 20500 Turku Finland Abstract The paper investigates classes of languages obtained

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner. Tel Aviv University. November 28, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 10: CF, PDAs and Beyond Greibach Normal Form I We want to show that all context-free

More information

Theory of Computation

Theory of Computation Theory of Computation (Feodor F. Dragan) Department of Computer Science Kent State University Spring, 2018 Theory of Computation, Feodor F. Dragan, Kent State University 1 Before we go into details, what

More information

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages

Context Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages Context Free Languages Automata Theory and Formal Grammars: Lecture 6 Context Free Languages Last Time Decision procedures for FAs Minimum-state DFAs Today The Myhill-Nerode Theorem The Pumping Lemma Context-free

More information

Computational Models: Class 3

Computational Models: Class 3 Computational Models: Class 3 Benny Chor School of Computer Science Tel Aviv University November 2, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

How to write proofs - II

How to write proofs - II How to write proofs - II Problem (Ullman and Hopcroft, Page 104, Exercise 4.8). Let G be the grammar Prove that S ab ba A a as baa B b bs abb L(G) = { x {a, b} x contains equal number of a s and b s }.

More information

Context-Free Grammars (and Languages) Lecture 7

Context-Free Grammars (and Languages) Lecture 7 Context-Free Grammars (and Languages) Lecture 7 1 Today Beyond regular expressions: Context-Free Grammars (CFGs) What is a CFG? What is the language associated with a CFG? Creating CFGs. Reasoning about

More information

Left-Forbidding Cooperating Distributed Grammar Systems

Left-Forbidding Cooperating Distributed Grammar Systems Left-Forbidding Cooperating Distributed Grammar Systems Filip Goldefus a, Tomáš Masopust b,, Alexander Meduna a a Faculty of Information Technology, Brno University of Technology Božetěchova 2, Brno 61266,

More information

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Salil Vadhan October 11, 2012 Reading: Sipser, Section 2.3 and Section 2.1 (material on Chomsky Normal Form). Pumping Lemma for

More information

CS 341 Homework 16 Languages that Are and Are Not Context-Free

CS 341 Homework 16 Languages that Are and Are Not Context-Free CS 341 Homework 16 Languages that Are and Are Not Context-Free 1. Show that the following languages are context-free. You can do this by writing a context free grammar or a PDA, or you can use the closure

More information

CISC4090: Theory of Computation

CISC4090: Theory of Computation CISC4090: Theory of Computation Chapter 2 Context-Free Languages Courtesy of Prof. Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Spring, 2014 Overview In Chapter

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012 Decision Problems with TM s Look at following sets: Lecture 31: Halting Problem CSCI 81 Spring, 2012 Kim Bruce A TM = { M,w M is a TM and w L(M)} H TM = { M,w M is a TM which halts on input w} TOTAL TM

More information

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26 Parsing Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Winter 2017/18 1 / 26 Table of contents 1 Context-Free Grammars 2 Simplifying CFGs Removing useless symbols Eliminating

More information

This lecture covers Chapter 7 of HMU: Properties of CFLs

This lecture covers Chapter 7 of HMU: Properties of CFLs This lecture covers Chapter 7 of HMU: Properties of CFLs Chomsky Normal Form Pumping Lemma for CFs Closure Properties of CFLs Decision Properties of CFLs Additional Reading: Chapter 7 of HMU. Chomsky Normal

More information

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

Linear conjunctive languages are closed under complement

Linear conjunctive languages are closed under complement Linear conjunctive languages are closed under complement Alexander Okhotin okhotin@cs.queensu.ca Technical report 2002-455 Department of Computing and Information Science, Queen s University, Kingston,

More information

Computational Models - Lecture 4 1

Computational Models - Lecture 4 1 Computational Models - Lecture 4 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 3/8, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc. Section 12.4 Context-Free Language Topics Algorithm. Remove Λ-productions from grammars for langauges without Λ. 1. Find nonterminals that derive Λ. 2. For each production A w construct all productions

More information

What we have done so far

What we have done so far What we have done so far DFAs and regular languages NFAs and their equivalence to DFAs Regular expressions. Regular expressions capture exactly regular languages: Construct a NFA from a regular expression.

More information

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.   ETH Zürich (D-ITET) October, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) October, 5 2017 Part 3 out of 5 Last week, we learned about closure and equivalence of regular

More information

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages

Part 3 out of 5. Automata & languages. A primer on the Theory of Computation. Last week, we learned about closure and equivalence of regular languages Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 3 out of 5 ETH Zürich (D-ITET) October, 5 2017 Last week, we learned about closure and equivalence of regular

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of

More information

Finite Automata and Regular Languages (part II)

Finite Automata and Regular Languages (part II) Finite Automata and Regular Languages (part II) Prof. Dan A. Simovici UMB 1 / 25 Outline 1 Nondeterministic Automata 2 / 25 Definition A nondeterministic finite automaton (ndfa) is a quintuple M = (A,

More information

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc. The Pumping Lemma For every regular language L, there is a number l 1 satisfying the pumping lemma property: All w L with w l can be expressed as a concatenation of three strings, w = u 1 vu 2, where u

More information

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor 60-354, Theory of Computation Fall 2013 Asish Mukhopadhyay School of Computer Science University of Windsor Pushdown Automata (PDA) PDA = ε-nfa + stack Acceptance ε-nfa enters a final state or Stack is

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Push-Down Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

A shrinking lemma for random forbidding context languages

A shrinking lemma for random forbidding context languages Theoretical Computer Science 237 (2000) 149 158 www.elsevier.com/locate/tcs A shrinking lemma for random forbidding context languages Andries van der Walt a, Sigrid Ewert b; a Department of Mathematics,

More information

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 4 out of 5 ETH Zürich (D-ITET) October, 12 2017 Last week, we showed the equivalence of DFA, NFA and REX

More information

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton

More information

The Pumping Lemma for Context Free Grammars

The Pumping Lemma for Context Free Grammars The Pumping Lemma for Context Free Grammars Chomsky Normal Form Chomsky Normal Form (CNF) is a simple and useful form of a CFG Every rule of a CNF grammar is in the form A BC A a Where a is any terminal

More information

The View Over The Horizon

The View Over The Horizon The View Over The Horizon enumerable decidable context free regular Context-Free Grammars An example of a context free grammar, G 1 : A 0A1 A B B # Terminology: Each line is a substitution rule or production.

More information

Parikh s theorem. Håkan Lindqvist

Parikh s theorem. Håkan Lindqvist Parikh s theorem Håkan Lindqvist Abstract This chapter will discuss Parikh s theorem and provide a proof for it. The proof is done by induction over a set of derivation trees, and using the Parikh mappings

More information

Miscellaneous. Closure Properties Decision Properties

Miscellaneous. Closure Properties Decision Properties Miscellaneous Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms and inverse homomorphisms.

More information

Chomsky and Greibach Normal Forms

Chomsky and Greibach Normal Forms Chomsky and Greibach Normal Forms Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science Computation Theory p.1/25 Simplifying a CFG It is often convenient to simplify CFG One

More information

Abstract Measure Theory

Abstract Measure Theory 2 Abstract Measure Theory Lebesgue measure is one of the premier examples of a measure on R d, but it is not the only measure and certainly not the only important measure on R d. Further, R d is not the

More information

,... We would like to compare this with the sequence y n = 1 n

,... We would like to compare this with the sequence y n = 1 n Example 2.0 Let (x n ) n= be the sequence given by x n = 2, i.e. n 2, 4, 8, 6,.... We would like to compare this with the sequence = n (which we know converges to zero). We claim that 2 n n, n N. Proof.

More information

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ,

We define the multi-step transition function T : S Σ S as follows. 1. For any s S, T (s,λ) = s. 2. For any s S, x Σ and a Σ, Distinguishability Recall A deterministic finite automaton is a five-tuple M = (S,Σ,T,s 0,F) where S is a finite set of states, Σ is an alphabet the input alphabet, T : S Σ S is the transition function,

More information

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules).

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). 1a) G = ({R, S, T}, {0,1}, P, S) where P is: S R0R R R0R1R R1R0R T T 0T ε (S generates the first 0. R generates

More information

SFWR ENG 2FA3. Solution to the Assignment #4

SFWR ENG 2FA3. Solution to the Assignment #4 SFWR ENG 2FA3. Solution to the Assignment #4 Total = 131, 100%= 115 The solutions below are often very detailed on purpose. Such level of details is not required from students solutions. Some questions

More information

Context-Free Languages (Pre Lecture)

Context-Free Languages (Pre Lecture) Context-Free Languages (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Context-Free Languages (Pre Lecture) Fall 2017 1 / 34 Outline Pumping Lemma

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

How to Pop a Deep PDA Matters

How to Pop a Deep PDA Matters How to Pop a Deep PDA Matters Peter Leupold Department of Mathematics, Faculty of Science Kyoto Sangyo University Kyoto 603-8555, Japan email:leupold@cc.kyoto-su.ac.jp Abstract Deep PDA are push-down automata

More information

Concordia University Department of Computer Science & Software Engineering

Concordia University Department of Computer Science & Software Engineering Concordia University Department of Computer Science & Software Engineering COMP 335/4 Theoretical Computer Science Winter 2015 Assignment 3 1. In each case, what language is generated by CFG s below. Justify

More information

CS500 Homework #2 Solutions

CS500 Homework #2 Solutions CS500 Homework #2 Solutions 1. Consider the two languages Show that L 1 is context-free but L 2 is not. L 1 = {a i b j c k d l i = j k = l} L 2 = {a i b j c k d l i = k j = l} Answer. L 1 is the concatenation

More information

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties of Context-Free Languages. Closure Properties Decision Properties Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms

More information

Lecture 12 Simplification of Context-Free Grammars and Normal Forms

Lecture 12 Simplification of Context-Free Grammars and Normal Forms Lecture 12 Simplification of Context-Free Grammars and Normal Forms COT 4420 Theory of Computation Chapter 6 Normal Forms for CFGs 1. Chomsky Normal Form CNF Productions of form A BC A, B, C V A a a T

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework

More information

Non-context-Free Languages. CS215, Lecture 5 c

Non-context-Free Languages. CS215, Lecture 5 c Non-context-Free Languages CS215, Lecture 5 c 2007 1 The Pumping Lemma Theorem. (Pumping Lemma) Let be context-free. There exists a positive integer divided into five pieces, Proof for for each, and..

More information

Properties of Context-free Languages. Reading: Chapter 7

Properties of Context-free Languages. Reading: Chapter 7 Properties of Context-free Languages Reading: Chapter 7 1 Topics 1) Simplifying CFGs, Normal forms 2) Pumping lemma for CFLs 3) Closure and decision properties of CFLs 2 How to simplify CFGs? 3 Three ways

More information

Section 1 (closed-book) Total points 30

Section 1 (closed-book) Total points 30 CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes

More information

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs CSC4510/6510 AUTOMATA 6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs The Pumping Lemma for Context Free Languages One way to prove AnBn is not regular is to use the pumping lemma

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. Theorem. For any context free grammar G; if there is a derivation of w 2 from the

Fall 1999 Formal Language Theory Dr. R. Boyer. Theorem. For any context free grammar G; if there is a derivation of w 2 from the Fall 1999 Formal Language Theory Dr. R. Boyer Week Seven: Chomsky Normal Form; Pumping Lemma 1. Universality of Leftmost Derivations. Theorem. For any context free grammar ; if there is a derivation of

More information

Theory Of Computation UNIT-II

Theory Of Computation UNIT-II Regular Expressions and Context Free Grammars: Regular expression formalism- equivalence with finite automata-regular sets and closure properties- pumping lemma for regular languages- decision algorithms

More information

Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y.

Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y. CSE2001, Fall 2006 1 Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y. S 00S1 A - xay, where x = 2 y.

More information

Context-Free and Noncontext-Free Languages

Context-Free and Noncontext-Free Languages Examples: Context-Free and Noncontext-Free Languages a*b* is regular. A n B n = {a n b n : n 0} is context-free but not regular. A n B n C n = {a n b n c n : n 0} is not context-free The Regular and the

More information

A Note On Minimum Path Bases

A Note On Minimum Path Bases A Note On Minimum Path Bases Petra M. Gleiss a, Josef Leydold b, Peter F. Stadler a,c a Institute for Theoretical Chemistry and Structural Biology, University of Vienna, Währingerstrasse 17, A-1090 Vienna,

More information

CS243, Logic and Computation Nondeterministic finite automata

CS243, Logic and Computation Nondeterministic finite automata CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

More information

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic and Theory of Computing Fuhua (Frank) Cheng Department of Computer Science University of Kentucky 1 Table of Contents: Week 1: Preliminaries (set algebra, relations, functions) (read Chapters

More information

Introduction to Formal Languages, Automata and Computability p.1/42

Introduction to Formal Languages, Automata and Computability p.1/42 Introduction to Formal Languages, Automata and Computability Pushdown Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/42 Introduction We have considered

More information

Blackhole Pushdown Automata

Blackhole Pushdown Automata Fundamenta Informaticae XXI (2001) 1001 1020 1001 IOS Press Blackhole Pushdown Automata Erzsébet Csuhaj-Varjú Computer and Automation Research Institute, Hungarian Academy of Sciences Kende u. 13 17, 1111

More information

MACHINE LEARNING - CS671 - Part 2a The Vapnik-Chervonenkis Dimension

MACHINE LEARNING - CS671 - Part 2a The Vapnik-Chervonenkis Dimension MACHINE LEARNING - CS671 - Part 2a The Vapnik-Chervonenkis Dimension Prof. Dan A. Simovici UMB Prof. Dan A. Simovici (UMB) MACHINE LEARNING - CS671 - Part 2a The Vapnik-Chervonenkis Dimension 1 / 30 The

More information

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata CS/Math 24: Introduction to Discrete Mathematics 4/2/2 Lecture 23 : Nondeterministic Finite Automata Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last time we designed finite state automata

More information

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010 University of Virginia - cs3102: Theory of Computation Spring 2010 PS2 - Comments Average: 77.4 (full credit for each question is 100 points) Distribution (of 54 submissions): 90, 12; 80 89, 11; 70-79,

More information

Chapter 4: Context-Free Grammars

Chapter 4: Context-Free Grammars Chapter 4: Context-Free Grammars 4.1 Basics of Context-Free Grammars Definition A context-free grammars, or CFG, G is specified by a quadruple (N, Σ, P, S), where N is the nonterminal or variable alphabet;

More information

Informal Statement Calculus

Informal Statement Calculus FOUNDATIONS OF MATHEMATICS Branches of Logic 1. Theory of Computations (i.e. Recursion Theory). 2. Proof Theory. 3. Model Theory. 4. Set Theory. Informal Statement Calculus STATEMENTS AND CONNECTIVES Example

More information

Theory of Computer Science

Theory of Computer Science Theory of Computer Science C1. Formal Languages and Grammars Malte Helmert University of Basel March 14, 2016 Introduction Example: Propositional Formulas from the logic part: Definition (Syntax of Propositional

More information

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4 Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form: A BC A a S ε B and C aren t start variables a is

More information

Deciding Whether a Regular Language is Generated by a Splicing System

Deciding Whether a Regular Language is Generated by a Splicing System Deciding Whether a Regular Language is Generated by a Splicing System Lila Kari Steffen Kopecki Department of Computer Science The University of Western Ontario Middlesex College, London ON N6A 5B7 Canada

More information

Theory of Computation 7 Normalforms and Algorithms

Theory of Computation 7 Normalforms and Algorithms Theory of Computation 7 Normalforms and Algorithms Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation

More information

CHAPTER 7. Connectedness

CHAPTER 7. Connectedness CHAPTER 7 Connectedness 7.1. Connected topological spaces Definition 7.1. A topological space (X, T X ) is said to be connected if there is no continuous surjection f : X {0, 1} where the two point set

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. March 13/18, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

NPDA, CFG equivalence

NPDA, CFG equivalence NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described

More information

Warshall s algorithm

Warshall s algorithm Regular Expressions [1] Warshall s algorithm See Floyd-Warshall algorithm on Wikipedia The Floyd-Warshall algorithm is a graph analysis algorithm for finding shortest paths in a weigthed, directed graph

More information

Computational Models - Lecture 3 1

Computational Models - Lecture 3 1 Computational Models - Lecture 3 1 Handout Mode Iftach Haitner. Tel Aviv University. November 14, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3},

(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3}, Code No: 07A50501 R07 Set No. 2 III B.Tech I Semester Examinations,MAY 2011 FORMAL LANGUAGES AND AUTOMATA THEORY Computer Science And Engineering Time: 3 hours Max Marks: 80 Answer any FIVE Questions All

More information

CSE 468, Fall 2006 Homework solutions 1

CSE 468, Fall 2006 Homework solutions 1 CSE 468, Fall 2006 Homework solutions 1 Homework 1 Problem 1. (a) To accept digit strings that contain 481: Q ={λ,4,48, 481}, Σ ={0,1,...,9}, q 0 = λ, A ={481}. To define δ, weuse a for all letters (well,

More information

Epsilon-Free Grammars and Lexicalized Grammars that Generate the Class of the Mildly Context-Sensitive Languages

Epsilon-Free Grammars and Lexicalized Grammars that Generate the Class of the Mildly Context-Sensitive Languages psilon-free rammars and Leicalized rammars that enerate the Class of the Mildly Contet-Sensitive Languages Akio FUJIYOSHI epartment of Computer and Information Sciences, Ibaraki University 4-12-1 Nakanarusawa,

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

More information

0 Sets and Induction. Sets

0 Sets and Induction. Sets 0 Sets and Induction Sets A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a A to denote that a is an element of the set

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form:

More information

3.10. TREE DOMAINS AND GORN TREES Tree Domains and Gorn Trees

3.10. TREE DOMAINS AND GORN TREES Tree Domains and Gorn Trees 3.10. TREE DOMAINS AND GORN TREES 211 3.10 Tree Domains and Gorn Trees Derivation trees play a very important role in parsing theory and in the proof of a strong version of the pumping lemma for the context-free

More information

Convex Sets. Prof. Dan A. Simovici UMB

Convex Sets. Prof. Dan A. Simovici UMB Convex Sets Prof. Dan A. Simovici UMB 1 / 57 Outline 1 Closures, Interiors, Borders of Sets in R n 2 Segments and Convex Sets 3 Properties of the Class of Convex Sets 4 Closure and Interior Points of Convex

More information

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars COMP-330 Theory of Computation Fall 2017 -- Prof. Claude Crépeau Lec. 10 : Context-Free Grammars COMP 330 Fall 2017: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic finite

More information