Documentation

Complexitylib.Classes.PCP.Internal.Materialize

Writing out a table #

Every stage of an algorithmic reduction writes a list: the edges of a graph, the entries of a rotation table, the records of a gadget. ListEncode runs the loop that does it, but asks for a bound on the loop's own state; this module discharges that bound from the rule alone, since a polynomial-time rule has polynomially bounded output and the loop runs no more often than its argument is long.

Main results #

A record rule materializes a list in polynomial time. No bound need be supplied: a polynomial-time rule already has polynomially bounded output, and the loop runs only as many times as its own argument is long.

The list encoder writes the list.

Adding up #

theorem Complexity.length_entryCat (E : List BoolList Bool) (x : List Bool) (n : ) :
(entryCat E x n).length = iFinset.range n, (E (pair x (List.replicate i true))).length
noncomputable def Complexity.countOver (E : List BoolList Bool) (z : List Bool) :

The total length of a rule's outputs over a range, in unary. Running the rule for its length alone is how a loop counts: a rule that answers [true] or [] counts the indices where it says yes.

Equations
Instances For

    Comparing #

    noncomputable def Complexity.ifEqLen (a b x y : List Bool) :

    x when the two strings have the same length, y otherwise.

    Equations
    Instances For
      theorem Complexity.ifEqLen_pos {a b : List Bool} (h : a.length = b.length) (x y : List Bool) :
      ifEqLen a b x y = x
      theorem Complexity.ifEqLen_neg {a b : List Bool} (h : a.length b.length) (x y : List Bool) :
      ifEqLen a b x y = y
      theorem Complexity.ifEqLen_mem_FP {a b x y : List BoolList Bool} (ha : a FP) (hb : b FP) (hx : x FP) (hy : y FP) :
      (fun (z : List Bool) => ifEqLen (a z) (b z) (x z) (y z)) FP
      noncomputable def Complexity.ifLtLen (a b x y : List Bool) :

      x when the first string is shorter than the second, y otherwise.

      Equations
      Instances For
        theorem Complexity.ifLtLen_pos {a b : List Bool} (h : a.length < b.length) (x y : List Bool) :
        ifLtLen a b x y = x
        theorem Complexity.ifLtLen_neg {a b : List Bool} (h : ¬a.length < b.length) (x y : List Bool) :
        ifLtLen a b x y = y
        theorem Complexity.ifLtLen_mem_FP {a b x y : List BoolList Bool} (ha : a FP) (hb : b FP) (hx : x FP) (hy : y FP) :
        (fun (z : List Bool) => ifLtLen (a z) (b z) (x z) (y z)) FP

        The count is written in marks.

        Searching #

        noncomputable def Complexity.isEmptyMark (s : List Bool) :

        One mark when the string is empty, none otherwise.

        Equations
        Instances For
          @[simp]
          theorem Complexity.isEmptyMark_mem_FP {f : List BoolList Bool} (hf : f FP) :
          (fun (z : List Bool) => isEmptyMark (f z)) FP
          noncomputable def Complexity.findFirst (E : List BoolList Bool) (z : List Bool) :

          The least index below the bound at which the rule answers something, or the bound itself when it never does: count the indices no answer has been seen up to.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            The search's answer is written in marks.

            theorem Complexity.length_findFirst (E : List BoolList Bool) (x : List Bool) (n : ) :
            (findFirst E (pair (List.replicate n true) x)).length = jFinset.range n, if kFinset.range (j + 1), (E (pair x (List.replicate k true))).length = 0 then 1 else 0
            theorem Complexity.length_findFirst_eq {E : List BoolList Bool} {x : List Bool} {n c : } (hc : c < n) (hhit : (E (pair x (List.replicate c true))).length 0) (hmin : k < c, (E (pair x (List.replicate k true))).length = 0) :

            The search returns the least index the rule answers at.