Documentation

GaudisCrypt.Syntax.Clone

EasyCrypt's clone #

clone import GaudisCrypt.SHA3.SecureRO as SRO with
  type «from» <- f_in, type «to» <- f_out,
  op bound <- limit, op sampleto <- sampleto
  proof * by first | exact limit_gt0 | exact sampleto_ll

An abstract theory T is a namespace whose declarations take the theory's types as implicit section variables and its operators and axioms as one instance [T.Params …] (a class whose types are outParams, so that inside the theory nothing is written). A clone is then:

The clone's instance is an instance: the theory's own instances (the coercions of EC's subtyping of module types, module_subtype) take the theory's, and are then found at the clone. Used through its namespace, each clone is its own: the aliases name the instance. Found by instance search, clones of one theory compete, even at different types: the theory's types are outParams, which Lean erases before the search, so the search answers with the latest clone's instance and fails at another clone's types. So where two clones of one theory meet in a file, what finds the instance by search works for the latest clone only: record notation for a module type's mk (C.FUNCTIONALITY.mk { f := … }), the subtyping coercions, a theory lemma used without its clone's alias. (SHA-3's Gconcl_list has SLCommon's and BlockSponge's clones of Indifferentiability; EC has many such files. Not yet solved: notes/SHA3/TacticReview.md.) Two clones of one theory at the same types with different operators are not supported either (EC's SRO and a second SRO' at the same types).

The clone's module variables are the theory's (global_var/module_var slots are named after T): two clones of one theory at the same types share them, where EC gives each clone its own.

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

        EasyCrypt's clone [import] T as C with type a <- τ, op o <- e proof * by tac: see the module docstring.

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

          Declarations of the theory that are not aliased: internal ones, the generated equations and auxiliary recursors, Lean's reserved names (T.x.congr_simp, T.x.eq_def, …: Lean makes them on demand for the alias C.x itself; a copy, a statement about T.x, would be found in their place, and simp panics on a congr_simp it did not make), instances, and inductive types with their constructors and recursors (an alias of a structure would not have its constructor notation).

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

            The application of c at the clone: its leading theory binders filled (the types by name, the theory's instance by params, other instances by instance search), the rest kept.

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

              The free variables e depends on, closed under the types of those variables.

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