# INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

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

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011

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.

QUIZ 3 x a ƒ(x)?b ƒ(x)?c ƒ(x)? anoyesno byesnoyes cno yes DYes No

QUIZ 3 b R R q a? aba to_endba

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 }

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

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.

A B ƒ ƒ MAPPING REDUCIBILITY w A ƒ(w) B Σ*Σ*Σ*Σ*

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)

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.

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

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

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

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

ca a acc ca abc ab

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

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

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

ba a a ab b bcb b 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.

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 t1t1 b1b1 … t2t2 b2b2 tktk bkbk t 1 b 1 t 1 b 1 t 2 b 2 t k b k … FPCP: PCP:

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.

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,

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

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

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 0 0000# q 1 000# xq 3 00# x0q 4 0# x0xq 3 #... #

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

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

# #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. …

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 Γ

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

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# q00q00 q 1 q10q10 xq3xq3 … 0q 3 q 2 0 xq 3 q 2 x q 3 q 2 0q200q20 q200q200 xq20xq20 q2x0q2x0 q 2 0

STEP 4 add a a STEP 5 add # # for all a Γ # #

# #q 0 0000# q 1 q00q00 xq3xq3 q10q10 q 2 0 0q 3 xq 3 q 2 x q 2 q 3 0q 2 0 q200q200 xq 2 0 q2x0q2x0 q 2 0 xq1xq1 q1xq1xq0xq0x xqrxqr q 0 q r q a q 1 q 2 q 1 q3xq3x xq3xq3 q30q30 0q40q4 q40q40 xq3xq3 q4xq4x xq4xq4 q 4 q r 0q 3 x q20xq20x q2xxq2xx xq 3 x q 3 x q 2 x x x # # 0 0 # # # #q 0 0000# xq3xq3 q10q10 0 0 0 0 # #q 0 0000# q 1 q00q00 0 0 0 0 0 0 # #

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 ## #

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

# #q 0 0000# q 1 q00q00 xq3xq3 q10q10 q 2 0 0q 3 xq 3 q 2 x q 2 q 3 0q 2 0 q200q200 xq 2 0 q2x0q2x0 q 2 0 xq1xq1 q1xq1xq0xq0x xqrxqr q 0 q r q a q 1 q 2 q 1 q3xq3x xq3xq3 q30q30 0q40q4 q40q40 xq3xq3 q4xq4x xq4xq4 q 4 q r 0q 3 x q20xq20x q2xxq2xx xq 3 x q 3 x q 2 x x x # # 0 0 # # 0 0q acc 0 q acc 0 x q acc x x xq acc x q acc x # #q 0 0000#

0 0, R, R q accept q reject 0 0, R, R q0q0 q1q1 0q10q1 q00q00 0q rej q10q10 q rej q 0 q 1 q acc 0 0 # # # #q 0 0# # # q acc 0q acc q acc q acc 0 # #q 0 0#0q10q1 q00q00# # 0 0 q 1 q acc # # 0 0 # q acc ## # #q acc 0q acc # #

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