Lecture 9¶
Example
Show that \(R_{TM} = \{\langle M \rangle : M \text{ is a TM with } L(M) \text{ being regular}\}\) is not recursive.
Proof
Suppose \(M_1\) decides on \(\overline{R_{TM}}\), then we construct \(M_2\) runs on \(H\).
\(M_2\) = on input \(\langle M, w \rangle\),
-
construct a TM \(M'\) = on input \(x\)
- run \(M\) on \(w\).
- run \(U\) on \(x\). (\(U\) is the universal TM)
\[ L(M') = \left\{ \begin{aligned} & \phi, && \text{if $M$ does not halt on $w$}, \\ & L(U) = H, && \text{if $M$ halts on $w$}. \end{aligned} \right. \]NOTE that \(\phi\) is regular, but \(L(U) = H\) is not regular (because it's even not recursice).
-
run \(M_1\) on \(\langle M' \rangle\).
- return the result of \(M_1\).
Since \(M_2\) can not decide \(H\), thus \(M_1\) can not decide \(\overline{R_{TM}}\). Therefore \(\overline{R_{TM}}\) is not recursive and so is \(R_{TM}\).
Example
Show that \(CF_{TM} = \{\langle M \rangle : M \text{ is a TM with } L(M) \text{ being context-free}\}\) is not recursive.
Proof
The same reduction pattern of \(R_{TM}\). Since \(\phi\) is context-free and \(H\) not.
Example
Show that \(REC_{TM} = \{\langle M \rangle : M \text{ is a TM with } L(M) \text{ being recursive}\}\) is not recursive.
From the examples above, we can conclude some pattern of not recursive langauges.
Rice's Theorem¶
Theorem
Suppose \(\mathcal{L}(P)\) is a non-empty proper subset of all recursively enumarable languages, then the following language is NOT recursive.
Proof
Case 1. \(\phi \notin \mathcal{L}(P)\)
There exists \(A \in \mathcal{L}(P)\), so there exists a TM \(M_A\) that semidecides \(A\). Suppose \(M_R\) decides \(R(P)\), then we construct \(M_H\) on \(H\).
\(M_H\) = on input \(\langle M, w \rangle\),
-
construct a TM \(M^*\) = on input \(x\)
- run \(M\) on \(w\)
- run \(M_A\) on \(x\)
\[ L(M^*) = \left\{ \begin{aligned} & \phi, && \text{if $M$ does not halt on $w$}, \\ & L(M_A) = A, && \text{if $M$ halts on $w$}. \end{aligned} \right. \] -
run \(M_R\) on \(\langle M^* \rangle\).
- return the result of \(M_R\).
Case 2. \(\phi \in \mathcal{L}(P)\)
Then \(\phi \notin \overline{\mathcal{L}(P)}\), we can reduce \(H\) to \(\overline{R(P)}\) like in case 1. And thus \(R(P)\) is not recursive.
Summary¶
To prove a language \(A\) recursive, we can prove
- By definition: construct a Turing machine.
- By reduction: \(A \le \text{known recursive language}\).
To prove a language \(A\) not recursive, we can prove
- By reduction: \(\text{known recursive language} \le A\).
- The mostly used language is \(H\).
To prove a language \(A\) recursively enumerable, we can prove
- By definition: construct a Turing machine.
- By reduction: \(A \le \text{known recursively enumerable language}\).
To prove a language \(A\) not recursively enumerable, we can prove
- By reduction: \(\text{known non-recursively enumerable language} \le A\).
- By the following theorem.
Theorem
If \(A\) and \(\overline{A}\) are recursively enumerable, then \(A\) is recursive.
Proof
Since \(A\) and \(\overline{A}\) are recursively enumerable, then there exists \(M_1\) and \(M_2\) that semidecides \(A\) and \(\overline{A}\) respectively.
Then we construct a \(M_3\) that decides \(A\).
\(M_3\) = on input \(x\)
- run \(M_1\) and \(M_2\) on \(x\) in parallel.
- if \(M_1\) halts on \(x\),
- accept \(x\).
- if \(M_2\) halts on \(x\),
- reject \(x\).
Example
Since \(H\) is recursively enumerable and not recursive, then \(\overline{H}\) is not recursively enumerable.
Example
Show that \(A = \{\langle M \rangle : M \text{ is a TM that halts on some input}\}\) is recursively enumerable.
Proof
\(M_A\) = on input \(\langle M \rangle\)
- for \(i\) = \(1, 2, 3, \dots\)
- for \(s\) = \(s_1, s_2, \dots, s_i\) (\(s_i \in L\))
- run \(M\) on \(s\) for \(i\) steps,
- if \(M\) halts on \(s\) within \(i\) steps,
- halt.
Closure Property¶
Theorem
If \(A\) and \(B\) are recursive langauges, then so as
- \(A \cup B\).
- \(A \cap B\).
- \(\overline{A}\).
- \(A \circ B\).
- \(A^*\).
If \(A\) and \(B\) are recursively enumerable langauges, then so as
- \(A \cup B\).
- \(A \cap B\).
- \(A \circ B\).
- \(A^*\).
NOTE not so as \(\overline{A}\), a counter example is \(H\).
Enumerator¶
There are some extra properties of Turing machine.
Definition
A Turing machine \(M\) enumerates a language \(L\) if for some state \(q\),
And \(L\) is Turing enumerable.
\(M\) has no input.
Theorem
A language \(L\) is Turing enumerable iff it's recursively enumerable.
Proof
If \(L\) is finite, it's trivial. Assume \(L\) is infinite,
\(\Rightarrow\). There exists a TM \(M\) that enumerates \(L\), we construct \(M'\).
\(M'\) = on input \(x\)
- run \(M\) to enumerate \(L\).
- every time \(M\) outputs a string \(w\),
- if \(w\) equals to \(x\),
- halt.
Then \(M'\) semidecides \(L\) and \(L\) is recursively enumerable.
\(\Leftarrow\). There exists a TM \(M\) that semidecides \(L\), we construct \(M'\).
\(M'\) =
- for \(i\) = \(1, 2, 3, \dots\)
- for \(s\) = \(s_1, s_2, \dots, s_i\) (\(s_i \in L\))
- run \(M\) on \(s\) for \(i\) steps.
- if \(M\) halts on \(s\) within \(i\) steps.
- output \(s\).
Here the "some state \(q\)" of \(M'\) is the halting state.
Definition
Let \(M\) be a TM that enumerates \(L\), then \(M\) is lexicographically enumerates \(L\) if whenever
we have \(w'\) after \(w\) in lexicographical order.
Theorem
\(L\) is lexicographically enumerable iff it's recursive.
Proof
\(\Leftarrow\). There exists \(M\) decides \(L\), we construct \(M'\).
\(M'\) on input \(x\)
- enumerate all strings in lexicographical order.
- for each string \(s\),
- run \(M\) on \(s\),
- if \(M\) accepts \(s\),
- output \(s\).
\(\Rightarrow\). There exists \(M\) lexicographically enumerate \(L\), we construct \(M'\).
\(M'\) = on input \(x\)
- run \(M\) to enumerate \(L\).
- every time \(M\) outputs a string \(w\),
- if \(w\) equals to \(x\),
- accept \(x\).
- reject \(x\).
创建日期: 2023.12.04 16:11:01 CST