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