Presentation is loading. Please wait.

Presentation is loading. Please wait.

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

Similar presentations


Presentation on theme: "INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011."— Presentation transcript:

1 INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

2 QUIZ 3 The Turing Machine M decides the language L if: M accepts all w ∈ L and rejects all w ∉ L. The language L is Turing-recognizable if: There is a TM that recognizes L (accepts all and only the strings in L). The language L is undecidable if: There is no TM that decides it.

3 QUIZ 3 x a ∈ ƒ(x)?b ∈ ƒ(x)?c ∈ ƒ(x)? ayes no byesnoyes cnoyesno DNoYes

4 QUIZ 3 q a? aab ☐ to_endab b → ☐, L

5 UNDECIDABLE PROBLEMS D TM = { 〈 M 〉 | M is a TM that does not accept 〈 M 〉 } Theorem. D TM is undecidable. Proof. Suppose machine N decides D TM. Then N accepts 〈 N 〉 ⇔ 〈 N 〉  D TM ⇔ N does not accept 〈 N 〉 A TM = { 〈 M,w 〉 | M is a TM that accepts on input w } Theorem. If A TM is decidable, so is D TM. Proof. If ¬A TM is decided by the program nAccept we can decide D TM by calling nAccept(M, 〈 M 〉 ). Theorem. If HALT TM is decidable, then so is A TM. HALT TM = { 〈 M,w 〉 | M is a TM that halts on input w }

6 In most cases, we show that a language 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

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

8 A B ƒ ƒ MAPPING REDUCIBILITY w  A  ƒ(w)  B Σ*Σ*Σ*Σ*

9 Theorem: If A  m B and B is decidable, then A is decidable Proof: Let BSolver be a program to decide B and let ƒ be a reduction from A to B We build a machine ASolver that decides A: ASolver(w): 1. Let s = ƒ(w) 2. Return BSolver(s)

10 Corollary: If A  m B and A is undecidable, then B is undecidable Proof: Suppose, for contradiction, that BSolver decides B and let ƒ be a reduction from A to B. The same machine ASolver decides A: ASolver(w): 1. Let s = ƒ(w) 2. Return BSolver(s) Since A is undecidable the program BSolver must not exist. Thus B is undecidable.

11 Theorem: If A ≤ m B and B ≤ m C, then A ≤ m C Proof: Let ƒ : A  B and g : B  C be computable functions, where w  A ⇔ ƒ(w)  B, x  B ⇔ g(x)  C We build a computable mapping h by setting h(w) = g(ƒ(w)). h is a reduction from A to C: h is computable, since ƒ and g are computable. w ∈ A, ƒ(w) ∈ B, g(ƒ(w)) = h(w) ∈ C

12 THE PCP GAME ba a a ab b bcb b a ba a a ab

13 a aa aaa a a c a aa c a aaa a a aa

14 a ab ca a b a ab abc c a ab b ca a abc c

15 ca a acc ca abc ab

16 aab aa acc a b b c a caa a b b

17 POST CORRESPONDENCE PROBLEM Given a collection of tiles, is there a match? PCP = { P | P is a set of tiles with a match } PCP is undecidable!

18 THE FPCP GAME … is just like the PCP game except that a match has to start with the first tile

19 a aa aaa a a c a aa c a aaa a a aa FPCP

20 ba a a ab b bcb b a FPCP

21 Theorem: PCP is “harder than” FPCP. That is: FPCP ≤ m PCP Proof. We will show a reduction that converts a FPCP instance F into a PCP instance P, so that P has a PCP match iff F has a FPCP match.

22 To convert an FPCP isntance into a PCP instance: If u = u 1 u 2 …u n, we define:  u =  u 1  u 2  u 3  …  u n u  = u 1  u 2  u 3  …  u n   u  =  u 1  u 2  u 3  …  u n  t1t1 b1b1 … t2t2 b2b2 tktk bkbk t1t1 b1b1 t1t1 b1b1 t2t2 b2b2 tktk bkbk   … FPCP: PCP:

