Documentation

CslibFrontier.Crypto.Protocols.MPC.Asymptotic

Asymptotic computational semi-honest security of protocol families #

semiHonestAdvantage measures one run of one protocol on one input tuple. This module gives the asymptotic notion: a ProtocolFamily has a protocol for each security parameter n and public parameters d, and ProtocolFamily.SemiHonestSecure P setup I E says that, with d drawn from the setup law setup n, some PPT simulator family for the coalition I makes the real and ideal runs indistinguishable for every PPT environment.

An environment (Environment) has two stages. Given n and d, it chooses all parties' inputs and keeps a state (InputChoice); after the run, it sees the views of the parties in I and the outputs of all parties, and returns a bit. In ProtocolFamily.realGame the views come from a run of the protocol; in ProtocolFamily.idealGame the outputs come from the functionality and a simulator computes the views from the inputs and outputs of the parties in I.

Efficiency is stated on encodings. A ProtocolFamily.Encoding writes the public parameters as a word and, for each party, its inputs, outputs and views as values of a fixed type with a fixed encoding (PartyEncoding), so that a protocol can represent group elements or other parameter-dependent values as records of words. An environment is PPT (Environment.IsPPT) when one uniform strict PPT machine computes each stage: the first reads (1ⁿ, d) and writes the inputs and the state, the second reads encGuessInput. A simulator family is PPT (SimulatorFamily.IsPPT) when one uniform strict PPT machine reads encSimInput, which holds 1ⁿ, d and the coalition's inputs and outputs, and writes the simulated views.

ProtocolFamily.SemiHonestSecure.of_perfect is the first property: a protocol family that is perfectly private at every n and d (the ideal and real joint distributions are equal) with a PPT simulator family is secure. ProtocolFamily.realGame_eq_idealGame is its game form, and ProtocolFamily.advantage_idealGame_le bounds the effect of replacing one simulator family by a statistically close one, as a protocol does when its exact simulator samples values that a bounded-time machine can only approximate.

Comparison with the sources #

[Lin17], Section 4.2, Definition 4.1 (p. 7) defines security of a two-party protocol against static semi-honest adversaries: there are PPT simulators S₁, S₂ such that S_i(1ⁿ, x_i, f_i(x)) paired with the functionality's output f(x) is computationally indistinguishable from party i's view paired with both parties' outputs. [Gol04], Definition 7.5.1 (general case, Eq. 7.40) is the m-party form, with a coalition I in place of one party. SemiHonestSecure P setup I E is the corresponding requirement for the coalition I; for two parties, Definition 4.1 corresponds to ∀ i, SemiHonestSecure P setup {i} E, with these differences:

Main definitions #

Main results #

CslibFrontier/Crypto/Protocols/MPC/DDHOT/Simulators.lean proves the notion across all static coalitions for DDH oblivious transfer with raw fair-coin bit-string party views from the DDH assumption (Cslib.Crypto.PrimeOrderGroupFamily.DDH.ddhOTProbFamily_semiHonestSecure, a stand-alone step toward [BS23], Theorem 23.7). The test module CslibFrontierTests.Crypto.MPCAsymptotic refutes it for a protocol that leaks a party's input bit, with a PPT environment, and proves it without assumptions for the protocol that delivers the bit as the functionality's output, through SemiHonestSecure.of_perfect.

References #

Protocol families, environments and simulators #

A family of m-party protocols: for each security parameter n and public parameters d, a protocol protocol n d in the oracle world world n d for the functionality functionality n d. The law of the public parameters is a separate argument of the games, as for F.DDH setup.

  • Desc : Type

    The type of public parameters.

  • spec : ℕ → self.Desc → MultiOracleSpec

    The oracle specification of the hybrid model; noOracleSpec in the plain model.

  • sc (n : ℕ) (d : self.Desc) : Schedule m (self.spec n d)

    The schedule of rounds.

  • In : ℕ → self.Desc → Fin m → Type

    The parties' input types.

  • Coins : ℕ → self.Desc → Fin m → Type

    The parties' coin types.

  • Out : ℕ → self.Desc → Fin m → Type

    The parties' output types.

  • protocol (n : ℕ) (d : self.Desc) : Protocol m (self.spec n d) (self.sc n d) (self.In n d) (self.Coins n d) (self.Out n d)

    The protocol.

  • world (n : ℕ) (d : self.Desc) : MultiOracleWorld (self.spec n d)

    The oracle world in which the protocol runs; noOracleWorld in the plain model.

  • functionality (n : ℕ) (d : self.Desc) : Functionality m (self.In n d) (self.Out n d)

    The functionality that the protocol computes.

