Documentation

Complexitylib.Classes.PCP.Internal.BaseAlg

The base graph, as an algorithm sees it #

The constraint graph of a 3CNF formula has three edges per clause, a vertex per variable and a vertex per clause. This module computes those numbers and those endpoints from the formula's encoding, in polynomial time.

The vertex numbering puts variables first, so a clause vertex sits at maxVar + 1 + j; both quantities are read off the encoding by the loops of MaxLoop and the parser.

Main definitions #

Main results #

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

The number of edges, in unary: three per clause.

Equations
Instances For
    theorem Complexity.baseEdgesU_eq (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE : ∀ (x : List Bool), E x = (Φ x).encode) (x : List Bool) :
    noncomputable def Complexity.baseMaxU (E : List BoolList Bool) (z : List Bool) :

    The largest variable index, in unary.

    Equations
    Instances For
      theorem Complexity.baseMaxU_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) :
      (baseMaxU E x).length = (Φ x).maxVar
      noncomputable def Complexity.baseTailU (E : List BoolList Bool) (w : List Bool) :

      The unary form of the first endpoint: the clause vertex.

      Equations
      Instances For
        noncomputable def Complexity.baseHeadU (E : List BoolList Bool) (w : List Bool) :

        The unary form of the second endpoint: the variable vertex.

        Equations
        Instances For

          What the endpoints compute #

          theorem Complexity.baseTailU_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) (e : ) :
          (baseTailU E (pair x (List.replicate e true))).length = (Φ x).maxVar + 1 + e / 3
          theorem Complexity.baseHeadU_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) {e : } (he : e < 3 * List.length (Φ x)) :
          (baseHeadU E (pair x (List.replicate e true))).length = (ThreeSATCSP.litOf (Φ x) (e / 3) e % 3, ).var

          The key the constraint looks at #

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

          The three literal signs of the clause an edge belongs to.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            noncomputable def Complexity.baseKey (E : List BoolList Bool) (w : ) (z : List Bool) :

            Everything the constraint depends on: the clause's signs, the position inside the clause, and the two symbol blocks.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem Complexity.baseKey_mem_FP (E : List BoolList Bool) (hE : E FP) (w : ) :
              theorem Complexity.length_baseKey_le (E : List BoolList Bool) (w : ) (z : List Bool) :
              (baseKey E w z).length 2 * w + 22

              The constraint #

              noncomputable def Complexity.baseOkKey (w : ) (k : List Bool) :

              What the constraint says, as a predicate of the key alone: the two blocks name symbols in the image of the alphabet embedding whose preimages satisfy the clause and agree on the checked position.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                noncomputable def Complexity.baseOk (E : List BoolList Bool) (w : ) :

                The constraint, as a language on the verifier's verdict argument.

                Equations
                Instances For
                  theorem Complexity.baseOk_mem_P (E : List BoolList Bool) (hE : E FP) (w : ) :

                  The record #

                  noncomputable def Complexity.baseAlg (E : List BoolList Bool) (hE : E FP) :

                  The base graph as an algorithm.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[simp]
                    theorem Complexity.numEdges_baseAlg (E : List BoolList Bool) (hE : E FP) (x : List Bool) :
                    @[simp]
                    theorem Complexity.width_baseAlg (E : List BoolList Bool) (hE : E FP) :
                    (baseAlg E hE).width = 23
                    theorem Complexity.vert_baseAlg_false (E : List BoolList Bool) (hE : E FP) (x : List Bool) (e : ) :
                    theorem Complexity.vert_baseAlg_true (E : List BoolList Bool) (hE : E FP) (x : List Bool) (e : ) :
                    @[simp]
                    theorem Complexity.ok_baseAlg (E : List BoolList Bool) (hE : E FP) :
                    (baseAlg E hE).ok = baseOk E 23

                    The symbol codec fits #

                    The sign flag #

                    theorem Complexity.litOf_eq (φ : SAT.CNF) {j : } (hj : j < List.length φ) (p : Fin 3) (hq : p < List.length φ[j]) :
                    ThreeSATCSP.litOf φ j p = φ[j][p]

                    Agreement with the real graph #

                    theorem Complexity.baseAlg_numEdges_eq (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE' : E FP) (hE : ∀ (x : List Bool), E x = (Φ x).encode) (x : List Bool) :
                    (baseAlg E hE').numEdges x = (baseCSP (Φ x)).numEdges
                    theorem Complexity.baseAlg_tail_eq (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE' : E FP) (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) (e : ) (he : e < (baseCSP (Φ x)).numEdges) :
                    (baseAlg E hE').vert false x e = ((baseCSP (Φ x)).tail e, he)
                    theorem Complexity.baseAlg_head_eq (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE' : E FP) (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) (e : ) (he : e < (baseCSP (Φ x)).numEdges) :
                    (baseAlg E hE').vert true x e = ((baseCSP (Φ x)).head e, he)

                    The key on a well-formed argument #

                    theorem Complexity.baseSigns_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)) (a : List Bool) :
                    baseSigns E (pair (pair x (List.replicate e true)) a) = [(ThreeSATCSP.litOf (Φ x) (e / 3) 0).sign, (ThreeSATCSP.litOf (Φ x) (e / 3) 1).sign, (ThreeSATCSP.litOf (Φ x) (e / 3) 2).sign]
                    theorem Complexity.baseKey_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)) {a : List Bool} (ha : a.length = 46) :
                    baseKey E 23 (pair (pair x (List.replicate e true)) a) = pair (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)) a

                    The constraint agrees #

                    theorem Complexity.baseAlg_ok_iff (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE' : E FP) (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) (x : List Bool) (e : ) (he : e < (baseCSP (Φ x)).numEdges) (u v : List Bool) (hu : u.length = 23) (hv : v.length = 23) :
                    theorem Complexity.baseAlg_models (E : List BoolList Bool) {Φ : List BoolSAT.CNF} (hE' : E FP) (hE : ∀ (x : List Bool), E x = (Φ x).encode) (h3 : ∀ (x : List Bool), (Φ x).Is3CNF) :
                    (baseAlg E hE').Models (fun (x : List Bool) => baseCSP (Φ x)) (symEnc GapAlpha 23) (symDec GapAlpha)

                    The base graph is modelled faithfully.