Beruflich Dokumente
Kultur Dokumente
Let
and
For string if
w L
w L
if
then
Definition: A language is recursive if some Turing machine accepts it and halts on any input string
Let
and
For string if if
w L
w L
We will prove: 1. There is a specific language which is not recursively enumerable (not accepted by any Turing Machine)
Recursively Enumerable
Recursive
{a}
a a
{a}
M1 , M 2 , M 3 , M 4 ,
Alternative representation
a
L( M i )
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1
0 0
1
0
1
0
L( M 4 )
L {a : a L( M i )}
i i
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1
0 0
1
0
3
1
0
4
L( M 4 )
L {a , a ,}
L {a : a L( M i )} L {a : a L( M i )}
i i
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1
0 0
1
0
1
1
0
2
L( M 4 )
L {a , a ,}
Theorem: Language
is recursively enumerable
Mk
L( M k ) L
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1
0 0
1
0
1
0
L( M 4 )
Question: M k M1 ?
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1 1
1
0 0
1
0
1
0
L( M 4 )
Answer:
M k M1
a L( M k ) a L ( M1 )
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1
0 0
1
0
1
0
L( M 4 )
Question: M k M 2 ?
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
2 2
1
0 0
1
0
1
0
L( M 4 )
Answer:
Mk M2
a L( M k ) a L( M 2 )
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1
0 0
1
0
1
0
L( M 4 )
Question: M k M 3 ?
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
3 3
1
0 0
1
0
1
0
L( M 4 )
Answer:
M k M3
a L( M k ) a L( M 3 )
Similarly:
M k Mi
for any
Because either:
a L( M k )
i i
a L( M i )
or
a L( M k )
i i
a L( M i )
M k cannot exist
End of Proof
Observation:
There is no algorithm that describes
L
Recursively Enumerable
Recursive
L {a : a L( M i )}
i i
a
L ( M1 )
L( M 2 )
L( M 3 )
1
0
0 0
1 1 1 1
1
0 0
1
0
3
1
0
4
L( M 4 )
L {a , a ,}
L {a : a L( M i )}
i i
is recursively enumerable
w
wa
i
Mi
Simulate If
M i on input a
End of Proof
Observation:
Recursively enumerable i i L {a : a L( M i )}
L {a : a L( M i )}
i i
is not recursive
L is recursive
Then
is recursive:
M that accepts L
Therefore:
L is recursive
But we know:
CONTRADICTION!!!!
Therefore,
is not recursive
End of Proof
L
Recursively Enumerable
L
Recursive
(strong result)
Theorem:
if a language L is recursive then there is an enumeration procedure for it
Proof:
Enumeration Machine
~ M
Accepts
w to output w
End of Proof
Example:
~ M
b ab bb aaa
b ab bb aaa
......
......
Theorem:
if language L is recursively enumerable then there is an enumeration procedure for it
Proof:
Enumeration Machine
~ M
Accepts L
a b aa ab ba bb aaa aab
w to output w
Problem: If w L machine M
BETTER APPROACH
w1
w2 w1
w1
1 Step in string
w2
1
w3
1
w4
1
2 3
2 3
2 3
2 3
If for any string wi machine M halts in a final state then it prints wi on the output
End of Proof
Theorem:
If for language L there is an enumeration procedure then L is recursively enumerable
Proof:
Input Tape
w
Machine that accepts L Enumerator for L
Compare
Repeat:
Using the enumerator, generate the next string of
L
w
We have proven:
Recursively-enumerable
Recursive Context-sensitive
Context-free
Regular
Decidability
w a binary number?
A problem is decidable if some Turing machine decides (solves) the problem Decidable problems: Does Machine Is string Does DFA
w a binary number?
The Turing machine that decides (solves) a problem answers YES or NO for each instance of the problem
Turing Machine
YES
NO
The machine that decides (solves) a problem: If the answer is YES then halts in a yes state
If the answer is NO then halts in a no state These states may not be final states
NO states
Question:
Does M
accept w ?
w L( M ) ?
Proof:
Thus, there exists a Turing Machine that solves the membership problem YES
M H
w
M accepts w M rejects w
NO
Let
Let
L is also recursive:
we will describe a Turing machine that accepts L and halts on any input
M
w
H M accepts w ?
YES NO
accept w
reject
Therefore,
L is recursive
Since L is chosen arbitrarily, every recursively enumerable language is also recursive But there are recursively enumerable languages which are not recursive Contradiction!!!!
END OF PROOF
Question:
Does M
halt on input w ?
Theorem: The halting problem is undecidable (there are M and w for which we cannot decide whether M halts on input w )
Proof:
Thus, there exists Turing Machine that solves the halting problem YES
M H
w
M halts on w M
doesnt halt on
NO
Construction of
H H
q y YES
q0 qn NO
wM w
Encoding of M
String
Construct machine If If
H :
H
q y YES
Loop forever
qa
qb
wM w
q0 qn NO
Construct machine
Input:
: H
(machine
wM
M )
If
M halts on input wM
Then loop forever Else halt
wM
copy
wM wM
wM
Run machine
Input:
wH
) H
If
halts on input wH H
Then loop forever Else halt
on input wH H :
If
If
END OF PROOF
If the halting problem was decidable then every recursively enumerable language would be recursive
Proof:
There exists Turing Machine H that solves the halting problem YES
M H
w
M halts on w M
doesnt halt on
NO
Let
Let
L is also recursive:
we will describe a Turing machine that accepts L and halts on any input
L
w
M
w
H M halts on w ?
NO YES
reject
w w
Therefore
L is recursive
Since L is chosen arbitrarily, every recursively enumerable language is also recursive But there are recursively enumerable languages which are not recursive Contradiction!!!!
END OF PROOF
Reducibility
Problem
A is reduced to problem B
B then
B
A
Problem
A is reduced to problem B
If
If
Example:
State
String
q
w
Question: Does
Theorem:
The state-entry problem is undecidable
Proof:
M
w
YES
M enters q
doesnt enter
NO
M
w
YES
M halts on w
doesnt halt on
NO
M
w
M q w
YES
YES
M
w
Convert Inputs ?
M q w
YES
YES
Convert
add transitions to
M
halting states
q
Single halt state
M halts on input w
if and only if
M
w
M q w
YES
YES
END OF PROOF
Another example:
the halting problem
Question: Does
a blank tape?
Theorem:
The blank-tape halting problem is undecidable
YES
M halts on
blank tape
M doesnt halt
on blank tape
M
w
YES
M halts on w
doesnt halt on
NO
M
w
YES
YES NO
M
w
Convert Inputs ?
YES
YES NO
Mw
w
Mw
step 1 if blank tape then write step2 execute M with input
M w
Since the halting problem is undecidable, the blank-tape halting problem is undecidable
END OF PROOF
Does machine
M halt on input w ?
w?
Blank-tape halting problem: Does machine M halt when starting on blank tape?
State-entry Problem:
M enter state q
Uncomputable Functions
Uncomputable Functions
Domain
Values region
An uncomputable function:
f ( n)
maximum number of moves until any Turing machine with n states halts when started with the blank tape
Theorem: Function
f (n) is uncomputable
Proof:
M M: m
f ( m)
Contradiction!!!
Therefore, function
f (n) in uncomputable
END OF PROOF
Theorem: For any recursively enumerable language it is undecidable to determine whether L is empty
Let
M be the TM with L( M ) L
YES
NO
M
w
YES
M accepts w M rejects w
NO
M
w
YES
NO YES
Mw
NO
M
w
Convert inputs ?
YES
NO YES
Mw
NO
Construct machine
Mw :
sw
w L
if and only if
L( M w ) is not empty
L( M w ) {w}
M
w
construct M w
Mw
YES
NO YES
NO
END OF PROOF
Let
M be the TM with L( M ) L
YES
NO
M
w
YES
Halting problem decider
M halts on w M
doesnt halt on
NO
M
w
YES
NO
M
w
YES
NO YES
NO
Construct machine
M w:
Initially, simulates
M on input w
Otherwise, reject
( finite language)
M halts on w
if and only if
L( M w ) is infinite
L( M w )
*
M
w
YES
NO
Theorem: For a recursively enumerable language L it is undecidable to determine whether L contains two different strings of same length
Let
M be the TM with L( M ) L
YES
L( M ) contains L( M )
Doesnt contain
NO
M
w
YES
Halting problem decider
M halts on w M
doesnt halt on
NO
M
w
M w Two-strings
problem decider
YES
YES NO
NO
M
w
YES
YES NO
NO
Construct machine
Mw :
Initially, simulate
M on input w
Otherwise, reject
( L( M w )
M halts on w
if and only if
and
M
w
YES
YES NO
NO
Rices Theorem
Definition:
Non-trivial properties of recursively enumerable languages: any property possessed by some (not all) recursively enumerable languages
L is finite
L contains two different strings of the same length
L(G1 ) L(G2 ) ?
G1, G2 are context-free grammars
Is context-free grammar
G ambiguous?
We need a tool to prove that the previous problems for context-free languages are undecidable:
n strings
A w1, w2 , , wn B v1, v2 , , vn
PC-solution:
wi w j wk vi v j vk
Example:
A:
w1 100 v1 001
w2 11 v2 111
w3 111 v3 11
B:
PC-solution: 2,1,3
w2 w1w3 v2v1v3
11100111
Example:
A:
w1 00 v1 0
w2 001 v2 11
w3 1000 v3 011
B:
There is no solution Because total length of strings from B is smaller than total length of strings from A
Is
L(G1 ) L(G2 ) ?
G1, G2 are context-free grammars
L(G1) L(G2 ) ?
Emptyinterection problem decider YES NO
G1
G2
G ,
Proof: