Documentation

CatCryptCore.Crypto.UCConcrete

Concrete UC Emulation #

UC emulation in which the environment's distinguishing advantage is bounded by a function of the adversary and of the environment, in the style of concrete security (EasyCrypt, EasyUC: Canetti, Stoughton, Varia, CSF 2019). A bound such as bound A Z = DDH_Advantage (B A Z), for an explicit reduction B, constrains every adversary and environment individually.

UCEmulates ε bounds sdist, the supremum over all distinguishers. The concrete form is pointwise: UCEmulatesC with a constant bound is exactly UCEmulates (UCEmulatesC_const_iff), so statistical results embed.

Main definitions #

Main results #

Simulator quantifier #

UCEmulatesCSim records the simulator as a map sim of the adversary; it is the primary form because transitivity evaluates the second bound at the simulator of the first (b₂ (sim₁ A)), which cannot be named when the simulator is only existential. UCEmulatesC keeps Canetti's ∀ A ∃ S shape and is equivalent to ∃ sim, UCEmulatesCSim … sim … (UCEmulatesC_iff_exists_sim).

Environment #

The environment is the triple of input, initial heap and distinguisher, the three quantities over which sdist takes its supremum. A bound may depend on all three: the IND-CPA reduction to DDH embeds the environment's messages.

Environments and concrete distance #

structure CatCrypt.Crypto.UCConcrete.Env (α : Type u_1) (β : Type u_2) :
Type (max u_1 u_2)

An environment for Kleisli morphisms α → SPComp β: it chooses the input, the initial heap, and the distinguisher run on the output.

  • input : α

    Input fed to the morphism.

  • heap : Core.Heap

    Initial heap.

  • dist : β → Core.SPComp Bool

    Distinguisher run on the output.

