Documentation

CslibFrontier.Crypto.Protocols.PolynomialCommitment.Basic

Polynomial commitment schemes, evaluation batching, and the Ligero matrix-code IOP core #

A polynomial commitment scheme (Cslib.Crypto.Protocols.PolyCommitScheme) commits to a polynomial from an admissible class ValidPoly and opens evaluations eval p z = y with short proofs Kate, Zaverucha and Goldberg. Its core security properties are evaluation completeness (PolyCommitScheme.EvalComplete), commitment binding (PolyCommitScheme.CommitmentBinding, PolyCommitScheme.CommitmentBindingExtract), and evaluation binding at each query point (PolyCommitScheme.EvaluationBinding, PolyCommitScheme.EvaluationBindingExtract). PolyCommitScheme.CommitmentBinding and PolyCommitScheme.EvaluationBinding are perfect binding: they quantify over all valid polynomials and randomness, respectively all commitments and pairs of accepting openings, with no adversary, probability or setup. The two Extract predicates ask a given function extract to map every binding break to a witness satisfying a given predicate Collision; a constant extract meets them for every scheme whenever some witness satisfies Collision. No binding notion against bounded adversaries is defined here.

When a prover claims k evaluations eval (p i) z = y i at a point z, random-linear-combination batching (Cslib.Crypto.Protocols.batchEvalReduction) samples a uniform challenge vector r : Fin k → F and reduces the k claims to the single linear combination ∑ i, r i * eval (p i) z = ∑ i, r i * y i Chiesa and Yogev. When any single claimed evaluation is false (eval (p i₀) z ≠ y i₀), the discrepancy ∑ i, r i * (eval (p i) z - y i) is a surjective additive homomorphism of r : Fin k → F onto F, so it is uniformly distributed on F (uniformOfFintype_map_linearComb) and vanishes with probability exactly 1 / |F| (toOuterMeasure_batchEval_sub_eq_zero, toOuterMeasure_batchEval_eq, batchEvalReduction_sound).

In the Ligero matrix-code interactive oracle proof Ames, Hazay, Ishai and Venkitasubramaniam, Chiesa and Yogev, a witness vector is reshaped into an m × l matrix U : Matrix (Fin m) (Fin l) F and encoded row-wise by a linear generator matrix G : Matrix (Fin l) (Fin n) F into M = U * G. To check proximity and row-wise consistency, the verifier sends a random challenge r : Fin m → F, the prover replies with the row combination v = ligeroRowComb r U = r ᵥ* U : Fin l → F, and the verifier checks (v ᵥ* G) j = (r ᵥ* M) j at queried columns j (ligeroColumnCheck, ligeroEvalCheck). Associativity of vector-matrix multiplication (Matrix.vecMul_vecMul) gives perfect completeness (ligeroRowComb_mul). If some row i₀ has M i₀ j ≠ ((U i₀) ᵥ* G) j, the honest row combination r ᵥ* U passes the check at column j with probability exactly 1 / |F| (toOuterMeasure_ligeroRowComb_eq), and against every prover the verifier accepts a response equal to r ᵥ* U with probability at most 1 / |F| (LigeroMatrixIOP.columnReduction_sound).

This module formalizes one column check as an interactive reduction (LigeroMatrixIOP.columnReduction): the column j is the input statement, M is a parameter of the verifier rather than an oracle, the response v is read in full, and consistency is measured against the fixed matrix U of the bundle. LigeroMatrixIOP.columnReduction_sound does not bound the probability that the verifier accepts a response other than r ᵥ* U, and no statement here says that the rows of M are codewords of G or close to codewords.

Main definitions #

Main results #

References #

Polynomial commitment scheme interface #

An evaluation opening: the claimed value of a committed polynomial at a query point, with the proof that the verifier checks against the commitment.

  • value : F

    The claimed evaluation.

  • proof : Proof

    The opening proof.

