Documentation

CslibFrontier.Crypto.Protocols.MPC.BGW

BGW Semi-Honest Arithmetic MPC Gates and Degree-Reduction Protocol #

This module formalizes the degree-reduction algebra and synchronous $m$-party Ben-Or–Goldwasser–Wigderson (BGW) semi-honest arithmetic gate protocols over finite fields ([BOGW88]; [GRR98]; [AL17]; [Gol04]; [KL20]), building on the Shamir secret-sharing homomorphisms and unauthorized-coalition marginal uniformity in CslibFrontier.Crypto.Protocols.SecretSharing.Shamir.Linear:

  1. BGW Multiplication Step and Degree-Reduction Algebra ($2t < |\text{Party}|$):
    • In Asharov–Lindell ([AL17]; numbering as in the full version, ePrint 2011/136), Section 4.3 (Protocol 4.5, Proposition 4.6, Protocol 4.7, Claims 4.8–4.9, and Proposition 4.10) presents the classical two-step randomize-then-reduce multiplication gate, where parties first add a degree-$2t$ zero-share (bgwMulStep params r₁ a r₂ b r_z, reconstructing to $a \cdot b$ via reconstruct_bgwMulStep_eq_mul) and then apply a linear degree-reduction step, whereas Section 6.1 explicitly describes the Gennaro–Rabin–Rabin (GRR, [GRR98]) one-step degree-reduction simplification, in which each party $j$ directly reshares its degree-$2t$ product $a_j \cdot b_j$ using a fresh degree-$t$ Shamir polynomial and all parties take a Lagrange linear combination without a separate randomization step.
    • Commutativity of Lagrange Reconstruction and Shamir Sharing (bgwDegreeReduceShare_share): when each party $j$ reshares its intermediate value $d_j$ using fresh degree-$t$ Shamir randomness $r_{\text{sub}}(j)$, and each party $i$ applies Lagrange reconstruction (bgwDegreeReduceShare) to its column of received sub-shares, the result equals party $i$'s genuine degree-$t$ Shamir share of Polynomial.reconstruct params.point d under combined randomness bgwReducedRandomness params r_sub. This establishes correctness for both the one-step GRR resharing of $a_j \cdot b_j$ (bgwDegreeReduceShare_mul_eq_share, reconstruct_bgwDegreeReduceShare_mul_eq_mul) and the two-step zero-randomized intermediate values (bgwDegreeReduceShare_bgwMulStep_eq_share).
  2. 1-Round Synchronous BGW/GRR Degree-Reduction Multiplication Gate (bgwDegreeReductionProtocol):
  3. 2-Round Synchronous BGW Sum Protocol (bgwSumProtocol):
    • Formalizes the 2-round $m$-party BGW input-sharing, local addition, and output-reconstruction protocol over noOracleSpec ([AL17], Section 4.2, Protocol 4.1 and Claim 4.3, specialized to addition gates).
    • Proves exact output correctness (output_bgwSumProtocol) and full joint view-and-output $t$-privacy PerfectSemiHonestPrivateLe (perfectSemiHonestPrivateLe_bgwSum, [AL17], Section 2.1, Definition 2.1) for all coalitions $I$ with $|I| \le t$.

Main definitions #

Main results #

References #

1. BGW multiplication step and degree-reduction algebra #

