Documentation

Complexitylib.Classes.PCP.Internal.AlgInit

The starting graph, written out #

BaseAlg reads the starting graph's numbers straight off a formula, which is all a verifier needs. Amplification needs more: the graph itself, as a string the round function can consume. This module writes it, reusing that module's readers.

An edge's constraint depends on the formula only through the three signs of its clause and which of the three positions the edge checks — twelve bits in all. That is what baseCodeKey extracts and relOfSigns turns back into a constraint, so the constraint's code is written by a table lookup.

Main definitions #

Main results #

The constraint, from the signs alone #

noncomputable def Complexity.relOfSigns (s : Fin 3Bool) (p : Fin 3) :

The constraint of an edge that checks position p of a clause whose three literals have signs s: both endpoints name triples in the image of the alphabet embedding, the first satisfies the clause, and the two agree on the checked position.

Equations
Instances For
    theorem Complexity.rel_baseCSP (φ : SAT.CNF) (e : ) (he : e < (baseCSP φ).numEdges) :
    (baseCSP φ).rel e, he = relOfSigns (fun (q : Fin 3) => (ThreeSATCSP.litOf φ (e / 3) q).sign) e % 3,

    The constraint depends only on the signs.

    The key #

    noncomputable def Complexity.baseCodeKey (E : List BoolList Bool) (w : List Bool) :

    The data an edge's constraint depends on: the clause's three signs and which of them the edge reads.

    Equations
    Instances For
      theorem Complexity.baseCodeKey_pair (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) {e : } (he : e < 3 * List.length (Φ x)) :
      baseCodeKey E (pair x (List.replicate e true)) = pair [(ThreeSATCSP.litOf (Φ x) (e / 3) 0).sign, (ThreeSATCSP.litOf (Φ x) (e / 3) 1).sign, (ThreeSATCSP.litOf (Φ x) (e / 3) 2).sign] (List.replicate (e % 3) true)

      The constraint's code, from the key #

      noncomputable def Complexity.baseRelOfKey (k : List Bool) :

      The constraint an edge's key stands for.

      Equations
      Instances For
        noncomputable def Complexity.baseCodeFn (k : List Bool) :

        The constraint's code, in unary, from the key.

        Equations
        Instances For
          theorem Complexity.relOfSigns_congr {s t : Fin 3Bool} {m n : } (hm : m < 3) (hn : n < 3) (hs : s = t) (h : m = n) :
          theorem Complexity.baseCodeFn_codeKey (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) (e : ) (he : e < (baseCSP (Φ x)).numEdges) :

          The counts #

          noncomputable def Complexity.baseVertsU (E : List BoolList Bool) (z : List Bool) :

          The number of vertices, in unary: one per variable, one per clause.

          Equations
          Instances For
            theorem Complexity.baseVertsU_eq (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) :
            theorem Complexity.baseEdgesU_count (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (x : List Bool) :

            The endpoints #

            theorem Complexity.baseTailU_val (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) (e : ) (he : e < (baseCSP (Φ x)).numEdges) :
            (baseTailU E (pair x (List.replicate e true))).length = ((baseCSP (Φ x)).tail e, he)
            theorem Complexity.baseHeadU_val (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) (e : ) (he : e < (baseCSP (Φ x)).numEdges) :
            (baseHeadU E (pair x (List.replicate e true))).length = ((baseCSP (Φ x)).head e, he)

            The graph #

            noncomputable def Complexity.baseGraphFn (E g : List BoolList Bool) :

            The starting graph, as a string.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem Complexity.baseGraphFn_eq (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) :

              The rule writes the starting graph.

              Padded to a fixed size #

              The base graph always has a vertex.

              noncomputable def Complexity.trivCode :

              The code of the constraint that is always true, in unary.

              Equations
              Instances For
                noncomputable def Complexity.basePadFn (E padU g : List BoolList Bool) :

                The starting graph, padded: the edge count is whatever padU says, so it can be made to depend on the input's length alone.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem Complexity.basePadFn_mem_FP (E : List BoolList Bool) {padU : List BoolList Bool} (hE : E FP) (hP : padU FP) (g : List BoolList Bool) :
                  basePadFn E padU g FP
                  theorem Complexity.basePadFn_eq (E : List BoolList Bool) {Φ : List BoolSAT.CNF} {padU : List BoolList Bool} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) (hPmark : padU x = List.replicate (padU x).length true) (hPle : 3 * List.length (Φ x) (padU x).length) :
                  basePadFn E padU baseCodeFn x = encGraph ((baseCSP (Φ x)).padGraph (padU x).length)

                  The rule writes the padded starting graph.