Documentation

ArkLib.ProofSystem.Sumcheck.Basic

The Sum-check Protocol #

We define the sum-check protocol as a series of Interactive Oracle Reductions (IORs), where the underlying polynomials are represented using Mathlib's noncomputable types Polynomial and MvPolynomial.

Other files will deal with implementations of the protocol, and we will prove that those implementations derive security from that of the abstract protocol.

Protocol Specification #

The sum-check protocol is parameterized by the following:

The sum-check relation has no witness. The statement for the i-th round, where i : Fin (n + 2), contains:

There is a single oracle statement, which is:

The sum-check relation for the i-th round checks that:

∑ x ∈ (univ.map D) ^ᶠ (n + 1 - i), poly ⸨challenges, x⸩ = target.

Note that the last statement (when i = n) is the output statement of the sum-check protocol.

For i = 0, ..., n, the i-th round of the sum-check protocol consists of the following:

  1. The prover sends a univariate polynomial pᵢ ∈ R⦃≤ deg⦄[X] of degree at most deg. If the prover is honest, then we have:

    pᵢ(X) = ∑ x ∈ (univ.map D) ^ᶠ (n - i), poly ⸨X ⦃i⦄, challenges, x⸩.

Here, poly ⸨X ⦃i⦄, challenges, x⸩ is the polynomial poly evaluated at the concatenation of the prior challenges challenges, the i-th variable as the new indeterminate X, and the rest of the values x ∈ (univ.map D) ^ᶠ (n - i).

In the oracle protocol, this polynomial pᵢ is turned into an oracle for which the verifier can query for evaluations at arbitrary points.

  1. The verifier then sends the i-th challenge rᵢ sampled uniformly at random from R.

  2. The (oracle) verifier then performs queries for the evaluations of pᵢ at all points in (univ.map D), and checks that: ∑ x in (univ.map D), pᵢ.eval x = target.

    If the check fails, then the verifier outputs failure.

    Otherwise, it outputs a statement for the next round as follows:

    • target is updated to pᵢ.eval rᵢ
    • challenges is updated to the concatenation of the previous challenges and rᵢ

Notes & TODOs #

An annoying issue is that we need to index over i : Fin (n + 2), not i : Fin (n + 1). This is because existing Fin functions works better with n + 1 which is clearly positive, and not i : Fin (n + 1) (which would imply n > 0, but this fact is not apparent).

Note that to represent sum-check as a series of IORs, we will need to implicitly constrain the degree of the polynomials via using subtypes, such as Polynomial.degreeLE and MvPolynomial.degreeOf. This is because the oracle verifier only gets oracle access to evaluating the polynomials, but does not see the polynomials in the clear.

When this is compiled to an interactive proof, the corresponding polynomial commitment schemes will enforce that the declared degree bound holds, via letting the (non-oracle) verifier perform explicit degree checks.

There are some generalizations that we could consider later:

References #

[JACM:LFKN92]

[C:BooChiSot21]

