Documentation

CslibFrontier.Crypto.Protocols.MPC.Yao

Yao's two-party protocol in the oblivious-transfer hybrid model #

Yao's protocol [Yao86] for a Boolean circuit C : Circuit σ (n₀ + n₁) m, in the form analysed by Lindell and Pinkas [LP09], with the point-and-permute garbling of Cslib.Crypto.Garbling. Party 0, the garbler, holds x₀ : Fin n₀ → Bool; party 1, the evaluator, holds x₁ : Fin n₁ → Bool. The garbler samples uniform wire keys and permutation bits, garbles C, and sends the garbled table, the labels of its own input bits and the decoding bits. The parties then make one call to the ideal batched oblivious transfer batchOTSpec n₁ (K × Bool): the garbler offers both labels of each of the evaluator's input wires and the evaluator chooses with its input bits. The evaluator evaluates the table on all input labels and decodes. In the one-sided output protocol (yaoProtocol, yaoFunctionality), only the evaluator receives the output C.eval I (Fin.append x₀ x₁); in the two-output protocol (yaoBothProtocol, yaoBothFunctionality), the evaluator sends the decoded output to the garbler in a final message round so that both parties receive C.eval I (Fin.append x₀ x₁).

These are the two cases of Goldreich's two-party semi-honest definition (Definition 7.2.1), one simulator per corrupted party, stated on the joint distribution of the corrupted party's view and both outputs, with a concrete distinguishing advantage in place of computational indistinguishability.

Scope: the oblivious transfer is the ideal oracle, and no composition theorem replaces it by a protocol. The bounds are for a single instance (circuit, inputs and distinguisher fixed), with no security parameter; running time is not tracked, and neither the simulators nor the reductions are certified efficient. Both the one-sided output protocol (yaoProtocol, where only the evaluator receives the circuit output) and the symmetric two-output protocol (yaoBothProtocol, where the evaluator sends the decoded output back to the garbler via Steps.append) are covered. The asymptotic one-sided and two-output protocols over word-level garbling schemes, with PPT simulators and certified reductions, are the protocol families Yao.oneSidedFamily and Yao.family of CslibFrontier.Crypto.Protocols.MPC.Yao.Family and CslibFrontier.Crypto.Protocols.MPC.Yao.Security.

Main definitions #

Main results #

References #

@[reducible]
def Cslib.Crypto.Protocols.MPC.YaoIn (n₀ n₁ : ℕ) :
Fin 2 → Type

The inputs: n₀ bits for the garbler (party 0) and n₁ bits for the evaluator (party 1).

structure Cslib.Crypto.Protocols.MPC.GarblerCoins {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) :

The garbler's coins.

@[reducible]
def Cslib.Crypto.Protocols.MPC.YaoCoins {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) :
Fin 2 → Type

The coins: the garbler's keys and permutation bits; the evaluator uses none.

@[reducible]

The outputs: nothing for the garbler and the circuit's output for the evaluator.

structure Cslib.Crypto.Protocols.MPC.YaoMessage (n₀ : ℕ) {n₁ m s : ℕ} (τ : Circuits.Circuit.Topology (n₀ + n₁) m s) (K : Type) :

The garbler's message: the garbled table, the labels of its own input bits and the decoding bits.

theorem Cslib.Crypto.Protocols.MPC.YaoMessage.ext_iff {n₀ n₁ m s : ℕ} {τ : Circuits.Circuit.Topology (n₀ + n₁) m s} {K : Type} {x y : YaoMessage n₀ τ K} :
theorem Cslib.Crypto.Protocols.MPC.YaoMessage.ext {n₀ n₁ m s : ℕ} {τ : Circuits.Circuit.Topology (n₀ + n₁) m s} {K : Type} {x y : YaoMessage n₀ τ K} (table : x.table = y.table) (labels : x.labels = y.labels) (decoding : x.decoding = y.decoding) :
x = y
@[reducible]
def Cslib.Crypto.Protocols.MPC.yaoSchedule {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) :

The schedule: the garbler sends its message, then the parties run one batched oblivious transfer of the labels of the evaluator's input bits.