structure Cslib.Crypto.Protocols.PolyCommitScheme (Poly Randomness Point F Commit Proof : Type u) :

A polynomial commitment scheme over polynomial representation Poly, commitment randomness Randomness, evaluation point type Point, value type F, commitment type Commit, and opening proof type Proof Kate, Zaverucha and Goldberg.

  • eval : Poly → Point → F

    Evaluate a polynomial at a query point.

  • ValidPoly : Poly → Prop

    Admissibility / degree-bound predicate on committed polynomials.

  • commit : Poly → Randomness → Commit

    Commit to a polynomial using explicit randomness.

  • openEval : Poly → Randomness → Point → Opening F Proof

    Open a committed polynomial at a point, returning the claimed value and an opening proof.

  • verifyEval : Commit → Point → F → Proof → Bool

    Deterministic verification of a claimed evaluation (y, π) at point z against c.

def Cslib.Crypto.Protocols.PolyCommitScheme.AcceptsEval {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) (c : Commit) (z : Point) (y : F) (π : Proof) :

The proposition that the verifier accepts opening (y, π) for commitment c at point z.

Instances For
    @[instance_reducible]
    instance Cslib.Crypto.Protocols.PolyCommitScheme.instDecidableAcceptsEval {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) (c : Commit) (z : Point) (y : F) (π : Proof) :
    Decidable (S.AcceptsEval c z y π)
    def Cslib.Crypto.Protocols.PolyCommitScheme.EvalComplete {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) :

    Evaluation completeness: for every valid polynomial p, commitment randomness r, and query point z, the honest opening proof (openEval p r z).proof is accepted for the true evaluation eval p z on commit p r.

    def Cslib.Crypto.Protocols.PolyCommitScheme.OpenValueCorrect {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) :

    Honest opening value correctness: the value of openEval p r z is eval p z.

    def Cslib.Crypto.Protocols.PolyCommitScheme.CommitmentBinding {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) :

    Commitment binding: no two distinct valid polynomials produce the same commitment.

    def Cslib.Crypto.Protocols.PolyCommitScheme.CommitmentBindingExtract {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) {Witness : Type u_1} (Collision : Witness → Prop) (extract : Poly → Randomness → Poly → Randomness → Witness) :

    Witness-extracting commitment binding: from any two distinct valid polynomials with the same commitment, extract recovers a witness satisfying Collision (such as a hash collision or discrete-logarithm relation). Here extract is an arbitrary function with no efficiency requirement, and a constant extract at a witness satisfying Collision satisfies the predicate for every scheme, so this is a statement about the named extract rather than a binding property of the scheme alone.

    def Cslib.Crypto.Protocols.PolyCommitScheme.EvaluationBinding {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) :

    Evaluation binding: at any query point z, no commitment c has two accepting openings (y₁, π₁) and (y₂, π₂) for distinct values y₁ ≠ y₂.

    def Cslib.Crypto.Protocols.PolyCommitScheme.EvaluationBindingExtract {Poly Randomness Point F Commit Proof : Type u} (S : PolyCommitScheme Poly Randomness Point F Commit Proof) {Witness : Type u_1} (Collision : Witness → Prop) (extract : Commit → Point → F → Proof → F → Proof → Witness) :

    Witness-extracting evaluation binding: from any two accepting openings (y₁, π₁) and (y₂, π₂) of the same commitment c at point z with y₁ ≠ y₂, extract recovers a witness satisfying Collision. As for CommitmentBindingExtract, extract is an arbitrary function with no efficiency requirement, and a constant extract at a witness satisfying Collision satisfies the predicate for every scheme.

    theorem Cslib.Crypto.Protocols.PolyCommitScheme.EvalComplete.verifyEval_openEval {Poly Randomness Point F Commit Proof : Type u} {S : PolyCommitScheme Poly Randomness Point F Commit Proof} (hcomp : S.EvalComplete) (hval : S.OpenValueCorrect) {p : Poly} (hp : S.ValidPoly p) (r : Randomness) (z : Point) :
    S.verifyEval (S.commit p r) z (S.openEval p r z).value (S.openEval p r z).proof = true

    Under EvalComplete and OpenValueCorrect, both components of openEval p r z verify.

    theorem Cslib.Crypto.Protocols.PolyCommitScheme.EvaluationBinding.eq_eval_of_verifyEval {Poly Randomness Point F Commit Proof : Type u} {S : PolyCommitScheme Poly Randomness Point F Commit Proof} (hbind : S.EvaluationBinding) (hcomp : S.EvalComplete) {p : Poly} (hp : S.ValidPoly p) (r : Randomness) (z : Point) {y : F} {π : Proof} (hver : S.verifyEval (S.commit p r) z y π = true) :
    y = S.eval p z

    Under EvalComplete and EvaluationBinding, any accepting opening (y, π) for an honest commitment commit p r to a valid polynomial p must satisfy y = eval p z.

    theorem Cslib.Crypto.Protocols.PolyCommitScheme.EvaluationBinding.commitmentBinding_of_eval_inj {Poly Randomness Point F Commit Proof : Type u} {S : PolyCommitScheme Poly Randomness Point F Commit Proof} (hbind : S.EvaluationBinding) (hcomp : S.EvalComplete) (hinj : ∀ (p₁ p₂ : Poly), S.ValidPoly p₁ → S.ValidPoly p₂ → (∀ (z : Point), S.eval p₁ z = S.eval p₂ z) → p₁ = p₂) :

    If evaluation completeness and evaluation binding hold, and valid polynomials are determined by their evaluations, then commitment binding holds.

    theorem Cslib.Crypto.Protocols.PolyCommitScheme.CommitmentBinding.commitmentBindingExtract {Poly Randomness Point F Commit Proof : Type u} {S : PolyCommitScheme Poly Randomness Point F Commit Proof} (hbind : S.CommitmentBinding) {Witness : Type u_1} (Collision : Witness → Prop) (extract : Poly → Randomness → Poly → Randomness → Witness) :
    S.CommitmentBindingExtract Collision extract

    Strict commitment binding implies witness-extracting commitment binding for any relation.

    theorem Cslib.Crypto.Protocols.PolyCommitScheme.EvaluationBinding.evaluationBindingExtract {Poly Randomness Point F Commit Proof : Type u} {S : PolyCommitScheme Poly Randomness Point F Commit Proof} (hbind : S.EvaluationBinding) {Witness : Type u_1} (Collision : Witness → Prop) (extract : Commit → Point → F → Proof → F → Proof → Witness) :
    S.EvaluationBindingExtract Collision extract

    Strict evaluation binding implies witness-extracting evaluation binding for any relation.

    The canonical transparent degree-bounded polynomial commitment scheme over Polynomial F, in which the commitment is the polynomial itself and verification checks the degree bound and direct evaluation.

    Random linear combination evaluation-batching reduction #

    @[reducible, inline]

    The single verifier-challenge round for batching k polynomial evaluation claims.

    @[reducible, inline]

    A batched evaluation claim: the challenge vector r : Fin k → F and the claimed linear combination v : F.

    def Cslib.Crypto.Protocols.batchEvalRelIn {Poly Point F : Type} {k : ℕ} (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) :
    (Fin k → F) → Unit → Prop

    The input relation for batching k evaluation claims at z: all k claimed values y i match eval (p i) z.

    def Cslib.Crypto.Protocols.batchEvalRelOut {Poly Point F : Type} {k : ℕ} [Semiring F] (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) :

    The output relation after sampling the batching weights r : Fin k → F: the single linear combination ∑ i, r i * eval (p i) z equals the batched value.

    theorem Cslib.Crypto.Protocols.toOuterMeasure_batchEval_sub_eq_zero {Poly Point F : Type} {k : ℕ} [Field F] [Fintype F] (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) (y : Fin k → F) {i₀ : Fin k} (hne : eval (p i₀) z ≠ y i₀) :
    (Probability.PMF.uniformOfFintype (Fin k → F)).toOuterMeasure {r : Fin k → F | ∑ i : Fin k, r i * (eval (p i) z - y i) = 0} = 1 / ↑(Fintype.card F)

    If eval (p i₀) z ≠ y i₀ for some i₀ : Fin k, then over uniform r : Fin k → F, the probability that ∑ i, r i * (eval (p i) z - y i) = 0 is exactly 1 / |F|.

    theorem Cslib.Crypto.Protocols.toOuterMeasure_batchEval_eq {Poly Point F : Type} {k : ℕ} [Field F] [Fintype F] (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) (y : Fin k → F) {i₀ : Fin k} (hne : eval (p i₀) z ≠ y i₀) :
    (Probability.PMF.uniformOfFintype (Fin k → F)).toOuterMeasure {r : Fin k → F | ∑ i : Fin k, r i * eval (p i) z = ∑ i : Fin k, r i * y i} = 1 / ↑(Fintype.card F)

    If eval (p i₀) z ≠ y i₀ for some i₀ : Fin k, then over uniform r : Fin k → F, the probability that the batched linear combinations agree (∑ i, r i * eval (p i) z = ∑ i, r i * y i) is exactly 1 / |F|.

    noncomputable def Cslib.Crypto.Protocols.batchEvalReduction {Poly Point F : Type} {k : ℕ} [Field F] [Fintype F] (_eval : Poly → Point → F) (_p : Fin k → Poly) (_z : Point) :

    Random linear combination evaluation-batching reduction Chiesa and Yogev: given a vector of k claimed evaluations y : Fin k → F for (p i) at z, the verifier samples a uniform challenge vector r : Fin k → F and outputs the single linear-combination claim (r, ∑ i, r i * y i).

    theorem Cslib.Crypto.Protocols.batchEvalReduction_outputOn {Poly Point F : Type} {k : ℕ} [Field F] [Fintype F] (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) (y : Fin k → F) (τ : (batchEvalSpec k F).Transcript) :
    (batchEvalReduction eval p z).verifier.outputOn y τ = some (τ.1, ∑ i : Fin k, τ.1 i * y i)
    theorem Cslib.Crypto.Protocols.batchEvalReduction_complete {Poly Point F : Type} {k : ℕ} [Field F] [Fintype F] (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) :

    Completeness of random linear combination batching: when all k claimed evaluations are correct (∀ i, eval (p i) z = y i), the batched claim holds with probability 1 (error 0).

    theorem Cslib.Crypto.Protocols.batchEvalReduction_rbrSound {Poly Point F : Type} {k : ℕ} [Field F] [Fintype F] (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) :

    Round-by-round soundness of random linear combination batching: a false multi-evaluation claim survives with probability at most 1 / |F|.

    theorem Cslib.Crypto.Protocols.batchEvalReduction_sound {Poly Point F : Type} {k : ℕ} [Field F] [Fintype F] (eval : Poly → Point → F) (p : Fin k → Poly) (z : Point) :

    Soundness of random linear combination batching: against any prover strategy, a false multi-evaluation claim produces a valid batched claim with probability at most 1 / |F|.

    Ligero matrix-code IOP core #

    def Cslib.Crypto.Protocols.ligeroRowComb {F : Type} {m l : ℕ} [Semiring F] (r : Fin m → F) (U : Matrix (Fin m) (Fin l) F) :
    Fin l → F

    The Ligero prover's row linear combination v = r ᵥ* U : Fin l → F for challenge vector r : Fin m → F and witness matrix U : Matrix (Fin m) (Fin l) F Ames, Hazay, Ishai and Venkitasubramaniam.

    theorem Cslib.Crypto.Protocols.ligeroRowComb_mul {F : Type} {m l n : ℕ} [Semiring F] (r : Fin m → F) (U : Matrix (Fin m) (Fin l) F) (G : Matrix (Fin l) (Fin n) F) :

    Ligero row-combination completeness identity: encoding the row linear combination ligeroRowComb r U by G equals taking the same linear combination of the encoded matrix U * G.

    theorem Cslib.Crypto.Protocols.ligeroRowComb_mul_eq_sum {F : Type} {m l n : ℕ} [CommSemiring F] (r : Fin m → F) (U : Matrix (Fin m) (Fin l) F) (G : Matrix (Fin l) (Fin n) F) (j : Fin n) :
    Matrix.vecMul (ligeroRowComb r U) G j = ∑ i : Fin m, r i * Matrix.vecMul (U i) G j

    Expanding ((ligeroRowComb r U) ᵥ* G) j as a linear combination of the encoded witness rows ((U i) ᵥ* G) j.

    def Cslib.Crypto.Protocols.ligeroEval {F : Type} {m l : ℕ} [Semiring F] (U : Matrix (Fin m) (Fin l) F) (b : Fin m → F) (c : Fin l → F) :
    F

    Target bilinear evaluation (b ᵥ* U) ⬝ᵥ c of a witness matrix U : Matrix (Fin m) (Fin l) F at outer-product query vectors b : Fin m → F and c : Fin l → F.

    def Cslib.Crypto.Protocols.ligeroColumnCheck {F : Type} {m l n : ℕ} [Semiring F] [DecidableEq F] (G : Matrix (Fin l) (Fin n) F) (M : Matrix (Fin m) (Fin n) F) (r : Fin m → F) (v : Fin l → F) (j : Fin n) :

    The Ligero verifier's column check at column j : Fin n: the j-th coordinate of the encoded response v ᵥ* G matches the r-linear combination of column j of the oracle matrix M.

    def Cslib.Crypto.Protocols.ligeroEvalCheck {F : Type} {m l n : ℕ} [Semiring F] [DecidableEq F] (G : Matrix (Fin l) (Fin n) F) (M : Matrix (Fin m) (Fin n) F) (b : Fin m → F) (c : Fin l → F) (w : F) (v : Fin l → F) (j : Fin n) :

    The Ligero verifier's combined evaluation and column check at column j : Fin n for a linear evaluation claim (b, c, w): checks both v ⬝ᵥ c = w and (v ᵥ* G) j = (b ᵥ* M) j.

    theorem Cslib.Crypto.Protocols.ligeroColumnCheck_honest {F : Type} {m l n : ℕ} [Semiring F] [DecidableEq F] (G : Matrix (Fin l) (Fin n) F) (U : Matrix (Fin m) (Fin l) F) (r : Fin m → F) (j : Fin n) :

    Completeness of the Ligero column check: when M = U * G and v = ligeroRowComb r U, the column check passes at every column j.

    theorem Cslib.Crypto.Protocols.ligeroEvalCheck_honest {F : Type} {m l n : ℕ} [Semiring F] [DecidableEq F] (G : Matrix (Fin l) (Fin n) F) (U : Matrix (Fin m) (Fin l) F) (b : Fin m → F) (c : Fin l → F) (j : Fin n) :
    ligeroEvalCheck G (U * G) b c (ligeroEval U b c) (ligeroRowComb b U) j = true

    Completeness of the Ligero evaluation check: when M = U * G, w = ligeroEval U b c, and v = ligeroRowComb b U, the evaluation check passes at every column j.

    theorem Cslib.Crypto.Protocols.toOuterMeasure_ligeroRowComb_eq {F : Type} {m l n : ℕ} [Field F] [Fintype F] (G : Matrix (Fin l) (Fin n) F) (M : Matrix (Fin m) (Fin n) F) (U : Matrix (Fin m) (Fin l) F) {i₀ : Fin m} {j : Fin n} (hne : M i₀ j ≠ Matrix.vecMul (U i₀) G j) :

    Ligero row-consistency soundness (exact probability): if some row i₀ of M disagrees with the encoded witness row (U i₀) ᵥ* G at column j, then over a uniform challenge r : Fin m → F, (r ᵥ* M) j = ((ligeroRowComb r U) ᵥ* G) j holds with probability exactly 1 / |F|.

    theorem Cslib.Crypto.Protocols.toOuterMeasure_ligeroRowComb_le {F : Type} {m l n : ℕ} [Field F] [Fintype F] (G : Matrix (Fin l) (Fin n) F) (M : Matrix (Fin m) (Fin n) F) (U : Matrix (Fin m) (Fin l) F) {i₀ : Fin m} {j : Fin n} (hne : M i₀ j ≠ Matrix.vecMul (U i₀) G j) :

    Ligero row-consistency soundness bound: if M i₀ j ≠ ((U i₀) ᵥ* G) j for some row i₀, then over uniform r : Fin m → F, (r ᵥ* M) j = ((ligeroRowComb r U) ᵥ* G) j holds with probability at most 1 / |F|.

    theorem Cslib.Crypto.Protocols.toOuterMeasure_ligeroEvalCheck_le {F : Type} {m l n : ℕ} [Field F] [Fintype F] [DecidableEq F] (G : Matrix (Fin l) (Fin n) F) (M : Matrix (Fin m) (Fin n) F) (U : Matrix (Fin m) (Fin l) F) (c : Fin l → F) {i₀ : Fin m} {j : Fin n} (hne : M i₀ j ≠ Matrix.vecMul (U i₀) G j) :

    If M i₀ j ≠ ((U i₀) ᵥ* G) j for some row i₀, then ligeroEvalCheck on the honest row combination ligeroRowComb b U accepts at column j with probability at most 1 / |F| over uniform b : Fin m → F.

    Bundle of a Ligero matrix-code IOP instance over an m × l witness matrix U, an l × n generator matrix G, and an m × n purported codeword matrix M Ames, Hazay, Ishai and Venkitasubramaniam.

    All rows of M at column j equal the encoded rows of U.

    @[reducible, inline]

    The round specification of a Ligero row-consistency check: the verifier sends a uniform challenge r : Fin m → F and the prover responds with a vector v : Fin l → F read in full.

    The input relation at column j: the purported matrix M is row-consistent with U * G at column j.

    def Cslib.Crypto.Protocols.LigeroMatrixIOP.relOut {F : Type} {m l n : ℕ} [Semiring F] (L : LigeroMatrixIOP F m l n) :
    (Fin m → F) × (Fin l → F) → Unit → Prop

    The output relation of the Ligero column reduction: the prover's response v equals the true row combination ligeroRowComb r L.U.

    Public-coin interactive reduction for the Ligero column check: on input column j : Fin n, the verifier samples a uniform row challenge r : Fin m → F, the prover sends v = ligeroRowComb r L.U, and the verifier checks (v ᵥ* L.G) j = (r ᵥ* L.M) j, outputting the claim (r, v).

    Completeness of the Ligero column reduction: if L.M is row-consistent with L.U * L.G at column j, the honest prover convinces the verifier with probability 1 (error 0).

    Round-by-round soundness of the Ligero column reduction: if column j has any inconsistent row L.M i₀ j ≠ ((L.U i₀) ᵥ* L.G) j, then any prover produces an accepted transcript in language L.relOut (where v = ligeroRowComb r L.U) with probability at most 1 / |F|.

    Soundness of the Ligero column reduction, for the honest claim only: if column j is not row-consistent with L.U * L.G, then against every prover the verifier accepts and outputs a claim in L.relOut, that is (r, v) with v = ligeroRowComb r L.U, with probability at most 1 / |F|. The probability that the verifier accepts some other response v ≠ ligeroRowComb r L.U is not bounded, so this does not bound a cheating prover's acceptance probability.