structure Cslib.Crypto.Protocols.MPC.InputChoice {m : ℕ} (P : ProtocolFamily m) (n : ℕ) (d : P.Desc) :

The inputs that an environment chooses for one run of P at n and d, and the state it keeps for its guess.

  • inputs (i : Fin m) : P.In n d i

    The inputs of all parties.

  • state : List Bool

    The state passed to the guessing stage.

A two-stage environment against P when the parties in I are corrupted. Given the security parameter n and public parameters d, choose picks all parties' inputs and a state; guess sees the state, the views of the parties in I and the outputs of all parties, and returns a bit.

@[reducible, inline]

A simulator family for the coalition I of P: for each n and d, a simulator that produces the views of the parties in I from their inputs and outputs. Nothing here asks it to be efficient; SimulatorFamily.IsPPT does.

noncomputable def Cslib.Crypto.Protocols.MPC.ProtocolFamily.realGame {m : ℕ} (P : ProtocolFamily m) (setup : ℕ → PMF P.Desc) (I : Finset (Fin m)) (Z : Environment P I) (n : ℕ) :

The real game: draw public parameters d from the setup law, let Z choose the inputs, run the protocol, and give Z the views of the parties in I and all outputs.

noncomputable def Cslib.Crypto.Protocols.MPC.ProtocolFamily.idealGame {m : ℕ} (P : ProtocolFamily m) (setup : ℕ → PMF P.Desc) (I : Finset (Fin m)) (S : SimulatorFamily P I) (Z : Environment P I) (n : ℕ) :

The ideal game: draw public parameters d from the setup law, let Z choose the inputs, compute the outputs with the functionality, let S n d produce the views of the parties in I from their inputs and outputs, and give Z these views and all outputs.

Encodings and efficiency #

structure Cslib.Crypto.Protocols.MPC.PartyEncoding (Desc : Type) (m : ℕ) (X : ℕ → Desc → Fin m → Type) :

How machines read and write the values X n d i of each party i: as values of a fixed type Rep i with the fixed encoding enc i, through an injective map rep n d i at each security parameter and public parameters. A fixed type lets certificates use the polynomial-time calculus on representations, such as records of words for group elements.

  • Rep : Fin m → Type

    The representation type of party i's values.

  • enc (i : Fin m) : self.Rep i ↪ List Bool

    The encoding of party i's representations.

  • rep (n : ℕ) (d : Desc) (i : Fin m) : X n d i ↪ self.Rep i

    The representation of party i's values at n and d.

noncomputable def Cslib.Crypto.Protocols.MPC.PartyEncoding.encAll {m : ℕ} {Desc : Type} {X : ℕ → Desc → Fin m → Type} (e : PartyEncoding Desc m X) (n : ℕ) (d : Desc) :
((i : Fin m) → X n d i) ↪ List Bool

The word of the values of all parties at n and d: the table (encDPi) of their representations.

noncomputable def Cslib.Crypto.Protocols.MPC.PartyEncoding.encCoalition {m : ℕ} {Desc : Type} {X : ℕ → Desc → Fin m → Type} (e : PartyEncoding Desc m X) (n : ℕ) (d : Desc) (I : Finset (Fin m)) :
((i : ↥I) → X n d ↑i) ↪ List Bool

The word of the values of the parties in I at n and d: the table (encDPi) of their representations.