theorem Sumcheck.PMF.bind_eq_zero {α β : Type u_1} {p : PMF α} {f : αPMF β} {b : β} :
(p >>= f) b = 0 ∀ (a : α), p a = 0 (f a) b = 0
def Sumcheck.Spec.Simpler.inputRelation (R : Type) [CommSemiring R] (d : ) {m : } (D : Fin m R) :
R × ((i : Unit) → InputOracleStatement R d i)UnitProp
Equations
Instances For
    Equations
    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Sumcheck.Spec.Simpler.verifier (R : Type) [CommSemiring R] (d : ) {m : } (D : Fin m R) [VCVCompatible R] :
        Verifier (pSpec R d) []ₒ (R × ((i : Unit) → InputOracleStatement R d i)) (R × ((i : Unit Unit) → OutputOracleStatement R d i))
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def Sumcheck.Spec.Simpler.reduction (R : Type) [CommSemiring R] (d : ) {m : } (D : Fin m R) [VCVCompatible R] :
          Reduction (pSpec R d) []ₒ (R × ((i : Unit) → InputOracleStatement R d i)) Unit (R × ((i : Unit Unit) → OutputOracleStatement R d i)) Unit
          Equations
          Instances For
            @[simp]
            theorem Sumcheck.Spec.Simpler.probFailure_bind_eq_zero_iff {ι : Type u} {spec : OracleSpec ι} {α β : Type u} [spec.FiniteRange] (oa : OracleComp spec α) (ob : αOracleComp spec β) :
            [⊥|oa >>= ob] = 0 [⊥|oa] = 0 xoa.support, [⊥|ob x] = 0
            @[simp]
            theorem Sumcheck.Spec.Simpler.WriterT.run_map {α β ω : Type u} {m : Type u → Type v} [Monad m] [Monoid ω] (x : WriterT ω m α) (f : αβ) :
            (f <$> x).run = Prod.map f id <$> x.run
            @[simp]
            theorem Sumcheck.Spec.Simpler.probFailure_liftComp {ι : Type u} {spec : OracleSpec ι} {α : Type u} {ι' : Type w} {superSpec : OracleSpec ι'} [spec.FiniteRange] [superSpec.FiniteRange] [h : MonadLift spec.OracleQuery superSpec.OracleQuery] (oa : OracleComp spec α) :
            [⊥|oa.liftComp superSpec] = [⊥|oa]
            @[simp]
            theorem Sumcheck.Spec.Simpler.liftComp_support {ι : Type u} {spec : OracleSpec ι} {α : Type u} {ι' : Type w} {superSpec : OracleSpec ι'} [h : MonadLift spec.OracleQuery superSpec.OracleQuery] (oa : OracleComp spec α) :
            (oa.liftComp superSpec).support = oa.support
            theorem Sumcheck.Spec.Simpler.neverFails_map_iff' {ι : Type u} {spec : OracleSpec ι} {α β : Type u} (oa : OracleComp spec α) (f : αβ) :
            structure Sumcheck.Spec.Statement (R : Type) (n : ) (i : Fin (n + 2)) :

            Statement for sum-check, parameterized by the ring R, the number of variables n, and the round index i : Fin (n + 2)

            Note that when i = Fin.last (n + 1), this is the output statement of the sum-check protocol

            • target : R
            • challenges : Fin iR
            Instances For
              @[reducible]
              Equations
              Instances For
                def Sumcheck.Spec.relation (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) (i : Fin (n + 2)) :
                Statement R n i × ((i : Fin 1) → OracleStatement R n deg i)UnitProp

                The sum-check relation for the i-th round, for i ≤ n

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

                  Protocol specification for the i-th round of the sum-check protocol

                  Consists of a message from prover to verifier of degree at most deg, and a message from verifier to prover of a field element in R.

                  Equations
                  Instances For

                    Recognize that the (only) message from the prover to the verifier has type R⦃≤ deg⦄[X], and hence can be turned into an oracle for evaluating the polynomial

                    Equations

                    Recognize that the challenge from the verifier to the prover has type R, and hence can be sampled uniformly at random

                    Equations
                    @[reducible]
                    def Sumcheck.Spec.proverState (R : Type) [CommSemiring R] (n deg : ) (i : Fin (n + 1)) :
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Sumcheck.Spec.proverIn (R : Type) [CommSemiring R] (n deg : ) (i : Fin (n + 1)) :
                      ProverIn (Statement R n i.castSucc × ((i : Fin 1) → OracleStatement R n deg i)) Unit ((proverState R n deg i).PrvState 0)

                      Prover input for the i-th round of the sum-check protocol, where i < n

                      Equations
                      Instances For
                        theorem Sumcheck.Spec.sumcheck_roundPoly_degreeLE (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) (i : Fin (n + 1)) {challenges : Fin i.castSuccR} {poly : MvPolynomial (Fin (n + 1)) R} (hp : poly MvPolynomial.restrictDegree (Fin (n + 1)) R deg) :

                        Auxiliary lemma for proving that the polynomial sent by the honest prover is of degree at most deg

                        def Sumcheck.Spec.proverRound (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) {ι : Type} (oSpec : OracleSpec ι) (i : Fin (n + 1)) :
                        ProverRound (pSpec R deg) oSpec

                        Prover interaction for the i-th round of the sum-check protocol, where i < n.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Sumcheck.Spec.proverOut (R : Type) [CommSemiring R] (n deg : ) (i : Fin (n + 1)) :
                          ProverOut (Statement R n i.succ × ((i : Fin 1) → OracleStatement R n deg i)) Unit ((proverState R n deg i).PrvState (Fin.last 2))

                          Since there is no witness, the prover's output for each round i < n of the sum-check protocol is trivial

                          Equations
                          Instances For
                            def Sumcheck.Spec.prover (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) {ι : Type} (oSpec : OracleSpec ι) (i : Fin (n + 1)) :
                            OracleProver (pSpec R deg) oSpec (Statement R n i.castSucc) Unit (Statement R n i.succ) Unit (OracleStatement R n deg) (OracleStatement R n deg)

                            The overall prover for the i-th round of the sum-check protocol, where i < n. This is only well-defined for n > 0, since when n = 0 there is no protocol.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              def Sumcheck.Spec.verifier (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) {ι : Type} (oSpec : OracleSpec ι) [VCVCompatible R] (i : Fin (n + 1)) :
                              Verifier (pSpec R deg) oSpec (Statement R n i.castSucc × ((i : Fin 1) → OracleStatement R n deg i)) (Statement R n i.succ × ((i : Fin 1) → OracleStatement R n deg i))

                              The (non-oracle) verifier of the sum-check protocol for the i-th round, where i < n + 1

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Sumcheck.Spec.oracleVerifier (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) {ι : Type} (oSpec : OracleSpec ι) [VCVCompatible R] (i : Fin (n + 1)) :
                                OracleVerifier (pSpec R deg) oSpec (Statement R n i.castSucc) (Statement R n i.succ) (OracleStatement R n deg) (OracleStatement R n deg)

                                The oracle verifier for the i-th round, where i < n + 1

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def Sumcheck.Spec.reduction (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) {ι : Type} (oSpec : OracleSpec ι) [VCVCompatible R] (i : Fin (n + 1)) :
                                  Reduction (pSpec R deg) oSpec (Statement R n i.castSucc × ((i : Fin 1) → OracleStatement R n deg i)) Unit (Statement R n i.succ × ((i : Fin 1) → OracleStatement R n deg i)) Unit

                                  The sum-check reduction for the i-th round, where i < n and n > 0

                                  Equations
                                  Instances For
                                    def Sumcheck.Spec.oracleReduction (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) {ι : Type} (oSpec : OracleSpec ι) [VCVCompatible R] (i : Fin (n + 1)) :
                                    OracleReduction (pSpec R deg) oSpec (Statement R n i.castSucc) Unit (Statement R n i.succ) Unit (OracleStatement R n deg) (OracleStatement R n deg)

                                    The sum-check oracle reduction for the i-th round, where i < n and n > 0

                                    Equations
                                    Instances For
                                      theorem Sumcheck.Spec.oracleVerifier_eq_verifier {R : Type} [CommSemiring R] [VCVCompatible R] {n deg m : } {D : Fin m R} {ι : Type} {oSpec : OracleSpec ι} {i : Fin (n + 1)} :
                                      (oracleVerifier R n deg D oSpec i).toVerifier = verifier R n deg D oSpec i

                                      The oracle verifier does the same thing as the non-oracle verifier

                                      theorem Sumcheck.Spec.perfect_completeness {R : Type} [CommSemiring R] [VCVCompatible R] {n deg m : } {D : Fin m R} {ι : Type} {oSpec : OracleSpec ι} {i : Fin (n + 1)} [DecidableEq ι] [oSpec.FiniteRange] :
                                      OracleReduction.perfectCompleteness (relation R n deg D i.castSucc) (relation R n deg D i.succ) (oracleReduction R n deg D oSpec i)

                                      Completeness theorem for sumcheck

                                      def Sumcheck.Spec.stateFunction {R : Type} [CommSemiring R] [VCVCompatible R] {n deg m : } {D : Fin m R} {ι : Type} {oSpec : OracleSpec ι} [oSpec.FiniteRange] (i : Fin (n + 1)) :

                                      State function for round-by-round soundness

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        def Sumcheck.Spec.rbrExtractor {R : Type} [CommSemiring R] {n deg : } {ι : Type} {oSpec : OracleSpec ι} (i : Fin (n + 1)) :

                                        Trivial extractor since witness is Unit

                                        Equations
                                        Instances For

                                          We give the type signature & security guarantees for the whole sum-check protocol (so that we could use it for other oracle reductions, e.g. Spartan, without needing to prove security of sum-check first)

                                          Equations
                                          Equations
                                          @[reducible]
                                          Equations
                                          Instances For
                                            Equations
                                            Instances For
                                              @[reducible]
                                              Equations
                                              Instances For
                                                def Sumcheck.Spec.Combined.relIn (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) :
                                                StmtIn R × ((i : Unit) → OStmtIn R n deg i)WitInProp
                                                Equations
                                                Instances For
                                                  def Sumcheck.Spec.Combined.relOut (R : Type) [CommSemiring R] (n deg : ) :
                                                  StmtOut R n × ((i : Unit) → OStmtOut R n deg i)WitOutProp
                                                  Equations
                                                  Instances For
                                                    def Sumcheck.Spec.Combined.prover (R : Type) [CommSemiring R] (n deg : ) :
                                                    OracleProver (pSpec R deg n) []ₒ (StmtIn R) WitIn (StmtOut R n) WitOut (OStmtIn R n deg) (OStmtOut R n deg)
                                                    Equations
                                                    Instances For
                                                      def Sumcheck.Spec.Combined.verifier (R : Type) [CommSemiring R] (n deg : ) :
                                                      OracleVerifier (pSpec R deg n) []ₒ (StmtIn R) (StmtOut R n) (OStmtIn R n deg) (OStmtOut R n deg)
                                                      Equations
                                                      Instances For
                                                        def Sumcheck.Spec.Combined.reduction (R : Type) [CommSemiring R] (n deg : ) :
                                                        OracleReduction (pSpec R deg n) []ₒ (StmtIn R) WitIn (StmtOut R n) WitOut (OStmtIn R n deg) (OStmtOut R n deg)
                                                        Equations
                                                        Instances For
                                                          theorem Sumcheck.Spec.Combined.reduction_complete (R : Type) [CommSemiring R] (n deg : ) {m : } (D : Fin m R) [VCVCompatible R] :

                                                          Perfect completeness for the (full) sum-check protocol