Instances For
    noncomputable def CatCrypt.Crypto.UCConcrete.Env.gap {α : Type u_1} {β : Type u_2} (f g : α → Core.SPComp β) (Z : Env α β) :

    Distinguishing gap of the environment Z between f and g.

    Equations
    Instances For
      def CatCrypt.Crypto.UCConcrete.DistC {α : Type u_1} {β : Type u_2} (f g : α → Core.SPComp β) (bound : Env α β → ENNReal) :

      Concrete distance: every environment Z distinguishes f from g with gap at most bound Z.

      Equations
      Instances For
        noncomputable def CatCrypt.Crypto.UCConcrete.Env.postcomp {α : Type u_1} {β : Type u_2} {γ : Type u_3} (k : β → Core.SPComp γ) (Z : Env α γ) :
        Env α β

        The environment Z precomposed with the post-processing k: same input and heap, distinguisher k followed by Z.dist. This is the reduction used by the right post-processing lemma.

        Equations
        Instances For
          theorem CatCrypt.Crypto.UCConcrete.DistC_const_iff {α : Type u_1} {β : Type u_2} {f g : α → Core.SPComp β} {ε : ENNReal} :
          (DistC f g fun (x : Env α β) => ε) ↔ sdist f g ≤ ε

          A constant concrete bound is the numeric bound sdist f g ≤ ε.

          theorem CatCrypt.Crypto.UCConcrete.DistC.mono {α : Type u_1} {β : Type u_2} {f g : α → Core.SPComp β} {b₁ b₂ : Env α β → ENNReal} (h : DistC f g b₁) (hle : ∀ (Z : Env α β), b₁ Z ≤ b₂ Z) :
          DistC f g b₂

          Monotonicity in the bound.

          theorem CatCrypt.Crypto.UCConcrete.DistC.refl {α : Type u_1} {β : Type u_2} (f : α → Core.SPComp β) :
          DistC f f fun (x : Env α β) => 0

          Every morphism has concrete distance 0 from itself.

          theorem CatCrypt.Crypto.UCConcrete.DistC.symm {α : Type u_1} {β : Type u_2} {f g : α → Core.SPComp β} {b : Env α β → ENNReal} (h : DistC f g b) :
          DistC g f b

          Symmetry.

          theorem CatCrypt.Crypto.UCConcrete.DistC.triangle {α : Type u_1} {β : Type u_2} {f g k : α → Core.SPComp β} {b₁ b₂ : Env α β → ENNReal} (h₁ : DistC f g b₁) (h₂ : DistC g k b₂) :
          DistC f k fun (Z : Env α β) => b₁ Z + b₂ Z

          Game hop: concrete bounds add pointwise.

          theorem CatCrypt.Crypto.UCConcrete.DistC.comp_right {α : Type u_1} {β : Type u_2} {γ : Type u_3} {f₁ f₂ : α → Core.SPComp β} {b : Env α β → ENNReal} (k : β → Core.SPComp γ) (h : DistC f₁ f₂ b) :
          DistC (fun (a : α) => (f₁ a).bind k) (fun (a : α) => (f₂ a).bind k) fun (Z : Env α γ) => b (Env.postcomp k Z)

          Right post-processing: running k after both morphisms is bounded by the bound of the environment that runs k inside its distinguisher.

          theorem CatCrypt.Crypto.UCConcrete.DistC.comp_left {α : Type u_1} {β : Type u_2} {γ : Type u_3} (f : α → Core.SPComp β) {g₁ g₂ : β → Core.SPComp γ} {b : Env β γ → ENNReal} (h : DistC g₁ g₂ b) :
          DistC (fun (a : α) => (f a).bind g₁) (fun (a : α) => (f a).bind g₂) fun (Z : Env α γ) => ⨆ (y : β), ⨆ (h' : Core.Heap), b { input := y, heap := h', dist := Z.dist }

          Pre-composition with a common computation: the bound is the supremum of the continuation bound over intermediate values and heaps, with the distinguisher unchanged.

          def CatCrypt.Crypto.UCConcrete.Env.sumCase {α₁ : Type u_1} {α₂ : Type u_2} {β₁ : Type u_3} {β₂ : Type u_4} (b₁ : Env α₁ β₁ → ENNReal) (b₂ : Env α₂ β₂ → ENNReal) :
          Env (α₁ ⊕ α₂) (β₁ ⊕ β₂) → ENNReal

          Case split of a bound on sum-typed environments: an environment on input .inl a is sent to the left bound with the distinguisher restricted to .inl, and symmetrically on the right.

          Equations
          Instances For
            theorem CatCrypt.Crypto.UCConcrete.DistC.mapSum {α₁ : Type u_1} {α₂ : Type u_2} {β₁ : Type u_3} {β₂ : Type u_4} {f₁ g₁ : α₁ → Core.SPComp β₁} {f₂ g₂ : α₂ → Core.SPComp β₂} {b₁ : Env α₁ β₁ → ENNReal} {b₂ : Env α₂ β₂ → ENNReal} (h₁ : DistC f₁ g₁ b₁) (h₂ : DistC f₂ g₂ b₂) :
            DistC (Crypto.mapSum f₁ f₂) (Crypto.mapSum g₁ g₂) (Env.sumCase b₁ b₂)

            Parallel composition on Sum: each input activates one component, so the bound is the component bound of the activated side.

            Concrete UC emulation #

            def CatCrypt.Crypto.UCConcrete.UCEmulatesC (spec : UCSpec) (π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)) (F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)) (bound : (spec.leak → Core.SPComp spec.view) → Env spec.hon (spec.out ⊕ spec.view) → ENNReal) :

            Concrete UC emulation: for every adversary A there is a simulator S such that every environment Z distinguishes the real run of π with A from the ideal run of F with S with gap at most bound A Z.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              def CatCrypt.Crypto.UCConcrete.UCEmulatesCSim (spec : UCSpec) (π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)) (F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)) (sim : (spec.leak → Core.SPComp spec.view) → spec.sim_if → Core.SPComp spec.view) (bound : (spec.leak → Core.SPComp spec.view) → Env spec.hon (spec.out ⊕ spec.view) → ENNReal) :

              Concrete UC emulation with the simulator given by the map sim.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim.forget {spec : UCSpec} {π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)} {F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)} {sim : (spec.leak → Core.SPComp spec.view) → spec.sim_if → Core.SPComp spec.view} {bound : (spec.leak → Core.SPComp spec.view) → Env spec.hon (spec.out ⊕ spec.view) → ENNReal} (h : UCEmulatesCSim spec π F sim bound) :
                UCEmulatesC spec π F bound

                An explicit simulator map yields concrete UC emulation.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesC_iff_exists_sim {spec : UCSpec} {π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)} {F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)} {bound : (spec.leak → Core.SPComp spec.view) → Env spec.hon (spec.out ⊕ spec.view) → ENNReal} :
                UCEmulatesC spec π F bound ↔ ∃ (sim : (spec.leak → Core.SPComp spec.view) → spec.sim_if → Core.SPComp spec.view), UCEmulatesCSim spec π F sim bound

                ∀ A ∃ S is equivalent to the existence of a simulator map.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesC_const_iff {spec : UCSpec} {π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)} {F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)} {ε : ENNReal} :
                (UCEmulatesC spec π F fun (x : spec.leak → Core.SPComp spec.view) (x_1 : Env spec.hon (spec.out ⊕ spec.view)) => ε) ↔ UCEmulates ε spec π F

                A constant concrete bound is numeric UC emulation.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim_const_iff {spec : UCSpec} {π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)} {F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)} {sim : UCAlg.SimConstruction spec} {ε : ENNReal} :
                (UCEmulatesCSim spec π F sim fun (x : spec.leak → Core.SPComp spec.view) (x_1 : Env spec.hon (spec.out ⊕ spec.view)) => ε) ↔ UCAlg.UCEmulatesAlg ε spec π F sim

                A constant concrete bound with an explicit simulator map is algebraic UC emulation.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesC.mono {spec : UCSpec} {π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)} {F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)} {b₁ b₂ : (spec.leak → Core.SPComp spec.view) → Env spec.hon (spec.out ⊕ spec.view) → ENNReal} (h : UCEmulatesC spec π F b₁) (hle : ∀ (A : spec.leak → Core.SPComp spec.view) (Z : Env spec.hon (spec.out ⊕ spec.view)), b₁ A Z ≤ b₂ A Z) :
                UCEmulatesC spec π F b₂

                Monotonicity in the bound.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim.mono {spec : UCSpec} {π : spec.hon → Core.SPComp (spec.out ⊕ spec.leak)} {F : spec.hon → Core.SPComp (spec.out ⊕ spec.sim_if)} {sim : (spec.leak → Core.SPComp spec.view) → spec.sim_if → Core.SPComp spec.view} {b₁ b₂ : (spec.leak → Core.SPComp spec.view) → Env spec.hon (spec.out ⊕ spec.view) → ENNReal} (h : UCEmulatesCSim spec π F sim b₁) (hle : ∀ (A : spec.leak → Core.SPComp spec.view) (Z : Env spec.hon (spec.out ⊕ spec.view)), b₁ A Z ≤ b₂ A Z) :
                UCEmulatesCSim spec π F sim b₂

                Monotonicity in the bound, simulator map fixed.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim.refl {hon : Type u_1} {out : Type u_2} {leak : Type u_3} {view : Type u_4} (π : hon → Core.SPComp (out ⊕ leak)) :
                UCEmulatesCSim { hon := hon, out := out, leak := leak, sim_if := leak, view := view } π π id fun (x : { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.leak → Core.SPComp { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.view) (x_1 : Env { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.hon ({ hon := hon, out := out, leak := leak, sim_if := leak, view := view }.out ⊕ { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.view)) => 0

                Reflexivity with the identity simulator map and bound 0.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim.trans {hon : Type u_1} {out : Type u_2} {leak₁ : Type u_3} {leak₂ : Type u_4} {leak₃ : Type u_5} {view : Type u_6} {π₁ : hon → Core.SPComp (out ⊕ leak₁)} {π₂ : hon → Core.SPComp (out ⊕ leak₂)} {π₃ : hon → Core.SPComp (out ⊕ leak₃)} {sim₁ : (leak₁ → Core.SPComp view) → leak₂ → Core.SPComp view} {sim₂ : (leak₂ → Core.SPComp view) → leak₃ → Core.SPComp view} {b₁ : (leak₁ → Core.SPComp view) → Env hon (out ⊕ view) → ENNReal} {b₂ : (leak₂ → Core.SPComp view) → Env hon (out ⊕ view) → ENNReal} (h₁ : UCEmulatesCSim { hon := hon, out := out, leak := leak₁, sim_if := leak₂, view := view } π₁ π₂ sim₁ b₁) (h₂ : UCEmulatesCSim { hon := hon, out := out, leak := leak₂, sim_if := leak₃, view := view } π₂ π₃ sim₂ b₂) :
                UCEmulatesCSim { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view } π₁ π₃ (sim₂ ∘ sim₁) fun (A : { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.leak → Core.SPComp { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.view) (Z : Env { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.hon ({ hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.out ⊕ { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.view)) => b₁ A Z + b₂ (sim₁ A) Z

                Transitivity: the simulator maps compose, and the second bound is evaluated at the simulator produced by the first.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesC.trans {hon : Type u_1} {out : Type u_2} {leak₁ : Type u_3} {leak₂ : Type u_4} {leak₃ : Type u_5} {view : Type u_6} {π₁ : hon → Core.SPComp (out ⊕ leak₁)} {π₂ : hon → Core.SPComp (out ⊕ leak₂)} {π₃ : hon → Core.SPComp (out ⊕ leak₃)} {b₁ : (leak₁ → Core.SPComp view) → Env hon (out ⊕ view) → ENNReal} {b₂ : Env hon (out ⊕ view) → ENNReal} (h₁ : UCEmulatesC { hon := hon, out := out, leak := leak₁, sim_if := leak₂, view := view } π₁ π₂ b₁) (h₂ : UCEmulatesC { hon := hon, out := out, leak := leak₂, sim_if := leak₃, view := view } π₂ π₃ fun (x : { hon := hon, out := out, leak := leak₂, sim_if := leak₃, view := view }.leak → Core.SPComp { hon := hon, out := out, leak := leak₂, sim_if := leak₃, view := view }.view) (Z : Env { hon := hon, out := out, leak := leak₂, sim_if := leak₃, view := view }.hon ({ hon := hon, out := out, leak := leak₂, sim_if := leak₃, view := view }.out ⊕ { hon := hon, out := out, leak := leak₂, sim_if := leak₃, view := view }.view)) => b₂ Z) :
                UCEmulatesC { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view } π₁ π₃ fun (A : { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.leak → Core.SPComp { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.view) (Z : Env { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.hon ({ hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.out ⊕ { hon := hon, out := out, leak := leak₁, sim_if := leak₃, view := view }.view)) => b₁ A Z + b₂ Z

                Transitivity of the existential form when the second bound does not depend on the adversary.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim_of_DistC {hon : Type u_1} {out : Type u_2} {leak : Type u_3} {view : Type u_4} {π F : hon → Core.SPComp (out ⊕ leak)} {b : Env hon (out ⊕ leak) → ENNReal} (h : DistC π F b) :
                UCEmulatesCSim { hon := hon, out := out, leak := leak, sim_if := leak, view := view } π F id fun (A : { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.leak → Core.SPComp { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.view) (Z : Env { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.hon ({ hon := hon, out := out, leak := leak, sim_if := leak, view := view }.out ⊕ { hon := hon, out := out, leak := leak, sim_if := leak, view := view }.view)) => b (Env.postcomp (mapSum Core.SPComp.pure A) Z)

                Same interface (composition plumbing): a concrete distance between π and F gives concrete UC emulation with the adversary as simulator; the bound runs the adversary inside the environment's distinguisher.

                Subroutine and parallel composition #

                theorem CatCrypt.Crypto.UCConcrete.DistC_compile {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {π F : α → Core.SPComp (β ⊕ γ)} {ρ_real ρ_ideal : γ → Core.SPComp δ} {b₁ : Env α (β ⊕ γ) → ENNReal} {b₂ : Env γ δ → ENNReal} (hπ : DistC π F b₁) (hρ : DistC ρ_real ρ_ideal b₂) :
                DistC (compile π ρ_real) (compile F ρ_ideal) fun (Z : Env α (β ⊕ δ)) => (⨆ (c : γ), ⨆ (h' : Core.Heap), b₂ { input := c, heap := h', dist := fun (d : δ) => Z.dist (Sum.inr d) }) + b₁ (Env.postcomp (mapSum Core.SPComp.pure ρ_ideal) Z)

                Concrete subroutine composition: replacing π by F and ρ_real by ρ_ideal costs the subroutine bound, taken at the intermediate values and heaps with the distinguisher restricted to .inr, plus the protocol bound at the environment that runs ρ_ideal inside its distinguisher.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim_compile {α : Type u_1} {β : Type u_2} {γ : Type u_3} {δ : Type u_4} {V : Type u_5} {π F : α → Core.SPComp (β ⊕ γ)} {ρ_real ρ_ideal : γ → Core.SPComp δ} {b₁ : Env α (β ⊕ γ) → ENNReal} {b₂ : Env γ δ → ENNReal} (hπ : DistC π F b₁) (hρ : DistC ρ_real ρ_ideal b₂) :
                UCEmulatesCSim { hon := α, out := β, leak := δ, sim_if := δ, view := V } (compile π ρ_real) (compile F ρ_ideal) id fun (A : { hon := α, out := β, leak := δ, sim_if := δ, view := V }.leak → Core.SPComp { hon := α, out := β, leak := δ, sim_if := δ, view := V }.view) (Z : Env { hon := α, out := β, leak := δ, sim_if := δ, view := V }.hon ({ hon := α, out := β, leak := δ, sim_if := δ, view := V }.out ⊕ { hon := α, out := β, leak := δ, sim_if := δ, view := V }.view)) => have Z' := Env.postcomp (mapSum Core.SPComp.pure A) Z; (⨆ (c : γ), ⨆ (h' : Core.Heap), b₂ { input := c, heap := h', dist := fun (d : δ) => Z'.dist (Sum.inr d) }) + b₁ (Env.postcomp (mapSum Core.SPComp.pure ρ_ideal) Z')

                Concrete UC subroutine composition (composition plumbing), same interface with the adversary as simulator.

                theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim_par {α₁ : Type u_1} {β₁ : Type u_2} {α₂ : Type u_3} {β₂ : Type u_4} {V : Type u_5} {π₁ F₁ : α₁ → Core.SPComp β₁} {π₂ F₂ : α₂ → Core.SPComp β₂} {b₁ : Env α₁ β₁ → ENNReal} {b₂ : Env α₂ β₂ → ENNReal} (h₁ : DistC π₁ F₁ b₁) (h₂ : DistC π₂ F₂ b₂) :
                UCEmulatesCSim { hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V } (fun (x : { hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V }.hon) => (mapSum π₁ π₂ x).bind fun (o : β₁ ⊕ β₂) => Core.SPComp.pure (Sum.inr o)) (fun (x : { hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V }.hon) => (mapSum F₁ F₂ x).bind fun (o : β₁ ⊕ β₂) => Core.SPComp.pure (Sum.inr o)) id fun (A : { hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V }.leak → Core.SPComp { hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V }.view) (Z : Env { hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V }.hon ({ hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V }.out ⊕ { hon := α₁ ⊕ α₂, out := Unit, leak := β₁ ⊕ β₂, sim_if := β₁ ⊕ β₂, view := V }.view)) => Env.sumCase b₁ b₂ (Env.postcomp (fun (o : β₁ ⊕ β₂) => Core.SPComp.pure (Sum.inr o)) (Env.postcomp (mapSum Core.SPComp.pure A) Z))

                Concrete UC parallel composition (composition plumbing): the output of mapSum π₁ π₂ is exposed on the adversary channel, and each environment is charged the bound of the component its input activates.

                Concrete game route #

                The distinguisher D with its initial heap fixed to h₀: it ignores the heap it is run on. For a heap-independent game G, running D after G from h₀ equals running fixHeap h₀ D after G from Heap.empty.

                Equations
                Instances For
                  theorem CatCrypt.Crypto.UCConcrete.DistC_of_isPure_advantageA {α : Type u_1} {β : Type u_2} {f g : α → Core.SPComp β} {gb : α → (β → Core.SPComp Bool) → ENNReal} (hf : ∀ (a : α), (f a).IsPure) (hg : ∀ (a : α), (g a).IsPure) (hAdv : ∀ (a : α) (D : β → Core.SPComp Bool), AdvantageA (f a) (g a) D ≤ gb a D) :
                  DistC f g fun (Z : Env α β) => gb Z.input (fixHeap Z.heap Z.dist)

                  Concrete distance from a per-distinguisher advantage bound on heap-independent games: the environment Z is charged the game bound at its input and its distinguisher with the heap fixed to Z.heap.

                  class CatCrypt.Crypto.UCConcrete.PureGame {hon : Type u_1} {leak : Type u_2} (G : hon → Core.SPComp leak) :

                  A family of heap-independent games.

                  • isPure (x : hon) : (G x).IsPure
                  Instances
                    class CatCrypt.Crypto.UCConcrete.GameAdvBoundC {hon : Type u_1} {leak : Type u_2} (G_real G_ideal : hon → Core.SPComp leak) (bound : hon → (leak → Core.SPComp Bool) → ENNReal) :

                    Concrete game bound: the advantage of every distinguisher D on input x is at most bound x D, where bound is typically the advantage of an explicit reduction built from D against a primitive.

                    bound is an explicit index, fixed by the goal.

                    Instances
                      noncomputable def CatCrypt.Crypto.UCConcrete.envReduction {hon : Type u_1} {leak : Type u_2} {V : Type u_3} (A : leak → Core.SPComp V) (Z : Env hon (Unit ⊕ V)) :
                      leak → Core.SPComp Bool

                      The distinguisher that the game bound receives from adversary A and UC environment Z: run A on the game output, pass its view to Z.dist on the adversary channel, with the heap fixed to Z.heap.

                      Equations
                      Instances For
                        noncomputable def CatCrypt.Crypto.UCConcrete.gameUCBound {hon : Type u_1} {leak : Type u_2} {V : Type u_3} (bound : hon → (leak → Core.SPComp Bool) → ENNReal) :
                        (leak → Core.SPComp V) → Env hon (Unit ⊕ V) → ENNReal

                        UC bound induced by a concrete game bound: the game bound at the environment's input and at envReduction A Z.

                        Equations
                        Instances For
                          theorem CatCrypt.Crypto.UCConcrete.ofGame_run_eq {hon leak V : Type} (G : hon → Core.SPComp leak) (A : leak → Core.SPComp V) (D : Unit ⊕ V → Core.SPComp Bool) (x : hon) :
                          ((UCDSL.UCProtocol.ofGame G x).bind (mapSum Core.SPComp.pure A)).bind D = (G x).bind fun (o : leak) => (A o).bind fun (v : V) => D (Sum.inr v)

                          Running a game wrapped by UCProtocol.ofGame, then the adversary, then a distinguisher, is running the game followed by the adversary and the distinguisher on the adversary channel.

                          theorem CatCrypt.Crypto.UCConcrete.UCEmulatesCSim_of_isPure_advantageA {hon leak V : Type} {G_real G_ideal : hon → Core.SPComp leak} {bound : hon → (leak → Core.SPComp Bool) → ENNReal} (hPure_r : ∀ (x : hon), (G_real x).IsPure) (hPure_i : ∀ (x : hon), (G_ideal x).IsPure) (hAdv : ∀ (x : hon) (D : leak → Core.SPComp Bool), AdvantageA (G_real x) (G_ideal x) D ≤ bound x D) :

                          Concrete UC emulation of a game pair from heap-independence and a concrete game bound (composition plumbing, simulator S = A).

                          class CatCrypt.Crypto.UCConcrete.UCFromGameC {hon leak : Type} (G_real G_ideal : hon → Core.SPComp leak) (V : Type) (bound : hon → (leak → Core.SPComp Bool) → ENNReal) :

                          Concrete UC emulation of UCProtocol.ofGame G_real by UCProtocol.ofGame G_ideal with view type V, simulator S = A, and the bound induced by the game bound bound.

                          Instances
                            instance CatCrypt.Crypto.UCConcrete.ucFromGameC_of_pure_adv {hon leak V : Type} {G_real G_ideal : hon → Core.SPComp leak} {bound : hon → (leak → Core.SPComp Bool) → ENNReal} [PureGame G_real] [PureGame G_ideal] [GameAdvBoundC G_real G_ideal bound] :
                            UCFromGameC G_real G_ideal V bound

                            Heap-independent games with a concrete game bound give concrete UC emulation (composition plumbing).