Documentation

GaudisCrypt.Logic.ReadNormTest

Golden tests of the read normal form and ec_skip (Logic/ReadNorm.lean) #

See Logic/ECAutoTest.lean for the format; scripts/update_golden.py refreshes the expected text.

instance GaudisCrypt.ReadNormTest.instIsGlobalVarIntRnCountMk :
rnCount.IsGlobalVar (VariableName.mk "GaudisCrypt.ReadNormTest.rnCount" ℤ)
Equations
Instances For

    The record of a module's fields: Tick.structure m is Tick.Structure.mk applied to Tick.tick of m.

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

    Equations
    Instances For

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

      Tick.tick.mk_simp reads this field back off a module built by Tick.mk; Tick.tick.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
      • theModule✝.tick = theModule✝
      Instances For
        @[simp]
        theorem GaudisCrypt.ReadNormTest.Tick.destruct_mk (theModule✝ : Tick) :
        mk theModule✝.structure = theModule✝

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

        @[simp]
        theorem GaudisCrypt.ReadNormTest.Tick.tick.mk_simp (theRecord✝ : Structure) :
        (mk theRecord✝).tick = theRecord✝.tick

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

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

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

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

        Instances For
          @[implicit_reducible]

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

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

          Equations

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

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

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

            Tick is by definition Module Tick.typeRep.

            Equations
            Instances For

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

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

              Equations
              Instances For
                @[reducible]

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

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

                Equations
                Instances For
                  @[simp]
                  theorem GaudisCrypt.ReadNormTest.Tick.mk_destruct (theRecord✝ : Structure) :
                  (mk theRecord✝).structure = theRecord✝

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

                  @[simp]

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

                  theorem GaudisCrypt.ReadNormTest.Bound.tick.procedure.apply_simp (holeArgs✝ : HoleSigs.empty.Instantiation) :
                  procedure.instantiate holeArgs✝ = proc (x : ℤ) : ℤ { var y : ℤ; y <- 0; if (decide (§rnCount < 3)) { rnCount <- §rnCount + 1; y <- §x; } return §y }

                  Instantiating the holes of Bound.tick.procedure with a tuple holeArgs of procedures: the body of proc tick 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 [Bound.tick.procedure.apply_simp]).

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

                  Equations
                  Instances For

                    The module declared by module Bound: the record of its procedures Bound.tick.

                    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 Bound.apply_simp to apply it with.

                    Equations
                    Instances For

                      The body of proc tick of module Bound, 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 Bound.tick.procedure.apply_simp) rather than run. Use Bound.tick for this procedure as a module.

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

                        A test in inlined code (if (decide …)) #

                        A test in the code (if (decide …)) #

                        ec_skip on the three judgments #

                        ec_auto, ec_intro #

                        The instance of an if #

                        The names of the values #

                        instance GaudisCrypt.ReadNormTest.instIsGlobalVarIntCMk :
                        RnA.c.IsGlobalVar (VariableName.mk "GaudisCrypt.ReadNormTest.RnA.c" ℤ)
                        Equations
                        Instances For
                          instance GaudisCrypt.ReadNormTest.instIsGlobalVarIntCMk_1 :
                          RnB.c.IsGlobalVar (VariableName.mk "GaudisCrypt.ReadNormTest.RnB.c" ℤ)
                          Equations
                          Instances For
                            instance GaudisCrypt.ReadNormTest.instIsGlobalVarIntCMk_2 :
                            RnC.RnA.c.IsGlobalVar (VariableName.mk "GaudisCrypt.ReadNormTest.RnC.RnA.c" ℤ)
                            Equations
                            Instances For

                              Strictness #