decid ability
TRANSCRIPT
-
7/30/2019 Decid Ability
1/177
Recursively Enumerable
andRecursive Languages
-
7/30/2019 Decid Ability
2/177
Definition:
A language is recursively enumerableif some Turing machine accepts it
-
7/30/2019 Decid Ability
3/177
For string :
Let be a recursively enumerable languageL
and the Turing Machine that accepts it
Lww
if then halts in a final state
Lwif then halts in a non-final state
or loops forever
-
7/30/2019 Decid Ability
4/177
Definition:
A language is recursive
if some Turing machine accepts it
and halts on any input string
In other words:A language is recursive if there is
a membership algorithm for it
-
7/30/2019 Decid Ability
5/177
For string :
Let be a recursive languageL
and the Turing Machine that accepts it
Lw
w
if then halts in a final state
Lwif then halts in a non-final state
-
7/30/2019 Decid Ability
6/177
We will prove:
1. There is a specific languagewhich is not recursively enumerable
(not accepted by any Turing Machine)
2. There is a specific language
which is recursively enumerable
but not recursive
-
7/30/2019 Decid Ability
7/177
Recursive
Recursively Enumerable
Non Recursively Enumerable
-
7/30/2019 Decid Ability
8/177
A Language whichis not
Recursively Enumerable
-
7/30/2019 Decid Ability
9/177
We want to find a language that
is not Recursively Enumerable
This language is not accepted by any
Turing Machine
-
7/30/2019 Decid Ability
10/177
Consider alphabet }{a
Strings: ,,,, aaaaaaaaaa
1
a2
a3
a4
a
-
7/30/2019 Decid Ability
11/177
Consider Turing Machines
that accept languages over alphabet }{a
They are countable:
,,,, 4321 MMM
-
7/30/2019 Decid Ability
12/177
Example language accepted by
},,{)( aaaaaaaaaaaaML i
},,{)( 642 aaaML i
i
Alternative representation
1a 2a 3a 4a 5a 6a 7a
)( iML
0 1 1 10 0 0
-
7/30/2019 Decid Ability
13/177
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
-
7/30/2019 Decid Ability
14/177
Consider the language
)}(:{ iii MLaaL
L consists from the 1s in the diagonal
-
7/30/2019 Decid Ability
15/177
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{
43
aaL
-
7/30/2019 Decid Ability
16/177
Consider the language
)}(:{ iii MLaaL
L consists of the 0s in the diagonal
)}(:{ iii MLaaL
L
-
7/30/2019 Decid Ability
17/177
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 21 aaL
-
7/30/2019 Decid Ability
18/177
Theorem:
Language is not recursively enumerableL
-
7/30/2019 Decid Ability
19/177
Proof:
is recursively enumerableLAssume for contradiction that
There must exist some machine
that acceptsk
L
LMLk)(
1 2 3 4
-
7/30/2019 Decid Ability
20/177
1a 2a 3a 4a
)(1
ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?1Mk
1 2 3 4
-
7/30/2019 Decid Ability
21/177
1a 2a 3a 4a
)(1
ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Answer: 1Mk
)(
)(
11
1
MLa
MLa k
1 2 3 4
-
7/30/2019 Decid Ability
22/177
1a 2a 3a 4a
)(1
ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?2Mk
1 2 3 4
-
7/30/2019 Decid Ability
23/177
1a 2a 3a 4a
)(1
ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Answer: 2Mk
)(
)(
22
2
MLa
MLa k
1 2 3 4
-
7/30/2019 Decid Ability
24/177
1a 2a 3a 4a
)(1
ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Question: ?3Mk
1 2 3 4
-
7/30/2019 Decid Ability
25/177
1a 2a 3a 4a
)(1
ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
Answer: 3Mk
)(
)(
33
3
MLa
MLa k
-
7/30/2019 Decid Ability
26/177
Similarly: ik M
)(
)(
ii
ki
MLa
MLa
)(
)(
ii
ki
MLa
MLa
for any i
Because either:
or
-
7/30/2019 Decid Ability
27/177
Therefore, the machine cannot existk
Therefore, the languageis not recursively enumerable
L
End of Proof
-
7/30/2019 Decid Ability
28/177
Observation:
There is no algorithm that describes L
(otherwise would be accepted by
some Turing Machine)
L
-
7/30/2019 Decid Ability
29/177
Recursive
Recursively Enumerable
Non Recursively Enumerable
L
-
7/30/2019 Decid Ability
30/177
A Language which isRecursively Enumerable
and not Recursive
-
7/30/2019 Decid Ability
31/177
We want to find a language which
There is a
Turing Machinethat accepts
the language
The machine
doesnt halt
on some input
Is recursively
enumerable
But not
recursive
-
7/30/2019 Decid Ability
32/177
We will prove that the language
)}(:{ iii MLaaL
Is recursively enumerable
but not recursive
-
7/30/2019 Decid Ability
33/177
1a 2a 3a 4a
)( 1ML
0 1 10
)( 2ML
)( 3ML
01 0 1
0 1 11
)( 4ML 0 10 0
},,{ 43 aaL
-
7/30/2019 Decid Ability
34/177
The language
Theorem:
)}(:{ iii MLaaL
is recursively enumerable
-
7/30/2019 Decid Ability
35/177
Proof:
We will give a Turing Machine thataccepts L
Turing Machine that accepts L
-
7/30/2019 Decid Ability
36/177
Turing Machine that accepts L
For any input string w
Compute , for which iaw
Find Turing machine i
(using an enumeration procedurefor Turing Machines)
Simulate on inputi
i
a If accepts, then accepti w
i
End of Proof
-
7/30/2019 Decid Ability
37/177
Observation:
)}(:{ iii MLaaL
)}(:{ iii MLaaL
Recursively enumerable
Not recursively enumerable
(Thus, also not recursive)
-
7/30/2019 Decid Ability
38/177
Theorem:
The language )}(:{ iii MLaaL
is not recursive
-
7/30/2019 Decid Ability
39/177
Proof:
Assume for contradiction that is recursive
Then is recursive:
L
L
Take the Turing Machine that accepts L
halts on any input:
If accepts then reject
If rejects then accept
-
7/30/2019 Decid Ability
40/177
Therefore:
L is recursive
But we know:
L is not recursively enumerable
thus, not recursive
CONTRADICTION!!!!
-
7/30/2019 Decid Ability
41/177
Therefore, is not recursiveL
End of Proof
-
7/30/2019 Decid Ability
42/177
L
Recursive
Recursively Enumerable
Non Recursively Enumerable
L
-
7/30/2019 Decid Ability
43/177
Turing acceptable languagesand
Enumeration Procedures
W ill
-
7/30/2019 Decid Ability
44/177
We will prove:
If a language is recursive thenthere is an enumeration procedure for it
A language is recursively enumerable
if and only ifthere is an enumeration procedure for it
(weak result)
(strong result)
-
7/30/2019 Decid Ability
45/177
Theorem:
if a language is recursive thenthere is an enumeration procedure for it
L
-
7/30/2019 Decid Ability
46/177
Proof:
~
Enumeration Machine
Accepts LEnumerates all
strings of input alphabet
-
7/30/2019 Decid Ability
47/177
If the alphabet is then
can enumerate strings as follows:
},{ ba~
ab
aaabba
bbaaaaab......
E ti d
-
7/30/2019 Decid Ability
48/177
Enumeration procedure
Repeat:~ generates a string w
checks if Lw
YES: print to outputw
NO: ignore w
End of Proof
E l }{ bbbbL
-
7/30/2019 Decid Ability
49/177
Example:
~
a
baaabba
bbaaaaab
......
)(ML
b
ab
bbaaa
......
,....},,,{ aaabbabbL
Enumeration
Output
b
ab
bbaaa
...... Theorem:
-
7/30/2019 Decid Ability
50/177
Theorem:
if language is recursively enumerable thenthere is an enumeration procedure for itL
Proof:
-
7/30/2019 Decid Ability
51/177
Proof:
~
Enumeration Machine
Accepts LEnumerates all
strings of input alphabet
-
7/30/2019 Decid Ability
52/177
If the alphabet is then
can enumerate strings as follows:
},{ ba~
ab
aaabba
bbaaaaab
NAIVE APPROACH
-
7/30/2019 Decid Ability
53/177
Enumeration procedure
Repeat: ~ generates a string w
checks if Lw
YES: print to outputw
NO: ignore w
NAIVE APPROACH
Problem: If
machine may loop forever
Lw
BETTER APPROACH
-
7/30/2019 Decid Ability
54/177
~
1
w
executes first step on
BETTER APPROACH
1w
~ Generates second string 2w
executes first step on 2w
second step on 1w
Generates first string
-
7/30/2019 Decid Ability
55/177
~ Generates third string 3w
executes first step on 3w
second step on 2wthird step on 1w
And so on............
-
7/30/2019 Decid Ability
56/177
1w 2w 3w 4w
1
Stepin
string
1 1 1
2 2 2 2
3 3 3 3
-
7/30/2019 Decid Ability
57/177
If for any string
machine halts in a final state
then it prints on the output
iw
iw
End of Proof
Theorem:
-
7/30/2019 Decid Ability
58/177
Theorem:
If for languagethere is an enumeration procedure
then is recursively enumerable
L
L
Proof:I t T
-
7/30/2019 Decid Ability
59/177
w
Input Tape
Enumerator
for L Compare
Machine that
accepts L
Turing machine that accepts L
-
7/30/2019 Decid Ability
60/177
Turing machine that accepts L
Repeat:
Using the enumerator,generate the next string of L
For input string w
Compare generated string with wIf same, accept and exit loop
End of Proof
-
7/30/2019 Decid Ability
61/177
We have proven:
A language is recursively enumerable
if and only if
there is an enumeration procedure for it
-
7/30/2019 Decid Ability
62/177
The Chomsky Hierarchy
-
7/30/2019 Decid Ability
63/177
-
7/30/2019 Decid Ability
64/177
Decidability
-
7/30/2019 Decid Ability
65/177
Consider problems with answer YES or NO
Examples:
Does Machine have three states ?
Is string a binary number?w
Does DFA accept any input?
A problem is decidable if some Turing machine
-
7/30/2019 Decid Ability
66/177
A problem is decidable if some Turing machine
decides (solves) the problem
Decidable problems:
Does Machine have three states ?
Is string a binary number?w
Does DFA accept any input?
The Turing machine that decides (solves)
-
7/30/2019 Decid Ability
67/177
Turing MachineInput
problem
instance
YES
NO
g
a problem answers YES or NO
for each instance of the problem
Th hi th t d id ( l ) bl
-
7/30/2019 Decid Ability
68/177
The machine that decides (solves) a problem:
If the answer is YESthen halts in ayes state
If the answer is NO
then halts in a no state
These states may not be final states
Turing Machine that decides a problem
-
7/30/2019 Decid Ability
69/177
YES states
NO states
YES and NO states are halting states
Difference between
-
7/30/2019 Decid Ability
70/177
Difference between
Recursive Languages and Decidable problems
The YES states may not be final states
For decidable problems:
Some problems are undecidable:
-
7/30/2019 Decid Ability
71/177
Some problems are undecidable:
which means:there is no Turing Machine that
solves all instances of the problem
A simple undecidable problem:
The membership problem
The Membership Problem
-
7/30/2019 Decid Ability
72/177
The Membership Problem
Input: Turing Machine
String w
Question: Does accept ?w
?)(MLw
Theorem:
-
7/30/2019 Decid Ability
73/177
Theorem:
The membership problem is undecidable
Proof: Assume for contradiction thatthe membership problem is decidable
(there are and for which we cannot
decide whether )
w
)(MLw
Th s th ists T i M hi H
-
7/30/2019 Decid Ability
74/177
Thus, there exists a Turing Machine
that solves the membership problem
H
Hw
YES accepts w
NO rejects w
Let be a recursively enumerable languageL
-
7/30/2019 Decid Ability
75/177
Let be a recursively enumerable languageL
Let be the Turing Machine that accepts L
We will prove that is also recursive:L
we will describe a Turing machine that
accepts and halts on any inputL
Turing Machine that accepts L
-
7/30/2019 Decid Ability
76/177
accepts ?wNO
YES
w
Hacceptw
Turing Machine that accepts
and halts on any inputL
reject w
Therefore L is recursive
-
7/30/2019 Decid Ability
77/177
Therefore, L is recursive
But there are recursively enumerable
languages which are not recursive
Contradiction!!!!
Since is chosen arbitrarily, everyrecursively enumerable language is alsorecursive
L
-
7/30/2019 Decid Ability
78/177
Therefore, the membership problem
is undecidable
END OF PROOF
A th f d id bl bl
-
7/30/2019 Decid Ability
79/177
Another famous undecidable problem:
The halting problem
The Halting Problem
-
7/30/2019 Decid Ability
80/177
The Halting Problem
Input: Turing Machine
String w
Question: Does halt on input ?w
Theorem:
-
7/30/2019 Decid Ability
81/177
Theorem:
The halting problem is undecidable
Proof: Assume for contradiction thatthe halting problem is decidable
(there are and for which we cannot
decide whether halts on input )
w
w
Thus there exists Turing Machine H
-
7/30/2019 Decid Ability
82/177
Thus, there exists Turing Machine
that solves the halting problem
H
Hw
YES halts on w
doesnt
halt onwNO
Construction of H
-
7/30/2019 Decid Ability
83/177
H
wwM 0q
yq
nq
Input:
initial tape contents
Encoding
of w
String
YES
NO
-
7/30/2019 Decid Ability
84/177
Construct machine :H
If returns YES then loop foreverH
If returns NO then haltH
-
7/30/2019 Decid Ability
85/177
H
wwM 0q
yq
nq NO
aq bq
H
Loop forever
YES
HConstruct machine :
-
7/30/2019 Decid Ability
86/177
HConstruct machine :
Input:
If halts on input Mw
Thenloop forever
Elsehalt
Mw (machine )
-
7/30/2019 Decid Ability
87/177
Mw MMwwcopy
Mw H
H
HRun machine with input itself:
-
7/30/2019 Decid Ability
88/177
HRun machine with input itself:
Input:
If halts on input
Thenloop forever
Elsehalt
Hw (machine )H
H Hw
-
7/30/2019 Decid Ability
89/177
on inputH Hw
If halts then loops forever
If doesnt halt then it halts
:
H
H
NONSENSE !!!!!
Therefore we have contradiction
-
7/30/2019 Decid Ability
90/177
Therefore, we have contradiction
The halting problem is undecidable
END OF PROOF
-
7/30/2019 Decid Ability
91/177
Another proof of the same theorem:
If the halting problem was decidable thenevery recursively enumerable language
would be recursive
Theorem:
-
7/30/2019 Decid Ability
92/177
Theorem:
The halting problem is undecidable
Proof: Assume for contradiction that
the halting problem is decidable
There exists Turing Machine H
-
7/30/2019 Decid Ability
93/177
There exists Turing Machine
that solves the halting problem
H
Hw
YES halts on w
doesnt
halt onwNO
Let be a recursively enumerable languageL
-
7/30/2019 Decid Ability
94/177
Let be a recursively enumerable language
Let be the Turing Machine that accepts L
We will prove that is also recursive:L
we will describe a Turing machine that
accepts and halts on any inputL
Turing Machine that acceptsd h lt i t
L
-
7/30/2019 Decid Ability
95/177
halts on ?w
YES
NO
w
Run
with input w
H reject w
accept w
reject w
and halts on any input
Halts on final state
Halts on non-final
state
Therefore L is recursive
-
7/30/2019 Decid Ability
96/177
But there are recursively enumerable
languages which are not recursive
Contradiction!!!!
Since is chosen arbitrarily, everyrecursively enumerable language
is also recursive
L
-
7/30/2019 Decid Ability
97/177
Therefore, the halting problem is undecidable
END OF PROOF
-
7/30/2019 Decid Ability
98/177
Reducibility
Problem is reduced to problemA B
-
7/30/2019 Decid Ability
99/177
Problem is reduced to problemA B
If we can solve problem then
we can solve problem
B
A
B
A
Problem is reduced to problemA B
-
7/30/2019 Decid Ability
100/177
If is undecidable then is undecidable
If is decidable then is decidableB A
A B
Problem is reduced to problemA B
-
7/30/2019 Decid Ability
101/177
Example: the halting problem
is reduced to
the state-entry problem
The state-entry problem
-
7/30/2019 Decid Ability
102/177
y p
Inputs: Turing Machine
State q
Question: Does
String w
enter state q
on input ?w
Theorem:
-
7/30/2019 Decid Ability
103/177
The state-entry problem is undecidable
Proof: Reduce the halting problem to
the state-entry problem
-
7/30/2019 Decid Ability
104/177
We want to build a decider
-
7/30/2019 Decid Ability
105/177
Halting problem
deciderw
YES
NO
halts on w
doesnt
halt onw
for the halting problem:
-
7/30/2019 Decid Ability
106/177
We need to convert one problem instance
to the other problem instance
-
7/30/2019 Decid Ability
107/177
qw
Halting problem decider
YES
NO
YES
NOw
Convert
Inputs
?
to the other problem instance
State-entryproblem
decider
Convert to :
-
7/30/2019 Decid Ability
108/177
Add new state q
From any halting state of add transitions toq
q
halting statesSingle
halt state
-
7/30/2019 Decid Ability
109/177
halts on input
halts on state on inputq
if and
only if
w
w
-
7/30/2019 Decid Ability
110/177
Generate
w
qw
Halting problem decider
YES
NO
YES
NOState-entryproblem
decider
We reduced the halting problem
-
7/30/2019 Decid Ability
111/177
Since the halting problem is undecidable,the state-entry problem is undecidable
END OF PROOF
g p
to the state-entry problem
Another example:
-
7/30/2019 Decid Ability
112/177
the halting problem
is reduced to
the blank-tape halting problem
The blank-tape halting problem
-
7/30/2019 Decid Ability
113/177
Input: Turing Machine
Question: Does halt when started with
a blank tape?
Theorem:
-
7/30/2019 Decid Ability
114/177
Proof: Reduce the halting problem to the
blank-tape halting problem
The blank-tape halting problem is undecidable
Suppose we have a decider for theblank-tape halting problem:
-
7/30/2019 Decid Ability
115/177
blank-tapehalting problem
decider
YES
NO
halts on
blank tape
doesnt halt
on blank tape
blank tape halting problem:
We want to build a decider
-
7/30/2019 Decid Ability
116/177
halting problem
deciderw
YES
NO
halts on w
doesnt
halt onw
for the halting problem:
We want to reduce the halting problem to
the blank-tape halting problem:
-
7/30/2019 Decid Ability
117/177
w
Blank-tapehalting problem
decider
Halting problem decider
YES
NOw
YES
NO
the blank tape halting problem:
We need to convert one problem instance
to the other problem instance
-
7/30/2019 Decid Ability
118/177
w
Blank-tapehalting problem
decider
Halting problem decider
YES
NOw
YES
NO
to the other problem instance
ConvertInputs
?
wConstruct a new machine
-
7/30/2019 Decid Ability
119/177
When started on blank tape, writes w
Then continues execution like
w
then write w
step 1 step2
if blank tape executewith input w
-
7/30/2019 Decid Ability
120/177
halts on input string
w halts when started with blank tape
if and
only if
w
-
7/30/2019 Decid Ability
121/177
We reduced the halting problem
-
7/30/2019 Decid Ability
122/177
Since the halting problem is undecidable,the blank-tape halting problem is undecidable
END OF PROOF
to the blank-tape halting problem
Summary of Undecidable Problems
-
7/30/2019 Decid Ability
123/177
Does machine halt on input ?
Halting Problem:
w
Membership problem:
Does machine accept string ?w
Blank-tape halting problem:
-
7/30/2019 Decid Ability
124/177
Does machine enter stateon input ?
Does machine halt when starting
on blank tape?
State-entry Problem:
wq
-
7/30/2019 Decid Ability
125/177
Uncomputable Functions
Uncomputable Functions
-
7/30/2019 Decid Ability
126/177
A function is uncomputable if it cannotbe computed for all of its domain
Domain Values
region
f
-
7/30/2019 Decid Ability
127/177
An uncomputable function:
)(nf
maximum number of moves until
any Turing machine with states
halts when started with the blank tape
n
Theorem: Function is uncomputable)(nf
-
7/30/2019 Decid Ability
128/177
Proof:
Then the blank-tape halting problem
is decidable
Assume for contradiction thatis computable)(nf
-
7/30/2019 Decid Ability
129/177
Therefore, the blank-tape halting
l l
-
7/30/2019 Decid Ability
130/177
problem is decidable
However, the blank-tape haltingproblem is undecidable
Contradiction!!!
-
7/30/2019 Decid Ability
131/177
-
7/30/2019 Decid Ability
132/177
Take a recursively enumerable language L
-
7/30/2019 Decid Ability
133/177
is empty?L
L is finite?L contains two different strings
of the same length?
Decision problems:
All these problems are undecidable
Theorem:For any recursively enumerable language L
-
7/30/2019 Decid Ability
134/177
y y g g
it is undecidable to determine whether
is emptyL
Proof:
We will reduce the membership problemto this problem
Let be the TM with LML )(
-
7/30/2019 Decid Ability
135/177
empty language
problem
decider
YES
NO
Suppose we have a decider for theempty language problem:
)(ML
)(ML
empty
not empty
-
7/30/2019 Decid Ability
136/177
We want to reduce the membership problem to
the empty language problem:
-
7/30/2019 Decid Ability
137/177
YES
NOw
NO
YES
Membership problem decider
w empty language
problem
decider
We need to convert one problem instance
to the other problem instance
-
7/30/2019 Decid Ability
138/177
YES
NOw
NO
YES
Membership problem decider
w empty language
problem
decider
Convert
inputs
?
-
7/30/2019 Decid Ability
139/177
-
7/30/2019 Decid Ability
140/177
-
7/30/2019 Decid Ability
141/177
-
7/30/2019 Decid Ability
142/177
Undecidable problemsfor
Recursively enumerable languages
continued
Take a recursively enumerable language L
-
7/30/2019 Decid Ability
143/177
is empty?L
L is finite?L contains two different strings
of the same length?
Decision problems:
All these problems are undecidable
-
7/30/2019 Decid Ability
144/177
Let be the TM with LML )(
-
7/30/2019 Decid Ability
145/177
finite language
problem
decider
YES
NO
Suppose we have a deciderfor the finite language problem:
)(ML
)(ML
finite
not finite
We will build a decider
-
7/30/2019 Decid Ability
146/177
Halting problem
deciderw
YES
NO
halts on w
We will build a decider
for the halting problem:
doesnthalt on
w
We want to reduce the halting problem tothe finite language problem
-
7/30/2019 Decid Ability
147/177
YES
NOw
NO
YES
Halting problem decider
wfinite language
problem
decider
We need to convert one problem instanceto the other problem instance
-
7/30/2019 Decid Ability
148/177
YES
NOw
NO
YES
Halting problem decider
wfinite language
problem
decider
convert
input
?
Construct machine :w
On arbitrary input string s
-
7/30/2019 Decid Ability
149/177
If enters a halt state,accept ( inifinite language)
Initially, simulates on input w
Otherwise, reject ( finite language)
y p g
s
s
*
-
7/30/2019 Decid Ability
150/177
halts on
)( wML is infinite
if andonly if
w
*)( wML
-
7/30/2019 Decid Ability
151/177
construct
w
YES
NOw
NO
YES
halting problemdecider
finite language
problemdecider
w
-
7/30/2019 Decid Ability
152/177
Theorem:
For a recursively enumerable language L
-
7/30/2019 Decid Ability
153/177
For a recursively enumerable language L
it is undecidable to determine whethercontains two different strings of
same length
L
Proof: We will reduce the halting problemto this problem
Let be the TM with LML )(
-
7/30/2019 Decid Ability
154/177
Two-strings
problem
decider
YES
NO
Suppose we have the deciderfor the two-strings problem:
)(ML
)(ML
contains
Doesntcontain
two equal length strings
We will build a decider for
-
7/30/2019 Decid Ability
155/177
Halting problem
deciderw
YES
NO
halts on w
the halting problem:
doesnthalt on
w
We want to reduce the halting problem tothe empty language problem
-
7/30/2019 Decid Ability
156/177
YES
NOw
YES
NO
Halting problem decider
Two-strings
problemdecider
w
We need to convert one problem instanceto the other problem instance
-
7/30/2019 Decid Ability
157/177
YES
NOw
YES
NO
Halting problem decider
Two-strings
problemdecider
wconvert
inputs?
Construct machine :w
O bit i t st i s
-
7/30/2019 Decid Ability
158/177
When enters a halt state,accept if or
Initially, simulate on input w
as bs (two equal length strings )
On arbitrary input string s
},{)( baMLw
Otherwise, reject ( )s )( wML
-
7/30/2019 Decid Ability
159/177
halts on
w
if andonly if
w
accepts two equal length strings
w accepts anda b
-
7/30/2019 Decid Ability
160/177
construct
w
YES
NOw
YES
NO
Halting problem decider
Two-strings
problemdecider
w
-
7/30/2019 Decid Ability
161/177
Definition:
-
7/30/2019 Decid Ability
162/177
Non-trivial properties ofrecursively enumerable languages:
any property possessed by some (not all)
recursively enumerable languages
-
7/30/2019 Decid Ability
163/177
-
7/30/2019 Decid Ability
164/177
-
7/30/2019 Decid Ability
165/177
The Post Correspondence
Problem
Some undecidable problems for
context-free languages:
-
7/30/2019 Decid Ability
166/177
context free languages:
Is context-free grammar ambiguous?G
Is ? )()( 21 GLGL
21,GG are context-free grammars
We need a tool to prove that the previous
problems for context-free languages
-
7/30/2019 Decid Ability
167/177
are undecidable:
The Post Correspondence Problem
The Post Correspondence Problem
I t T f i
-
7/30/2019 Decid Ability
168/177
Input: Two sequences of strings
nwwwA ,,, 21
nvvvB ,,, 21
n
-
7/30/2019 Decid Ability
169/177
Example:
11100 1111w 2w 3w
:A
-
7/30/2019 Decid Ability
170/177
001 111 11
1v 2v 3v
:B
PC-solution: 3,1,2 312312 vvvwww
1110011
Example:
00100 10001w 2w 3w
:A
-
7/30/2019 Decid Ability
171/177
0 11 011
1v 2v 3v
:B
There is no solution
Because total length of strings from
is smaller than total length of strings from
B
A
We will show:
-
7/30/2019 Decid Ability
172/177
1. The MPC problem is undecidable
2. The PC problem is undecidable
(by reducing MPC to PC)
(by reducing the membership to MPC)
-
7/30/2019 Decid Ability
173/177
Some undecidable problems forcontext-free languages:
-
7/30/2019 Decid Ability
174/177
Is context-free grammar
ambiguous?
G
Is ? )()( 21 GLGL
21,GG are context-free grammars
We reduce the PC problem to these problems
Theorem: Let be context-free
grammars. It is undecidable21,GG
-
7/30/2019 Decid Ability
175/177
Proof:
to determine if )()(
21GLGL
Rdeduce the PC problem to this
problem
Suppose we have a decider for the
empty-intersection problem
-
7/30/2019 Decid Ability
176/177
Empty-interection
problem
decider
?)()( 21 GLGL
1G
2G
YES
NO
Context-free
grammars
For a context-free grammar ,GTheorem:
it i d id bl t d t i
-
7/30/2019 Decid Ability
177/177
it is undecidable to determine
if G is ambiguous
Proof: Reduce the PC problem
to this problem