Golden tests of equiv_proc (I) and equiv_conseq_frame H #
(Logic/ECProcInv.lean; see Logic/ECAutoTest.lean for the format, scripts/update_golden.py
refreshes the expected text.) Two oracles that count in steps of one and of two, a declared
adversary with one procedure, and a declared functor with two procedures, whose oracle lists are
a hypothesis and whose procedures have a rule tagged @[proc_inv].
Equations
- GaudisCrypt.ECProcInvTest.pCount = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.ECProcInvTest.pCount" ℤ)
Instances For
Equations
- GaudisCrypt.ECProcInvTest.pOther = GaudisCrypt.varLens (GaudisCrypt.VariableName.mk "GaudisCrypt.ECProcInvTest.pOther" ℤ)
Instances For
Builds a module of type Orc from the record Orc.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of Orc.structure (Orc.mk_destruct, Orc.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Orc.get.mk_simp.
Equations
- GaudisCrypt.ECProcInvTest.Orc.mk theRecord✝ = theRecord✝.get
Instances For
@[simp]: reading the field get back off a module built from a record — Orc.get (Orc.mk r) = r.get.
It is what carries the right-hand side of an X.apply_simp (which is an Orc.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.get.apply_simp.
@[simp]: Orc.structure (Orc.mk r) = r — destructing a module built from a record gives that record back.
The record of a module's fields: Orc.structure m is Orc.Structure.mk applied to Orc.get of m.
Inverse of Orc.mk (Orc.mk_destruct, Orc.destruct_mk).
Instances For
The field get of a module of type Orc: the projection onto component 0 of the right-nested tuple Orc.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Orc.get.mk_simp reads this field back off a module built by Orc.mk; Orc.get.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).
Instances For
The module type declared by moduletype Orc, with fields get: the type Module Orc.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with Orc.mk, read a single field off one with the accessors Orc.get, and get the whole record back with Orc.structure.
Instances For
The IsModule Orc instance: Orc is a module type, with representation Orc.typeRep.
It is what lets the name Orc stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Orc.typeRep would do on its own but Orc, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.ECProcInvTest.instIsModuleOrc = { moduleTypeRep := GaudisCrypt.ECProcInvTest.Orc.typeRep, isModule := ⋯ }
The ModuleTypeRep underlying Orc, the module type declared by moduletype Orc: the right-nested product of its 1 field types, in declaration order.
Orc is by definition Module Orc.typeRep.
Instances For
What is derivable about the accessor Orc.get, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Orc.get.utilities.accessorModule : Orc →ₘ …— the accessor as a module, a projection being a module morphism;Orc.get.utilities.apply_simp—Module.app Orc.get.utilities.accessorModule m = Orc.get m: applying that module is the accessor;Orc.get.utilities.expression_eq— the same at the level of expressions:(Orc.get m).expression = (Orc.get.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The field p 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.p.mk_simp reads this field back off a module built by Two.mk; Two.p.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✝.p = GaudisCrypt.Module.fst' theModule✝
Instances For
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
- GaudisCrypt.ECProcInvTest.instIsModuleTwo = { moduleTypeRep := GaudisCrypt.ECProcInvTest.Two.typeRep, isModule := ⋯ }
The module type declared by moduletype Two, with fields p, q: 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.p, Two.q, and get the whole record back with Two.structure.
Instances For
What is derivable about the accessor Two.p, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Two.p.utilities.accessorModule : Two →ₘ …— the accessor as a module, a projection being a module morphism;Two.p.utilities.apply_simp—Module.app Two.p.utilities.accessorModule m = Two.p m: applying that module is the accessor;Two.p.utilities.expression_eq— the same at the level of expressions:(Two.p m).expression = (Two.p.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The record of a module's fields: Two.structure m is Two.Structure.mk applied to Two.p, Two.q of m.
Inverse of Two.mk (Two.mk_destruct, Two.destruct_mk).
Instances For
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.p.mk_simp, Two.q.mk_simp.
Equations
- GaudisCrypt.ECProcInvTest.Two.mk theRecord✝ = GaudisCrypt.Module.pair' theRecord✝.p theRecord✝.q
Instances For
@[simp]: Two.structure (Two.mk r) = r — destructing a module built from a record gives that record back.
@[simp]: reading the field p back off a module built from a record — Two.p (Two.mk r) = r.p.
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.p.apply_simp.
What is derivable about the accessor Two.q, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Two.q.utilities.accessorModule : Two →ₘ …— the accessor as a module, a projection being a module morphism;Two.q.utilities.apply_simp—Module.app Two.q.utilities.accessorModule m = Two.q m: applying that module is the accessor;Two.q.utilities.expression_eq— the same at the level of expressions:(Two.q m).expression = (Two.q.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: reading the field q back off a module built from a record — Two.q (Two.mk r) = r.q.
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.q.apply_simp.
The field q 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.q.mk_simp reads this field back off a module built by Two.mk; Two.q.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✝.q = GaudisCrypt.Module.snd' theModule✝
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
An adversary with oracle access.
Equations
Instances For
A functor with two procedures (a simulator).
Equations
Instances For
The body of proc get of module Inc, 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 Inc.get.procedure.apply_simp) rather than run. Use Inc.get for this procedure as a module.
Equations
- GaudisCrypt.ECProcInvTest.Inc.get.procedure = proc (x : ℤ) : ℤ { GaudisCrypt.ECProcInvTest.pCount <- §GaudisCrypt.ECProcInvTest.pCount + 1; return §x }
Instances For
@[simp]: Inc.get = Module.proc Inc.get.procedure — true by definition, proc get using no module parameter and so having no holes to fill.
Instantiating the holes of Inc.get.procedure with a tuple holeArgs of procedures: the body of proc get 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 [Inc.get.procedure.apply_simp]).
The module declared by module Inc: the record of its procedures Inc.get.
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 Inc.apply_simp to apply it with.
Equations
Instances For
proc get of module Inc as a module: Module.proc Inc.get.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Inc.get.apply_simp says exactly that.
Equations
Instances For
Instantiating the holes of Inc2.get.procedure with a tuple holeArgs of procedures: the body of proc get 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 [Inc2.get.procedure.apply_simp]).
@[simp]: Inc2.get = Module.proc Inc2.get.procedure — true by definition, proc get using no module parameter and so having no holes to fill.
The body of proc get of module Inc2, 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 Inc2.get.procedure.apply_simp) rather than run. Use Inc2.get for this procedure as a module.
Equations
- GaudisCrypt.ECProcInvTest.Inc2.get.procedure = proc (x : ℤ) : ℤ { GaudisCrypt.ECProcInvTest.pCount <- §GaudisCrypt.ECProcInvTest.pCount + 2; return §x }
Instances For
proc get of module Inc2 as a module: Module.proc Inc2.get.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Inc2.get.apply_simp says exactly that.
Equations
Instances For
The module declared by module Inc2: the record of its procedures Inc2.get.
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 Inc2.apply_simp to apply it with.
Equations
Instances For
hoare_call (: P ==> Q) / x #
clear_decl_hyps (what the closers do in front of simp_all) #
equiv_call (H), the callees spelled differently #
equiv_conseq_frame H #
equiv_proc (I) on a declared adversary #
equiv_proc (I) by a rule (@[proc_inv]) #
Equations
Instances For
EC's module type of S lists the oracles of its procedures (proc p(x : int) : int {O.get}):
each procedure of S(O) is code with a hole for O.get.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The abstract call rule for S(O).p (none is given for S(O).q).