theorem Cslib.Crypto.Protocols.MPC.PartyEncoding.encCoalition_singleton {m : ℕ} {Desc : Type} {X : ℕ → Desc → Fin m → Type} (e : PartyEncoding Desc m X) (n : ℕ) (d : Desc) (i : Fin m) (x : (j : ↥{i}) → X n d ↑j) :
(e.encCoalition n d {i}) x = (Turing.MultiTapeTM.encPi Turing.MultiTapeTM.encBits) fun (x_1 : ↥{i}) => (e.enc i) ((e.rep n d i) (x ⟨i, ⋯⟩))

The word of the values of a single party i: the one-entry table of its representation.

theorem Cslib.Crypto.Protocols.MPC.PartyEncoding.encCoalition_apply_polyTime {m : ℕ} {Desc : Type} {X : ℕ → Desc → Fin m → Type} (e : PartyEncoding Desc m X) {I : Finset (Fin m)} {γ : Type} {enc : γ ↪ List Bool} {n : γ → ℕ} {d : γ → Desc} {v : (c : γ) → (i : ↥I) → X (n c) (d c) ↑i} (h : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => (e.encCoalition (n c) (d c) I) (v c)) enc Turing.MultiTapeTM.encBits) (i : ↥I) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => (e.rep (n c) (d c) ↑i) (v c i)) enc (e.enc ↑i)

Reading one member's value. From the word of a coalition's values, computed in polynomial time, the representation of member i's value is computed in polynomial time. A certificate applies it to encSimInput_inputs_polyTime or encSimInput_outputs_polyTime to read a coalition member's input or output from a simulator's input.

How machines read and write the public parameters, inputs, outputs and views of a protocol family. The encoding is part of what ProtocolFamily.SemiHonestSecure claims: it fixes the input lengths that bound the running time of environments and simulators.

The input of an environment's guessing stage against P with the parties in I corrupted, as a record: the security parameter, the public parameters, the saved state, the views of the parties in I and the outputs of all parties.

The input of a simulator for the coalition I of P, as a record: the security parameter, the public parameters, and the inputs and outputs of the parties in I.

  • secParam : ℕ

    The security parameter, given to machines in unary.

  • desc : P.Desc

    The public parameters.

  • inputs (i : ↥I) : P.In self.secParam self.desc ↑i

    The inputs of the parties in I.

  • outputs (i : ↥I) : P.Out self.secParam self.desc ↑i

    The outputs of the parties in I.