def Cslib.Crypto.Protocols.MPC.YaoMessage.ofGarbled {n₀ n₁ m : ℕ} {K : Type} {s : ℕ} {τ : Circuits.Circuit.Topology (n₀ + n₁) m s} (G : Garbling.Garbled τ K) (x₀ : Fin n₀ → Bool) :
YaoMessage n₀ τ K

The garbler's message for a garbled circuit and the garbler's input.

def Cslib.Crypto.Protocols.MPC.yaoDecode {n₀ n₁ m : ℕ} {K T : Type} {s : ℕ} {τ : Circuits.Circuit.Topology (n₀ + n₁) m s} [AddCommGroup K] (F : K → T → K × Bool) (tw : Garbling.Slot τ → T) (M : YaoMessage n₀ τ K) (Y : Fin n₁ → K × Bool) :
Fin m → Bool

The evaluator's output: evaluate the table on the garbler's labels followed by its own, then decode.

@[reducible]
def Cslib.Crypto.Protocols.MPC.YaoFinal {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) (i : Fin 2) :

The local state of each party after the oblivious transfer.

noncomputable def Cslib.Crypto.Protocols.MPC.sampleGarblerCoins {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) [Fintype K] [Nonempty K] :

Sample the garbler's coins uniformly.

def Cslib.Crypto.Protocols.MPC.yaoCoins {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K : Type} (C : Circuits.Circuit σ (n₀ + n₁) m) (c : GarblerCoins C K) (i : Fin 2) :
YaoCoins C K i

The garbler's coins as a coin tuple.

def Cslib.Crypto.Protocols.MPC.yaoInput {n₀ n₁ : ℕ} (x : (i : Fin 2) → YaoIn n₀ n₁ i) :
Fin (n₀ + n₁) → Bool

The circuit's input: the garbler's bits followed by the evaluator's.

def Cslib.Crypto.Protocols.MPC.yaoOutputs {m : ℕ} (y : Fin m → Bool) (i : Fin 2) :
YaoOut m i

The output tuple for a circuit output y: nothing for the garbler, y for the evaluator.

The two-party functionality: the evaluator learns C.eval I (Fin.append x₀ x₁) and the garbler learns nothing.

def Cslib.Crypto.Protocols.MPC.evaluatorView {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K : Type} (C : Circuits.Circuit σ (n₀ + n₁) m) (x₁ : Fin n₁ → Bool) (V : Garbling.View C.topology K) :
PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoSchedule C K) 1

The evaluator's view when the view of the garbled circuit is V and its input is x₁: the garbler's message carries the table, the labels of the garbler's input wires and the decoding bits, and the oblivious transfer delivers the labels of the evaluator's input wires.

def Cslib.Crypto.Protocols.MPC.garblerView {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K : Type} (C : Circuits.Circuit σ (n₀ + n₁) m) (x₀ : Fin n₀ → Bool) (c : GarblerCoins C K) :
PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoSchedule C K) 0

The garbler's view: its input and coins; it receives nothing.

noncomputable def Cslib.Crypto.Protocols.MPC.yaoGarblerSim {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) [Fintype K] [Nonempty K] :
CoalitionSimulator (yaoSchedule C K) (YaoIn n₀ n₁) (YaoCoins C K) (YaoOut m) {0}

The simulator for a corrupted garbler: fresh coins and nothing received.

def Cslib.Crypto.Protocols.MPC.yaoEvaluatorDistinguisher {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K : Type} (C : Circuits.Circuit σ (n₀ + n₁) m) (x₁ : Fin n₁ → Bool) (y : Fin m → Bool) (D : ((i : ↥{1}) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoSchedule C K) ↑i) × ((i : Fin 2) → YaoOut m i) → ProbComp Bool) (V : Garbling.View C.topology K) :

The distinguisher on views of the garbled circuit that a distinguisher D on the evaluator's joint view and outputs induces, for input tuple x and circuit output y.

