Documentation

GaudisCrypt.Logic.ECCallAbstract

EasyCrypt's call (_: ={glob A, x₁, …}) on an abstract procedure #

equiv_call (_ : ={glob A, Bounder.bounder, Counter.c, RO.m})

The last statements of both sides call the same declared module A (declare module), with oracles O₁, O₂ (A(O₁).f, A(O₂).f). EC's call (_: ={glob A, X}): the two calls agree on their results and on glob A and X afterwards, if their arguments and glob A, X agree before, and if the oracles' procedures keep that agreement (prhlProc_abstract_call_module, the invariant globInvF X (glob A) Eq).

Goals, as EC's: the oracles' judgments (oracle, one per procedure of the oracles' module type, each equiv[ O₁.f ~ O₂.f : ={arg, glob A, X} ==> ={res, glob A, X} ]), then the code before the calls (pre). The representation of A comes from its declaration and the oracles' module type T.ext; A's disjointness from X and the oracles' countable arguments are discharged as for hoare_call (: inv). glob A may be written or left out: it is always part of the invariant.

On a call A(O₁) ~ A(O₂) of a declared module, Logic/ECCallUpto.lean's rule for the same syntax comes first: EC's oracle judgments, without glob A (the oracles' writes keep it). The rule here is the fallback, and the rule for another declared module's glob in the set.

theorem GaudisCrypt.prhlProc_glob_module {sig : ProcedureSignature} (M : Module.Proc sig) {R : Footprint VariableAssignment} (hM : FVP.fvP M ≤ R) :
prhlProc (fun (a₁ : sig.ParamType) (g₁ : VariableAssignment) (a₂ : sig.ParamType) (g₂ : VariableAssignment) => a₁ = a₂ ∧ R.touched_getter.get g₁ = R.touched_getter.get g₂) M.procedure M.procedure fun (r₁ : sig.ret) (g₁ : VariableAssignment) (r₂ : sig.ret) (g₂ : VariableAssignment) => r₁ = r₂ ∧ R.touched_getter.get g₁ = R.touched_getter.get g₂

A concrete procedure keeps ={glob R}: a procedure module M touching only R (its footprint below R) runs the same from equal arguments and states equal on R (EC's call (_ : ={glob P}) on a concrete callee, its oracle judgment by sim).

theorem GaudisCrypt.HoleIndex.forall_cons {s : ProcedureSignature} {holes : HoleSigs} {P : {sig' : ProcedureSignature} → HoleIndex (HoleSigs.cons s holes) sig' → Prop} (h0 : P zero) (hs : ∀ {sig' : ProcedureSignature} (n : HoleIndex holes sig'), P n.succ) {sig' : ProcedureSignature} (n : HoleIndex (HoleSigs.cons s holes) sig') :
P n

A statement about every oracle of a module type with one more procedure: the first one, and every other.

A statement about every oracle of a module type without procedures.

The components of the oracles O : T (T a ×ₘ of module types): each module type and module, in the order of the holes (ModuleTypeRep.holesApp); a literal pair's components, or (literal := false) Module.fst O, Module.snd O — what T's canonical ext reduces to.

The procedures of a module X of a module type C declared by moduletype (its fields, in order), as (C.f X).procedure.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    holes as a literal .cons s₁ (… .empty) (the signatures left as they are).

    Split a goal ∀ {sig'} (n : HoleIndex holes sig'), P n over the k holes.

    In the goal g about the hole k: each (ext O).lookup _ the procedure of O₁ or O₂ it is (procs₁[k], procs₂[k]); the views L.get g taken apart (Lens.pair); the goal's remaining funs applied.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      An abstract module with several procedures #

      EC's module type Adv (O : POracle) = { proc a1 … proc a2 … }, declare module A <: Adv: a functor A : POracle →ₘ AdvProcs into a record of procedures. Its procedure A(O).a2 is the functor AdvProcs.a2 ∘ A into a procedure (Module.comp with the accessor as a module, which touches nothing), and the rules for an abstract functor into a procedure apply to that.

      theorem GaudisCrypt.prhlProc_of_comp_accessor {T B : Type 1} [IsModule T] [IsModule B] {sig : ProcedureSignature} {acc : B → Module.Proc sig} (U : ModuleTypeUtilities B (Module.Proc sig) acc) (D : Module.Arr T B) (O₁ O₂ : T) {P : sig.ParamType → VariableAssignment → sig.ParamType → VariableAssignment → Prop} {Q : sig.ret → VariableAssignment → sig.ret → VariableAssignment → Prop} (h : prhlProc P (Module.app (Module.comp U.accessorModule D) O₁).procedure (Module.app (Module.comp U.accessorModule D) O₂).procedure Q) :
      prhlProc P (acc (Module.app D O₁)).procedure (acc (Module.app D O₂)).procedure Q

      A judgment about the procedures (acc ∘ D)(O₁), (acc ∘ D)(O₂) is one about acc (D O₁), acc (D O₂): the accessor acc of a module type applied to the functor's result.

      theorem GaudisCrypt.Module.representable_comp_firstOrder {T B : Type 1} [IsModule T] [IsModule B] {sig : ProcedureSignature} (f : Arr B (Proc sig)) (A : Arr T B) (ext : T → ((moduleTypeRep T).holesApp HoleSigs.empty).Instantiation) (hT : (moduleTypeRep T).FirstOrder := by module_first_order) (hne : ((moduleTypeRep T).holesApp HoleSigs.empty).AllNonempty := by holes_nonempty) (hext : ∀ (O : T), ext O = (moduleTypeRep T).extOf (cast T O) := by intro _; rfl) :

      A functor into a record, followed by an accessor, is representable over a first-order oracle type (Module.representable_of_firstOrder).

      theorem GaudisCrypt.FVP.fvP_comp_le_of_pure {A B C : Type 1} [IsModule A] [IsModule B] [IsModule C] {f : Module.Arr B C} {g : Module.Arr A B} {F : Footprint VariableAssignment} (hf : fvP f ≤ ⊥) (hg : fvP g ≤ F) :

      f ∘ g touches what g touches when f touches nothing (an accessor).

      The callee of an abstract call acc (Module.app D O) through a module type's accessor acc = C.f … (A(O).a2 for a declared A with several procedures): the accessor's utilities C.f.utilities … and their name. none for a functor into a procedure (Module.app D O itself is the callee).

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        The pieces of an abstract call rule's application that depend on whether the callee is the functor's result (D(O)) or an accessor of it (acc? = some …, accessorOfCall?): the wrapper around the rule, the representability of the functor, and the bound of its footprint by the region kept equal (inner its bound for D itself).

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          After a rule applied through accPieces: the goals that still name the composite (acc ∘ D)(O) (the callee's losslessness, …) name acc (D O) again, as the hypotheses about the declared module do.

          Equations
          Instances For

            The module M of the last statement x <- call M.procedure (e) of s, if it is one.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              The step prhlStmt_seq_call with the callees' judgment inner, on the goal ty split before its last statements. For a procedure of a declared module with several procedures (acc? = some …): with EC's frame — the global variables the postcondition reads that the two callees stay out of (the declared module's restriction, its oracles' code: fp_disjoint) keep their values (prhlStmt_seq_call_frame).

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                The concrete-callee case of equiv_call (_ : ={x₁, …}) with EC's frame, elaborated in Logic/ECCallEquiv.lean (which imports this file): the rule below hands concrete callees to it.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  EC's call (_: ={glob A, x₁, …}): see the module docstring.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    EC's call (_ : true) on a call of an abstract procedure (the adversary): the invariant true, under which the two runs keep the adversary's own state equal — equiv_call (_ : ={glob A}) for the declared module A the calls are of.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For