Documentation

GaudisCrypt.Logic.GlobWritesTest

Tests of fp_writes (Logic/GlobWrites.lean), and of glob_simp's guard (Logic/ECCallUpto.lean).

Equations
Instances For
    instance GaudisCrypt.GlobWritesTest.instIsGlobalVarNatGwCountMk :
    gwCount.IsGlobalVar (VariableName.mk "GaudisCrypt.GlobWritesTest.gwCount" ℕ)
    instance GaudisCrypt.GlobWritesTest.instIsGlobalVarForallNatBoolGwMapMk :
    gwMap.IsGlobalVar (VariableName.mk "GaudisCrypt.GlobWritesTest.gwMap" (ℕ → Bool))
    Equations
    Instances For
      Equations
      Instances For
        instance GaudisCrypt.GlobWritesTest.instIsGlobalVarNatGwReadMk :
        gwRead.IsGlobalVar (VariableName.mk "GaudisCrypt.GlobWritesTest.gwRead" ℕ)

        The field f of a module of type Two: the projection onto component 1 of the right-nested tuple Two.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].

        Two.f.mk_simp reads this field back off a module built by Two.mk; Two.f.utilities has the accessor as a module, and the lemmas about it.

        Its parameters are named x, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).

        Equations
        Instances For

          The record of a module's fields: Two.structure m is Two.Structure.mk applied to Two.init, Two.f of m.

          Inverse of Two.mk (Two.mk_destruct, Two.destruct_mk).

          Equations
          Instances For

            What is derivable about the accessor Two.init, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):

            • Two.init.utilities.accessorModule : Two →ₘ … — the accessor as a module, a projection being a module morphism;
            • Two.init.utilities.apply_simp — Module.app Two.init.utilities.accessorModule m = Two.init m: applying that module is the accessor;
            • Two.init.utilities.expression_eq — the same at the level of expressions: (Two.init m).expression = (Two.init.utilities.proj m.expression).reduce.
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              The record of the fields of a module of type Two: the fields init, f, one per moduletype field, each of that field's own module type.

              Two.mk turns such a record into a Two, Two.structure turns a Two back into one.

              Instances For
                @[reducible]

                Builds a module of type Two from the record Two.Structure of its fields, as a right-nested Module.pair'. @[reducible].

                Inverse of Two.structure (Two.mk_destruct, Two.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Two.init.mk_simp, Two.f.mk_simp.

                Equations
                Instances For
                  @[simp]
                  theorem GaudisCrypt.GlobWritesTest.Two.init.mk_simp (theRecord✝ : Structure) :
                  (mk theRecord✝).init = theRecord✝.init

                  @[simp]: reading the field init back off a module built from a record — Two.init (Two.mk r) = r.init.

                  It is what carries the right-hand side of an X.apply_simp (which is an Two.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.init.apply_simp.

                  The field init of a module of type Two: the projection onto component 0 of the right-nested tuple Two.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].

                  Two.init.mk_simp reads this field back off a module built by Two.mk; Two.init.utilities has the accessor as a module, and the lemmas about it.

                  It takes no parameters (recorded in @[gaudiProcParamNames]).

                  Equations
                  Instances For
                    @[simp]
                    theorem GaudisCrypt.GlobWritesTest.Two.destruct_mk (theModule✝ : Two) :
                    mk theModule✝.structure = theModule✝

                    @[simp]: Two.mk (Two.structure m) = m — rebuilding a module from its own fields gives that module back.

                    @[simp]
                    theorem GaudisCrypt.GlobWritesTest.Two.mk_destruct (theRecord✝ : Structure) :
                    (mk theRecord✝).structure = theRecord✝

                    @[simp]: Two.structure (Two.mk r) = r — destructing a module built from a record gives that record back.

                    @[simp]
                    theorem GaudisCrypt.GlobWritesTest.Two.f.mk_simp (theRecord✝ : Structure) :
                    (mk theRecord✝).f = theRecord✝.f

                    @[simp]: reading the field f back off a module built from a record — Two.f (Two.mk r) = r.f.

                    It is what carries the right-hand side of an X.apply_simp (which is an Two.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.f.apply_simp.

                    @[implicit_reducible]

                    The IsModule Two instance: Two is a module type, with representation Two.typeRep.

                    It is what lets the name Two stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Two.typeRep would do on its own but Two, a plain (non-reducible) def, would not.

                    Equations

                    The module type declared by moduletype Two, with fields init, f: the type Module Two.typeRep of modules that are a right-nested tuple of the field types.

                    Build one from a record of its fields with Two.mk, read a single field off one with the accessors Two.init, Two.f, and get the whole record back with Two.structure.

                    Equations
                    Instances For

                      What is derivable about the accessor Two.f, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):

                      • Two.f.utilities.accessorModule : Two →ₘ … — the accessor as a module, a projection being a module morphism;
                      • Two.f.utilities.apply_simp — Module.app Two.f.utilities.accessorModule m = Two.f m: applying that module is the accessor;
                      • Two.f.utilities.expression_eq — the same at the level of expressions: (Two.f m).expression = (Two.f.utilities.proj m.expression).reduce.
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        The ModuleTypeRep underlying Two, the module type declared by moduletype Two: the right-nested product of its 2 field types, in declaration order.

                        Two is by definition Module Two.typeRep.

                        Equations
                        Instances For
                          @[simp]

                          @[simp]: Fill.fill = Module.proc Fill.fill.procedure — true by definition, proc fill using no module parameter and so having no holes to fill.

                          Instantiating the holes of Fill.fill.procedure with a tuple holeArgs of procedures: the body of proc fill as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

                          Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [Fill.fill.procedure.apply_simp]).

                          The module declared by module Fill: the record of its procedures Fill.fill.

                          The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no Fill.apply_simp to apply it with.

                          Equations
                          Instances For

                            The body of proc fill of module Fill, as a procedure of its own: it calls no module parameter, so it has no holes.

                            A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see Fill.fill.procedure.apply_simp) rather than run. Use Fill.fill for this procedure as a module.

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

                              proc fill of module Fill as a module: Module.proc Fill.fill.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Fill.fill.apply_simp says exactly that.

                              Equations
                              Instances For

                                proc init of module M as a module: Module.proc M.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — M.init.apply_simp says exactly that.

                                Equations
                                Instances For

                                  proc f of module M as a module: Module.proc M.f.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — M.f.apply_simp says exactly that.

                                  Equations
                                  Instances For
                                    @[simp]

                                    @[simp]: M.init = Module.proc M.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.

                                    theorem GaudisCrypt.GlobWritesTest.M.f.procedure.apply_simp (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                    procedure.instantiate holeArgs✝ = proc (x : ℕ) : Bool { var y : Bool; if (decide (§x < §gwRead)) { y <- call Fill.fill.procedure (§x); } return §y }

                                    Instantiating the holes of M.f.procedure with a tuple holeArgs of procedures: the body of proc f as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

                                    Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [M.f.procedure.apply_simp]).

                                    The body of proc init of module M, as a procedure of its own: it calls no module parameter, so it has no holes.

                                    A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see M.init.procedure.apply_simp) rather than run. Use M.init for this procedure as a module.

                                    Equations
                                    Instances For

                                      The body of proc f of module M, as a procedure of its own: it calls no module parameter, so it has no holes.

                                      A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see M.f.procedure.apply_simp) rather than run. Use M.f for this procedure as a module.

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

                                        The module declared by module M: the record of its procedures M.init, M.f.

                                        The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no M.apply_simp to apply it with.

                                        Equations
                                        Instances For

                                          Instantiating the holes of M.init.procedure with a tuple holeArgs of procedures: the body of proc init as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

                                          Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [M.init.procedure.apply_simp]).

                                          @[simp]

                                          @[simp]: M.f = Module.proc M.f.procedure — true by definition, proc f using no module parameter and so having no holes to fill.

                                          The body of proc f of module M2, as a procedure of its own: it calls no module parameter, so it has no holes.

                                          A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see M2.f.procedure.apply_simp) rather than run. Use M2.f for this procedure as a module.

                                          Equations
                                          Instances For

                                            The body of proc init of module M2, as a procedure of its own: it calls no module parameter, so it has no holes.

                                            A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see M2.init.procedure.apply_simp) rather than run. Use M2.init for this procedure as a module.

                                            Equations
                                            Instances For

                                              proc f of module M2 as a module: Module.proc M2.f.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — M2.f.apply_simp says exactly that.

                                              Equations
                                              Instances For
                                                @[simp]

                                                @[simp]: M2.init = Module.proc M2.init.procedure — true by definition, proc init using no module parameter and so having no holes to fill.

                                                theorem GaudisCrypt.GlobWritesTest.M2.f.procedure.apply_simp (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                                procedure.instantiate holeArgs✝ = proc (x : ℕ) : Bool { var y : Bool; y <- call Fill.fill.procedure (§x); return §y }

                                                Instantiating the holes of M2.f.procedure with a tuple holeArgs of procedures: the body of proc f as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

                                                Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [M2.f.procedure.apply_simp]).

                                                The module declared by module M2: the record of its procedures M2.init, M2.f.

                                                The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no M2.apply_simp to apply it with.

                                                Equations
                                                Instances For

                                                  proc init of module M2 as a module: Module.proc M2.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — M2.init.apply_simp says exactly that.

                                                  Equations
                                                  Instances For

                                                    Instantiating the holes of M2.init.procedure with a tuple holeArgs of procedures: the body of proc init as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

                                                    Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [M2.init.procedure.apply_simp]).

                                                    @[simp]

                                                    @[simp]: M2.f = Module.proc M2.f.procedure — true by definition, proc f using no module parameter and so having no holes to fill.

                                                    glob_simp and its guard glob_set_present #

                                                    instance GaudisCrypt.GlobWritesTest.instIsGlobalVarNatGwOtherMk :
                                                    gwOther.IsGlobalVar (VariableName.mk "GaudisCrypt.GlobWritesTest.gwOther" ℕ)
                                                    Equations
                                                    Instances For

                                                      A bound fp_module cannot prove is no bound #

                                                      Wrap(M), a functor applied to a concrete module, is bounded by FVP.fvP M; fp_module, meeting M's variables in the code, cannot show it. The footprint read off the code is then none (not a sorry, cached, with an error logged in the caller's proof), and fp_disjoint fails.

                                                      The body of proc g of module Wrap, as a procedure of its own: it calls no module parameter, so it has no holes.

                                                      A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see Wrap.g.procedure.apply_simp) rather than run. Use Wrap.g for this procedure as a module.

                                                      Equations
                                                      Instances For

                                                        The module declared by module Wrap: the record of its procedures Wrap.g.

                                                        The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no Wrap.apply_simp to apply it with.

                                                        Equations
                                                        Instances For

                                                          proc g of module Wrap as a module: Module.proc Wrap.g.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Wrap.g.apply_simp says exactly that.

                                                          Equations
                                                          Instances For
                                                            @[simp]

                                                            @[simp]: Wrap.g = Module.proc Wrap.g.procedure — true by definition, proc g using no module parameter and so having no holes to fill.

                                                            theorem GaudisCrypt.GlobWritesTest.Wrap.g.procedure.apply_simp (P : Two) (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                                            (procedure P).instantiate holeArgs✝ = proc (x : ℕ) : Bool { var r : Bool; r <- call P.f.procedure (§x); return §r }

                                                            Instantiating the holes of Wrap.g.procedure with a tuple holeArgs of procedures: the body of proc g as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

                                                            Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [Wrap.g.procedure.apply_simp]).

                                                            A module of procedure aliases #

                                                            proc f = c; makes f the procedure c: Al's procedures are M.init and Fill.fill, with no .procedure of their own. The footprint is read off them all the same.

                                                            The module declared by module Al: the record of its procedures Al.init, Al.f.

                                                            The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no Al.apply_simp to apply it with.

                                                            Equations
                                                            Instances For

                                                              proc f = …; of module Al: an alias, EasyCrypt's proc f = M.g. Its callee mentions no module parameter, so Al.f is the callee itself.

                                                              Equations
                                                              Instances For
                                                                @[simp]

                                                                @[simp]: the alias Al.init is its callee, as written in the declaration.

                                                                @[simp]

                                                                @[simp]: the alias Al.f is its callee, as written in the declaration.

                                                                proc init = …; of module Al: an alias, EasyCrypt's proc init = M.g. Its callee mentions no module parameter, so Al.init is the callee itself.

                                                                Equations
                                                                Instances For

                                                                  A concrete module met twice inside another (M in both aliases of AlM): fp_module bounds it by its own bound (read off its code once, cached) instead of reading its code at each occurrence.

                                                                  proc init = …; of module AlM: an alias, EasyCrypt's proc init = M.g. Its callee mentions no module parameter, so AlM.init is the callee itself.

                                                                  Equations
                                                                  Instances For

                                                                    The module declared by module AlM: the record of its procedures AlM.init, AlM.f.

                                                                    The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no AlM.apply_simp to apply it with.

                                                                    Equations
                                                                    Instances For

                                                                      proc f = …; of module AlM: an alias, EasyCrypt's proc f = M.g. Its callee mentions no module parameter, so AlM.f is the callee itself.

                                                                      Equations
                                                                      Instances For
                                                                        @[simp]

                                                                        @[simp]: the alias AlM.f is its callee, as written in the declaration.

                                                                        @[simp]

                                                                        @[simp]: the alias AlM.init is its callee, as written in the declaration.