

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solutions to various problems related to turing machines, decidability, and automata theory. Topics include proving that some decidable languages are not decided by certain turing machines, constructing turing machines that decide specific languages, and understanding the relationship between context-free languages and regular languages. Students of computer science, particularly those studying automata theory and formal languages, will find this document useful.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


4.28 Let A be a Turing-recognizable language consisting of descriptions of Turing ma- chines, {〈M 1 〉, 〈M 2 〉,... }, where every Mi is a decider. Prove that some decidable language D is not decided by any decider Mi whose description appears in A. (Hint: You may find it helpful to consider an enumerator for A.)
4.1 (a) Yes. The DFA M accepts 0100. (b) No. M doesn’t accept 011. (c) No. This input has only a single component and thus is not of the correct form. (d) No. The first component is not a regular expression and so the input is not of the correct form. (e) No. M ’s language isn’t empty. (f) Yes. M accepts the same language as itself. 4.5 (a) No, f is not one-to-one because f (1) = f (3). (d) Yes, g is one-to-one. 4.9 The following TM I decides INFINITE (^) DFA. I = “ On input 〈A〉 where A is a DFA:
1. Let k be the number of states of A. 2. Construct a DFA D that accepts all strings of length k or more. 3. Construct a DFA M such that L(M ) = L(A) ∩ L(D). 4. Test L(M ) = ∅, using the E (^) DFA decider T from Theorem 4.4. 5. If T accepts, reject ; if T rejects, accept. ” This algorithm works because a DFA which accepts infinitely many strings must accept arbitrarily long strings. Therefore this algorithm accepts such DFAs. Con- versely, if the algorithm accepts a DFA, the DFA accepts some string of length k or more, where k is the number of states of the DFA. This string may be pumped in the manner of the pumping lemma for regular languages to obtain infinitely many accepted strings.
4.11 The following TM decides A.
“ On input 〈M 〉:
1. Construct a DFA O that accepts every string containing an odd number of 1 s. 2. Construct DFA B such that L(B) = L(M ) ∩ L(O). 3. Test whether L(B) = ∅, using the E (^) DFA decider T from Theo- rem 4.4. 4. If T accepts, accept ; if T rejects, reject. ”
4.13 You showed in Problem 2.18 that, if C is a context-free language and R is a regular language, then C ∩ R is context free. Therefore 1 ∗^ ∩ L(G) is context free. The following TM decides A. “ On input 〈G〉:
1. Construct CFG H such that L(H) = 1 ∗^ ∩ L(G). 2. Test whether L(H) = ∅, using the E (^) CFG decider R from Theo- rem 4.8.
3. If R accepts, reject; if R rejects, accept. ”
4.21 The following procedure decides AMBIG NFA. Given an NFA N, we design a DFA D that simulates N and accepts a string iff it is accepted by N along two different computational branches. Then we use a decider for E (^) DFA to determine whether D accepts any strings. Our strategy for constructing D is similar to the NFA to DFA conversion in the proof of Theorem 1.39. We simulate N by keeping a pebble on each active state. We begin by putting a red pebble on the start state and on each state reachable from the start along ε transitions. We move, add, and remove pebbles in accordance with N’s transitions, preserving the color of the pebbles. Whenever two or more pebbles are moved to the same state, we replace its pebbles with a blue pebble. After reading the input, we accept if a blue pebble is on an accept states of N. The DFA D has a state corresponding to each possible position of pebbles. For each state of N, three possibilities occur: it can contain a red pebble, a blue pebble, or no pebble. Thus, if N has n states, D will have 3 n^ states. Its start state, accept states, and transition function are defined to carry out the simulation.
4.23 The language of all strings with an equal number of 0 s and 1 s is a context free language, generated by the grammar S → 1 S 0 S | 0 S 1 S | ε. Let P be the PDA that recognizes this language. Build a TM M for BAL (^) DFA , which operates as follows. On input 〈B〉, where B is a DFA, use B and P to construct a new PDA R that recognizes the intersection of the languages of B and P. Then test whether R’s language is empty. If its language is empty, reject ; otherwise, accept.