Documentation

GaudisCrypt.Logic.ECProcInv

EasyCrypt's proc (I) on an abstract procedure, and conseq H with EC's frame #

equiv_proc (I)           -- EC's `proc (I)` on `equiv[ A(O₁).f ~ A(O₂).f : P ==> Q ]`
equiv_call (_ : I)       -- EC's `call (_ : I)` on a procedure with a rule (`@[proc_inv]`)
equiv_conseq_frame H     -- EC's `conseq H` on a procedure judgment, with EC's frame
equiv_call (H)           -- EC's `call H`, also where the calls spell the callees differently

equiv_proc (I) #

On a judgment about the same abstract procedure with two oracles, EC's proc (I) keeps the invariant I across it if the oracles do. I is written as for equiv_call (_ : I) (Logic/ECCallUpto.lean): ={glob M, x, …} ∧ J or a relation J between the two memories.

The abstract procedure is either

Goals: the oracles' judgments, EC's ={arg} ∧ I ==> ={res} ∧ I when the oracles' writes keep the region (glob of the modules, read off the goal's precondition), else with the region in them; then pre, EC's two implications (the goal's precondition gives the invariant, the invariant the postcondition), as one statement about no code, unless ec_auto closes it.

The same rules serve EC's call (_ : I) on such a procedure as the last statement: equiv_call (_ : ={glob M, …} ∧ I) (goals: the oracles' judgments, then the code before).

equiv_conseq_frame H #

equiv_conseq H (Logic/ECConseq.lean) asks H's postcondition to imply the goal's. EC's conseq H also knows what the procedures do not write: a variable or a glob the goal's postcondition reads and a procedure stays out of keeps its value. Goals pre (the goal's precondition implies H's) and post: for arguments and globals that satisfy the goal's precondition, results and final globals that satisfy H's postcondition and are in each side's frame satisfy the goal's; an implication that simplification closes is closed. The procedures of the goal are read off their module views first (module_norm), and a procedure named differently from H's is recognised by its body. The rule is prhlProc_conseq_frame.

@[proc_inv]: a rule of equiv_proc (I) for an abstract procedure (see Logic/ECProcInv.lean).

Equations
Instances For
    theorem GaudisCrypt.prhlProc_conseq_frame {sig₁ sig₂ : ProcedureSignature} {M₁ : Module.Proc sig₁} {M₂ : Module.Proc sig₂} {A A' : sig₁.ParamType → VariableAssignment → sig₂.ParamType → VariableAssignment → Prop} {B B' : sig₁.ret → VariableAssignment → sig₂.ret → VariableAssignment → Prop} {Fr₁ Fr₂ : VariableAssignment → VariableAssignment → Prop} (h : prhlProc A' M₁.procedure M₂.procedure B') (hFr₁ : M₁.Frame Fr₁) (hFr₂ : M₂.Frame Fr₂) (hA : ∀ (a₁ : sig₁.ParamType) (g₁ : VariableAssignment) (a₂ : sig₂.ParamType) (g₂ : VariableAssignment), A a₁ g₁ a₂ g₂ → A' a₁ g₁ a₂ g₂) (hB : ∀ (a₁ : sig₁.ParamType) (g₁ : VariableAssignment) (a₂ : sig₂.ParamType) (g₂ : VariableAssignment), A a₁ g₁ a₂ g₂ → ∀ (r₁ : sig₁.ret) (τ₁ : VariableAssignment) (r₂ : sig₂.ret) (τ₂ : VariableAssignment), B' r₁ τ₁ r₂ τ₂ → Fr₁ g₁ τ₁ → Fr₂ g₂ τ₂ → B r₁ τ₁ r₂ τ₂) :

    EC's conseq H on a procedure judgment, with each procedure's frame: the postcondition for the results and final globals h relates that are in each side's frame of the initial globals, under the precondition.

    The global variables (lenses into the globals, the components of a Lens.pair) and the regions (F of F.touched_getter) that the condition e of a procedure judgment reads.

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

      The procedure i (argument 3 or 4) of the goal prhlProc A p₁ p₂ B as q: the same term, or a procedure with the same body (the two unfolded, Flatten.unfoldProcedure: a module behind a record of another port, an alias).

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

        k's result, built with the finite support of the regions Rs in context (fp_finite; a region without it is left out): fp_disjoint takes a variable outside a region's glob from the region's finite support, which it looks for among the hypotheses.

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

            An implication between conditions of procedure judgments, readable: the conditions' local definitions (have params := …) replaced by their values and the reads simplified.

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

              Close g by tac if that closes it (EC's tactics close the goals that are trivial); none then, else the goal as it was.

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

                Close an implication between conditions of procedure judgments by simplification, with what EC takes for granted about globs: states that agree on a region agree on a region inside it (={glob A, glob B} gives ={glob B}). none if closed, else the goal as it was.

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

                  The index of the argument n of a lemma with binder names names.

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

                    The goals StmtWithHoles.WritesKeep F.touched_getter.get o.body of an oracle procedure: split down to its writes, a write to a local or to a global variable outside F (fp_disjoint) closed. Fails if a write is left (an abstract oracle, a write into F).

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

                      An oracle's goal prhlProc (… ∧ globInvF L F I …) o₁ o₂ (… ∧ globInvF L F I …) as EC's ={arg} ∧ I ==> ={res} ∧ I, the region F kept by the oracles' writes (prhlProc_globInvF_of_writesKeep); if they do not keep it syntactically (an abstract oracle), the goal with the region.

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

                        equiv_proc (I) by a rule tagged @[proc_inv], on the judgment about the two call statements (see the module docstring).

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

                          EC's proc (I) on an abstract procedure: see the module docstring. Goals: the oracles' judgments, then pre.

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

                            Do the two sides end with calls of procedures that a rule tagged @[proc_inv] is about (and that are not a declared module applied to its oracles, which equiv_call has rules for)?

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

                              EC's conseq H on a procedure judgment, with EC's frame: see the module docstring. Goals pre, post.

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