Documentation

VCVio.Interaction.UC.Computational

Computational observation layer for UC security #

This file bridges the abstract UC judgments (Emulates, UCSecure) to concrete computational indistinguishability by instantiating the ObsEq parameter with distributional advantage bounds.

Main definitions #

Main results #

Semantics T extracts a probabilistic game (ProbComp Unit) from each closed system in the open-composition theory T.

The Unit return type matches the convention used by ProbComp.distAdvantage: success is () and failure is . This is the minimal bridge needed to give computational meaning to the abstract Emulates judgment.

Instances For
    def Interaction.UC.CompEmulates {T : OpenTheory} (sem : Semantics T) (ε : ) {Δ : PortBoundary} (real ideal : T.Obj Δ) :

    CompEmulates sem ε real ideal asserts that real computationally emulates ideal up to advantage ε under semantics sem.

    For every plug K : T.Plug Δ, the distinguishing advantage between the real-world and ideal-world closed executions is at most ε.

    Instances For
      def Interaction.UC.compObsEq {T : OpenTheory} (sem : Semantics T) (ε : ) :
      T.ClosedT.ClosedProp

      The observation relation on closed systems induced by a semantics and an advantage bound: two closed systems are related when their distinguishing advantage is at most ε.

      Instances For
        theorem Interaction.UC.CompEmulates.toEmulates {T : OpenTheory} {sem : Semantics T} {ε : } {Δ : PortBoundary} {real ideal : T.Obj Δ} (h : CompEmulates sem ε real ideal) :
        Emulates real ideal (compObsEq sem ε)

        CompEmulates is an instance of abstract Emulates for the observation relation compObsEq sem ε.

        theorem Interaction.UC.CompEmulates.refl {T : OpenTheory} (sem : Semantics T) {Δ : PortBoundary} (W : T.Obj Δ) :
        CompEmulates sem 0 W W

        Every system computationally emulates itself with advantage zero.

        theorem Interaction.UC.CompEmulates.triangle {T : OpenTheory} {sem : Semantics T} {ε₁ ε₂ : } {Δ : PortBoundary} {W₁ W₂ W₃ : T.Obj Δ} (h₁₂ : CompEmulates sem ε₁ W₁ W₂) (h₂₃ : CompEmulates sem ε₂ W₂ W₃) :
        CompEmulates sem (ε₁ + ε₂) W₁ W₃

        Computational emulation composes transitively with additive advantage bounds (triangle inequality on distinguishing advantage).

        theorem Interaction.UC.CompEmulates.map_invariance {T : OpenTheory} [T.IsLawfulPlug] {sem : Semantics T} {ε : } {Δ₁ Δ₂ : PortBoundary} (f : Δ₁.Hom Δ₂) {real ideal : T.Obj Δ₁} (h : CompEmulates sem ε real ideal) :
        CompEmulates sem ε (T.map f real) (T.map f ideal)

        Adapting both sides of a computational emulation along the same boundary morphism preserves the advantage bound.

        This is the computational specialization of Emulates.map_invariance. The key identity is plug (map f W) K = plug W (map (swap f) K).

        theorem Interaction.UC.CompEmulates.mono {T : OpenTheory} {sem : Semantics T} {ε₁ ε₂ : } ( : ε₁ ε₂) {Δ : PortBoundary} {real ideal : T.Obj Δ} (h : CompEmulates sem ε₁ real ideal) :
        CompEmulates sem ε₂ real ideal

        Weakening: if ε₁ ≤ ε₂ then CompEmulates sem ε₁ implies CompEmulates sem ε₂.

        Composition #

        theorem Interaction.UC.CompEmulates.par_left {T : OpenTheory} [T.CompactClosed] {sem : Semantics T} {ε : } {Δ₁ Δ₂ : PortBoundary} {real₁ ideal₁ : T.Obj Δ₁} (h₁ : CompEmulates sem ε real₁ ideal₁) (W₂ : T.Obj Δ₂) :
        CompEmulates sem ε (T.par real₁ W₂) (T.par ideal₁ W₂)

        Replacing the left component of a parallel composition preserves the computational emulation bound.

        theorem Interaction.UC.CompEmulates.par_right {T : OpenTheory} [T.CompactClosed] {sem : Semantics T} {ε : } {Δ₁ Δ₂ : PortBoundary} (W₁ : T.Obj Δ₁) {real₂ ideal₂ : T.Obj Δ₂} (h₂ : CompEmulates sem ε real₂ ideal₂) :
        CompEmulates sem ε (T.par W₁ real₂) (T.par W₁ ideal₂)

        Replacing the right component of a parallel composition preserves the computational emulation bound.

        theorem Interaction.UC.CompEmulates.par_compose {T : OpenTheory} [T.CompactClosed] {sem : Semantics T} {ε₁ ε₂ : } {Δ₁ Δ₂ : PortBoundary} {real₁ ideal₁ : T.Obj Δ₁} {real₂ ideal₂ : T.Obj Δ₂} (h₁ : CompEmulates sem ε₁ real₁ ideal₁) (h₂ : CompEmulates sem ε₂ real₂ ideal₂) :
        CompEmulates sem (ε₁ + ε₂) (T.par real₁ real₂) (T.par ideal₁ ideal₂)

        Computational UC composition for par: advantages add.

        theorem Interaction.UC.CompEmulates.wire_left {T : OpenTheory} [T.CompactClosed] {sem : Semantics T} {ε : } {Δ₁ Γ Δ₂ : PortBoundary} {real₁ ideal₁ : T.Obj (Δ₁.tensor Γ)} (h₁ : CompEmulates sem ε real₁ ideal₁) (W₂ : T.Obj (Γ.swap.tensor Δ₂)) :
        CompEmulates sem ε (T.wire real₁ W₂) (T.wire ideal₁ W₂)

        Replacing the left factor of a wiring preserves the computational emulation bound.

        theorem Interaction.UC.CompEmulates.wire_right {T : OpenTheory} [T.CompactClosed] {sem : Semantics T} {ε : } {Δ₁ Γ Δ₂ : PortBoundary} (W₁ : T.Obj (Δ₁.tensor Γ)) {real₂ ideal₂ : T.Obj (Γ.swap.tensor Δ₂)} (h₂ : CompEmulates sem ε real₂ ideal₂) :
        CompEmulates sem ε (T.wire W₁ real₂) (T.wire W₁ ideal₂)

        Replacing the right factor of a wiring preserves the computational emulation bound.

        theorem Interaction.UC.CompEmulates.wire_compose {T : OpenTheory} [T.CompactClosed] {sem : Semantics T} {ε₁ ε₂ : } {Δ₁ Γ Δ₂ : PortBoundary} {real₁ ideal₁ : T.Obj (Δ₁.tensor Γ)} {real₂ ideal₂ : T.Obj (Γ.swap.tensor Δ₂)} (h₁ : CompEmulates sem ε₁ real₁ ideal₁) (h₂ : CompEmulates sem ε₂ real₂ ideal₂) :
        CompEmulates sem (ε₁ + ε₂) (T.wire real₁ real₂) (T.wire ideal₁ ideal₂)

        Computational UC composition for wire: advantages add.

        theorem Interaction.UC.CompEmulates.plug_compose {T : OpenTheory} [T.CompactClosed] {sem : Semantics T} {ε₁ ε₂ : } {Δ : PortBoundary} {real ideal : T.Obj Δ} {K_real K_ideal : T.Obj Δ.swap} (hProt : CompEmulates sem ε₁ real ideal) (hEnv : CompEmulates sem ε₂ K_real K_ideal) :
        (sem.run (T.close real K_real)).distAdvantage (sem.run (T.close ideal K_ideal)) ε₁ + ε₂

        Computational UC composition for plug: when both the protocol and the environment emulate their ideals, the advantage of the closed real system vs. closed ideal system is bounded by the sum.

        Simulator-based computational UC security #

        def Interaction.UC.CompUCSecure {T : OpenTheory} (sem : Semantics T) (ε : ) {Δ : PortBoundary} (protocol ideal : T.Obj Δ) (SimSpace : Type u_1) (simulate : SimSpaceT.Plug ΔT.Plug Δ) :

        CompUCSecure sem ε protocol ideal SimSpace simulate is the simulator-based UC security statement with bounded advantage.

        There exists a simulator parameter s : SimSpace such that for every context K, the distinguishing advantage between the real execution and the simulated ideal execution is at most ε.

        Instances For
          theorem Interaction.UC.CompEmulates.toCompUCSecure {T : OpenTheory} {sem : Semantics T} {ε : } {Δ : PortBoundary} {protocol ideal : T.Obj Δ} (h : CompEmulates sem ε protocol ideal) :
          CompUCSecure sem ε protocol ideal PUnit.{u_1 + 1} fun (x : PUnit.{u_1 + 1}) (K : T.Plug Δ) => K

          Computational emulation implies simulator-based UC security with the trivial (identity) simulator.

          theorem Interaction.UC.CompUCSecure.toCompEmulates_id {T : OpenTheory} {sem : Semantics T} {ε : } {Δ : PortBoundary} {protocol ideal : T.Obj Δ} (hSec : CompUCSecure sem ε protocol ideal PUnit.{u_1 + 1} fun (x : PUnit.{u_1 + 1}) (K : T.Plug Δ) => K) :
          CompEmulates sem ε protocol ideal

          Simulator-based UC security with identity simulation recovers computational emulation.

          Asymptotic computational emulation #

          def Interaction.UC.AsympCompEmulates (T : OpenTheory) (sem : (n : ) → Semantics (T n)) {Δ : PortBoundary} (real ideal : (n : ) → (T n).Obj Δ) (Adv : Type u_1) (isPPT : AdvProp) (env : Adv(n : ) → (T n).Plug Δ) :

          AsympCompEmulates is the asymptotic version of computational emulation.

          Given a family of theories T n indexed by security parameter n : ℕ, with corresponding semantics, real/ideal systems, and adversary-chosen environments, this asserts that every PPT adversary has negligible distinguishing advantage.

          Instances For
            theorem Interaction.UC.AsympCompEmulates.of_pointwise_bound {T : OpenTheory} {sem : (n : ) → Semantics (T n)} {Δ : PortBoundary} {real ideal : (n : ) → (T n).Obj Δ} {Adv : Type u_1} {isPPT : AdvProp} {env : Adv(n : ) → (T n).Plug Δ} (f : ENNReal) (hf : negligible f) (hbound : ∀ (_A : Adv) (n : ) (K : (T n).Plug Δ), ENNReal.ofReal (((sem n).run ((T n).close (real n) K)).distAdvantage ((sem n).run ((T n).close (ideal n) K))) f n) :
            AsympCompEmulates T sem real ideal Adv isPPT env

            Pointwise bounded advantage implies asymptotic security: if at each security parameter the advantage is bounded by f n, and f is negligible, then the asymptotic emulation holds (for any adversary class).

            theorem Interaction.UC.AsympCompEmulates.of_compEmulates {T : OpenTheory} {sem : (n : ) → Semantics (T n)} {Δ : PortBoundary} {real ideal : (n : ) → (T n).Obj Δ} {Adv : Type u_1} {isPPT : AdvProp} {env : Adv(n : ) → (T n).Plug Δ} (ε : ) ( : negligible fun (n : ) => ENNReal.ofReal (ε n)) (hComp : ∀ (n : ), CompEmulates (sem n) (ε n) (real n) (ideal n)) :
            AsympCompEmulates T sem real ideal Adv isPPT env

            Convert a family of pointwise CompEmulates bounds into an asymptotic statement when the bound function is negligible.

            Asymptotic composition #

            theorem Interaction.UC.AsympCompEmulates.par_compose {T : OpenTheory} {sem : (n : ) → Semantics (T n)} [(n : ) → (T n).CompactClosed] {Δ₁ Δ₂ : PortBoundary} {real₁ ideal₁ : (n : ) → (T n).Obj Δ₁} {real₂ ideal₂ : (n : ) → (T n).Obj Δ₂} {Adv : Type u_1} {isPPT : AdvProp} {env : Adv(n : ) → (T n).Plug (Δ₁.tensor Δ₂)} (ε₁ ε₂ : ) (hε₁ : negligible fun (n : ) => ENNReal.ofReal (ε₁ n)) (hε₂ : negligible fun (n : ) => ENNReal.ofReal (ε₂ n)) (h₁ : ∀ (n : ), CompEmulates (sem n) (ε₁ n) (real₁ n) (ideal₁ n)) (h₂ : ∀ (n : ), CompEmulates (sem n) (ε₂ n) (real₂ n) (ideal₂ n)) :
            AsympCompEmulates T sem (fun (n : ) => (T n).par (real₁ n) (real₂ n)) (fun (n : ) => (T n).par (ideal₁ n) (ideal₂ n)) Adv isPPT env

            Asymptotic UC composition for par: if each component's pointwise advantage is negligible, then the parallel composition also has negligible advantage.

            theorem Interaction.UC.AsympCompEmulates.wire_compose {T : OpenTheory} {sem : (n : ) → Semantics (T n)} [(n : ) → (T n).CompactClosed] {Δ₁ Γ Δ₂ : PortBoundary} {real₁ ideal₁ : (n : ) → (T n).Obj (Δ₁.tensor Γ)} {real₂ ideal₂ : (n : ) → (T n).Obj (Γ.swap.tensor Δ₂)} {Adv : Type u_1} {isPPT : AdvProp} {env : Adv(n : ) → (T n).Plug (Δ₁.tensor Δ₂)} (ε₁ ε₂ : ) (hε₁ : negligible fun (n : ) => ENNReal.ofReal (ε₁ n)) (hε₂ : negligible fun (n : ) => ENNReal.ofReal (ε₂ n)) (h₁ : ∀ (n : ), CompEmulates (sem n) (ε₁ n) (real₁ n) (ideal₁ n)) (h₂ : ∀ (n : ), CompEmulates (sem n) (ε₂ n) (real₂ n) (ideal₂ n)) :
            AsympCompEmulates T sem (fun (n : ) => (T n).wire (real₁ n) (real₂ n)) (fun (n : ) => (T n).wire (ideal₁ n) (ideal₂ n)) Adv isPPT env

            Asymptotic UC composition for wire: if each factor's pointwise advantage is negligible, then the wired composition also has negligible advantage.

            theorem Interaction.UC.AsympCompEmulates.plug_compose {T : OpenTheory} {sem : (n : ) → Semantics (T n)} [(n : ) → (T n).CompactClosed] {Δ : PortBoundary} {real ideal : (n : ) → (T n).Obj Δ} {K_real K_ideal : (n : ) → (T n).Obj Δ.swap} (ε₁ ε₂ : ) (hε₁ : negligible fun (n : ) => ENNReal.ofReal (ε₁ n)) (hε₂ : negligible fun (n : ) => ENNReal.ofReal (ε₂ n)) (hProt : ∀ (n : ), CompEmulates (sem n) (ε₁ n) (real n) (ideal n)) (hEnv : ∀ (n : ), CompEmulates (sem n) (ε₂ n) (K_real n) (K_ideal n)) :
            negligible fun (n : ) => ENNReal.ofReal (((sem n).run ((T n).close (real n) (K_real n))).distAdvantage ((sem n).run ((T n).close (ideal n) (K_ideal n))))

            Asymptotic UC composition for plug: if both the protocol and the environment have negligible pointwise advantages, then the distinguishing advantage of the closed real vs. closed ideal system is negligible.

            Bridge to SecurityGame #

            noncomputable def Interaction.UC.ucDistGame (T : OpenTheory) (sem : (n : ) → Semantics (T n)) {Δ : PortBoundary} (real ideal : (n : ) → (T n).Obj Δ) {Adv : Type u_1} (env : Adv(n : ) → (T n).Plug Δ) :

            The UC distinguishing game: a SecurityGame whose advantage at adversary A and security parameter n is the distributional distance between the real and ideal closed executions under the environment chosen by A.

            Instances For
              theorem Interaction.UC.AsympCompEmulates.iff_secureAgainst {T : OpenTheory} {sem : (n : ) → Semantics (T n)} {Δ : PortBoundary} {real ideal : (n : ) → (T n).Obj Δ} {Adv : Type u_1} {isPPT : AdvProp} {env : Adv(n : ) → (T n).Plug Δ} :
              AsympCompEmulates T sem real ideal Adv isPPT env (ucDistGame T sem real ideal env).secureAgainst isPPT

              AsympCompEmulates is exactly secureAgainst isPPT for the UC distinguishing game. This is definitional.

              theorem Interaction.UC.ucDistGame_secureAgainst_of_asympCompEmulates {T : OpenTheory} {sem : (n : ) → Semantics (T n)} {Δ : PortBoundary} {real ideal : (n : ) → (T n).Obj Δ} {Adv : Type u_1} {isPPT : AdvProp} {env : Adv(n : ) → (T n).Plug Δ} (h : AsympCompEmulates T sem real ideal Adv isPPT env) :
              (ucDistGame T sem real ideal env).secureAgainst isPPT

              If real UC-emulates ideal, then the UC distinguishing game is secure against any adversary class. Uses the SecurityGame.secureAgainst vocabulary.

              theorem Interaction.UC.SecurityGame.secureAgainst_of_ucEmulation {T : OpenTheory} {sem : (n : ) → Semantics (T n)} {Δ : PortBoundary} {real ideal : (n : ) → (T n).Obj Δ} {Adv : Type u_1} {Adv' : Type u_2} {isPPT : AdvProp} {isPPT' : Adv'Prop} {env : Adv'(n : ) → (T n).Plug Δ} {g : SecurityGame Adv} {reduce : AdvAdv'} (hreduce : ∀ (A : Adv), isPPT AisPPT' (reduce A)) (hbound : ∀ (A : Adv) (n : ), g.advantage A n (ucDistGame T sem real ideal env).advantage (reduce A) n) (hUC : AsympCompEmulates T sem real ideal Adv' isPPT' env) :

              UC security reduction: if security of g₁ reduces to UC-emulation of real by ideal, then g₁ is secure whenever UC-emulation holds.

              This bridges SecurityGame.secureAgainst_of_reduction to the UC setting: given a reduction from a standard security game to the UC distinguishing game, UC-emulation implies security of the original game.