400 likes | 503 Views
CSci 4011. INHERENT LIMITATIONS OF COMPUTER PROGRAMS. 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).
E N D
CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGRAMS
QUIZ 3 The Turing Machine M decides the language L if: Maccepts 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.
QUIZ 3 b → R ☐ → R qa?aba ☐to_endba
UNDECIDABLE PROBLEMS DTM = { 〈M〉 | M is a TM that does not accept 〈M〉 } Theorem. DTM is undecidable. Proof. Suppose machine N decides DTM. Then N accepts 〈N〉 ⇔ 〈N〉 DTM ⇔N does not accept 〈N〉 ATM = { 〈M,w〉 | M is a TM that accepts on input w } Theorem. If ATM is decidable, so is DTM. Proof. If ¬ATM is decided by the program nAccept we can decide DTM by calling nAccept(M,〈M〉). HALTTM = { 〈M,w〉 | M is a TM that halts on input w } Theorem. If HALTTM is decidable, then so is ATM.
In most cases, we show that a language is undecidable by showing that if it is decidable, then so is ATM. We reduce deciding ATM to deciding the language in question
MAPPING REDUCIBILITY ƒ : Σ* Σ* is a computable function if some Turing machine M, for any input w, halts with just ƒ(w) on its tape A 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.
MAPPING REDUCIBILITY Σ* Σ* B ƒ A ƒ w A ƒ(w) B
Theorem: If A m B and B is decidable, then A is decidable Let BSolver be a program to decide B and let ƒ be a reduction from A to B Proof: We build a machine ASolver that decides A: ASolver(w): 1. Let s = ƒ(w) 2. Return BSolver(s)
Corollary: If A m B and A is undecidable, then B is undecidable Suppose, for contradiction, that BSolver decides B and let ƒ be a reduction from A to B. Proof: 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.
Theorem: If A ≤m B and B ≤m C, then A ≤m C Let ƒ : A B and g : B C be computable functions, where w A ⇔ ƒ(w) B, x B ⇔ g(x) C Proof: 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
ba ba b b a a bcb ab ab a a a THE PCP GAME
aaa aaa a a a c a aa aa aa a c a a
abc abc ca ca b b a a a ab ab ab ca ca a c a c
abc acc ca ab ca a
aab acc caa b b c aa b b a a a
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!
THE FPCP GAME … is just like the PCP game except that a match has to start with the first tile
aaa aaa a a a c a aa aa aa a c a a FPCP
ba b b a bcb ab a a FPCP
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.
t1 tk t2 t1 t1 t2 tk b1 b2 b1 bk b1 b2 bk To convert an FPCP isntance into a PCP instance: If u = u1u2…un,wedefine: u = u1 u2 u3 … un u = u1 u2 u3 … un u = u1 u2 u3 … un FPCP: … PCP: …
Theorem:FPCP is undecidable Proof: We will show that ATM≤mFPCP. 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.
COMPUTATION HISTORIES An accepting computation history is a sequence of configurations C1,C2,…,Ck, where 1. C1 is the start configuration, 2. Ck is an accepting configuration, 3. Each Ci follows from Ci-1 An rejecting computation history is a sequence of configurations C1,C2,…,Ck, where 1. C1 is the start configuration, 2. Ck is a rejecting configuration, 3. Each Ci follows from Ci-1
M accepts w if and only if there exists an accepting computation history that starts with C1=q0w
qreject x → x, L 2n 0 → 0, L { 0 | n ≥ 0 } q2 → , R → , L x → x, R x → x, R q0 q1 q3 0 → , R 0 → x, R x → x, R 0 → 0, R → , R 0 → x, R → , R qaccept q4 x → x, R → , R
x → x, L 2n 0 → 0, L { 0 | n ≥ 0 } q2 → , R → , L x → x, R x → x, R q0 q1 q3 0 → , R 0 → x, R x → x, R 0 → 0, R → , R qreject 0 → x, R → , R qaccept q4 x → x, R → , R q00000 q1000 xq300 x0q40 x0xq3 x0q2x xq20x q2x0x q2x0x #q00000#q1000#xq300#x0q40#x0xq3# ... # :
Given 〈M,w〉, we will construct an instance P of FPCP in 7 steps
# #q0w1w2…wn# STEP 1 Put into P
# #q0w1w2…wn# Ci# # C2# C1# #C1# C2# Ci+1# C3# IDEA FOR STEP 2-5: Add tiles so that: matching C1 on top adds C2 on the bottom. … matching C2 on top adds C3 on the bottom. matching Ci on top adds Ci+1 on the bottom.
cqa qa pcb bp STEP 2 If (q,a) = (p,b,R) then add STEP 3 for all c Γ If (q,a) = (p,b,L) then add
qreject x → x, L 2n 0 → 0, L { 0 | n ≥ 0 } q2 → , R → , L x → x, R x → x, R q0 q1 q3 0 → , R 0 → x, R x → x, R 0 → 0, R → , R 0 → x, R → , R qaccept q4 x → x, R → , R
x → x, L 2n 0 → 0, L { 0 | n ≥ 0 } q2 → , R # → , L x → x, R x → x, R #q00000# q0 q1 q3 0 → , R 0 → x, R x → x, R 0 → 0, R → , R qreject 0 → x, R → , R xq20 q20 xq3 0q3 q3 0q20 q10 q00 qaccept q4 q1 xq3 q2 q20 q2x q20 q2x0 q200 x → x, R → , R …
a # # # a # STEP 4 for all a Γ add STEP 5 add
# # # q00 q00 q10 q10 q1 q1x q0x q0 #q00000# #q00000# #q00000# xq3 xq3 qa q1 q1 xq1 xqr qr q20 xq20 0q3 0q20 q3x q2 q30 q40 q4 q4x q2x0 q1 q20 q20 xq3 q200 0q4 xq3 qr xq4 0 # 0 0 0 0 x 0 # q3x xq3 q3 0q3x xq3x # q2x q2xx # 0 0 0 0 x 0 0 # q2 # q20x q2x
How do we get the match to stop? xbqaccy# ? xqiay# xbqaccy# C2# C3# Ci# Ci+1# # #C1# C1# C2# … … Let qacc“eat up” one tape cell per step xqaccy# xqacc# xqacc# qacc# qacc## # xbqaccy# xqaccy#
qacc## qacca aqacc qacc qacc # STEP 6 add for all a Γ STEP 7 add
# # q00 q10 q1 q1x q0x q0 #q00000# #q00000# xq3 qa q1 xq1 xqr qr q20 xq20 0q3 0q20 q3x q2 q30 q40 q4 q4x q2x0 q1 q20 q20 xq3 q200 0q4 xq3 qr xq4 # 0 x q3x xq3 q3 0q3x xq3x # q2x q2xx # 0 x q2 # q20x q2x 0qacc qacc qacc qaccx qacc0 xqacc x 0 x x x 0
# q00 q10 qacc0 qacc 0qacc qacc## qacc q0 #q00# 0qrej 0q1 qrej qacc qacc qacc qacc # # # q1 0 qreject qacc 0 # # q00 # 0 q1 # # # 0 0qacc qacc # #q00# 0q1 # 0 qacc # # # 0 qacc qacc 0 → 0, R → , R q0 q1 qaccept 0→ 0, R → , R
Given 〈M,w〉, we can construct an instance of FPCP that has a match if and only if M accepts w That is, ATM≤m FPCP. Since FPCP ≤m PCP, we get: ATM ≤m PCP Since ATM is undecidable, so is PCP