Decidability
The diagonalization method
Undecidability
fig2
Countable and Uncountable Sets
- The natural numbers N={ 1,2,3,…} are countable.
Definition: a set S is countable if it is finite, or it is infinite and there is a bijection
f: N→S
The positive rational numbers
Q={m / n |m,n∈N} are countable.- Theorem: The real numbers R are uncountable. (Cantor diagonalization)
Non-RE Languages
Theorem: there exist languages that are not Recursively Enumerable.
Proof outline:
- the set of all TMs is countable
- the set of all languages is uncountable
- the function
L : {TM’s} → {languages}$ cannot be onto
Proof:
The halting problem is undecidable
The Halting Problem
Definition:
HALT = { <M,x> | TM M halts on inputx} Theorem: HALT is not decidable (undecidable).
- Proof:、
- Suppose TM H decides HALT
- if
M halts on x ,H accept - if M does not halt on
x , H reject
- if
- Define new TM
H′ : on input <M> <script type="math/tex" id="MathJax-Element-19"> </script>
- if H accepts
<M,<M>> , then loop - if H rejects
<M,<M>> , then halt
- if H accepts
- Consider H′ on input <H′> <script type="math/tex" id="MathJax-Element-25"> </script>:
- if it halts, then H rejects
<H′,<H′>> , which implies it cannot halt - if it loops, then H accepts
<H′,<H′>> , which implies it must halt
- if it halts, then H rejects
- Contradiction. Thus neither H nor
H′ can exist
RE and co-RE
The complement of a RE language is called a co-RE language.
Theorem: a language L is decidable if and only if L is RE and L is co-RE.
Proof:
(⇒) we already know decidable implies RE
- If L is decidable, then complement of L is decidable by flipping accept/reject.
- So L is in co-RE.
(⇐) we have TM M that recognizes
- On input x, simulate
M , M′ in parallel.- If M accepts, accept; if
M′ accepts, reject. A natural non-RE Language
Theorem: the complement of HALT is not recursively enumerable.
Proof:
we know that HALT is RE
suppose complement of HALT is RE
then HALT is co-RE
implies HALT is decidable.
Contradiction.
Complexity
Analyze Algorithms
Worst-Case AnalysisTime Complexity
Measure Time Complexity
Asymptotic Notation
Asymptotic Notation Facts
- logarithmic: O(log n)
- logbn=(log2n)/(log2b)
- so logbn = O(log2n
- If M accepts, accept; if