Documentation

CslibFrontier.Crypto.Protocols.MPC.OTCommitment

Commitment from ideal oblivious transfer #

The Crépeau construction described in [Cra00], §7.1, p. 21: commit to b by supplying independent pairs (r, r ^^ b) to ideal OT. The receiver retains its private selection bits and the selected values. Opening reveals all pairs, which must have parity b and agree with the selected values. We use the existing ot14World, duplicating the two payloads across four slots.

Main definitions #

Main results #

These are information-theoretic commitment games in the ideal OT hybrid, not realization of an ideal commitment functionality or malicious MPC completeness. Strategies may be computationally unbounded; no polynomial-time certificate is asserted. Communication is a fixed sequence of k OT calls followed by opening, with no receiver messages to the sender. Sender abort is represented by returning no opening; it cannot increase the winning probability.

References #

@[reducible, inline]

One revealed pair for each OT call. The type enforces the opening length.

The pair encoding an honest commitment bit, duplicated into the four OT slots.

noncomputable def Cslib.Crypto.Protocols.MPC.OTCommitment.transfer (t : Fin 4 → Bool) (j : Fin 4) :
PMF ((s : Fin 2) → ot14Spec.Answer () s)

A call to the existing ideal OT world, retaining its asymmetric answer types.

@[simp]
theorem Cslib.Crypto.Protocols.MPC.OTCommitment.transfer_eq (t : Fin 4 → Bool) (j : Fin 4) :
transfer t j = PMF.pure fun (i : Fin (1 + 1)) => Fin.cases () (fun (x : Fin 1) => t j) i
def Cslib.Crypto.Protocols.MPC.OTCommitment.Accepts {k : ℕ} (choices received : Fin k → Bool) (b : Bool) (o : Opening k) :

Verify all pair parities and every value actually received through OT.

Honest opening from the sender's independent masks.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.correct {k : ℕ} (b : Bool) (masks choices : Fin k → Bool) :
Accepts choices (fun (i : Fin k) => table b (masks i) (boolPairToFin4 (false, choices i))) b (opening b masks)

Honest OT answers agree with an opening, for every choice vector and every mask vector.

A sender can select any table from its current private state, retain arbitrary additional randomness, and update its state using its actual OT answer. That answer is Unit, not the receiver's selected bit. The round number counts the calls remaining.

  • choose : ℕ → State → PMF ((Fin 4 → Bool) × State)

    Randomized table and private state selection; no parity restriction.

  • receive : State → Unit → State

    Local processing of the sender's OT response.

noncomputable def Cslib.Crypto.Protocols.MPC.OTCommitment.senderRun {State : Type} (A : Sender State) (k : ℕ) :
State → (Fin k → Bool) → PMF ((Fin k → Bool) × State)

Run the sender against a fixed, private receiver choice vector. The returned pair contains the receiver's OT answers and the sender's final private state, kept separate throughout.

def Cslib.Crypto.Protocols.MPC.OTCommitment.senderTablesWith {m : Type → Type} [Monad m] {State : Type} (choose : ℕ → State → m ((Fin 4 → Bool) × State)) (receive : State → Unit → State) (k : ℕ) :
State → m ((Fin k → Fin 4 → Bool) × State)

Common sender-table recursion, with only the sampling backend varied. Receiver choices are not an input; the semantic specialization is related to actual OT by senderRun_eq.

noncomputable def Cslib.Crypto.Protocols.MPC.OTCommitment.senderTables {State : Type} (A : Sender State) (k : ℕ) (st : State) :
PMF ((Fin k → Fin 4 → Bool) × State)

The same sender's local table transcript. Its independence from receiver choices is a consequence of senderRun_eq, not a restriction that the tables encode a consistent bit.

No sender table is generated at zero rounds.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.senderTables_succ {State : Type} (A : Sender State) (k : ℕ) (st : State) :
senderTables A (k + 1) st = do let __x ← A.choose k st match __x with | (t, next) => do let __x ← senderTables A k (A.receive next ()) match __x with | (rest, final) => pure (Fin.cons t rest, final)

One sender round chooses its table, receives only Unit, then continues.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.senderRun_eq {State : Type} (A : Sender State) (k : ℕ) (st : State) (choices : Fin k → Bool) :
senderRun A k st choices = PMF.map (fun (x : (Fin k → Fin 4 → Bool) × State) => match x with | (ts, final) => (fun (i : Fin k) => ts i (boolPairToFin4 (false, choices i)), final)) (senderTables A k st)

Exact factorization of actual OT execution: the sender's local transcript does not depend on the private choices, and the receiver gets precisely the selected table entries.

noncomputable def Cslib.Crypto.Protocols.MPC.OTCommitment.doubleOpens {k : ℕ} (choices received : Fin k → Bool) (o : Option (Opening k × Opening k)) :

Test two candidate openings to opposite bits; none is abort.

