Generating All Circular Shifts by Context-Free Grammars in Greibach Normal Form

Size: px
Start display at page:

Download "Generating All Circular Shifts by Context-Free Grammars in Greibach Normal Form"

Transcription

1 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 Abstract For each alphabet Σ n = {a 1,a,...,a n }, linearly ordered by a 1 < a < < a n, let C n be the language of circular or cyclic shifts over Σ n, i.e., C n = {a 1 a a n 1 a n, a a 3 a n a 1,...,a n a 1 a n a n 1 }. We study a few families of context-free grammars G n (n 1) in Greibach normal form such that G n generates C n. The members of these grammar families are investigated with respect to the following descriptional complexity measures: the number of nonterminals ν(n), the number of rules π(n) and the number of leftmost derivations δ(n) of G n. As in the case of Chomsky normal form, these ν, π and δ are functions bounded by low-degree polynomials. However, the question whether there exists a family of grammars that is minimal with respect to all these measures remains open. Keywords: context-free grammar, Greibach normal form, permutation, circular shift, cyclic shift, descriptional complexity, unambiguous grammar. 1 Introduction Let Σ n = {a 1, a,...,a n } be an alphabet, linearly ordered by a 1 < a < < a n, and let L n be the language over Σ n of the n! permutations of a 1 a a n. In 00 G. Satta [15] conjectured that any context-free grammar G n in Chomsky normal form (CNF) that generates L n must have a number of nonterminal symbols that is not bounded by any polynomial function in n. This statement has been proved in [9], but without showing how to generate {L n } n 1 by context-free grammars {G n } n 1 in CNF. In [] we provided several grammar families for {L n } n 1 together with the usual descriptional complexity measures as the number of nonterminals ν(n) and the number of rules π(n); cf. [11, 13, 14, 7, 5, 1, 6] for

2 Peter R.J. Asveld these measures. The relative descriptional complexity of these grammar families is anything but straightforward and the quest for a family of minimal grammars (with respect to these complexity measures) remains a challenging problem. Then in [3] we investigated some specific permutations over Σ n, viz. the circular or cyclic shifts, defined by C n = {a 1 a a n 1 a n, a a 3 a n a 1, a 3 a 4 a 1 a,...,a n a 1 a n a n 1 }. An alternative definition of C n in terms of the so-called circular closure operator c on languages L, which is defined by c(l) = {vu uv L} [8], is: C n = c({a 1 a a n }). The fact that the n elements of C n is much less than the n! elements of L n is also reflected by the complexity measures of the corresponding grammar families: for {L n } n 1, the functions ν(n) and π(n) are exponential functions [15, 9, ], whereas for {C n } n 1, they are bounded by low-degree polynomial functions; cf. [3]. In this paper we investigate a few ways of generating the family {C n } n 1 by contextfree grammars in Greibach normal form (GNF) and for these families of grammars we determine the complexity measures ν, π and δ as functions of n. The results we obtain are rather similar to those in [3], as is the organization of this paper. is devoted to preliminaries and in 3 we consider elementary properties of grammars G n in GNF for C n. As using the arbitrary GNF for C n is trivial ( 3), we focus in 4 7 on the Greibach k-form (k = 1, ). An approach based on the set of circularly ordered strings results in a grammar family in Greibach -form ( 4). Modifying this family into Greibach 1-form in 5 results in a family with less rules. Unambiguous grammars for C n are studied in 6: then ν(n) and π(n) are related in a simple way. In 7 we discuss minimality for unambiguous grammars in GNF but the existence of a family of grammars for which these complexity measures are minimal remains open. Finally, some concluding remarks are in 8. Preliminaries For rudiments of discrete mathematics, particularly of combinatorics, and of formal language theory, we refer to standard texts like [10] and [1], respectively. We denote the empty word by λ and the length of the word x by x. For each word w over Σ, A(w) is defined as the set of all symbols from Σ that do occur in w. Formally, A(λ) =, and A(ax) = {a} A(x) for each a Σ and x Σ. This mapping is extended to languages L over Σ by A(L) = {A(w) w L}. Remember that a λ-free context-free grammar G = (V, Σ, P, S) is in Chomsky normal form (CNF) if P N (N {S}) N Σ where N = V Σ. And G is in Greibach normal form (GNF) if P N Σ(N {S}). Particularly, G is in Greibach k-form if P N Σ( k i=0 (N {S})i ). For a context-free grammar G = (V, Σ, P, S) with α V, L(G, α) denotes the language defined by L(G, α) = {w Σ α w}. Thus for the language L(G) generated by G, we have L(G) = L(G, S). Notice that, if G is in CNF or GNF, then G has no useless symbols, L(G, α) is a nonempty language for each symbol α in V, and L(G, α) = {α} for each α in Σ.

3 Generating Circular Shifts by Context-Free Grammars in GNF 3 In studying C n we need, as in [3], subwords of a 1 a a n a 1 a n 1 ; so we consider the set Fk n all subwords of length k (1 k n) that obey the circular succession relation on Σ n defined by: a i a j if and only if either (i) i < n and j = i + 1 or (ii) i = n and j = 1; cf. 6.1 in [10]. Clearly, is not a transitive relation: it is a kind of successor relation. Then the formal definition of Fk n reads F n k = {x Σ n u, v Σ n : uxv = a 1 a a n a 1 a a k 1 ; x = k} with 1 k n; their partial unions Q n m are defined by Qn m = m k=1 F k n (1 m n). For a finite set X, we denote the cardinality of X by #X. Then we obviously have C n = Fn n = Qn n Qn n 1, #F k n = n (1 k n), #Qn m = mn and #C n = #Fn n = n. 3 Elementary Properties We first recall some simple properties of grammars in GNF that generate L n (the language of all permutations over Σ n ). From [4] we quote the following results. Proposition 3.1. For n 1, let G n = (V n, Σ n, P n, S n ) be a context-free grammar in GNF that generates L n, and let A, B N n = V n Σ n. (1) The language L(G n, A) is a nonempty subset of an isomorphic copy M k of the language L k for some k (1 k n). Consequently, each string z in L(G n, A) has length k, z consists of k different symbols, and A(z) = A(L(G n, A)). () If L(G n, A) L(G n, B), then A(L(G n, A)) = A(L(G n, B)). (3) If A aa 1 A A m is a rule in G n, then for each (i, j) with 1 i < j m, A(L(G n, A i )) A(L(G n, A j )) =, a / A(L(G n, A k )) with 1 k m, and A(L(G n, A)) = {a} A(L(G n, A 1 )) A(L(G n, A )) A(L(G n, A m )). This result gives rise to the following equivalence relation on N n : A and B in N n are called equivalent if x = y for some x L(G n, A) and some y L(G n, B). The equivalence classes are denoted by {E n,k } n k=1. The number of elements #E n,k of the equivalence class E n,k will be denoted by D(n, k) (1 k n). Example 3.. Consider G P 3 = (V 3, Σ 3, P 3, A 13 ) with N 3 = {A 13, A 1, A 13, A 3, A 1, A, A 3 } and P 3 consists of A 13 a 1 A 3 a A 13 a 3 A 1, A 1 a 1 A a A 1, A 13 a 1 A 3 a 3 A 1, A 3 a A 3 a 3 A, A 1 a 1, A a and A 3 a 3. Clearly, G P 3 is in GNF. Then L(G P 3 ) = L 3, E 3,3 = {A 13 }, E 3, = {A 1, A 13, A 3 }, E 3,1 = {A 1, A, A 3 }, and hence D(3, 3) = 1 and D(3, ) = D(3, 1) = 3. Proposition 3.1 relies on the fact that each word in L(G n ) is a permutation. As circular shifts are special permutations, Proposition 3.1 still applies; but what is particular about generating C n rather than L n is expressed in Proposition 3.4, the proof of which depends on the following result from [3]. Lemma 3.3. If X is a nonempty proper subalphabet of Σ n, then there exists at most one word x with A(x) = X such that x satisfies the circular succession relation. And if

