A = { G : G is a connected undirected graph} This is called an encoding Typically for graphs G = (V, E) A = { G : G is a connected undirected graph} M= “On input <G> 1. Mark an arbitrary vertex 2. Repeat until no new vertices are marked • For each vertex • Mark it if it is connected by an edge to a marked vertex 3. If all vertices are marked then accept else reject Decider ADFA = { D, w : D is a DFA that accepts input w} ANFA = { N, w : N is an NFA that accepts input w} emptiness testing EDFA = { D : D is an DFA and L(D) = ∅} emptiness testing EDFA = { D : D is an DFA and L(D) = ∅} Try #1 MEDFA = “On input D 1. If D has any accept states reject else accept” A = { G : G is connected undirected graph} M= “On input <G> 1. Mark an arbitrary vertex 2. Repeat until no new vertices are marked • For each vertex • Mark it if it is connected by an edge to a marked vertex 3. If all vertices are marked then accept else reject equivalence testing EQDFA = { D1, D2 : D1, D2 are DFAs and L(D1) = L(D2)} equivalence testing EQDFA = { D1, D2 : D1, D2 are DFAs and L(D1) = L(D2)} Try #1 MEQDFA = “On input D1, D2 1. For every w ∈ Σ* If D1, D2 either both accept or both reject accept else reject” equivalence testing EQDFA = { D1, D2 : D1, D2 are DFAs and L(D1) = L(D2)} idea: use emptiness testing of the symmetric difference of L(D1) and L(D2) ATM = { M, w : M is a TM that accepts input w} U= “On input M, w 1. Simulate M on w 2. If M ends in an accept state, accept else if it ends in a reject state reject” L(U) = ATM Decider or Recognizer? ATM = { M, w : M is a TM that accepts input w} is undecidable ATM = { M, w : M is a TM that accepts input w} is undecidable Proof by contradiction ATM = { M, w : M is a TM that accepts input w} is undecidable Suppose ATM is decidable. Then there is a TM H that decides ATM. H( M, w ) = { accept reject iff M accepts w iff M does not accept w ATM = { M, w : M is a TM that accepts input w} is undecidable Construct TM D that uses TM H as a subroutine: D= “On input M where M is a TM 1. Run TM H on M, M 2. Output the opposite of H a) If H ends in an accept state, reject b) If H ends in a reject state, accept” ATM = { M, w : M is a TM that accepts input w} is undecidable reject iff M accepts M accept iff M does not accept M { D( M ) = ATM = { M, w : M is a TM that accepts input w} is undecidable D( D ) = { reject iff D accepts D accept iff D does not accept D Contradiction!
© Copyright 2024 Paperzz