Documentation

Complexitylib.Classes.Containments.NLSubsetP

NL ⊆ P #

⚠️ Unreviewed by Bolton

Nondeterministic logarithmic space is contained in deterministic polynomial time.

On an input of length n, a machine using O(log n) work space has only polynomially many configurations: a state, an input head position, and O(log n) cells of work tape. The machine accepts exactly when some accepting configuration is reachable from the initial one in the configuration graph, and reachability in a polynomially sized graph is decidable in polynomial time by breadth-first search.

How it is proved #

The graph half comes first. NL_bounded_reachability eliminates every trace of nondeterminism from the membership condition, and mem_iff_exists_accepting_reachable states it as bare reachability: x is in the language exactly when some accepting configuration is reachable from the initial one.

The search half is programmed, not assembled. Cobham's theorem (CobhamFP_eq_FP) says a function is polynomial-time exactly when it belongs to the machine-independent algebra, so the search is built by composing polynomial-time functions:

Internal.NLSearchAssemble runs the search for as many steps as there are configurations and turns the verdict into P membership with mem_P_of_decisionFn.

An earlier plan routed the search through Complexitylib.Models.RandomAccessMachine instead. That still needs a compiler from RAM programs back to Turing machines, which the library does not have; the algebra needs no such bridge.

Main results #

NL ⊆ P: reachability in the polynomially sized configuration graph of a logspace-bounded machine is decidable in polynomial time.

Equations
Instances For
    theorem Complexity.NL_bounded_reachability {L : Language} (hL : L NL) :
    ∃ (k : ) (tm : NTM k) (A : ) (B : ), ∀ (x : List Bool), x L ctm.reachSet (tm.initCfg x) (A * (x.length + 1) ^ B), tm.halted c c.output.cells 1 = Γ.one

    A language in NL is a polynomially bounded reachability search. There is a machine whose configuration graph decides membership: x is in the language exactly when an accepting configuration turns up within A · (|x| + 1) ^ B rounds of successor-closure from the initial configuration. Nondeterminism, choice sequences, time bounds, and asymptotic quantifiers have all been discharged; only the search remains.

    NL ⊆ P: the configuration graph of a log-space nondeterministic machine has polynomially many nodes, and a worklist search walks all of it in polynomial time. The search is programmed rather than assembled: Cobham's theorem (CobhamFP_eq_FP) makes membership in FP a matter of composing polynomial-time functions, Cobham.stepFn supplies the encoded machine step, and Cobham.iterate_mem_FP supplies the loops.

    coNL ⊆ P: P is closed under complement, so the containment passes to the complementary class — with no appeal to the Immerman–Szelepcsényi theorem.