4 4 Peter R.J. Asveld X = {b 1, b,..., b l }, then x = b p(1) b p() b p(l) provided there exists a permutation p of {1,,..., l} such that b p(1) b p() b p(l). For each w Σ n, let α(w) be the first and ω(w) be the last symbol of w. Thus if w = σ 1 σ σ m with σ i Σ (1 i m), then α(w) = σ 1 and ω(w) = σ m. Proposition 3.4. Let G n = (V n, Σ n, P n, S n ) be a context-free grammar in GNF that generates C n, and let α, β V n {S n }. (1) For each α, the language L(G n, α) is a singleton. () If L(G n, α) L(G n, β), then L(G n, α) = L(G n, β). (3) If A aa 1 A A m is in P n with L(G n, A i ) = {x i } (1 i m), then a α(x 1 ) and for each i (1 i < m), ω(x i ) α(x i+1 ). Consequently, if L(G n, A i ) = {x i } F n Λ(i), then L(G n, A) = {ax 1 x x m } F n k with k = 1 + m i=1 Λ(i). Proof. (1) G n is in GNF; so each symbol α in V n {S n } is useful: there is a derivation S n + ϕαψ + ϕx α ψ + x where x is a circular shift, ϕψ λ, A(x) = Σ n, and 1 #A(x α ) < n. Now, by Lemma 3.3, L(G n, α) contains at most one word over Σ n, and since L(G n, α) is nonempty, L(G n, α) is a singleton. () As L(G n, α) and L(G n, β) are singletons by (1), L(G n, α) L(G n, β) implies that they are equal. Finally, (3) is a direct consequence of the fact that L(G n, A) Q n n. Henceforth, in examples we will always assume tacitly that E n,1 = {A 1,...,A n } and we will use R n = {A i a i A i E n,1 }. Example 3.5. Consider G U 4 = (V 4, Σ 4, P 4, S 4 ) in GNF with P 4 = {S 4 a 1 A 3 A 4 a A 34 A 1 a 3 A 41 A a 4 A 1 A 3, A 1 a 1 A, A 3 a A 3, A 34 a 3 A 4, A 41 a 4 A 1 } R 4. Then L(G U 4 ) = C 4, E 4,4 = {S 4 }, E 4,3 =, E 4, = {A 1, A 3, A 34, A 41 }, E 4,1 = {A 1, A, A 3, A 4 }, D(4, 4) = 1, D(4, 3) = 0 and D(4, ) = D(4, 1) = 4. Since S 4 a 3 A 41 A is in P 4, we have L(G 4, A 41 ) = {a 4 a 1 }, L(G 4, A ) = {a }, a 3 a 4 = α(a 4 a 1 ) and ω(a 4 a 1 ) = a 1 a = α(a ). As measures for the descriptional complexity of G n from {G n } n 1, we use ν(n) = #N n and π(n) = #P n ; cf. [11, 13, 14, 7, 5, 1, 6]. A less-known measure has been introduced in [, 3]; viz. the number of left-most derivations δ(n) of G n. Remember that in a leftmost derivation the leftmost nonterminal is always expanded. Thus δ(n) = #{S n L x x L(G n )}, where L denotes the leftmost derivation relation. Clearly, this measure makes sense when we generate a finite language by a λ-free grammar with bounded ambiguity. Notice that these descriptional complexity measures depend on n as well as on the family under consideration; so we use ν α (n), π α (n) and δ α (n) in the context of a family {G α n } n 1 of which the individual members are labeled by α. Example 3.6. For G P 3 of Example 3., we have ν P(3) = 7, π P (3) = 1 and δ P (3) = 3! = 6, since G P 3 is unambiguous []. Similarly, for the unambiguous GU 4 of Example 3.5, we have ν U (4) = 9, π U (4) = 1 and δ U (4) = 4.

