Documentation

CslibFrontier.Crypto.Protocols.UC.AdaptiveComposition

Single-session adaptive UC composition (snapshot corruption model) #

This module proves single-subroutine composition for this library's snapshot, call-bounded adaptive-corruption port model (CslibFrontier.Crypto.Protocols.UC.Adaptive and CslibFrontier.Crypto.Protocols.UC.AdaptiveDummyAdversary), mirroring static single-session composition in CslibFrontier.Crypto.Protocols.UC.Composition (#6043). These results are not [Can20a] Theorem 3 (Section 2.3), Theorem 22 (Section 6.1), or Section 7.1.1's write-once / non-erasing storage and coin-exposure model: participants are bounded only by oracle call counts per activation (unbounded local computation, not PPT ITMs), sessions are fixed to a single n-party subroutine instance, and .nonErasing histories record caller-supplied view snapshots rather than enforcing write-once storage or per-party activation granularity.

An AdaptiveHybridProtocol ρ is an n-party adaptive calling protocol whose machines invoke a subroutine's partySpec n SubIn SubOut port. composeAdaptive ρ σ composes ρ over an inner AdaptiveProtocol σ, exposing ρ's network port beside σ's routed network port (NetQ ⊕ RoutedNetQ n SubIn NQ). A single .corrupt i query corrupts party i consistently across both ρ and σ, returning AdaptiveHybridView Viewρ Viewσ pairing ρ's and σ's CorruptionReports without leaking uncorrupted party state or erased histories.

Because adaptiveRouter in UC.Adaptive runs P.applyInitialCorruptions before recording the initial snapshot trace[0], composition preserves initial snapshots under ViewStableOnCorrupt (vacuously true for .erasing protocols, and true whenever onCorrupt does not alter view for .nonErasing protocols).

Main definitions #

Main results #

References #

Adaptive hybrid protocols, views, and composed state #

structure Cslib.Crypto.Protocols.UC.AdaptiveHybridProtocol (n : ℕ) (In Out NetQ NetR SubIn SubOut View : Type) :

An n-party calling protocol in the snapshot adaptive-corruption model, invoking a subroutine's partySpec n SubIn SubOut port.

Combined corruption report returned when corrupting party i in composeAdaptive ρ σ: pairs the outer protocol's CorruptionReport with the inner subroutine's CorruptionReport, each respecting its own PartyMemory.

  • outer : CorruptionReport Viewρ

    The outer hybrid protocol's corruption report at party i.

  • sub : CorruptionReport Viewσ

    The inner subroutine protocol's corruption report at party i.

