Presentation is loading. Please wait.

Presentation is loading. Please wait.

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453.

Similar presentations


Presentation on theme: "FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453."— Presentation transcript:

1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453

2 UNDECIDABILITY II: REDUCTIONS

3 A TM = { (M,w) | M is a TM that accepts string w } A TM is undecidable: (constructive proof & subtle) Assume machine H semi-decides A TM H( (M,w) ) = Accept if M accepts w Rejects or loops otherwise Construct a new TM D H as follows: on input M, run H on (M,M) and output the “opposite” of H whenever possible.

4 D H ( M ) = Reject if M accepts M (i.e. if H( M, M ) = Accept) Accept if M rejects M (i.e. if H( M, M ) = Reject) loops if M loops on M (i.e. if H( M, M ) loops) DHDH DHDH DHDH DHDH DHDH DHDH DHDH DHDH DHDH DHDH DHDH DHDH DHDH Note: There is no contradiction here! D H loops on D H We can effectively construct an instance which does not belong to A TM (namely, (D H, D H ) ) but H fails to tell us that.

5 That is: Given any semi-decision machine H for A TM (and thus a potential decision machine for A TM ), we can effectively construct an instance which does not belong to A TM (namely, ( D H, D H )) but H fails to tell us that. So H cannot be a decision machine for A TM

6 HALT TM = { (M,w) | M is a TM that halts on string w } Theorem: HALT TM is undecidable THE HALTING PROBLEM Proof: Assume, for a contradiction, that TM H decides HALT TM We use H to construct a TM D that decides A TM On input (M,w), D runs H on (M,w) If H rejects then reject If H accepts, run M on w until it halts: Accept if M accepts and Reject if M rejects

7 H (M,w) M w If M doesn’t halt: REJECT If M halts Does M halt on w? D

8 In most cases, we will show that a language L is undecidable by showing that if it is decidable, then so is A TM We reduce deciding A TM to deciding the language in question A TM “<” L So, A TM “<” Halt TM Is Halt TM “<” A TM ?

9 E TM = { M | M is a TM and L(M) =  } Theorem: E TM is undecidable Proof: Assume, for a contradiction, that TM Z decides E TM s If s  w, REJECT If s = w, run M(w) Algorithm for deciding A TM : On input (M,w): MwMw 1. Create M w 2. Run Z on M w Use Z as a subroutine to decide A TM So, L (M w ) =   M(w) does not accept L (M w )    M(w) accepts

10 Accepts if M does not accept w Rejects, otherwise Z s If s  w, REJECT If s = w, run M(w) MwMw (M,w) L(M w ) =  ? So, L (M w ) =   M(w) does not accept REVERSE accept/reject Decision Machine for A TM N L(N) =  ? MwMw

11 REGULAR TM = { M | M is a TM and L(M) is regular} Theorem: REGULAR TM is undecidable Proof: Assume, for a contradiction, that TM R decides REGULAR TM

12 R N Is L(N) regular? s If s = 0 n 1 n, accept Else run M(w) MwMw L(M w ) = Σ* if M(w) accepts {0 n 1 n } otherwise L(M w ) is regular  M(w) accepts MwMw Is L(M w ) regular? Yes  M accepts w

13 ALL PDA = { P | P is a PDA and L(P) = Σ* } Theorem: ALL PDA is undecidable Proof: Assume, for a contradiction, that TM A decides ALL PDA We use A to decide A TM More subtle construction Idea! If M(w) does not accept, then there is no accepting computation for M on input w. Then any string of 0’s and 1’s will fail to be (a code for) an accepting computation. So, given (M, w) construct a PDA that accepts non-accepting computations of M on w. Thus, M(w) does not accept  L(P) = Σ* Idea!

14 CONFIGURATIONS 11010q 7 00110 q7q7 10 000 011 1 1

15 COMPUTATION HISTORIES An accepting computation history is a sequence of configurations C 1,C 2,…,C k, where An rejecting computation history is a sequence of configurations C 1,C 2,…,C k, where 1. C 1 is the start configuration, 2. C k is a rejecting configuration, 3. Each C i follows from C i-1 2. C k is an accepting configuration, 1. C 1 is the start configuration,

