Documentation

CslibFrontier.Crypto.Protocols.PolynomialCommitment.LigeroBatchIOP

Batched Reed–Solomon proximity IOPs, curve-batched Ligero reductions, and BCS/ROM soundness #

CslibFrontier.Crypto.Protocols.PolynomialCommitment.LigeroProximity formalizes full-vector (r : Fin m → F) Ligero proximity testing in Cslib.Interactive.Reduction up to d / 3 for general linear codes and up to unique decoding (2 * e + k ≤ n) for Reed–Solomon codes, together with column-query soundness of ligeroEvalCheck assuming M is already e-close to U * G. This module advances #5968 and #643 in three steps (after [AHIV17], [BSCI+23], and [BSCS16]; locator for [AHIV17] not re-verified against primary PDF):

  1. Weight-parameterized Ligero proximity reductions, single-scalar curve batching, and Johnson-bound (1 - √ρ) soundness (ligeroBatchProximityReduction, ligeroCurveProximityReduction): one reduction parameterized by weights : BatchChal → (Fin m → F) specializes at ligeroPowWeights m (z ↦ (1, z, …, z ^ (m - 1))) to single-scalar curve batching. Combining these reductions with CslibFrontier.Foundations.Data.Code.InterleavedCurve yields round-by-round and plain-model soundness:
    • for full-vector ligeroBatchProximityReduction m id (Fin m → F) up to the Johnson bound 1 - √ρ with row-count-independent batching error (explicit (m_GS, D) Guruswami–Sudan bound and closed-form 1 - √ρ - η Siegel bound);
    • for ligeroCurveProximityReduction (z : F, compressing randomness from m field elements to one scalar) in both the unique-decoding regime (2 * e + k ≤ n, error ((m - 1) * n) / |F| + ((n - (e + 1)) / n) ^ q) and the Johnson regime (1 - √ρ).
  2. Combined proximity-and-evaluation interactive reduction (LigeroEvalClaim, ligeroBatchEvalReduction): discharges both interleaved e-proximity and a bilinear evaluation claim (b ᵥ* U) ⬝ᵥ c = w over the same q queried columns of M against arbitrary matrices and arbitrary cheating provers without extra query-round error, and characterizes the accepted unique-decoding language ligeroEvalProximityLang constructively via Cslib.Code.berlekampWelchInterleaved (mem_ligeroEvalProximityLang_reedSolomon_iff).
  3. Direct batched Reed–Solomon proximity PublicCoinIOP and two-channel BCS/ROM compilation (rsBatchProximityIOP, rsAffineBatchProximityIOP, rsCurveBatchProximityIOP): compiles the 2-round batched Reed–Solomon proximity test over Fin (2 ^ d) (k ≤ 2 ^ d) as a Cslib.Crypto.Protocols.BCS.PublicCoinIOP issuing exact k committed message openings and q scheduled column reads, proving perfect IOP and two-channel ROM completeness (rsBatchProximityBCS_honestROMGame_eq_pure_true), IOPRoundByRoundSoundness, interactive soundness (rsBatchProximityIOP_interactive_le), and adaptive two-channel random-oracle soundness (rsBatchProximityBCS_romSoundness_bound) across both the unique-decoding and Johnson regimes.

Main definitions #

Main results #

References #

Part 1: Weight-parameterized and curve-batched Ligero proximity reductions #

def Cslib.Crypto.Protocols.ligeroPowWeights {F : Type u_1} [Semiring F] (m : ℕ) (z : F) :
Fin m → F

Vandermonde power weights i ↦ z ^ (i : ℕ) compressing an m-row linear combination to a single scalar challenge z : F.

@[simp]
theorem Cslib.Crypto.Protocols.ligeroPowWeights_apply {F : Type u_1} [Semiring F] (m : ℕ) (z : F) (i : Fin m) :
ligeroPowWeights m z i = z ^ ↑i
@[reducible, inline]

Round specification of a weight-parameterized batched proximity reduction with batching challenge space BatchChal, message length l, codeword length n, and q column queries.

noncomputable def Cslib.Crypto.Protocols.ligeroBatchProximityReduction {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) (weights : BatchChal → Fin m → F) {l n : ℕ} [NeZero n] (G : Matrix (Fin l) (Fin n) F) (q : ℕ) :

Weight-parameterized Ligero interleaved proximity reduction: samples a uniform challenge chal : BatchChal, forms row weights weights chal : Fin m → F, receives a purported message combination v : Fin l → F, and checks ligeroColumnCheck G M (weights chal) v (Q t) at q independent uniform column indices Q : Fin q → Fin n.

@[reducible, inline]

Single-scalar curve-batched Ligero proximity reduction: tests proximity to interleavedLinear (Fin m) (codeOfGenerator G) using powers 1, z, …, z ^ (m - 1) of a single uniform scalar z : F and q uniform column queries.

theorem Cslib.Crypto.Protocols.ligeroBatchProximityReduction_outputOn {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) (weights : BatchChal → Fin m → F) {l n : ℕ} [NeZero n] (G : Matrix (Fin l) (Fin n) F) (q : ℕ) (M : Matrix (Fin m) (Fin n) F) (chal : BatchChal) (v : Fin l → F) (Q : Fin q → Fin n) :
(ligeroBatchProximityReduction m weights G q).verifier.outputOn M (chal, v, Q, ()) = if ∀ (t : Fin q), ligeroColumnCheck G M (weights chal) v (Q t) = true then some () else none
theorem Cslib.Crypto.Protocols.ligeroBatchProximityReduction_outputOn_congr {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) (weights : BatchChal → Fin m → F) {l n : ℕ} [NeZero n] (G : Matrix (Fin l) (Fin n) F) (q : ℕ) {M₁ M₂ : Matrix (Fin m) (Fin n) F} (chal : BatchChal) (v : Fin l → F) (Q : Fin q → Fin n) (hcols : ∀ (t : Fin q) (i : Fin m), M₁ i (Q t) = M₂ i (Q t)) :