5 Generating Circular Shifts by Context-Free Grammars in GNF 5 For each family {G α n} n 1 = {(V n, Σ n, P n, S n )} n 1 for {C n } n 1 to be considered in the sequel, we assume that the first two (unspecified) elements G α 1 and Gα satisfy N 1 = {S 1 } and P 1 = {S 1 a 1 } for G α 1, and N = {S, A 1, A }, P = {S a 1 A a A 1, A 1 a 1, A a } for G α. Then ν α (1) = π α (1) = δ α (1) = 1, ν α () = 3, π α () = 4, δ α () =, whereas for n 3, ν α (n) = n k=1 D(n, k) n + 1, π α(n) n + and δ α (n) n. This implies that specifying a family {G α n} n 1 reduces to defining the family {G α n} n 3. As an illustration we consider a simple family of grammars in GNF for {C n } n 1. It is based on a single nonterminal S n and the trivial set of rules {S n w w C n }. To obtain grammars in GNF we need isomorphisms ϕ n : Σ n {A 1, A,...,A n } defined by ϕ n (a i ) = A i (1 i n), that are extended to words by ϕ n (σ 1 σ σ k ) = ϕ n (σ 1 )ϕ n (σ ) ϕ n (σ k ) (σ i Σ n, 1 i k). Definition 3.7. {G T n} n 1 is given by {(V n, Σ n, P n, S n )} n 1 with for n 3, N n = V n Σ n = {S n } {A i 1 i n}, P n = {S n σ 1 ϕ n (σ σ n ) σ 1 σ σ n C n } {A i a i 1 i n}. In the sequel we will slightly change our notation in order to reduce the number of subscript levels: if x = a j a k, we will write A j k for A x instead of A aj a k ; cf. Examples 3. and 3.5 above. In this way the set of indices {1,,..., n} inherits the linear order of Σ n ; a similar remark applies with respect to the -relation. Example 3.8. For n = 3, we have G T 3 = (V 3, Σ 3, P 3, S 3 ) with P3 T = {S 3 a 1 A A 3 a A 3 A 1 a 3 A 1 A } R 3. Now E 3,3 = {S 3 }, E 3, =, E 3,1 = {A 1, A, A 3 }, D(3, 3) = 1, D(3, ) = 0, D(3, 1) = 3, ν T (3) = 4, π T (3) = 6 and δ T (3) = 3. The following result easily follows from Definition 3.7. Proposition 3.9. For the family {G T n } n 1 of Definition 3.7 we have for n 3, (1) D(n, n) = 1, D(n, k) = 0 (1 < k < n), and D(n, 1) = n, () ν T (n) = n + 1, (3) π T (n) = n, (4) δ T (n) = n. 4 Greibach -form A Straightforward Approach The trivial family {G T n } n 1 of grammars in (unrestricted) GNF of Definition 3.7 gives rise to simple results that are not very interesting. Therefore we restrict ourselves in the sequel to grammars in Greibach k-form with k=1,. It turns out that in those cases the corresponding descriptional complexity measures are less trivial. The idea on which our next family of grammars is based stems from Proposition 3.4: we have nonterminals A x for all strings x in Q n n 1 with x = k < n such that L(G n, A x ) = {x}

6 6 Peter R.J. Asveld and A x E n,k. For the words in C n = Q n n Q n n 1 we have rules S n aa x A y for all nonempty words x and y with axy C n and E n,n = {S n }. Definition 4.1. {G 0 n} n 1 is given by {(V n, Σ n, P n, S n )} n 1 with for n 3, N n = V n Σ n = {S n } {A x x Q n n }, P n = {S n aa x A y axy C n ; a Σ n ; x, y Σ + n } {A a a a Σ n } {A axy aa x A y a Σ n ; axy Q n n 1; x, y Σ + n } {A ab aa b a, b Σ n ; a b }. Example 4.. Consider G 0 5 = (V 5, Σ 5, P 5, S 5 ) with P 5 = {S 5 a 1 A A 345 a 1 A 3 A 45 a 1 A 34 A 5 a A 3 A 451 a A 34 A 51 a A 345 A 1 a 3 A 4 A 51 a 3 A 45 A 1 a 3 A 451 A a 4 A 5 A 13 a 4 A 51 A 3 a 4 A 51 A 3 a 5 A 1 A 34 a 5 A 1 A 34 a 5 A 13 A 4, A 13 a 1 A A 3, A 34 a A 3 A 4, A 345 a 3 A 4 A 5, A 451 a 4 A 5 A 1, A 51 a 5 A 1 A, A 1 a 1 A, A 3 a A 3, A 34 a 3 A 4, A 45 a 4 A 5, A 51 a 5 A 1 } R 5. We have E 5,5 = {S 5 }, E 5,4 =, E 5,3 = {A 13, A 34, A 345, A 451, A 51 }, E 5, = {A 1, A 3, A 34, A 45, A 51 }, E 5,1 = {A 1, A, A 3, A 4, A 5 }, D(5, 5) = 1, D(5, 4) = 0, D(5, 3) = D(5, ) = D(5, 1) = 5. Consequently, ν 0 (5) = 16, π 0 (5) = 30 and δ 0 (5) = 15; hence G 0 5 is ambiguous. In general, if S is a statement that can be true or false, then [S] is equal to 1 if S is true, and to 0 otherwise; cf. [10]. Proposition 4.3. For the family {G 0 n } n 1 of Definition 4.1 we have for n 3, (1) D(n, n) = 1, D(n, n 1) = 0, and D(n, k) = n with 1 k < n 1, () ν 0 (n) = n n + 1, (3) π 0 (n) = [n 4] ( 1 n3 7 n + 6n) + n, (4) δ 0 (n) = n n. Proof. From Definition 4.1 it follows that for n 3, ν 0 (n) = #N n = 1 + #Q n n = 1 + (n )n = n n + 1, while π 0 (n) = h 0 (n) + h 1 (n) + h (n) + h 3 (n) with h 0 (n) = #{S n aa x A y axy C n ; a Σ n ; x, y Σ + n }, h 1 (n) = #{A axy aa x A y a Σ n ; axy Q n n 1 ; x, y Σ+ n }, h (n) = #{A ab aa b a, b Σ n ; a b }, h 3 (n) = #{A a a a Σ n }. Clearly, h 0 (n) = n(n ) and h (n) = h 3 (n) = n. For h 1 we observe that h 1 (3) = 0, and for n 4, we have h 1 (n) = n k=3 (k ) n = 1 n(n 3)(n 4) = 1 n3 7 n + 6n. So π 0 (n) = n(n ) + [n 4] ( 1 n3 7 n + 6n) + n + n = [n 4] ( 1 n3 7 n + 6n) + n. The grammar G 0 n generates n strings, each of which can be obtained by a left-most derivation in n ways (n 3); consequently, we have δ 0 (n) = n(n ).