23 Theorem: FPCP is undecidable Proof:We will show that A TM ≤ m FPCP. Given a pair 〈 M,w 〉 we will construct a set of tiles that has a match iff M accepts w. The match will correspond to an accepting computation history of M on w.

24 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,

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

26 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

27 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  q  xq 3 00  x0q 4 0  x0xq 3  x0q 2 x  xq 2 0x  q 2 x0x q 2  x0x : #q #  q 1 000#  xq 3 00#  x0q 4 0#  x0xq 3 #... #

28 Given 〈 M,w 〉, we will construct an instance P of FPCP in 7 steps

29 STEP 1 Put # #q 0 w 1 w 2 …w n # into P

30 # #q 0 w 1 w 2 …w n # matching C 1 on top adds C 2 on the bottom. IDEA FOR STEP 2-5: Add tiles so that: # #C 1 # C1#C1# C2#C2# C2#C2# C3#C3# Ci#Ci# C i+1 # matching C 2 on top adds C 3 on the bottom. matching C i on top adds C i+1 on the bottom.  …

31 STEP 2 If  (q,a) = (p,b,R) then add qa bp STEP 3 If  (q,a) = (p,b,L) then add cqa pcbpcb for all c  Γ

32 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

33 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 # q00q00 q1q1 q10q10 xq3xq3 … 0q30q3 q20q20 xq3xq3 q2xq2x q3q3 q2q2 0q200q20 q200q200 xq20xq20 q2x0q2x0 q20q20 q20q20

34 STEP 4 add a a STEP 5 add # # for all a  Γ # ##

35 # #q # q1q1 q00q00 xq3xq3 q10q10 q20q20 0q 3  xq 3  q2xq2x q 2  q3q3 0q 2 0 q200q200 xq 2 0 q2x0q2x0 q20q20 q20q20 xq1xq1 q1xq1xq0xq0x xqrxqr q0q0 qrqr qaqa q1q1 q2q2 q1q1 q3xq3x xq3xq3 q30q30 0q40q4 q40q40 xq3xq3 q4xq4x xq4xq4 q4q4 qrqr 0q 3 x q20xq20x q2xxq2xx xq 3 x q3xq3x q2xq2x x x # ##   0 0 # # # #q #   xq3xq3 q10q # q1q1 q00q # #

36 How do we get the match to stop? # #C 1 # C1#C2#C1#C2# C2#C3#C2#C3# C i # C i+1 # xq i ay# xbq acc y# … … ? Let q acc “eat up” one tape cell per step xbq acc y# xq acc y# xq acc # q acc # q acc ## #

37 STEP 7 add q acc ## # STEP 6 add aq acc q acc q acc a q acc for all a  Γ

38 # #q # q1q1 q00q00 xq3xq3 q10q10 q20q20 0q 3  xq 3  q2xq2x q 2  q3q3 0q 2 0 q200q200 xq 2 0 q2x0q2x0 q20q20 q20q20 xq1xq1 q1xq1xq0xq0x xqrxqr q0q0 qrqr qaqa q1q1 q2q2 q1q1 q3xq3x xq3xq3 q30q30 0q40q4 q40q40 xq3xq3 q4xq4x xq4xq4 q4q4 qrqr 0q 3 x q20xq20x q2xxq2xx xq 3 x q3xq3x q2xq2x x x # ##   0 0 # # 0 0q acc 0 q acc 0 x q acc x x xq acc x  q acc x q acc  # #q #

39 0 → 0, R  → , R q accept q reject 0 → 0, R  → , R q0q0 q1q1 0q10q1 q00q00 0q rej q10q10  q rej q0q0 q1q1  q acc 0 0   # # # #q 0 0# # ## q acc  q acc q acc 0q acc q acc q acc  q acc q acc 0 # #q 0 0#0q10q1 q00q00# ## 0 0 q1q1  q acc # # 0 0q acc  q acc # q acc ## # #q acc 0q acc # #

40 Given 〈 M,w 〉, we can construct an instance of FPCP that has a match if and only if M accepts w Since A TM is undecidable, so is PCP That is, A TM ≤ m FPCP. Since FPCP ≤ m PCP, we get: A TM ≤ m PCP


Download ppt "INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011."

Similar presentations


Ads by Google