Documentation

GaudisCrypt.Logic.StmtSwapTest

Tests of stmt_swap and stmt_split_pair (Logic/StmtSwap.lean).

@[reducible, inline]

A clone's op given as a function (op dout _ <- d, an abbreviation): the sampling b <$ dout §x does not read x, and moves past x's assignment.

Equations
Instances For
    instance GaudisCrypt.StmtSwapTest.instIsGlobalVarNatSwapTestCountMk :
    swapTestCount.IsGlobalVar (VariableName.mk "GaudisCrypt.StmtSwapTest.swapTestCount" ℕ)
    Equations
    Instances For
      @[simp]
      theorem GaudisCrypt.StmtSwapTest.Init.init.mk_simp (theRecord✝ : Structure) :
      (mk theRecord✝).init = theRecord✝.init

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

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

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

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

      @[reducible]

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

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

      Equations
      Instances For

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

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

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

          Init is by definition Module Init.typeRep.

          Equations
          Instances For

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

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

            Instances For

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

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

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

              Equations
              • theModule✝.init = theModule✝
              Instances For

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

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

                Equations
                Instances For

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

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

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

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

                    @[implicit_reducible]

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

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

                    Equations
                    Equations
                    Instances For
                      instance GaudisCrypt.StmtSwapTest.instIsGlobalVarBoolSwapTestFlagMk :
                      swapTestFlag.IsGlobalVar (VariableName.mk "GaudisCrypt.StmtSwapTest.swapTestFlag" Bool)