7 Generating Circular Shifts by Context-Free Grammars in GNF 7 5 Greibach 1-form An Improvement The next grammar family {G 1 n } n 1 to generate {C n } n 1 consists of context-free grammars in Greibach 1-form; this family is closely related to Definition 5.1 in [3] which in turn has been inspired by generating {C n } n 1 with regular grammars. Definition 5.1. {G 1 n} n 1 is given by {(V n, Σ n, P n, S n )} n 1 with for n 3, N n = V n Σ n = {S n } {A x x Q n n 1}, P n = {S n aa x ax C n ; a Σ n } {A a a a Σ n } {A ax aa x ax Q n n 1 ; a Σ n, x Σ + n }. Example 5.. For n = 3, we obtain G 1 3 = (V 3, Σ 3, P 3, S 3 ) with P 3 = {S 3 a 1 A 3 a A 31 a 3 A 1, A 1 a 1 A, A 3 a A 3, A 31 a 3 A 1 } R 3 Then we have E 3,3 = {S 3 }, E 3, = {A 1, A 3, A 31 }, E 3,1 = {A 1, A, A 3 }, D(3, 3) = 1, D(3, ) = D(3, 1) = 3, ν 1 (3) = 7, π 1 (3) = 9 and δ 1 (3) = 3. The proof of the following result is similar to the one of Proposition 5.3 in [3]. Proposition 5.3. For the family {G 1 n} n 1 of Definition 5.1 we have for n 3, (1) D(n, n) = 1 and D(n, k) = n with 1 k < n, () ν 1 (n) = n n + 1, (3) π 1 (n) = n, (4) δ 1 (n) = n. Comparing Propositions 4.3 and 5.3 yields for n 4, ν 0 (n) < ν 1 (n), π 0 (n) > π 1 (n) and δ 0 (n) > δ 1 (n). The latter two inequalities may be considered as an improvement; the price we have to pay is n additional nonterminal symbols. 6 Families of Unambiguous Grammars In [3] we argued that a first step towards minimal grammars in CNF is to avoid ambiguity. The situation for the GNF is very similar: the following crucial result and its proof are almost identical to the one for CNF in [3]. Proposition 6.1. Let {G n } n 1 be a family of grammars in GNF that generates {C n } n 1. Then δ(n) = n if and only if π(n) = ν(n) + n 1. The proof tells us that in an unambiguous grammar for C n, there are n rules for S n and a single rule for each A N n {S n }. So we try to minimize ν(n), and as a consequence π(n) will reach its minimum value as well. Clearly, Proposition 6.1 applies to {G 1 n } n 1 but not to {G 0 n} n 1. However, {G 1 n} n 1 is not the only family satisfying Proposition 6.1; another one will be introduced now. Definition 6.. {G n} n 1 is given by {(V n, Σ n, P n, S n )} n 1 with for n 3, N n = V n Σ n = {S n } {A a a Σ n } M n with for m,

8 8 Peter R.J. Asveld M m = {A x x Fm Fm 4 F m }, and M m 1 = {A x x Fm 3 m 1 F m 5 m 1 F 3 m 1 }, P n = {S n aa b A x a, b Σ n ; x Σ + n ; abx C n; x Fn n } Q n {A abx aa b A x a, b Σ n ; A abx M n ; x Σ + n } {A a a a Σ n } with for m, Q m = {A ab aa b a, b Σ n ; a b }, and Q m 1 =. Example 6.3. Let G 6 = (V 6, Σ 6, P 6, S 6 ) with P 6 = {S 6 a 1 A A 3456 a A 3 A 4561 a 3 A 4 A 561 a 4 A 5 A 613 a 5 A 6 A 134 a 6 A 1 A 345, A 134 a 1 A A 34, A 345 a A 3 A 45, A 3456 a 3 A 4 A 56, A 4561 a 4 A 5 A 61, A 561 a 5 A 6 A 1, A 613 a 6 A 1 A 3, A 1 a 1 A, A 3 a A 3, A 34 a 3 A 4, A 45 a 4 A 5, A 56 a 5 A 6, A 61 a 6 A 1 } R 6. Now E 6,6 = {S n }, E 6,5 =, E 6,4 = {A 134, A 345, A 3456, A 4561, A 561, A 613 }, E 6,3 =, E 6, = {A 1, A 3, A 34, A 45, A 56, A 61 } and E 6,1 = {A 1, A, A 3, A 4, A 5, A 6 }. Then we obtain ν (6) = 19 < 31 = ν 1 (6) and π (6) = 4 < 36 = π 1 (6). Proposition 6.4. For the family {G n } n 1 of Definition 6., we have (1) D(n, n) = 1, D(n, n 1) = 0, D(n, 1) = n, and for k < n 1, D(n, k) = if k n (mod ) then n else 0, () for n 3, ν (n) = 1 n + 1 n [n is odd] + 1, (3) for n 3, π (n) = 1 n + 1 n ([n is odd] + ), (4) δ (n) = n. Proof. From Definition 6., Proposition 6.4(1) and (4) easily follow. Then for even n with n 4, we have ν (n) = 1 + n + n k=4 D(n, k) = 1 + n + 1 (n 4)n = 1 n + 1. For odd n with n 3, we obtain ν (n) = 1+n+ n k=3 D(n, k) = 1+n+ 1 (n 3)n = 1 n + 1 n+1. Combining these two cases results in ν (n) = 1 n + 1 n [n is odd] + 1 for n 3. Finally, Proposition 6.1 implies Proposition 6.4(3). From Propositions 5.3 and 6.4 it follows that for n 4, we have ν (n) < ν 1 (n) and, consequently, π (n) < π 1 (n). It is possible to continue in this way by introducing families {G k n } n 1 (k 3) such that for each rule A abc, L(G k n, B) consists of a single word of length k 1. As in [3] the objections are twofold: the definitions become more complicated as k increases, and we are probably left with ν k (n) and π k (n) being functions in Θ(n ). 7 Towards a Family of Minimal Grammars For the CNF we defined in [3] a family of grammars {G k n } n 1 to be minimal if each G k is unambiguous and ν(n) Θ(n); cf. Proposition 6.1. As we will see, this latter condition is likely to be too ambitious for the GNF. In [3] we also established the existence of a minimal family for the CNF; it turns out that the corresponding problem for the GNF remains open. But let us first have a look at a GNF-family as simple as the minimal CNF-family of [3].