Query locality: ligeroBatchProximityReduction reads M only at the q queried columns Q t (t : Fin q).

theorem Cslib.Crypto.Protocols.ligeroBatchProximityReduction_complete {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) (weights : BatchChal → Fin m → F) {l n : ℕ} [NeZero n] (G : Matrix (Fin l) (Fin n) F) (q : ℕ) :

Completeness of ligeroBatchProximityReduction: every honestly encoded matrix M = U * G is accepted with error 0.

theorem Cslib.Crypto.Protocols.ligeroAffineProximityReduction_reedSolomon_rbrSound_johnson_exact {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e m_GS D : ℕ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hk : 1 ≤ k) (hm_GS : 1 ≤ m_GS) (hk_le : k ≤ n - e) (hinterp : n * (m_GS * (m_GS + 1) / 2) < (Code.Sudan.monomials (k - 1) D).card) (hroot : D < m_GS * (n - e)) :

Explicit-parameter Guruswami–Sudan round-by-round soundness of full-vector ligeroBatchProximityReduction up to the Johnson bound (in the setting of [BenSassonCarmonIshaiKoppartySaraf2020, Theorems 1.2 and 1.6]): the affine-vector batching round has escape probability at most johnsonCurveBound n m_GS (k - 1) D 1 n / |F|, with zero dependence on the row count m.

theorem Cslib.Crypto.Protocols.ligeroAffineProximityReduction_reedSolomon_rbrSound_johnson_of_eta {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e : ℕ} {η : ℝ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hk : 1 ≤ k) (hkn : k ≤ n) (hη : 0 < η) (he : ↑e / ↑n ≤ 1 - √(↑k / ↑n) - η) :
(ligeroBatchProximityReduction m id (reedSolomonGenerator α k) q).verifier.RbrSound (ligeroProximityLang m (reedSolomonGenerator α k) e) Set.univ (ENNReal.ofReal (115200 * ↑n ^ 2 / (↑k / ↑n * η ^ 6 * ↑(Fintype.card F))), (↑(n - (e + 1)) / ↑n) ^ q, ())