def Cslib.Crypto.Protocols.MPC.yaoSend {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (st : (Fin n₀ → Bool) × GarblerCoins C K) :

The garbler's message from its input and coins.

def Cslib.Crypto.Protocols.MPC.yaoQuery {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (s : Fin 2) (st : (YaoIn n₀ n₁ s × YaoCoins C K s) × (Round.message 0 1 (YaoMessage n₀ C.topology K)).Received s) :
(batchOTSpec n₁ (K × Bool)).Query () s

The oblivious-transfer queries: the garbler offers both labels of each of the evaluator's input wires, and the evaluator chooses with its input bits.

def Cslib.Crypto.Protocols.MPC.yaoOutput {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] (C : Circuits.Circuit σ (n₀ + n₁) m) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (i : Fin 2) (st : YaoFinal C K i) :
YaoOut m i

The outputs: the garbler outputs nothing; the evaluator decodes with the garbler's message and the labels from the oblivious transfer.

noncomputable def Cslib.Crypto.Protocols.MPC.yaoProtocol {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) :
Protocol 2 (batchOTSpec n₁ (K × Bool)) (yaoSchedule C K) (YaoIn n₀ n₁) (YaoCoins C K) (YaoOut m)

Yao's protocol in the batched oblivious-transfer hybrid model. The garbler garbles C with uniform keys and permutation bits and sends the garbled table, the labels of its own input bits and the decoding bits. The evaluator obtains the labels of its input bits by one batched oblivious transfer, evaluates the table and decodes.

theorem Cslib.Crypto.Protocols.MPC.yaoDecode_ofGarbled {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] {s : ℕ} {τ : Circuits.Circuit.Topology (n₀ + n₁) m s} (G : Garbling.Garbled τ K) (F : K → T → K × Bool) (tw : Garbling.Slot τ → T) (x₀ : Fin n₀ → Bool) (x₁ : Fin n₁ → Bool) :
(yaoDecode F tw (YaoMessage.ofGarbled G x₀) fun (j : Fin n₁) => G.encoding (Fin.natAdd n₀ j) (x₁ j)) = G.run F tw (Fin.append x₀ x₁)

Decoding the message of a garbled circuit with the labels of the evaluator's bits runs the garbled circuit on the whole input.

theorem Cslib.Crypto.Protocols.MPC.yao_output_of_mem_support {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) {r : ((i : Fin 2) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoSchedule C K) i) × ((i : Fin 2) → YaoOut m i)} (hr : r ∈ ((yaoProtocol C I F tw).evalWith (batchOTWorld n₁ (K × Bool)) x).support) :
r.2 = yaoOutputs (C.eval I (yaoInput x))

Correctness: in every run of Yao's protocol the evaluator outputs C.eval I (Fin.append x₀ x₁) and the garbler outputs nothing.

theorem Cslib.Crypto.Protocols.MPC.realJoint_yao_evaluator {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) :

The real joint distribution for a corrupted evaluator: its view is determined by the view of the garbled circuit on the whole input.

theorem Cslib.Crypto.Protocols.MPC.realJoint_yao_garbler {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) :

The real joint distribution for a corrupted garbler: fresh coins and nothing received.

theorem Cslib.Crypto.Protocols.MPC.idealJoint_yao_garbler {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) :

Perfect privacy against the garbler: the ideal joint distribution with the simulator yaoGarblerSim equals the real one.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_yao_garbler {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) (D : ((i : ↥{0}) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoSchedule C K) ↑i) × ((i : Fin 2) → YaoOut m i) → ProbComp Bool) :

A corrupted garbler has advantage zero against every distinguisher.

noncomputable def Cslib.Crypto.Protocols.MPC.yaoEvaluatorSim {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) :
CoalitionSimulator (yaoSchedule C K) (YaoIn n₀ n₁) (YaoCoins C K) (YaoOut m) {1}

The simulator for a corrupted evaluator: the simulated view of the garbled circuit from the topology and the output, placed in the evaluator's view.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_yao_evaluator_le {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] [Fintype T] [DecidableEq T] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (htw : Function.Injective tw) (x : (i : Fin 2) → YaoIn n₀ n₁ i) (D : ((i : ↥{1}) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoSchedule C K) ↑i) × ((i : Fin 2) → YaoOut m i) → ProbComp Bool) :
semiHonestAdvantage (yaoProtocol C I F tw) (batchOTWorld n₁ (K × Bool)) (yaoFunctionality C I) {1} (yaoEvaluatorSim C F tw) x D ≤ ∑ j ∈ Finset.range (n₀ + n₁ + C.size), PRF.advantage F (Garbling.reduction C I F tw (yaoInput x) (yaoEvaluatorDistinguisher C (x 1) (C.eval I (yaoInput x)) D) j)