9 Generating Circular Shifts by Context-Free Grammars in GNF 9 Definition 7.1. {G n} n 1 is given by {(V n, Σ n, P n, S n )} n 1 with for even n 4, N n = V n Σ n = {S n, A 1, A,...,A n } {A i k i = 1, 3, 5,..., n 1; a i a k F n F n 4 F n 6 F }, P n = {S n a i A j A k m a j A k m A i i = 1, 3,..., n 1; a i a j a k a m C n } and for odd n 3, {A k a k 1 k n} {A i...m a i A j A k m i = 1, 3,..., n 1; a i a j a k a m F n F n 4 F n 6 F }, where A k...m is taken equal to λ whenever a k a m equals λ; N n = V n Σ n = {S n, A 1, A,...,A n } {A i k i = 1, 3, 5,...,n; a i a k F n F n 4 F n 6 F 3 }, P n = {S n a i A j A k m a j A k m A i a n A 1...(n ) A n 1 i = 1, 3,..., n ; a i a j a k a m C n } {A k a k 1 k n} {A i...m a i A j A k m i = 1, 3,..., n ; a i a j a k a m F n F n 4 F n 6 F 3 } {A n1...k a n A 1...(k 1) A k k =, 4,..., n 3; a n a 1 a k F n F n 4 F n 6 F 3 }. Example 7.. Let G 7 = (V 7, Σ 7, P 7, S 7 ) with P 7 = {S 7 a 1 A A a A A 1 a 3 A 4 A 5671 a 4 A 5671 A 3 a 5 A 6 A 7134 a 6 A 7134 A 5 a 7 A 1345 A 6, A 1345 a 1 A A 345, A a 3 A 4 A 567, A 5671 a 5 A 6 A 71, A 7134 a 7 A 13 A 4, A 13 a 1 A A 3, A 345 a 3 A 4 A 5, A 567 a 5 A 6 A 7, A 71 a 7 A 1 A } R 7. Then ν (7) = 16 < 9 = ν (7), π (7) = < 35 = π (7) and δ (7) = 7. Proposition 7.3. For the family {G n} n 1 of Definition 7.1 we have (1) D(n, n) = 1, D(n, 1) = n, and for even n and k =, 4,..., n, D(n, k) = 1n, for odd n and k = 3, 5,..., n, D(n, k) = 1n, () ν (n) = 1 4 n + 1n [n is even], 4 4 (3) π (n) = 1 4 n + 3n 3 [n is odd], 4 (4) δ (n) = n. Proof. It is easy to establish (1) and (4); then for even n we have ν (n) = 1 + n + ( 1 n 1)1 n = 1 4 n + 1 n + 1, and for odd n, ν (n) = 1 + n + 1 n 1 1 n = 1 4 n + 1 n Finally, (3) follows from (), (4) and Proposition 6.1. Although this is an improvement with respect to Propositions 4.3, 5.3 and 6.4, {G n } n 1 is by no means a minimal family as we will see from the following divide-and-conquer family; cf. 8 in [].

10 10 Peter R.J. Asveld P n := {A i a i a i Σ n } {S n a i A x A y a i xy C n ; x = 1(n 1) }; N n := {S n } {A i a i Σ n }; M := {x, y S n a i A x A y P n }; while M Σ n [i.e. x M : x ] do begin N n := N n {A x }; M := M {x}; case x of = : P n := P n {A x a i A j a i a j = x}; = 3: P n := P n {A x a i A j A k a i a j a k = x}; 4: begin P n := P n {A x a i A y A z a i yz = x; y = 1 ( x 1) }; M := M {y, z a i yz = x; y = 1 ( x 1) }; end endcase end Figure 1: Algorithm to determine N n and P n of G n. Definition 7.4. {G n} n 1 is given by {(V n, Σ n, P n, S n )} n 1 where the sets N n and P n are determined by the algorithm in Figure 1. Example 7.5. G 7 = (V 7, Σ 7, P 7, S 7 ) with P 7 = {S 7 a 1 A 34 A 567 a A 345 A 671 a 3 A 456 A 71 a 4 A 567 A 13 a 5 A 671 A 34 a 6 A 71 A 345 a 7 A 13 A 456, A 13 a 1 A A 3, A 34 a A 3 A 4, A 345 a 3 A 4 A 5, A 456 a 4 A 5 A 6, A 567 a 5 A 6 A 7, A 671 a 6 A 7 A 1, A 71 a 7 A 1 A } R 7. Now ν (7) = 15 < 16 = ν (7), π (7) = 1 < = ν (7) and δ (7) = 7. n ν (n) π (n) Table 1: ν (n) and π (n) for 3 n 16. As usual in analyzing such a divide-and-conquer approach, a closed form for ν (n) and π (n) is very hard or even impossible to obtain; for small values we refer to Table 1. Only for special values of n we can infer some manageable expressions. Proposition 7.6. For the family {G n } n 1 we have in case n = k 1 (k ), (1) D(n, n) = 1, D(n, i 1) = n (i = 1,,..., k 1), and D(n, i) = 0 otherwise, () ν (n) = n log (n + 1) n + 1, (3) π (n) = n log (n + 1), (4) δ (n) = n.

11 Generating Circular Shifts by Context-Free Grammars in GNF 11 So using this divide-and-conquer approach we end up with ν (n) and π (n) in Θ(n log n), rather than in Θ(n ) as for the previous families. 8 Concluding Remarks We discussed a few ways of generating the languages {C n } n 1 of circular shifts by contextfree grammars {G n } n 1 in GNF, and we compared these families with respect to the measures ν, π and δ. Our results give rise to the following observation. Conjecture 8.1. Any family of context-free grammars in GNF {G n } n 1 that generates {C n } n 1 must have measures ν(n) and π(n) that are not bounded by any linear function in n. The situation in the GNF-case differs considerably from the CNF-case: in [3] we established the existence of a minimal family in CNF for which ν and π are linear functions in n (even with small coefficients). For the GNF the definition of minimality remains a problem; viz. setting {G n } n 1 in GNF is minimal for {C n } n 1 if (i) each G n is unambiguous, and (ii) ν(n) Θ(f(n)) leaves us with the question of an adequate choice for f(n). Conjecture 8.1 implies f(n) ω(n). Taking f(n) equal to n log n results in the minimality of {G n } n 1 (Proposition 7.6), but the question whether this family is also minimal in an absolute sense (i.e., does there exists no family with ν(n) Θ(n log n) and ν(n) < n log (n + 1) n + 1 for n large enough with n = k 1 and k?) remains an open problem as well. References 1. B. Alspach, P. Eades & G. Rose, A lower-bound for the number of productions for a certain class of languages, Discrete Appl. Math. 6 (1983) P.R.J. Asveld, Generating all permutations by context-free grammars in Chomsky normal form, Theoret. Comput. Sci. 354 (006) P.R.J. Asveld, Generating all circular shifts by context-free grammars in Chomsky normal form, CTIT TR 05-3 (005), ISSN , University of Twente, Enschede, the Netherlands; to appear in J. Autom., Lang. Combin. 4. P.R.J. Asveld, Generating all permutations by context-free grammars in Greibach normal form, (in preparation). 5. W. Bucher, A note on a problem in the theory of grammatical complexity, Theoret. Comput. Sci. 14 (1981) W. Bucher, H.A. Maurer & K. Culik II, Context-free complexity of finite languages, Theoret. Comput. Sci. 8 (1984) W. Bucher, H.A. Maurer, K. Culik II & D. Wotschke, Concise description of finite languages, Theoret. Comput. Sci. 14 (1981) 7-46.

