Corollary (Sipser Lecture 8). The set ℒ of all languages over a nonempty countable alphabet is uncountable. Combined with the countability of Turing machines, this shows that some language is not Turing-decidable.
A TMDesc packages a Turing machine together with its (decidable) state type and an input
string. This corresponds to the encoded pair ⟨M, w⟩ used throughout Sipser's undecidability
arguments — for example, the input to a putative decider for A_TM.
- Q : Type
- decEq : DecidableEq self.Q
- input : List Γ
Instances For
A TMEncoding over alphabet Γ is a bundle of all the encoding/universal-machine
machinery used informally in Sipser. It provides:
- an injective encoding
encode : TMDesc Γ → List Γwith a decoder, - a self-reference principle (used for the Recursion Theorem / diagonal argument),
- a universal TM
Uthat simulates encoded TMs whenever they halt, - sequential composition of a decider with another TM, and
- transducer composition with computable functions, as used in mapping reductions.
- encode_injective : Function.Injective self.encode
Instances For
Dovetailing simulation. Given TMs M₁, M₂ such that for every input w at least one of
them accepts, one can construct a decider T that simulates both in parallel and accepts iff
M₁ accepts. This is the technical content behind Sipser's Lecture 8 theorem "If A and Aᶜ
are T-recognizable then A is decidable."
Theorem (Sipser Lecture 8). If both A and its complement Aᶜ are Turing-recognizable
then A is Turing-decidable. The proof runs the two recognizers in parallel and accepts/rejects
according to whichever halts first.
If a TM accepts an input then it halts on that input (accepting is a form of halting).
Swapping accept/reject states does not change the one-step transition function of the TM
on non-halting configurations, and on halting configurations both sides idle, so the step
functions agree pointwise.
If H is a decider then its flip H.flip accepts w iff H does not accept w. This is
the crucial property that allows the flip to decide the complement language.
Theorem (Sipser, undecidability of A_TM). The acceptance problem
A_TM = {⟨M, w⟩ | M accepts w} is not Turing-decidable. The proof is the classical Turing
diagonal argument: assuming a decider H exists, the flipped machine D = H.flip (which
decides whether H rejects) leads to a contradiction via the self-reference principle
provided by TMEncoding.
A decider for HALT_TM yields a decider for A_TM. This is the standard reduction
A_TM ≤ HALT_TM: first use the HALT_TM-decider to check that M halts on w, then run the
universal TM U (which is guaranteed to halt on inputs whose underlying TM halts) to determine
whether M accepts. Together with the undecidability of A_TM this implies the undecidability
of HALT_TM.
Theorem (Sipser). The halting problem HALT_TM = {⟨M, w⟩ | M halts on w} is
undecidable, by reduction from A_TM.
The head movement directions L and R form a two-element Fintype.
The raw data of a finite-state Turing machine over Γ: a state count n, a blank symbol,
a transition function, and start/accept/reject states. This is the carrier used to enumerate
TMs in a countable family.
Instances For
For finite alphabets, the set of finite-state TM descriptions is countable.
Map a piece of raw TM data to its language. If qAccept = qReject (ill-formed data) the
language is empty; otherwise it is the language of the corresponding TM.
Instances For
Two TMs that agree on blank, transition function, start, accept, and reject states
accept the same language. The "extra" data in a TM record (e.g. inputAlpha) does not affect
the language.
Every language of a TM with state set Fin n arises as tmDescToLang of some encoded
description.
Corollary (Sipser Lecture 8). Some language is not Turing-decidable. The argument is the cardinality argument: there are only countably many Turing machines but uncountably many languages, so some language cannot be decided.
An explicit witness to "some language is undecidable": A_TM itself is undecidable.
Restatement: there exists a language over Γ that is not Turing-decidable.
A PCP instance is a finite list of dominoes.
Instances For
A PCP instance P has a match if there is a nonempty sequence of indices i₁, …, iₖ such
that concatenating the tops in order produces the same string as concatenating the bottoms in
order. The PCP language is precisely the set of encoded instances with a match.
Instances For
An injective encoding/decoding scheme that turns PCP instances over Γ into strings
over Γ.
- encode : PCPInstance Γ → List Γ
- decode : List Γ → Option (PCPInstance Γ)
- encode_injective : Function.Injective self.encode
Instances For
The Post Correspondence Problem language PCP = {⟨P⟩ | P has a match}. By Sipser's
Lecture 10 theorem, this language is undecidable.
Instances For
An LBADesc packages a linearly bounded automaton (a finite-state TM constrained to its
input region) with an input string. Following Sipser, LBA = ⟨B, w⟩ is the typical input to
A_LBA.
- Q : Type
- decEq : DecidableEq self.Q
- lba : TuringMachine.LBA self.Q Γ
- input : List Γ
Instances For
Injective encoding/decoding of LBADescs into strings, used to formulate the language
A_LBA.
- encode_injective : Function.Injective self.encode
Instances For
A bounded configuration records only the data of an LBA configuration that can vary in
the bounded simulation: state, head position in Fin m, and tape contents on the first m
cells. The total number of such configurations is finite.
Instances For
The set of bounded configurations of an LBA with state set Q, tape alphabet Γ, and
input bound m is finite when Q and Γ are. This finiteness is the basis of the decidability
of A_LBA: an LBA either accepts within |Q| · m · |Γ|^m steps or loops.
Extract the bounded-configuration view of a TM configuration whose head lies in [0, m).
Instances For
An LBA never modifies tape cells outside the input region [0, max 1 |w|): for any
position i outside this region, the tape symbol after n steps equals the initial symbol.
If two configurations of an LBA running on input w agree on their bounded views (state,
head position, and tape contents in [0, max 1 |w|)) then they are equal as full
configurations, since the tape outside that window is fixed. This is the key lemma underlying
the pigeonhole argument that bounds LBA running time.
Acceptance of an LBA description is decidable (classically). Constructively this follows from the finiteness of LBA configurations, which bounds the search for an accepting run.
There is a universal TM U that, when run on the encoding of an LBADesc d, simulates the
LBA d.lba on input d.input and decides whether it accepts. U always halts because LBAs
have only finitely many configurations on a fixed input, so non-acceptance can be detected by
pigeonhole.
Theorem (Sipser Lecture 10). A_LBA = {⟨B, w⟩ | LBA B accepts w} is Turing-decidable.
The decider simulates B on w for enough steps that, by pigeonhole on bounded
configurations, either acceptance has occurred or the LBA is in a loop.
An LBAMachineDesc is an LBA on its own (no input attached), used for the emptiness
problem E_LBA.
- Q : Type
- decEq : DecidableEq self.Q
- lba : TuringMachine.LBA self.Q Γ
Instances For
The language accepted by an LBA description.
Instances For
Injective encoding/decoding of LBA machine descriptions, used to formulate E_LBA.
- encode : LBAMachineDesc Γ → List Γ
- decode : List Γ → Option (LBAMachineDesc Γ)
- encode_injective : Function.Injective self.encode
Instances For
The emptiness problem for LBAs: E_LBA = {⟨B⟩ | L(B) = ∅}. By Sipser's Lecture 10 theorem,
this language is undecidable.
Instances For
Computation-history construction for E_LBA. Given a TM description d, one can build an
LBA bd whose language is empty iff d does not accept. (The LBA recognizes valid
accepting computation histories of d; emptiness corresponds to no accepting history existing,
i.e. d does not accept.)
A default LBA description whose language is empty, used for malformed inputs of the mapping reduction.
The transducer that maps a TM description to its computation-history LBA description is
TM-computable. This is the computability side of the reduction A_TM ≤ₘ E_LBAᶜ.
Computation-history transducer for E_LBA. There exists a computable function f
mapping TM encodings to LBA encodings such that on a valid TM input ⟨d⟩, f produces an
LBA whose language is empty iff d does not accept, and on invalid inputs f produces an
LBA with empty language. This is the engine of the reduction A_TM ≤ₘ (E_LBA)ᶜ.
Mapping reduction A_TM ≤ₘ (E_LBA)ᶜ. Using the computation-history construction, the
acceptance problem for TMs many-one reduces to the non-emptiness problem for LBAs. Since
A_TM is undecidable, so is (E_LBA)ᶜ, and hence so is E_LBA.
If E_LBA were decidable, so would A_TM be: combine a decider for E_LBA, flip it to
decide the complement, and pre-compose with the computation-history transducer.
Theorem (Sipser Lecture 10). The LBA emptiness problem
E_LBA = {⟨B⟩ | L(B) = ∅} is undecidable.
Theorem. A_TM is Turing-recognizable: the universal TM U provided by the encoding
serves as a recognizer. On input ⟨M, w⟩, U simulates M on w and accepts iff M does.
Corollary (Sipser Lecture 8). The complement (A_TM)ᶜ is not Turing-recognizable.
For if both A_TM and its complement were recognizable, then by the previous theorem A_TM
would be decidable, contradicting the diagonal argument.
Restatement of the previous corollary in the root namespace: (A_TM)ᶜ is
T-unrecognizable.
An injective encoding/decoding scheme that turns context-free grammars over Γ into
strings over Γ. Used to formulate ALL_CFG.
- encode : ContextFreeGrammar Γ → List Γ
- decode : List Γ → Option (ContextFreeGrammar Γ)
- encode_injective : Function.Injective self.encode
Instances For
Computation-history reduction for ALL_CFG. There is a computable function f
mapping TM encodings to CFG encodings such that, for any TM d, the CFG f(⟨d⟩) generates
all strings iff d does not accept (so the strings not generated correspond to
accepting computation histories of d), and on invalid inputs f outputs a universal CFG.
The universality problem for CFGs: ALL_CFG = {⟨G⟩ | G is a CFG and L(G) = Σ*}. By
Sipser's Lecture 10 theorem, this language is undecidable.
Instances For
Re-export of the computation-history CFG construction at the top level.
Mapping reduction A_TM ≤ₘ (ALL_CFG)ᶜ. Via the computation-history CFG construction,
the acceptance problem reduces to the complement of CFG universality.
If ALL_CFG were decidable, so would A_TM be: flip the ALL_CFG-decider and compose
with the reduction f.
Theorem (Sipser Lecture 10). ALL_CFG = {⟨G⟩ | L(G) = Σ*} is undecidable.
Restatement of ALL_CFG_not_decidable at the root namespace level.
Sipser Lecture 9 (mapping reductions preserve decidability). If A ≤ₘ B and B is
decidable, then so is A: compose the reduction transducer with the decider for B.
Sipser's PCP construction. There is a map pcpFor from TM descriptions to PCP
instances such that the constructed instance has a match iff the TM accepts its input, and the
overall input-to-encoding map is TM-computable. This is the technical heart of the reduction
A_TM ≤ₘ PCP.
Computation-history PCP construction. A computable function f maps any TM encoding
to a PCP-instance encoding so that the PCP instance has a match iff the TM accepts its input,
and on inputs that are not TM encodings the resulting PCP instance has no match. Combined with
the empty-list lemma, this yields the mapping reduction A_TM ≤ₘ PCP.
Mapping reduction A_TM ≤ₘ PCP. Using the computation-history PCP construction, the
acceptance problem many-one reduces to PCP.
If PCP were decidable, so would A_TM be (immediate consequence of the mapping reduction
and decidability transferring along mapping reductions).
Theorem (Sipser Lecture 10). The Post Correspondence Problem
PCP = {⟨P⟩ | P has a match} is undecidable, by reduction from A_TM.