Documentation

Complexitylib.Classes.PCP.Internal.PCPtoSAT

A PCP verifier as a CNF formula #

SubsetNP reduces "some proof is accepted on every coin string" to "some bitstring is a witness": a table, laid out one block of Q answers per coin string, that is consistent and accepted everywhere. Both conditions are predicates on individual bits of that bitstring, so both are CNF clauses.

That is what this module builds. The formula's variables are the positions of the witness — a SAT assignment and a witness are the same object, since both read out of range as false — so the encoding needs no translation of models.

With r coins and q queries the formula has 2^r q variables and O(4^r q^2 + 2^r 2^q) clauses — polynomial when r is logarithmic and q constant.

Main definitions #

Main results #

Enumerating bit vectors #

Every bit vector of a given length.

Equations
Instances For

    Variables #

    def Complexity.PCPVerifier.varIdx (t Q : ) (ρ : Fin tBool) (i : ) :

    The variable holding the answer to query i on coin string ρ. The blocks sit a stride Q apart, exactly as SubsetNP.tableOf reads them.

    Equations
    Instances For
      theorem Complexity.PCPVerifier.get_varIdx (V : PCPVerifier) (t Q : ) (x w : List Bool) (ρ : Fin tBool) {i : } (hi : i < (V.positions x (BitString.toList ρ)).length) :
      (V.tableOf t Q x w ρ)[i]? = some (SAT.Assignment.get w (varIdx t Q ρ i))

      The clauses #

      The coin strings, listed by index. Computable, unlike an enumeration drawn from Finset.univ, because the reduction has to be carried out by a machine.

      Equations
      Instances For

        Two query slots reading the same proof position must get the same answer.

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

          For each coin string, a clause blocking every answer vector the verdict rejects. The verdict arrives as a Boolean function, which is the form a polynomial-time decision procedure takes.

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

            The formula of a verifier on an input.

            Equations
            Instances For

              Semantics of the consistency clauses #

              theorem Complexity.PCPVerifier.eval_consClauses_iff (V : PCPVerifier) (t Q : ) (x w : List Bool) :
              SAT.CNF.eval w (V.consClauses t Q x) = true ∀ (ρ ρ' : Fin tBool) (i i' : ), i < (V.positions x (BitString.toList ρ)).lengthi' < (V.positions x (BitString.toList ρ')).length(V.positions x (BitString.toList ρ))[i]? = (V.positions x (BitString.toList ρ'))[i']?SAT.Assignment.get w (varIdx t Q ρ i) = SAT.Assignment.get w (varIdx t Q ρ' i')

              Semantics of the acceptance clauses #

              theorem Complexity.PCPVerifier.tableOf_getD (V : PCPVerifier) (t Q : ) (x w : List Bool) (ρ : Fin tBool) {i : } (hi : i < (V.positions x (BitString.toList ρ)).length) :
              (V.tableOf t Q x w ρ).getD i false = SAT.Assignment.get w (varIdx t Q ρ i)
              theorem Complexity.PCPVerifier.eval_acceptClauses_iff (V : PCPVerifier) {g : List BoolBool} (hg : ∀ (z : List Bool), g z = true z V.verdict) (t Q : ) (x w : List Bool) :
              SAT.CNF.eval w (V.acceptClauses g t Q x) = true ∀ (ρ : Fin tBool), pair (pair x (BitString.toList ρ)) (V.tableOf t Q x w ρ) V.verdict

              The formula is equivalent to the witness relation #

              theorem Complexity.PCPVerifier.eval_toCNF_iff (V : PCPVerifier) {g : List BoolBool} (hg : ∀ (z : List Bool), g z = true z V.verdict) (t Q : ) (x w : List Bool) :
              SAT.CNF.eval w (V.toCNF g t Q x) = true V.Witness t Q x w

              A satisfying assignment is exactly a witness.

              theorem Complexity.PCPVerifier.satisfiable_toCNF_iff (V : PCPVerifier) {g : List BoolBool} (hg : ∀ (z : List Bool), g z = true z V.verdict) (t Q : ) (x : List Bool) :
              (V.toCNF g t Q x).Satisfiable ∃ (w : List Bool), V.Witness t Q x w

              The formula is satisfiable exactly when a proof exists.

              The reduction, at the level of membership #

              The query budget used for a given input: one more than the bound, so that the stride is positive even when the verifier makes no queries.

              Equations
              Instances For
                theorem Complexity.PCPVerifier.satisfiable_toCNF_iff_exists_proof (V : PCPVerifier) {g : List BoolBool} (hg : ∀ (z : List Bool), g z = true z V.verdict) {q : } (hq : V.QueryBounded q) (t : ) (x : List Bool) :
                (V.toCNF g t (budget q x) x).Satisfiable ∃ (π : List Bool), ∀ (ρ : Fin tBool), V.Accepts x π (BitString.toList ρ)

                The encoded formula tracks membership. For an input on which the verifier is either certainly accepted or accepted with probability at most a half, the formula is satisfiable exactly when some proof is always accepted.

                theorem Complexity.PCPVerifier.mem_language_toCNF_iff (V : PCPVerifier) {L : Language} {g : List BoolBool} (hg : ∀ (z : List Bool), g z = true z V.verdict) {q : } {t : } (hq : V.QueryBounded q) (hcomp : xL, ∃ (π : List Bool), eventProb (V.acceptEvent t x π) = 1) (hsound : xL, ∀ (π : List Bool), eventProb (V.acceptEvent t x π) 1 / 2) (x : List Bool) :
                x L (V.toCNF g t (budget q x) x).encode SAT.language

                The reduction is correct. If L is decided by the verifier with t coins in the sense of PCP, then membership in L is membership of the encoded formula in SAT.