Documentation

CslibFrontier.Computability.Complexity.Classes.Ladner.PolyTime

Ladner's language in polynomial time and in NP #

The exponent function Cslib.Complexity.Ladner.H of Ladner's language is computable in polynomial time on unary numbers (Cslib.Complexity.Ladner.computableInPolyTime_H), and Ladner's language is in NP (Cslib.Complexity.Ladner.SATH_mem_NP), with a verifier that reads the padded formula and evaluates it under the assignment the certificate describes.

The table of the values H m, m < n, is built by iterating one step n times. The step (Cslib.Complexity.Ladner.hstepB, equal to Cslib.Complexity.Ladner.Hstep) searches the first log₂ (log₂ n) machine indices; for each, it runs the machine on each of the n words with indices below n with the universal function, for at most n steps, and compares the answer with membership in the padded language along the table. A word with index below n has length at most log₂ n, so membership is decided by decoding the padded formula and trying the n words with indices below n as certificates (Cslib.Complexity.Ladner.bruteSAT_iff). Every intermediate value is polynomial in n, and the polynomial-time calculus certifies the composite.

The certificate rests on general tools: a total decoder for formulas (Cslib.Complexity.cnfDecoder, built from Turing.MultiTapeTM.Decoder.nat and Turing.MultiTapeTM.Decoder.bool), capped powers on unary numbers (Cslib.Complexity.Ladner.computableInPolyTime_capPow), the universal function with its number of steps in unary (Turing.MultiTapeTM.Universal.computableInPolyTime_universal), and the words by index (Cslib.Complexity.Ladner.computableInPolyTime_word). Decoding machine descriptions and coding their input bits use the shared polynomial-time rules in CslibFrontier.Computability.Machines.Turing.MultiTape.Universal.PolyTime.

Main definitions #

Main results #

References #

Decoding formulas #

The formula decoded from a word.

Capped powers #

The power b ^ e, capped at c.

Words by index #

Reading a padded formula #

The formula φ such that y is encCNF φ padded with (encCNF φ).length ^ h ones, if there is one.

The formula padded in y along the exponent function e, if any.

Membership in a padded language through padCheck.

Reading the formula padded along a computed exponent function is polynomial-time. The exponent function may capture the input.

Satisfiability of short formulas #

Whether one of the words with indices below n is a satisfying certificate for φ.

theorem Cslib.Complexity.Ladner.bruteSAT_iff {n : ℕ} {φ : Logic.PL.CNF ℕ} (h : 2 ^ ((encCNF φ).length + 1) ≤ n + 1) :

Short formulas are decided by trying the words with small indices: every certificate of the length of the encoded formula has a smaller index than n.

The step of the exponent function #

Membership in the padded language along the table T, decided by bruteSAT with the words with indices below the length of T.

theorem Cslib.Complexity.Ladner.memB_word_iff {T : List ℕ} {j : ℕ} (hj : j < T.length) :
memB T (word j) = true ↔ word j ∈ padSAT fun (m : ℕ) => T.getD m 0

The test of Cslib.Complexity.Ladner.Agrees along the table T, as a Boolean.

theorem Cslib.Complexity.Ladner.agreesB_iff {T : List ℕ} {i j : ℕ} (hj : j < T.length) :
agreesB T i j = true ↔ Agrees (fun (m : ℕ) => T.getD m 0) T.length i j

The step of the exponent function as a search over machine indices and words.

The search computes the step.

The run of an indexed machine, with the number of steps in unary, is polynomial-time.

The exponent function #

Ladner's language is in NP #

The verifier of Ladner's language: read the padded formula and evaluate it under the assignment the certificate describes.

Padding a certificate with false does not change the assignment it describes.

Ladner's language is in NP, with the verifier evaluating the padded formula.

Machines deciding problems in P #

theorem Cslib.Complexity.Ladner.exists_index_of_mem_P {A : Set (List Bool)} (h : A ∈ P Turing.MultiTapeTM.encBits) (B : ℕ) :
∃ (f : List Bool → Bool), (∀ (w : List Bool), w ∈ A ↔ f w = true) ∧ ∃ (i : ℕ), B ≤ i ∧ ∀ (w : List Bool), runIndexed i w (clock i w.length) = ([Turing.MultiTapeTM.Universal.eBit (f w)], true)

A problem in P is decided by machines with large indices and large clocks. It is decided by a Boolean function f, and machines of arbitrarily large index output [f w] on each word w within their clock.