Documentation

CslibFrontier.Crypto.Protocols.VOLE.Basic

Vector Oblivious Linear Evaluation (VOLE), IT-MACs, and a Linear Sigma Protocol #

Vector Oblivious Linear Evaluation (VOLE) ([BCG+19]; [BBDdSG+23c]) is a two-party correlation generator over a commutative ring R: for a vector length n, the sender receives vectors (u, v) : (Fin n → R) × (Fin n → R) and the receiver receives a global scalar MAC key Δ : R together with a tag vector w : Fin n → R satisfying the information-theoretic MAC (IT-MAC) relation

∀ i, w i = u i * Δ + v i.

VOLE correlations are additively homomorphic (VOLECorrelation.add, VOLECorrelation.smul, VOLECorrelation.addConst, VOLECorrelation.Valid.linearComb). To commit to an arbitrary secret witness x : Fin n → R using a random VOLE correlation (u, v), the prover sends the correction vector δ = x - u (voleCommitWitness), which is uniformly distributed and statistically independent of x (voleCommitWitness_uniform, voleCommitWitness_indep), and the receiver adjusts its tags to w' i = w i + δ i * Δ = x i * Δ + v i (voleAdjustReceiver).

Over a field F, IT-MAC openings are unconditionally binding up to soundness error 1 / |F|: if a cheating prover opens x' ≠ x, at most one global key Δ ∈ F accepts the opening (voleOpen_unique_delta_of_ne, card_filter_voleVerifyOpening_le_one, toOuterMeasure_voleVerifyOpening_le). Multiplication gates satisfy the Quicksilver / VOLE degree-2 algebraic identity (voleMulCheck_sub_eq, voleMulCheck), which collapses to a relation linear in Δ whenever x * y = z.

voleInTheHeadSigma is SigmaProtocol.linear on Fin n → ZMod q (voleInTheHeadSigma_eq_linear): the response to the challenge c is the tag vector of voleSample x v (ι c) for the witness x and a uniform mask v. It inherits completeness, special soundness (for prime q) and special HVZK from that protocol; this does not establish VOLE-in-the-head security ([BBDdSG+23c]).

Main definitions #

Main results #

References #

VOLE Correlations and Ideal Functionality #

A Vector Oblivious Linear Evaluation (VOLE) correlation of length n over R ([BCG+19]; [BBDdSG+23c]). The sender holds (u, v) and the receiver holds (delta, w).

  • u : Fin n → R

    The sender's vector of authenticated ring elements.

  • v : Fin n → R

    The sender's vector of additive MAC masks.

  • delta : R

    The receiver's global scalar MAC key Δ.

  • w : Fin n → R

    The receiver's vector of MAC tags.

