Theory of Computation Test 2

Theorems Chapter 4
STUDY
PLAY
Theorem 4.1:
ADFA = {<B,w>|B is a DFA that accepts input string w} is a decidable language.
Proof Idea:
Design a TM M that decides ADFA
M ="on input <B,w>, where B is a DFA and w is a string:
1. Simulate B on input w.
2. If the simulation ends in an accept state, accept. If it ends in a non-accepting state, reject."
You could write a computer program to do so

First examine the input <B, w>
How to represent B, a reasonable DFA?
W, a valid string?
M rejects if the input <B,w> doesn't properly represent a DFA B and a string w.
Second, M carries out the simulation
Start from B's start state and w's leftmost symbol
M keeps track of B's current state and B's position in the input w by writing on its tape.
When M finishes processing the last symbol of w, accepts the input if B is an accepting state, otherwise, rejects.
Theorem 4.2:
ANFA = {<B,w>|B is a NFA that accepts input string w} is a decidable language.
Proof Idea:
Design a TM N that decides ANFA
N ="on input <B,w>, where B is a NFA and w is a string:
1. Simulate B on input w.
Need to simulate every path on the computation tree.
2. If one of the computation ends in an accept state, accept. otherwise, reject."


Alternative Idea:
Design a TM N that decides ANFA
N ="on input <B,w>, where B is a NFA and w is a string:
1. Convert NFA B to an equivalent DFA C, using the procedure for this conversion given in Theorem 1.39.
2. Run TM M from the Theorem 4.1 on input <C,w>
3. If M accepts, accept; otherwise, reject."
Theorem 4.3:
AREX = {<R,w> | R is a regular expression that generates string w} is a decidable language.
Proof Idea:
Design a TM P that decides AREX
P ="on input <R,w>, where B is a regular expression and w is a string:
1. Convert regular expression R to an equivalent NFA A, using the procedure for this conversion given in Theorem 1.54.
2. Run TM N from the Theorem 4.2 on input <A,w>
3. If N accepts, accept; if N rejects, reject."
ADFA, ANFA and AREX
ADFA, ANFA and AREX are all decidable languages

Design a TM for one of the languages, can be easily incorporated into a TM for the other languages
DFA NFA REX
Theorem 4.4:
EDFA = {<A>|A is a DFA and L(A) = } is a decidable language.
Hint: Given a graph, can you tell me if you can reach node B starting from node A?
Proof Idea:
Design a TM T that decides EDFA
T ="on input <A>, where A is a DFA:
1. Mark the start state of A.
2. Repeat until no new states get marked:
3. Mark any state that has a transition coming into it from any state that is already marked.
4. If no accept state is marked, accept; otherwise, reject."
Trace the reachability algorithm for the graph made up by the prof. on the board.
Theorem 4.5:
EQDFA = { <A,B> | A and B are DFAs and L(A) = L(B) } is a decidable language.
Proof Idea:
Design a TM F that decides EQDFA
Construct a new DFA C from A and B, where C accepts only those strings that are only accepted by A or B but not by both.
If C empty, then A and B accept the same language
How to construct C? (see next slide)
F = "on input <A, B>, where A and B are DFAs:
1. Construct DFA C.
2. Run TM T from Theorem 4.4 on input <C>.
3. If T accepts (i.e. C empty), accept. If T rejects, reject."
Exercise 4.11:
Let A = {M|M is a DFA which doesn't accept any string containing an odd number of 1s}. Show that A is decidable.
Proof Idea:
Design a TM F that decides A.
F = "on input <M>,
1. Construct DFA O that accepts every string containing an odd number of 1s.
2. Construct DFA B such that L(B) =L(M) L(O).
3. Test whether L(H) = , using the EDFA decider T from Theorem 4.4
4. If T accepts, accept. If T rejects, reject."
Theorem 4.7:
ACFG = {<G,w>|G is a CFG that generates string w} is a decidable language,
Proof Idea:
Design a TM S that decides ACFG
S ="on input <G,w>, where G is a CFG and w is a string:
1. Convert G to an equivalent grammar in Chomsky normal form. Any string of length n>1 generated in exactly 2n-1 steps!
2. List all derivations with 2n-1 steps, where n is the length of w.
3. If any of these derivations generate w, accept; if not, reject."
Theorem 4.8:
ECFG = {<G>| G is a CFG and L(G) = } is a decidable language,
Proof Idea:
Design a TM R that decides ECFG
R ="on input <G>, where G is a CFG:
1. Mark all terminal symbols in G.
2. Repeat until no new variables get marked.
3. mark any variable A where G has a rule A U1 U2 ... Uk and each symbol U1 U2 ... Uk has already been marked.
4. If the start variable is not marked, accept; otherwise, reject."

Try on ABC BC Xa
Theorem 4.9:
Every context-free language is decidable
Proof Idea:
Let G be a CFG for A and design a TM MG that decides A. We build a copy of G into MG.
MG ="on input w:
1. Run TM S (from thm 4.7) on input <G,w>.
2. If this machine accepts, accept; if it rejects, reject."
Theorem 4.11:
ATM = {<M, w>|M is a Turing machine and M accepts w} is undecidable.
Proof:
Assume that ATM is decidable and obtain a contradiction
Suppose that H is a decider for ATM. On input <M, w>, where M is a TM and w is a string,

Construct a new Turing machine D with H as a subroutine. But it does the opposite of H.
D = "On input <M>, where M is a TM:
1. Run H on input <M, <M>>.
2. Output the opposite of what H outputs; that is, if H accepts, reject and if H rejects, accept." (reasonable.)

Review the Steps:
Assume TM h decides ATM. Then use H to build a TM D that when given input <M> accepts exactly when M does not accept <M>. Finally run D on itself.

H accepts <M, w> exactly when M accept w.

D rejects <M> exactly when M accepts <M>.

D rejects <D> exactly when D accepts <D> (Contradiction)
ATM is Turing-recognizable
Construct a TM U that recognizes ATM.
U = "On input <M, w>, where M is a TM and w is a string:
1. Simulate M on input w.
2. If M ever enters its accept state, accept; if M ever enters its reject state, reject."
(U is known as the Universal TM)
Theorem 4.22:
A language is decidable if and only if it is Turing-recognizable and co-Turing-recognizable
Co-Turing-recognizable:
A language is co-Turing-recognizable if it is the complement of a Turing-recognizable language

The complement of a language is the language consisting of all strings that are not in the language.

Proof in two directions:
First, if A is decidable, show both A and its complement are Turing-recognizable.
A is decidable A is also Turing-recognizable
A is decidable A's complement is decidable A's complement is Turing-recognizable.
Second, if both A and its complement are Turing-recognizable, show A is decidable.

Let M1 be the recognizer for A and M2 be the recognizer for the complement. The following Turing machine is a decider for A.
M = "On input w:
1. Run both M1 and M2 on input w in parallel.
2. If M1 accepts, accept; if M2 accepts, reject."
Corollary 4.23:
The complement of ATM is not Turing-recognizable
Proof
ATM is Turing-recognizable. If the complement of ATM is Turing-recognizable, ATM would be decidable (previous proof).
According to Theorem 4.11, ATM is not decidable.
So the complement of ATM is not Turing-recognizable.
YOU MIGHT ALSO LIKE...