Documentation

Complexitylib.Classes.Containments.Internal.LogSpaceBound

The configuration graph of a log-space machine is polynomially sized #

⚠️ Unreviewed by Bolton

A machine using O(log n) space has only polynomially many configurations: each of the 4 ^ O(log n) tape contents is n ^ O(1), and the head positions contribute a further polynomial factor. This is what turns the graph reachability of Complexitylib.Classes.Containments.Internal.ConfigGraph into a polynomial-time search.

Main results #

theorem Complexity.exists_log_bound {f : } (hf : BigO f fun (n : ) => Nat.log 2 n) :
∃ (C : ) (D : ), ∀ (n : ), f n C * Nat.log 2 n + D

An asymptotic logarithmic bound becomes an everywhere bound after adding a constant: the finitely many exceptional inputs are absorbed into it.

theorem Complexity.four_pow_log_le (C D n : ) :
4 ^ (C * Nat.log 2 n + D) 4 ^ D * (n + 1) ^ (2 * C)

Four to a logarithmic power is polynomial.

Bounded by a constant times a power of n + 1.

Equations
Instances For
    theorem Complexity.PolyBounded.mono {g h : } (hg : PolyBounded g) (hle : ∀ (n : ), h n g n) :

    Transfer along a pointwise bound.

    theorem Complexity.PolyBounded.mul {g h : } (hg : PolyBounded g) (hh : PolyBounded h) :
    PolyBounded fun (n : ) => g n * h n
    theorem Complexity.PolyBounded.add {g h : } (hg : PolyBounded g) (hh : PolyBounded h) :
    PolyBounded fun (n : ) => g n + h n
    theorem Complexity.PolyBounded.pow {g : } (hg : PolyBounded g) (m : ) :
    PolyBounded fun (n : ) => g n ^ m
    theorem Complexity.PolyBounded.of_log {f : } (hf : BigO f fun (n : ) => Nat.log 2 n) :

    A log-space bound is polynomially bounded, as is four to its power.

    theorem Complexity.PolyBounded.four_pow {f : } (hf : BigO f fun (n : ) => Nat.log 2 n) (m : ) :
    PolyBounded fun (n : ) => 4 ^ (f n + m)
    theorem Complexity.exists_config_bound {k : } (Q : Type) [Fintype Q] {f : } (hf : BigO f fun (n : ) => Nat.log 2 n) :
    PolyBounded fun (n : ) => Fintype.card (Code Q k n (f n))

    The configuration count of a log-space machine is polynomial.