a) Provide a careful and complete argument that will convince a skeptical but rational jury that every nonempty string of the target language L must contain at least one of the strings aab, aba, baa as a substring. Note that the latter strings are the shortest nonempty strings in L. Hint: Given a string w of L, chop w up into consecutive segments of length three. Each of these segments is either one of the desired strings aab, aba, baa, or else it is one of the other five possible strings of length four over the alphabet {a, b}. In the former case, you're done. In the latter, argue that at least one of the segments must be aaa (why?). Take it from there.
Zoom in on one of the occurrences of aaa in w. The neighboring length 3 segments of w are either both also aaa, or else one of them contains the symbol b. In the former case, "grow" the aaa segment by adding the neighboring aaa segments to it. Iterate this process until the boundary of the "all a's" region is reached. Notice that an occurrence of b will eventually be found either to the right or to the left of an aaa segment, since otherwise the string would contain only a's and therefore would not belong to L. If an occurrence of b is found to the left, then the string baa will occur at the boundary. If an occurrence of b is found to the right, then the string aab will occur at the boundary (the other boundary may be one of the ends of the string in either of these cases, which is ok). In either case, one of the target strings aab, aba, baa will occur as a substring of w as claimed.
b) Use the fact stated in part a) to design a PDA P that recognizes L. Your PDA design should be directly based on part a). If you wish, provide a state transition diagram in extended PDA (ePDA) notation first, and then show the standard PDA state transition diagram associated with it. Explain.
a) Design a PDA P that recognizes the language generated by G. Follow the CFG-to-PDA conversion procedure discussed in class. The machine P should have 3 states. Explain.
The key transitions are those from the compute state to itself. There is one transition of the form ε, A -> w for each rule of the grammar of the form A -> w, where A is a variable and w is a string of terminals and nonterminals. For the grammar given above, these transitions are the following:
ε, S -> ASB | 10 | SS ε, A -> 1A | ε ε, B -> B0 | εThe use of the symbol | is shorthand; there will really be a separate transition for each possible consequent of each rule. This corresponds to nondeterminism of the PDA.
We must also add a transition of the form a, a -> ε for each terminal symbol a. In this grammar there are precisely two terminal symbols x, y, so two rules are added in this stage:
0, 0 -> ε 1, 1 -> εThis completes the construction of the PDA corresponding to the grammar given above.
b) Give a step by step description of an accepting computation of your PDA P from part a) on the input string 11000. Indicate the full sequence of state transitions of P. Also, clearly show each step in the computation by drawing the following ingredients (draw separate copies of each for every step):
(11000, ε)
(11000, S$)
(11000, ASB$)
(11000, 1ASB$)
(1000, ASB$)
(1000, SB$)
(1000, 10B$)
(000, 0B$)
(00, B$)
(00, B0$)
(00, B00$)
(00, 00$)
(0, 0$)
(ε, $)
(ε, ε)
c) Give, in detail, the derivation of the string 11000 in the grammar G that corresponds to the particular accepting computation that you described in part b).
S => ASB => 1ASB => 1SB => 110B => 110B0 => 110B00 => 11000
δ(q,n,a) = (q',n').The input string is accepted by P if and only if the computation of P on input w ends in an accepting state.
a) Suppose that L is a regular language. Must there exist a PIA P that recognizes L? Explain your answer carefully.
δP(q,blank,a) = (q',blank), where q' = δM(q,a), for all states qHere, the states q are the same as for the DFA M, as is the input alphabet. Since P so defined operates exactly like the original DFA M, it recognizes the same language L.
b) Can you construct a PIA that recognizes the language L = {0n 1n | n ≥ 0}?
c) (Optional extra credit) Can you give a simple characterization of the class of languages that can be recognized by PIA? Any solution submitted for this portion must include a carefully reasoned and complete explanation.