CMPS 260 Spring 2020
Homework #7: DPDA's, CFL's, Turing Machines, Recursive/RE Languages
Due: May 14

1. Present a DPDA (deterministic PDA) that accepts the language {ambn  |  m > n}. Include a narrative to explain the role/purpose/function played by each state in the DPDA.


2. Present a DPDA (deterministic PDA) that accepts the language {ambn  |  m > n}* (i.e., the Kleene closure of the language from the previous problem). Include a narrative to explain the role/purpose/function played by each state in the DPDA.


3. Give an example of a context-free language whose complement is not context-free. Justify your claim.

Hint: Start with a language that is known not to be a CFL and make a persuasive argument that its complement is a CFL. (The latter argument might be made easier by using the fact that CFL's are closed under union.)


4. Argue persuasively that there is an algorithm by which to determine, given a context-free grammar G (or, respectively, a PDA M) and a positive integer n, whether L(G) (respectively, L(M)) contains any strings of length less than n.

Hint: One way to solve the problem makes use of Linz's Theorems 8.5 and 8.6 (and the fact that Theorem 8.5's proof (that CFL's are closed under intersection with regular languages) is constructive).


5. Present a Turing machine that computes the function f(x) = x mod 4 where the input and output are to be encoded using unary notation.

For example, if, initially, the tape has 27 1's on it (representing the integer 27), the machine should halt with exactly three 1's on the tape (because 27 mod 4 = 3).

Provide a short narrative to explain, at a high level of abstraction, how your machine works.


6. Each move of a standard Turing Machine, as presented by Linz in Chapter 9, results in the machine overwriting the symbol in the current tape cell, moving one cell to the right or to the left, and entering some state. Suppose that we impose the restriction that the symbol written onto the current tape cell must be different from what was there before. That is, in this restricted type of Turing Machine, (qj,b,D) ∈ δ(qi,a) (where D is either 'L' or 'R') implies that a and b are distinct symbols.

Use a simulation argument to show that, for any standard TM M there exists a TM M', restricted in the way described above, such that L(M) = L(M').


7. Present a convincing argument that the intersection of any recursive language L1 with any RE language L2 is RE.

Hint: One approach would be to alter an enumeration procedure for L2 so that it enumerates L1 ∩ L2 instead. Another would be to make use of a decision algorithm for L1 and a decision semi-algorithm for L2.


8. Present a convincing argument that L is recursive if it has an enumeration procedure that "prints" its strings in ascending order by length (so that for any two strings printed consecutively, the second is at least as long as the first).

Hint: Describe a decision algorithm for L that makes use of the described enumeration procedure. Don't forget that there are finitely many strings of any particular length.