- Modify the PDA in 4.2.1.4 to accept {0 n 1 n : n ≥ 1} by ES.
- Modify the PDA in 4.2.1.4 to accept {0 n 1 n : n ≥ 3} by ES.
-
Build a PDA over an input alphabet ∑ that accepts strings by ES, and (provably) accepts { xx R : x
∑*}. - Build a PDA for the language {0 n 1 5 n : n ≥ 0}. You are free to choose the mode of acceptance.
- Repeat the above task, but now do it in this way: First get a CFG for the language, and then construct a PDA for the language that accepts by empty stack (cf. 4.3.0.5 ).
-
Give a CFG G over ∑ = {0, 1} such that L ( G ) = { xx R : x
∑*}. - Give a CFG G over ∑ = {(, )} such that L ( G ) is the full set of balanced brackets—that is, not only those of the form ((())) but also those like ((())) (()).
- Provide a complete proof for the claims in Example 4.3.0.7 .
- By induction on regular expression length prove: “For every α, there is a CFG, G , such that L ( G ) = L (α)”.
- Prove that CFL are closed under union, that is, if L and L ′ are CFL, then so is L ∪ L ′.
- Prove that CFL are closed under concatenation, that is, if L and L ′ are CFL, then so is LL ′.
- Prove that CFL are closed under reversal, that is, if L is a CFL, then so is L R .
-
Prove that CFL are not closed under complement. That is, if L is a CFL over ∑, then it is not necessarily the case that
, that is, ∑* − L is a CFL.
Hint . Toward your counterexample begin by thinking set-theoretically. - Prove that the language over { a , b } given by L = { a n ba n 2 : n > 0} is not a CFL.
- The language L = {1 p : p is a prime}, over ∑ = {1}, is not regular. Is it a CFL? Why?
- The language L = {1 n 3 : n ≥ 0}, over ∑ = {1}, is not regular. Is it a CFL? Why?
-
Prove that the intersection of a CFL L and a regular language L ′ is a CFL.
Hint . Let M be a PDA for L and N a FA for L ′. Assume that the PDA accepts by accepting state . Now imitate the construction of 3.1.2.2 . -
Prove that the language L of strings over {0, 1, 2} that have an equal number of zeros, ones and twos is not a CFL.
Hint . The pumping lemma will not work directly. However, 0*1*2* defines a regular language. - Prove that the language over {0, 1, #} given by { z # x # y : { x , y , z } ⊆ {0, 1}* ∧ z = x + y in binary} is not a CFL.
125 This special case includes strings such as ((())) but not ((()))(()).
126 If instead we opted for the understanding that a
Σ ∪ {
}, then we could conflate instructions one and two, and three and four.
2 The reader should not overlook the fact that we do not need to know what a “computation” is before we know what an “ID” is! Indeed, we will define a computation as an appropriate sequence of IDs.
127 Note the there is. I am not saying that it is the only move, or that I uniquely determines J.
128 To allow such PDAs to begin a computation, the stack is “externally”—i.e., not by a PDA instruction—initialized with a special “bottom of the stack ‘initial’ symbol”.
129 By Empty Stack.
130 By Accepting State.
131 By Empty Stack and Accepting State. We may also say “AS+ES-accepted”.
132 In ( q 0 , x , $)
* ( q ,
, $), that is, in ( q 0 , x , $)
I 1
I 2
· · · I r
( q ,
, $) each I i , has $ at the bottom of its stack. In (5) we left all else the same, but we removed all the $’s.
133 Terminating, since
has no pure push moves.
134 The study of (in our case, mathematical) trees.
135 We say that the sp (
j ) are pairwise disjoint .
136 This explains the specific to this proof, and “nonstandard”, choice of a non Latin capital letter, to allow this level of “inclusivity” in the notation.
137 The last node on the path is a terminal in w . A path of length l has l + 1 nodes.