CS103 - 6 2 23
CS103 - 6 2 23
CS103 - 6 2 23
Unsolvable Problems
Outside even recognizable languages = Finding Non-RE Languages
Let’s jump right into proving that there exists a language that is not recognizable
Opening thought question: let’s list off all TMs and look at how they behave when
they are fed other TM codes (as strings) as input
o Expand the definition of code and TMs beyond the understanding that only
some machines take TMs as input. The alphabet of a TM isn’t that important
since we can always convert to other alphabets (eg: binary code). Bottom
line, just accept that every TM that exists can in
some sense take other TM source code as input.
Start mechanically listing down TMs starting with all
possible single lines of code, then 2 lines, etc… --- infinite
list. Then observe what the behavior would be when fed
other TMs (accept vs no).
o Here’s an example of how this table could look…
o Check in question: What is L(M0)?
{⟨M0⟩, ⟨M3⟩, ⟨M4⟩, ... }
o L(M1) and L(M2) are potentially Σ* if pattern continues
o Aside: even if M1 and M2 accept every TM code, doesn’t necessarily mean
their language is Σ* if there are strings that they also accept but that are not
the code of TMs. We don’t need to worry about the existence of any of these
strings but could include union of {w | w is a string that isn’t a TM’s code and
M accepts w) in the language of M.
o Pollev: How many TMs don’t accept their own source
code? 2: M3 and M5
o Throwback to Cantor’s theorem: we’re going to take a
collection of the diagonal and flip – is there any TM that
can accept that language (set of acc and no for TMs).
o No possible TM can have the language in light blue at the
bottom! We cannot recognize this language; L = {⟨M⟩| M is
a TM and M ∉ L(M)}
Diagonalization Language
The language we saw in proof above is called diagonalization language.
LD = {⟨M⟩| M is a TM and M ∉ L(M)}
This is our first unrecognizable language (note: there’s actually an infinite number
of unrecognizable language)
(Note 2: LD is a special name that we should recognize, just like A TM)
Theorem: LD ∉ RE
Proof:
By contradiction; assume that LD ∈ RE. Then there must be some recognizer R such
that L(R) = LD.
Let M be an arbitrary TM. Since L(R) = LD, we know that:
⟨M⟩ ∈ LD iff ⟨M⟩ ∈ L(R). -- (1)
From the definition of LD, we see that ⟨M⟩ ∈ LD iff ⟨M⟩ ∉ L(M).
Combining this with statement (1) tells us that
⟨M⟩ ∉ L(M) iff ⟨M⟩ ∈ L(R). -- (2)
Since our choice of M was arbitrary, we see that statement (2) holds for any TM M.
In particular, this means that statement (2) holds for the TM R, which tells us that
⟨R⟩ ∉ L(R) iff ⟨R⟩ ∈ L(R). -- (3)
This is clearly impossible. We have reached a contradiction, so our assumption must
have been wrong. Thus LD ∉ RE. ■
This result can be formalized as Gödel’s incompleteness theorem
Decidable vs Recognizable
{⟨M⟩|…} is generally assumed not decidable but not always.
There’s a great theorem that formalizes that: Rice’s theorem: Any language that
consists of certain TMs but not others and claims to make any distinguishing based
on the language of the TM (i.e. distinguishes based on their language/ behavior) is
not decidable.
o However, if the claim about the behavior is true about every TM or no TM,
then this theorem does not apply
o Eg: L = {⟨M⟩| M is a TM and ε ∈ L(M) or ε ∉ L(M)}: initially looks like Rice’s
applies, but actually this is true for everything (ε always either in or out) ---
this language is not only decideable, but it’s actually regular!
o Similarly L = {⟨M⟩| M is a TM and ⟨M⟩ is odd} has nothing to do with L(M) so
Rice’s does not apply! (again regular language land)