Decidability
Decidability is a property of languages. A language is decidable if there exists an algorithm that can determine whether a given string is in the language or not. Apparently, decidable languages are the same as recursive languages.
Inclusion Chain
We have the following inclusion chain of language classes:
where
We will show the inclusion and decidability in the following sections.
Do we have non-RE languages?
It seems that the inclusion chain implies that not all languages are recursively enumerable. Indeed, and we will show that there are non-RE languages by constructing one.
Lemma 1: The set of all Turing machines
Lemma 2: The set of all languages
Theorem: There are languages that are not recursively enumerable, for the function
Proof of Lemma 1: The set of all Turing machines is countable because each Turing machine can be represented by a finite string, and the set of all finite strings is countable (We can easily give a mapping from the set of all finite strings to positive integers).
Proof of Lemma 2: We can use binary string to encode languages, and suppose that the set of all languages is countable, then we can assign one integer to each language and corresponding string. However, we can construct a language
Then,
Lemma 2 can also be proved by Cantor's diagonal argument.
The Halting Problem
The halting problem is the problem of determining, given a description of a program and an input, whether the program will eventually halt when running with that input. Formally, given a pair
Undecidability
Theorem The halting problem is undecidable.
Proof Suppose that there is a Turing machine yes
if no
otherwise.
We can define a new Turing machine yes
, then no
,
Let's consider what happens when we input no
, then
Co-RE Languages
The complement of all recursively enumerable languages is called co-
Venn Diagram of RE and co-RE
Proof
We already know that
If a language
We can easily imply that