Round-by-round soundness of full-vector ligeroBatchProximityReduction up to 1 - √ρ - η (original explicit-constant variant) (in the setting of [BenSassonCarmonIshaiKoppartySaraf2020, Theorems 1.2 and 1.6]): for 1 ≤ k ≤ n, η > 0, and (e : ℝ) / n ≤ 1 - √(k / n) - η, the row-batching round has m-independent escape probability at most 115200 * n ^ 2 / ((k / n) * η ^ 6 * |F|) (using this library's explicit Siegel constant) and the q-column query round has escape probability at most ((n - (e + 1)) / n) ^ q.

theorem Cslib.Crypto.Protocols.ligeroAffineProximityReduction_reedSolomon_sound_johnson_of_eta {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e : ℕ} {η : ℝ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hk : 1 ≤ k) (hkn : k ≤ n) (hη : 0 < η) (he : ↑e / ↑n ≤ 1 - √(↑k / ↑n) - η) :

Plain-model soundness of full-vector ligeroBatchProximityReduction up to 1 - √ρ - η (original explicit-constant variant) against every adaptive prover strategy.

theorem Cslib.Crypto.Protocols.ligeroCurveProximityReduction_reedSolomon_rbrSound {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e : ℕ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hunique : 2 * e + k ≤ n) :

Round-by-round soundness of single-scalar ligeroCurveProximityReduction in the unique-decoding regime (2 * e + k ≤ n, derived via [BenSassonCarmonIshaiKoppartySaraf2020, Theorems 1.5 and 6.1]): the single-scalar challenge round has escape probability at most ((m - 1) * n) / |F| and the q-column query round has escape probability at most ((n - (e + 1)) / n) ^ q.

Plain-model soundness of single-scalar ligeroCurveProximityReduction in the unique-decoding regime (2 * e + k ≤ n) against every adaptive prover strategy.

theorem Cslib.Crypto.Protocols.ligeroCurveProximityReduction_reedSolomon_rbrSound_johnson_exact {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e m_GS D : ℕ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hk : 1 ≤ k) (hm_GS : 1 ≤ m_GS) (hk_le : k ≤ n - e) (hinterp : n * (m_GS * (m_GS + 1) / 2) < (Code.Sudan.monomials (k - 1) D).card) (hroot : D < m_GS * (n - e)) :

Explicit-parameter Guruswami–Sudan round-by-round soundness of single-scalar ligeroCurveProximityReduction up to the Johnson bound (in the setting of [BenSassonCarmonIshaiKoppartySaraf2020, Theorems 1.5 and 6.2]).

theorem Cslib.Crypto.Protocols.ligeroCurveProximityReduction_reedSolomon_rbrSound_johnson_of_eta {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e : ℕ} {η : ℝ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hk : 1 ≤ k) (hkn : k ≤ n) (hη : 0 < η) (he : ↑e / ↑n ≤ 1 - √(↑k / ↑n) - η) :
(ligeroCurveProximityReduction m (reedSolomonGenerator α k) q).verifier.RbrSound (ligeroProximityLang m (reedSolomonGenerator α k) e) Set.univ (ENNReal.ofReal (115200 * ↑(m - 1) * ↑n ^ 2 / (↑k / ↑n * η ^ 6 * ↑(Fintype.card F))), (↑(n - (e + 1)) / ↑n) ^ q, ())

Round-by-round soundness of single-scalar ligeroCurveProximityReduction up to 1 - √ρ - η (original explicit-constant variant) (in the setting of [BenSassonCarmonIshaiKoppartySaraf2020, Theorems 1.5 and 6.2]).

theorem Cslib.Crypto.Protocols.ligeroCurveProximityReduction_reedSolomon_sound_johnson_of_eta {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e : ℕ} {η : ℝ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hk : 1 ≤ k) (hkn : k ≤ n) (hη : 0 < η) (he : ↑e / ↑n ≤ 1 - √(↑k / ↑n) - η) :

Plain-model soundness of single-scalar ligeroCurveProximityReduction up to 1 - √ρ - η (original explicit-constant variant) against every adaptive prover strategy.

Part 2: Combined Ligero proximity-and-evaluation reduction #

A Ligero bilinear evaluation claim on an m × n purported codeword matrix matrix: asserts that matrix encodes an m × l witness matrix U satisfying ligeroEval U rowWeights colWeights = value ((rowWeights ᵥ* U) ⬝ᵥ colWeights = value).

  • matrix : Matrix (Fin m) (Fin n) F

    Purported m × n encoded codeword matrix accessed via column queries.

  • rowWeights : Fin m → F

    Row-combination evaluation weights b : Fin m → F.

  • colWeights : Fin l → F

    Column-combination evaluation weights c : Fin l → F.

  • value : F

    Claimed scalar evaluation w : F.

theorem Cslib.Crypto.Protocols.LigeroEvalClaim.ext {F : Type} {m l n : ℕ} {x y : LigeroEvalClaim F m l n} (matrix : x.matrix = y.matrix) (rowWeights : x.rowWeights = y.rowWeights) (colWeights : x.colWeights = y.colWeights) (value : x.value = y.value) :
x = y

Prover's message in ligeroBatchEvalReduction: the pre-encoded proximity row combination proxComb and the pre-encoded evaluation row combination evalComb.

  • proxComb : Fin l → F

    Purported pre-encoded combination weights chal ᵥ* U for the proximity check.

  • evalComb : Fin l → F

    Purported pre-encoded combination claim.rowWeights ᵥ* U for the linear evaluation check.

theorem Cslib.Crypto.Protocols.LigeroEvalReply.ext {F : Type} {l : ℕ} {x y : LigeroEvalReply F l} (proxComb : x.proxComb = y.proxComb) (evalComb : x.evalComb = y.evalComb) :
x = y
def Cslib.Crypto.Protocols.ligeroEvalCodewordRel {F : Type} [Semiring F] {m l n : ℕ} (G : Matrix (Fin l) (Fin n) F) :
LigeroEvalClaim F m l n → Matrix (Fin m) (Fin l) F → Prop

Honest completeness relation for LigeroEvalClaim: claim.matrix = U * G and ligeroEval U claim.rowWeights claim.colWeights = claim.value.

Proximity-and-evaluation language for G at radius e: claims whose matrix lies within column-Hamming distance e of U * G for some m × l witness matrix U satisfying ligeroEval U claim.rowWeights claim.colWeights = claim.value.

theorem Cslib.Crypto.Protocols.mem_ligeroEvalProximityLang_of_rel {F : Type} [CommSemiring F] [DecidableEq F] {m l n : ℕ} {G : Matrix (Fin l) (Fin n) F} {claim : LigeroEvalClaim F m l n} {U : Matrix (Fin m) (Fin l) F} (hrel : ligeroEvalCodewordRel G claim U) (e : ℕ) :

Every honest claim satisfying ligeroEvalCodewordRel G belongs to ligeroEvalProximityLang G e for all e : ℕ.

theorem Cslib.Crypto.Protocols.mem_ligeroEvalProximityLang_reedSolomon_iff {F : Type} [Field F] [DecidableEq F] {m k n e : ℕ} {α : Fin n → F} (hα : Function.Injective α) (hunique : 2 * e + k ≤ n) {claim : LigeroEvalClaim F m k n} :
claim ∈ ligeroEvalProximityLang (reedSolomonGenerator α k) e ↔ ∃ (P : Fin m → Polynomial F), Code.berlekampWelchInterleaved α e k (Function.swap claim.matrix) = some P ∧ ligeroEval (Matrix.of fun (i : Fin m) (d : Fin k) => (P i).coeff ↑d) claim.rowWeights claim.colWeights = claim.value

Berlekamp–Welch characterization of ligeroEvalProximityLang in the unique-decoding regime (2 * e + k ≤ n): with distinct evaluation points α : Fin n → F, a claim belongs to ligeroEvalProximityLang (reedSolomonGenerator α k) e if and only if berlekampWelchInterleaved α e k (Function.swap claim.matrix) returns a polynomial family P whose coefficient matrix evaluates to claim.value.

@[reducible, inline]

Round specification of ligeroBatchEvalReduction.

def Cslib.Crypto.Protocols.ligeroBatchEvalVerify {F : Type} [Semiring F] [DecidableEq F] {m l n q : ℕ} (G : Matrix (Fin l) (Fin n) F) (claim : LigeroEvalClaim F m l n) (r : Fin m → F) (reply : LigeroEvalReply F l) (Q : Fin q → Fin n) :

Boolean verification predicate for ligeroBatchEvalReduction: checks the claimed dot product upfront and verifies both ligeroColumnCheck (proximity) and ligeroEvalCheck (linear evaluation) at all q queried columns.

noncomputable def Cslib.Crypto.Protocols.ligeroBatchEvalReduction {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) (weights : BatchChal → Fin m → F) {l n : ℕ} [NeZero n] (G : Matrix (Fin l) (Fin n) F) (q : ℕ) :

Combined Ligero proximity-and-evaluation interactive reduction: tests both interleaved e-proximity of claim.matrix and ligeroEval U claim.rowWeights claim.colWeights = claim.value using a single q-column query batch.

theorem Cslib.Crypto.Protocols.ligeroBatchEvalReduction_outputOn {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) (weights : BatchChal → Fin m → F) {l n : ℕ} [NeZero n] (G : Matrix (Fin l) (Fin n) F) (q : ℕ) (claim : LigeroEvalClaim F m l n) (chal : BatchChal) (reply : LigeroEvalReply F l) (Q : Fin q → Fin n) :
(ligeroBatchEvalReduction m weights G q).verifier.outputOn claim (chal, reply, Q, ()) = if ligeroBatchEvalVerify G claim (weights chal) reply Q = true then some () else none
theorem Cslib.Crypto.Protocols.ligeroBatchEvalReduction_outputOn_congr {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] {m l n : ℕ} [NeZero n] (weights : BatchChal → Fin m → F) (G : Matrix (Fin l) (Fin n) F) (q : ℕ) {M₁ M₂ : Matrix (Fin m) (Fin n) F} (b : Fin m → F) (c : Fin l → F) (w : F) (chal : BatchChal) (reply : LigeroEvalReply F l) (Q : Fin q → Fin n) (hcols : ∀ (t : Fin q) (i : Fin m), M₁ i (Q t) = M₂ i (Q t)) :
(ligeroBatchEvalReduction m weights G q).verifier.outputOn { matrix := M₁, rowWeights := b, colWeights := c, value := w } (chal, reply, Q, ()) = (ligeroBatchEvalReduction m weights G q).verifier.outputOn { matrix := M₂, rowWeights := b, colWeights := c, value := w } (chal, reply, Q, ())

Query locality of ligeroBatchEvalReduction: the verifier accesses claim.matrix only at the q queried columns Q t (t : Fin q).

theorem Cslib.Crypto.Protocols.ligeroBatchEvalReduction_complete {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) (weights : BatchChal → Fin m → F) {l n : ℕ} [NeZero n] (G : Matrix (Fin l) (Fin n) F) (q : ℕ) :

Completeness of ligeroBatchEvalReduction: every honest claim claim.matrix = U * G with ligeroEval U claim.rowWeights claim.colWeights = claim.value is accepted with error 0.

theorem Cslib.Crypto.Protocols.ligeroAffineEvalReduction_reedSolomon_rbrSound {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e : ℕ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hunique : 2 * e + k ≤ n) :

Round-by-round soundness of full-vector ligeroBatchEvalReduction across the Reed–Solomon unique-decoding radius (2 * e + k ≤ n): rejects every claim outside ligeroEvalProximityLang (reedSolomonGenerator α k) e with per-round errors n / |F| and ((n - (e + 1)) / n) ^ q.

Plain-model soundness of full-vector ligeroBatchEvalReduction across the Reed–Solomon unique-decoding radius (2 * e + k ≤ n).

theorem Cslib.Crypto.Protocols.ligeroCurveEvalReduction_reedSolomon_rbrSound {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {k n q e : ℕ} [NeZero n] {α : Fin n → F} (hα : Function.Injective α) (hunique : 2 * e + k ≤ n) :

Round-by-round soundness of single-scalar ligeroBatchEvalReduction across the Reed–Solomon unique-decoding radius (2 * e + k ≤ n): rejects every claim outside ligeroEvalProximityLang (reedSolomonGenerator α k) e with per-round errors ((m - 1) * n) / |F| and ((n - (e + 1)) / n) ^ q.

Plain-model soundness of single-scalar ligeroBatchEvalReduction across the Reed–Solomon unique-decoding radius (2 * e + k ≤ n).

Part 3: Direct Batched Reed–Solomon Proximity PublicCoinIOP & Two-Channel BCS/ROM #

structure Cslib.Crypto.Protocols.LigeroIOPChal (BatchChal : Type) (d q : ℕ) :

Per-round public-coin challenge record for rsBatchProximityIOP: carries a row-batching challenge batchChal : BatchChal (consumed after round 0) and q column query indices queryIdxs : Fin q → Fin (2 ^ d) (consumed at verification after round 1).

  • batchChal : BatchChal

    Row-combination batching challenge sampled after round 0.

  • queryIdxs : Fin q → Fin (2 ^ d)

    q column query indices sampled in the final round.

Instances For
    theorem Cslib.Crypto.Protocols.LigeroIOPChal.ext_iff {BatchChal : Type} {d q : ℕ} {x y : LigeroIOPChal BatchChal d q} :
    theorem Cslib.Crypto.Protocols.LigeroIOPChal.ext {BatchChal : Type} {d q : ℕ} {x y : LigeroIOPChal BatchChal d q} (batchChal : x.batchChal = y.batchChal) (queryIdxs : x.queryIdxs = y.queryIdxs) :
    x = y
    def Cslib.Crypto.Protocols.LigeroIOPChal.equivProd (BatchChal : Type) (d q : ℕ) :
    LigeroIOPChal BatchChal d q ≃ BatchChal × (Fin q → Fin (2 ^ d))

    Equivalence between LigeroIOPChal BatchChal d q and BatchChal × (Fin q → Fin (2 ^ d)).

    @[instance_reducible]
    instance Cslib.Crypto.Protocols.instDecidableEqLigeroIOPChal {BatchChal : Type} [DecidableEq BatchChal] {d q : ℕ} :
    DecidableEq (LigeroIOPChal BatchChal d q)
    @[instance_reducible]
    instance Cslib.Crypto.Protocols.instFintypeLigeroIOPChal {BatchChal : Type} [Fintype BatchChal] {d q : ℕ} :
    Fintype (LigeroIOPChal BatchChal d q)
    instance Cslib.Crypto.Protocols.instNonemptyLigeroIOPChal {BatchChal : Type} [Nonempty BatchChal] {d q : ℕ} :
    Nonempty (LigeroIOPChal BatchChal d q)
    theorem Cslib.Crypto.Protocols.card_ligeroIOPChal {BatchChal : Type} [Fintype BatchChal] (d q : ℕ) :
    Fintype.card (LigeroIOPChal BatchChal d q) = Fintype.card BatchChal * (2 ^ d) ^ q

    Exact cardinality of LigeroIOPChal BatchChal d q.

    def Cslib.Crypto.Protocols.rsBatchProximityDecide {F BatchChal : Type} [Semiring F] [DecidableEq F] {m d : ℕ} (k : ℕ) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) (M : Matrix (Fin m) (Fin (2 ^ d)) F) (chals : Fin 2 → LigeroIOPChal BatchChal d q) (answers : List F) :

    Verifier decision function of rsBatchProximityIOP: checks that answers has length k and verifies ligeroColumnCheck at all q queried columns (chals 1).queryIdxs s.

    theorem Cslib.Crypto.Protocols.rsBatchProximityDecide_congr_cols {F BatchChal : Type} [Semiring F] [DecidableEq F] {m d : ℕ} (k : ℕ) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) {M₁ M₂ : Matrix (Fin m) (Fin (2 ^ d)) F} (chals : Fin 2 → LigeroIOPChal BatchChal d q) (answers : List F) (hcols : ∀ (s : Fin q) (i : Fin m), M₁ i ((chals 1).queryIdxs s) = M₂ i ((chals 1).queryIdxs s)) :
    rsBatchProximityDecide k α q weights M₁ chals answers = rsBatchProximityDecide k α q weights M₂ chals answers

    Query locality of rsBatchProximityDecide: the decision depends on M only at the q queried columns (chals 1).queryIdxs s (s : Fin q).

    def Cslib.Crypto.Protocols.rsBatchProximityIOP {F BatchChal : Type} [Semiring F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) :
    BCS.PublicCoinIOP 2 d (Matrix (Fin m) (Fin (2 ^ d)) F) (Matrix (Fin m) (Fin k) F) F (LigeroIOPChal BatchChal d q)

    2-round batched Reed–Solomon proximity PublicCoinIOP (k ≤ 2 ^ d over domain Fin (2 ^ d)):

    • Round 0: zero announcement table (0 openings), followed by batching challenge (chals 0).batchChal.
    • Round 1: honest prover commits the combined message ligeroRowComb r U : Fin k → F in the first k positions of OracleTable d F; verifier opens those k positions (queries.length = k) and checks ligeroColumnCheck at the q columns (chals 1).queryIdxs.
    @[reducible, inline]
    abbrev Cslib.Crypto.Protocols.rsAffineBatchProximityIOP {F : Type} [Semiring F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) :
    BCS.PublicCoinIOP 2 d (Matrix (Fin m) (Fin (2 ^ d)) F) (Matrix (Fin m) (Fin k) F) F (LigeroIOPChal (Fin m → F) d q)

    Full-vector (Fin m → F) specialization of rsBatchProximityIOP.

    @[reducible, inline]
    abbrev Cslib.Crypto.Protocols.rsCurveBatchProximityIOP {F : Type} [Semiring F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) :
    BCS.PublicCoinIOP 2 d (Matrix (Fin m) (Fin (2 ^ d)) F) (Matrix (Fin m) (Fin k) F) F (LigeroIOPChal F d q)

    Single-scalar power (z : F) specialization of rsBatchProximityIOP.

    @[simp]
    theorem Cslib.Crypto.Protocols.length_rsBatchProximityIOP_queries {F BatchChal : Type} [Semiring F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) (M : Matrix (Fin m) (Fin (2 ^ d)) F) (chals : Fin 2 → LigeroIOPChal BatchChal d q) :
    ((rsBatchProximityIOP m hk α q weights).queries M chals).length = k
    theorem Cslib.Crypto.Protocols.iopVerify_rsBatchProximityIOP_eq_true_iff {F BatchChal : Type} [Semiring F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) (M : Matrix (Fin m) (Fin (2 ^ d)) F) (chals : Fin 2 → LigeroIOPChal BatchChal d q) (oracles : Fin 2 → BCS.OracleTable d F) :
    BCS.iopVerify (rsBatchProximityIOP m hk α q weights) M chals oracles = true ↔ ∀ (s : Fin q), ligeroColumnCheck (reedSolomonGenerator α k) M (weights (chals 0).batchChal) (fun (t : Fin k) => oracles 1 ⟨↑t, ⋯⟩) ((chals 1).queryIdxs s) = true

    Pointwise characterization of iopVerify for rsBatchProximityIOP.

    theorem Cslib.Crypto.Protocols.rsBatchProximityIOP_complete {F BatchChal : Type} [Semiring F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) :

    Perfect IOP completeness of rsBatchProximityIOP.

    theorem Cslib.Crypto.Protocols.rsBatchProximityBCS_honestROMGame_eq_pure_true {F BatchChal : Type} [Semiring F] [DecidableEq F] [DecidableEq BatchChal] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) (encSym : F → List Bool) {M : Matrix (Fin m) (Fin (2 ^ d)) F} {U : Matrix (Fin m) (Fin k) F} (hrel : ligeroCodewordRel m (reedSolomonGenerator α k) M U) (σ : ℕ) :
    BCS.bcsHonestROMGame (rsBatchProximityIOP m hk α q weights) encSym M U σ = PMF.pure true

    Two-channel BCS random-oracle completeness of rsBatchProximityIOP.

    theorem Cslib.Crypto.Protocols.isCostBounded_bcsMTCost_rsBatchProximityVerifyROM {F BatchChal : Type} [Semiring F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q : ℕ) (weights : BatchChal → Fin m → F) (encSym : F → List Bool) (M : Matrix (Fin m) (Fin (2 ^ d)) F) (prf : BCS.BCSProof 2 F) {L_path : ℕ} (hops : ∀ op ∈ prf.openings, op.path.length ≤ L_path) :
    OracleComp.IsCostBounded BCS.bcsMTCost (BCS.bcsVerifyROM (rsBatchProximityIOP m hk α q weights) encSym M prf) (k * (L_path + 1))

    BCS random-oracle verifier Merkle hash query bound for rsBatchProximityIOP: when all opened authentication paths have length at most L_path, bcsVerifyROM makes at most k * (L_path + 1) Merkle hash queries.

    def Cslib.Crypto.Protocols.rsBatchDoomed {F BatchChal : Type} [Field F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q e : ℕ) (weights : BatchChal → Fin m → F) (M : Matrix (Fin m) (Fin (2 ^ d)) F) :
    List (BCS.OracleTable d F × LigeroIOPChal BatchChal d q) → Prop

    Doomed-prefix predicate for rsBatchProximityIOP.

    def Cslib.Crypto.Protocols.rsBatchGoodStep {F BatchChal : Type} [Field F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q e : ℕ) (weights : BatchChal → Fin m → F) (M : Matrix (Fin m) (Fin (2 ^ d)) F) (pref : List (BCS.OracleTable d F × LigeroIOPChal BatchChal d q)) (π : BCS.OracleTable d F) (chal : LigeroIOPChal BatchChal d q) :

    Non-escaping round step predicate for rsBatchProximityIOP.

    theorem Cslib.Crypto.Protocols.rsBatchProximityIOP_rbrSound {F BatchChal : Type} [Field F] [DecidableEq F] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q e : ℕ) (weights : BatchChal → Fin m → F) :
    BCS.IOPRoundByRoundSoundness (rsBatchProximityIOP m hk α q weights) (ligeroProximityLang m (reedSolomonGenerator α k) e) (rsBatchDoomed m hk α q e weights) (rsBatchGoodStep m hk α q e weights)

    Unconditional IOPRoundByRoundSoundness of rsBatchProximityIOP at any proximity radius e : ℕ.

    theorem Cslib.Crypto.Protocols.rsBatchProximityIOP_interactive_le {F BatchChal : Type} [Field F] [DecidableEq F] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q e : ℕ) (weights : BatchChal → Fin m → F) {ε_row : ENNReal} (hrow : ∀ M ∉ ligeroProximityLang m (reedSolomonGenerator α k) e, (Probability.PMF.uniformOfFintype BatchChal).toOuterMeasure {b : BatchChal | ∃ cw ∈ Code.reedSolomon α k, hammingDist (Matrix.vecMul (weights b) M) cw ≤ e} ≤ ε_row) {M : Matrix (Fin m) (Fin (2 ^ d)) F} (hM : M ∉ ligeroProximityLang m (reedSolomonGenerator α k) e) (P : BCS.InteractiveIOPProver d F (LigeroIOPChal BatchChal d q)) :
    (BCS.iopInteractiveGame (rsBatchProximityIOP m hk α q weights) M P) true ≤ ε_row + (↑(2 ^ d - (e + 1)) / 2 ^ d) ^ q

    Interactive IOP soundness of rsBatchProximityIOP against any adaptive (possibly randomized) cheating IOP prover P given row-batching escape bound ε_row.

    theorem Cslib.Crypto.Protocols.rsBatchProximityBCS_romSoundness_bound {F BatchChal : Type} [Field F] [DecidableEq F] [DecidableEq BatchChal] [Fintype BatchChal] [Nonempty BatchChal] (m : ℕ) {d k : ℕ} (hk : k ≤ 2 ^ d) (α : Fin (2 ^ d) → F) (q e : ℕ) (weights : BatchChal → Fin m → F) {ε_row : ENNReal} (hrow : ∀ M ∉ ligeroProximityLang m (reedSolomonGenerator α k) e, (Probability.PMF.uniformOfFintype BatchChal).toOuterMeasure {b : BatchChal | ∃ cw ∈ Code.reedSolomon α k, hammingDist (Matrix.vecMul (weights b) M) cw ≤ e} ≤ ε_row) {encSym : F → List Bool} {decSym : List Bool → F} (hdec : Function.LeftInverse decSym encSym) (defaultSym : F) (σ : ℕ) {P : OracleComp (BCS.BCSROMSpec (Matrix (Fin m) (Fin (2 ^ d)) F) (LigeroIOPChal BatchChal d q)) (Matrix (Fin m) (Fin (2 ^ d)) F × BCS.BCSProof 2 F)} {t_MT t_FS q_V : ℕ} (hMT : OracleComp.IsCostBounded BCS.bcsMTCost P t_MT) (hFS : OracleComp.IsCostBounded BCS.bcsFSCost P t_FS) (hV : ∀ (M : Matrix (Fin m) (Fin (2 ^ d)) F) (prf : BCS.BCSProof 2 F), (M, prf) ∈ P.support → OracleComp.IsCostBounded BCS.bcsMTCost (BCS.bcsVerifyROM (rsBatchProximityIOP m hk α q weights) encSym M prf) q_V) :
    (BCS.bcsSoundnessGame (rsBatchProximityIOP m hk α q weights) encSym (ligeroProximityLang m (reedSolomonGenerator α k) e) P σ) true ≤ ↑(t_FS + 2) * (max ε_row ((↑(2 ^ d - (e + 1)) / 2 ^ d) ^ q) + ↑(t_FS + 2) * (1 / ↑(Fintype.card BatchChal * (2 ^ d) ^ q))) + ↑(t_MT + q_V) * (↑(3 * (t_MT + q_V) + 2 * (t_FS + 2)) * (1 / 2 ^ σ))

    General adaptive two-channel BCS random-oracle soundness bound for rsBatchProximityIOP given any row-batching escape bound ε_row.

    theorem Cslib.Crypto.Protocols.rsAffineBatchProximityBCS_romSoundness_unique {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {d k q e : ℕ} (hk : k ≤ 2 ^ d) {α : Fin (2 ^ d) → F} (hα : Function.Injective α) (hunique : 2 * e + k ≤ 2 ^ d) {encSym : F → List Bool} {decSym : List Bool → F} (hdec : Function.LeftInverse decSym encSym) (defaultSym : F) (σ : ℕ) {P : OracleComp (BCS.BCSROMSpec (Matrix (Fin m) (Fin (2 ^ d)) F) (LigeroIOPChal (Fin m → F) d q)) (Matrix (Fin m) (Fin (2 ^ d)) F × BCS.BCSProof 2 F)} {t_MT t_FS q_V : ℕ} (hMT : OracleComp.IsCostBounded BCS.bcsMTCost P t_MT) (hFS : OracleComp.IsCostBounded BCS.bcsFSCost P t_FS) (hV : ∀ (M : Matrix (Fin m) (Fin (2 ^ d)) F) (prf : BCS.BCSProof 2 F), (M, prf) ∈ P.support → OracleComp.IsCostBounded BCS.bcsMTCost (BCS.bcsVerifyROM (rsAffineBatchProximityIOP m hk α q) encSym M prf) q_V) :
    (BCS.bcsSoundnessGame (rsAffineBatchProximityIOP m hk α q) encSym (ligeroProximityLang m (reedSolomonGenerator α k) e) P σ) true ≤ ↑(t_FS + 2) * (max (2 ^ d / ↑(Fintype.card F)) ((↑(2 ^ d - (e + 1)) / 2 ^ d) ^ q) + ↑(t_FS + 2) * (1 / ↑(Fintype.card F ^ m * (2 ^ d) ^ q))) + ↑(t_MT + q_V) * (↑(3 * (t_MT + q_V) + 2 * (t_FS + 2)) * (1 / 2 ^ σ))

    Two-channel BCS/ROM soundness of rsAffineBatchProximityIOP across the unique-decoding radius (2 * e + k ≤ 2 ^ d).

    theorem Cslib.Crypto.Protocols.rsAffineBatchProximityBCS_romSoundness_johnson_of_eta {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {d k q e : ℕ} {η : ℝ} (hk_pos : 1 ≤ k) (hk : k ≤ 2 ^ d) {α : Fin (2 ^ d) → F} (hα : Function.Injective α) (hη : 0 < η) (he : ↑e / ↑(2 ^ d) ≤ 1 - √(↑k / ↑(2 ^ d)) - η) {encSym : F → List Bool} {decSym : List Bool → F} (hdec : Function.LeftInverse decSym encSym) (defaultSym : F) (σ : ℕ) {P : OracleComp (BCS.BCSROMSpec (Matrix (Fin m) (Fin (2 ^ d)) F) (LigeroIOPChal (Fin m → F) d q)) (Matrix (Fin m) (Fin (2 ^ d)) F × BCS.BCSProof 2 F)} {t_MT t_FS q_V : ℕ} (hMT : OracleComp.IsCostBounded BCS.bcsMTCost P t_MT) (hFS : OracleComp.IsCostBounded BCS.bcsFSCost P t_FS) (hV : ∀ (M : Matrix (Fin m) (Fin (2 ^ d)) F) (prf : BCS.BCSProof 2 F), (M, prf) ∈ P.support → OracleComp.IsCostBounded BCS.bcsMTCost (BCS.bcsVerifyROM (rsAffineBatchProximityIOP m hk α q) encSym M prf) q_V) :
    (BCS.bcsSoundnessGame (rsAffineBatchProximityIOP m hk α q) encSym (ligeroProximityLang m (reedSolomonGenerator α k) e) P σ) true ≤ ↑(t_FS + 2) * (max (ENNReal.ofReal (115200 * ↑(2 ^ d) ^ 2 / (↑k / ↑(2 ^ d) * η ^ 6 * ↑(Fintype.card F)))) ((↑(2 ^ d - (e + 1)) / 2 ^ d) ^ q) + ↑(t_FS + 2) * (1 / ↑(Fintype.card F ^ m * (2 ^ d) ^ q))) + ↑(t_MT + q_V) * (↑(3 * (t_MT + q_V) + 2 * (t_FS + 2)) * (1 / 2 ^ σ))

    Two-channel BCS/ROM soundness of rsAffineBatchProximityIOP up to 1 - √ρ - η (original explicit-constant variant) (1 ≤ k ≤ 2 ^ d, m-independent proximity escape error).

    theorem Cslib.Crypto.Protocols.rsCurveBatchProximityBCS_romSoundness_unique {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {d k q e : ℕ} (hk : k ≤ 2 ^ d) {α : Fin (2 ^ d) → F} (hα : Function.Injective α) (hunique : 2 * e + k ≤ 2 ^ d) {encSym : F → List Bool} {decSym : List Bool → F} (hdec : Function.LeftInverse decSym encSym) (defaultSym : F) (σ : ℕ) {P : OracleComp (BCS.BCSROMSpec (Matrix (Fin m) (Fin (2 ^ d)) F) (LigeroIOPChal F d q)) (Matrix (Fin m) (Fin (2 ^ d)) F × BCS.BCSProof 2 F)} {t_MT t_FS q_V : ℕ} (hMT : OracleComp.IsCostBounded BCS.bcsMTCost P t_MT) (hFS : OracleComp.IsCostBounded BCS.bcsFSCost P t_FS) (hV : ∀ (M : Matrix (Fin m) (Fin (2 ^ d)) F) (prf : BCS.BCSProof 2 F), (M, prf) ∈ P.support → OracleComp.IsCostBounded BCS.bcsMTCost (BCS.bcsVerifyROM (rsCurveBatchProximityIOP m hk α q) encSym M prf) q_V) :
    (BCS.bcsSoundnessGame (rsCurveBatchProximityIOP m hk α q) encSym (ligeroProximityLang m (reedSolomonGenerator α k) e) P σ) true ≤ ↑(t_FS + 2) * (max (↑((m - 1) * 2 ^ d) / ↑(Fintype.card F)) ((↑(2 ^ d - (e + 1)) / 2 ^ d) ^ q) + ↑(t_FS + 2) * (1 / ↑(Fintype.card F * (2 ^ d) ^ q))) + ↑(t_MT + q_V) * (↑(3 * (t_MT + q_V) + 2 * (t_FS + 2)) * (1 / 2 ^ σ))

    Two-channel BCS/ROM soundness of single-scalar rsCurveBatchProximityIOP across the unique-decoding radius (2 * e + k ≤ 2 ^ d).

    theorem Cslib.Crypto.Protocols.rsCurveBatchProximityBCS_romSoundness_johnson_of_eta {F : Type} [Field F] [Fintype F] [DecidableEq F] (m : ℕ) {d k q e : ℕ} {η : ℝ} (hk_pos : 1 ≤ k) (hk : k ≤ 2 ^ d) {α : Fin (2 ^ d) → F} (hα : Function.Injective α) (hη : 0 < η) (he : ↑e / ↑(2 ^ d) ≤ 1 - √(↑k / ↑(2 ^ d)) - η) {encSym : F → List Bool} {decSym : List Bool → F} (hdec : Function.LeftInverse decSym encSym) (defaultSym : F) (σ : ℕ) {P : OracleComp (BCS.BCSROMSpec (Matrix (Fin m) (Fin (2 ^ d)) F) (LigeroIOPChal F d q)) (Matrix (Fin m) (Fin (2 ^ d)) F × BCS.BCSProof 2 F)} {t_MT t_FS q_V : ℕ} (hMT : OracleComp.IsCostBounded BCS.bcsMTCost P t_MT) (hFS : OracleComp.IsCostBounded BCS.bcsFSCost P t_FS) (hV : ∀ (M : Matrix (Fin m) (Fin (2 ^ d)) F) (prf : BCS.BCSProof 2 F), (M, prf) ∈ P.support → OracleComp.IsCostBounded BCS.bcsMTCost (BCS.bcsVerifyROM (rsCurveBatchProximityIOP m hk α q) encSym M prf) q_V) :
    (BCS.bcsSoundnessGame (rsCurveBatchProximityIOP m hk α q) encSym (ligeroProximityLang m (reedSolomonGenerator α k) e) P σ) true ≤ ↑(t_FS + 2) * (max (ENNReal.ofReal (115200 * ↑(m - 1) * ↑(2 ^ d) ^ 2 / (↑k / ↑(2 ^ d) * η ^ 6 * ↑(Fintype.card F)))) ((↑(2 ^ d - (e + 1)) / 2 ^ d) ^ q) + ↑(t_FS + 2) * (1 / ↑(Fintype.card F * (2 ^ d) ^ q))) + ↑(t_MT + q_V) * (↑(3 * (t_MT + q_V) + 2 * (t_FS + 2)) * (1 / 2 ^ σ))

    Two-channel BCS/ROM soundness of single-scalar rsCurveBatchProximityIOP up to 1 - √ρ - η (original explicit-constant variant).