Privacy against the evaluator: every distinguisher's advantage between the ideal joint distribution with yaoEvaluatorSim and the real one is at most the sum of the PRF advantages of the n₀ + n₁ + C.size reductions of the garbling scheme, against the distinguisher on views of the garbled circuit that D induces.

Two-output Yao protocol (both parties learn the output) #

@[reducible]

The return round in which the evaluator sends the decoded output to the garbler.

@[reducible]
def Cslib.Crypto.Protocols.MPC.yaoBothSchedule {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) :

The schedule of two-output Yao's protocol: yaoSchedule C K followed by the evaluator sending the decoded output to the garbler.

def Cslib.Crypto.Protocols.MPC.yaoBothFunctionality {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) :
Functionality 2 (YaoIn n₀ n₁) fun (x : Fin 2) => Fin m → Bool

The two-party functionality in which both the garbler and the evaluator learn C.eval I (Fin.append x₀ x₁).

def Cslib.Crypto.Protocols.MPC.yaoReturnSteps (n₁ : ℕ) (K : Type) (m : ℕ) :
Steps (YaoOut m) (fun (x : Fin 2) => Fin m → Bool) (yaoReturnSchedule n₁ K m)

After yaoProtocol computes YaoOut m (() for the garbler and y : Fin m → Bool for the evaluator), the evaluator sends y to the garbler and both parties output y.

def Cslib.Crypto.Protocols.MPC.evaluatorBothView {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K : Type} (C : Circuits.Circuit σ (n₀ + n₁) m) (x₁ : Fin n₁ → Bool) (V : Garbling.View C.topology K) :
PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoBothSchedule C K) 1

The evaluator's view in yaoBothProtocol when the view of the garbled circuit is V and its input is x₁: its view in yaoProtocol, followed by nothing received in the return round.

def Cslib.Crypto.Protocols.MPC.garblerBothView {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K : Type} (C : Circuits.Circuit σ (n₀ + n₁) m) (x₀ : Fin n₀ → Bool) (c : GarblerCoins C K) (y : Fin m → Bool) :
PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoBothSchedule C K) 0

The garbler's view in yaoBothProtocol: its input, its coins, nothing received in the first two rounds, and the output y received from the evaluator in the return round.

noncomputable def Cslib.Crypto.Protocols.MPC.yaoBothGarblerSim {σ : Circuits.Signature} {n₀ n₁ m : ℕ} (C : Circuits.Circuit σ (n₀ + n₁) m) (K : Type) [Fintype K] [Nonempty K] :
CoalitionSimulator (yaoBothSchedule C K) (YaoIn n₀ n₁) (YaoCoins C K) (fun (x : Fin 2) => Fin m → Bool) {0}

The simulator for a corrupted garbler in yaoBothProtocol: sample fresh coins and deliver the garbler's output yI ⟨0, _⟩ as the evaluator's return message.

noncomputable def Cslib.Crypto.Protocols.MPC.yaoBothEvaluatorSim {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) :
CoalitionSimulator (yaoBothSchedule C K) (YaoIn n₀ n₁) (YaoCoins C K) (fun (x : Fin 2) => Fin m → Bool) {1}

The simulator for a corrupted evaluator in yaoBothProtocol: simulate the garbled circuit view from the topology and the evaluator's output, placed in evaluatorBothView.

def Cslib.Crypto.Protocols.MPC.yaoBothEvaluatorDistinguisher {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K : Type} (C : Circuits.Circuit σ (n₀ + n₁) m) (x₁ : Fin n₁ → Bool) (y : Fin m → Bool) (D : ((i : ↥{1}) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoBothSchedule C K) ↑i) × (Fin 2 → Fin m → Bool) → ProbComp Bool) (V : Garbling.View C.topology K) :

The distinguisher on views of the garbled circuit that a distinguisher D on the evaluator's joint view and outputs in yaoBothProtocol induces.

