Sub topic 2
Closure properties: what union, intersection and complement preserve
This chapter assumes you know finite automata, context-free grammars, and proof by contradiction. A Turing machine (TM) is a model of computation with a tape and a finite set of states. A language is decidable (recursive) if some TM halts on every input with accept or reject. It is recursively enumerable (RE) if some TM accepts exactly its strings and may loop on others.
Closure properties
A class of languages is closed under an operation when applying that operation to members of the class always gives another member.
Recursive languages are closed under union, intersection and complement. Given deciders M1 and M2, run both on the input and combine their answers. For complement, swap accept and reject.
RE languages are closed under union and intersection. Run both recognizers alternately, one step at a time, so that a looping machine does not block the other. RE languages are not closed under complement.
| Operation | Recursive | RE |
|---|---|---|
| Union | Yes | Yes |
| Intersection | Yes | Yes |
| Complement | Yes | No |
The Church-Turing thesis
The Church-Turing thesis states that every effectively computable function can be computed by a TM. It is a thesis, not a theorem, because "effectively computable" is an informal notion. No model yet tried has exceeded the power of TMs.
Encoding machines and the universal Turing machine
Each TM M has a finite description written as a string, denoted <M>. A universal Turing machine U takes the pair <M, w> and simulates M on w. Machines can therefore be treated as data.
Why some languages have no machine: counting and diagonalization
Each TM has a finite description, so there are only countably many TMs. The languages over {0,1} form an uncountable set. Some languages therefore have no TM. Diagonalization gives an explicit example. List the strings w1, w2, ... and define L as the set of wi such that Mi does not accept wi.
The halting problem and A_TM are undecidable
ATM = {<M, w> : M accepts w}. Suppose a decider H exists for ATM. Build D, which on input <M> runs H on <M, <M>>. If H accepts, D loops forever. If H rejects, D accepts. Now run D on <D>. If H accepts, D loops, so H was wrong. If H rejects, D accepts, so H was wrong again. No decider H exists.
Proving undecidability by reduction
To show that a language B is undecidable, assume a decider for B and use it to decide a language already known to be undecidable, such as ATM. Build a machine that transforms an ATM instance into a B instance.
HALTTM = {<M, w> : M halts on w}. Given <M, w>, build M' that runs M on w and accepts if M accepts. Otherwise M' loops. M' halts on w exactly when M accepts w. A decider for HALTTM would therefore decide ATM, so HALTTM is undecidable.
Exercise
Is the complement of A_TM recursively enumerable?
Show answer
No. ATM is RE. If its complement were also RE, ATM would be recursive, which contradicts its undecidability.