Understanding Rice's Theorem: A Comprehensive Guide

  • MHB
  • Thread starter mathmari
  • Start date
  • Tags
    Theorem
In summary: Yes.A language is undecidable if there is no machine that for each word says "yes" or "no".In summary, Rice's theorem states that for any nontrivial property $P$, $L_P=\{n \mid n \in P\}$ is undecidable.
  • #1
mathmari
Gold Member
MHB
5,049
7
Hey! :eek:

I am reading Rice's theorem but I am facing some difficulties understanding it.

In my notes there is the following formulation:

For any nontrivial property $P$, $L_P=\{n \mid n \in P\}$ is undecidable.

Could you explain it to me?
 
Technology news on Phys.org
  • #2
You should probably read a textbook. Briefly, we are considering a nontrivial property of enumerable languages, i.e., a set of enumerable languages that neither is empty nor contains all languages. Each enumerable language has many machines that accept it, and each machine can be encoded, say, by a number. If we collect the codes of all machines that accept some language in our set, the resulting set of codes in undecidable.
 
  • #3
Is an enumerable language a language for which there is a Turing machine that halts, i.e., a Turing machine that accepts this language?

So, from the theorem we have that if we collect the codes of all machines that accept some language, the resulting set of codes is undecidable, does this mean that there is no algorithm that halts when the input is the set of codes?
 
  • #4
mathmari said:
Is an enumerable language a language for which there is a Turing machine that halts, i.e., a Turing machine that accepts this language?
Yes, it's a language such that some machine halts on words in the language and does not halt on words outside the language. It can also be proved that there is an enumerator for such language, hence the name "(recursively) enumerable".

mathmari said:
So, from the theorem we have that if we collect the codes of all machines that accept some language, the resulting set of codes is undecidable, does this mean that there is no algorithm that halts when the input is the set of codes?
That's not exactly what "undecidable" means.
 
  • #5
Evgeny.Makarov said:
Yes, it's a language such that some machine halts on words in the language and does not halt on words outside the language. It can also be proved that there is an enumerator for such language, hence the name "(recursively) enumerable".

Which is the difference between a recursively enumerable language and a recursive language?

Doesn't both mean a computable language?

- - - Updated - - -

Evgeny.Makarov said:
That's not exactly what "undecidable" means.

What is then the meaning of "undecidable" ?
 
  • #6
I am writing definitions from memory, so you should double-check them in your sources.

mathmari said:
Which is the difference between a recursively enumerable language and a recursive language?
I believe

recursive = decidable
recursively enumerable = semidecidable = accepted by some machine

mathmari said:
Doesn't both mean a computable language?
I am not sure what "computable language" means.

