Documentation

Complexity.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 tidily computable in polynomial time on unary numbers (Cslib.Complexity.Ladner.computableTidilyInPolyTime_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.computableTidilyInPolyTime_capPow), the universal function with its number of steps in unary (Turing.MultiTapeTM.Universal.computableTidilyInPolyTime_universal), and the words by index (Cslib.Complexity.Ladner.computableTidilyInPolyTime_word). Decoding machine descriptions and coding their input bits use the shared polynomial-time rules in Complexity.Computability.Machines.Turing.MultiTape.Universal.PolyTime.

Main definitions #

Main results #

References #

Decoding formulas #

The formula decoded from a word.

Instances For

    Capped powers #

    The power b ^ e, capped at c.

    Instances For

      Words by index #

      Reading a padded formula #

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

      Instances For

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

        Instances For

          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 φ.

          Instances 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.

            Instances For
              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.

              Instances For
                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.

                Instances For

                  The search computes the step.

                  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.

                  Instances For

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