Documentation

CslibFrontier.Crypto.Protocols.MPC.SPDZ

SPDZ Authenticated Secret Sharing, Online Operations, and Batch MACCheck Soundness #

This module formalizes the SPDZ authenticated secret-sharing representation and its linear and Beaver-triple online operations ([DPSZ12]), together with the commit-then-open batch MACCheck protocol and the $2 / p$ bound for its standalone cheating-equation game over prime fields ZMod p ([DKL+13]).

Source map #

Locators refer to the IACR ePrint full versions: [DPSZ12] is ePrint 2011/535 (revision of 2012-11-05) and [DKL+13] is ePrint 2012/642 (revision of 2013-08-20). LNCS page and figure numbers are not verified.

Contents #

  1. SPDZ Authenticated Secret Sharing (AuthShare): represents an authenticated value $\langle a \rangle = (\delta, (a_0, \dots, a_{n-1}), (\gamma_0, \dots, \gamma_{n-1}))$ over ZMod p with reconstructed secret $a = \sum_i a_i$, MAC sum $\gamma = \sum_i \gamma_i$, and global MAC invariant AuthShare.Valid alpha ($\gamma = \alpha \cdot (a + \delta)$).
  2. Linear & Online Beaver Operations (AuthShare.add, AuthShare.neg, AuthShare.sub, AuthShare.smul, AuthShare.addConst, AuthShare.mulOnline): local share addition, negation, subtraction, public scalar multiplication, public constant addition (updating party 0's value share and shifting the public modifier $\delta \mapsto \delta - e$), and online Beaver multiplication $\langle x \cdot y \rangle = e \cdot \langle a \rangle + d \cdot \langle b \rangle + \langle c \rangle + d \cdot e$, all preserving AuthShare.Valid alpha, matching Cslib.Crypto.Protocols.MPC.Beaver.beaverMulShare on each party's value share (AuthShare.valShares_mulOnline_eq_beaverMulShare), and reconstructing $x \cdot y$ when $d = x - a$, $e = y - b$, and $c = a \cdot b$ (AuthShare.secret_mulOnline_eq_mul).
  3. Batch MACCheck Protocol & Completeness (OpenedValue, PartyCheckInput, ResidualOpening, checkResidual, macCheckProtocol, eval_snd_macCheckProtocol_eq_pure_true): two-round commit-then-open protocol over CslibFrontier.Crypto.Protocols.MPC.Basic and CslibFrontier.Crypto.Protocols.MPC.Broadcast checking a batch of $T$ publicly opened values via linear combination weights $e \in (\mathbb{Z}_p)^T$ supplied as inputs (steps 5–9 of [DKL+13], App. D.1, Fig. 10, adapted to the $\delta$-representation). Honest executions satisfy $\sum_i \sigma_i = 0$ (sum_checkResidual_eq_zero) and accept with probability 1.
  4. Residual Cheating Equation & $2 / p$ Standalone Cheating-Equation Game Bound (sum_checkResidual_eq_neg_mul, sum_checkResidual_add_eq_zero_iff, linearCombZeroGame, macCheckSoundnessGame, eval_macCheckSoundnessGame_le, eval_macCheckSoundnessAdvGame_le): for prime p and any nonzero vector of opening errors err ≠ 0 (even against an adaptive residual shift deltaShift : (Fin T → ZMod p) → ZMod p chosen as a function of the public weights e, or generated from prior randomized adversary state adv : ProbComp S independent of alpha), the MACCheck cheating equation alpha * linearCombAddHom err e = deltaShift e (standalone game) holds with probability at most $2 / p$ ([DKL+13], §5.1, Lemma 1; App. D.3):

Scope note: macCheckProtocol is parameterized over an abstract deterministic commitment map commit : ZMod p → Coins → Comm (checking equality of Round-1 commitments and Round-2 openings); weights are supplied as inputs (PartyCheckInput.weights) whose joint generation after the openings is not modeled, alpha is not sampled by the protocol, and the AddCommMonoid structures on Coins, Comm, and ResidualOpening are only used by the broadcastSteps combinator. The games macCheckSoundnessGame and macCheckSoundnessAdvGame analyze the standalone algebraic information-theoretic cheating equation given an independent uniform MAC key $\alpha \in \mathbb{Z}_p$ and public weights $e \in (\mathbb{Z}_p)^T$. The game's $\alpha$ plays the role of an honest party's key share $\alpha_H$, uniform and unknown to the adversary; the corrupt parties' contribution $\alpha_C \cdot L$ is part of deltaShift. The games are analyzed directly, not as an execution of macCheckProtocol, a computational commitment binding reduction, a UC emulation proof, or a polynomial-time simulator certificate. Generalizing the $2 / p$ bound to an arbitrary finite field and removing the AddCommMonoid requirement from broadcastSteps are left as follow-ups.

Main definitions #

Main results #

References #

SPDZ ⟨·⟩-authenticated secret sharing and online operations #

SPDZ authenticated secret sharing ⟨a⟩ = (δ, (a_0, …, a_{n-1}), (γ_0, …, γ_{n-1})) over ZMod p among n parties ([DPSZ12]).

  • delta : ZMod p

    Public modifier δ tracked identically by all parties.

  • valShares : Fin n → ZMod p

    Party i's additive share a_i of the secret a = ∑ i, a_i.

  • macShares : Fin n → ZMod p

    Party i's additive share γ_i of the MAC γ(a) = ∑ i, γ_i.

Instances For
    theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.ext {p n : ℕ} {x y : AuthShare p n} (delta : x.delta = y.delta) (valShares : x.valShares = y.valShares) (macShares : x.macShares = y.macShares) :
    x = y
    def Cslib.Crypto.Protocols.MPC.SPDZ.instDecidableEqAuthShare.decEq {p✝ n✝ : ℕ} (x✝ x✝¹ : AuthShare p✝ n✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    @[instance_reducible]

    Underlying secret a = ∑ i, a_i represented by s.

    Sum γ(a) = ∑ i, γ_i of all n parties' MAC shares.

    Global SPDZ MAC relation ∑ i, γ_i = α * ((∑ i, a_i) + δ) under global key alpha : ZMod p.

    Instances For
      @[instance_reducible]

      Coordinatewise addition ⟨a⟩ + ⟨b⟩ of authenticated shares.

      @[instance_reducible]

      Coordinatewise negation -⟨a⟩ of an authenticated share.

      @[instance_reducible]

      Coordinatewise subtraction ⟨a⟩ - ⟨b⟩ of authenticated shares.

      @[instance_reducible]

      Public scalar multiplication c • ⟨a⟩ of an authenticated share by c : ZMod p.

      Addition of a public constant e : ZMod p to ⟨a⟩ ([DPSZ12]): party 0 adds e to its value share while the public modifier shifts to δ - e, leaving all MAC shares unchanged.

      SPDZ online Beaver multiplication ⟨x * y⟩ = e • ⟨a⟩ + d • ⟨b⟩ + ⟨c⟩ + d * e given authenticated Beaver triple ⟨a⟩, ⟨b⟩, ⟨c⟩ and public masked openings d (claimed x - a) and e (claimed y - b) ([DPSZ12]). The opened scalars d and e are audited in batch by MACCheck.

      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.secret_add {p n : ℕ} (s₁ s₂ : AuthShare p n) :
      (s₁ + s₂).secret = s₁.secret + s₂.secret
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.macSum_add {p n : ℕ} (s₁ s₂ : AuthShare p n) :
      (s₁ + s₂).macSum = s₁.macSum + s₂.macSum
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.delta_add {p n : ℕ} (s₁ s₂ : AuthShare p n) :
      (s₁ + s₂).delta = s₁.delta + s₂.delta
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.secret_sub {p n : ℕ} (s₁ s₂ : AuthShare p n) :
      (s₁ - s₂).secret = s₁.secret - s₂.secret
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.macSum_sub {p n : ℕ} (s₁ s₂ : AuthShare p n) :
      (s₁ - s₂).macSum = s₁.macSum - s₂.macSum
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.delta_sub {p n : ℕ} (s₁ s₂ : AuthShare p n) :
      (s₁ - s₂).delta = s₁.delta - s₂.delta
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.Valid.add {p n : ℕ} {alpha : ZMod p} {s₁ s₂ : AuthShare p n} (h₁ : Valid alpha s₁) (h₂ : Valid alpha s₂) :
      Valid alpha (s₁ + s₂)

      Valid alpha is preserved under share addition s₁ + s₂.

      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.Valid.neg {p n : ℕ} {alpha : ZMod p} {s : AuthShare p n} (hs : Valid alpha s) :
      Valid alpha (-s)

      Valid alpha is preserved under share negation -s.

      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.Valid.sub {p n : ℕ} {alpha : ZMod p} {s₁ s₂ : AuthShare p n} (h₁ : Valid alpha s₁) (h₂ : Valid alpha s₂) :
      Valid alpha (s₁ - s₂)

      Valid alpha is preserved under share subtraction s₁ - s₂.

      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.Valid.smul {p n : ℕ} {alpha : ZMod p} (c : ZMod p) {s : AuthShare p n} (hs : Valid alpha s) :
      Valid alpha (c • s)

      Valid alpha is preserved under public scalar multiplication c • s.

      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.Valid.addConst {p n : ℕ} [NeZero n] {alpha : ZMod p} (e : ZMod p) {s : AuthShare p n} (hs : Valid alpha s) :

      Valid alpha is preserved under public constant addition addConst e s (n > 0).

      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.Valid.mulOnline {p n : ℕ} [NeZero n] {alpha : ZMod p} {sa sb sc : AuthShare p n} (d e : ZMod p) (ha : Valid alpha sa) (hb : Valid alpha sb) (hc : Valid alpha sc) :
      Valid alpha (sa.mulOnline sb sc d e)

      Valid alpha is preserved by mulOnline (n > 0) whenever the triple shares sa, sb, sc satisfy Valid alpha (even for arbitrary candidate public openings d, e).

      def Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.tamperParty {p n : ℕ} (s : AuthShare p n) (i : Fin n) (δ_x δ_t : ZMod p) :

      Corrupt party i submits tampered shares: it adds δ_x to its value share a_i and δ_t to its MAC share γ_i, leaving the public modifier δ and every other party's shares unchanged.

      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.secret_tamperParty {p n : ℕ} (s : AuthShare p n) (i : Fin n) (δ_x δ_t : ZMod p) :
      (s.tamperParty i δ_x δ_t).secret = s.secret + δ_x
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.macSum_tamperParty {p n : ℕ} (s : AuthShare p n) (i : Fin n) (δ_x δ_t : ZMod p) :
      (s.tamperParty i δ_x δ_t).macSum = s.macSum + δ_t
      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.delta_tamperParty {p n : ℕ} (s : AuthShare p n) (i : Fin n) (δ_x δ_t : ZMod p) :
      (s.tamperParty i δ_x δ_t).delta = s.delta
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.valid_tamperParty_iff {p n : ℕ} {alpha : ZMod p} {s : AuthShare p n} (hs : Valid alpha s) (i : Fin n) (δ_x δ_t : ZMod p) :
      Valid alpha (s.tamperParty i δ_x δ_t) ↔ alpha * δ_x = δ_t

      Single-share MAC check characterization: when s is valid under α, party i's tampered submission (a_i + δ_x, γ_i + δ_t) is valid under α if and only if α * δ_x = δ_t.

      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.valShares_mulOnline_eq_beaverMulShare {p n : ℕ} (sa sb sc : AuthShare p n) (d e : ZMod p) (i : Fin n) :
      (sa.mulOnline sb sc d e).valShares i = Beaver.beaverMulShare i (d, e) { a := sa.valShares i, b := sb.valShares i, c := sc.valShares i }

      Each party i's value share in mulOnline agrees with Beaver.beaverMulShare applied to the party's value-share triple ⟨sa.valShares i, sb.valShares i, sc.valShares i⟩.

      @[simp]
      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.secret_mulOnline {p n : ℕ} [NeZero n] (sa sb sc : AuthShare p n) (d e : ZMod p) :
      (sa.mulOnline sb sc d e).secret = e * sa.secret + d * sb.secret + sc.secret + d * e

      Reconstructed secret of mulOnline before substituting d and e.

      theorem Cslib.Crypto.Protocols.MPC.SPDZ.AuthShare.secret_mulOnline_eq_mul {p n : ℕ} [NeZero n] (sx sy sa sb sc : AuthShare p n) (d e : ZMod p) (hd : d = sx.secret - sa.secret) (he : e = sy.secret - sb.secret) (hc : sc.secret = sa.secret * sb.secret) :
      (sa.mulOnline sb sc d e).secret = sx.secret * sy.secret

      Online multiplication correctness ([DPSZ12]): when the public openings satisfy d = sx.secret - sa.secret and e = sy.secret - sb.secret and the triple satisfies sc.secret = sa.secret * sb.secret, mulOnline reconstructs sx.secret * sy.secret.

      Batch MACCheck data structures, residual equations, and commit-then-open protocol #

      Publicly opened value (a'_ℓ, δ_ℓ) audited during SPDZ MACCheck.

      • value : ZMod p

        Claimed public value a'_ℓ reconstructed by opening ⟨a_ℓ⟩.

      • delta : ZMod p

        Public modifier δ_ℓ associated with ⟨a_ℓ⟩.

      Instances For
        theorem Cslib.Crypto.Protocols.MPC.SPDZ.OpenedValue.ext {p : ℕ} {x y : OpenedValue p} (value : x.value = y.value) (delta : x.delta = y.delta) :
        x = y
        @[instance_reducible]

        Party i's local input to a batch MACCheck over T opened values ([DKL+13], App. D.1, Fig. 10).

        • opened : Fin T → OpenedValue p

          The T publicly opened values and modifiers (a'_ℓ, δ_ℓ).

        • macShares : Fin T → ZMod p

          Party i's local MAC shares γ(a_ℓ)_i for ℓ : Fin T.

        • keyShare : ZMod p

          Party i's additive share α_i of the global MAC key α = ∑ i, α_i.

        • weights : Fin T → ZMod p

          Public random linear-combination weights (e_0, …, e_{T-1}).

        Instances For
          theorem Cslib.Crypto.Protocols.MPC.SPDZ.PartyCheckInput.ext {p T : ℕ} {x y : PartyCheckInput p T} (opened : x.opened = y.opened) (macShares : x.macShares = y.macShares) (keyShare : x.keyShare = y.keyShare) (weights : x.weights = y.weights) :
          x = y
          @[instance_reducible]

          Round-2 opening message (σ_j, decommit_j) broadcast by party j in macCheckProtocol.

          • sigma : ZMod p

            Party j's claimed residual share σ_j.

          • decommit : Coins

            Decommitment randomness matching party j's Round-1 commitment.

          Instances For
            theorem Cslib.Crypto.Protocols.MPC.SPDZ.ResidualOpening.ext {p : ℕ} {Coins : Type} {x y : ResidualOpening p Coins} (sigma : x.sigma = y.sigma) (decommit : x.decommit = y.decommit) :
            x = y
            def Cslib.Crypto.Protocols.MPC.SPDZ.instDecidableEqResidualOpening.decEq {p✝ : ℕ} {Coins✝ : Type} [DecidableEq Coins✝] (x✝ x✝¹ : ResidualOpening p✝ Coins✝) :
            Decidable (x✝ = x✝¹)
            @[instance_reducible]
            @[instance_reducible]

            Equivalence between ResidualOpening p Coins and ZMod p × Coins, used to transport AddCommMonoid from ZMod p × Coins for broadcastSteps.

            Party i's local MACCheck residual share σ_i = (∑ ℓ, e_ℓ * γ(a_ℓ)_i) - α_i * (∑ ℓ, e_ℓ * (a'_ℓ + δ_ℓ)): an adaptation of the check σ_i = γ_i - α_i * a of [DKL+13] (App. D.1, Fig. 10) to the δ-representation of [DPSZ12]; at δ = 0 it is the source check.

            def Cslib.Crypto.Protocols.MPC.SPDZ.verifyResiduals {p n : ℕ} {Coins Comm : Type} [DecidableEq Comm] (commit : ZMod p → Coins → Comm) (commits : Fin n → Comm) (openings : Fin n → ResidualOpening p Coins) :

            Verify that every party's Round-2 residual opening matches its Round-1 commitment and that the opened residual shares sum to 0 ([DKL+13], App. D.1, Fig. 10).

            structure Cslib.Crypto.Protocols.MPC.SPDZ.PartyCheckInput.AuthenticFor {p n T : ℕ} (alpha : ZMod p) (shares : Fin T → AuthShare p n) (opened : Fin T → OpenedValue p) (e : Fin T → ZMod p) (inp : Fin n → PartyCheckInput p T) :

            Predicate stating that inp : Fin n → PartyCheckInput p T arises from validly authenticated shares shares : Fin T → AuthShare p n under global key alpha = ∑ i, α_i with common public opened values and common public weights e (allowing opened to differ from the true secrets by err_ℓ = (opened ℓ).value - (shares ℓ).secret). Following [DKL+13], App. D.3, tampering with the corrupt parties' MAC shares is not modeled here; it is absorbed into the adversarial shift deltaOpen / deltaShift.

            • opened_eq (i : Fin n) : (inp i).opened = opened

              Every party sees the same public opened values opened.

            • weights_eq (i : Fin n) : (inp i).weights = e

              Every party uses the same public random weights e.

            • macShares_eq (i : Fin n) (l : Fin T) : (inp i).macShares l = (shares l).macShares i

              Every party holds its corresponding MAC share of each shares ℓ.

            • delta_eq (l : Fin T) : (opened l).delta = (shares l).delta

              Each public modifier (opened ℓ).delta matches (shares ℓ).delta.

            • sum_keyShare : ∑ i : Fin n, (inp i).keyShare = alpha

              The key shares sum to the global MAC key alpha.

            • valid_shares (l : Fin T) : AuthShare.Valid alpha (shares l)

              Each authenticated share in the batch satisfies the SPDZ MAC invariant under alpha.

            structure Cslib.Crypto.Protocols.MPC.SPDZ.PartyCheckInput.Honest {p n T : ℕ} (alpha : ZMod p) (shares : Fin T → AuthShare p n) (opened : Fin T → OpenedValue p) (e : Fin T → ZMod p) (inp : Fin n → PartyCheckInput p T) extends Cslib.Crypto.Protocols.MPC.SPDZ.PartyCheckInput.AuthenticFor alpha shares opened e inp :

            Predicate stating that inp is a completely honest MACCheck instance in which every opened value (opened ℓ).value equals the true shared secret (shares ℓ).secret.

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.sum_checkResidual_eq_neg_mul {p n T : ℕ} {alpha : ZMod p} {shares : Fin T → AuthShare p n} {opened : Fin T → OpenedValue p} {e : Fin T → ZMod p} {inp : Fin n → PartyCheckInput p T} (hauth : PartyCheckInput.AuthenticFor alpha shares opened e inp) :
            ∑ i : Fin n, checkResidual (inp i) = -alpha * (Probability.linearCombAddHom fun (l : Fin T) => (opened l).value - (shares l).secret) e

            Core algebraic residual identity of SPDZ MACCheck (the δ-adapted check of [DKL+13], App. D.1, Fig. 10): when inp is authenticated for shares with claimed public openings opened, ∑ i, checkResidual (inp i) = - alpha * ∑ ℓ, e_ℓ * ((opened ℓ).value - (shares ℓ).secret).

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.sum_checkResidual_eq_zero {p n T : ℕ} {alpha : ZMod p} {shares : Fin T → AuthShare p n} {opened : Fin T → OpenedValue p} {e : Fin T → ZMod p} {inp : Fin n → PartyCheckInput p T} (hhon : PartyCheckInput.Honest alpha shares opened e inp) :
            ∑ i : Fin n, checkResidual (inp i) = 0

            Honest completeness of checkResidual: when all opened values match the true secrets, the parties' residuals sum to 0.

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.sum_checkResidual_add_eq_zero_iff {p n T : ℕ} {alpha : ZMod p} {shares : Fin T → AuthShare p n} {opened : Fin T → OpenedValue p} {e : Fin T → ZMod p} {inp : Fin n → PartyCheckInput p T} (hauth : PartyCheckInput.AuthenticFor alpha shares opened e inp) (deltaOpen : ZMod p) :
            ∑ i : Fin n, checkResidual (inp i) + deltaOpen = 0 ↔ alpha * (Probability.linearCombAddHom fun (l : Fin T) => (opened l).value - (shares l).secret) e = deltaOpen

            Cheating equation equivalence ([DKL+13], App. D.3): adding an adversarial residual shift deltaOpen to the honest residual sum yields 0 if and only if alpha * linearCombAddHom err e = deltaOpen.

            @[reducible]

            Schedule for the two-round commit-then-open macCheckProtocol: Round 1 broadcasts commitments Comm and Round 2 broadcasts ResidualOpening p Coins.

            def Cslib.Crypto.Protocols.MPC.SPDZ.macCheckProtocol (p n T : ℕ) {Coins Comm : Type} [AddCommMonoid Coins] [AddCommMonoid Comm] [DecidableEq Comm] (sampleCoins : ProbComp Coins) (commit : ZMod p → Coins → Comm) :
            Protocol n noOracleSpec (macCheckSchedule p n Coins Comm) (fun (x : Fin n) => PartyCheckInput p T) (fun (x : Fin n) => Coins) fun (x : Fin n) => Bool

            Two-round commit-then-open MACCheck protocol over CslibFrontier.Crypto.Protocols.MPC.Basic, modeling steps 5–9 of [DKL+13], App. D.1, Fig. 10 (steps 1–4, which coin-flip a seed and expand it with a PRG into the weights, are replaced by the input weights PartyCheckInput.weights), with the residual adapted to the δ-representation:

            1. Each party i samples commitment coins r_i ← sampleCoins, computes σ_i = checkResidual, and broadcasts commit σ_i r_i in Round 1.
            2. Each party i broadcasts ⟨σ_i, r_i⟩ : ResidualOpening p Coins in Round 2.
            3. Each party outputs verifyResiduals commit commits openings.
            theorem Cslib.Crypto.Protocols.MPC.SPDZ.eval_snd_macCheckProtocol_eq_pure_true {p n T : ℕ} {Coins Comm : Type} [AddCommMonoid Coins] [AddCommMonoid Comm] [DecidableEq Comm] (sampleCoins : ProbComp Coins) (commit : ZMod p → Coins → Comm) {alpha : ZMod p} {shares : Fin T → AuthShare p n} {opened : Fin T → OpenedValue p} {e : Fin T → ZMod p} {inp : Fin n → PartyCheckInput p T} (hhon : PartyCheckInput.Honest alpha shares opened e inp) :
            PMF.map Prod.snd ((macCheckProtocol p n T sampleCoins commit).evalWith noOracleWorld inp) = PMF.pure fun (x : Fin n) => true

            Honest completeness of macCheckProtocol: for every commitment scheme (sampleCoins, commit) and every honest PartyCheckInput.Honest batch, all n parties output true with probability 1.

            Concrete $2 / p$ bound for the standalone MACCheck cheating-equation game #

            noncomputable def Cslib.Crypto.Protocols.MPC.SPDZ.linearCombZeroGame (p T : ℕ) [NeZero p] (err : Fin T → ZMod p) :

            Stage-1 ProbComp game testing whether random weights e ← $ᵗ (Fin T → ZMod p) annihilate a fixed nonzero error vector err : Fin T → ZMod p.

            noncomputable def Cslib.Crypto.Protocols.MPC.SPDZ.macCheckSoundnessGame (p T : ℕ) [NeZero p] (err : Fin T → ZMod p) (deltaShift : (Fin T → ZMod p) → ZMod p) :

            Standalone MACCheck cheating-equation game, the game from the proof of [DKL+13], §5.1, Lemma 1 (App. D.3): samples an independent uniform MAC key alpha ← $ᵗ ZMod p and public weights e ← $ᵗ (Fin T → ZMod p), and tests whether the adversary's (possibly e-adaptive) residual shift deltaShift e satisfies the cheating equation alpha * linearCombAddHom err e = deltaShift e.

            noncomputable def Cslib.Crypto.Protocols.MPC.SPDZ.macCheckSoundnessAdvGame (p T : ℕ) [NeZero p] {S : Type} (adv : ProbComp S) (err : S → Fin T → ZMod p) (deltaShift : S → (Fin T → ZMod p) → ZMod p) :

            Stateful randomized-adversary standalone MACCheck cheating-equation game (the game of [DKL+13], App. D.3, paralleling CslibFrontier.Crypto.Protocols.VOLE.MulCheck): an arbitrary prior computation adv : ProbComp S selects state s determining both the opening error vector err s and the e-adaptive shift deltaShift s before the independent key alpha is sampled, winning if err s ≠ 0 and alpha * linearCombAddHom (err s) e = deltaShift s e.

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.eval_linearCombZeroGame_eq {p T : ℕ} [Fact (Nat.Prime p)] {err : Fin T → ZMod p} (herr : err ≠ 0) :

            Stage 1 exact probability: for prime p and err ≠ 0, linearCombZeroGame p T err outputs true with exact probability p⁻¹ (via toOuterMeasure_uniform_linearComb_eq_zero).

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.eval_linearCombZeroGame_le {p T : ℕ} [Fact (Nat.Prime p)] {err : Fin T → ZMod p} (herr : err ≠ 0) :

            Stage 1 upper bound in ℝ≥0∞.

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.probability_linearCombZeroGame_le {p T : ℕ} [Fact (Nat.Prime p)] {err : Fin T → ZMod p} (herr : err ≠ 0) :
            ((linearCombZeroGame p T err).eval true).toReal ≤ 1 / ↑p

            Stage 1 real-valued probability bound ≤ 1 / p.

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.eval_macKey_guess_eq {p : ℕ} [Fact (Nat.Prime p)] {L : ZMod p} (hL : L ≠ 0) (d : ZMod p) :
            (PMF.map (fun (alpha : ZMod p) => decide (alpha * L = d)) (Probability.PMF.uniformOfFintype (ZMod p))) true = (↑p)⁻¹

            Stage-2 exact key-guessing probability: for any L ≠ 0 and d : ZMod p, a uniform key alpha : ZMod p satisfies alpha * L = d with probability exactly p⁻¹ (via toOuterMeasure_uniform_linearComb_eq on Unit).

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.eval_macKey_guess_le {p : ℕ} [Fact (Nat.Prime p)] (L d : ZMod p) :
            (PMF.map (fun (alpha : ZMod p) => decide (alpha * L = d)) (Probability.PMF.uniformOfFintype (ZMod p))) true ≤ (if L = 0 then 1 else 0) + (↑p)⁻¹

            Stage-2 pointwise key-guessing bound: for any L, d : ZMod p, a uniform key alpha : ZMod p satisfies alpha * L = d with probability at most (if L = 0 then 1 else 0) + p⁻¹ (the L ≠ 0 branch is eval_macKey_guess_eq).

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.eval_macCheckSoundnessGame_le {p T : ℕ} [Fact (Nat.Prime p)] {err : Fin T → ZMod p} (herr : err ≠ 0) (deltaShift : (Fin T → ZMod p) → ZMod p) :
            (macCheckSoundnessGame p T err deltaShift).eval true ≤ 2 / ↑p

            Concrete $2 / p$ bound for the standalone MACCheck cheating-equation game ([DKL+13], §5.1, Lemma 1; App. D.3): for prime p, any nonzero opening error vector err ≠ 0, and any e-adaptive residual shift deltaShift, macCheckSoundnessGame p T err deltaShift outputs true with probability at most 2 / p.

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.probability_macCheckSoundnessGame_le {p T : ℕ} [Fact (Nat.Prime p)] {err : Fin T → ZMod p} (herr : err ≠ 0) (deltaShift : (Fin T → ZMod p) → ZMod p) :
            ((macCheckSoundnessGame p T err deltaShift).eval true).toReal ≤ 2 / ↑p

            Real-valued 2 / p bound for macCheckSoundnessGame.

            theorem Cslib.Crypto.Protocols.MPC.SPDZ.eval_macCheckSoundnessAdvGame_le {p T : ℕ} [Fact (Nat.Prime p)] {S : Type} (adv : ProbComp S) (err : S → Fin T → ZMod p) (deltaShift : S → (Fin T → ZMod p) → ZMod p) :
            (macCheckSoundnessAdvGame p T adv err deltaShift).eval true ≤ 2 / ↑p

            Standalone MACCheck cheating-equation bound against any prior randomized adversary adv : ProbComp S that selects state s (fixing err s and deltaShift s) before the independent uniform key alpha : ZMod p is sampled.