Documentation

CslibFrontier.Crypto.Protocols.MPC.PolyTime.Encoding

Family Inputs, View Encodings and Efficiency Predicates for the GMW Completeness Theorem #

This module fixes the word-level interface of the uniform efficiency claims in Cslib.Crypto.Protocols.MPC.PolyTime. A family instance is packaged with its party inputs (FamilyRunInput) or with a coalition's inputs and outputs (FamilySimInput), records encoded injectively as bit lists by enc_structure. Party views of gmwOT14RandomizedProtocol are encoded by encGMWPartyView, and coalition view tuples by encodeCoalitionView. The named predicates Protocol.Family.IsOraclePPT and CoalitionSimulator.Family.IsPPT state uniform efficiency of a protocol family's joint word-level runner and of a coalition simulator family.

Main definitions #

References #

Family input records and encGMWPartyView #

structure Cslib.Crypto.Protocols.MPC.FamilyRunInput (α : Type) (m : ℕ) (n : α → ℕ) :

Input record for executing a protocol family: the instance index : α and the n index-bit party inputs.

  • index : α

    The instance of the family.

  • inputs : Fin m → BitString (n self.index)

    The party inputs.

structure Cslib.Crypto.Protocols.MPC.FamilySimInput (α : Type) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) :

Input record for running a coalition simulator family: the instance index : α with the coalition's n index-bit inputs and k index-bit outputs.

  • index : α

    The instance of the family.

  • inputs (i : ↥I) : BitString (n self.index)

    The coalition's inputs.

  • outputs (i : ↥I) : BitString (k self.index)

    The coalition's outputs.

def Cslib.Crypto.Protocols.MPC.extendCoalitionBits {m len : ℕ} (I : Finset (Fin m)) (vI : ↥I → BitString len) :

Pad a coalition-indexed bitstring tuple vI : (i : I) → BitString len with 0 outside I and serialize the resulting m blocks of width len to a m * len-bit list.

Zero-extension and serialization of coalition tuples is injective.

Injective bit-list encoding of FamilyRunInput α m n: pairs enc index with the packed m * n index party input bits List.ofFn (BitString.blocksEquiv.symm inputs).

@[simp]
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_apply {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) (a : FamilyRunInput α m n) :
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_inputs_inO {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) :
Turing.MultiTapeTM.ComputableInO (fun (a : FamilyRunInput α m n) => (fun (x : Fin m → BitString (n a.index)) => List.ofFn (BitString.blocksEquiv.symm x)) a.inputs) (encFamilyRunInput enc m n) Turing.MultiTapeTM.encBits (fun (a : FamilyRunInput α m n) => ((encFamilyRunInput enc m n) a).length) fun (a : FamilyRunInput α m n) => ((encFamilyRunInput enc m n) a).length
@[reducible, inline]

The tuple of the fields of encFamilyRunInput.

theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_inputs_length_le {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) (a : FamilyRunInput α m n) :
(Turing.MultiTapeTM.encBits ((fun (a : FamilyRunInput α m n) => (fun (x : Fin m → BitString (n a.index)) => List.ofFn (BitString.blocksEquiv.symm x)) a.inputs) a)).length ≤ ((encFamilyRunInput enc m n) a).length
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_index_budget {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → FamilyRunInput α m n} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encFamilyRunInput enc m n) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).index) encIn✝ enc S✝
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_index_inO {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) :
Turing.MultiTapeTM.ComputableInO (fun (a : FamilyRunInput α m n) => a.index) (encFamilyRunInput enc m n) enc (fun (a : FamilyRunInput α m n) => ((encFamilyRunInput enc m n) a).length) fun (a : FamilyRunInput α m n) => ((encFamilyRunInput enc m n) a).length
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_inputs_polyTime {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → FamilyRunInput α m n} :
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_mk_polyTime {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {x1 : (c : γ) → Fin m → BitString (n (x0 c))} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn enc) (h1 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => (fun (x : Fin m → BitString (n (x0 c))) => List.ofFn (BitString.blocksEquiv.symm x)) (x1 c)) encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { index := x0 x, inputs := x1 x }) encIn (encFamilyRunInput enc m n)
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_mk_budget {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → α} {x1 : (c : γ) → Fin m → BitString (n (x0 c))} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn enc budget) (h1 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (fun (x : Fin m → BitString (n (x0 c))) => List.ofFn (BitString.blocksEquiv.symm x)) (x1 c)) encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { index := x0 x, inputs := x1 x }) encIn (encFamilyRunInput enc m n) budget
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_mk_inO {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {T0 S0 : γ → ℕ} {x1 : (c : γ) → Fin m → BitString (n (x0 c))} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn enc T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => (fun (x : Fin m → BitString (n (x0 c))) => List.ofFn (BitString.blocksEquiv.symm x)) (x1 c)) encIn Turing.MultiTapeTM.encBits T1 S1) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { index := x0 x, inputs := x1 x }) encIn (encFamilyRunInput enc m n) (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_index_length_le {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) (a : FamilyRunInput α m n) :
(enc ((fun (a : FamilyRunInput α m n) => a.index) a)).length ≤ ((encFamilyRunInput enc m n) a).length
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_index_polyTime {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → FamilyRunInput α m n} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encFamilyRunInput enc m n) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).index) encIn✝ enc
theorem Cslib.Crypto.Protocols.MPC.encFamilyRunInput_inputs_budget {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → FamilyRunInput α m n} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encFamilyRunInput enc m n) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (fun (x : Fin m → BitString (n (g✝ c).index)) => List.ofFn (BitString.blocksEquiv.symm x)) (g✝ c).inputs) encIn✝ Turing.MultiTapeTM.encBits S✝
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_index_inO {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) :
Turing.MultiTapeTM.ComputableInO (fun (a : FamilySimInput α m n k I) => a.index) (encFamilySimInput enc m n k I) enc (fun (a : FamilySimInput α m n k I) => ((encFamilySimInput enc m n k I) a).length) fun (a : FamilySimInput α m n k I) => ((encFamilySimInput enc m n k I) a).length
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_mk_inO {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {T0 S0 : γ → ℕ} {x1 : (c : γ) → ↥I → BitString (n (x0 c))} {T1 S1 : γ → ℕ} {x2 : (c : γ) → ↥I → BitString (k (x0 c))} {T2 S2 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn enc T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => extendCoalitionBits I (x1 c)) encIn Turing.MultiTapeTM.encBits T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => extendCoalitionBits I (x2 c)) encIn Turing.MultiTapeTM.encBits T2 S2) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { index := x0 x, inputs := x1 x, outputs := x2 x }) encIn (encFamilySimInput enc m n k I) (fun (x : γ) => T0 x + (T1 x + T2 x)) fun (x : γ) => S0 x + (S1 x + S2 x)
@[reducible, inline]
abbrev Cslib.Crypto.Protocols.MPC.encFamilySimInputFields {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) :

