A function f : ℕ → ℕ is time constructible if there exists a Turing machine M
which is a decider, runs in some time t', with t' = O(f). This is the standard
hypothesis under which the Time Hierarchy Theorem is stated.
Instances For
Little-o implies big-O: if g = o(f) then g = O(f).
Universal simulation with logarithmic overhead. Given a time-constructible bound
f, there is a single universal simulator TM sim that runs in time O(f) and
correctly decides membership in M.language for every decider M whose running
time s satisfies s = O(f(n)/log(f(n))). This is the key ingredient powering the
Time Hierarchy Theorem: the log factor accounts for the overhead of simulating an
arbitrary machine M on a fixed universal machine.
Running a deterministic TM for n + m steps is the same as running it for n
steps and then m more steps from the resulting configuration.
Swapping the accept and reject states of a TM does not change how the next
configuration is computed (the step function only consults δ, not the
accept/reject labels). Used to build the diagonalizer machine which complements
the language of the universal simulator.
Iterated version of tm_swap_step_eq: swapping the accept/reject states of a TM
leaves every n-step run identical to that of the original machine.
Existence of a time-diagonalizer. From a time-constructible bound f we
construct a decider D running in time O(f) whose language differs from the
language of every decider M running in time O(f(n)/log(f(n))). D is built by
swapping accept/reject on the universal simulator from
universal_simulation_overhead, so that it accepts exactly the encodings rejected
by the simulator — a Cantor-style diagonalization within TIME(f).
Time Hierarchy Theorem. For any time-constructible f, there is a language A
which is decidable in TIME(f(n)) but is not decidable in TIME(g(n)) for any
g = o(f(n)/log(f(n))). Equivalently,
TIME(o(f(n)/log(f(n)))) ⊊ TIME(f(n)). Proved by diagonalizing against all
faster machines using time_diagonalizer_exists.
IsAsympDominated g f is the little-o relation on ℕ → ℕ: for every constant
c > 0 there exists n₀ such that c · g(n) < f(n) for all n ≥ n₀.
Used to express g = o(f) in the Space Hierarchy Theorem.
Instances For
A function f : ℕ → ℕ is space constructible if there is a TM decider M
whose space usage on every input of length n equals f(n) exactly once it
halts. This is the standard hypothesis for the Space Hierarchy Theorem.
Instances For
A TM description packages a Turing machine over alphabet Γ together with
its number of states. The state type Fin (numStates + 3) reserves three states
(start, accept, reject) on top of the working states, providing a uniform shape
for enumeration in the diagonalization construction.
- numStates : ℕ
- machine : TuringMachine.TM (Fin (self.numStates + 3)) Γ
Instances For
The diagonal language with respect to an encoding encode : TMDesc Γ → List Γ:
the set of strings w such that whenever w encodes some machine description d,
d.machine does not accept w. By Cantor-style diagonalization, this language
differs from every machine's language on at least one encoding.
Instances For
Under an injective encoding, membership of encode d in the diagonal language is
equivalent to d.machine not accepting its own encoding encode d.
The diagonal language differs from the language of every machine d.machine.
This is the diagonalization core: on its own encoding encode d, the two
languages must disagree (whether or not d.machine accepts encode d).
Space-bounded universal simulation. Given a space-constructible bound f,
there exists an injective encoding of TM descriptions and a single decider D
whose language is the diagonal language diagLang encode, runs in space O(f),
and such that every TM M running in space o(f) is represented (up to language)
by some description d. This is the space analogue of
universal_simulation_overhead and the engine of the Space Hierarchy Theorem.
Existence of a space-diagonalizer. From a space-constructible bound f we
build a TM D that runs in space O(f) and whose language differs from the
language of every TM M running in space g = o(f). Combines sim_overhead
with diagLang_ne to produce the witness used in the Space Hierarchy Theorem.
Space Hierarchy Theorem. For any space-constructible f, there exists a
language A decidable in SPACE(f(n)) but not in SPACE(o(f(n))). In other
words, SPACE(o(f(n))) ⊊ SPACE(f(n)). Proved by exhibiting the diagonalizer
machine from diagonalizer_exists.
A deterministic oracle Turing machine over state set Q and tape alphabet Γ.
Beyond the usual TM data (blank symbol, input alphabet, transition δ, start state,
accept/reject states), the machine has a distinguished query state qQuery and an
oracle oracle ⊆ List Γ. The transition function takes an extra Bool reading the
oracle's answer to the current query tape, so the machine can consult oracle
membership in a single step.
- blank : Γ
- inputAlpha : Set Γ
- blank_not_in_inputAlpha : self.blank ∉ self.inputAlpha
- δ : Q → Γ → Bool → Q × Γ × TuringMachine.Direction
- q₀ : Q
- qAccept : Q
- qReject : Q
- qQuery : Q
Instances For
A configuration of an oracle TM: the current state, head position on the two-way infinite tape, the tape contents, and the contents of the auxiliary query tape which holds the string to be tested against the oracle.
Instances For
One computation step of a deterministic oracle TM. If the current state is
qAccept or qReject, the configuration is left unchanged (halted). Otherwise
the oracle answer is computed (as queryTape ∈ oracle when in qQuery, else
false), δ is consulted, and the head, state, and tape are updated.
Instances For
M.run c n applies M.step exactly n times starting from configuration c.
Instances For
The initial oracle TM configuration on input w: state is q₀, head at position
0, tape contains w on cells 0, …, w.length - 1 and blank elsewhere, and the
query tape is empty.
Instances For
Run M for n steps starting from its initial configuration on input w.
Instances For
M.accepts w if some finite-step run of M on input w ends in qAccept.
Instances For
M.halts w if some finite-step run of M on w reaches qAccept or qReject.
Instances For
The language of an oracle TM M is the set of strings it accepts.
Instances For
An oracle TM M is a decider if it halts on every input.
Instances For
M.decides B means M is a decider and L(M) = B.
Instances For
M.runsInTime t if on every input w, M reaches an accept or reject state
within t(|w|) steps.
Instances For
A nondeterministic oracle Turing machine: like OracleTM but the transition
function δ returns a set of possible next moves at each step. Used to define
NP-with-oracle complexity classes.
- blank : Γ
- inputAlpha : Set Γ
- blank_not_in_inputAlpha : self.blank ∉ self.inputAlpha
- δ : Q → Γ → Bool → Set (Q × Γ × TuringMachine.Direction)
- q₀ : Q
- qAccept : Q
- qReject : Q
- qQuery : Q
Instances For
Single-step relation for an oracle NTM: M.step c₁ c₂ holds when c₂ is one of
the configurations reachable from c₁ in one step (or c₂ = c₁ if c₁ is a
halt configuration). Membership of queryTape in oracle is consulted whenever
the state is qQuery.
Instances For
Initial configuration of an oracle NTM on input w (analogous to OracleTM.initConfig).
Instances For
A configuration is a halt configuration if its state is qAccept or qReject.
Instances For
A configuration is an accept configuration if its state equals qAccept.
Instances For
M.accepts w if there exists some nondeterministic computation branch of M
on w (a finite sequence of valid step-related configurations starting from
M.initConfig w) ending in an accept configuration.
Instances For
The language of an oracle NTM M is the set of strings it accepts.
Instances For
An oracle NTM M is a decider if every nondeterministic branch from the
initial configuration eventually reaches a halt configuration.
Instances For
M.decides B if M is a decider whose language is B.
Instances For
M.runsInTime t if on every input w and every valid branch of length
k ≤ t(|w|), the configuration at step k is a halt configuration.
Instances For
InPWithOracle A B says B ∈ P^A: some deterministic oracle TM with oracle A
decides B in polynomial time n^k.
Instances For
InNPWithOracle A B says B ∈ NP^A: some nondeterministic oracle TM with
oracle A decides B in polynomial time n^k.
Instances For
InPSPACE A (in this namespace) reuses the definition SpaceComplexity.InPSPACE.
Instances For
InNPSPACE A (in this namespace) reuses the definition SpaceComplexity.InNPSPACE.
Instances For
TQBF is the language of true quantified Boolean formulae under encoding enc
(a wrapper over SpaceComplexity.tqbfLanguage). TQBF is the canonical
PSPACE-complete language used here as an oracle.
Instances For
PSPACE ⊆ NPSPACE: any deterministic PSPACE machine is a (trivial) nondeterministic one.
Savitch's Theorem at the PSPACE level: NPSPACE = PSPACE. Forward direction
is the standard Savitch simulation NSPACE(s) ⊆ SPACE(s²); the reverse direction
is trivial inclusion.
NP^TQBF ⊆ NPSPACE: any nondeterministic polynomial-time machine using a TQBF
oracle can be simulated in nondeterministic polynomial space, since each oracle
query can be answered in PSPACE.
If B ≤_P A then B ∈ P^A: a polynomial-time reduction can be carried out by a
P machine that calls the oracle A once on the reduced input.
PSPACE ⊆ P^TQBF: every PSPACE language polynomial-time reduces to TQBF (since
TQBF is PSPACE-complete), so it is in P with a TQBF oracle.
P^A ⊆ NP^A for every oracle A: a deterministic oracle machine is a (trivial) nondeterministic one.
There exists an oracle A such that P^A = NP^A. Take A = TQBF. Then both
P^TQBF and NP^TQBF collapse to PSPACE: the containments
P^TQBF ⊆ NP^TQBF ⊆ NPSPACE = PSPACE ⊆ P^TQBF together with Savitch's theorem
give equality. This is the classic "relativization barrier" result for P vs NP.