Instances For
    theorem Cslib.Crypto.Protocols.VOLE.VOLECorrelation.ext_iff {R : Type u} {n : ℕ} {x y : VOLECorrelation R n} :
    x = y ↔ x.u = y.u ∧ x.v = y.v ∧ x.delta = y.delta ∧ x.w = y.w
    theorem Cslib.Crypto.Protocols.VOLE.VOLECorrelation.ext {R : Type u} {n : ℕ} {x y : VOLECorrelation R n} (u : x.u = y.u) (v : x.v = y.v) (delta : x.delta = y.delta) (w : x.w = y.w) :
    x = y
    def Cslib.Crypto.Protocols.VOLE.instDecidableEqVOLECorrelation.decEq {R✝ : Type u_1} {n✝ : ℕ} [DecidableEq R✝] (x✝ x✝¹ : VOLECorrelation R✝ n✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    @[instance_reducible]

    The sender's view (u, v) of a VOLE correlation.

    The receiver's view (Δ, w) of a VOLE correlation.

    The VOLE correlation invariant ∀ i, w i = u i * Δ + v i.

    Instances For
      def Cslib.Crypto.Protocols.VOLE.voleSample {R : Type u} [CommRing R] {n : ℕ} (u v : Fin n → R) (delta : R) :

      Construct a valid VOLE correlation from sender vectors (u, v) and receiver key delta.

      @[simp]
      theorem Cslib.Crypto.Protocols.VOLE.voleSample_u {R : Type u} [CommRing R] {n : ℕ} (u v : Fin n → R) (delta : R) :
      (voleSample u v delta).u = u
      @[simp]
      theorem Cslib.Crypto.Protocols.VOLE.voleSample_v {R : Type u} [CommRing R] {n : ℕ} (u v : Fin n → R) (delta : R) :
      (voleSample u v delta).v = v
      @[simp]
      theorem Cslib.Crypto.Protocols.VOLE.voleSample_delta {R : Type u} [CommRing R] {n : ℕ} (u v : Fin n → R) (delta : R) :
      (voleSample u v delta).delta = delta
      @[simp]
      theorem Cslib.Crypto.Protocols.VOLE.voleSample_w {R : Type u} [CommRing R] {n : ℕ} (u v : Fin n → R) (delta : R) (i : Fin n) :
      (voleSample u v delta).w i = u i * delta + v i
      @[simp]
      theorem Cslib.Crypto.Protocols.VOLE.valid_voleSample {R : Type u} [CommRing R] {n : ℕ} (u v : Fin n → R) (delta : R) :
      (voleSample u v delta).Valid

      Every correlation constructed by voleSample satisfies VOLECorrelation.Valid.

      The ideal VOLE functionality distribution over a finite commutative ring R: sample u, v : Fin n → R and delta : R independently and uniformly, and set w i = u i * delta + v i.

      Every sample in the support of voleIdealDist R n satisfies the VOLE invariant Valid.

      A correlation belongs to the support of voleIdealDist R n if and only if it is Valid.

      Under voleIdealDist R n, the receiver's global key delta is uniformly distributed in R.

      Linear Homomorphism and VOLE Witness Commitment #

      Componentwise addition of two VOLE correlations sharing the same global key delta.

      Public scalar multiplication of a VOLE correlation by a : R.

      Public constant shift of a VOLE correlation by a : Fin n → R: adds a to u and a i * delta to w i while keeping the MAC mask v unchanged.

      theorem Cslib.Crypto.Protocols.VOLE.VOLECorrelation.Valid.add {R : Type u} [CommRing R] {n : ℕ} {c₁ c₂ : VOLECorrelation R n} (h₁ : c₁.Valid) (h₂ : c₂.Valid) (hdelta : c₁.delta = c₂.delta) :
      (c₁.add c₂).Valid

      Componentwise addition preserves Valid when both correlations share the same delta.

      Public scalar multiplication preserves Valid.

      Public constant addition preserves Valid.

      theorem Cslib.Crypto.Protocols.VOLE.VOLECorrelation.Valid.linearComb {R : Type u} [CommRing R] {n : ℕ} {c : VOLECorrelation R n} (hc : c.Valid) (coeff : Fin n → R) :
      ∑ i : Fin n, coeff i * c.w i = (∑ i : Fin n, coeff i * c.u i) * c.delta + ∑ i : Fin n, coeff i * c.v i

      Any public linear combination ∑ i, coeff i * w i of valid VOLE tags is a valid IT-MAC tag for ∑ i, coeff i * u i with MAC mask ∑ i, coeff i * v i.

      def Cslib.Crypto.Protocols.VOLE.voleCommitWitness {R : Type u} [CommRing R] {n : ℕ} (x u : Fin n → R) :
      Fin n → R

      VOLE witness commitment (mask derandomization): to commit to a secret witness x : Fin n → R using a sender VOLE vector u : Fin n → R, the prover sends the correction vector δ = x - u.

      def Cslib.Crypto.Protocols.VOLE.voleAdjustReceiver {R : Type u} [CommRing R] {n : ℕ} (w d : Fin n → R) (delta : R) :
      Fin n → R

      Receiver tag adjustment: given initial VOLE tags w : Fin n → R, correction vector d : Fin n → R, and global key delta : R, the receiver computes w' i = w i + d i * delta.

      Update a VOLE correlation to authenticate a chosen witness x : Fin n → R via voleCommitWitness and voleAdjustReceiver.

      @[simp]
      theorem Cslib.Crypto.Protocols.VOLE.voleAdjustReceiver_voleCommitWitness {R : Type u} [CommRing R] {n : ℕ} {c : VOLECorrelation R n} (hc : c.Valid) (x : Fin n → R) (i : Fin n) :

      After voleCommitWitness and voleAdjustReceiver, the receiver's adjusted tags satisfy the IT-MAC relation w' i = x i * delta + v i for the witness x.

      Updating a valid VOLE correlation with any witness x via commitWitness produces a valid VOLE correlation authenticating x.

      Perfect hiding of VOLE witness commitment: for every witness x : Fin n → R, when the sender's VOLE vector u is drawn uniformly from Fin n → R, the correction message voleCommitWitness x u = x - u is uniformly distributed on Fin n → R.

      Statistical independence of VOLE witness commitment: any two witnesses x₁, x₂ : Fin n → R induce identical correction-message distributions under a uniform VOLE mask u.

      IT-MAC Opening Verification, Unforgeability, and Degree-2 Multiplication Check #

      def Cslib.Crypto.Protocols.VOLE.voleVerifyOpening {R : Type u} [CommRing R] {n : ℕ} (w' : Fin n → R) (delta : R) (x' v' : Fin n → R) :

      The receiver accepts an opened value vector x' : Fin n → R and MAC tag vector v' : Fin n → R against adjusted tags w' : Fin n → R and global key delta : R when ∀ i, w' i = x' i * delta + v' i.

      Instances For
        @[instance_reducible]
        instance Cslib.Crypto.Protocols.VOLE.instDecidableVoleVerifyOpeningOfDecidableEq {R : Type u} [CommRing R] {n : ℕ} [DecidableEq R] (w' : Fin n → R) (delta : R) (x' v' : Fin n → R) :
        Decidable (voleVerifyOpening w' delta x' v')

        Honest openings of a valid VOLE correlation are always accepted.

        Honest openings after voleCommitWitness and voleAdjustReceiver are always accepted.

        theorem Cslib.Crypto.Protocols.VOLE.voleOpen_unique_delta_of_ne {n : ℕ} {F : Type u} [Field F] {w' x v x' v' : Fin n → F} {delta : F} {i : Fin n} (htrue : w' i = x i * delta + v i) (hforge : w' i = x' i * delta + v' i) (hne : x' i ≠ x i) :
        delta = (v' i - v i) / (x i - x' i)

        IT-MAC unforgeability at a disagreed coordinate: over a field F, if the true relation is w' i = x i * delta + v i and a forged opening (x', v') with x' i ≠ x i also satisfies w' i = x' i * delta + v' i, then delta is uniquely determined as (v' i - v i) / (x i - x' i).

        theorem Cslib.Crypto.Protocols.VOLE.voleOpen_forger_eq_or_unique_delta {n : ℕ} {F : Type u} [Field F] {w' x v x' v' : Fin n → F} {delta : F} (htrue : voleVerifyOpening w' delta x v) (hforge : voleVerifyOpening w' delta x' v') :
        x' = x ∧ v' = v ∨ ∃ (i : Fin n), x' i ≠ x i ∧ delta = (v' i - v i) / (x i - x' i)

        If both (x, v) and (x', v') pass voleVerifyOpening w' delta, then either x' = x (and v' = v) or there is a coordinate i where x' i ≠ x i and delta = (v' i - v i) / (x i - x' i).

        theorem Cslib.Crypto.Protocols.VOLE.card_filter_voleVerifyOpening_le_one {n : ℕ} {F : Type u} [Field F] [Fintype F] [DecidableEq F] {x v x' v' : Fin n → F} (hne : x' ≠ x) :
        {delta : F | ∀ (i : Fin n), x i * delta + v i = x' i * delta + v' i}.card ≤ 1

        For any forged value x' ≠ x over a finite field F, at most one global key delta : F satisfies the IT-MAC verification equation ∀ i, x i * delta + v i = x' i * delta + v' i.

        theorem Cslib.Crypto.Protocols.VOLE.toOuterMeasure_voleVerifyOpening_le {n : ℕ} {F : Type u} [Field F] [Fintype F] {x v x' v' : Fin n → F} (hne : x' ≠ x) :
        (Probability.PMF.uniformOfFintype F).toOuterMeasure {delta : F | ∀ (i : Fin n), x i * delta + v i = x' i * delta + v' i} ≤ (↑(Fintype.card F))⁻¹

        IT-MAC soundness bound: for any forged witness x' ≠ x and tag vector v', the probability over a uniform global key delta ← PMF.uniformOfFintype F that (x', v') passes verification is at most 1 / Fintype.card F.

        def Cslib.Crypto.Protocols.VOLE.voleMulCrossTerm {R : Type u} [CommRing R] (x v_x y v_y v_z : R) :
        R

        The prover's linear-in-Δ coefficient x * v_y + y * v_x - v_z in the Quicksilver / VOLE degree-2 multiplication check ([BBDdSG+23c]).

        The prover's constant term v_x * v_y in the Quicksilver / VOLE degree-2 multiplication check.

        theorem Cslib.Crypto.Protocols.VOLE.voleMulCheck_sub_eq {R : Type u} [CommRing R] {x y z v_x v_y v_z w_x w_y w_z delta : R} (hwx : w_x = x * delta + v_x) (hwy : w_y = y * delta + v_y) (hwz : w_z = z * delta + v_z) :
        w_x * w_y - w_z * delta = (x * y - z) * delta ^ 2 + voleMulCrossTerm x v_x y v_y v_z * delta + voleMulConstTerm v_x v_y

        Algebraic identity for VOLE multiplication check: for authenticated wires w_x = x * delta + v_x, w_y = y * delta + v_y, and w_z = z * delta + v_z, the quadratic combination w_x * w_y - w_z * delta decomposes into (x * y - z) * delta ^ 2 plus a linear function of delta.

        theorem Cslib.Crypto.Protocols.VOLE.voleMulCheck {R : Type u} [CommRing R] {x y z v_x v_y v_z w_x w_y w_z delta : R} (hwx : w_x = x * delta + v_x) (hwy : w_y = y * delta + v_y) (hwz : w_z = z * delta + v_z) (hxyz : x * y = z) :
        w_x * w_y - w_z * delta = voleMulCrossTerm x v_x y v_y v_z * delta + voleMulConstTerm v_x v_y

        Quicksilver / VOLE degree-2 multiplication check: when x * y = z, the quadratic term vanishes and w_x * w_y - w_z * delta is affine-linear in delta with slope voleMulCrossTerm x v_x y v_y v_z and constant term voleMulConstTerm v_x v_y.

        theorem Cslib.Crypto.Protocols.VOLE.voleMulCheck_iff_of_ne_zero {F : Type u} [Field F] {x y z v_x v_y v_z w_x w_y w_z delta : F} (hwx : w_x = x * delta + v_x) (hwy : w_y = y * delta + v_y) (hwz : w_z = z * delta + v_z) (hdelta : delta ≠ 0) :
        w_x * w_y - w_z * delta = voleMulCrossTerm x v_x y v_y v_z * delta + voleMulConstTerm v_x v_y ↔ x * y = z

        Over a field F, if the prover uses the honest cross and constant terms at a nonzero global key delta ≠ 0, then the multiplication check passes if and only if x * y = z.

        Linear Sigma Protocol in VOLE Notation #

        noncomputable def Cslib.Crypto.Protocols.VOLE.voleInTheHeadSigma {q n : ℕ} [NeZero q] {Y N C : Type} [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → (Fin n → ZMod q) →ₗ[ZMod q] N) (target : Y → N) (ι : C ↪ ZMod q) :
        SigmaProtocol (Fin n → ZMod q) Y N C (Fin n → ZMod q)

        Linear Sigma protocol in VOLE notation (SigmaProtocol.linear) for a linear relation ψ y x = target y over ZMod q with witness x : Fin n → ZMod q:

        1. The prover samples a random VOLE mask vector v ← PMF.uniformOfFintype (Fin n → ZMod q) and commits to the aggregate MAC mask t = ψ y v : N.
        2. The verifier sends a challenge c : C, determining the VOLE global key Δ = ι c : ZMod q.
        3. The prover forms the VOLE correlation voleSample x v (ι c) with sender vectors (x, v) and outputs the receiver's VOLE tag vector w = (voleSample x v (ι c)).w.
        4. The verifier checks that ψ y w equals the IT-MAC tag t + ι c • target y.
        def Cslib.Crypto.Protocols.VOLE.voleInTheHeadExtract {q n : ℕ} {Y N C : Type} (ι : C ↪ ZMod q) :
        Y → N → C → (Fin n → ZMod q) → C → (Fin n → ZMod q) → Fin n → ZMod q

        Witness extractor for voleInTheHeadSigma from two accepting conversations with a common commitment and distinct challenges c ≠ c'.

        noncomputable def Cslib.Crypto.Protocols.VOLE.voleInTheHeadSimulate {q n : ℕ} [NeZero q] {Y N C : Type} [AddCommGroup N] [Module (ZMod q) N] (ψ : Y → (Fin n → ZMod q) →ₗ[ZMod q] N) (target : Y → N) (ι : C ↪ ZMod q) (y : Y) (c : C) :
        PMF (N × (Fin n → ZMod q))

        Simulator for voleInTheHeadSigma: samples a uniform VOLE receiver tag vector w : Fin n → ZMod q and solves the IT-MAC verification equation for the commitment t.

        theorem Cslib.Crypto.Protocols.VOLE.voleSample_w_eq_linear_respond {q n : ℕ} {C : Type} (ι : C ↪ ZMod q) (x v : Fin n → ZMod q) (c : C) :
        (voleSample x v (ι c)).w = v + ι c • x

        The voleInTheHeadSigma response (voleSample x v (ι c)).w equals the linear Sigma response v + ι c • x.

        theorem Cslib.Crypto.Protocols.VOLE.voleInTheHeadSigma_eq_linear {q n : ℕ} [NeZero q] {Y N C : Type} [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → (Fin n → ZMod q) →ₗ[ZMod q] N) (target : Y → N) (ι : C ↪ ZMod q) :
        voleInTheHeadSigma ψ target ι = SigmaProtocol.linear ψ target ι

        voleInTheHeadSigma coincides with SigmaProtocol.linear on Fin n → ZMod q.

        @[simp]
        theorem Cslib.Crypto.Protocols.VOLE.voleInTheHeadSigma_accepts_iff {q n : ℕ} [NeZero q] {Y N C : Type} [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → (Fin n → ZMod q) →ₗ[ZMod q] N) (target : Y → N) (ι : C ↪ ZMod q) {y : Y} {t : N} {c : C} {w : Fin n → ZMod q} :
        (voleInTheHeadSigma ψ target ι).Accepts y t c w ↔ (ψ y) w = t + ι c • target y
        theorem Cslib.Crypto.Protocols.VOLE.voleInTheHeadSigma_complete {q n : ℕ} [NeZero q] {Y N C : Type} [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → (Fin n → ZMod q) →ₗ[ZMod q] N) (target : Y → N) (ι : C ↪ ZMod q) :
        (voleInTheHeadSigma ψ target ι).Complete fun (x : Fin n → ZMod q) (y : Y) => (ψ y) x = target y

        Completeness of voleInTheHeadSigma, from SigmaProtocol.linear_complete.

        theorem Cslib.Crypto.Protocols.VOLE.voleInTheHeadSigma_specialSoundness {q n : ℕ} [NeZero q] {Y N C : Type} [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → (Fin n → ZMod q) →ₗ[ZMod q] N) (target : Y → N) (ι : C ↪ ZMod q) [Fact (Nat.Prime q)] :
        (voleInTheHeadSigma ψ target ι).SpecialSoundness (fun (x : Fin n → ZMod q) (y : Y) => (ψ y) x = target y) (voleInTheHeadExtract ι)

        Special soundness of voleInTheHeadSigma when q is prime, from SigmaProtocol.linear_specialSoundness.

        theorem Cslib.Crypto.Protocols.VOLE.voleInTheHeadSigma_specialHVZK {q n : ℕ} [NeZero q] {Y N C : Type} [AddCommGroup N] [Module (ZMod q) N] [DecidableEq N] (ψ : Y → (Fin n → ZMod q) →ₗ[ZMod q] N) (target : Y → N) (ι : C ↪ ZMod q) :
        (voleInTheHeadSigma ψ target ι).SpecialHVZK (fun (x : Fin n → ZMod q) (y : Y) => (ψ y) x = target y) (voleInTheHeadSimulate ψ target ι)

        Special honest-verifier zero knowledge of voleInTheHeadSigma, from SigmaProtocol.linear_specialHVZK.