Professional Documents
Culture Documents
FORMAL LANGUAGES,
AUTOMATA AND
COMPUTABILITY
ATM = { (M,w) | M is a TM that accepts string w }
HALTTM = { (M,w) | M is a TM that halts on string w }
ALL UNDECIDABLE
Use Reductions to Prove
Which are SEMI-DECIDABLE?
Let f : Σ* Σ* be a computable function
such that w A f(w) B
Σ* A B Σ*
f
CONSTRUCT f : Σ* Σ*
CONSTRUCT f : Σ* Σ*
f: (M,w) M’w where M’w (s) = accept if s = 0n1n
M(w) otherwise
So, L (M’w) = Σ* if M(w) accepts
{0n1n} if not
So, (M, w ) ATM M’w REGTM
Is REG SEMI-DECIDABLE?
ATM = { (M,w) | M is a TM that accepts string w }
REGTM = { M | M is a TM and L(M) is regular}
CONSTRUCT f : Σ* Σ*
f: (M,w) M”w where M”w (s) = accept if s = 0n1n
and M(w) accepts
Loop otherwise
So, L (M’w) = {0n1n} if M(w) accepts
if not
So, (M, w ) ATM M”w REGTM
CONSTRUCT f : Σ* Σ*
f: M (M, M ) where M (s) = Loops
CONSTRUCT f : Σ* Σ*
f: (M,w) Pw where
Pw (s) = accept iff s is NOT an accepting computation of M(w)
ε,ε → ε ε,ε → ε
ε,ε → ε
q0 q1 q3
0 → , R 0 → x, R
x → x, R
→ , R 0 → 0, R
→ , R 0 → x, R
qreject qaccept q4
x → x, R
→ , R
x → x, L
2n q 0000
0 →0 0, L
{0 |n≥0}
q2 q1000
→ , R xq300
→ , L
x → x, R x0qx4→
0 x, R
q0 q1 x0xq
q 3
3
0 → , R 0 → x, R x0q2x
x → x, R xq 0x0, R
→ , R 0 2→
→ , R 0 → x, R
q2x0x
qreject qaccept qq24x0x
x → x, R
→ , R
P recognizes all strings except:
ba a b b
a ab bcb a
aaa a a c
a c aa a
b a ca abc
ca ab a c
abc ca acc
ab a ca
GENERAL RULE #1
If every top string is longer than the
corresponding bottom one, there can’t be a match
caa acc b aab c
a a b aa a
GENERAL RULE #2
If there is a domino with the same string on the
top and on the bottom, there is a match
POST CORRESPONDENCE PROBLEM
Given a collection of dominos, is there a match?
PCP = { P | P is a set of dominos 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 domino
FPCP
aaa a a c
a c aa a
FPCP
ba a b b
a ab bcb a
Theorem: FPCP is undecidable
Proof: Assume machine C decides FPCP
We will show how to use C to decide ATM
Given (M,w)
we will construct a set of
dominos P where a match is
an accepting computation caa aba a
history for M on w P= …
c bb d
P has a match?
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
→ , R 0 → 0, R
→ , R 0 → x, R
qreject qaccept q4
x → x, R
→ , R
x → x, L
2n q 0000
0 →0 0, L
{0 |n≥0}
q2 q1000
→ , R xq300
→ , L
x → x, R x0qx4→
0 x, R
q0 q1 x0xq
q 3
3
0 → , R 0 → x, R x0q2x
x → x, R xq 0x0, R
→ , R 0 2→
→ , R 0 → x, R
q2x0x
qreject qaccept qq24x0x
#q00000#q1000#xq300#x0q40#x0xq3# ... #
:
x → x, R
→ , R
Given (M,w), we will construct an
instance P of FPCP in 7 steps
STEP 1
#
Put into P
#q0w1w2…wn#
START
STEP 2
qa
If (q,a) = (p,b,R) then add
bp
STEP 3
cqa
If (q,a) = (p,b,L) then add for all c Γ
pcb
RULES
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
→ , R 0 → 0, R
→ , R 0 → x, R
qreject qaccept q4
x → x, R
→ , R
x → x, L0q 0
2n 0 → 0, L 2
{0 |n≥0}
q2 q200
→ , R
→ , L
x → x, R xq20
x → x, R
q0 q2x0
q1 q3
0 → , R 0 → x, R
q20
x → x, R
→ , R 0 → 0, R
→ , R 0 → x, R q20
STEP 5
# #
add
# #
CONTINUE
STEP 4
a
add for all a Γ
a
STEP 5
# #
add
# #
STEP 6
aqacc qacca
add for all a Γ
qacc qacc
# q00 q10 q1x q0x q0 q1 q2
#q00000# q1 xq3 xq1 xqr qr qa q1
# # 0 0 x x x x
q10 0 0
xq3 0 0
STEP 7
qacc##
add
#
END
0 → 0, R → , R
q0 q1 qaccept
0 → 0, R
→ , R
qreject
t1 t2 tk
FPCP: …
b1 b2 bk