theorem Cslib.Crypto.Protocols.MPC.encGuessInput_mk_inO {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → P.Desc} {T1 S1 : γ → ℕ} {x2 : γ → List Bool} {T2 S2 : γ → ℕ} {x3 : (c : γ) → (i : ↥I) → PartyView (P.In (x0 c) (x1 c)) (P.Coins (x0 c) (x1 c)) (P.sc (x0 c) (x1 c)) ↑i} {T3 S3 : γ → ℕ} {x4 : (c : γ) → (i : Fin m) → P.Out (x0 c) (x1 c) i} {T4 S4 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn E.desc T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO x2 encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => (E.view.encCoalition (x0 c) (x1 c) I) (x3 c)) encIn Turing.MultiTapeTM.encBits T3 S3) (h4 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => (E.output.encAll (x0 c) (x1 c)) (x4 c)) encIn Turing.MultiTapeTM.encBits T4 S4) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { secParam := x0 x, desc := x1 x, state := x2 x, views := x3 x, outputs := x4 x }) encIn (encGuessInput E) (fun (x : γ) => T0 x + (T1 x + (T2 x + (T3 x + T4 x)))) fun (x : γ) => S0 x + (S1 x + (S2 x + (S3 x + S4 x)))
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_outputs_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → GuessInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_secParam_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → GuessInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_views_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GuessInput P I} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encGuessInput E) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (E.view.encCoalition (g✝ c).secParam (g✝ c).desc I) (g✝ c).views) encIn✝ Turing.MultiTapeTM.encBits S✝
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_secParam_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GuessInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_state_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → GuessInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_desc_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → GuessInput P I} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encGuessInput E) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).desc) encIn✝ E.desc
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_state_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GuessInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_views_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → GuessInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_mk_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ : Type} {encIn : γ ↪ List Bool} {budget x0 : γ → ℕ} {x1 : γ → P.Desc} {x2 : γ → List Bool} {x3 : (c : γ) → (i : ↥I) → PartyView (P.In (x0 c) (x1 c)) (P.Coins (x0 c) (x1 c)) (P.sc (x0 c) (x1 c)) ↑i} {x4 : (c : γ) → (i : Fin m) → P.Out (x0 c) (x1 c) i} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn E.desc budget) (h2 : Turing.MultiTapeTM.ComputableInSpace x2 encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (E.view.encCoalition (x0 c) (x1 c) I) (x3 c)) encIn Turing.MultiTapeTM.encBits budget) (h4 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (E.output.encAll (x0 c) (x1 c)) (x4 c)) encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { secParam := x0 x, desc := x1 x, state := x2 x, views := x3 x, outputs := x4 x }) encIn (encGuessInput E) budget
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_desc_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GuessInput P I} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encGuessInput E) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).desc) encIn✝ E.desc S✝
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_mk_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → ℕ} {x1 : γ → P.Desc} {x2 : γ → List Bool} {x3 : (c : γ) → (i : ↥I) → PartyView (P.In (x0 c) (x1 c)) (P.Coins (x0 c) (x1 c)) (P.sc (x0 c) (x1 c)) ↑i} {x4 : (c : γ) → (i : Fin m) → P.Out (x0 c) (x1 c) i} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn Turing.MultiTapeTM.encUnary) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn E.desc) (h2 : Turing.MultiTapeTM.ComputableInPolyTime x2 encIn Turing.MultiTapeTM.encBits) (h3 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => (E.view.encCoalition (x0 c) (x1 c) I) (x3 c)) encIn Turing.MultiTapeTM.encBits) (h4 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => (E.output.encAll (x0 c) (x1 c)) (x4 c)) encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { secParam := x0 x, desc := x1 x, state := x2 x, views := x3 x, outputs := x4 x }) encIn (encGuessInput E)
theorem Cslib.Crypto.Protocols.MPC.encGuessInput_desc_length_le {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) (a : GuessInput P I) :
(E.desc ((fun (a : GuessInput P I) => a.desc) a)).length ≤ ((encGuessInput E) a).length
@[reducible, inline]

The tuple of the fields of encGuessInput.

noncomputable def Cslib.Crypto.Protocols.MPC.encGuessInput {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) :

The encoding of a guessing-stage input: the unary security parameter, the public parameters E.desc d, the state, the word of the views of the parties in I (PartyEncoding.encCoalition) and the word of all outputs (PartyEncoding.encAll), each framed except the last.

theorem Cslib.Crypto.Protocols.MPC.encGuessInput_outputs_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → GuessInput P I} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encGuessInput E) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (E.output.encAll (g✝ c).secParam (g✝ c).desc) (g✝ c).outputs) encIn✝ Turing.MultiTapeTM.encBits S✝
theorem Cslib.Crypto.Protocols.MPC.encSimInput_desc_length_le {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) (a : SimInput P I) :
(E.desc ((fun (a : SimInput P I) => a.desc) a)).length ≤ ((encSimInput E) a).length
noncomputable def Cslib.Crypto.Protocols.MPC.encSimInput {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) :

The encoding of a simulator's input: the unary security parameter, the public parameters E.desc d, and the words of the inputs and of the outputs of the parties in I (PartyEncoding.encCoalition), each framed except the last.

