Flat CH 5
Flat CH 5
Theory
Prof. Mihir N Shah, Assistant Professor
Computer Science & Engineering
CHAPTER-5
Undecidability
Problems and Languages
HP is undecidable
YES
P, i A
NO
HP is Undecidable
infinite
B loop
YES
make
P copy P, P A
NO YES
B infinite
loop
YES
make
B copy B, B A
NO YES
B halts on input B (prints a YES, see outer box) if B does not halt on input B
(A should yield a NO, see inner box)
B does not halt on input B (infinite loop, see outer box) if B halts on input B (A
should yield a YES, see inner box)
Notes and Conclusions(Undecidable Problems)
If M halts and accepts input w ===> U halts and accepts input W too
If M does not halt with W ===> Neither does U.
Alphabet Encoding
Symbols: a b c d
State Encoding
States: q1 q2 q3 q4
1 11
Symbol - Encoding
0 1
Input alphabet 1 11
{0,1} B 111
tape alphabet q0 1
{0, 1, B} q1 11
states q0, q1 …. …
qn 1n+1
L 1
R 11
Transition Encoding
Encoding: 1 0 1 0 11 0 11 0 1
separator
Turing Machine Encoding
Transitions:
Encoding:
10101101101 00 11 0 11 0 111 0 111 0 11
separator
Turing Machine Example with Halts
0/0 ,L
B/B ,R 1/1,R
q0 q1 q2
1/1, L
Universal Turing Machine Example
00010111011011101100110101010100….00….000
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 . . .
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 . . .
00010111011011101100110101010100….00….000
tape 1: 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 . . .
tape 3: B 1 0 1 1 B string w
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 . . .
tape 3: B 1 0 1 1 B string w
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 0
tape 3: B 1 0 1 1 B string w
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 0
tape 3: B 1 0 1 1 B string w
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: . . . 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 . .
tape 3: B 1 0 1 1 B string w
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: . . . 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 . .
tape 3: B 1 0 1 1 B string w
Three-tape Deterministic Universal Turing Machine
00010111011011101100110101010100….00….000
tape 1: . . . 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 . .
tape 3: B 1 0 1 1 B string w
Reduction N #v
M #w
algorithm Decider for
from HP to MP
MP
The reduction algorithm is a total Turing machine (halts after each conversion).
This is not an undecidability proof for MP. A decider for MP may not be
forced to use a (hypothetical) decider for HP.
If MP was proved to be undecidable, this reduction proves the
undecidability of HP.
Formal Definition of Reduction
σ is a reduction from A to B.
Notation: A ≤ B (many-to-one reduction) or A ≤ B (Turing reduction).
The membership problem for A is no more difficult than the membership
problem for B.
Example: HP ≤ MP and MP ≤ HP.
Example of Reduction
Example of Reduction
Example of Reduction
Example of Reduction
Notes and Conclusions(Undecidable Problems)
Notes on Reduction
Given w ∈ Σ∗, is w ∈ L?
Given a solver for Q, use this solver as a subroutine to solve P. This is one way of
solving P, not the only or the most efficient way.
Proposition: The problem whether a given Turing machine M accepts the null
string ε is undecidable.
M M
w w
M #w N
Reduction Example 1
N can use M and w in any manner it likes. These are part of its finite
control.
Behaviour of N on input v:
Erase input v.
Write the string w on the tape.
Simulate M on w.
If the simulation halts, accept v.
Reduction Example 1
Σ∗ if M halts on w,
L (N) =
Φ if M does not halt on w.
Proposition: The problem whether a given Turing machine M accepts all the
strings over Σ is undecidable.
M M U
w w
M #w N
Reduction Example 2
L if M halts on w
• L (N) =
Φ if M does not halt on w
The same reduction can be used to prove the following undecidability results.
Proof
Let B be recursive.
Let σ be the reduction map A ≤ B.
Since B is r.e., A is r.e. too (by the previous theorem).
σ is also a reduction map for Ā ≤ B̄
B̄ is recursive and so r.e.
By the previous theorem, Ā is r.e. too.
Since A and Ā are both r.e., A is recursive.
Rice’s Theorem
We specify a property for a single Turing machine, the language of Turing
Machine has that property
Properties of Turing Machines are Properties of Regular Expression Sets, not
of Turing Machines.
A property must be independent of the representative machine.
Types Of Properties
Types of Properties
Trivial Properties
The constant map RE → {T, F} taking all L ∈ RE to T
The constant map RE → {T, F} taking all L ∈ RE to F
Non Trivial Properties
Any other Properties it is called NonTrivial Properties it means
The constant map RE → {T, F} taking all L ∉ RE to T or F
Types Of Properties
Monotone Properties
Assume that F≤T
Whenever A ⊆ B, we have P(A) ≤ P(B).
Examples of monotone properties: L (M) is infinite, L (M) = Σ∗.
Examples of non-monotone properties: L (M) is finite, L (M) = Φ
Rice’s Theorem Part-1
Theorem
Any non-trivial property P of r.e. languages is undecidable. In other words, the set
Π = {N | P(L (N)) = T} is not recursive.
Proof
Let P be a non-trivial property of r.e. languages.
Behaviour of N on input v:
Input: M # w.
Output: A Turing machine N such that P(L (N)) = T if and only if M does not
halt on w.
Behavior of N on input v:
Copy v from the first tape to the second tape, and w from the finite
control to the third tape.
Run three simulations in parallel (one step of each in round-robin fashion)
M1 on v on the first tape, M2 on v on the second tape, M on w on the third
tape.
Rice’s Theorem: Part 2: The Reduction HP≤Π