cse 105

CSE 105 THEORY OF COMPUTATION Fall 2016 - PowerPoint PPT Presentation

CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/ T odays lecture Examples of undecidable languages Examples of decidable languages Reductions Reading: Chapter 5 Previously Diag


  1. CSE 105 THEORY OF COMPUTATION Fall 2016 http://cseweb.ucsd.edu/classes/fa16/cse105-abc/

  2. T oday’s lecture ● Examples of undecidable languages ● Examples of decidable languages ● Reductions ● Reading: Chapter 5

  3. Previously … ● Diag = {<M> | M is a TM s.t. <M> is not in L(M) } Undecidable (in fact, not even RE) – ● DD = {<M,<M>> | M is a TM s.t. <M> is not in L(M) } Just like Diag: Undecidavle (in fact, not even RE) – Proof: Assume DD is decidable. It follows that Diag is decidable. – Contradiction! ● A TM = { <M,w> | M is a TM such that M(w) accepts } A TM is RE, but not Decidable. Therefore, also not coRE. – Proof: Assume A TM is decidable. It follows that MM is decidable. – Contradiction!

  4. A TM is undecidable (Proof details) ● Assume for contradiction A TM is decidable ● MM = {<M,<M>> | M is a TM} is decidable ● MM - A TM is decidable because the class of decidable languages is closed under set difgerence. ● Notice: MM – A TM = { <M,<M>> | M is a TM} - {<M,w> | w ∈ L(M) } = { <M,<M>> | M is a TM and <M> ∉ L(M) } = DD ● So, DD is decidable. Contradiction!

  5. Some example languages ● Acceptance problem: A DFA = { <M,w> | M is a DFA and M(w) accepts } – A TM = { <M,w> | M is a TM and M(w) accepts } – ● Emptyness problem: E DFA = {<M> | M is a DFA and L(M) is the empty set } – E TM = {<M> | M is a TM and L(M) is the empty set } – ● Equivalence problem: EQ DFA = { <M,M’> | M and M’ are DFAs and L(M) = L(M’) } –

  6. Some example languages ● Acceptance problem: A DFA = { <M,w> | M is a DFA and M(w) accepts } DECIDABLE – A TM = { <M,w> | M is a TM and M(w) accepts } UNDECIDABLE – ● Emptyness problem: E DFA = {<M> | M is a DFA and L(M) is the empty set } DECIDABLE – E TM = {<M> | M is a TM and L(M) is the empty set } UNDECIDABLE – ● Equivalence problem: EQ DFA = { <M,M’> | M and M’ are DFAs and L(M) = L(M’) } DECIDABLE –

  7. E DFA is decidable ● P EDFA (w) = 1. Parse input w as <Q,Σ,δ,s,F>. If parse fails, then reject. 2. Let X = {s} 3. For all q in X and a in Σ a) Let q’ = δ(q,a) b) If q’ is not in X, then X ← X U {q’} and restart the loop at 3) 4. If X intersects F, then accept, else reject.

  8. E DFA is decidable EDFA ● P EDFA (w) = 1. Parse input w as <Q,Σ,δ,s,F>. If parse fails, then reject. 2. Let X = {s} 3. For all q in X and a in Σ a) Let q’ = δ(q,a) b) If q’ is not in X, then X ← X U {q’} and restart the loop at 3) 4. If X intersects F, then accept, else reject.

  9. E DFA is decidable What is the language of P EDFA ? ● P EDFA (w) = A) {<P,w> | P is a DFA and P(w) accepts} B) {<P> | P is a DFA} 1. Parse input w as <Q,Σ,δ,s,F>. If parse fails, then reject. C) {<P> | P is a DFA and L(P) = Ø } 2. Let X = {s} D) {<P> | P is a DFA and L(P) = {ε} } E) None of the above 3. For all q in X and a in Σ a) Let q’ = δ(q,a) b) If q’ is not in X, then X ← X U {q’} and restart the loop at 3) 4. If X intersects F, then accept, else reject.

  10. E DFA is decidable ● P EDFA (w) = 1. Parse input w as <Q,Σ,δ,s,F>. If parse fails, then reject. 2. Let X = {s} 3. For all q in X and a in Σ a) Let q’ = δ(q,a) b) If q’ is not in X, then X ← X U {q’} and restart the loop at 3) 4. If X intersects F, then reject reject , else accept accept

  11. EQ DFA is decidable ● P EQDFA (<M,M’>) 1) Check if both M and M’ are DFA. If not, then reject. 2) Use closure properties of regular languages to build a DFA M’’ for L(M’’) = (L(M) – L(M’)) U (L(M’) - L(M)) Run P EDFA (<M’’>). If P EDFA accepts, then accept, else reject. – ● Notice L(M)=L(M’) if and only if L(M’’) is empty.

  12. Summary ● DD is decidable → Diag is decidable Since Diag is undecidable, then DD is also undecidable – ● A TM is decidable → DD is decidable Since DD is undecidable, then A TM is undecidable – ● E DFA is decidable → EQ DFA is decidable Since E DFA is decidable, then EQ DFA is decidable –

  13. Proving implications ● Claim: If A is decidable, then B is decidable ● Proof: Assume A is decidable – Show that B is also decidable – ● Proof methods: Using closure properties of decidable languages: transform A into B – Let M be a decider for A. Use M to build a decider for B – ● Notice: We do not need to know if A is decidable

  14. Reductions ● “If A is decidable then B is decidable” Can be proved using closure properties, or assuming a decider – for A Makes sense even when A or B are undecidable – ● When decidability of B is unknown This reduces the problem of solving B to the (possibly easier) – problem of solving A ● Proof is called a “reduction” from B to A Oftern written B < A –

  15. Reductions ● “If A is decidable then B is decidable” Can be proved using closure properties, or assuming a decider – Assume B<A B<A and A is decidable. for A What can you conclude? Makes sense even when A or B are undecidable – A) B is also decidable ● When decidability of B is unknown B) B is a subset of A This reduces the problem of solving B to the (possibly easier) C) B is undecidable – problem of solving A D) B may be decidable or undecidable E) I don’t know ● Proof is called a “reduction” from B to A Oftern written B B < < A A –

  16. Reductions ● “If A is decidable then B is decidable” Can be proved using closure properties, or assuming a decider – Assume A<B A<B and A is decidable. for A What can you conclude? Makes sense even when A or B are undecidable – A) B is also decidable ● When decidability of B is unknown B) B is a subset of A This reduces the problem of solving B to the (possibly easier) C) B is undecidable – problem of solving A D) B may be decidable or undecidable E) I don’t know ● Proof is called a “reduction” from B to A Oftern written B B < < A A –

  17. Reductions ● “If A is decidable then B is decidable” Can be proved using closure properties, or assuming a decider – Assume A<B A<B and A is undecidable. for A What can you conclude? Makes sense even when A or B are undecidable – A) B is also decidable ● When decidability of B is unknown B) B is a subset of A This reduces the problem of solving B to the (possibly easier) C) B is undecidable – problem of solving A D) B may be decidable or undecidable E) I don’t know ● Proof is called a “reduction” from B to A Oftern written B B < < A A –

  18. Reductions ● “If A is decidable then B is decidable” Can be proved using closure properties, or assuming a decider – Assume B<A B<A and A is undecidable. for A What can you conclude? Makes sense even when A or B are undecidable – A) B is also decidable ● When decidability of B is unknown B) B is a subset of A This reduces the problem of solving B to the (possibly easier) C) B is undecidable – problem of solving A D) B may be decidable or undecidable E) I don’t know ● Proof is called a “reduction” from B to A Oftern written B B < < A A –

  19. Some problems on CFG ● EQ CFG = {<G 1 ,G 2 > | G 1 ,G 2 CFG s.t. L(G 1 ) = L(G 2 ) } ● SUB CFG = {<G 1 ,G 2 > | G 1 ,G 2 CFG s.t. L(G 1 ) ⊆ L(G 2 ) } ● SUP CFG = {<G 1 ,G 2 > | G 1 ,G 2 CFG s.t. L(G 1 ) ⊇ L(G 2 ) } ● Can you give reductions between any two of these problems? In what direction? EQ CFG < SUB CFG ? – SUB CFG < SUP CFG ? – SUP CFG < EQ CFG ? –

  20. Next Time ● We have class on Wednesday ● Thursday and Friday: Thanksgiving! ● Haskell 4 due tonight ● HW7 due T ue Nov 29 ● Last week of classes after Thanksgiving

Recommend


More recommend