Documentation

CslibFrontier.Crypto.Protocols.MPC.AllToAll

Synchronous All-to-All Point-to-Point Messages #

This module defines the all-to-all message layer of CslibFrontier.Crypto.Protocols.MPC.Basic: every party s : Fin m sends one message of type Msg to every party r : Fin m (including itself), one .message s r Msg round per ordered pair in allPairs m.

Broadcast (CslibFrontier.Crypto.Protocols.MPC.Broadcast) is the special case of a message that does not depend on the receiver. The input-sharing step of CslibFrontier.Crypto.Protocols.MPC.CircuitEval is another instance.

Main definitions #

Main results #

All ordered sender-receiver pairs (s, r) : Fin m × Fin m (including (s, s) self-pairs).

@[reducible]
def Cslib.Crypto.Protocols.MPC.msgRound {m : ℕ} {spec : MultiOracleSpec} (Msg : Type) (p : Fin m × Fin m) :
Round m spec

Point-to-point message round from p.1 to p.2 carrying Msg.

@[reducible]
def Cslib.Crypto.Protocols.MPC.msgSchedule {m : ℕ} {spec : MultiOracleSpec} (Msg : Type) (L : List (Fin m × Fin m)) :
Schedule m spec

Schedule of point-to-point message rounds along L : List (Fin m × Fin m).

@[reducible]

Schedule of all-to-all point-to-point messages of type Msg.

def Cslib.Crypto.Protocols.MPC.extractMsg {m : ℕ} {spec : MultiOracleSpec} {Msg : Type} [Zero Msg] (p : Fin m × Fin m) (i : Fin m) (recv : (msgRound Msg p).Received i) :
Fin m → Msg

Extract party i's inbox update from message round p = (s, r): the single-slot vector Pi.single s msg at the receiver r, and 0 at every other party.

def Cslib.Crypto.Protocols.MPC.msgStepsWith {m : ℕ} {spec : MultiOracleSpec} {Msg : Type} [AddCommMonoid Msg] {State Out : Fin m → Type} (send : (i : Fin m) → State i → Fin m → Msg) (finish : (i : Fin m) → State i → (Fin m → Msg) → Out i) (L : List (Fin m × Fin m)) :
Steps (fun (i : Fin m) => State i × (Fin m → Msg)) Out (msgSchedule Msg L)

Execute point-to-point message rounds along L: in round (s, r) party s sends send s st_s r. Each party accumulates its received messages into the second component of its state and applies finish at .done.

def Cslib.Crypto.Protocols.MPC.allToAllStepsWith (m : ℕ) {spec : MultiOracleSpec} {Msg : Type} [AddCommMonoid Msg] {State Out : Fin m → Type} (send : (i : Fin m) → State i → Fin m → Msg) (finish : (i : Fin m) → State i → (Fin m → Msg) → Out i) :
Steps State Out (allToAllSchedule m Msg)

All-to-all message exchange: party s sends send s (st s) r to party r, and party i outputs finish i (st i) inbox_i from the vector inbox_i : Fin m → Msg of the messages addressed to it.

def Cslib.Crypto.Protocols.MPC.receivedMsgOfInbox {m : ℕ} {spec : MultiOracleSpec} {Msg : Type} (p : Fin m × Fin m) (i : Fin m) (inbox_i : Fin m → Msg) :
(msgRound Msg p).Received i

Received record for party i in round p = (s, r) constructed from party i's inbox inbox_i : Fin m → Msg.

def Cslib.Crypto.Protocols.MPC.receivedScheduleOfInbox {m : ℕ} {spec : MultiOracleSpec} {Msg : Type} (i : Fin m) (inbox_i : Fin m → Msg) (L : List (Fin m × Fin m)) :

Received transcript for party i along msgSchedule Msg L constructed from inbox_i.

theorem Cslib.Crypto.Protocols.MPC.deliverMessage_eq_receivedMsgOfInbox {m : ℕ} {spec : MultiOracleSpec} {Msg : Type} (toSend : Fin m → Fin m → Msg) (p : Fin m × Fin m) (i : Fin m) :
Round.deliverMessage (toSend p.1 p.2) i = receivedMsgOfInbox p i fun (s : Fin m) => toSend s i
@[simp]
theorem Cslib.Crypto.Protocols.MPC.evalWith_allToAllStepsWith (m : ℕ) {spec : MultiOracleSpec} {Msg : Type} [AddCommMonoid Msg] {State Out : Fin m → Type} (send : (i : Fin m) → State i → Fin m → Msg) (finish : (i : Fin m) → State i → (Fin m → Msg) → Out i) (W : MultiOracleWorld spec) (st : (i : Fin m) → State i) :
(allToAllStepsWith m send finish).evalWith W st = PMF.pure fun (i : Fin m) => receivedScheduleOfInbox i (fun (s : Fin m) => send s (st s) i) (allPairs m)

Evaluating allToAllStepsWith in any world W deterministically delivers to each party i its inbox fun s => send s (st s) i.

@[simp]
theorem Cslib.Crypto.Protocols.MPC.outputAt_allToAllStepsWith (m : ℕ) {spec : MultiOracleSpec} {Msg : Type} [AddCommMonoid Msg] {State Out : Fin m → Type} (send : (i : Fin m) → State i → Fin m → Msg) (finish : (i : Fin m) → State i → (Fin m → Msg) → Out i) (i : Fin m) (st_i : State i) (inbox : Fin m → Msg) :
(allToAllStepsWith m send finish).outputAt i st_i (receivedScheduleOfInbox i inbox (allPairs m)) = finish i st_i inbox

On the transcript of inbox inbox, party i outputs finish i st_i inbox.