Instances For
    def Cslib.Crypto.Protocols.UC.instDecidableEqAdaptiveHybridView.decEq {Viewρ✝ Viewσ✝ : Type} [DecidableEq Viewρ✝] [DecidableEq Viewσ✝] (x✝ x✝¹ : AdaptiveHybridView Viewρ✝ Viewσ✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    instance Cslib.Crypto.Protocols.UC.instDecidableEqAdaptiveHybridView {Viewρ✝ Viewσ✝ : Type} [DecidableEq Viewρ✝] [DecidableEq Viewσ✝] :
    DecidableEq (AdaptiveHybridView Viewρ✝ Viewσ✝)
    @[instance_reducible]
    instance Cslib.Crypto.Protocols.UC.instReprAdaptiveHybridView {Viewρ✝ Viewσ✝ : Type} [Repr Viewρ✝] [Repr Viewσ✝] :
    Repr (AdaptiveHybridView Viewρ✝ Viewσ✝)
    def Cslib.Crypto.Protocols.UC.instReprAdaptiveHybridView.repr {Viewρ✝ Viewσ✝ : Type} [Repr Viewρ✝] [Repr Viewσ✝] :
    AdaptiveHybridView Viewρ✝ Viewσ✝ → ℕ → Std.Format
    structure Cslib.Crypto.Protocols.UC.AdaptiveComposeState (Sρ Viewρ Sσ Viewσ : Type) (n : ℕ) :

    Internal state of composeAdaptive ρ σ at security parameter κ: separate AdaptiveRouterStates for the outer protocol ρ and inner subroutine σ so that each tracks exactly its own activations and snapshots.

    def Cslib.Crypto.Protocols.UC.AdaptiveHybridProtocol.applyInitialCorruptions {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ : Type} (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (κ : ℕ) (C₀ : Finset (Fin n)) (s : (ρ.machine κ).State) :
    (ρ.machine κ).State

    Apply ρ.onCorrupt κ i in canonical order for every i ∈ C₀ at initialization.

    def Cslib.Crypto.Protocols.UC.AdaptiveHybridProtocol.corruptionReport {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ : Type} (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (κ : ℕ) (i : Fin n) (s : AdaptiveRouterState (ρ.machine κ).State Viewρ n) :

    Build the corruption report for party i from ρ's router state.

    def Cslib.Crypto.Protocols.UC.AdaptiveHybridProtocol.recordSnapshot {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ : Type} (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (κ : ℕ) (s' : (ρ.machine κ).State) (corrupted : Finset (Fin n)) (trace : Fin n → List Viewρ) :

    Append every party's ρ.view snapshot after an outer protocol activation.

    def Cslib.Crypto.Protocols.UC.AdaptiveHybridProtocol.PolyBounded {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ : Type} (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (p : Polynomial ℕ) :

    Every activation and initialization of ρ.machine κ makes at most p.eval κ calls.

    def Cslib.Crypto.Protocols.UC.AdaptiveProtocol.ViewStableOnCorrupt {n : ℕ} {In Out NetQ NetR View₁ : Type} (P : AdaptiveProtocol n In Out NetQ NetR View₁) :

    Snapshot stability under onCorrupt for .nonErasing AdaptiveProtocols: onCorrupt does not modify view, so initial snapshots recorded before vs. after applyInitialCorruptions agree. Vacuously true when P.memory = .erasing.

    def Cslib.Crypto.Protocols.UC.AdaptiveHybridProtocol.ViewStableOnCorrupt {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ : Type} (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) :

    Snapshot stability under onCorrupt for .nonErasing AdaptiveHybridProtocols. Vacuously true when ρ.memory = .erasing.

    theorem Cslib.Crypto.Protocols.UC.AdaptiveProtocol.ViewStableOnCorrupt.of_erasing {n : ℕ} {In Out NetQ NetR View₁ : Type} {P : AdaptiveProtocol n In Out NetQ NetR View₁} (h : P.memory = PartyMemory.erasing) :

    Every .erasing AdaptiveProtocol satisfies ViewStableOnCorrupt vacuously.

    theorem Cslib.Crypto.Protocols.UC.AdaptiveHybridProtocol.ViewStableOnCorrupt.of_erasing {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ : Type} {ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ} (h : ρ.memory = PartyMemory.erasing) :

    Every .erasing AdaptiveHybridProtocol satisfies ViewStableOnCorrupt vacuously.

    Subroutine replacement (composeAdaptive) #

    def Cslib.Crypto.Protocols.UC.subPartyMachine {n : ℕ} {SubIn SubOut NQ NR View₁ : Type} (σ : AdaptiveProtocol n SubIn SubOut NQ NR View₁) (κ : ℕ) :

    Closed machine answering subroutine party calls for σ inside composeAdaptive ρ σ, guarding against corrupted parties and recording σ snapshots per activation.

    def Cslib.Crypto.Protocols.UC.composeAdaptive {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ NR View₁ : Type} (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (σ : AdaptiveProtocol n SubIn SubOut NQ NR View₁) :
    AdaptiveProtocol n In Out (NetQ ⊕ RoutedNetQ n SubIn NQ) (NetR ⊕ RoutedNetR SubOut NR) (AdaptiveHybridView Viewρ View₁)

    Single-session subroutine replacement ρ^σ in the snapshot adaptive-corruption model. A single .corrupt i query corrupts party i across both ρ and σ via onCorrupt, returning AdaptiveHybridView (outer and sub CorruptionReports). Outer memory is .erasing so that outer adaptiveRouter snapshots neither leak erased inner histories nor count simulator-internal subroutine queries.

    Absorbed environment and composed simulator #

    def Cslib.Crypto.Protocols.UC.absorbAdaptiveHybrid {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ NR View₁ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (Z : AdaptiveEnvironment n In Out (AdaptiveNetQ n In (NetQ ⊕ RoutedNetQ n SubIn NQ)) (AdaptiveNetR Out (NetR ⊕ RoutedNetR SubOut NR) (AdaptiveHybridView Viewρ View₁))) :
    AdaptiveEnvironment n SubIn SubOut (AdaptiveNetQ n SubIn NQ) (AdaptiveNetR SubOut NR View₁)

    The subroutine environment embedding ρ and Z: runs ρ internally against the subroutine and forwards Z's subroutine-network and .corrupt queries.

    def Cslib.Crypto.Protocols.UC.adaptiveHybridSim {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) (S_D : AdaptiveAdversary n SubIn SubOut NQ₂ NR₂ View₂ (AdaptiveNetQ n SubIn NQ₁) (AdaptiveNetR SubOut NR₁ View₁)) :
    AdaptiveAdversary n In Out (NetQ ⊕ RoutedNetQ n SubIn NQ₂) (NetR ⊕ RoutedNetR SubOut NR₂) (AdaptiveHybridView Viewρ View₂) (AdaptiveNetQ n In (NetQ ⊕ RoutedNetQ n SubIn NQ₁)) (AdaptiveNetR Out (NetR ⊕ RoutedNetR SubOut NR₁) (AdaptiveHybridView Viewρ View₁))

    The composed simulator for composeAdaptive ρ π against composeAdaptive ρ φ, built from an adaptive dummy-adversary simulator S_D for π against φ and initial corruption schedule C₀.

    Budgets #

    The budget pρ + 1 + pZ * (pρ + 3) of the status-checked absorbed environment.

    @[simp]

    Evaluation of absorbAdaptiveCheckPoly pZ pρ at security parameter κ.

    theorem Cslib.Crypto.Protocols.UC.composeAdaptive_polyBounded {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ NR View₁ : Type} {ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ} {σ : AdaptiveProtocol n SubIn SubOut NQ NR View₁} {pρ pσ : Polynomial ℕ} (hρ : ρ.PolyBounded pρ) (hσ : σ.PolyBounded pσ) :
    (composeAdaptive ρ σ).PolyBounded ((pρ + 1) * (pσ + 1) + pσ)

    Adaptive subroutine replacement preserves polynomial call budgets.

    theorem Cslib.Crypto.Protocols.UC.absorbAdaptiveHybrid_polyBounded {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ NR View₁ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) {ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ} {Z : AdaptiveEnvironment n In Out (AdaptiveNetQ n In (NetQ ⊕ RoutedNetQ n SubIn NQ)) (AdaptiveNetR Out (NetR ⊕ RoutedNetR SubOut NR) (AdaptiveHybridView Viewρ View₁))} {pρ pZ : Polynomial ℕ} (hρ : ρ.PolyBounded pρ) (hZ : Z.PolyBounded pZ) :
    (absorbAdaptiveHybrid mode C₀ ρ Z).PolyBounded (absorbPoly pZ pρ)

    Absorbing an adaptive hybrid protocol with budget pρ into an environment with budget pZ gives an environment with budget absorbPoly pZ pρ.

    theorem Cslib.Crypto.Protocols.UC.adaptiveHybridSim_polyBounded {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) {S_D : AdaptiveAdversary n SubIn SubOut NQ₂ NR₂ View₂ (AdaptiveNetQ n SubIn NQ₁) (AdaptiveNetR SubOut NR₁ View₁)} {pS : Polynomial ℕ} (hS : S_D.PolyBounded pS) :
    (adaptiveHybridSim mode C₀ S_D).PolyBounded (pS + 1)

    The composed simulator of a subroutine simulator with budget pS has budget pS + 1.

    Execution regrouping: dummy adversary #

    theorem Cslib.Crypto.Protocols.UC.adaptiveExec_compose_dummy {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ NR View₁ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (π : AdaptiveProtocol n SubIn SubOut NQ NR View₁) (hρ_view : ρ.ViewStableOnCorrupt) (hπ_view : π.ViewStableOnCorrupt) (Z : AdaptiveEnvironment n In Out (AdaptiveNetQ n In (NetQ ⊕ RoutedNetQ n SubIn NQ)) (AdaptiveNetR Out (NetR ⊕ RoutedNetR SubOut NR) (AdaptiveHybridView Viewρ View₁))) (κ : ℕ) (z : List Bool) :
    adaptiveExec mode (composeAdaptive ρ π) (adaptiveDummyAdversary C₀ (NetQ ⊕ RoutedNetQ n SubIn NQ) (NetR ⊕ RoutedNetR SubOut NR)) Z κ z = adaptiveExec mode π (adaptiveDummyAdversary C₀ NQ NR) (absorbAdaptiveHybrid mode C₀ ρ Z) κ z

    Running composeAdaptive ρ π with adaptiveDummyAdversary C₀ equals running π with adaptiveDummyAdversary C₀ and absorbAdaptiveHybrid mode C₀ ρ Z (for ViewStableOnCorrupt protocols; vacuously satisfied for .erasing protocols).

    Execution regrouping: composed simulator and synchronization check #

    def Cslib.Crypto.Protocols.UC.AdaptiveAdversary.CorruptSync {n : ℕ} {SubIn SubOut NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) (φ : AdaptiveProtocol n SubIn SubOut NQ₂ NR₂ View₂) (S_D : AdaptiveAdversary n SubIn SubOut NQ₂ NR₂ View₂ (AdaptiveNetQ n SubIn NQ₁) (AdaptiveNetR SubOut NR₁ View₁)) :

    Synchronization condition for eval_adaptiveExec_compose_sim_of_corruptSync: S_D starts with initial = C₀ and every activation preserves adaptiveRouter mode φ's corrupted set (C on .party/.net, and if mode = .adaptive then insert i C else C on .corrupt i) whenever C₀ κ ⊆ C.

    Adaptive composition theorems #

    Exact composition regrouping under CorruptSync #

    theorem Cslib.Crypto.Protocols.UC.eval_adaptiveExec_compose_sim_of_corruptSync {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (φ : AdaptiveProtocol n SubIn SubOut NQ₂ NR₂ View₂) (hρ_view : ρ.ViewStableOnCorrupt) (hφ_view : φ.ViewStableOnCorrupt) (S_D : AdaptiveAdversary n SubIn SubOut NQ₂ NR₂ View₂ (AdaptiveNetQ n SubIn NQ₁) (AdaptiveNetR SubOut NR₁ View₁)) (hSync : AdaptiveAdversary.CorruptSync mode C₀ φ S_D) (Z : AdaptiveEnvironment n In Out (AdaptiveNetQ n In (NetQ ⊕ RoutedNetQ n SubIn NQ₁)) (AdaptiveNetR Out (NetR ⊕ RoutedNetR SubOut NR₁) (AdaptiveHybridView Viewρ View₁))) (κ : ℕ) (z : List Bool) :
    (adaptiveExec mode (composeAdaptive ρ φ) (adaptiveHybridSim mode C₀ S_D) Z κ z).eval = (adaptiveExec mode φ S_D (absorbAdaptiveHybrid mode C₀ ρ Z) κ z).eval

    Execution regrouping for the composed simulator under CorruptSync in the snapshot adaptive model: running composeAdaptive ρ φ against adaptiveHybridSim mode C₀ S_D and Z induces the same Boolean distribution as running φ against S_D and absorbAdaptiveHybrid mode C₀ ρ Z.

    theorem Cslib.Crypto.Protocols.UC.adaptiveAdvantage_compose_of_corruptSync {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} (mode : CorruptionMode) (C₀ : ℕ → Finset (Fin n)) (ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ) (π : AdaptiveProtocol n SubIn SubOut NQ₁ NR₁ View₁) (φ : AdaptiveProtocol n SubIn SubOut NQ₂ NR₂ View₂) (hρ_view : ρ.ViewStableOnCorrupt) (hπ_view : π.ViewStableOnCorrupt) (hφ_view : φ.ViewStableOnCorrupt) (S_D : AdaptiveAdversary n SubIn SubOut NQ₂ NR₂ View₂ (AdaptiveNetQ n SubIn NQ₁) (AdaptiveNetR SubOut NR₁ View₁)) (hSync : AdaptiveAdversary.CorruptSync mode C₀ φ S_D) (Z : AdaptiveEnvironment n In Out (AdaptiveNetQ n In (NetQ ⊕ RoutedNetQ n SubIn NQ₁)) (AdaptiveNetR Out (NetR ⊕ RoutedNetR SubOut NR₁) (AdaptiveHybridView Viewρ View₁))) (κ : ℕ) (z : List Bool) :
    adaptiveAdvantage mode (composeAdaptive ρ π) (composeAdaptive ρ φ) (adaptiveDummyAdversary C₀ (NetQ ⊕ RoutedNetQ n SubIn NQ₁) (NetR ⊕ RoutedNetR SubOut NR₁)) (adaptiveHybridSim mode C₀ S_D) Z κ z = adaptiveAdvantage mode π φ (adaptiveDummyAdversary C₀ NQ₁ NR₁) S_D (absorbAdaptiveHybrid mode C₀ ρ Z) κ z

    Advantage regrouping under CorruptSync in the snapshot adaptive model.

    theorem Cslib.Crypto.Protocols.UC.AdaptiveEmulatesDummyWithin.compose {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} {mode : CorruptionMode} {ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ} {π : AdaptiveProtocol n SubIn SubOut NQ₁ NR₁ View₁} {φ : AdaptiveProtocol n SubIn SubOut NQ₂ NR₂ View₂} {pρ pD : Polynomial ℕ} {ε : Polynomial ℕ → ℕ → NNReal} (hρ_view : ρ.ViewStableOnCorrupt) (hπ_view : π.ViewStableOnCorrupt) (hφ_view : φ.ViewStableOnCorrupt) (hρ : ρ.PolyBounded pρ) (h : AdaptiveEmulatesDummyWithin mode π φ pD ε) :

    Concrete composition for AdaptiveEmulatesDummyWithin, this library's snapshot, call-bounded, fixed-n-party, adaptive-corruption dummy-adversary emulation notion (a step toward [Can20a]-style adaptive composition, not [Can20a] Theorem 3 or §7.1.1's write-once storage and coin-exposure model; #6043). Requires ViewStableOnCorrupt on all three protocols (vacuous when .memory = .erasing) and evaluates ε at absorbAdaptiveCheckPoly pZ pρ, whose extra status queries rule out simulator initial-corruption and runtime-corruption desynchronization without assuming an explicit CorruptSync condition.

    theorem Cslib.Crypto.Protocols.UC.AdaptiveEmulatesWithin.compose {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} {mode : CorruptionMode} {ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ} {π : AdaptiveProtocol n SubIn SubOut NQ₁ NR₁ View₁} {φ : AdaptiveProtocol n SubIn SubOut NQ₂ NR₂ View₂} {pρ g : Polynomial ℕ} {ε : Polynomial ℕ → Polynomial ℕ → ℕ → NNReal} (hρ_view : ρ.ViewStableOnCorrupt) (hπ_view : π.ViewStableOnCorrupt) (hφ_view : φ.ViewStableOnCorrupt) (hρ : ρ.PolyBounded pρ) (h : AdaptiveEmulatesWithin mode π φ g ε) :

    Concrete composition for AdaptiveEmulatesWithin, this library's snapshot, call-bounded, fixed-n-party, adaptive-corruption port-model emulation notion (not [Can20a] Theorem 3 or §7.1.1's write-once non-erasing storage and PPT ITMs; #6043). Requires ViewStableOnCorrupt on ρ, π, and φ (vacuous under .erasing) and ρ.PolyBounded pρ, evaluating the error at absorbAdaptiveCheckPoly (absorbPoly pZ pA) pρ without assuming CorruptSync.

    theorem Cslib.Crypto.Protocols.UC.AdaptiveEmulates.compose {n : ℕ} {In Out NetQ NetR SubIn SubOut Viewρ NQ₁ NR₁ View₁ NQ₂ NR₂ View₂ : Type} {mode : CorruptionMode} {ρ : AdaptiveHybridProtocol n In Out NetQ NetR SubIn SubOut Viewρ} {π : AdaptiveProtocol n SubIn SubOut NQ₁ NR₁ View₁} {φ : AdaptiveProtocol n SubIn SubOut NQ₂ NR₂ View₂} {pρ : Polynomial ℕ} (hρ_view : ρ.ViewStableOnCorrupt) (hπ_view : π.ViewStableOnCorrupt) (hφ_view : φ.ViewStableOnCorrupt) (hρ : ρ.PolyBounded pρ) (h : AdaptiveEmulates mode π φ) :

    Asymptotic composition for AdaptiveEmulates, this library's snapshot, call-bounded, fixed-n-party, adaptive-corruption port-model emulation notion (not [Can20a] Theorem 3 or §7.1.1's write-once non-erasing storage and PPT ITMs; #6043). Requires ViewStableOnCorrupt on ρ, π, and φ (vacuous under .erasing) and ρ.PolyBounded pρ, without assuming CorruptSync.