Ambiguity of context free languages as a function of the word length
|
|
- Antonia Ball
- 6 years ago
- Views:
Transcription
1 Ambiguity of context free languages as a function of the word length Mohamed NAJI MohamedNaji@web.de WWW: Mobile November 1998 Abstract In this paper we discus the concept of ambiguity of context free languages and grammars. We prove the existence of constant ambiguous, exponential ambiguous and polynomial ambiguous languages and we give examples for these classes of ambiguity Contents 1 Introduction 3 2 Preliminaries context free grammar O Notations Ogden s Lemma
2 LIT OF FIGURE 2 3 Ambiguity 5 4 Constant ambiguous languages 7 5 Exponential ambiguous languages 12 6 Polynomial ambiguous languages 18 7 Conclusion 24 references 24 Index 25 List of Figures 1 derivation trees and A pumptrees derivation tree B i with A i pumptree for z i := a h b hh! 1... b hh! i 1 bh i b hh! i1... bhh! k A i on the left of A j in the tree T A i is a descendant of A j in the tree T for z=a hh! b hh! 1 b hh! 2... b hh! k Illustration of the path π i and the factorization z= û i v q i w ix q i ŷi 13 6 a derivation tree B(z) for a word z from {a h b h c hh!, a h b hh! c h } k 15 7 derivation tree T(z) for the word(a hh! b hh! c hh! ) k the A i pumptree is on the left of the Ãi pumptree in T (z, z) A i is a descendant of Ãi a derivation tree B(z) for a word z = z i1 z i2... z ik a derivation tree T(z) for the word (a hh! (b hh! c) p ) k A ij on the left of Aĩj in T (z, z)
3 1 INTRODUCTION 3 13 A ij is a descendant of Aĩj Introduction The concept of ambiguity plays a fundamental role in formal language theory. Measuring the amount of ambiguity in context free grammars is well known; see for example [1, ection 7.3]. We define the ambiguity as a function of the word length 2 Preliminaries We use the following notations and definitions of grammars and languages as introduced in [5]: 2.1 context free grammar A context free grammar (CFG) is a quadruple G=(N, Σ, P, ) where N and Σ are finite disjoint sets of nonterminals and terminals respectively; P is a finite set of productions of the form A α where A N and α (N Σ) ; N is the start symbol. If A α is in P and α 1, α 2 are in (N Σ), then we write α 1 Aα 2 = α 1 αα 2. i = is the i fold product, = is the transitive, = the reflexive and transitive closure of =. The context free language (CFL) generated by G is L(G):= {w Σ = w}. A language L is termed context free if L=L(G) for a CFG G. # a (w) denotes the number of a s in w, w the length of w.
4 2 PRELIMINARIE O Notations Let f, g : N R be functions g = O(f) : ( c R, n o N) : ( n n 0 ) : (g(n) cf(n)) g = Ω(f) : ( c R, n o N) : ( n n 0 ) : (g(n) cf(n)) g = Θ(f) : g = O(f) g = Ω(f) g = 2 O(n) : ( c R, n o N) : ( n n 0 ) : (g(n) 2 cn ) g = 2 Ω(n) : ( c R, n o N) : ( n n 0 ) : (g(n) 2 cn ) g = 2 Θ(n) : g = 2 O(n) and g = 2 Ω(n) 2.3 Ogden s Lemma [5] Let G=(N, Σ, P, ) be a CFG. Then there is a constant h=h(g), such that for every word z L(G) with at least h marked positions, there is a factorization z=uvwxy with: 1. w contains at least one of the marked positions 2. Either u and v both contain marked positions, or x and y both contain marked positions 3. vwx has at most h marked positions 4. A N such that = uay = uvaxy =... integers q 0 = uv q Ax q y = uv q wx q y L(G) for all Remark 2.1 Point (4) of Ogden s Lemma (on page 4) says, that each derivation tree of z=uvwxy in G has a subtree rooted at A which could be
5 3 AMBIGUITY 5 pumped to obtain a derivation tree of uv q wx q y in G for q > 0. We call such a subtree a A pumptree. (see Figure 1 on page 5) u A y pump the A-pumptree q times u A y v A x v q A x q w w Figure 1: derivation trees and A pumptrees 3 Ambiguity Measuring the amount of ambiguity in context free grammars is well known, see for example, [1, ection 7.3]. We define the ambiguity as a function of the word length n. Definition 3.1 (Ambiguity of CFG) Let k > 0 be an arbitrary integer, f : N R be a non constant function and {O, Ω, Θ}. The ambiguity da G (w) of a word w in a CFG G is da G (w):=number of derivation trees (leftmost derivations) 1 of w in G. The ambiguity da G (n) of a CFG G is da G (n):=sup{da G (w) w Σ and w n}. 1 For the definition of derivation and leftmost derivation see [5]
6 3 AMBIGUITY 6 G is at least k ambiguous : There is a word in L(G) for which there is at least k distinct derivation trees in G. G is at most k ambiguous : There is a word with at most k derivation trees in G. G is k ambiguous : (G is at least k ambiguous) and (G is at most k ambiguous). G is polynomial of degree k ambiguous : da G (n) = Θ(n k ). G is exponential ambiguous : da G (n) = 2 Θ(n). G is (f(n)) ambiguous : da G (n) = (f(n)). G is 2 (f(n)) ambiguous : da G (n) = 2 (f(n)). Definition 3.2 (Ambiguity of CFL) Let k > 0 be an arbitrary integer and f : N R be a non constant function. A CFL L is k ambiguous : each CFG for L is at least k ambiguous and there is an at most k ambiguous CFG for L. A CFL L is polynomial of degree k ambiguous : each CFG for L is Ω(n k ) ambiguous and there is a O(n k ) ambiguous CFG for L. A CFL L is exponential ambiguous : each CFG for L is 2 Ω(n) ambiguous and there is a 2 O(n) ambiguous CFG for L. A CFL L is Θ(f(n)) ambiguous : each CFG for L is Ω(f(n)) ambiguous and there is a O(f(n)) ambiguous CFG for L.
7 4 CONTANT AMBIGUOU LANGUAGE 7 Theorem 3.1 For all cycle free 2 CFG G, da G (n) 2 cn for some c > 0. Proof Let G=(N, Σ, P, ) be a cycle free CFG. The number of derivation trees, which can be obtained in i leftmost derivations steps, is at most P i. For every cycle free grammar there are integers a, b such that (A i = w) implies (i a w b) [2, Theorem 4.1]. Thus the number of derivation trees of a word w in a cycle free CFG G is at most P a w b = 2 (anb) log P, where n := w and log denotes the binary logarithm. Remark 3.1 By Theorem 3.1 there isn t any CFL which has an ambiguity bigger than 2 Θ(n) (e. g.θ(n n )). Wich [6] has proven, that there isn t any grammar (and so there isn t any language) with ambiguity bigger than polynomial but smaller than proper exponential (e. g. Θ(2 n )) 4 Constant ambiguous languages Maurer [3] has proven the existence of context free languages which are inherently ambiguous of any degree. We reprove this result using Ogden s Lemma (on page 4) and another (less complicated) language Theorem 4.1 Let k be a constant from N. L k := {a m b m 1 1 b m b m k k m, m 1, m 2,..., m k 1, i with m = m i } is k ambiguous. A. 2 A CFG is cycle free if there is no derivation of the form A = A for any nonterminal
8 4 CONTANT AMBIGUOU LANGUAGE 8 Proof For k=1 we obtain the well known unambiguous language L 1 := {a m b m 1 m 1}. Let k 2, L k = L(G) for some CFG G=(N, Σ, P, ) and h be the constant for G from Ogden s Lemma (on page 4). Now we consider the words z i := a h b h 1 1 b h b h k k with h j := h, if j = i h h!, otherweise, for i = 1,..., k where all the a s are marked. It s not difficult to prove, that for every factorization z i = u i v i w i x i y i satisfying conditions (1)-(4) of Ogden s Lemma (on page 4) ince u i = a r i 1 r i h 2, v i = a s i 1 s i h 2, w i = a h s i r i b hh! 1... b hh! i 1 bt i i 0 t i h 1, x i = b s i i y i = b h s i t i i b hh! i1... bhh! k. = u i A i y i = u i v i A i x i y i = u i v i w i x i y i = z i, every derivation tree B i of z i in G has an A i pumptree (see Figure 2 on page 9)
9 4 CONTANT AMBIGUOU LANGUAGE 9 u i A i y i a r i b h s i t i i b hh! i1...bhh! k v i A i x i a s i w i b s i i a h s i r i b hh! 1...b hh! i 1 bt i i Figure 2: derivation tree B i with A i pumptree for z i := a h b hh! 1... b hh! i 1 bh i b hh! i1... bhh! k We pump the A i pumptree (of the derivation tree B i ) q i := h! s i 1 times, we obtain a derivation tree T i for the word z := a hh! b hh! 1 b hh! 2... b hh! k in G. ince i=1,...,k, we obtain k derivation trees T 1, T 2,..., T k for the word z := a hh! b hh! 1 b hh! 2... b hh! k in G. We now prove that these k derivation trees are distinct. uppose there are i, j {1,..., k} with i j but T i = T j = T. The derivation tree T must have both nodes A i (because T = T i ) and nodes A j (because T = T j ). Case 1: Neither A i nor A j appears (in the tree T) as a descendant of the other. w. l. o. g. A i appears on the left of A j (see Figure 3 on page 10) The frontier of T is a word in which b s would precede a s and hence is
10 4 CONTANT AMBIGUOU LANGUAGE 10 not in L k, a contradiction (see Figure 3 on page 10) u i A i w A j y j v q i i w i x q i i v q j j w j x q j j b i a Figure 3: A i on the left of A j in the tree T other Case 2: Either A i or A j appears (in the tree T) as a descendant of the w. l. o. g. A i is a descendant of A j. (see Figure 4 on page 11)
11 4 CONTANT AMBIGUOU LANGUAGE 11 u j A j y j v q j j A j x q j j u A i y v q i i A i x q i i w i Figure 4: A i is a descendant of A j in the tree T for z=a hh! b hh! 1 b hh! 2... b hh! k We obtain: = u j A j y j = u j v q j j A jx q j j y j = u j v q j j ua iyx q j j y j = u j v q j j uvq i i w ix q i i yxq j j y j = z L k where # a (z) = # br (z) = h h! r {1,..., i,..., j,..., k} But if we pump the A i pumptree of the A j pumptree (in the tree T),
12 5 EXPONENTIAL AMBIGUOU LANGUAGE 12 then we obtain: = u j A j y j = u j v q j1 j A j x q j1 j y j = u j v q j1 j ua i yx q j1 j y j = u j v q j1 j uv q i1 i w i x q i1 i yx q j1 j y j := z L k where: # a ( z) = # a (z) v j v i = h h! v j v i # bi ( z) = # bi (z) x i = h h! v i # bj ( z) = # bj (z) x j = h h! v j # br ( z) = # br (z) = h h! Thus r {1,..., k}, # a ( z) # br ( z), a contradiction of u j v q j1 j uv q i1 i w i x q i1 i yx q j1 j y j := z L k. Each CFG for L k is therefore at least k ambiguous. It is not difficult to give an at most k ambiguous CFG for L k. An at most k ambiguous CFG for L k can be found in [4]. 5 Exponential ambiguous languages Theorem 5.1 Let L = {a i b i c j i, j 1} {a i b j c i i, j 1}. L is exponential ambiguous. Proof Let L =L(G) for a CFG G=(N, Σ, P, ) and h be the constant from Ogden s Lemma (on page 4) for G. We consider the words of L of the form
13 5 EXPONENTIAL AMBIGUOU LANGUAGE 13 z = z 1 z 2... z k, where z i {a h b h c hh!, a h b hh! c h } i {1,..., k} and mark all the a s. ince the number of the marked positions in each z i is equal to h, for each given i we can find a factorization z = û i v i w i x i ŷ i and we can construct a path π i in each derivation tree B(z) for z in G (with the same idea as the well known proof of Ogden s Lemma [5, Theorem 2.24]) such that: 1. w i contains at least one of the marked positions of z i 2. Either û i and v i both contain marked positions of z i, or x i and ŷ i both contain marked positions of z i. 3. v i w i x i has at most h marked positions of z i. 4. = û i A i ŷ i = û i v i A i x i ŷ i =... = û i v q i A ix q i ŷi = û i v q i w ix q i ŷi L for all integers q 0 The situation is depicted in Figure (see Figure 5 on page 13) û i A i ŷ i v i A i x i w i Figure 5: Illustration of the path π i and the factorization z= û i v q i w ix q i ŷi
14 5 EXPONENTIAL AMBIGUOU LANGUAGE 14 We can further prove: z i = a h b h c hh! : û i = z 1... z i 1 u i u i = a r i and 1 r i h 2, v i = a s i 1 s i h 2, w i = a h r i s i b h s i t i 0 t i h 1, x i = b s i ŷ i = y i z i1... z k y i = b t i c hh!. z i = a h b hh! c h : û i = z 1... z i 1 u i u i = a r i and 1 r i h 2, v i = a s i 1 s i h 2, w i = a h r i s i b hh! c t i 0 t i h 1, x i = c s i ŷ i = y i z i1... z k y i = c h t i s i. The proof is straightforward and will be omitted here, you can see [4] ince A i = v i A i x i, the derivation tree B(z) has an A i pumptree, whose frontier v i w i x i is a subword of z i. We can use this argumentation for each i {1,..., k}, thus the derivation tree B(z) consists of the k A 1, A 2,..., A k pumptrees, which are in B(z) parallel to themselves. (see Figure 6 on page 15)
15 5 EXPONENTIAL AMBIGUOU LANGUAGE 15 u 1 A 1 A 2... A k v 1 A 1 x 1 v 2 A 2 x 2 v k A k x k w 1 w 2 w k Figure 6: a derivation tree B(z) for a word z from {a h b h c hh!, a h b hh! c h } k If we pump each A i pumptree in the tree B(z) q i := h! s i 1 times, we will obtain a derivation tree T(z) for the word (a hh! b hh! c hh! ) k (see Figure 7 on page 15) u 1 A 1 A 2... A k v q 1 1 A 1 x q 1 1 v q 2 2 A 2 x q 2 2 v q k k A k x q k k w 1 w 2 w k Figure 7: derivation tree T(z) for the word(a hh! b hh! c hh! ) k ince there are 2 k words of the form z = z 1 z 2... z k where z i {a h b h c hh!, a h b hh! c h } i {1, 2,..., k}, there are 2 k derivation trees of the form T(z) for the word (a hh! b hh! c hh! ) k.
16 5 EXPONENTIAL AMBIGUOU LANGUAGE 16 We now prove that these 2 k derivation trees are distinct. uppose there are z = z 1 z 2... z k and z = z 1 z 2... z k where z i, z i {a h b h c hh!, a h b hh! c h } with z z but T (z) = T ( z) = T (z, z). z z implies there is i {1,..., k} with z i z i. W. l. o. g. let z i = a h b h c hh! and z i = a h b hh! c h. The tree T (z, z) must have both an A i pumptree (because T (z, z)=t(z)) and an Ãi pumptree (because T (z, z)=t ( z)). We discuss the two following cases. Case 1: Neither the A i pumptree nor the Ãi pumptree is a subtree of the other. w. l. o. g. the A i pumptree is on the left of the Ãi pumptree in the tree T (z, z) (see Figure 8 on page 16) (a hh! b hh! c hh! ) i 1 u i A i y i wũ i à i ỹ i (a hh! b hh! c hh! ) k i v q i i w i x q i i ṽ q i i w x q i i i Figure 8: the A i pumptree is on the left of the Ãi pumptree in T (z, z) The frontier of the tree T (z, z) would have at least (k1) subwords of the form a hh! b hh! c hh!. But the frontier of T (z, z) is the word (a hh! b hh! c hh! ) k, a contradiction. Case 2: Either the Ãi pumptree or the A i pumptree is a subtree of the other
17 5 EXPONENTIAL AMBIGUOU LANGUAGE 17 w. l. o. g. A i is a descendant of Ãi (see Figure 9 on page 17) (a hh! b hh! c hh! ) i 1 ũ i à i ỹ i (a hh! b hh! c hh! ) k i ṽ i q i à i x i q i u A i y v q i i w i x q i i Figure 9: A i is a descendant of Ãi We obtain here: = (a hh! b hh! c hh! ) i 1 ũ i ṽ i q i à i x i qiỹ i (a hh! b hh! c hh! ) k i = (a hh! b hh! c hh! ) i 1 ũ i ṽ i q i ua i y x i qiỹ i (a hh! b hh! c hh! ) k i = (a hh! b hh! c hh! ) i 1 ũ i ṽ i q i uv q i i A ix q i i y x i qiỹ i (a hh! b hh! c hh! ) k i = (a hh! b hh! c hh! ) i 1 q ũ i ṽ i i uv q i i w ix q i i y x qiỹ i }{{} i (a hh! b hh! c hh! ) k i t 1 = (a hh! b hh! c hh! ) i 1 t 1 (a hh! b hh! c hh! ) k i L. ince the frontier of T (z, z) is the word (a hh! b hh! c hh! ) k, t 1 = a hh! b hh! c hh!.
18 6 POLYNOMIAL AMBIGUOU LANGUAGE 18 However if we pump the A i pumptree and the Ãi pumptree in the tree T (z, z), then we obtain: = (a hh! b hh! c hh! ) i 1 ũ i ṽ i q i 1 Ã i x i q i 1ỹ i (a hh! b hh! c hh! ) k i = (a hh! b hh! c hh! ) i 1 ũ i ṽ i q i 1 ua i y x i q i 1ỹ i (a hh! b hh! c hh! ) k i = (a hh! b hh! c hh! ) i 1 q ũ i ṽ i 1 i uv q i1 i A i x q i1 q i y x i 1ỹ i i (a hh! b hh! c hh! ) k i = (a hh! b hh! c hh! ) i 1 q ũ i ṽ i 1 i uv q i1 i w i x q i1 q i y x i 1ỹ }{{ i } i (a hh! b hh! c hh! ) k i = (a hh! b hh! c hh! ) i 1 t 2 (a hh! b hh! c hh! ) k i L. t 2 # a (t 2 ) = # a (t 1 ) ṽ i v i = h h! ṽ i v i # b (t 2 ) = # a (t 1 ) x i = h h! v i # c (t 2 ) = # a (t 1 ) x i = h h! ṽ i Thus # a (t 2 ) # b (t 2 ) and # a (t 2 ) # c (t 2 ) and therefore t 2 / L. A contradiction of = (a hh! b hh! c hh! ) i 1 t 2 (a hh! b hh! c hh! ) k i L. We can now conclude, that the 2 k derivation trees are distinct, and each CFG for L is therefore 2 Ω(n) ambiguous. By Theorem 3.1 (on page 7) and Remark 3.1 (on page 7) there isn t any language, which has an ambiguity bigger than 2 Θ(n). Thus L is exponential ambiguous. 6 Polynomial ambiguous languages Theorem 6.1 Let L := {a m b m 1 cb m 2 c... b m p c p N; m, m 1, m 2,..., m p N; i {1, 2,..., p} with m = m i }. L k is polynomial of degree k ambiguous. Proof Let L k = L(G) for some CFG G=(N, Σ, P, ) and h be the constant for G from Ogden s Lemma (on page 4). Now we consider the words of L k
19 6 POLYNOMIAL AMBIGUOU LANGUAGE 19 of the form z = z i1 z i2... z ik where z ij := a h (b hh! c) ij 1 b h c(b hh! c) p i j, j=1,...,k and i j = 1,..., p and mark all the a s in each z iα with α {1, 2,..., k}. imilar to the proof of Theorem 6.1 we can prove, that each derivation tree B(z) for z in G consists of k A i1, A i2, A ik pumptrees, which are parallel to themselves in the tree B(z). (see Figure 10 on page 19) u i1 A i1 A i2... A ik v i1 A i1 x i1 v i2 A i2 x i2 v ik A ik x ik w i1 w i2 w ik Figure 10: a derivation tree B(z) for a word z = z i1 z i2... z ik We now pump each A ij pumptree of the tree B(z) q ij = h! s ij 1 times, we obtain a derivation tree T(z) for the word (a hh! (b hh! c) p ) k. (see Figure 11 on page 20)
20 6 POLYNOMIAL AMBIGUOU LANGUAGE 20 u i1 A i1 A i2... A ik v q i 1 i 1 A i1 x q i 1 i 1 v q i 2 i 2 A i2 x q i 2 i 2 v q i k i k A ik x q i k i k w i1 w i2 w ik Figure 11: a derivation tree T(z) for the word (a hh! (b hh! c) p ) k ince there are p k words of the form z = z i1 z i2... z ik where z ij := a h (b hh! c) i j 1 b h c(b hh! c) p i j, j=1,...,k and i j = 1,..., p, there are p k derivation trees of the form T(z). We now prove, that these p k derivation trees of the form T(z) are distinct. uppose there are z = z i1 z i2... z ik where z ij := a h (b hh! c) ij 1 b h c(b hh! c) p i j and z = zĩ1 zĩ2... zĩk where zĩj := a h (b hh! c)ĩj 1 b h c(b hh! c) p z z implies there is j such that i j. The tree T (z, z) must have both an A ij pumptree (because T (z, z)=t(z)) and an Aĩj pumptree (because T (z, z)=t ( z). We discuss the two following
21 6 POLYNOMIAL AMBIGUOU LANGUAGE 21 cases. Case 1: Neither the A ij pumptree nor the Aĩj pumptree is a subtree of the other w. l. o. g. the A ij pumptree is on the left of the Aĩj pumptree in the tree T (z, z) (see Figure 12 on page 21) (a hh! (b hh! c) p ) i j 1 u ij A ij y ij wuĩj Aĩj yĩj (a hh! (b hh! c) p ) k v q i j i j w ij x q i j i j v q wĩj x q Figure 12: A ij on the left of Aĩj in T (z, z) The frontier of the tree T (z, z) would have at least (k1) subtrees of the form a hh! (b hh! c) p. But the frontier of the tree T (z, z) is the word (a hh! (b hh! c) p ) k, a contradiction. Case 2: Either the A ij pumptree or the Aĩj pumptree is a subtree of the other w. l. o. g. A ij is a descendant of Aĩj (see Figure 13 on page 22)
22 6 POLYNOMIAL AMBIGUOU LANGUAGE 22 (a hh! (b hh! c) p )ĩj 1 uĩj Aĩj yĩj (a hh! (b hh! c) p ) k v q Aĩj x q u A ij y v q i j i j w ij x q i j i j Figure 13: A ij is a descendant of Aĩj We obtain here: = (a hh! (b hh! c) p )ĩj 1 uĩj v q i j Aĩj x q yĩj (a hh! (b hh! c) p ) k = (a hh! (b hh! c) p )ĩj 1 uĩj v q = (a hh! (b hh! c) p )ĩj 1 uĩj v q ua ij yx q yĩj (a hh! (b hh! c) p ) k uv q i j i j A ij x q i j i j = (a hh! (b hh! c) p )ĩj 1 uĩj v q uv q i j i j w ij x q i j i j yx q yĩj ĩ }{{ j } t 1 = (a hh! (b hh! c) p )ĩj 1 t 1 (a hh! (b hh! c) p ) k L k yx q yĩj (a hh! (b hh! c) p ) k (ahh! (bhh! c)p )k ĩj ince the frontier of T (z, z) is the word (a hh! (b hh! c) p ) k, t 1 = a hh! (b hh! c) p. if we pump however the A i pumptree and the Ãi pumptree in the tree T (z, z), then we obtain:
23 6 POLYNOMIAL AMBIGUOU LANGUAGE 23 = (a hh! (b hh! c) p )ĩj 1 uĩj v q ĩ 1 j = (a hh! (b hh! c) p )ĩj 1 uĩj v q ĩ 1 j = (a hh! (b hh! c) p )ĩj 1 uĩj v q ĩ 1 j = (a hh! (b hh! c) p )ĩj 1 uĩj v q ĩ 1 j yĩj (a hh! (b hh! c) p ) k ua ĩ ij yx q ĩ 1 j yĩj (a hh! (b hh! c) p ) k j Aĩj x q ĩ 1 j uv q i j 1 i j A ij x q i j 1 uv q i j 1 i j w ij x q i j 1 }{{} t 2 = (a hh! (b hh! c) p )ĩj 1 t 2 (a hh! (b hh! c) p ) k L k i j yx q ĩ 1 j yĩj (a hh! (b hh! c) p ) k i j yx q ĩ 1 j yĩj (ahh!(bhh! c)p )k ĩj # a (t 2 ) = # a (t 1 ) vĩj v ij = h h! vĩj v ij The number of the b s in each b Block of t 2 is either hh! or hh! xĩj or h h! x ij and therefore unequal to the numbere of the a s in t 2. Thus t 2 / L. This is a contradiction to (a hh! (b hh! c) p )ĩj 1 t 2 (a hh! (b hh! c) p ) k L k. We can conclude, that the word a hh! (b hh! c) p ) k has at least p k derivation trees in G. ince n := (a hh! (b hh! c) p ) k = k(p(hh!1)hh!), da G (n) = Ω(n k ). The grammar with the productions: E k E at bca at bc T at b ε A A ba bca bc produces L k and is O(n k ) ambiguous. [4]
24 7 CONCLUION 24 7 Conclusion From this work we obtain the following classes of CFL: constant ambiguous languages: e.g. L k := {a m b m 1 1 b m b m k k m, m 1, m 2,..., m k 1, i with m = m i } polynomial ambiguous languages: e.g. L k where L := {a m b m 1 cb m 2 c... b mp c p N; m, m 1, m 2,..., m p N; i {1, 2,..., p} with m = m i } subbexponential ambiguous languages (e.g. Θ(2 n ) ambiguous languages): There isn t any language exponential ambiguous languages: e.g. 1} {a i b j c i i, j 1} L where L = {a i b i c j i, j Languages, whose ambiguity bigger than exponential (e.g. Θ(n n ) ambiguous languages): There isn t any language However there remain the following questions: 1. Is there any Θ(n r ) ambiguous languages, where r is a non natural number? 2. Is there any sublinear ambiguous languages (e. g. Θ(log(n)) ambiguous languages)? References [1] M. A. Harrison, Introduction to Formal language Theory, Addison Wesley, 1978.
25 REFERENCE 25 [2]. Heilbrunner, Parsing automata approach to LR theory, Theoret. Comput. ci. (1981), no. 15, [3] H. Maurer, The existence of context free languages which are inherently ambiguous of any degree, Department of Mathematics Research eries; University of Calgary, (1968). [4] M. Naji, Der Grad der Mehrdeutigkeit kontextfreier Grammatiken und prachen, Master s thesis, Fachbereich Informatik; Universität Frankfurt am Main, [5] A. V. Aho & J. D. Ullman, The Theory of Parsing, Translation and Compiling, Prentice Hall, [6] K. Wich, Kriterien für die Mehrdeutigkeit kontextfreier Grammatiken, Master s thesis, Fachbereich Informatik; Universität Frankfurt am Main, 1997.
26 Index A ambiguity, 3, 5 G grammar context free, 3 cycle free, 7 L language constant ambiguous, 7 context free, 3 exponential ambiguous, 12 polynomial ambiguous, 18 O Ogden s Lemma, 4 P pumptree, 5 26
Einführung in die Computerlinguistik
Einführung in die Computerlinguistik Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2016 1 / 22 CFG (1) Example: Grammar G telescope : Productions: S NP VP NP
More informationThe 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 informationParsing. 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 informationEinführung in die Computerlinguistik
Einführung in die Computerlinguistik Context-Free Grammars formal properties Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2018 1 / 20 Normal forms (1) Hopcroft and Ullman (1979) A normal
More informationContext-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 informationContext-Free Grammars and Languages. We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs.
Context-Free Grammars and Languages We have seen that many languages cannot be regular. Thus we need to consider larger classes of langs. Contex-Free Languages (CFL s) played a central role natural languages
More informationChap. 7 Properties of Context-free Languages
Chap. 7 Properties of Context-free Languages 7.1 Normal Forms for Context-free Grammars Context-free grammars A where A N, (N T). 0. Chomsky Normal Form A BC or A a except S where A, B, C N, a T. 1. Eliminating
More informationEinführung in die Computerlinguistik Kontextfreie Grammatiken - Formale Eigenschaften
Normal forms (1) Einführung in die Computerlinguistik Kontextfreie Grammatiken - Formale Eigenschaften Laura Heinrich-Heine-Universität Düsseldorf Sommersemester 2013 normal form of a grammar formalism
More informationCS375: 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 informationCS20a: summary (Oct 24, 2002)
CS20a: summary (Oct 24, 2002) Context-free languages Grammars G = (V, T, P, S) Pushdown automata N-PDA = CFG D-PDA < CFG Today What languages are context-free? Pumping lemma (similar to pumping lemma for
More informationProperties of Context-Free Languages
Properties of Context-Free Languages Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr
More informationComputational 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 informationFoundations 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 informationOn decision problems for timed automata
On decision problems for timed automata Olivier Finkel Equipe de Logique Mathématique, U.F.R. de Mathématiques, Université Paris 7 2 Place Jussieu 75251 Paris cedex 05, France. finkel@logique.jussieu.fr
More informationNon-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 informationChapter 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 informationContext-free Grammars and Languages
Context-free Grammars and Languages COMP 455 002, Spring 2019 Jim Anderson (modified by Nathan Otterness) 1 Context-free Grammars Context-free grammars provide another way to specify languages. Example:
More information6.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 information60-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 informationProperties 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 informationCOMP-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 informationContext Free Languages and Grammars
Algorithms & Models of Computation CS/ECE 374, Fall 2017 Context Free Languages and Grammars Lecture 7 Tuesday, September 19, 2017 Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 36 What stack got to do
More informationCPS 220 Theory of Computation
CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of
More informationProperties of context-free Languages
Properties of context-free Languages We simplify CFL s. Greibach Normal Form Chomsky Normal Form We prove pumping lemma for CFL s. We study closure properties and decision properties. Some of them remain,
More informationSolution. 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 informationGrammar formalisms Tree Adjoining Grammar: Formal Properties, Parsing. Part I. Formal Properties of TAG. Outline: Formal Properties of TAG
Grammar formalisms Tree Adjoining Grammar: Formal Properties, Parsing Laura Kallmeyer, Timm Lichte, Wolfgang Maier Universität Tübingen Part I Formal Properties of TAG 16.05.2007 und 21.05.2007 TAG Parsing
More informationThis 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 informationChapter 16: Non-Context-Free Languages
Chapter 16: Non-Context-Free Languages Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter
More informationTAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar
TAFL 1 (ECS-403) Unit- III 3.1 Definition of CFG (Context Free Grammar) and problems 3.2 Derivation 3.3 Ambiguity in Grammar 3.3.1 Inherent Ambiguity 3.3.2 Ambiguous to Unambiguous CFG 3.4 Simplification
More informationComputational 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 informationIntroduction 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 informationSection 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 informationContext-Free Grammars. 2IT70 Finite Automata and Process Theory
Context-Free Grammars 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 18, 2016 Generating strings language L 1 = {a n b n n > 0} ab L 1 if w L 1 then awb L 1 production rules
More informationTHEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET
THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages
More informationContext-Free Grammars and Languages. Reading: Chapter 5
Context-Free Grammars and Languages Reading: Chapter 5 1 Context-Free Languages The class of context-free languages generalizes the class of regular languages, i.e., every regular language is a context-free
More informationContext-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 informationCS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL) Objectives Introduce Pumping Lemma for CFL Apply Pumping Lemma to show that some languages are non-cfl Pumping Lemma
More informationContext-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 informationLanguages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:
Languages A language is a set (usually infinite) of strings, also known as sentences Each string consists of a sequence of symbols taken from some alphabet An alphabet, V, is a finite set of symbols, e.g.
More informationGenerating All Circular Shifts by Context-Free Grammars in Greibach Normal Form
Generating All Circular Shifts by Context-Free Grammars in Greibach Normal Form Peter R.J. Asveld Department of Computer Science, Twente University of Technology P.O. Box 17, 7500 AE Enschede, the Netherlands
More informationChapter 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 informationECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam
ECS 120: Theory of Computation Handout MT UC Davis Phillip Rogaway February 16, 2012 Midterm Exam Instructions: The exam has six pages, including this cover page, printed out two-sided (no more wasted
More informationMA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation Bottom-up parsing Pumping Theorem for CFLs Recap: Going One Way Lemma: Each context-free language is accepted by some PDA. Proof (by construction): The idea: Let the stack
More informationNPDA, 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 informationContext 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 informationAutomata Theory CS F-08 Context-Free Grammars
Automata Theory CS411-2015F-08 Context-Free Grammars David Galles Department of Computer Science University of San Francisco 08-0: Context-Free Grammars Set of Terminals (Σ) Set of Non-Terminals Set of
More informationComputational 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 informationCS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA) Objectives Introduce the Pumping Lemma for CFL Show that some languages are non- CFL Discuss the DPDA, which
More informationChapter 1. Formal Definition and View. Lecture Formal Pushdown Automata on the 28th April 2009
Chapter 1 Formal and View Lecture on the 28th April 2009 Formal of PA Faculty of Information Technology Brno University of Technology 1.1 Aim of the Lecture 1 Define pushdown automaton in a formal way
More informationFunctions on languages:
MA/CSSE 474 Final Exam Notation and Formulas page Name (turn this in with your exam) Unless specified otherwise, r,s,t,u,v,w,x,y,z are strings over alphabet Σ; while a, b, c, d are individual alphabet
More informationThe 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 informationChomsky 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 informationLinear 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 informationIntroduction to Algorithms
Introduction to Algorithms (2 nd edition) by Cormen, Leiserson, Rivest & Stein Chapter 3: Growth of Functions (slides enhanced by N. Adlai A. DePano) Overview Order of growth of functions provides a simple
More informationAC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014
Q.2 a. Show by using Mathematical Induction that n i= 1 i 2 n = ( n + 1) ( 2 n + 1) 6 b. Define language. Let = {0; 1} denote an alphabet. Enumerate five elements of the following languages: (i) Even binary
More informationCOMP 382: Reasoning about algorithms
Fall 2014 Unit 4: Basics of complexity analysis Correctness and efficiency So far, we have talked about correctness and termination of algorithms What about efficiency? Running time of an algorithm For
More informationAutomata Theory. CS F-10 Non-Context-Free Langauges Closure Properties of Context-Free Languages. David Galles
Automata Theory CS411-2015F-10 Non-Context-Free Langauges Closure Properties of Context-Free Languages David Galles Department of Computer Science University of San Francisco 10-0: Fun with CFGs Create
More informationFall 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 informationEECS 477: Introduction to algorithms. Lecture 5
EECS 477: Introduction to algorithms. Lecture 5 Prof. Igor Guskov guskov@eecs.umich.edu September 19, 2002 1 Lecture outline Asymptotic notation: applies to worst, best, average case performance, amortized
More informationIntroduction and Motivation. Introduction and Motivation. Introduction to Computability. Introduction and Motivation. Theory. Lecture5: Context Free
ntroduction to Computability Theory Lecture5: Context Free Languages Prof. Amos sraeli 1 ntroduction and Motivation n our study of RL-s we Covered: 1. Motivation and definition of regular languages. 2.
More informationGenerating All Permutations by Context-Free Grammars in Chomsky Normal Form
Generating All Permutations by Context-Free Grammars in Chomsky Normal Form Peter R.J. Asveld Department of Computer Science, Twente University of Technology P.O. Box 217, 7500 AE Enschede, the Netherlands
More informationHarvard 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 informationSuppose h maps number and variables to ɛ, and opening parenthesis to 0 and closing parenthesis
1 Introduction Parenthesis Matching Problem Describe the set of arithmetic expressions with correctly matched parenthesis. Arithmetic expressions with correctly matched parenthesis cannot be described
More informationGenerating All Circular Shifts by Context-Free Grammars in Chomsky Normal Form
Generating All Circular Shifts by Context-Free Grammars in Chomsky Normal Form Peter R.J. Asveld Department of Computer Science, Twente University of Technology P.O. Box 217, 7500 AE Enschede, the Netherlands
More informationSolution to CS375 Homework Assignment 11 (40 points) Due date: 4/26/2017
Solution to CS375 Homework Assignment 11 (40 points) Due date: 4/26/2017 1. Find a Greibach normal form for the following given grammar. (10 points) S bab A BAa a B bb Ʌ Solution: (1) Since S does not
More informationTheory of Computation (IV) Yijia Chen Fudan University
Theory of Computation (IV) Yijia Chen Fudan University Review language regular context-free machine DFA/ NFA PDA syntax regular expression context-free grammar Pushdown automata Definition A pushdown automaton
More informationAnalysis of Algorithms - Using Asymptotic Bounds -
Analysis of Algorithms - Using Asymptotic Bounds - Andreas Ermedahl MRTC (Mälardalens Real-Time Research Center) andreas.ermedahl@mdh.se Autumn 004 Rehersal: Asymptotic bounds Gives running time bounds
More informationParsing. Probabilistic CFG (PCFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 22
Parsing Probabilistic CFG (PCFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Winter 2017/18 1 / 22 Table of contents 1 Introduction 2 PCFG 3 Inside and outside probability 4 Parsing Jurafsky
More informationBefore We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?
Before We Start The Pumping Lemma Any questions? The Lemma & Decision/ Languages Future Exam Question What is a language? What is a class of languages? Context Free Languages Context Free Languages(CFL)
More informationTheory of Computation 8 Deterministic Membership Testing
Theory of Computation 8 Deterministic Membership Testing Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation
More informationA representation of context-free grammars with the help of finite digraphs
A representation of context-free grammars with the help of finite digraphs Krasimir Yordzhev Faculty of Mathematics and Natural Sciences, South-West University, Blagoevgrad, Bulgaria Email address: yordzhev@swu.bg
More informationHarvard 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 informationGenerating All Permutations by Context-Free Grammars in Chomsky Normal Form
Generating All Permutations by Context-Free Grammars in Chomsky Normal Form Peter R.J. Asveld Department of Computer Science, Twente University of Technology P.O. Box 217, 7500 AE Enschede, the Netherlands
More informationAlgorithms and Theory of Computation. Lecture 2: Big-O Notation Graph Algorithms
Algorithms and Theory of Computation Lecture 2: Big-O Notation Graph Algorithms Xiaohui Bei MAS 714 August 14, 2018 Nanyang Technological University MAS 714 August 14, 2018 1 / 20 O, Ω, and Θ Nanyang Technological
More informationDivide and Conquer algorithms
Divide and Conquer algorithms Another general method for constructing algorithms is given by the Divide and Conquer strategy. We assume that we have a problem with input that can be split into parts in
More informationNotes for Comp 497 (454) Week 10
Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free
More informationd(ν) = max{n N : ν dmn p n } N. p d(ν) (ν) = ρ.
1. Trees; context free grammars. 1.1. Trees. Definition 1.1. By a tree we mean an ordered triple T = (N, ρ, p) (i) N is a finite set; (ii) ρ N ; (iii) p : N {ρ} N ; (iv) if n N + and ν dmn p n then p n
More informationCS473 - Algorithms I
CS473 - Algorithms I Lecture 2 Asymptotic Notation 1 O-notation: Asymptotic upper bound f(n) = O(g(n)) if positive constants c, n 0 such that 0 f(n) cg(n), n n 0 f(n) = O(g(n)) cg(n) f(n) Asymptotic running
More informationComputational 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 informationPUSHDOWN AUTOMATA (PDA)
PUSHDOWN AUTOMATA (PDA) FINITE STATE CONTROL INPUT STACK (Last in, first out) input pop push ε,ε $ 0,ε 0 1,0 ε ε,$ ε 1,0 ε PDA that recognizes L = { 0 n 1 n n 0 } Definition: A (non-deterministic) PDA
More informationCISC 4090 Theory of Computation
CISC 4090 Theory of Computation Context-Free Languages and Push Down Automata Professor Daniel Leeds dleeds@fordham.edu JMH 332 Languages: Regular and Beyond Regular: a b c b d e a Not-regular: c n bd
More informationOgden s Lemma for CFLs
Ogden s Lemma for CFLs Theorem If L is a context-free language, then there exists an integer l such that for any u L with at least l positions marked, u can be written as u = vwxyz such that 1 x and at
More informationContext-Free Grammars. 2IT70 Finite Automata and Process Theory
Context-Free Grammars 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven Quartile2, 2014-2015 Generating strings language L 1 èa n b n Ë n 0 í ab L 1 if w L 1 then awb L 1 2 IT70
More informationTheory of Computation (II) Yijia Chen Fudan University
Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest
More informationSCHEME FOR INTERNAL ASSESSMENT TEST 3
SCHEME FOR INTERNAL ASSESSMENT TEST 3 Max Marks: 40 Subject& Code: Automata Theory & Computability (15CS54) Sem: V ISE (A & B) Note: Answer any FIVE full questions, choosing one full question from each
More informationTHEORY OF COMPUTATION
THEORY OF COMPUTATION There are four sorts of men: He who knows not and knows not he knows not: he is a fool - shun him; He who knows not and knows he knows not: he is simple teach him; He who knows and
More informationCSE 105 Homework 5 Due: Monday November 13, Instructions. should be on each page of the submission.
CSE 05 Homework 5 Due: Monday November 3, 207 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments
More informationFinite 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 informationWeak vs. Strong Finite Context and Kernel Properties
ISSN 1346-5597 NII Technical Report Weak vs. Strong Finite Context and Kernel Properties Makoto Kanazawa NII-2016-006E July 2016 Weak vs. Strong Finite Context and Kernel Properties Makoto Kanazawa National
More informationÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK. 17 april Classrum Edition
ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK 7 april 23 Classrum Edition CONTEXT FREE LANGUAGES & PUSH-DOWN AUTOMATA CONTEXT-FREE GRAMMARS, CFG Problems Sudkamp Problem. (3.2.) Which language generates the
More informationLecture 11 Context-Free Languages
Lecture 11 Context-Free Languages COT 4420 Theory of Computation Chapter 5 Context-Free Languages n { a b : n n { ww } 0} R Regular Languages a *b* ( a + b) * Example 1 G = ({S}, {a, b}, S, P) Derivations:
More informationSYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES
Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,
More informationTree Adjoining Grammars
Tree Adjoining Grammars TAG: Parsing and formal properties Laura Kallmeyer & Benjamin Burkhardt HHU Düsseldorf WS 2017/2018 1 / 36 Outline 1 Parsing as deduction 2 CYK for TAG 3 Closure properties of TALs
More informationCOMPUTER ALGORITHMS. Athasit Surarerks.
COMPUTER ALGORITHMS Athasit Surarerks. Introduction EUCLID s GAME Two players move in turn. On each move, a player has to write on the board a positive integer equal to the different from two numbers already
More information5/10/16. Grammar. Automata and Languages. Today s Topics. Grammars Definition A grammar G is defined as G = (V, T, P, S) where:
Grammar Automata and Languages Grammar Prof. Mohamed Hamada oftware Engineering Lab. The University of Aizu Japan Regular Grammar Context-free Grammar Context-sensitive Grammar Left-linear Grammar right-linear
More informationProblem 2.6(d) [4 pts] Problem 2.12 [3pts] Original CFG:
Problem 2.6(d) [4 pts] S X T#X X#T T#X#T X axa bxb #T# # T at bt #T ε Problem 2.12 [3pts] Original CFG: R XRX S S atb bta T XTX X ε X a b q start ε, ε $ ε, R X ε, ε R ε, ε X ε, R S ε, T X ε, T ε ε, X a
More informationPlan for 2 nd half. Just when you thought it was safe. Just when you thought it was safe. Theory Hall of Fame. Chomsky Normal Form
Plan for 2 nd half Pumping Lemma for CFLs The Return of the Pumping Lemma Just when you thought it was safe Return of the Pumping Lemma Recall: With Regular Languages The Pumping Lemma showed that if a
More informationComputational 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 informationCS Non-recursive and Recursive Algorithm Analysis
CS483-04 Non-recursive and Recursive Algorithm Analysis Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/
More informationDefinition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where
Recitation 11 Notes Context Free Grammars Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x A V, and x (V T)*. Examples Problem 1. Given the
More information