Smoke tests for equiv[ … ] (Syntax/PRHLSyntax.lean).
Equations
- GaudisCrypt.PRHLSyntaxTest.g = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.PRHLSyntaxTest.g" ℕ)
Instances For
Printing: sided reads print as §x{1}/§x{2}, each side with its own vars.
The IsModule T instance: T is a module type, with representation T.typeRep.
It is what lets the name T stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module T.typeRep would do on its own but T, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.PRHLSyntaxTest.instIsModuleT = { moduleTypeRep := GaudisCrypt.PRHLSyntaxTest.T.typeRep, isModule := ⋯ }
What is derivable about the accessor T.f, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
T.f.utilities.accessorModule : T →ₘ …— the accessor as a module, a projection being a module morphism;T.f.utilities.apply_simp—Module.app T.f.utilities.accessorModule m = T.f m: applying that module is the accessor;T.f.utilities.expression_eq— the same at the level of expressions:(T.f m).expression = (T.f.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module type declared by moduletype T, with fields f: the type Module T.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with T.mk, read a single field off one with the accessors T.f, and get the whole record back with T.structure.
Instances For
The field f of a module of type T: the projection onto component 0 of the right-nested tuple T.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
T.f.mk_simp reads this field back off a module built by T.mk; T.f.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named n, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Instances For
Builds a module of type T from the record T.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of T.structure (T.mk_destruct, T.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas T.f.mk_simp.
Equations
- GaudisCrypt.PRHLSyntaxTest.T.mk theRecord✝ = theRecord✝.f
Instances For
@[simp]: T.structure (T.mk r) = r — destructing a module built from a record gives that record back.
The record of a module's fields: T.structure m is T.Structure.mk applied to T.f of m.
Inverse of T.mk (T.mk_destruct, T.destruct_mk).
Instances For
@[simp]: reading the field f back off a module built from a record — T.f (T.mk r) = r.f.
It is what carries the right-hand side of an X.apply_simp (which is an T.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.f.apply_simp.
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 module declared by module M: the record of its procedures 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
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
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
- GaudisCrypt.PRHLSyntaxTest.M.f.procedure = proc (n : ℕ) : ℕ { GaudisCrypt.PRHLSyntaxTest.g <- §n; return §n + 1 }
Instances For
@[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 h 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.h.procedure.apply_simp) rather than run. Use M2.h for this procedure as a module.
Equations
Instances For
proc h of module M2 as a module: Module.proc M2.h.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — M2.h.apply_simp says exactly that.
Equations
Instances For
@[simp]: M2.h = Module.proc M2.h.procedure — true by definition, proc h using no module parameter and so having no holes to fill.
The module declared by module M2: the record of its procedures M2.h.
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.
Instances For
Instantiating the holes of M2.h.procedure with a tuple holeArgs of procedures: the body of proc h 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.h.procedure.apply_simp]).