Homework Assignment 7 ANSWERS

Transcription

Homework Assignment 7 ANSWERS
Homework Assignment 7 ANSWERS
CSCI 2670 Introduction to Theory of Computing, Spring 2015
Due Monday April 27, 2015
This homework assignment is about decidability, undecidability, and proofs.
1. Question 4.1, page 210 (exercise only, you do NOT need to turn in your answers).
Answer: On page 213.
2. Question 4.2, page 211 (hint: use theorem 4.5 and theorem 1.54 (or lemma 1.55)).
Answer: Express the language as
EQDF A,REX = {hD, Ei | D is a DFA, E is a reg. exp. and L(D) = L(E)}
To prove this language is decidable, we design the following decider M1 for it.
Since EQDF A is decidable, we assume M to be its decider.
On inputs hD, Ei, where D is a DFA and E is a regular expression. M1 works as follows:
(1) convert E to an equivalent NFA (by Lemma 1.55);
(2) convert NFA to an equivalent DFA DE (by Theorem 1.39) where L(DE ) = L(E);
(3) M1 simulates M on input hD, DE i.
(4) M1 accepts hD, Ei if and only if M accepts hD, DE i;
Clearly, M1 halts on all inputs and it decides language EQDF A,REX .
3. Question 4.3, page 121 (hint: use theorem 4.5 and note that it is not difficult to design
a DFA to recognize language Σ∗ ).
Answer: To prove that language ALLDF A = {hM i : M is a DFA and L(M ) = Σ∗ } is decidable, we
construct the following decider T for it. Since by Theorem 4.5, language EDF A is decider, we assume
that S is a decider for EDF A . T works as follows:
(1) on input hM i,
(2) convert DFA M to another M 0 by flipping accept states to non-accept states and vice versa;
(3) run S on input hM 0 i;
(4) accept if and only if S accepts hM 0 i;
Because S halts on all inputs, S halts on all inputs. T is a decider for ALLDF A .
1
4. Question 4.4, page 121 (hint: can you solve the problem if the CFG is in Chomsky
normal form?).
Answer: To prove that language ACF G = {hGi : G is a CFG that generates }, we construct a
decider M as follows:
(1) on input hGi;
(2) use the process to convert hGi into Chomsky normal form F ;
(3) let S be the start nonterminal symbol in F ;
(4) accept if and only if S → is a rule in F .
Because the process to convert a CFG to Chomsky normal form is finite, M is a decider.
5. Read and understand Theorem 4.11 (given on page 202) and its proof (given on pages
207-209). Use succinct logical reasoning statements to rewrite the proof. You can
only use succinct logical statements, assumptions, and/or inferences, with a total up
to 20 sentences. Each sentence can be at most one line long. Number these sentences
and they are connected logically in a sequence.
Answer: Note the the book uses a slightly different notation. It uses M to represents an encoding
of machine M and uses hM i for same string as M but not have the meaning of M (i.e., just a string).
Okay, here is the proof:
(1) Assume AT M is a decidable;
(2) Assume that H is a decider for AT M such that H accepts input hM, wi iff M accepts input w;
(3) Construct a TM D that it rejects input hM i iff H accepts hM, hM ii;
(4) by (2) and (3), D rejects input hM i iff M accepts input hM i;
(5) in the statement of (4), replace M with D, we obtain the following:
(6) D rejects input hDi iff D accepts input hDi;
(7) statement (6) is a paradox, thus the assumption (2) is wrong;
(8) by (7) the assumption (1) is wrong.
(9) by (8), AT M is undecidable.
6. Read and understand theorem 5.1 and its proof (given on pages 216-217). Answer the
following questions:
(1) Which are the three TMs R, S, and M for ?
Answer: R is the assumed decider for HALTT M ; S is the constructed TM for AT M , and M is the
TM as a part of the input hM, wi for S or R.
(2) What does it mean when S accepts? What about when R accepts? How about
M accepts?
Answer: “S accepts” means “S accepts input hM, wi”, implying M accepts input w and halts. “R
accepts” means “R accepts input hM, wi”, implying M halts on input w. “M accepts” means “M
accepts input w and halts”.