16 M accepts w if and only if there exists an accepting computation history that starts with C 1 =q 0 w

17 ALL PDA = { P | P is a PDA and L(P) = Σ* } Theorem: ALL PDA is undecidable Proof: Assume, for a contradiction, that TM A decides ALL PDA We use A to decide A TM On input (M,w), construct a PDA P that accepts Σ* if and only if M does not accept w P will recognize all strings that are NOT accepting computation histories for M on w

18 1. Do not start with C 1 2. Do not end with an accepting configuration 3. Where some C i does not properly yield C i+1 P will recognize all strings (read as sequences of configurations) that: ε,ε → ε Non-deterministic checks for 1, 2, and 3.

19 0 → , R  → , R q accept q reject 0 → x, R x → x, R  → , R x → x, R 0 → 0, L x → x, L x → x, R  → , L  → , R 0 → x, R 0 → 0, R  → , R x → x, R { 0 | n ≥ 0 } 2n2n q0q0 q1q1 q2q2 q3q3 q4q4

20 0 → , R  → , R q accept q reject 0 → x, R x → x, R  → , R x → x, R 0 → 0, L x → x, L x → x, R  → , L  → , R 0 → x, R 0 → 0, R  → , R x → x, R { 0 | n ≥ 0 } 2n2n q0q0 q1q1 q2q2 q3q3 q4q4 q 0 0000  q 1 000  xq 3 00  x0q 4 0  x0xq 3  x0q 2 x  xq 2 0x  q 2 x0x q 2  x0x

21 P recognizes all strings except: #C 1 # C 2 R #C 3 #C 4 R #C 5 #C 6 R #….# C k If k is odd, put C k on stack and see if C k+1 R follows properly: For example, If =uaq i bv and  (q i,b) = (q j,c,R), then C k properly yields C k+1  C k+1 = uacq j v

22 P recognizes all strings except: #C 1 # C 2 R #C 3 #C 4 R #C 5 #C 6 R #….# C k If k is odd, put C k on stack and see if C k+1 R follows properly: For example, If =uaq i bv and  (q i,b) = (q j,c,L), then C k properly yields C k+1  C k+1 = uq j acv

23 P recognizes all strings except: #C 1 # C 2 R #C 3 #C 4 R #C 5 #C 6 R #….# C k If k is even, put C k R on stack and see if C k+1 follows properly: For example, If =uaq i bv and  (q i,b) = (q j,c,L), then C k properly yields C k+1  C k+1 = uq j acv

24 ALL PDA = { P | P is a PDA and L(P) = Σ* } Theorem: ALL PDA is undecidable Proof: Assume, for a contradiction, that TM A decides ALL PDA We use A to decide A TM On input (M,w), construct a PDA P that accepts Σ* if and only if M does not accept w P will recognize all strings that are NOT accepting computation histories for M on w

25 MAPPING REDUCIBILITY f : Σ*  Σ* is a computable function if some Turing machine M, on every input w, halts with just f(w) on its tape A language A is mapping reducible to language B, written A  m B, if there is a computable function (“coding”) f : Σ*  Σ*, where for every w, w  A  f(w)  B f is called a reduction from A to B

26 AB f f

27 Theorem: If A  m B and B is decidable, then A is decidable Proof: Let M decide B and let f be a reduction from A to B We build a machine N that decides A as follows: On input w: 1. Compute f(w) 2. Run M on f(w)

28 All undecidability proofs from today can be seen as constructing an f that reduces A TM to the proper language Exercise. Construct such an f in each case. (Hint. Sometimes you have to consider the complement of the language. )

29 All undecidability proofs from today can be seen as constructing an f that reduces A TM to the proper language A TM  m HALT TM : Map (M, w)  (M’, w) where M’(w) = M(w) if M(w) accepts loops otherwise So (M, w)  A TM  (M’, w)  HALT TM

30 Read chapter 5.1-5.3 of the book for next time


Download ppt "FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453."

Similar presentations


Ads by Google