noncomputable def Cslib.Crypto.Protocols.MPC.BGW.bgwMulStep {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (r₁ : SecretSharing.Shamir.Randomness params) (a : F) (r₂ : SecretSharing.Shamir.Randomness params) (b : F) (r_z : Fin (2 * params.threshold) → F) (i : Party) :
F

Local BGW degree-$2t$ zero-randomized multiplication step ([AL17], Section 4.3, Protocol 4.5, steps 1–2): party i multiplies its degree-$t$ shares of a and b and adds a degree-$2t$ Shamir share of 0 with randomness r_z : Fin (2 * params.threshold) → F.

theorem Cslib.Crypto.Protocols.MPC.BGW.bgwMulStep_eq_eval_sharingPolynomial {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (r₁ : SecretSharing.Shamir.Randomness params) (a : F) (r₂ : SecretSharing.Shamir.Randomness params) (b : F) (r_z : Fin (2 * params.threshold) → F) (i : Party) :

bgwMulStep evaluates the degree-$\le 2t$ sharing polynomial of a * b with tail randomness mulTailCoeffs a r₁ b r₂ + r_z.

theorem Cslib.Crypto.Protocols.MPC.BGW.reconstruct_bgwMulStep_eq_mul {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (h2t : 2 * params.threshold < Fintype.card Party) (r₁ : SecretSharing.Shamir.Randomness params) (a : F) (r₂ : SecretSharing.Shamir.Randomness params) (b : F) (r_z : Fin (2 * params.threshold) → F) :
SecretSharing.Shamir.Polynomial.reconstruct params.point (bgwMulStep params r₁ a r₂ b r_z) = a * b

When 2 * params.threshold < Fintype.card Party ($t < n / 2$), Lagrange reconstruction of bgwMulStep across all parties recovers a * b.

noncomputable def Cslib.Crypto.Protocols.MPC.BGW.bgwReducedRandomness {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (r_sub : Party → SecretSharing.Shamir.Randomness params) :

Combined degree-$t$ Shamir randomness resulting from Lagrange recombination of per-party resharing polynomials r_sub : Party → Randomness params ([GRR98]; [AL17], Section 6.1).

noncomputable def Cslib.Crypto.Protocols.MPC.BGW.bgwDegreeReduceShare {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (subShares : Party → Party → F) (i : Party) :
F

BGW degree-reduction recombination step ([GRR98]; [AL17], Section 6.1): party i applies Lagrange reconstruction at zero (Polynomial.reconstruct params.point) to the column j ↦ subShares j i of sub-shares sent to i.

theorem Cslib.Crypto.Protocols.MPC.BGW.bgwDegreeReduceShare_share {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (r_sub : Party → SecretSharing.Shamir.Randomness params) (d : Party → F) (i : Party) :
bgwDegreeReduceShare params (fun (j k : Party) => SecretSharing.Shamir.share params (r_sub j) (d j) k) i = SecretSharing.Shamir.share params (bgwReducedRandomness params r_sub) (SecretSharing.Shamir.Polynomial.reconstruct params.point d) i

Commutativity of Lagrange Reconstruction and Shamir Sharing ([GRR98]; [AL17], Section 6.1): when each party j shares its intermediate value d j using degree-$t$ Shamir randomness r_sub j, applying bgwDegreeReduceShare at party i yields party i's degree-$t$ Shamir share of Polynomial.reconstruct params.point d under randomness bgwReducedRandomness params r_sub.

theorem Cslib.Crypto.Protocols.MPC.BGW.bgwDegreeReduceShare_mul_eq_share {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (h2t : 2 * params.threshold < Fintype.card Party) (r₁ r₂ : SecretSharing.Shamir.Randomness params) (a b : F) (r_sub : Party → SecretSharing.Shamir.Randomness params) (i : Party) :
bgwDegreeReduceShare params (fun (j k : Party) => SecretSharing.Shamir.share params (r_sub j) (SecretSharing.Shamir.share params r₁ a j * SecretSharing.Shamir.share params r₂ b j) k) i = SecretSharing.Shamir.share params (bgwReducedRandomness params r_sub) (a * b) i

When 2 * params.threshold < Fintype.card Party, BGW degree reduction on the unmasked product shares d j = share params r₁ a j * share params r₂ b j produces a genuine degree-$t$ Shamir sharing of a * b ([GRR98]; [AL17], Section 6.1).

theorem Cslib.Crypto.Protocols.MPC.BGW.bgwDegreeReduceShare_bgwMulStep_eq_share {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (h2t : 2 * params.threshold < Fintype.card Party) (r₁ : SecretSharing.Shamir.Randomness params) (a : F) (r₂ : SecretSharing.Shamir.Randomness params) (b : F) (r_z : Fin (2 * params.threshold) → F) (r_sub : Party → SecretSharing.Shamir.Randomness params) (i : Party) :
bgwDegreeReduceShare params (fun (j k : Party) => SecretSharing.Shamir.share params (r_sub j) (bgwMulStep params r₁ a r₂ b r_z j) k) i = SecretSharing.Shamir.share params (bgwReducedRandomness params r_sub) (a * b) i

When 2 * params.threshold < Fintype.card Party, BGW degree reduction on the degree-$2t$ zero-randomized product shares bgwMulStep params r₁ a r₂ b r_z also produces a genuine degree-$t$ Shamir sharing of a * b.

theorem Cslib.Crypto.Protocols.MPC.BGW.reconstruct_bgwDegreeReduceShare_mul_eq_mul {F : Type u_1} {Party : Type u_2} [Field F] [Fintype Party] (params : SecretSharing.Shamir.Params F Party) (h2t : 2 * params.threshold < Fintype.card Party) (r₁ r₂ : SecretSharing.Shamir.Randomness params) (a b : F) (r_sub : Party → SecretSharing.Shamir.Randomness params) {s : Finset Party} (hs : SecretSharing.Shamir.authorized params s) :
(SecretSharing.Shamir.reconstruct params s fun (i : ↥s) => bgwDegreeReduceShare params (fun (j k : Party) => SecretSharing.Shamir.share params (r_sub j) (SecretSharing.Shamir.share params r₁ a j * SecretSharing.Shamir.share params r₂ b j) k) ↑i) = a * b

Any degree-$t$ authorized coalition s (params.threshold + 1 ≤ s.card) reconstructs a * b from the BGW degree-reduced shares whenever 2 * params.threshold < Fintype.card Party.

2. Synchronous $m$-party BGW gate protocols and $t$-privacy #

noncomputable def Cslib.Crypto.Protocols.MPC.BGW.bgwDegreeReductionProtocol {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) :
Protocol m noOracleSpec (allToAllSchedule m F) (fun (x : Fin m) => F × F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) fun (x : Fin m) => F

1-round synchronous $m$-party BGW degree-reduction multiplication gate protocol over noOracleSpec ([GRR98]; [AL17], Section 6.1):

  1. Each party s : Fin m holds input share pair uv_s = (u_s, v_s) : F × F and samples fresh degree-$t$ Shamir randomness r_s : Randomness params.
  2. Each party s sends the sub-share share params r_s (u_s * v_s) i to each party i : Fin m via allToAllStepsWith.
  3. Each party i outputs the Lagrange-recombined share Polynomial.reconstruct params.point inbox_i.
def Cslib.Crypto.Protocols.MPC.BGW.bgwDegreeReductionViewOf {F : Type} [Field F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (i : Fin m) (uv_i : F × F) (r_i : SecretSharing.Shamir.Randomness params) (inbox_i : Fin m → F) :
PartyView (fun (x : Fin m) => F × F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (allToAllSchedule m F) i

Construct party i's PartyView in bgwDegreeReductionProtocol from its input uv_i, its coins r_i, and its received sub-share inbox inbox_i : Fin m → F.

theorem Cslib.Crypto.Protocols.MPC.BGW.evalWith_bgwDegreeReductionProtocol {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (uv : Fin m → F × F) :
(bgwDegreeReductionProtocol params).evalWith noOracleWorld uv = PMF.map (fun (r : Fin m → SecretSharing.Shamir.Randomness params) => (fun (i : Fin m) => bgwDegreeReductionViewOf params i (uv i) (r i) fun (s : Fin m) => SecretSharing.Shamir.share params (r s) ((uv s).1 * (uv s).2) i, fun (i : Fin m) => bgwDegreeReduceShare params (fun (s k : Fin m) => SecretSharing.Shamir.share params (r s) ((uv s).1 * (uv s).2) k) i)) (Probability.PMF.uniformOfFintype (Fin m → SecretSharing.Shamir.Randomness params))
theorem Cslib.Crypto.Protocols.MPC.BGW.output_bgwDegreeReductionProtocol_eq_share_mul {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (h2t : 2 * params.threshold < m) (r₁ r₂ : SecretSharing.Shamir.Randomness params) (a b : F) {res : ((i : Fin m) → PartyView (fun (x : Fin m) => F × F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (allToAllSchedule m F) i) × (Fin m → F)} (hres : res ∈ ((bgwDegreeReductionProtocol params).evalWith noOracleWorld fun (i : Fin m) => (SecretSharing.Shamir.share params r₁ a i, SecretSharing.Shamir.share params r₂ b i)).support) :
res.2 = fun (i : Fin m) => SecretSharing.Shamir.share params (bgwReducedRandomness params fun (j : Fin m) => (res.1 j).coins) (a * b) i

Output correctness of bgwDegreeReductionProtocol: when 2 * params.threshold < m ($t < m / 2$) and the inputs uv are degree-$t$ Shamir shares of a and b, every supported execution outputs a genuine degree-$t$ Shamir sharing of a * b under bgwReducedRandomness params.

theorem Cslib.Crypto.Protocols.MPC.BGW.reconstruct_output_bgwDegreeReductionProtocol_eq_mul {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (h2t : 2 * params.threshold < m) (r₁ r₂ : SecretSharing.Shamir.Randomness params) (a b : F) {res : ((i : Fin m) → PartyView (fun (x : Fin m) => F × F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (allToAllSchedule m F) i) × (Fin m → F)} (hres : res ∈ ((bgwDegreeReductionProtocol params).evalWith noOracleWorld fun (i : Fin m) => (SecretSharing.Shamir.share params r₁ a i, SecretSharing.Shamir.share params r₂ b i)).support) {s : Finset (Fin m)} (hs : SecretSharing.Shamir.authorized params s) :

On any supported execution of bgwDegreeReductionProtocol with degree-$t$ Shamir shares of a and b ($2t < m$), reconstructing the output shares over any degree-$t$ authorized coalition s (params.threshold + 1 ≤ s.card) recovers a * b.

noncomputable def Cslib.Crypto.Protocols.MPC.BGW.bgwDegreeReductionViewSim {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (I : Finset (Fin m)) (uvI : ↥I → F × F) :
ProbComp ((i : ↥I) → PartyView (fun (x : Fin m) => F × F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (allToAllSchedule m F) ↑i)

Coalition view simulator for bgwDegreeReductionProtocol params ([AL17], Section 3.2, Claims 3.2 and 3.4): given only the coalition's input share pairs uvI : (i : I) → F × F, samples uniform coins rI for i ∈ I and independent uniform sub-share vectors hCompl : Iᶜ → I → F from honest senders s ∉ I, and assembles each corrupted party's inbox.

theorem Cslib.Crypto.Protocols.MPC.BGW.map_restrict_evalWith_bgwDegreeReductionProtocol {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (I : Finset (Fin m)) (hI : I.card ≤ params.threshold) (uv : Fin m → F × F) :
PMF.map (fun (r : ((i : Fin m) → PartyView (fun (x : Fin m) => F × F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (allToAllSchedule m F) i) × (Fin m → F)) => I.restrict r.1) ((bgwDegreeReductionProtocol params).evalWith noOracleWorld uv) = (bgwDegreeReductionViewSim params I (I.restrict uv)).eval

$t$-Privacy of BGW Degree-Reduction Views ([AL17], Section 3.2, Claims 3.2 and 3.4): for every coalition I with I.card ≤ params.threshold and every input tuple uv : Fin m → F × F, the marginal distribution of I's views in bgwDegreeReductionProtocol params equals ProbComp.eval (bgwDegreeReductionViewSim params I (I.restrict uv)), which depends only on I.restrict uv and is independent of all honest parties' input share pairs.

3. 2-round synchronous $m$-party BGW sum protocol and full joint $t$-privacy #

@[reducible]

Schedule for bgwSumProtocol params: one all-to-all point-to-point Shamir input-sharing phase followed by one all-to-all broadcast of summed shares.

def Cslib.Crypto.Protocols.MPC.BGW.bgwSumFunctionality {F : Type} [Field F] (m : ℕ) :
Functionality m (fun (x : Fin m) => F) fun (x : Fin m) => F

Deterministic $m$-party functionality returning the sum ∑ j : Fin m, x j to every party.

noncomputable def Cslib.Crypto.Protocols.MPC.BGW.bgwSumProtocol {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) :
Protocol m noOracleSpec (bgwSumSchedule m F) (fun (x : Fin m) => F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) fun (x : Fin m) => F

2-round synchronous $m$-party BGW sum protocol over noOracleSpec ([AL17], Section 4.2, Protocol 4.1, for a circuit of addition gates):

  1. Each party s : Fin m samples degree-$t$ Shamir randomness r_s : Randomness params and sends share params r_s (x s) rcv to each receiver rcv : Fin m via allToAllStepsWith.
  2. Each party k : Fin m sums its received shares Y_k = ∑ s : Fin m, inbox_k s and broadcasts Y_k via broadcastSteps.
  3. Each party reconstructs Polynomial.reconstruct params.point Y.
def Cslib.Crypto.Protocols.MPC.BGW.bgwSumViewOf {F : Type} [Field F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (i : Fin m) (x_i : F) (r_i : SecretSharing.Shamir.Randomness params) (inbox_i Y : Fin m → F) :
PartyView (fun (x : Fin m) => F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (bgwSumSchedule m F) i

Construct party i's PartyView in bgwSumProtocol from its input x_i, its coins r_i, its Round 1 received share inbox inbox_i : Fin m → F, and the Round 2 broadcast vector Y : Fin m → F.

theorem Cslib.Crypto.Protocols.MPC.BGW.evalWith_bgwSumProtocol {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (x : Fin m → F) :
(bgwSumProtocol params).evalWith noOracleWorld x = PMF.map (fun (r : Fin m → SecretSharing.Shamir.Randomness params) => have inbox := fun (i s : Fin m) => SecretSharing.Shamir.share params (r s) (x s) i; have Y := fun (k : Fin m) => ∑ s : Fin m, SecretSharing.Shamir.share params (r s) (x s) k; (fun (i : Fin m) => bgwSumViewOf params i (x i) (r i) (inbox i) Y, fun (x : Fin m) => SecretSharing.Shamir.Polynomial.reconstruct params.point Y)) (Probability.PMF.uniformOfFintype (Fin m → SecretSharing.Shamir.Randomness params))
theorem Cslib.Crypto.Protocols.MPC.BGW.output_bgwSumProtocol {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (x : Fin m → F) {res : ((i : Fin m) → PartyView (fun (x : Fin m) => F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (bgwSumSchedule m F) i) × (Fin m → F)} (hres : res ∈ ((bgwSumProtocol params).evalWith noOracleWorld x).support) :
res.2 = fun (x_1 : Fin m) => ∑ j : Fin m, x j

Output correctness of bgwSumProtocol: on every execution in the support, every party outputs ∑ j : Fin m, x j.

noncomputable def Cslib.Crypto.Protocols.MPC.BGW.bgwSumSim {F : Type} [Field F] [Fintype F] {m : ℕ} (params : SecretSharing.Shamir.Params F (Fin m)) (I : Finset (Fin m)) :
CoalitionSimulator (bgwSumSchedule m F) (fun (x : Fin m) => F) (fun (x : Fin m) => SecretSharing.Shamir.Randomness params) (fun (x : Fin m) => F) I

Coalition simulator for bgwSumProtocol params against any static coalition I with I.card ≤ params.threshold:

  1. If I = Finset.univ (vacuous when I.card ≤ params.threshold < m) or I = ∅ (empty view), handles directly; otherwise picks an honest pivot party j₀ ∉ I and sets H' := Iᶜ.erase j₀.
  2. Samples total Round 2 randomness R_tot : Randomness params, corrupted coins rI : (i : I) → Randomness params, and honest non-pivot Round 1 shares hRest : (s : H') → (I → F) uniformly.
  3. Computes the Round 2 broadcast vector Y k = share params R_tot y k from the ideal output y and sets the pivot honest party j₀'s Round 1 share to i ∈ I so that the column of shares received by i sums to Y i.

Full Joint View-and-Output $t$-Privacy of bgwSumProtocol (cf. [AL17], Section 4.2, Protocol 4.1 and Claim 4.3, for addition gates only): for every static coalition I with I.card ≤ params.threshold, bgwSumProtocol params privately computes bgwSumFunctionality m in noOracleWorld with simulator bgwSumSim params.