12 1 Peter R.J. Asveld 8. J. Dassow, On the circular closure of languages, EIK 15 (1979) K. Ellul, B. Krawetz, J. Shallit & M.-w. Wang, Regular expressions: new results and open problems, J. Autom. Lang. Comb. 9 (004) R.L. Graham, D.E. Knuth & O. Patashnik, Concrete Mathematics (1989), Addison- Wesley, Reading, MA. 11. J. Gruska, Some classifications of context-free languages, Inform. Contr. 14 (1969) M.A. Harrison, Introduction to Formal Language Theory (1978), Addison-Wesley, Reading, MA. 13. V.A. Iljuškin, The complexity of the grammatical description of context-free languages, Dokl. Akad. Nauk SSSR 03 (197) / Soviet Math. Dokl. 13 (197) A. Kelemenová, Complexity of normal form grammars, Theoret. Comput. Sci. 8 (1984) G. Satta, personal communication (00).

Generating All Circular Shifts by Context-Free Grammars in Chomsky Normal Form

Generating 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 information

Generating All Permutations by Context-Free Grammars in Chomsky Normal Form

Generating 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 information

Generating All Permutations by Context-Free Grammars in Chomsky Normal Form

Generating 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 information

A Fuzzy Approach to Erroneous Inputs in Context-Free Language Recognition

A Fuzzy Approach to Erroneous Inputs in Context-Free Language Recognition A Fuzzy Approach to Erroneous Inputs in Context-Free Language Recognition Peter R.J. Asveld Department of Computer Science, Twente University of Technology P.O. Box 217, 7500 AE Enschede, The Netherlands

More information

CPS 220 Theory of Computation

CPS 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 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

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation CFL Hierarchy CFL Decision Problems Your Questions? Previous class days' material Reading Assignments HW 12 or 13 problems Anything else I have included some slides online

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

6.8 The Post Correspondence Problem

6.8 The Post Correspondence Problem 6.8. THE POST CORRESPONDENCE PROBLEM 423 6.8 The Post Correspondence Problem The Post correspondence problem (due to Emil Post) is another undecidable problem that turns out to be a very helpful tool for

More information

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction Math 4 Summer 01 Elementary Number Theory Notes on Mathematical Induction Principle of Mathematical Induction Recall the following axiom for the set of integers. Well-Ordering Axiom for the Integers If

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

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

CS481F01 Prelim 2 Solutions

CS481F01 Prelim 2 Solutions CS481F01 Prelim 2 Solutions A. Demers 7 Nov 2001 1 (30 pts = 4 pts each part + 2 free points). For this question we use the following notation: x y means x is a prefix of y m k n means m n k For each of

More information

Context Free Grammars

Context Free Grammars Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.

More information

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers. MATH 4 Summer 011 Elementary Number Theory Notes on Mathematical Induction Principle of Mathematical Induction Recall the following axiom for the set of integers. Well-Ordering Axiom for the Integers If

More information

Optimal Regular Expressions for Permutations

Optimal Regular Expressions for Permutations Optimal Regular Expressions for Permutations arxiv:1812.06347v1 [cs.fl] 15 Dec 2018 Antonio Molina Lovett and Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, ON N2L 3G1 Canada

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

Context-Free Grammars: Normal Forms

Context-Free Grammars: Normal Forms Context-Free Grammars: Normal Forms 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 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

Pushdown Automata. Reading: Chapter 6

Pushdown Automata. Reading: Chapter 6 Pushdown Automata Reading: Chapter 6 1 Pushdown Automata (PDA) Informally: A PDA is an NFA-ε with a infinite stack. Transitions are modified to accommodate stack operations. Questions: What is a stack?

More information

ON PARTITIONS SEPARATING WORDS. Formal languages; finite automata; separation by closed sets.

ON PARTITIONS SEPARATING WORDS. Formal languages; finite automata; separation by closed sets. ON PARTITIONS SEPARATING WORDS Abstract. Partitions {L k } m k=1 of A+ into m pairwise disjoint languages L 1, L 2,..., L m such that L k = L + k for k = 1, 2,..., m are considered. It is proved that such

More information

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

ECS 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 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

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

Chap. 7 Properties of Context-free Languages

Chap. 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 information

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:

Languages. 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 information

CS 373: Theory of Computation. Fall 2010

CS 373: Theory of Computation. Fall 2010 CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Normal Forms for CFG Normal Forms for Grammars It is typically easier to work with a context free language if given a CFG in a normal

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

A New Shuffle Convolution for Multiple Zeta Values

A New Shuffle Convolution for Multiple Zeta Values January 19, 2004 A New Shuffle Convolution for Multiple Zeta Values Ae Ja Yee 1 yee@math.psu.edu The Pennsylvania State University, Department of Mathematics, University Park, PA 16802 1 Introduction As

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

Ambiguity of context free languages as a function of the word length

Ambiguity of context free languages as a function of the word length Ambiguity of context free languages as a function of the word length Mohamed NAJI Email: MohamedNaji@web.de WWW: http://www.mohamednaji.de.vu Mobile 49-160-1127558 November 1998 Abstract In this paper

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

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

Einführung in die Computerlinguistik

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 information

The constructible universe

The constructible universe The constructible universe In this set of notes I want to sketch Gödel s proof that CH is consistent with the other axioms of set theory. Gödel s argument goes well beyond this result; his identification

More information

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Lecture Notes 1 Basic Concepts of Mathematics MATH 352 Ivan Avramidi New Mexico Institute of Mining and Technology Socorro, NM 87801 June 3, 2004 Author: Ivan Avramidi; File: absmath.tex; Date: June 11,

More information

Theory of Computation - Module 3

Theory of Computation - Module 3 Theory of Computation - Module 3 Syllabus Context Free Grammar Simplification of CFG- Normal forms-chomsky Normal form and Greibach Normal formpumping lemma for Context free languages- Applications of

More information

0.Axioms for the Integers 1

0.Axioms for the Integers 1 0.Axioms for the Integers 1 Number theory is the study of the arithmetical properties of the integers. You have been doing arithmetic with integers since you were a young child, but these mathematical

