Documentation

CslibFrontier.Computability.Complexity.Classes.Ladner.Basic

The padded satisfiability problem of Ladner's theorem #

Ladner's theorem is proved by padding satisfiable formulas with a number of ones growing slowly but, unless P = NP, faster than any polynomial Arora and Barak, Theorem 3.3. Along an exponent function e, a formula φ whose encoding has length m is padded to the word pad (encCNF φ) (m ^ e m): the encoding followed by false and m ^ e m ones (Cslib.Complexity.Ladner.padSAT). Ladner's language Cslib.Complexity.Ladner.SATH takes the exponent Cslib.Complexity.Ladner.H defined here.

H n is the least index i < log₂ (log₂ n) of a machine agreeing with the language itself on the words with indices below n, or log₂ (log₂ n) if there is none. Words are indexed by ℕ (Cslib.Complexity.Ladner.word); the words with indices below n have length at most log₂ n and include every word whose length l satisfies 2 ^ (l + 1) ≤ n + 1. The machine with index i is the one described at the start of the i-th word (Turing.MultiTapeTM.Universal.decodeDesc), run by the universal function, so every machine has arbitrarily large indices. On a word of length l it is allowed (2 * l + 2) ^ i steps, a clock exceeding every polynomial time bound at large enough indices, but never more than n. Arora and Barak allow i * l ^ i steps and estimate the cost; capping the clock at n keeps the computation of H n polynomial in n without any asymptotic estimate, and for every fixed machine and word the cap stops mattering once n is large.

Whether a word with index below n belongs to the language depends only on the values H m with m < n. H is therefore defined by recursion on tables of its earlier values (Cslib.Complexity.Ladner.Hstep, Cslib.Complexity.Ladner.Htable), and characterised by Cslib.Complexity.Ladner.H_le_of_agrees and Cslib.Complexity.Ladner.agrees_H.

Main definitions #

Main results #

References #

Words by index #

The word with index j: the binary digits of j + 1, least significant first, without the final true.

The index of a word: one less than the number whose binary digits are the word followed by true.

@[simp]

Every word has an index.

The index of a word of length l is less than 2 ^ (l + 1) - 1.

The word with index j has length at most log₂ (j + 1).

The word with index j is shorter than j + 1.

@[simp]

The index of the word with index j is j. The binary digits of j + 1 end with true: otherwise the word with index j would itself be the binary digits of j + 1, of length at most log₂ (j + 1).

Padding #

The word u padded with k ones after a separating zero.

Splits a word at its last false: the word before it and the number of trues after it. If the word has no false, the second component is its length.

@[simp]
theorem Cslib.Complexity.Ladner.length_pad (u : List Bool) (k : ℕ) :
(pad u k).length = u.length + 1 + k
@[simp]

Padding is undone.

theorem Cslib.Complexity.Ladner.pad_inj {u u' : List Bool} {k k' : ℕ} :
pad u k = pad u' k' ↔ u = u' ∧ k = k'
theorem Cslib.Complexity.Ladner.pad_unpad {y : List Bool} (hy : (unpad y).2 < y.length) :
pad (unpad y).1 (unpad y).2 = y

A word with a false is its padded split.

Padded satisfiability #

Satisfiable formulas padded along an exponent function. A formula φ whose encoding has length m is padded with m ^ e m ones.

theorem Cslib.Complexity.Ladner.mem_padSAT_congr {e e' : ℕ → ℕ} {y : List Bool} (h : ∀ m < y.length, e m = e' m) :

Membership of y depends only on the exponents of lengths below the length of y.

The indexed machines #

The run of the machine with index i on w for t steps: the universal function on the description at the start of the i-th word, and w under the coding false ↦ 0, true ↦ 1.

A finite binary machine halting within time t x with output f x, simulated by the universal function on its description for at least t x steps, halts with output (f x).map eBit.

A finite binary machine halting within time t x with output [f x], simulated by the universal function on its description for at least t x steps, halts with output [eBit (f x)].

Every description is the description of machines with arbitrarily large indices.

theorem Cslib.Complexity.Ladner.exists_index_runIndexed_eq {k : ℕ} {State : Type} [Finite State] (tm : Turing.MultiTapeTM k Bool State) {f : List Bool → Bool} {t : List Bool → ℕ} (h : ∀ (x : List Bool), (Turing.MultiTapeTM.runFrom (tm.initCfg x) (t x)).Halted ∧ (Turing.MultiTapeTM.runFrom (tm.initCfg x) (t x)).output = [f x]) (B : ℕ) :
∃ (i : ℕ), B ≤ i ∧ ∀ (x : List Bool) (T : ℕ), t x ≤ T → runIndexed i x T = ([Turing.MultiTapeTM.Universal.eBit (f x)], true)

A decider is run by machines with arbitrarily large indices. A finite binary machine halting within time t x with output [f x] is described at some index i ≥ B, which halts on x with output [eBit (f x)] when allowed at least t x steps.

The clock of the machine with index i on inputs of length l.

theorem Cslib.Complexity.Ladner.le_clock {c e i : ℕ} (h : c + e ≤ i) (l : ℕ) :
c * (l + 1) ^ e ≤ clock i l

For c + e ≤ i, clock i l dominates c * (l + 1) ^ e.

theorem Cslib.Complexity.Ladner.clock_le_two_pow (i l : ℕ) :
clock i l ≤ 2 ^ ((l + 1) * i)

clock i l is at most 2 ^ ((l + 1) * i).

def Cslib.Complexity.Ladner.Agrees (e : ℕ → ℕ) (cap i j : ℕ) :

The machine with index i, allowed clock i l steps on a word of length l but never more than cap, halts on the j-th word with output [b] where b decides membership in padSAT e.

theorem Cslib.Complexity.Ladner.agrees_congr {e e' : ℕ → ℕ} {cap i j : ℕ} (h : ∀ m < j, e m = e' m) :
Agrees e cap i j ↔ Agrees e' cap i j

Agreement on the j-th word depends only on the exponents of lengths below j.

The exponent function #

noncomputable def Cslib.Complexity.Ladner.Hstep (T : List ℕ) :

The value of the exponent at T.length from the table T of its earlier values: the least index below log₂ (log₂ T.length) of a machine agreeing with padSAT on the words with indices below T.length, or log₂ (log₂ T.length). The clocks are capped at T.length.

The table of the first n values of the exponent function.

noncomputable def Cslib.Complexity.Ladner.H (n : ℕ) :

The exponent function of Ladner's language.

Ladner's language: satisfiable formulas padded along H.

The tables hold the values of H.

theorem Cslib.Complexity.Ladner.agrees_Htable_iff {n i j : ℕ} (hj : j < n) :
Agrees (fun (m : ℕ) => (Htable n).getD m 0) n i j ↔ Agrees H n i j
theorem Cslib.Complexity.Ladner.H_eq (n : ℕ) :
H n = sInf {i : ℕ | i = Nat.log 2 (Nat.log 2 n) ∨ ∀ j < n, Agrees H n i j}

H grows slowly: H n ≤ log₂ (log₂ n).

theorem Cslib.Complexity.Ladner.H_le_of_agrees {n i : ℕ} (h : ∀ j < n, Agrees H n i j) :
H n ≤ i

H n is at most the index of every machine agreeing with SATH below n.

theorem Cslib.Complexity.Ladner.agrees_H {n : ℕ} (h : H n < Nat.log 2 (Nat.log 2 n)) (j : ℕ) :
j < n → Agrees H n (H n) j

If H n < log₂ (log₂ n), the machine with index H n agrees with SATH below n.