The tuple of the fields of encFamilySimInput.

def Cslib.Crypto.Protocols.MPC.encFamilySimInput {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) :

Injective bit-list encoding of FamilySimInput α m n k I: pairs enc index with the zero-extended packed coalition input bits extendCoalitionBits I inputs and output bits extendCoalitionBits I outputs.

theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_index_deg {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) :
Turing.MultiTapeTM.ComputableInDegree (fun (a : FamilySimInput α m n k I) => a.index) (encFamilySimInput enc m n k I) enc 1 1
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_inputs_budget {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → FamilySimInput α m n k I} :
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_index_length_le {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) (a : FamilySimInput α m n k I) :
(enc ((fun (a : FamilySimInput α m n k I) => a.index) a)).length ≤ ((encFamilySimInput enc m n k I) a).length
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_inputs_inO {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) :
Turing.MultiTapeTM.ComputableInO (fun (a : FamilySimInput α m n k I) => extendCoalitionBits I a.inputs) (encFamilySimInput enc m n k I) Turing.MultiTapeTM.encBits (fun (a : FamilySimInput α m n k I) => ((encFamilySimInput enc m n k I) a).length) fun (a : FamilySimInput α m n k I) => ((encFamilySimInput enc m n k I) a).length
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_mk_polyTime {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → α} {x1 : (c : γ) → ↥I → BitString (n (x0 c))} {x2 : (c : γ) → ↥I → BitString (k (x0 c))} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn enc) (h1 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => extendCoalitionBits I (x1 c)) encIn Turing.MultiTapeTM.encBits) (h2 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => extendCoalitionBits I (x2 c)) encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { index := x0 x, inputs := x1 x, outputs := x2 x }) encIn (encFamilySimInput enc m n k I)
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_inputs_length_le {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) (a : FamilySimInput α m n k I) :
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_outputs_polyTime {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → FamilySimInput α m n k I} :
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_index_polyTime {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → FamilySimInput α m n k I} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encFamilySimInput enc m n k I) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).index) encIn✝ enc
@[simp]
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_apply {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) (a : FamilySimInput α m n k I) :
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_outputs_length_le {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) (a : FamilySimInput α m n k I) :
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_outputs_budget {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → FamilySimInput α m n k I} :
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_mk_budget {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → α} {x1 : (c : γ) → ↥I → BitString (n (x0 c))} {x2 : (c : γ) → ↥I → BitString (k (x0 c))} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn enc budget) (h1 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => extendCoalitionBits I (x1 c)) encIn Turing.MultiTapeTM.encBits budget) (h2 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => extendCoalitionBits I (x2 c)) encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { index := x0 x, inputs := x1 x, outputs := x2 x }) encIn (encFamilySimInput enc m n k I) budget
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_inputs_polyTime {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → FamilySimInput α m n k I} :
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_index_budget {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → FamilySimInput α m n k I} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encFamilySimInput enc m n k I) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).index) encIn✝ enc S✝
theorem Cslib.Crypto.Protocols.MPC.encFamilySimInput_outputs_inO {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) (I : Finset (Fin m)) :
Turing.MultiTapeTM.ComputableInO (fun (a : FamilySimInput α m n k I) => extendCoalitionBits I a.outputs) (encFamilySimInput enc m n k I) Turing.MultiTapeTM.encBits (fun (a : FamilySimInput α m n k I) => ((encFamilySimInput enc m n k I) a).length) fun (a : FamilySimInput α m n k I) => ((encFamilySimInput enc m n k I) a).length
def Cslib.Crypto.Protocols.MPC.encGMWPartyView (m coins n k : ℕ) (C : Circuits.Circuit Circuits.Boolean.signature (m * n + coins) (m * k)) (i : Fin m) (v : PartyView (fun (x : Fin m) => BitString n) (fun (j : Fin m) => BitString coins × Schedule.ComposedCoins (fun (x : Unit) (i : Fin (1 + 1)) => Fin.cases Bool (fun (x : Fin 1) => Unit) i) (Schedule.ComposedCoins (fun (x : Unit) (x_1 : Fin ((sharedMulSpec m).arity x)) => Unit) (fun (x : Fin m) => Fin (n + coins) → Fin (m - 1) → Bool) (gmwCircuitSchedule m (n + coins) k (C.comp (xorPreludeCircuit m n coins)))) (Schedule.compose (fun (x : (sharedMulSpec m).Op) => multiPartyMulSchedule m) (gmwCircuitSchedule m (n + coins) k (C.comp (xorPreludeCircuit m n coins)))) j) (Schedule.compose (fun (x : (sharedMulSpec 2).Op) => twoPartyMulSchedule) (Schedule.compose (fun (x : (sharedMulSpec m).Op) => multiPartyMulSchedule m) (gmwCircuitSchedule m (n + coins) k (C.comp (xorPreludeCircuit m n coins))))) i) :

