Documentation

CslibFrontier.Crypto.Protocols.MPC.Composition.HybridGame

The round hybrids of a composed protocol as games of one environment #

CslibFrontier/Crypto/Protocols/MPC/Composition/Hybrid.lean bounds the subprotocol-replacement gap of a composed protocol by Composition.replacementBound, an expectation over the earlier rounds of the advantages of distinguishers that depend on the outcome of these rounds. The absolute value is inside that expectation, so the bound cannot be compared with the advantage of one distinguisher that samples the earlier rounds itself: E |X| ≥ |E X|.

This module gives the hybrid argument with the absolute value outside. The j-th hybrid of the kernel program Composition.kernelRun draws the first j oracle rounds from the real kernel and the later ones from the ideal kernel. Consecutive hybrids differ in the kernel of one oracle round, and both are the game of one environment, Composition.roundEnv: it runs the first j oracle rounds on the real kernel and stops at the next one with a Composition.RoundChallenge: the operation of that round, the corrupted slots, the query tuple, and a guessing stage, the program Composition.roundDistinguisher, which simulates the remaining rounds and runs the given test. Composition.roundGame κ draws the challenged round from the kernel κ and runs the guessing stage. The environment does not depend on κ, so for κ the ideal and the real joint distribution of a subprotocol the two games are the ideal and the real semi-honest game of that subprotocol against one environment that chooses the input tuple.

Everything here is original bookkeeping for the hybrid argument in the proof of Goldreich's composition theorem (Section 7.5.2.1, Theorem 7.5.7), not a cited statement. The statements are equalities of distributions and triangle inequalities: there is no security parameter, the first stage of an environment is a distribution rather than a program, because it draws the earlier rounds from the real joint distributions, and nothing is claimed about the efficiency of either stage. The asymptotic composition theorem is not proved here (#6045).

Main definitions #

Main results #

References #

The number of oracle rounds of a schedule.

structure Cslib.Crypto.Protocols.MPC.Composition.RoundChallenge {spec₁ spec₂ : MultiOracleSpec} (sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂) (Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type) :

A challenged oracle round. The oracle operation op of the round, the corrupted slots coalition, the query tuple query of the slots, and the guessing stage guess, a program that turns the views of the corrupted slots in a subprotocol for op and the answers of all slots into a bit.

  • op : spec₁.Op

    The oracle operation of the challenged round.

  • coalition : Finset (Fin (spec₁.arity self.op))

    The corrupted slots of the operation.

  • query (s : Fin (spec₁.arity self.op)) : spec₁.Query self.op s

    The query tuple of the slots.

  • guess : ((s : ↥self.coalition) → PartyView (spec₁.Query self.op) (Coins₂ self.op) (sc₂ self.op) ↑s) × ((s : Fin (spec₁.arity self.op)) → spec₁.Answer self.op s) → ProbComp Bool

    The guess from the views of the corrupted slots and the answers of all slots.

noncomputable def Cslib.Crypto.Protocols.MPC.Composition.roundGame {spec₁ spec₂ : MultiOracleSpec} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (κ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) :
Bool ⊕ RoundChallenge sc₂ Coins₂ → Game

The game of a challenged round on the kernel κ. An environment either has already decided its bit, or it stops at a challenged round c; the views of the corrupted slots and the answers of that round are then drawn from κ c.op c.coalition c.query and given to the guessing stage. For κ the ideal and the real joint distribution of a subprotocol, the two games on c are the two games of semiHonestAdvantage for that subprotocol, on the input tuple c.query against c.guess.

theorem Cslib.Crypto.Protocols.MPC.Composition.bind_elim_bind_roundGame {spec₁ spec₂ : MultiOracleSpec} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} {β : Type} (κ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) (e : PMF (Bool ⊕ β)) (g : β → PMF (Bool ⊕ RoundChallenge sc₂ Coins₂)) :
(e.bind (Sum.elim (fun (b : Bool) => PMF.pure (Sum.inl b)) g)).bind (roundGame κ) = e.bind (Sum.elim PMF.pure fun (a : β) => (g a).bind (roundGame κ))