noncomputable def Cslib.Crypto.Protocols.MPC.OTCommitment.bindingGame {State : Type} (A : Sender State) (k : ℕ) (initial : PMF State) (finish : State → PMF (Option (Opening k × Opening k))) :

Conventional malicious-sender double-opening experiment. Initial private state is independent of the honest receiver's uniform secret choices. Both openings are generated from the final sender state, without giving the sender either the choices or the selected values.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.doubleOpens_unique {k : ℕ} (ts : Fin k → Fin 4 → Bool) (o : Option (Opening k × Opening k)) {c d : Fin k → Bool} (hc : doubleOpens c (fun (i : Fin k) => ts i (boolPairToFin4 (false, c i))) o = true) (hd : doubleOpens d (fun (i : Fin k) => ts i (boolPairToFin4 (false, d i))) o = true) :
c = d

Two opposite-parity openings can simultaneously match at most one choice vector, regardless of the tables the sender supplied.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.binding {State : Type} (A : Sender State) (k : ℕ) (initial : PMF State) (finish : State → PMF (Option (Opening k × Opening k))) :
(bindingGame A k initial finish) true ≤ 2⁻¹ ^ k

Information-theoretic binding against every randomized stateful sender, including arbitrary inconsistent OT tables. This is a two-opening bound, not ideal-functionality simulation.

An adaptive receiver can choose any of the four OT slots from its private state, then process the selected bit with arbitrary additional randomness. State may contain its full view.

  • choose : ℕ → State → PMF (Fin 4 × State)

    Choice of any OT index, depending on all prior local information.

  • receive : State → Bool → PMF State

    Randomized state update after seeing the selected bit.

def Cslib.Crypto.Protocols.MPC.OTCommitment.receiverCommitWith {m : Type → Type} [Monad m] {State : Type} (choose : ℕ → State → m (Fin 4 × State)) (receive : State → Bool → m State) (coin : m Bool) (call : (Fin 4 → Bool) → Fin 4 → m ((i : Fin 2) → ot14Spec.Answer () i)) (b : Bool) (k : ℕ) :
State → m ((Fin k → Bool) × (Fin k → Fin 4 × Bool) × State)

One receiver commit recursion, shared by semantic and program executions. The backend supplies receiver-local actions, fresh masks, and the selected OT answer. No sender mask is passed to choose or receive.

noncomputable def Cslib.Crypto.Protocols.MPC.OTCommitment.receiverCommit {State : Type} (A : Receiver State) (b : Bool) (k : ℕ) (st : State) :
PMF ((Fin k → Bool) × (Fin k → Fin 4 × Bool) × State)

Honest commit execution, retaining the sender's private masks alongside the receiver's transcript and final state. The masks are never passed to the receiver strategy. The semantic backend uses the actual OT world and is the original PMF specialization of the shared recursion.

No receiver calls or masks are sampled at zero rounds.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.receiverCommit_succ {State : Type} (A : Receiver State) (b : Bool) (k : ℕ) (st : State) :
receiverCommit A b (k + 1) st = do let __x ← A.choose k st match __x with | (j, next) => do let r ← Probability.PMF.uniformOfFintype Bool let ans ← transfer (table b r) j let next ← A.receive next (ans 1) let __x ← receiverCommit A b k next match __x with | (masks, rest, final) => pure (Fin.cons r masks, Fin.cons (j, ans 1) rest, final)

The PMF backend keeps the original actual-OT execution, including sampling order.

noncomputable def Cslib.Crypto.Protocols.MPC.OTCommitment.receiverRun {State : Type} (A : Receiver State) (b : Bool) (k : ℕ) (st : State) :
PMF ((Fin k → Fin 4 × Bool) × State)

Honest sender against an adaptive receiver. The result explicitly includes every receiver query and answer, as well as final private state. Each fresh sender mask is independent of the receiver's current query and history. The sender's masks are projected away.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.receiverRun_zero {State : Type} (A : Receiver State) (b : Bool) (st : State) :

Observing zero commit calls returns an empty receiver transcript.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.receiverRun_succ {State : Type} (A : Receiver State) (b : Bool) (k : ℕ) (st : State) :
receiverRun A b (k + 1) st = do let __x ← A.choose k st match __x with | (j, next) => do let r ← Probability.PMF.uniformOfFintype Bool let ans ← transfer (table b r) j let next ← A.receive next (ans 1) let __x ← receiverRun A b k next match __x with | (rest, final) => pure (Fin.cons (j, ans 1) rest, final)

The receiver observation keeps the original step-by-step OT execution, without exposing any honest sender mask to the strategy.

theorem Cslib.Crypto.Protocols.MPC.OTCommitment.perfectHiding {State : Type} (A : Receiver State) (b b' : Bool) (k : ℕ) (st : State) :
receiverRun A b k st = receiverRun A b' k st

Perfect hiding of the complete adaptive receiver view, for all four possible OT indices. The initial state can be any fixed auxiliary input; averaging preserves the equality.