Serialize party i's complete PartyView in gmwOT14RandomizedProtocol m coins n k C to a List Bool encoding:

  • v.input : BitString n
  • v.coins.1 : BitString coins (randomized-wrapper coin share)
  • v.coins.2.1.1 : Fin (n + coins) → Fin (m - 1) → Bool (Step 1 input-sharing coins)
  • encOTSubCoins _ i v.coins.2.2 (Step 2 & Step 3 $\text{OT}_1^4$ sender coins)
  • Step 1 received input shares (encPairsMsgReceived)
  • Step 2 & Step 3 received $\text{OT}_1^4$ receiver answers (encOTOracleAnswers)
  • Step 3 received output-reconstruction shares (encOutCoordsMsgReceived).
def Cslib.Crypto.Protocols.MPC.encodeCoalitionView {m : ℕ} {spec : MultiOracleSpec} {sc : Schedule m spec} {In Coins : Fin m → Type} (encView : (i : Fin m) → PartyView In Coins sc i → List Bool) (I : Finset (Fin m)) (vI : (i : ↥I) → PartyView In Coins sc ↑i) :

Encode a coalition view tuple vI : (i : I) → PartyView In Coins sc i.1 into List Bool by listing encView i (vI ⟨i, hi⟩) for i ∈ I and [] for i ∉ I.

Named efficiency predicates for protocol and simulator families #

def Cslib.Crypto.Protocols.MPC.Protocol.Family.IsOraclePPT {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n : α → ℕ) {sc : α → Schedule m ot14Spec} {Coins Out : α → Fin m → Type} (proto : (a : α) → Protocol m ot14Spec (sc a) (fun (x : Fin m) => BitString (n a)) (Coins a) (Out a)) (encView : (a : α) → (i : Fin m) → PartyView (fun (x : Fin m) => BitString (n a)) (Coins a) (sc a) i → List Bool) (encOut : (a : α) → (i : Fin m) → Out a i → List Bool) :

A family of m-party $\text{OT}_1^4$-hybrid protocols proto a, indexed by a : α with n a-bit party inputs, has a uniform oracle-PPT joint word-level execution: the centralized runner Protocol.runEncoded, with party views encoded by encView a and outputs by encOut a, is Cslib.Probability.IsOraclePPTOn over the family input encoding encFamilyRunInput enc m n. One machine and clock serve every instance, and the runner is charged for the whole family input. This certifies the joint execution across all parties rather than separate per-party strategies.

def Cslib.Crypto.Protocols.MPC.CoalitionSimulator.Family.IsPPT {α : Type} (enc : α ↪ List Bool) (m : ℕ) (n k : α → ℕ) {spec : MultiOracleSpec} {sc : α → Schedule m spec} {Coins : α → Fin m → Type} (I : Finset (Fin m)) (encView : (a : α) → (i : Fin m) → PartyView (fun (x : Fin m) => BitString (n a)) (Coins a) (sc a) i → List Bool) (S : (a : α) → CoalitionSimulator (sc a) (fun (x : Fin m) => BitString (n a)) (Coins a) (fun (x : Fin m) => BitString (k a)) I) :

A family of coalition-I simulators S a, indexed by a : α with n a-bit party inputs and k a-bit party outputs, is uniformly PPT: on the family input encoding encFamilySimInput enc m n k I, sampling the simulated coalition views and encoding them with encodeCoalitionView (encView a) I is Cslib.Probability.IsPPTOn.