H = { H=\{ H={“ M M M”“ w w w”: M M M is a TM that halts on w } w\} w}
H H H is R.E.
If H H H is recursive, then all R.E. languages are recursive
H H H is not recursive
Lemma: H H H is recursively enumerable
Universal TM: U = U= U= on input “ M M M”“ w w w”
run M M M on “ w w w”
if M M M halts on “ w w w”, halts on “ M M M”“ w w w”
U U U halts on “ M M M”“ w w w” ⟺ \iff ⟺ M M M halts on w ⟺ w \iff w⟺ “ M M M”“ w w w” ∈ H \in H ∈H
U U U semidecides H H H
Lemma: If H H H is recursive, so are all R.E. languages
Also: H H H is complete for the class of R.E. languages
Let A A A be a R.E. language and M M M be a TM that semidecides A A A
Is w ∈ A w\in A w∈A? ⟺ \iff ⟺ Does M M M halt on w w w? ⟺ \iff ⟺ “ M M M”“ w w w” ∈ H \in H ∈H
If H H H is recursive, there exists a TM M H M_H MH that decides H H H
M A = M_\mathrm{A}= MA= on input w w w
run M H M_\mathrm{H} MH on “ M M M”“ w w w”
if M H M_\mathrm{H} MH accepts “ M M M”“ w w w”, accept w w w
else reject
Theorem: H H H is not recursive
H = { H=\{ H={“ M M M”“ w w w”: M M M is a TM that halts on w } w\} w}
H ′ = { H'=\{ H′={“ M M M”: M M M is a TM that halts on “ M M M” } \} }
H d = { H_d=\{ Hd={“ M M M”: M M M is a TM that does not halt on “ M M M” } \} }
Claim: If H H H is recursive, then H d H_d Hd is also recursive
If H H H is recursive, there exists a TM M H M_H MH that decides H H H
M d = M_\mathrm{d}= Md= on input “ M M M”
run M H M_\mathrm{H} MH on “ M M M”““ M M M””
if M H M_\mathrm{H} MH accepts “ M M M”““ M M M””, reject “ M M M”
else accept
Claim: H d H_d Hd is not R.E.
Suppose H d H_d Hd is R.E., there exists a TM D D D semidecides H d H_d Hd
D D D on input “ M M M”
halts if “ M M M” ∈ H d \in H_d ∈Hd, therefore M M M does not halt on “ M M M”
does not halt if “ M M M” ∉ H d \notin H_d ∈/Hd, therefore M M M halts on “ M M M”
Barber Dilemma: D D D on input “ D D D”
halts if D D D does not halt on “ D D D”
does not halt if D D D halts on “ D D D”
Lemma: L L L is recursive iff L L L and L ‾ \overline{L} L is both R.E.
sufficiency: recursive under complement
L L L and L ‾ \overline{L} L are both recursive, therefore also R.E.
necessity: M L M_L ML and M L ‾ M_{\overline{L}} ML semidecides L L L and L ‾ \overline{L} L, respectively
M ∗ = M^*= M∗= on input w w w
run M L M_\mathrm{L} ML and M L ‾ M_\mathrm{\overline{L}} ML on w w w in parallel
if M L M_\mathrm{L} ML halts, accept w w w
else if M L ‾ M_\mathrm{\overline{L}} ML halts, reject w w w
Theorem: The class of R.E. languages is not closed under complement
H H H and H ‾ \overline{H} H are both R.E., then H H H is recursive
Definition
Let A A A and B B B be two languages over Σ A \Sigma_A ΣA and Σ B \Sigma_B ΣB, respectively
A A A reduction from A A A to B B B is a computable function f : Σ A ∗ → Σ B ∗ f:\Sigma_A^*\to\Sigma_B^* f:ΣA∗→ΣB∗
Theorem
Suppose that there is a reduction f f f from A A A to B B B, if B B B is recursive, so is A A A
M A = M_\mathrm{A}= MA= on input w w w
compute f ( w ) f(w) f(w)
run M B M_\mathrm{B} MB on f ( w ) f(w) f(w)
if M B M_\mathrm{B} MB accepts f ( w ) f(w) f(w), accept w w w
else reject
A ⪯ B A\preceq B A⪯B
Theorem: The following problems are undecidable
A = { A=\{ A={“ M M M”: M M M is a TM that halts on e } e\} e}
Given a TM M M M and a string w w w
M w = M_w= Mw= on input w w w
run M M M on u u u
if M M M halts on u u u, halts
M w M_w Mw halts on e e e (“ M w M_w Mw” ∈ A \in A ∈A) ⟺ \iff ⟺ M w M_w Mw halts on every input ⟺ M w \iff M_w ⟺Mw halts on w w w (“ M M M”“ w w w” ∈ H \in H ∈H)
Notice: “ M w M_w Mw” is used as input of A A A
H ⪯ A H\preceq A H⪯A
B = { B=\{ B={“ M M M”: M M M is a TM that halts on some strings } \} }
f ( f( f(“ M M M”“ w w w” ) = )= )=“ M w M_w Mw”
H ⪯ B H\preceq B H⪯B
C = { C=\{ C={“ M M M”: M M M is a TM that halts on every string } \} }
f ( f( f(“ M M M”“ w w w” ) = )= )=“ M w M_w Mw”
H ⪯ C H\preceq C H⪯C
D = { D=\{ D={" M 1 M_1 M1"“ M 2 M_2 M2”: M 1 M_1 M1 and M 2 M_2 M2 are two TMs that halts on the same string } \} }
Let M ∗ M^* M∗ be a TM with S ∈ H ⟺ M ∗ S\in H\iff M^* S∈H⟺M∗ halts on every input
f ( f( f(“ M M M” ) = )= )=“ M M M”“ M ∗ M^* M∗”
C ⪯ D C\preceq D C⪯D
E 1 = { E_1=\{ E1={“ M M M”: M M M is a TM that L ( M ) L(M) L(M) is regular } \} }
E 2 = { E_2=\{ E2={“ M M M”: M M M is a TM that L ( M ) L(M) L(M) is context-free } \} }
E 3 = { E_3=\{ E3={“ M M M”: M M M is a TM that L ( M ) L(M) L(M) is recursive } \} }
Given a TM M M M and a string w w w
f ( f( f(“ M M M”“ w w w” ) = )= )=“ M w M_w Mw”
M w = M_w= Mw= on input v v v
run M M M on w w w
run U U U on “ M M M”“ v v v”
if “ M M M”“ w w w” ∉ H \notin H ∈/H, does not halt in step 1, L ( M w ) = ∅ L(M_w)=\varnothing L(Mw)=∅
if “ M M M”“ w w w” ∈ H \in H ∈H, L ( M w ) = L ( U ) = H L(M_w)=L(U)=H L(Mw)=L(U)=H
L ( M w ) L(M_w) L(Mw) is regular/context-free/recursive iff “ M M M”“ w w w” ∉ H \notin H ∈/H
H ⪯ E 1 ‾ , E 2 ‾ , E 3 ‾ H\preceq \overline{E_1},\overline{E_2},\overline{E_3} H⪯E1,E2,E3
There is a certain fixed TM M M M, for which the following problem is undecidable:
Given a string w w w, does M M M halt on w w w?
Language: L ( M ) L(M) L(M)
Run U U U on “ M M M”“ w w w”
Rice’s Theorem
Suppose L \mathcal{L} L is a proper, non-empty subset of all R.E. languages, the following is undecidable: given a TM M M M, is L ( M ) ∈ L L(M)\in\mathcal{L} L(M)∈L?
S = { S=\{ S={“ M M M”: M M M is a TM that L ( M ) ∈ L } L(M)\in\mathcal{L}\} L(M)∈L}
Proof:
Assume ∅ ∉ L \varnothing\notin\mathcal{L} ∅∈/L, otherwise let L \mathcal{L} L be its complement
Let a language A ∈ L A\in\mathcal{L} A∈L and a TM M A M_\mathrm{A} MA that semidecides A A A
f ( f( f(“ M M M”“ w w w” ) = )= )= on input u u u
run M M M on w w w
run M A M_\mathrm{A} MA on u u u
if “ M M M”“ w w w” ∉ H \notin H ∈/H, L ( f ( L(f( L(f(“ M M M”“ w w w” ) ) = ∅ ))=\varnothing ))=∅
if “ M M M”“ w w w” ∈ H \in H ∈H, L ( f ( L(f( L(f(“ M M M”“ w w w” ) ) = L ( M A ) = A ∈ L ))=L(M_A)=A\in\mathcal{L} ))=L(MA)=A∈L
H ⪯ S H\preceq S H⪯S
Given a TM M M M, does M M M halt on e e e?
L = { L \mathcal{L}=\{L L={L: L L L is R.E. and e ∈ L } e\in L\} e∈L}
Given a TM M M M, does M M M halt on some input?
L = { L \mathcal{L}=\{L L={L: L L L is R.E. and L ≠ ∅ } L\ne\varnothing\} L=∅}
Given a TM M M M, does M M M halt on every input?
L = { Σ ∗ } \mathcal{L}=\{\Sigma^*\} L={Σ∗}
Given a TM M M M, is L ( M ) L(M) L(M) regular/context-free/recursive?
L = { L \mathcal{L}=\{L L={L: L L L is regular/context-free/recursive } \} }
Theorem: A language L L L is R.E. iff it is Turing enumerable
Assume L L L is infinite
sufficiency:
Let M M M be a TM that enumerates L L L
Construct a TM M ′ M' M′ to semidecide L L L
M ′ = M'= M′= on input w w w
run M M M to enumerate L L L
every time M M M outputs a string, compare it with w w w, and halt if they match
necessity:
Let M M M be a TM that semidecides L L L
Construct a TM M ′ M' M′ to enumerate L L L
Name all strings over Σ \Sigma Σ as s 1 , s 2 , … s_1,s_2,\dots s1,s2,… in lexicographical order
M ′ = M'= M′= on input w w w
for i = 1 , 2 , … i=1,2,\dots i=1,2,…
run M M M on s 1 , s 2 , … , s i s_1,s_2,\dots,s_i s1,s2,…,si at most i i i steps
if M M M hatls on s j s_j sj in i i i steps, output s j s_j sj
Definition
Let M M M be a TM enumerates L L L, we say M M M lexicographically enumerate L L L if whenever ( q , ⊳ ⊔ ‾ w ) ⊢ M + ( q , ⊳ ⊔ ‾ w ′ ) (q,\rhd\underline{\sqcup}w)\vdash^+_M(q,\rhd\underline{\sqcup}w') (q,⊳⊔w)⊢M+(q,⊳⊔w′)
w ′ w' w′ is after w w w in lexico order
Theorem: A language is recursive iff it is lexico Turing enumerable
sufficiency:
Let M M M be a TM that decides L L L
Construct a TM M ′ M' M′ to lexico enumerate L L L
M ′ = M'= M′= on input w w w
generate all strings voer Σ \Sigma Σ in lexico order
run M M M on each string w w w to see if w ∈ L w\in L w∈L
if M M M accepts w w w, accept
else reject
necessity:
Let M M M be a TM that lexico enumerates L L L
Construct a TM M ′ M' M′ to decide L L L
M ′ = M'= M′= on input w w w
run M M M to enumerate L L L until M M M outputs a string is after w w w in lexico order
if w w w is among strings that output, accept w w w