The Hierarchy of Computational Power
Not all computational models are created equal. As we relax restrictions on memory and access, the class of languages recognized grows larger.
Regular (DFA/NFA)
Memory: Finite states only.
Example: \( L = \{ w \in \{0,1\}^* \mid w \text{ has even 0s} \} \)
Limit: Cannot count arbitrarily high.
Context-Free (PDA)
Memory: Infinite Stack (LIFO).
Example: \( L = \{ 0^n 1^n \mid n \ge 0 \} \)
Limit: Can only compare two dependent parts.
Turing Machine
Memory: Infinite Tape (Random Access).
Example: \( L = \{ 0^n 1^n 0^n \mid n \ge 0 \} \)
Power: Can solve anything algorithmically solvable.
Multitape Turing Machines
- Single Tape: Zig-zag back and forth matching first and last chars. \(O(n^2)\).
- 2-Tape: Copy input to Tape 2. Move Tape 1 head to start, Tape 2 head to end. Move heads towards each other comparing symbols. \(O(n)\).
Equivalence Proofs
To show two models are equivalent, we must show that they can simulate each other.
1. Multitape \(\equiv\) Single Tape
We can flatten \(k\) tapes onto a single tape by using delimiters (\#) and marking virtual head positions with dotted symbols.
2. Doubly-Infinite Tape \(\equiv\) Semi-Infinite Tape
A standard TM has a left boundary. A doubly-infinite TM does not. We simulate the doubly-infinite one by "folding" it at the origin.
- If \(i \ge 0\), map to \(2i\) (Even cells).
- If \(i < 0\), map to \(2(-i) - 1\) (Odd cells).
Interactive Simulation: Binary Adder
This 3-Tape machine adds two binary numbers. Input is placed on Tape 1 (e.g., "101+11").
- Scan Tape 1 to copy the first number to Tape 2 (reversed) and second number to Tape 3 (reversed).
- Reset heads on Tape 2 and 3.
- Perform addition bit-by-bit from left to right (since numbers are reversed), writing sum to Tape 1.
- Handle carry.
- (In a real TM, we would reverse Tape 1 again to get final result, simplified here).
Halting vs. Acceptance
This distinction is the foundation of Computability Theory.
Turing-Recognizable (RE)
A language \(L\) is RE if there exists a TM \(M\) such that:
- If \(w \in L\), \(M\) halts and accepts.
- If \(w \notin L\), \(M\) either rejects or loops forever.
Turing-Decidable (Recursive)
A language \(L\) is Decidable if there exists a TM \(M\) such that:
- If \(w \in L\), \(M\) halts and accepts.
- If \(w \notin L\), \(M\) halts and rejects.
(No infinite looping allowed!)
Other Variations of Turing Machines
All of the following are equivalent in power to the standard Single-Tape DTM.
Theorem: A language is Turing-Recognizable iff some enumerator enumerates it.
Simulation: Map \( \mathbb{Z}^2 \to \mathbb{Z} \) using a spiral mapping (Cantor pairing function).
Equivalence: A TM can simulate RAM by using one tape for memory addresses and another for values. It's slower (polynomial slowdown), but computes the same functions.
The Universal Turing Machine (UTM)
A standard TM is hardwired to do one task. A UTM is a programmable machine.
Encoding: We encode the states, alphabet, and transition function of \(M\) into a string (e.g., binary). The UTM reads this description on one tape and the contents of \(M\)'s simulated tape on another.
The Church-Turing Thesis
"Everything that is intuitively computable can be computed by a Turing Machine."
This is a hypothesis, not a theorem. It equates the informal notion of an "Algorithm" with the formal mathematical definition of a Turing Machine.
Why do we believe it?
- Many different models were proposed in the 1930s (Lambda Calculus, Recursive Functions, Post Systems).
- All were proven to be mathematically equivalent to TMs.
- No one has ever found a physically realizable computation method that is more powerful than a TM (Quantum computers are faster, but not "more powerful" in terms of computability).
Nondeterministic Turing Machines (NDTM)
Deterministic (DTM): \(\delta: Q \times \Gamma \to Q \times \Gamma \times \{L, R\}\)
Nondeterministic (NDTM): \(\delta: Q \times \Gamma \to \mathcal{P}(Q \times \Gamma \times \{L, R\})\)
An NDTM accepts input \(w\) if at least one branch of the computation tree leads to \(q_{accept}\).
Simulation Strategy (Proof Sketch)
We use a DTM with 3 tapes to simulate the NDTM using Breadth-First Search (BFS) on the computation tree.
- Tape 1: Holds the original input \(w\) (read-only).
- Tape 2: Simulation tape (scratchpad).
- Tape 3: Address tape. Stores a sequence (e.g., 1-2-3-1) telling the NDTM which choice to make at each step.