mathmari said:
What is then the meaning of "undecidable" ?
"Undecidable" means "not decidable", and a machine that decides a language always halts (not only on words in the language, as you wrote in post #3).

As an off-topic, I don't think it is right to use the forum as a substitute for a textbook. Definitions should be looked up in a textbook first. One should only ask on the forum if the definition is unclear, the textbook is unavailable or there is some other problem.
 
  • #7
Evgeny.Makarov said:
recursive = decidable
recursively enumerable = semidecidable = accepted by some machine

I looked in my book and I found the following:

A language that is accepted by a Turing machine is said to be recursively enumerable.
A subclass of r.e. sets, called the recursive sets, are those languages accepted by at least one Turing machine that halts on all inputs.

So, the difference is that the recursively enumerable languages are accepted by exactly one Turing machine but the recursive languages are accepted by at least one Turing machine?
 
  • #8
mathmari said:
So, the difference is that the recursively enumerable languages are accepted by exactly one Turing machine but the recursive languages are accepted by at least one Turing machine?
No, in both cases the languages are accepted by an infinite number of machines. You can always add an unreachable state, for example, to change a machine without changing the language it accepts.

A language is decidable if there is a machine that for each word says "yes" or "no" depending on whether the words is in the language.

A language is semidecidable, or r.e., if there is a machine that for each word in the language says "yes". For words not in the language the machine is allowed to say "no" or not to halt at all.
 
  • #9
Evgeny.Makarov said:
A language is decidable if there is a machine that for each word says "yes" or "no" depending on whether the words is in the language.

A language is semidecidable, or r.e., if there is a machine that for each word in the language says "yes". For words not in the language the machine is allowed to say "no" or not to halt at all.

I see... And a language is undecidable if there is no machine that for each word says "yes" or "no" ?
 
  • #10
mathmari said:
a language is undecidable if there is no machine that for each word says "yes" or "no" ?
...depending on whether the word is in the language.
 
  • #11
At what kind of problems do we apply Rice's Theorem? Could you give me an example so that I can understand it better?
 
  • #12
Good textbooks such as by Sipser or by Lewis and Papadimitriou have many examples of application of the Rice's theorem.
 
  • #13
We could for example use Rice's theorem to show that the language $L=\{n \in \mathbb{N} \mid T_n(1) \downarrow\}$ is not recursive, right?

So, we have to show that the property in this case in non-trivial, don't we?

Is the property that each Turing machine halts with input $1$?

And how do we show that this property is non-trivial?

Or do we have to reduce the Halting problem to the above one?
 
Last edited by a moderator:
  • #14
The property is the property of languages. In this case, it is something like "1 is in the language". Some languages contain 1, some don't; so the property is nontrivial.

I must say that the Rice's theorem is formulated in two versions: for languages and for functions. They are essentially the same, but look different at first glance. Which version are you using?
 
  • #15
Evgeny.Makarov said:
The property is the property of languages. In this case, it is something like "1 is in the language". Some languages contain 1, some don't; so the property is nontrivial.

A language that contains 1 is for example $0^n10^n$ and a language that doesn't contain 1 is for example $0^{\star}$, right?
Evgeny.Makarov said:
I must say that the Rice's theorem is formulated in two versions: for languages and for functions. They are essentially the same, but look different at first glance. Which version are you using?

In my notes there is the following version of the theorem:

Let $P$ a nontrivial property of Turing machines (where trivial is a property that either all Turing machines have or none). Then the set (language) $L_P=\{n \in \mathbb{N} \mid \text{ the machine } T_n \text{ has the property } P\}$ is not recursive.
 
  • #16
mathmari said:
A language that contains 1 is for example $0^n10^n$ and a language that doesn't contain 1 is for example $0^{\star}$, right?
Yes.

mathmari said:
In my notes there is the following version of the theorem:

Let $P$ a nontrivial property of Turing machines (where trivial is a property that either all Turing machines have or none). Then the set (language) $L_P=\{n \in \mathbb{N} \mid \text{ the machine } T_n \text{ has the property } P\}$ is not recursive.
This statement is actually false. Comparing it with the correct Rice's theorem and determining why it is false is an excellent exercise.

I assume that $T_n$ denotes the machine with code $n$ and that each machine has a unique code. Consider the property $P(T)$ as follows: "$T$ has at most 10 states". By recovering the machine from a code $n$ and inspecting it we can definitely tell if the machine has at most 10 states or not. Therefore, $\{n\mid P(T_n)\text{ holds}\}$ is decidable.

As I said, Rice's theorem talks about properties of r.e. languages or, alternatively, of computable functions. When there is a question about recognizing some property of languages, the first question is how to feed a language into a computer. Since languages are in general infinite, we cannot feed it as a set, so we have to come up with some representation. One option is regular expressions, but they cover only a portion of languages, i.e., regular ones. Therefore we choose to represent a language by a TM that accepts it. Thus we may deal only with r.e. languages.

As I said, we want a property of languages, and each language has many TMs that accept it. Suppose we want to decide if a language is infinite. We write a program that instead of languages accepts their representations, i.e., TMs. Then it would be wrong if one TM leads to one answer (the language that it accepts is infinite), while another TM accepting the same language leads to a different answer (the language is finite). Thus, if we are talking about the properties of TMs that we want to recognize, they must be "language-invariant" (my term). A property $Q$ of TMs is called language-invariant if
\[
\forall L,M_1,M_2.\;M_1\text{ accepts }L\text{ and }M_2\text{ accepts }L\implies (Q(M_1)\Leftrightarrow Q(M_2)).
\]
In other words, $Q$ does not distinguish TMs that accept the same language. Thus, each language-invariant property of TMs corresponds to a property of languages.

Let $L(T)$ be the language accepts by a TM $T$. Rice's theorem for languages can be stated in two forms.

1. If $P$ be a nontrivial property of languages, then $\{n\mid P(L(T_n))\text{ holds}\}$ is undecidable.

2. If $Q$ be a nontrivial language-invariant property of TMs, then $\{n\mid Q(T_n)\text{ holds}\}$ is undecidable.

I recommend reading the textbook by Sipser.
 
  • #17
Evgeny.Makarov said:
This statement is actually false. Comparing it with the correct Rice's theorem and determining why it is false is an excellent exercise.

It should be as follows:

Let $P$ a nontrivial property of languages of Turing machines (where trivial is a property that either the language of all Turing machines have or none). Then the set (language) $L_P=\{n \in \mathbb{N} \mid \text{ the language of the machine } T_n \text{ has the property } P\}$ is not recursive.

or not?
 
  • #18
mathmari said:
Let $P$ be a nontrivial property...

If by the language of a Turing machine $M$ you mean the language that $M$ accepts, then yes.
 
  • #19
The proof of Rice's theorem that I found in my notes is the following:

Let $L_P$ be recursive. That means that there is a Turing machine $T^{\star}$ that computes $L_P$.
We reduce the Halting problem to $L_P$.
For this reason we construct the function $f$ which corresponds to $(n, x)$ the $m$ such that the Turing machine $T_m$ has the following properties:
  • On input $y$ the $T_m$ simulates the $T_n$ on input $x$.
If $T_n(x) \downarrow$ then $T_m$ simulates $T^{\star}$ on input $y$.
$f$ consist a translation of the Halting problem to $L_P$.

$$(n, x) \in \text{ HALT } \Leftrightarrow m \in L_P$$
Could you explain to me the sentence "If $T_n(x) \downarrow$ then $T_m$ simulates $T^{\star}$ on input $y$."
Does this mean that if the Turing machine halts, then $T_m$ simulates $T^{\star}$, i.e., the language of $T_m$ has the property $P$. So, $m \in L_P$.
Is this correct?
 
  • #20
mathmari said:
For this reason we construct the function $f$ which corresponds to $(n, x)$ the $m$ such that
Better: "function $f$ that maps $(n, x)$ to $m$ such that..."

mathmari said:
the Turing machine $T_m$ has the following properties:
  • On input $y$ the $T_m$ simulates the $T_n$ on input $x$.
If $T_n(x) \downarrow$ then $T_m$ simulates $T^{\star}$ on input $y$.
$f$ consist a translation of the Halting problem to $L_P$.

$$(n, x) \in \text{ HALT } \Leftrightarrow m \in L_P$$

Could you explain to me the sentence "If $T_n(x) \downarrow$ then $T_m$ simulates $T^{\star}$ on input $y$."
Does this mean that if the Turing machine halts, then $T_m$ simulates $T^{\star}$
Yes.

mathmari said:
i.e., the language of $T_m$ has the property $P$.
No. The proof says that $n$ and $x$ are hard-wides into the resulting machine $T_m$. On any input $y$, $T_m$ first runs $T_n$ on $x$. If it stops, then $T_m$ runs $T^*$ on $y$. If $T_n(x)$ diverges (does not stop), then there is nothing more to do.

However, I believe this proof is incorrect. If $(n,x)\in\text{HALT}$, then $T_m$ behaves like $T^*$. But there is no reason why the language accepted by $T^*$ should satisfy $P$.

For the reduction of HALT to $L_P$ to work, we must have
\[
(n,x)\in\text{HALT}\iff f(n,x)=m\in L_P.
\]
The right-hand side means by definition that $P(L(T_m))$ holds. Suppose that $(n,x)\in\text{HALT}$. Then $T_m$ behaves like $T^*$, i.e., $L(T_m)=L(T^*)$. By definition, $L(T^*)=L_P$, so $L(T_m)=L_P$. But there is no reason why $P(L_P)$ should hold. Suppose, for example, that $P(L)$ means that $L$ is infinite. Then $L_P$ is also infinite since many machines accept infinite languages. Therefore, $P(L_P)$ indeed holds. On the other hand, let $P(L)$ mean that $L$ is finite. Still $L_P$ is infinite because infinitely many machines accept finite languages. Therefore, $P(L_P)$ does not hold.

It seems to me that the proof is making a categorical error. The machine $T_m$ should not emulate the decider $T^*$ of $L_P$; rather, it should emulate one of the machines in $L_P$, i.e., one of the machines whose language satisfies $P$. There is no reason why $L_P$ should satisfy $P$ itself.

Along with an incorrect statement of the Rice's theorem, this is a second serious mistake in your notes. Something strange is going on: either you recorder the lecture incorrectly, or your instructor made serious mistakes. Again, I recommend reading Sipser.
 
  • #21
The Rice's theorem that I found in Sipser is the following:

View attachment 4478

and the proof is:

View attachment 4479
Why do we take the TM $T_{\varnothing}$ that always rejects?

Could you explain to me the first point at the description of the TM $S$? I am confused about how the TM $S$ works...

Which is the reduction from the Halting problem to P? Maybe $\langle M, w \rangle \mapsto M_w$ ?
 

Attachments

  • rice.PNG
    rice.PNG
    13.8 KB · Views: 51
  • rice_proof.PNG
    rice_proof.PNG
    24.6 KB · Views: 52
Last edited by a moderator:
  • #22
I read the proof also at the link: CS 4810 but I don't understand why we distinguish these cases...
 
  • #23
mathmari said:
Which is the reduction from the Halting problem to P? Maybe $\langle M, w \rangle \mapsto M_w$ ?
Yes. Unfortunately, reduction is introduced formally pretty late in Sipser, and there are several proofs of undecidability without explicit reference to reduction. In this case, it would be enough to describe how $M_w$ is built given $M$ and $w$ and to note that
\[
\langle M,w\rangle\in A_{\text{TM}}\iff \langle M_w\rangle\in P.\qquad(*)
\]
(To remind, in Sipser $A_{\text{TM}}=\{\langle M,w\rangle\mid M\text{ accepts }w\}$.) The current proof uses $R_P$ to prove a special case of the general theorem: if $L_1$ is reducible to $L_2$ and $L_1$ is undecidable, then so is $L_2$. If we have this general theorem, then constructing a reduction is enough.

mathmari said:
Why do we take the TM $T_{\varnothing}$ that always rejects?
The concrete $T_\emptyset$ is irrelevant. What is important is that all machines that accept the empty language are outside of $P$. (If this is not so, then the proof suggests proving that the complement of $P$ is undecidable.) Thus, if $M$ does not accept $w$, then $M_w$ does not accept anything either and so $\langle M_w\rangle\notin P$. This is the direction $(\Longleftarrow)$ of (*) above.

mathmari said:
Could you explain to me the first point at the description of the TM $S$? I am confused about how the TM $S$ works...
$S$ is used to decide $A_{\text{TM}}$ provided $R_P$ decides $P$. Again, it is not necessary if we have the theorem about reduction. $S$ constructs $M_w$ and runs $R_P$ on $\langle M_w\rangle$. If you need more information, please describe more precisely what you don't understand.
 
  • #24
I read again the proof of Sipser and also the proof of the link of the post #22.

It is as follows:

Let $L_H$ be the language of the Halting problem.

We will show that $L_H \leq_m L_P$. Sine $L_H$ is undecidable, $L_P$ will also be undecidable.

Let $T_{\varnothing}$ be a TM that always rejects, so $L(T_{\varnothing})=\varnothing$.

We assume that $\varnothing \notin P$ without loss of generality because if $\varnothing \in P$ we can proceed with $P^c$, which is also a non-trivial property of languages of TM.

Because $P$is not trivial, there exists a TM $T$ such that $L(T) \in P$.

We consider the computable function $f$ that maps $\langle M, w \rangle$ to $\langle M_w\rangle$, where $M_w$ is the following TM:

$$M_w(u) : \left\{\begin{matrix}
\text{ if } M(w) \downarrow \ \ \& \ \ M(w)=yes & \text{ then simulate } T(u). \\ \ \ \ \ & \text{ If } T(u)=yes \text{ then } M_w(u)=yes \\ \\
\text{ if } M(w) \downarrow \ \ \& \ \ M(w)=no &\text{ then } M_w(u)=no
\end{matrix}\right.$$

$M_w$ accepts on input $u$ iff $M$ accepts $w$ and $T$ accepts $u$.

Therefore, $L(M_w)=L(T)$ if $M$ accepts $w$ and $L(M_w)=\varnothing$ if $M$ does not accept $w$.

Since $L(T) \in P$ and $\varnothing \notin P$, we have that $L(M_w) \in P$ iff $M$ accepts $w$, i.e., $$\langle M_w\rangle \in L_P \Leftrightarrow \langle M, w \rangle \in L_H$$

So, $f$ is a reduction from $L_H$ to $L_P$. That means that $L_H \leq_m L_P$.
Is everything correct?

Could you clarify why it stands that $L(T_{\varnothing})=\varnothing$ ?

At the sentence "Therefore, $L(M_w)=L(T)$ if $M$ accepts $w$ and $L(M_w)=\varnothing$ if $M$ does not accept $w$. " we have that $L(M_w)=L(T)$ if $M$ accepts $w$ because on input $w$ both $M_w$ and $T$ accept? And we have that $L(M_w)=\varnothing$ if $M$ does not accept $w$ because $\varnothing=L(T_{\varnothing})$ and both $M_w$ and $T_{\varnothing}$ reject $w$?
 
Last edited by a moderator:
  • #25
mathmari said:
We will show that $L_H \leq_m L_P$
The reduction you are bullding is actually from $\{\langle M,w\rangle\mid M\text{ accepts }w\}$ and not from $\{\langle M,w\rangle\mid M\text{ halts on }w\}$. This is because you are showing
\[
M\text{ accepts }w\iff \langle M_w\rangle \in L_P
\]
and not
\[
M\text{ halts on }w\iff \langle M_w\rangle \in L_P
\]
However, modifying the construction to be a reduction from $L_H$ is easy.

mathmari said:
Because $P$ is not trivial, there exists a TM $T$ such that $L(T)\in P$.
In https://driven2services.com/staging/mh/index.php?posts/73374/ you defined $L_P$ as the language consisting of codes of those machines that satisfy $P$. However, in Sipser's proof in https://driven2services.com/staging/mh/index.php?posts/73400/ that language is denoted by $P$. In any case, I think that in the latest posts $P$ did not denote a property of languages, so you can't write $L(T)\in P$. It's best to summarize notation before a complete proof.

mathmari said:
$$M_w : \left\{\begin{matrix}
\text{ if } M(w) \downarrow \ \ \& \ \ M(w)=yes & \text{ then simulate } T(u). \\ \ \ \ \ & \text{ If } T(u)=yes \text{ then } M_w(u)=yes \\ \\
\text{ if } M(w) \downarrow \ \ \& \ \ M(w)=no &\text{ then } M_w(u)=no
\end{matrix}\right.$$
The thing on the left of the big curly brace should be $M_w(u)$ and not $M_w$.

mathmari said:
Could you clarify why it stands that $L(T_{\varnothing})=\varnothing$ ?
By definition of $T_\emptyset$ and $L(\cdot)$.

mathmari said:
At the sentence "Therefore, $L(M_w)=L(T)$ if $M$ accepts $w$ and $L(M_w)=\varnothing$ if $M$ does not accept $w$. " we have that $L(M_w)=L(T)$ if $M$ accepts $w$ because on input $w$ both $M_w$ and $T$ accept?
Not at all. $L(M_w)=L(T)$ means that $M_w$ and $T$ accept (i.e., say "yes") on the same set of words, and not only $w$.

mathmari said:
And we have that $L(M_w)=\varnothing$ if $M$ does not accept $w$ because $\varnothing=L(T_{\varnothing})$ and both $M_w$ and $T_{\varnothing}$ reject $w$?
Again, $L(M_w)=\emptyset$ means that $M_w$ does not accept any word, not just $w$.
 
  • #26
The theorem is

Let $P$ be any non-trivial property of languages of Turing machines. Then, the following language is undecidable

$L_P=\{\langle M \rangle \mid L(M) \text{ satisfies } $P$ \}$

I made some changes at the proof:

Let $L_H$ be the language of the Halting problem.

We will show that $L_H \leq_m L_P$. Since $L_H$ is undecidable, $L_P$ will also be undecidable.

Let $T_{\varnothing}$ be a TM that always rejects, so $L(T_{\varnothing})=\varnothing$.

We assume that $\varnothing$ doesn't satisfy $P$ without loss of generality because if it would satisfy we can proceed with $P^c$, which is also a non-trivial property of languages of TM.

Because $P$ is not trivial, there exists a TM $T$ such that $L(T)$ satisfies $P$.

We consider the computable function $f$ that maps $\langle M, w \rangle$ to $\langle M_w\rangle$, where $M_w$ is the following TM:

$$M_w(u) : \left\{\begin{matrix}
\text{ if } M(w) \downarrow & \text{ then simulate } T(u). \\ \ \ \ \ & \text{ If } T(u)=yes \text{ then } M_w(u)=yes \\ \\
\text{ if } M(w) \uparrow &\text{ then } M_w(u) \uparrow
\end{matrix}\right.$$

$M_w$ accepts on input $u$ iff $M$ halts and $T$ accepts $u$.

Therefore, $L(M_w)=L(T)$ if $M$ halts and $L(M_w)=\varnothing$ if $M$ does not halt.

Since $L(T)$ satisfies $P$ and $\varnothing$ doesn't satisfy $P$, we have that $L(M_w)$ satisfy $P$ iff $M$ halts, i.e., $$\langle M_w\rangle \in L_P \Leftrightarrow \langle M, w \rangle \in L_H$$
Is it correct?

To prove that the language $L=\{n \in \mathbb{N} \mid T_n(1) \downarrow \}$ is not recursive, I have done the following:

First way:

The property of the language is that the language of a TM contains the symbol $1$. This property is non-trivial. Regular languages are accepted by TMs. The regular language $0^{\star}$, which is accepted by a TM $T_0$, doesn't have this property. The regular language $1^+$, which is accepted by a TM $T_1$, has this property.

So, from Rice's theorem we have that the language $L=\{n \in \mathbb{N} \mid T_n(1) \downarrow \}$ is not recursive.
Second way:

Let $L_H$ be the language of the Halting problem.

We will show that $L_H \leq_m L$. Since $L_H$ is undecidable, $L$ will also be undecidable.

The property $P$ of the language is that the language of a TM contains the symbol $1$. This property is non-trivial. Regular languages are accepted by TMs. The regular language $0^{\star}$, which is accepted by a TM $T_0$, doesn't have this property. The regular language $1^+$, which is accepted by a TM $T_1$, has this property.

We consider the computable function $f$ that maps $\langle M, w \rangle$ to $\langle M_w\rangle$, where $M_w$ is the following TM:

$$M_w(1) : \left\{\begin{matrix}
\text{ if } M(w) \downarrow & \text{ then simulate } T(1). \\ \ \ \ \ & \text{ If } T(1)=yes \text{ then } M_w(1)=yes \\ \\
\text{ if } M(w) \uparrow &\text{ then } M_w(1) \uparrow
\end{matrix}\right.$$

$M_w$ accepts on input $1$ iff $M$ halts and $T$ accepts $1$.

Therefore, $L(M_w)=L(T)$ if $M$ halts and $L(M_w)=\varnothing$ if $M$ does not halt.

Since $L(T)$ satisfies $P$ and $\varnothing$ doesn't satisfy $P$, we have that $L(M_w)$ satisfy $P$ iff $M$ halts, i.e., $$\langle M_w\rangle \in L_P \Leftrightarrow \langle M, w \rangle \in L_H$$ Are both ways correct? Could I improve something?
 
  • #27
mathmari said:
Is it correct?
Yes.

mathmari said:
To prove that the language $L=\{n \in \mathbb{N} \mid T_n(1) \downarrow \}$ is not recursive, I have done the following:

First way:

The property of the language is that the language of a TM contains the symbol $1$. This property is non-trivial. Regular languages are accepted by TMs. The regular language $0^{\star}$, which is accepted by a TM $T_0$, doesn't have this property. The regular language $1^+$, which is accepted by a TM $T_1$, has this property.

So, from Rice's theorem we have that the language $L=\{n \in \mathbb{N} \mid T_n(1) \downarrow \}$ is not recursive.
Strictly speaking, there is a difference between halting on 1 ($T_n(1)\downarrow$) and accepting 1. At least the is a difference in Sipser; in some other sources it may be the same. So Rice's theorem is not immediately applicable here.
 
  • #28
Evgeny.Makarov said:
Strictly speaking, there is a difference between halting on 1 ($T_n(1)\downarrow$) and accepting 1. At least the is a difference in Sipser; in some other sources it may be the same. So Rice's theorem is not immediately applicable here.

So, we apply Rice's theorem only when the language accepts the input and not just hold on it?
The second way is correct, isn't it?
 
  • #29
mathmari said:
So, we apply Rice's theorem only when the language accepts the input and not just hold on it?
What exactly do you mean? A single input? All inputs? And how can a language accept an input? Write your idea formally.

To apply Rice's theorem, the set of machine codes should be language-invariant as defined in https://driven2services.com/staging/mh/index.php?posts/73362/, i.e., it must be a property of the TM's language as described in https://driven2services.com/staging/mh/index.php?posts/73400/.

mathmari said:
The second way is correct, isn't it?
Let's see.

mathmari said:
$$M_w(1) : \left\{\begin{matrix}
\text{ if } M(w) \downarrow & \text{ then simulate } T(1). \\ \ \ \ \ & \text{ If } T(1)=yes \text{ then } M_w(1)=yes \\ \\
\text{ if } M(w) \uparrow &\text{ then } M_w(1) \uparrow
\end{matrix}\right.$$
This is not a good description of $M_w$ because it describes its behavior only on input 1 and because $T$ is undefined. I assume $T$ is one of the machines that accepts input 1. Also, what happens when T(1) ="no"?

mathmari said:
$M_w$ accepts on input $1$ iff $M$ halts and $T$ accepts $1$.
Should say, "$M$ halts on $w$".

mathmari said:
$$\langle M_w\rangle \in L_P \Leftrightarrow \langle M, w \rangle \in L_H$$
This is correct, but $L_P\ne L=\{n \in \mathbb{N} \mid T_n(1) \downarrow \}$. This proof method suffers from the same flaw as the first one: $L$ does not correspond to a property of languages.

Also, if $L$ did correspond to a property of languages (e.g., if $L=\{n \in \mathbb{N} \mid T_n\text{ accepts }1 \}$), then the second method is simply the first one with the proof of Rice's theorem attached. Specializing the proof of a theorem to a concrete situation is a good exercise, but it is hardly a different proof.
 

FAQ: Understanding Rice's Theorem: A Comprehensive Guide

1. What is Rice's Theorem?

Rice's Theorem is a fundamental result in computer science and mathematics that states that it is impossible to create a general algorithm to determine the properties of a program or function. In other words, there is no algorithm that can take in any program and determine what it does or what properties it has.

2. Why is Rice's Theorem important?

Rice's Theorem has many important implications in computer science, particularly in the field of computability and complexity theory. It helps us understand the limits of computation and the types of problems that are unsolvable by computers. It also has practical applications in software verification and program analysis.

3. How does Rice's Theorem relate to the halting problem?

Rice's Theorem is closely related to the halting problem, which is the problem of determining whether a program will eventually halt or run forever. In fact, Rice's Theorem is a generalization of the halting problem, showing that it is impossible to create a general algorithm to solve not just the halting problem, but any problem about program properties.

4. Can you give an example of a problem that cannot be solved using Rice's Theorem?

One example is the problem of determining whether a program will always produce an even output. This is a property that cannot be determined by a general algorithm according to Rice's Theorem. Another example is determining whether a program will always terminate in a prime number.

5. Are there any exceptions to Rice's Theorem?

There are some limited exceptions to Rice's Theorem, such as when the program in question is simple enough to be analyzed by a more specific algorithm. However, these exceptions are rare and do not change the overall validity of Rice's Theorem.

Back
Top