Documentation

GaudisCrypt.Logic.AbstractCallUpto

The up-to-bad abstract call rule (EasyCrypt's call (: bad, invP, invQ)) #

EasyCrypt's abstract call rule has an up-to-bad form (equivF_abs_upto, src/phl/ecPhlFun.ml): the two oracle instantiations need agree only until a bad event on the right, after which the runs are unrelated except for an invariant invQ. prhlProc_abstract_call_upto (procedure with holes) and prhlProc_abstract_call_upto_module (module) are that rule.

The coupling (prhl2_body_upto) is built by induction over the adversary's code, with the invariant uptoInv: before the bad event, the runs are synchronized as in the plain abstract call rule (syncInv: ={glob}, invP, equal locals); after it, the two runs of what remains couple independently (ProgramDenotation.prhl2.product), each side keeping a unary invariant (satisfies_inv_of_confined). An independent coupling needs both remainders to be lossless: the induction carries "this statement is lossless here" (ProgramDenotation.LosslessAt), which the adversary's losslessness gives at the start and LosslessAt.of_bind passes on to almost every intermediate state. A loop switches to the independent coupling at the start of an iteration (ProgramDenotation.prhl2.while_upto, Logic/PRHL2Upto.lean), since after the bad event the two guards need not agree.

theorem GaudisCrypt.SubProbability.mass_eq_tsum {T : Type u} (μ : SubProbability T) :
↑μ Set.univ = ∑' (t : T), ↑μ {t}

The mass of a sub-probability is the sum of its atoms.

theorem GaudisCrypt.SubProbability.mass_eq_expected {T : Type u} (μ : SubProbability T) :
↑μ Set.univ = μ.expected fun (x : T) => 1
theorem GaudisCrypt.SubProbability.mass_bind {α β : Type u} (μ : SubProbability α) (f : α → SubProbability β) :
↑(μ >>= f) Set.univ = ∑' (t : α), ↑(f t) Set.univ * ↑μ {t}

The mass of a bind: the continuation's masses, weighted by the atoms.

theorem GaudisCrypt.SubProbability.lossless_of_bind {α β : Type u} {μ : SubProbability α} {f : α → SubProbability β} (h : ↑(μ >>= f) Set.univ = 1) :
↑μ Set.univ = 1 ∧ μ.satisfies fun (t : α) => ↑(f t) Set.univ = 1

A lossless bind: its first part is lossless, and its continuation is lossless at every atom of the first part.

def GaudisCrypt.ProgramDenotation.LosslessAt {s : Type u} {α : Type v} (c : ProgramDenotation s α) (σ : s) :

c runs without loss from σ.

Equations
Instances For
    theorem GaudisCrypt.ProgramDenotation.LosslessAt.of_bind {s : Type u} {α β : Type v} {c : ProgramDenotation s α} {k : α → ProgramDenotation s β} {σ : s} (h : (c >>= k).LosslessAt σ) :
    c.LosslessAt σ ∧ (c σ).satisfies fun (x : α × s) => (k x.1).LosslessAt x.2

    A program lossless at σ followed by k: lossless at σ, and k is lossless at every outcome.

    theorem GaudisCrypt.SubProbability.bind_const_of_lossless {α β : Type u} (μ : SubProbability α) (hμ : ↑μ Set.univ = 1) (ν : SubProbability β) :
    (do let _ ← μ ν) = ν

    Running a lossless sub-probability first does not change the expectation of what follows.

    theorem GaudisCrypt.ProgramDenotation.prhl2.product {s₁ s₂ : Type (max u v)} {α β : Type v} {A : s₁ → s₂ → Prop} {c : ProgramDenotation s₁ α} {d : ProgramDenotation s₂ β} {B : α × s₁ → β × s₂ → Prop} (h : ∀ (σ₁ : s₁) (σ₂ : s₂), A σ₁ σ₂ → c.LosslessAt σ₁ ∧ d.LosslessAt σ₂ ∧ ∀ (x : α × s₁) (y : β × s₂), ↑(c σ₁) {x} ≠ 0 → ↑(d σ₂) {y} ≠ 0 → B x y) :
    prhl2 A c d B

    The product coupling: two runs, lossless at the related states, couple independently; the postcondition must hold for every pair of outcomes.

    One side at a time: invariants of the L-content #

    def GaudisCrypt.diagInv {Ω : Type} (L : Lens Ω VariableAssignment) (Inv : Ω → Prop) (g₁ g₂ : VariableAssignment) :

    The diagonal invariant: equal states, and Inv of the L-content.

    Equations
    Instances For

      A run confined to a region outside L keeps the L-content.

      The adversary's own steps keep the diagonal invariant.

      theorem GaudisCrypt.satisfies_inv_of_confined {Ω : Type} (L : Lens Ω VariableAssignment) {holes : HoleSigs} {sig : ProcedureSignature} (A : ProcedureWithHoles holes sig) (hdisj : FVP.fvP_proc A ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (inst : holes.Instantiation) (Inv : Ω → Prop) (horacle : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType) (g : VariableAssignment), Inv (L.get g) → (procedureDenotation (inst.lookup n) a g).satisfies fun (x : sig'.ret × VariableAssignment) => Inv (L.get x.2)) (s : StmtWithHoles holes) (hs : Lib.RO.Instantiate.ConfinedP (Lib.RO.Instantiate.fvP_proc A) s) (ps : ProgramState) (hps : Inv (L.get ps.globals)) :
      (programDenotation (s.instantiate inst) ps).satisfies fun (x : Unit × ProgramState) => Inv (L.get x.2.globals)

      Unary invariance: a statement confined to what A may touch, with oracles that keep Inv of the L-content, keeps it.

      theorem GaudisCrypt.ProgramDenotation.prhl2.strengthen {s₁ s₂ : Type (max u v)} {α β : Type v} {A : s₁ → s₂ → Prop} {c : ProgramDenotation s₁ α} {d : ProgramDenotation s₂ β} {B : α × s₁ → β × s₂ → Prop} {U₁ : α × s₁ → Prop} {U₂ : β × s₂ → Prop} (h : prhl2 A c d B) (hu : ∀ (σ₁ : s₁) (σ₂ : s₂), A σ₁ σ₂ → (c σ₁).satisfies U₁ ∧ (d σ₂).satisfies U₂) :
      prhl2 A c d fun (u : α × s₁) (v : β × s₂) => B u v ∧ U₁ u ∧ U₂ v

      A coupling whose marginals satisfy U₁, U₂ satisfies them on its support.

      theorem GaudisCrypt.ProgramDenotation.set_losslessAt {s : Type u} {a : Type v} (x : Setter a s) (r : a) (σ : s) :
      (set x r).LosslessAt σ
      theorem GaudisCrypt.ProgramDenotation.LosslessAt.while_unroll {s : Type u} {cond : ProgramDenotation s Bool} {body : ProgramDenotation s Unit} {σ : s} (h : (while_loop cond body).LosslessAt σ) :
      (cond σ).satisfies fun (x : Bool × s) => (if x.1 = true then do body while_loop cond body else pure ()).LosslessAt x.2

      A loop lossless at σ: at the guard's outcome, the rest (body; loop or nothing) is lossless.

      The up-to-bad induction #

      @[reducible, inline]
      abbrev GaudisCrypt.syncInv {Ω : Type} (L : Lens Ω VariableAssignment) (F : Footprint VariableAssignment) (I : Ω → Ω → Prop) (bad : Ω → Prop) :

      Before the bad event: ={glob} on F, I on the L-contents, and not bad on the right (EasyCrypt's !bad{2} /\ ={glob A} /\ invP).

      Equations
      Instances For
        @[reducible, inline]
        abbrev GaudisCrypt.badInv {Ω : Type} (L : Lens Ω VariableAssignment) (bad : Ω → Prop) (Q : Ω → Ω → Prop) (g₁ g₂ : VariableAssignment) :

        After the bad event: bad on the right, and Q on the L-contents (EasyCrypt's bad{2} /\ invQ).

        Equations
        Instances For
          @[reducible, inline]
          abbrev GaudisCrypt.uptoInv {Ω : Type} (L : Lens Ω VariableAssignment) (F : Footprint VariableAssignment) (I : Ω → Ω → Prop) (bad : Ω → Prop) (Q : Ω → Ω → Prop) (ps₁ ps₂ : ProgramState) :

          The invariant of the up-to-bad induction, on procedure states.

          Equations
          Instances For
            theorem GaudisCrypt.prhl2_badInv_product {Ω : Type} (L : Lens Ω VariableAssignment) {holes : HoleSigs} {sig : ProcedureSignature} (A : ProcedureWithHoles holes sig) (inst₁ inst₂ : holes.Instantiation) (bad : Ω → Prop) (Q : Ω → Ω → Prop) (hdisj : FVP.fvP_proc A ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (hQ₁ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType) (g : VariableAssignment) (ω₂ : Ω), bad ω₂ → Q (L.get g) ω₂ → (procedureDenotation (inst₁.lookup n) a g).satisfies fun (x : sig'.ret × VariableAssignment) => Q (L.get x.2) ω₂) (hQ₂ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType) (g : VariableAssignment) (ω₁ : Ω), bad (L.get g) → Q ω₁ (L.get g) → (procedureDenotation (inst₂.lookup n) a g).satisfies fun (x : sig'.ret × VariableAssignment) => bad (L.get x.2) ∧ Q ω₁ (L.get x.2)) (s : StmtWithHoles holes) (hs : Lib.RO.Instantiate.ConfinedP (Lib.RO.Instantiate.fvP_proc A) s) :
            ProgramDenotation.prhl2 (fun (ps₁ ps₂ : ProgramState) => badInv L bad Q ps₁.globals ps₂.globals ∧ (programDenotation (s.instantiate inst₁)).LosslessAt ps₁ ∧ (programDenotation (s.instantiate inst₂)).LosslessAt ps₂) (programDenotation (s.instantiate inst₁)) (programDenotation (s.instantiate inst₂)) fun (u v : Unit × ProgramState) => badInv L bad Q u.2.globals v.2.globals

            After the bad event: the two runs of any statement of A, lossless at the related states, couple independently; the left keeps Q against the right's state, the right keeps bad and Q.

            theorem GaudisCrypt.prhl2_upto_split {Ω : Type} (L : Lens Ω VariableAssignment) {holes : HoleSigs} {sig : ProcedureSignature} (A : ProcedureWithHoles holes sig) (inst₁ inst₂ : holes.Instantiation) (bad : Ω → Prop) (Q : Ω → Ω → Prop) (F : Footprint VariableAssignment) (I : Ω → Ω → Prop) (hdisj : FVP.fvP_proc A ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (hQ₁ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType) (g : VariableAssignment) (ω₂ : Ω), bad ω₂ → Q (L.get g) ω₂ → (procedureDenotation (inst₁.lookup n) a g).satisfies fun (x : sig'.ret × VariableAssignment) => Q (L.get x.2) ω₂) (hQ₂ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType) (g : VariableAssignment) (ω₁ : Ω), bad (L.get g) → Q ω₁ (L.get g) → (procedureDenotation (inst₂.lookup n) a g).satisfies fun (x : sig'.ret × VariableAssignment) => bad (L.get x.2) ∧ Q ω₁ (L.get x.2)) (s : StmtWithHoles holes) (hs : Lib.RO.Instantiate.ConfinedP (Lib.RO.Instantiate.fvP_proc A) s) (hsync : ProgramDenotation.prhl2 (fun (ps₁ ps₂ : ProgramState) => (uptoInv L F I bad Q ps₁ ps₂ ∧ (programDenotation (s.instantiate inst₁)).LosslessAt ps₁ ∧ (programDenotation (s.instantiate inst₂)).LosslessAt ps₂) ∧ ¬badInv L bad Q ps₁.globals ps₂.globals) (programDenotation (s.instantiate inst₁)) (programDenotation (s.instantiate inst₂)) fun (u v : Unit × ProgramState) => uptoInv L F I bad Q u.2 v.2) :
            ProgramDenotation.prhl2 (fun (ps₁ ps₂ : ProgramState) => uptoInv L F I bad Q ps₁ ps₂ ∧ (programDenotation (s.instantiate inst₁)).LosslessAt ps₁ ∧ (programDenotation (s.instantiate inst₂)).LosslessAt ps₂) (programDenotation (s.instantiate inst₁)) (programDenotation (s.instantiate inst₂)) fun (u v : Unit × ProgramState) => uptoInv L F I bad Q u.2 v.2

            Before a statement, the bad event happened (prhl2_badInv_product) or not: it suffices to treat the synchronized case.

            theorem GaudisCrypt.prhl2_body_upto {Ω : Type} (L : Lens Ω VariableAssignment) {holes : HoleSigs} {sig : ProcedureSignature} (A : ProcedureWithHoles holes sig) (inst₁ inst₂ : holes.Instantiation) (bad : Ω → Prop) (Q : Ω → Ω → Prop) (F : Footprint VariableAssignment) (I : Ω → Ω → Prop) (hAF : FVP.fvP_proc A ≤ F) (hFL : F ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (horacle : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType), ProgramDenotation.prhl2 (syncInv L F I bad) (procedureDenotation (inst₁.lookup n) a) (procedureDenotation (inst₂.lookup n) a) fun (u v : sig'.ret × VariableAssignment) => badInv L bad Q u.2 v.2 ∨ u.1 = v.1 ∧ syncInv L F I bad u.2 v.2) (hQ₁ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType) (g : VariableAssignment) (ω₂ : Ω), bad ω₂ → Q (L.get g) ω₂ → (procedureDenotation (inst₁.lookup n) a g).satisfies fun (x : sig'.ret × VariableAssignment) => Q (L.get x.2) ω₂) (hQ₂ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (a : sig'.ParamType) (g : VariableAssignment) (ω₁ : Ω), bad (L.get g) → Q ω₁ (L.get g) → (procedureDenotation (inst₂.lookup n) a g).satisfies fun (x : sig'.ret × VariableAssignment) => bad (L.get x.2) ∧ Q ω₁ (L.get x.2)) (s : StmtWithHoles holes) :
            Lib.RO.Instantiate.ConfinedP (Lib.RO.Instantiate.fvP_proc A) s → ProgramDenotation.prhl2 (fun (ps₁ ps₂ : ProgramState) => uptoInv L F I bad Q ps₁ ps₂ ∧ (programDenotation (s.instantiate inst₁)).LosslessAt ps₁ ∧ (programDenotation (s.instantiate inst₂)).LosslessAt ps₂) (programDenotation (s.instantiate inst₁)) (programDenotation (s.instantiate inst₂)) fun (u v : Unit × ProgramState) => uptoInv L F I bad Q u.2 v.2

            The up-to-bad induction (the body of EasyCrypt's call (: bad, invP, invQ) for an abstract procedure): every statement of A, lossless at the related states, keeps uptoInv. Before the bad event the two runs are synchronized (={glob}, invP, equal locals) and the oracle calls are coupled by horacle; after it, they couple independently (prhl2_badInv_product); a loop switches to that at the start of an iteration (prhl2.while_upto).

            theorem GaudisCrypt.hoareProc.satisfies {sig : ProcedureSignature} {P : sig.ParamType → VariableAssignment → Prop} {p : Procedure sig} {B : sig.ret → VariableAssignment → Prop} (h : hoareProc P p B) {a : sig.ParamType} {g : VariableAssignment} (hP : P a g) :
            (procedureDenotation p a g).satisfies fun (r : sig.ret × VariableAssignment) => B r.1 r.2

            A Hoare triple about a procedure, as the support of its runs.

            A lossless procedure is lossless from every state.

            theorem GaudisCrypt.prhlProc_abstract_call_upto {Ω : Type} (L : Lens Ω VariableAssignment) {holes : HoleSigs} {sig : ProcedureSignature} (inst₁ inst₂ : holes.Instantiation) (A : ProcedureWithHoles holes sig) (F : Footprint VariableAssignment) (hAF : FVP.fvP_proc A ≤ F) (hFL : F ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (bad : Ω → Prop) (I Q : Ω → Ω → Prop) (hll₁ : (A.instantiate inst₁).IsLossless) (hll₂ : (A.instantiate inst₂).IsLossless) (horacle : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig'), prhlProc (fun (a₁ : sig'.ParamType) (g₁ : VariableAssignment) (a₂ : sig'.ParamType) (g₂ : VariableAssignment) => a₁ = a₂ ∧ syncInv L F I bad g₁ g₂) (inst₁.lookup n) (inst₂.lookup n) fun (r₁ : sig'.ret) (g₁ : VariableAssignment) (r₂ : sig'.ret) (g₂ : VariableAssignment) => badInv L bad Q g₁ g₂ ∨ r₁ = r₂ ∧ syncInv L F I bad g₁ g₂) (hQ₁ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (ω₂ : Ω), bad ω₂ → hoareProc (fun (x : sig'.ParamType) (g : VariableAssignment) => Q (L.get g) ω₂) (inst₁.lookup n) fun (x : sig'.ret) (g : VariableAssignment) => Q (L.get g) ω₂) (hQ₂ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (ω₁ : Ω), hoareProc (fun (x : sig'.ParamType) (g : VariableAssignment) => bad (L.get g) ∧ Q ω₁ (L.get g)) (inst₂.lookup n) fun (x : sig'.ret) (g : VariableAssignment) => bad (L.get g) ∧ Q ω₁ (L.get g)) :
            prhlProc (fun (a₁ : sig.ParamType) (g₁ : VariableAssignment) (a₂ : sig.ParamType) (g₂ : VariableAssignment) => badInv L bad Q g₁ g₂ ∨ a₁ = a₂ ∧ syncInv L F I bad g₁ g₂) (A.instantiate inst₁) (A.instantiate inst₂) fun (r₁ : sig.ret) (g₁ : VariableAssignment) (r₂ : sig.ret) (g₂ : VariableAssignment) => badInv L bad Q g₁ g₂ ∨ r₁ = r₂ ∧ syncInv L F I bad g₁ g₂

            The up-to-bad abstract call rule (EasyCrypt's call (: bad, invP, invQ) on an abstract procedure, equivF_abs_upto in src/phl/ecPhlFun.ml), for an adversary given as a procedure with holes:

              A lossless with the two instantiations of its oracles                      (EC: `islossless A`)
              equiv[ o₁ ~ o₂ : !bad{2} ∧ ={arg} ∧ ={glob} ∧ invP
                             ==> if bad{2} then invQ else ={res} ∧ ={glob} ∧ invP ]      (per oracle)
              ∀ &2, bad{2} → hoare[ o₁ : invQ ==> invQ ]                                  (per oracle)
              ∀ &1, hoare[ o₂ : bad ∧ invQ ==> bad ∧ invQ ]                               (per oracle)
              ──────────────────────────────────────────────────────────────────────────────────────────
              equiv[ A(o₁) ~ A(o₂) : if bad{2} then invQ else ={arg} ∧ ={glob} ∧ invP
                                   ==> if bad{2} then invQ else ={res} ∧ ={glob} ∧ invP ]
            

            bad, invP, invQ read the oracle region L (EasyCrypt rejects invariants on glob A); ={glob} is agreement on a region F containing A's footprint, outside L. EasyCrypt asks the oracles to be lossless after the bad event (its phoare … = 1); here the adversary's losslessness is asked with the two instantiations directly.

            Synchronized means equal #

            With ={glob} everything outside L (F = L.compl.footprint) and invP equality on L, EasyCrypt's ={glob A} /\ invP before the bad event is equality of the global states, and the per-oracle premise can be stated at equal states (prhlProc_upto_of_eq).

            theorem GaudisCrypt.syncInv_compl_eq_iff {Ω : Type} (L : Lens Ω VariableAssignment) (bad : Ω → Prop) (g₁ g₂ : VariableAssignment) :
            syncInv L L.compl.footprint (fun (x1 x2 : Ω) => x1 = x2) bad g₁ g₂ ↔ g₁ = g₂ ∧ ¬bad (L.get g₂)

            syncInv at F = L.compl.footprint and invP equality: equal states, not bad.

            theorem GaudisCrypt.prhlProc_upto_of_eq {Ω : Type} (L : Lens Ω VariableAssignment) {sig' : ProcedureSignature} (bad : Ω → Prop) {o₁ o₂ : Procedure sig'} (h : prhlProc (fun (a₁ : sig'.ParamType) (g₁ : VariableAssignment) (a₂ : sig'.ParamType) (g₂ : VariableAssignment) => a₁ = a₂ ∧ g₁ = g₂ ∧ ¬bad (L.get g₂)) o₁ o₂ fun (r₁ : sig'.ret) (g₁ : VariableAssignment) (r₂ : sig'.ret) (g₂ : VariableAssignment) => bad (L.get g₂) ∨ r₁ = r₂ ∧ g₁ = g₂) :
            prhlProc (fun (a₁ : sig'.ParamType) (g₁ : VariableAssignment) (a₂ : sig'.ParamType) (g₂ : VariableAssignment) => a₁ = a₂ ∧ syncInv L L.compl.footprint (fun (x1 x2 : Ω) => x1 = x2) bad g₁ g₂) o₁ o₂ fun (r₁ : sig'.ret) (g₁ : VariableAssignment) (r₂ : sig'.ret) (g₂ : VariableAssignment) => badInv L bad (fun (x x_1 : Ω) => True) g₁ g₂ ∨ r₁ = r₂ ∧ syncInv L L.compl.footprint (fun (x1 x2 : Ω) => x1 = x2) bad g₁ g₂

            The oracle premise of prhlProc_abstract_call_upto(_module) at F = L.compl.footprint, invP equality and invQ trivial, from equal arguments and states: after the calls, the bad event, or equal results and states.

            theorem GaudisCrypt.prhlProc_abstract_call_upto_module {Ω : Type} (L : Lens Ω VariableAssignment) {T : Type 1} [IsModule T] {sig : ProcedureSignature} {holes : HoleSigs} (D : Module.Arr T (Module.Proc sig)) (ext : T → holes.Instantiation) (hD : Module.Representable D ext) (F : Footprint VariableAssignment) (hDF : FVP.fvP D ≤ F) (hFL : F ≤ L.footprintᶜ) (hc : ∀ {sig' : ProcedureSignature} (a : HoleIndex holes sig'), Countable sig'.ParamType) (bad : Ω → Prop) (I Q : Ω → Ω → Prop) (O₁ O₂ : T) (hll₁ : (Module.app D O₁).procedure.IsLossless) (hll₂ : (Module.app D O₂).procedure.IsLossless) (horacle : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig'), prhlProc (fun (a₁ : sig'.ParamType) (g₁ : VariableAssignment) (a₂ : sig'.ParamType) (g₂ : VariableAssignment) => a₁ = a₂ ∧ syncInv L F I bad g₁ g₂) ((ext O₁).lookup n) ((ext O₂).lookup n) fun (r₁ : sig'.ret) (g₁ : VariableAssignment) (r₂ : sig'.ret) (g₂ : VariableAssignment) => badInv L bad Q g₁ g₂ ∨ r₁ = r₂ ∧ syncInv L F I bad g₁ g₂) (hQ₁ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (ω₂ : Ω), bad ω₂ → hoareProc (fun (x : sig'.ParamType) (g : VariableAssignment) => Q (L.get g) ω₂) ((ext O₁).lookup n) fun (x : sig'.ret) (g : VariableAssignment) => Q (L.get g) ω₂) (hQ₂ : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig') (ω₁ : Ω), hoareProc (fun (x : sig'.ParamType) (g : VariableAssignment) => bad (L.get g) ∧ Q ω₁ (L.get g)) ((ext O₂).lookup n) fun (x : sig'.ret) (g : VariableAssignment) => bad (L.get g) ∧ Q ω₁ (L.get g)) :
            prhlProc (fun (a₁ : sig.ParamType) (g₁ : VariableAssignment) (a₂ : sig.ParamType) (g₂ : VariableAssignment) => badInv L bad Q g₁ g₂ ∨ a₁ = a₂ ∧ syncInv L F I bad g₁ g₂) (Module.app D O₁).procedure (Module.app D O₂).procedure fun (r₁ : sig.ret) (g₁ : VariableAssignment) (r₂ : sig.ret) (g₂ : VariableAssignment) => badInv L bad Q g₁ g₂ ∨ r₁ = r₂ ∧ syncInv L F I bad g₁ g₂

            The up-to-bad abstract call rule for a module (EasyCrypt's declare module D <: T {-O}, then call (: bad, invP, invQ)): prhlProc_abstract_call_upto through D's representation. D's losslessness with the two oracles is EasyCrypt's islossless premise (from D_ll).