More information

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic Mathematics 114L Spring 2018 D.A. Martin Mathematical Logic 1 First-Order Languages. Symbols. All first-order languages we consider will have the following symbols: (i) variables v 1, v 2, v 3,... ; (ii)

More information

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Notes for Comp 497 (Comp 454) Week 10 4/5/05 Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability

More information

IMA Preprint Series # 2066

IMA Preprint Series # 2066 THE CARDINALITY OF SETS OF k-independent VECTORS OVER FINITE FIELDS By S.B. Damelin G. Michalski and G.L. Mullen IMA Preprint Series # 2066 ( October 2005 ) INSTITUTE FOR MATHEMATICS AND ITS APPLICATIONS

More information

Chapter 1. Sets and Numbers

Chapter 1. Sets and Numbers Chapter 1. Sets and Numbers 1. Sets A set is considered to be a collection of objects (elements). If A is a set and x is an element of the set A, we say x is a member of A or x belongs to A, and we write

More information

Isomorphisms between pattern classes

Isomorphisms between pattern classes Journal of Combinatorics olume 0, Number 0, 1 8, 0000 Isomorphisms between pattern classes M. H. Albert, M. D. Atkinson and Anders Claesson Isomorphisms φ : A B between pattern classes are considered.

More information

Coloring k-trees with forbidden monochrome or rainbow triangles

Coloring k-trees with forbidden monochrome or rainbow triangles Coloring k-trees with forbidden monochrome or rainbow triangles Julian Allagan & Vitaly Voloshin Department of Mathematics, University of North Georgia, Watkinsville, Georgia email: julian.allagan@ung.edu

More information

Chapter 3. Regular grammars

Chapter 3. Regular grammars Chapter 3 Regular grammars 59 3.1 Introduction Other view of the concept of language: not the formalization of the notion of effective procedure, but set of words satisfying a given set of rules Origin

More information

arxiv: v2 [math.nt] 4 Jun 2016

arxiv: v2 [math.nt] 4 Jun 2016 ON THE p-adic VALUATION OF STIRLING NUMBERS OF THE FIRST KIND PAOLO LEONETTI AND CARLO SANNA arxiv:605.07424v2 [math.nt] 4 Jun 206 Abstract. For all integers n k, define H(n, k) := /(i i k ), where the

More information

arxiv: v1 [math.co] 3 Nov 2014

arxiv: v1 [math.co] 3 Nov 2014 SPARSE MATRICES DESCRIBING ITERATIONS OF INTEGER-VALUED FUNCTIONS BERND C. KELLNER arxiv:1411.0590v1 [math.co] 3 Nov 014 Abstract. We consider iterations of integer-valued functions φ, which have no fixed

More information

Congruence Classes of 2-adic Valuations of Stirling Numbers of the Second Kind

Congruence Classes of 2-adic Valuations of Stirling Numbers of the Second Kind 1 2 3 47 6 23 11 Journal of Integer Sequences, Vol. 16 (2013), Article 13.3.6 Congruence Classes of 2-adic Valuations of Stirling Numbers of the Second Kind Curtis Bennett and Edward Mosteig Department

More information

NP-problems continued

NP-problems continued NP-problems continued Page 1 Since SAT and INDEPENDENT SET can be reduced to each other we might think that there would be some similarities between the two problems. In fact, there is one such similarity.

More information

Hanoi Graphs and Some Classical Numbers

Hanoi Graphs and Some Classical Numbers Hanoi Graphs and Some Classical Numbers Sandi Klavžar Uroš Milutinović Ciril Petr Abstract The Hanoi graphs Hp n model the p-pegs n-discs Tower of Hanoi problem(s). It was previously known that Stirling

More information

Outline. We will now investigate the structure of this important set.

Outline. We will now investigate the structure of this important set. The Reals Outline As we have seen, the set of real numbers, R, has cardinality c. This doesn't tell us very much about the reals, since there are many sets with this cardinality and cardinality doesn't

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

c 1998 Society for Industrial and Applied Mathematics Vol. 27, No. 4, pp , August

c 1998 Society for Industrial and Applied Mathematics Vol. 27, No. 4, pp , August SIAM J COMPUT c 1998 Society for Industrial and Applied Mathematics Vol 27, No 4, pp 173 182, August 1998 8 SEPARATING EXPONENTIALLY AMBIGUOUS FINITE AUTOMATA FROM POLYNOMIALLY AMBIGUOUS FINITE AUTOMATA

More information

11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic

11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic 11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic Bezout s Lemma Let's look at the values of 4x + 6y when x and y are integers. If x is -6 and y is 4 we

More information

Theory of Computation 1 Sets and Regular Expressions

Theory of Computation 1 Sets and Regular Expressions Theory of Computation 1 Sets and Regular Expressions Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Theory of Computation

More information

Theory of Computation 8 Deterministic Membership Testing

Theory 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 information

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form

More information

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Simplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form

More information

Enumeration of Automata, Languages, and Regular Expressions

Enumeration of Automata, Languages, and Regular Expressions Enumeration of Automata, Languages, and Regular Expressions Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1 Canada shallit@cs.uwaterloo.ca http://www.cs.uwaterloo.ca/~shallit

More information

Einführung in die Computerlinguistik

Einfü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 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

Hierarchy among Automata on Linear Orderings

Hierarchy among Automata on Linear Orderings Hierarchy among Automata on Linear Orderings Véronique Bruyère Institut d Informatique Université de Mons-Hainaut Olivier Carton LIAFA Université Paris 7 Abstract In a preceding paper, automata and rational

More information

Some Properties in Generalized n-inner Product Spaces

Some Properties in Generalized n-inner Product Spaces Int. Journal of Math. Analysis, Vol. 4, 2010, no. 45, 2229-2234 Some Properties in Generalized n-inner Product Spaces B. Surender Reddy Department of Mathematics, PGCS, Saifabad Osmania University, Hyderabad-500004,

More information

d(ν) = max{n N : ν dmn p n } N. p d(ν) (ν) = ρ.

d(ν) = 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 information

Pushdown Automata (2015/11/23)

Pushdown Automata (2015/11/23) Chapter 6 Pushdown Automata (2015/11/23) Sagrada Familia, Barcelona, Spain Outline 6.0 Introduction 6.1 Definition of PDA 6.2 The Language of a PDA 6.3 Euivalence of PDA s and CFG s 6.4 Deterministic PDA

More information

A SUMMATION FORMULA FOR SEQUENCES INVOLVING FLOOR AND CEILING FUNCTIONS