noncomputable def Cslib.Crypto.Protocols.MPC.yaoBothProtocol {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) :
Protocol 2 (batchOTSpec n₁ (K × Bool)) (yaoBothSchedule C K) (YaoIn n₀ n₁) (YaoCoins C K) fun (x : Fin 2) => Fin m → Bool

Yao's protocol with output for both parties in the batched oblivious-transfer hybrid model: yaoProtocol followed by the evaluator sending the decoded output to the garbler.

theorem Cslib.Crypto.Protocols.MPC.yaoBoth_output_of_mem_support {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) {r : ((i : Fin 2) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoBothSchedule C K) i) × (Fin 2 → Fin m → Bool)} (hr : r ∈ ((yaoBothProtocol C I F tw).evalWith (batchOTWorld n₁ (K × Bool)) x).support) :
r.2 = fun (x_1 : Fin 2) => C.eval I (yaoInput x)

Correctness of two-output Yao's protocol: in every run both the garbler and the evaluator output C.eval I (Fin.append x₀ x₁).

theorem Cslib.Crypto.Protocols.MPC.realJoint_yaoBoth_evaluator {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) :
(yaoBothProtocol C I F tw).realJoint (batchOTWorld n₁ (K × Bool)) {1} x = PMF.map (fun (G : Garbling.Garbled C.topology K) => (singletonView (evaluatorBothView C (x 1) (G.view (yaoInput x))), fun (x_1 : Fin 2) => C.eval I (yaoInput x))) (Garbling.garble C I F tw).eval

The real joint distribution for a corrupted evaluator in yaoBothProtocol.

theorem Cslib.Crypto.Protocols.MPC.realJoint_yaoBoth_garbler {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) :
(yaoBothProtocol C I F tw).realJoint (batchOTWorld n₁ (K × Bool)) {0} x = PMF.map (fun (c : GarblerCoins C K) => (singletonView (garblerBothView C (x 0) c (C.eval I (yaoInput x))), fun (x_1 : Fin 2) => C.eval I (yaoInput x))) (sampleGarblerCoins C K).eval

The real joint distribution for a corrupted garbler in yaoBothProtocol: fresh coins and the circuit output received in the return round.

theorem Cslib.Crypto.Protocols.MPC.idealJoint_yaoBoth_garbler {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) :

Perfect privacy against the garbler in yaoBothProtocol: the ideal joint distribution with yaoBothGarblerSim equals the real one.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_yaoBoth_garbler {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) (D : ((i : ↥{0}) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoBothSchedule C K) ↑i) × (Fin 2 → Fin m → Bool) → ProbComp Bool) :

A corrupted garbler in yaoBothProtocol has advantage zero against every distinguisher.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_yaoBoth_evaluator_eq {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (x : (i : Fin 2) → YaoIn n₀ n₁ i) (D : ((i : ↥{1}) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoBothSchedule C K) ↑i) × (Fin 2 → Fin m → Bool) → ProbComp Bool) :

In yaoBothProtocol, a distinguisher's advantage for a corrupted evaluator equals its distinguishing advantage between the garbling scheme's realGame and simGame.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_yaoBoth_evaluator_le {σ : Circuits.Signature} {n₀ n₁ m : ℕ} {K T : Type} [AddCommGroup K] [Fintype K] [Nonempty K] [Fintype T] [DecidableEq T] (C : Circuits.Circuit σ (n₀ + n₁) m) (I : Circuits.Interpretation σ Bool) (F : K → T → K × Bool) (tw : Garbling.Slot C.topology → T) (htw : Function.Injective tw) (x : (i : Fin 2) → YaoIn n₀ n₁ i) (D : ((i : ↥{1}) → PartyView (YaoIn n₀ n₁) (YaoCoins C K) (yaoBothSchedule C K) ↑i) × (Fin 2 → Fin m → Bool) → ProbComp Bool) :

Privacy against the evaluator in yaoBothProtocol: every distinguisher's advantage between the ideal joint distribution with yaoBothEvaluatorSim and the real one is at most the sum of the PRF advantages of the n₀ + n₁ + C.size reductions of the garbling scheme.