theorem Cslib.Crypto.Protocols.MPC.encSimInput_secParam_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → SimInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encSimInput_outputs_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SimInput P I} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encSimInput E) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (E.output.encCoalition (g✝ c).secParam (g✝ c).desc I) (g✝ c).outputs) encIn✝ Turing.MultiTapeTM.encBits S✝
theorem Cslib.Crypto.Protocols.MPC.encSimInput_mk_inO {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ : Type} {encIn : γ ↪ List Bool} {x0 T0 S0 : γ → ℕ} {x1 : γ → P.Desc} {T1 S1 : γ → ℕ} {x2 : (c : γ) → (i : ↥I) → P.In (x0 c) (x1 c) ↑i} {T2 S2 : γ → ℕ} {x3 : (c : γ) → (i : ↥I) → P.Out (x0 c) (x1 c) ↑i} {T3 S3 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn Turing.MultiTapeTM.encUnary T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn E.desc T1 S1) (h2 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => (E.input.encCoalition (x0 c) (x1 c) I) (x2 c)) encIn Turing.MultiTapeTM.encBits T2 S2) (h3 : Turing.MultiTapeTM.ComputableInO (fun (c : γ) => (E.output.encCoalition (x0 c) (x1 c) I) (x3 c)) encIn Turing.MultiTapeTM.encBits T3 S3) :
Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { secParam := x0 x, desc := x1 x, inputs := x2 x, outputs := x3 x }) encIn (encSimInput E) (fun (x : γ) => T0 x + (T1 x + (T2 x + T3 x))) fun (x : γ) => S0 x + (S1 x + (S2 x + S3 x))
theorem Cslib.Crypto.Protocols.MPC.encSimInput_mk_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → ℕ} {x1 : γ → P.Desc} {x2 : (c : γ) → (i : ↥I) → P.In (x0 c) (x1 c) ↑i} {x3 : (c : γ) → (i : ↥I) → P.Out (x0 c) (x1 c) ↑i} (h0 : Turing.MultiTapeTM.ComputableInPolyTime x0 encIn Turing.MultiTapeTM.encUnary) (h1 : Turing.MultiTapeTM.ComputableInPolyTime x1 encIn E.desc) (h2 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => (E.input.encCoalition (x0 c) (x1 c) I) (x2 c)) encIn Turing.MultiTapeTM.encBits) (h3 : Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ) => (E.output.encCoalition (x0 c) (x1 c) I) (x3 c)) encIn Turing.MultiTapeTM.encBits) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => { secParam := x0 x, desc := x1 x, inputs := x2 x, outputs := x3 x }) encIn (encSimInput E)
theorem Cslib.Crypto.Protocols.MPC.encSimInput_desc_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SimInput P I} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encSimInput E) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).desc) encIn✝ E.desc S✝
theorem Cslib.Crypto.Protocols.MPC.encSimInput_secParam_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SimInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encSimInput_desc_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → SimInput P I} :
Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encSimInput E) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).desc) encIn✝ E.desc
theorem Cslib.Crypto.Protocols.MPC.encSimInput_outputs_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → SimInput P I} :
@[reducible, inline]

The tuple of the fields of encSimInput.

theorem Cslib.Crypto.Protocols.MPC.encSimInput_inputs_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → SimInput P I} :
Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encSimInput E) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (E.input.encCoalition (g✝ c).secParam (g✝ c).desc I) (g✝ c).inputs) encIn✝ Turing.MultiTapeTM.encBits S✝
theorem Cslib.Crypto.Protocols.MPC.encSimInput_inputs_polyTime {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → SimInput P I} :
theorem Cslib.Crypto.Protocols.MPC.encSimInput_desc_inO {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) :
Turing.MultiTapeTM.ComputableInO (fun (a : SimInput P I) => a.desc) (encSimInput E) E.desc (fun (a : SimInput P I) => ((encSimInput E) a).length) fun (a : SimInput P I) => ((encSimInput E) a).length
theorem Cslib.Crypto.Protocols.MPC.encSimInput_mk_budget {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} (E : P.Encoding) {γ : Type} {encIn : γ ↪ List Bool} {budget x0 : γ → ℕ} {x1 : γ → P.Desc} {x2 : (c : γ) → (i : ↥I) → P.In (x0 c) (x1 c) ↑i} {x3 : (c : γ) → (i : ↥I) → P.Out (x0 c) (x1 c) ↑i} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn Turing.MultiTapeTM.encUnary budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn E.desc budget) (h2 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (E.input.encCoalition (x0 c) (x1 c) I) (x2 c)) encIn Turing.MultiTapeTM.encBits budget) (h3 : Turing.MultiTapeTM.ComputableInSpace (fun (c : γ) => (E.output.encCoalition (x0 c) (x1 c) I) (x3 c)) encIn Turing.MultiTapeTM.encBits budget) :
Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { secParam := x0 x, desc := x1 x, inputs := x2 x, outputs := x3 x }) encIn (encSimInput E) budget