A SUMMATION FORMULA FOR SEQUENCES INVOLVING FLOOR AND CEILING FUNCTIONS ROCKY MOUNTAIN JOURNAL OF MATHEMATICS Volume 36, Number 5, 006 A SUMMATION FORMULA FOR SEQUENCES INVOLVING FLOOR AND CEILING FUNCTIONS M.A. NYBLOM ABSTRACT. A closed form expression for the Nth partial

More information

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

Grammars (part II) Prof. Dan A. Simovici UMB rammars (part II) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Length-Increasing vs. Context-Sensitive rammars Theorem The class L 1 equals the class of length-increasing languages. 3 / 1 Length-Increasing

More information

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

SYLLABUS. 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 information

TAFL 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 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 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

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

Notes for Comp 497 (454) Week 10

Notes 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 information

MANFRED DROSTE AND WERNER KUICH

MANFRED DROSTE AND WERNER KUICH Logical Methods in Computer Science Vol. 14(1:21)2018, pp. 1 14 https://lmcs.episciences.org/ Submitted Jan. 31, 2017 Published Mar. 06, 2018 WEIGHTED ω-restricted ONE-COUNTER AUTOMATA Universität Leipzig,

More information

A REFINED ENUMERATION OF p-ary LABELED TREES

A REFINED ENUMERATION OF p-ary LABELED TREES Korean J. Math. 21 (2013), No. 4, pp. 495 502 http://dx.doi.org/10.11568/kjm.2013.21.4.495 A REFINED ENUMERATION OF p-ary LABELED TREES Seunghyun Seo and Heesung Shin Abstract. Let T n (p) be the set of

More information

Permutation groups/1. 1 Automorphism groups, permutation groups, abstract

Permutation groups/1. 1 Automorphism groups, permutation groups, abstract Permutation groups Whatever you have to do with a structure-endowed entity Σ try to determine its group of automorphisms... You can expect to gain a deep insight into the constitution of Σ in this way.

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

1. Induction on Strings

1. Induction on Strings CS/ECE 374: Algorithms & Models of Computation Version: 1.0 Fall 2017 This is a core dump of potential questions for Midterm 1. This should give you a good idea of the types of questions that we will ask

More information

1 Alphabets and Languages

1 Alphabets and Languages 1 Alphabets and Languages Look at handout 1 (inference rules for sets) and use the rules on some examples like {a} {{a}} {a} {a, b}, {a} {{a}}, {a} {{a}}, {a} {a, b}, a {{a}}, a {a, b}, a {{a}}, a {a,

More information

MA/CSSE 474 Theory of Computation

MA/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 information

Context Free Grammars: Introduction

Context Free Grammars: Introduction Context Free Grammars: Introduction Context free grammar (CFG) G = (V, Σ, R, S), where V is a set of grammar symbols Σ V is a set of terminal symbols R is a set of rules, where R (V Σ) V S is a distinguished

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

Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer.

Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer. Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer. Language Generator: Context free grammars are language generators,

More information

Theory of Computation Turing Machine and Pushdown Automata

Theory of Computation Turing Machine and Pushdown Automata Theory of Computation Turing Machine and Pushdown Automata 1. What is a Turing Machine? A Turing Machine is an accepting device which accepts the languages (recursively enumerable set) generated by type

More information

Homework 5 - Solution

Homework 5 - Solution DCP3122 Introduction to Formal Languages, Spring 2015 Instructor: Prof. Wen-Guey Tzeng Homework 5 - Solution 5-May-2015 Due: 18-May-2015 1. Given Σ = {a, b, c}, find an NPDA that accepts L = {a n b n+m

More information

6 Cosets & Factor Groups

6 Cosets & Factor Groups 6 Cosets & Factor Groups The course becomes markedly more abstract at this point. Our primary goal is to break apart a group into subsets such that the set of subsets inherits a natural group structure.

More information

The commutation with ternary sets of words

The commutation with ternary sets of words The commutation with ternary sets of words Juhani Karhumäki Michel Latteux Ion Petre Turku Centre for Computer Science TUCS Technical Reports No 589, March 2004 The commutation with ternary sets of words

More information

Axiomatic set theory. Chapter Why axiomatic set theory?

Axiomatic set theory. Chapter Why axiomatic set theory? Chapter 1 Axiomatic set theory 1.1 Why axiomatic set theory? Essentially all mathematical theories deal with sets in one way or another. In most cases, however, the use of set theory is limited to its

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

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK COMS11700 Undecidability Department of Computer Science, University of Bristol Bristol, UK 4 April 2014 COMS11700: Undecidability Slide 1/29 Decidability We are particularly interested in Turing machines

More information

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS 1. Cardinal number of a set The cardinal number (or simply cardinal) of a set is a generalization of the concept of the number of elements

More information

Finite Presentations of Pregroups and the Identity Problem

Finite Presentations of Pregroups and the Identity Problem 6 Finite Presentations of Pregroups and the Identity Problem Alexa H. Mater and James D. Fix Abstract We consider finitely generated pregroups, and describe how an appropriately defined rewrite relation

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

10. The GNFA method is used to show that

10. The GNFA method is used to show that CSE 355 Midterm Examination 27 February 27 Last Name Sample ASU ID First Name(s) Ima Exam # Sample Regrading of Midterms If you believe that your grade has not been recorded correctly, return the entire

More information

Grammars and Context Free Languages

Grammars and Context Free Languages Grammars and Context Free Languages H. Geuvers and A. Kissinger Institute for Computing and Information Sciences Version: fall 2015 H. Geuvers & A. Kissinger Version: fall 2015 Talen en Automaten 1 / 23

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

Homework #7 Solutions

Homework #7 Solutions Homework #7 Solutions p 132, #4 Since U(8) = {1, 3, 5, 7} and 3 2 mod 8 = 5 2 mod 8 = 7 2 mod 8, every nonidentity element of U(8) has order 2. However, 3 U(10) we have 3 2 mod 10 = 9 3 3 mod 10 = 7 3

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

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations Page 1 Definitions Tuesday, May 8, 2018 12:23 AM Notations " " means "equals, by definition" the set of all real numbers the set of integers Denote a function from a set to a set by Denote the image of

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

Some Operations Preserving Primitivity of Words

Some Operations Preserving Primitivity of Words Some Operations Preserving Primitivity of Words Jürgen Dassow Fakultät für Informatik, Otto-von-Guericke-Universität Magdeburg PSF 4120; D-39016 Magdeburg; Germany Gema M. Martín, Francisco J. Vico Departamento

More information