Two stages as one environment. An outer stage e that either decides a bit or produces an index a, followed by an environment g a, is one environment: its round game is the outer stage followed by the round game of g a.

noncomputable def Cslib.Crypto.Protocols.MPC.Composition.roundEnv {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (W₁ : MultiOracleWorld spec₁) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (ν : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) (I : Finset (Fin m)) {State Out : Fin m → Type} {sc₁ : Schedule m spec₁} (steps : Steps State Out sc₁) (j : ℕ) (st : (i : Fin m) → State i) (D : ((i : ↥I) → Schedule.SubCoins Coins₂ sc₁ ↑i × (Schedule.compose sc₂ sc₁).Received ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) :
PMF (Bool ⊕ RoundChallenge sc₂ Coins₂)

The environment of the j-th hybrid hop of a kernel program. It runs steps from the states st, drawing the first j oracle rounds from the kernel ν, and stops at the next oracle round with the challenge of that round. The guessing stage is roundDistinguisher: it delivers the answers, runs the remaining rounds with the ideal functionalities W₁ and the simulators S₂, puts the given views in front of the result and runs the test D. When steps has at most j oracle rounds, the environment runs D itself and returns the bit.

roundGame on the ideal joint distributions after this environment is the j-th hybrid of the kernel program, and roundGame ν the hybrid j + 1 (roundEnv_succ_bind_roundGame).

theorem Cslib.Crypto.Protocols.MPC.Composition.roundEnv_zero_bind_roundGame {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (W₁ : MultiOracleWorld spec₁) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (ν : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) (I : Finset (Fin m)) {State Out : Fin m → Type} {sc₁ : Schedule m spec₁} (steps : Steps State Out sc₁) (st : (i : Fin m) → State i) (D : ((i : ↥I) → Schedule.SubCoins Coins₂ sc₁ ↑i × (Schedule.compose sc₂ sc₁).Received ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) :
(roundEnv W₁ S₂ ν I steps 0 st D).bind (roundGame fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (idealJoint (W₁ op) J (S₂ op J) q).eval) = (kernelRun (fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (idealJoint (W₁ op) J (S₂ op J) q).eval) I steps st).bind fun (res : ((i : ↥I) → Schedule.SubCoins Coins₂ sc₁ ↑i × (Schedule.compose sc₂ sc₁).Received ↑i) × ((i : Fin m) → Out i)) => (D res).eval

The first hybrid is the ideal run. The game of the environment of hop 0 on the ideal joint distributions is the kernel program on these distributions followed by the test.

theorem Cslib.Crypto.Protocols.MPC.Composition.roundEnv_succ_bind_roundGame {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (W₁ : MultiOracleWorld spec₁) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (ν : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) (I : Finset (Fin m)) {State Out : Fin m → Type} {sc₁ : Schedule m spec₁} (steps : Steps State Out sc₁) (j : ℕ) (st : (i : Fin m) → State i) (D : ((i : ↥I) → Schedule.SubCoins Coins₂ sc₁ ↑i × (Schedule.compose sc₂ sc₁).Received ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) :
(roundEnv W₁ S₂ ν I steps (j + 1) st D).bind (roundGame fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (idealJoint (W₁ op) J (S₂ op J) q).eval) = (roundEnv W₁ S₂ ν I steps j st D).bind (roundGame ν)

Consecutive hybrids differ in the kernel of one round. The game of the environment of hop j + 1 on the ideal joint distributions is the game of the environment of hop j on the kernel ν: both draw the first j + 1 oracle rounds from ν and the later ones from the ideal joint distributions.

theorem Cslib.Crypto.Protocols.MPC.Composition.roundEnv_bind_roundGame_of_oracleRounds_le {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (W₁ : MultiOracleWorld spec₁) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (ν : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) (I : Finset (Fin m)) {State Out : Fin m → Type} {sc₁ : Schedule m spec₁} (κ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) (steps : Steps State Out sc₁) {j : ℕ} (hj : sc₁.oracleRounds ≤ j) (st : (i : Fin m) → State i) (D : ((i : ↥I) → Schedule.SubCoins Coins₂ sc₁ ↑i × (Schedule.compose sc₂ sc₁).Received ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) :
(roundEnv W₁ S₂ ν I steps j st D).bind (roundGame κ) = (kernelRun ν I steps st).bind fun (res : ((i : ↥I) → Schedule.SubCoins Coins₂ sc₁ ↑i × (Schedule.compose sc₂ sc₁).Received ↑i) × ((i : Fin m) → Out i)) => (D res).eval

The last hybrid is the real run. When steps has at most j oracle rounds, the environment of hop j challenges no round, and its game on any kernel κ is the kernel program on ν followed by the test.

noncomputable def Cslib.Crypto.Protocols.MPC.composeRoundEnv {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₁ : Schedule m spec₁} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {In Coins₁ Out : Fin m → Type} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (P : Protocol m spec₁ sc₁ In Coins₁ Out) (W₁ : MultiOracleWorld spec₁) (W₂ : MultiOracleWorld spec₂) (Sub : (op : spec₁.Op) → Protocol (spec₁.arity op) spec₂ (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op)) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (I : Finset (Fin m)) (x : (i : Fin m) → In i) (D : ((i : ↥I) → PartyView In (Schedule.ComposedCoins Coins₂ Coins₁ sc₁) (Schedule.compose sc₂ sc₁) ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) (j : ℕ) :

The environment of the j-th hybrid hop of a composed protocol. For the outer protocol P on the input tuple x and a distinguisher D of the coalition I's views of P.compose Sub, it samples the outer coins, runs P.steps with the first j oracle rounds drawn from the real joint distributions (Sub op).realJoint W₂ of the subprotocols, and stops at the next oracle round with the challenge of that round (Composition.roundEnv): the guessing stage Composition.roundDistinguisher simulates the later rounds with W₁ and S₂ and runs D.

theorem Cslib.Crypto.Protocols.MPC.composeRoundEnv_zero_bind_roundGame {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₁ : Schedule m spec₁} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {In Coins₁ Out : Fin m → Type} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (P : Protocol m spec₁ sc₁ In Coins₁ Out) (W₁ : MultiOracleWorld spec₁) (W₂ : MultiOracleWorld spec₂) (Sub : (op : spec₁.Op) → Protocol (spec₁.arity op) spec₂ (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op)) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (I : Finset (Fin m)) (x : (i : Fin m) → In i) (D : ((i : ↥I) → PartyView In (Schedule.ComposedCoins Coins₂ Coins₁ sc₁) (Schedule.compose sc₂ sc₁) ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) :
(composeRoundEnv P W₁ W₂ Sub S₂ I x D 0).bind (Composition.roundGame fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (idealJoint (W₁ op) J (S₂ op J) q).eval) = (P.realJoint W₁ I x).bind fun (r : ((i : ↥I) → PartyView In Coins₁ sc₁ ↑i) × ((i : Fin m) → Out i)) => (composeDistinguisher P S₂ I x D r).eval

The first hybrid of a composed protocol. The ideal game of the environment of hop 0 is the real execution of the outer protocol P in W₁ against the reduction composeDistinguisher P S₂ I x D.

theorem Cslib.Crypto.Protocols.MPC.composeRoundEnv_succ_bind_roundGame {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₁ : Schedule m spec₁} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {In Coins₁ Out : Fin m → Type} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (P : Protocol m spec₁ sc₁ In Coins₁ Out) (W₁ : MultiOracleWorld spec₁) (W₂ : MultiOracleWorld spec₂) (Sub : (op : spec₁.Op) → Protocol (spec₁.arity op) spec₂ (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op)) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (I : Finset (Fin m)) (x : (i : Fin m) → In i) (D : ((i : ↥I) → PartyView In (Schedule.ComposedCoins Coins₂ Coins₁ sc₁) (Schedule.compose sc₂ sc₁) ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) (j : ℕ) :
(composeRoundEnv P W₁ W₂ Sub S₂ I x D (j + 1)).bind (Composition.roundGame fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (idealJoint (W₁ op) J (S₂ op J) q).eval) = (composeRoundEnv P W₁ W₂ Sub S₂ I x D j).bind (Composition.roundGame fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (Sub op).realJoint W₂ J q)

Consecutive hybrids of a composed protocol. The ideal game of the environment of hop j + 1 is the real game of the environment of hop j.

theorem Cslib.Crypto.Protocols.MPC.composeRoundEnv_bind_roundGame_of_oracleRounds_le {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₁ : Schedule m spec₁} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {In Coins₁ Out : Fin m → Type} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (P : Protocol m spec₁ sc₁ In Coins₁ Out) (W₁ : MultiOracleWorld spec₁) (W₂ : MultiOracleWorld spec₂) (Sub : (op : spec₁.Op) → Protocol (spec₁.arity op) spec₂ (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op)) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (I : Finset (Fin m)) (x : (i : Fin m) → In i) (D : ((i : ↥I) → PartyView In (Schedule.ComposedCoins Coins₂ Coins₁ sc₁) (Schedule.compose sc₂ sc₁) ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) (κ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → ((s : Fin (spec₁.arity op)) → spec₁.Query op s) → PMF (((s : ↥J) → PartyView (spec₁.Query op) (Coins₂ op) (sc₂ op) ↑s) × ((s : Fin (spec₁.arity op)) → spec₁.Answer op s))) {j : ℕ} (hj : sc₁.oracleRounds ≤ j) :
(composeRoundEnv P W₁ W₂ Sub S₂ I x D j).bind (Composition.roundGame κ) = ((P.compose Sub).realJoint W₂ I x).bind fun (r : ((i : ↥I) → PartyView In (Schedule.ComposedCoins Coins₂ Coins₁ sc₁) (Schedule.compose sc₂ sc₁) ↑i) × ((i : Fin m) → Out i)) => (D r).eval

The last hybrid of a composed protocol. When P has at most j oracle rounds, the game of the environment of hop j on any kernel κ is the real execution of P.compose Sub in W₂ against D.

theorem Cslib.Crypto.Protocols.MPC.semiHonestAdvantage_compose_le_sum_roundGame {m : ℕ} {spec₁ spec₂ : MultiOracleSpec} {sc₁ : Schedule m spec₁} {sc₂ : (op : spec₁.Op) → Schedule (spec₁.arity op) spec₂} {In Coins₁ Out : Fin m → Type} {Coins₂ : (op : spec₁.Op) → Fin (spec₁.arity op) → Type} (P : Protocol m spec₁ sc₁ In Coins₁ Out) (W₁ : MultiOracleWorld spec₁) (W₂ : MultiOracleWorld spec₂) (Sub : (op : spec₁.Op) → Protocol (spec₁.arity op) spec₂ (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op)) (S₂ : (op : spec₁.Op) → (J : Finset (Fin (spec₁.arity op))) → CoalitionSimulator (sc₂ op) (spec₁.Query op) (Coins₂ op) (spec₁.Answer op) J) (I : Finset (Fin m)) (x : (i : Fin m) → In i) (D : ((i : ↥I) → PartyView In (Schedule.ComposedCoins Coins₂ Coins₁ sc₁) (Schedule.compose sc₂ sc₁) ↑i) × ((i : Fin m) → Out i) → ProbComp Bool) (f : Functionality m In Out) (S₁ : (I : Finset (Fin m)) → CoalitionSimulator sc₁ In Coins₁ Out I) :
semiHonestAdvantage (P.compose Sub) W₂ f I (composeSim P (S₁ I) S₂) x D ≤ semiHonestAdvantage P W₁ f I (S₁ I) x (composeDistinguisher P S₂ I x D) + ∑ j ∈ Finset.range sc₁.oracleRounds, Game.advantage ((composeRoundEnv P W₁ W₂ Sub S₂ I x D j).bind (Composition.roundGame fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (idealJoint (W₁ op) J (S₂ op J) q).eval)) ((composeRoundEnv P W₁ W₂ Sub S₂ I x D j).bind (Composition.roundGame fun (op : spec₁.Op) (J : Finset (Fin (spec₁.arity op))) (q : (s : Fin (spec₁.arity op)) → spec₁.Query op s) => (Sub op).realJoint W₂ J q))

Composition bound with one environment per oracle round. For every outer protocol P in the oracle world W₁, outer simulators S₁, subprotocols Sub in W₂ and subprotocol simulators S₂, the semi-honest advantage of D against P.compose Sub with the composed simulator is at most the advantage of the reduction composeDistinguisher P S₂ I x D against P with S₁ I, plus the sum over the oracle rounds j of P of the advantage of the environment composeRoundEnv of hop j between the ideal and the real game of its challenged round. Each summand is the absolute difference of two acceptance probabilities of one environment, which samples the outer coins and the earlier rounds itself; compare semiHonestAdvantage_compose_le_replacementBound, where the absolute value is inside the expectation over these.

This is the concrete, per-instance form of the hybrid argument for Goldreich's Theorem 7.5.7, not the cited theorem: nothing is assumed about P, Sub or the simulators, and no efficiency of the environments is claimed.

theorem Cslib.Crypto.Protocols.MPC.advantage_bind_compose_le_add_sum_roundGame {α : Type} {m : α → ℕ} {spec₁ spec₂ : α → MultiOracleSpec} {sc₁ : (a : α) → Schedule (m a) (spec₁ a)} {sc₂ : (a : α) → (op : (spec₁ a).Op) → Schedule ((spec₁ a).arity op) (spec₂ a)} {In Coins₁ Out : (a : α) → Fin (m a) → Type} {Coins₂ : (a : α) → (op : (spec₁ a).Op) → Fin ((spec₁ a).arity op) → Type} (p : PMF (Bool ⊕ α)) (P : (a : α) → Protocol (m a) (spec₁ a) (sc₁ a) (In a) (Coins₁ a) (Out a)) (W₁ : (a : α) → MultiOracleWorld (spec₁ a)) (W₂ : (a : α) → MultiOracleWorld (spec₂ a)) (f : (a : α) → Functionality (m a) (In a) (Out a)) (S₁ : (a : α) → (I : Finset (Fin (m a))) → CoalitionSimulator (sc₁ a) (In a) (Coins₁ a) (Out a) I) (Sub : (a : α) → (op : (spec₁ a).Op) → Protocol ((spec₁ a).arity op) (spec₂ a) (sc₂ a op) ((spec₁ a).Query op) (Coins₂ a op) ((spec₁ a).Answer op)) (S₂ : (a : α) → (op : (spec₁ a).Op) → (J : Finset (Fin ((spec₁ a).arity op))) → CoalitionSimulator (sc₂ a op) ((spec₁ a).Query op) (Coins₂ a op) ((spec₁ a).Answer op) J) (I : (a : α) → Finset (Fin (m a))) (x : (a : α) → (i : Fin (m a)) → In a i) (D : (a : α) → ((i : ↥(I a)) → PartyView (In a) (Schedule.ComposedCoins (Coins₂ a) (Coins₁ a) (sc₁ a)) (Schedule.compose (sc₂ a) (sc₁ a)) ↑i) × ((i : Fin (m a)) → Out a i) → ProbComp Bool) (N : ℕ) (hN : ∀ (a : α), (sc₁ a).oracleRounds ≤ N) :
Game.advantage (p.bind (Sum.elim PMF.pure fun (a : α) => (idealJoint (f a) (I a) (composeSim (P a) (S₁ a (I a)) (S₂ a)) (x a)).eval.bind fun (r : ((i : ↥(I a)) → PartyView (In a) (Schedule.ComposedCoins (Coins₂ a) (Coins₁ a) (sc₁ a)) (Schedule.compose (sc₂ a) (sc₁ a)) ↑i) × ((i : Fin (m a)) → Out a i)) => (D a r).eval)) (p.bind (Sum.elim PMF.pure fun (a : α) => (((P a).compose (Sub a)).realJoint (W₂ a) (I a) (x a)).bind fun (r : ((i : ↥(I a)) → PartyView (In a) (Schedule.ComposedCoins (Coins₂ a) (Coins₁ a) (sc₁ a)) (Schedule.compose (sc₂ a) (sc₁ a)) ↑i) × ((i : Fin (m a)) → Out a i)) => (D a r).eval)) ≤ Game.advantage (p.bind (Sum.elim PMF.pure fun (a : α) => (idealJoint (f a) (I a) (S₁ a (I a)) (x a)).eval.bind fun (r : ((i : ↥(I a)) → PartyView (In a) (Coins₁ a) (sc₁ a) ↑i) × ((i : Fin (m a)) → Out a i)) => (composeDistinguisher (P a) (S₂ a) (I a) (x a) (D a) r).eval)) (p.bind (Sum.elim PMF.pure fun (a : α) => ((P a).realJoint (W₁ a) (I a) (x a)).bind fun (r : ((i : ↥(I a)) → PartyView (In a) (Coins₁ a) (sc₁ a) ↑i) × ((i : Fin (m a)) → Out a i)) => (composeDistinguisher (P a) (S₂ a) (I a) (x a) (D a) r).eval)) + ∑ j ∈ Finset.range N, Game.advantage (p.bind (Sum.elim PMF.pure fun (a : α) => (composeRoundEnv (P a) (W₁ a) (W₂ a) (Sub a) (S₂ a) (I a) (x a) (D a) j).bind (Composition.roundGame fun (op : (spec₁ a).Op) (J : Finset (Fin ((spec₁ a).arity op))) (q : (s : Fin ((spec₁ a).arity op)) → (spec₁ a).Query op s) => (idealJoint (W₁ a op) J (S₂ a op J) q).eval))) (p.bind (Sum.elim PMF.pure fun (a : α) => (composeRoundEnv (P a) (W₁ a) (W₂ a) (Sub a) (S₂ a) (I a) (x a) (D a) j).bind (Composition.roundGame fun (op : (spec₁ a).Op) (J : Finset (Fin ((spec₁ a).arity op))) (q : (s : Fin ((spec₁ a).arity op)) → (spec₁ a).Query op s) => (Sub a op).realJoint (W₂ a) J q)))

Composition bound under common outer randomness, with one environment per oracle round. Let p be the distribution of an outer stage that either decides a bit or produces an index a, such as the description drawn by a trusted setup together with the inputs chosen by an environment, or the challenge of an environment of an enclosing composition. Let the outer protocol P a, the subprotocols, the simulators, the coalition, the inputs and the distinguisher D a all depend on a, with at most N oracle rounds. The advantage between the ideal game of (P a).compose (Sub a) with the composed simulator and its real game in W₂ a, both after the outer stage, is at most the advantage between the ideal and the real game of the outer protocol P a in W₁ a against composeDistinguisher, after the outer stage, plus the sum over j < N of the advantage of one environment between the ideal and the real game of its challenged round: this environment runs the outer stage and then composeRoundEnv (P a) … j. Every absolute value is outside the expectation over the outer stage, the outer coins and the earlier rounds.

For an outer stage that never decides, take p = q.map Sum.inr. Nothing is assumed about the protocols or the simulators, and no efficiency is claimed.