An environment is PPT for the encoding E when its choosing stage is computed by a uniform strict PPT machine that reads the unary security parameter and the public parameters and writes the table of the representations of the chosen inputs and the state, and its guessing stage by one that reads encGuessInput E and writes the output bit.

A simulator family is PPT for the encoding E when one uniform strict PPT machine reads encSimInput E and writes the table of the representations of the simulated views.

Asymptotic semi-honest security of the protocol family P with public parameters drawn from setup, against the static coalition I, for the encoding E ([Lin17], Definition 4.1, for each corrupted party; [Gol04], Definition 7.5.1, for a coalition): some simulator family S, PPT for E, makes the real game and the ideal game with S indistinguishable for every PPT environment. The environments are uniform and choose the inputs, and the public parameters come from a setup law; the module documentation lists these and the other differences from the sources.

theorem Cslib.Crypto.Protocols.MPC.ProtocolFamily.realGame_eq_idealGame {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} {setup : ℕ → PMF P.Desc} {S : SimulatorFamily P I} (h : ∀ (n : ℕ) (d : P.Desc) (x : (i : Fin m) → P.In n d i), (idealJoint (P.functionality n d) I (S n d) x).eval = (P.protocol n d).realJoint (P.world n d) I x) (Z : Environment P I) (n : ℕ) :
P.realGame setup I Z n = P.idealGame setup I S Z n

Perfect privacy makes the games equal: if at every n and d the ideal joint distribution with S n d equals the real one, the real game and the ideal game with S are equal for every environment.

theorem Cslib.Crypto.Protocols.MPC.ProtocolFamily.advantage_idealGame_le {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} {setup : ℕ → PMF P.Desc} {S S' : SimulatorFamily P I} {ε : NNReal} {n : ℕ} (h : ∀ (d : P.Desc) (xI : (i : ↥I) → P.In n d ↑i) (yI : (i : ↥I) → P.Out n d ↑i) (k : ((i : ↥I) → PartyView (P.In n d) (P.Coins n d) (P.sc n d) ↑i) → Game), Game.advantage ((S n d xI yI).eval.bind k) ((S' n d xI yI).eval.bind k) ≤ ε) (Z : Environment P I) :
(P.idealGame setup I S Z n).advantage (P.idealGame setup I S' Z n) ≤ ε

Replacing a simulator family by a close one. If at the security parameter n the simulators S n d and S' n d are within ε on every input against every test, the ideal games with S and with S' are within ε for every environment.

theorem Cslib.Crypto.Protocols.MPC.ProtocolFamily.SemiHonestSecure.of_perfect {m : ℕ} {P : ProtocolFamily m} {I : Finset (Fin m)} {setup : ℕ → PMF P.Desc} {E : P.Encoding} {S : SimulatorFamily P I} (hS : SimulatorFamily.IsPPT E S) (h : ∀ (n : ℕ) (d : P.Desc) (x : (i : Fin m) → P.In n d i), (idealJoint (P.functionality n d) I (S n d) x).eval = (P.protocol n d).realJoint (P.world n d) I x) :
P.SemiHonestSecure setup I E

Perfect privacy with PPT simulators gives security. If at every n and d the ideal joint distribution with S n d equals the real one, and S is PPT for E, then P is semi-honest secure against I for E.