The discrete logarithm assumption (EasyCrypt theories/crypto/DLog.ec) #
The theory DLog over a cyclic group of prime order (Lib/EC/Group.lean: EC's
clone Group.CyclicGroup as G, clone G.PowZMod as GP, clone GP.FDistr as FD at the head of
the file): the standard experiment, the one whose adversary may fail, and the reduction of the
second to the first (StdRedAdversary, dlog_standard_reduction).
theory DLog #
The field guess of a module of type StdAdversary: the projection onto component 0 of the right-nested tuple StdAdversary.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
StdAdversary.guess.mk_simp reads this field back off a module built by StdAdversary.mk; StdAdversary.guess.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named h, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Instances For
@[simp]: StdAdversary.mk (StdAdversary.structure m) = m — rebuilding a module from its own fields gives that module back.
@[simp]: reading the field guess back off a module built from a record — StdAdversary.guess (StdAdversary.mk r) = r.guess.
It is what carries the right-hand side of an X.apply_simp (which is an StdAdversary.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.guess.apply_simp.
The record of a module's fields: StdAdversary.structure m is StdAdversary.Structure.mk applied to StdAdversary.guess of m.
Inverse of StdAdversary.mk (StdAdversary.mk_destruct, StdAdversary.destruct_mk).
Instances For
The record of the fields of a module of type StdAdversary: the fields guess, one per moduletype field, each of that field's own module type.
StdAdversary.mk turns such a record into a StdAdversary, StdAdversary.structure turns a StdAdversary back into one.
Instances For
The IsModule StdAdversary instance: StdAdversary is a module type, with representation StdAdversary.typeRep.
It is what lets the name StdAdversary stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module StdAdversary.typeRep would do on its own but StdAdversary, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.EC.DLog.DLog.instIsModuleStdAdversary = { moduleTypeRep := GaudisCrypt.EC.DLog.DLog.StdAdversary.typeRep, isModule := ⋯ }
What is derivable about the accessor StdAdversary.guess, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
StdAdversary.guess.utilities.accessorModule : StdAdversary →ₘ …— the accessor as a module, a projection being a module morphism;StdAdversary.guess.utilities.apply_simp—Module.app StdAdversary.guess.utilities.accessorModule m = StdAdversary.guess m: applying that module is the accessor;StdAdversary.guess.utilities.expression_eq— the same at the level of expressions:(StdAdversary.guess m).expression = (StdAdversary.guess.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 StdAdversary, with fields guess: the type Module StdAdversary.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with StdAdversary.mk, read a single field off one with the accessors StdAdversary.guess, and get the whole record back with StdAdversary.structure.
Equations
Instances For
The ModuleTypeRep underlying StdAdversary, the module type declared by moduletype StdAdversary: the right-nested product of its 1 field types, in declaration order.
StdAdversary is by definition Module StdAdversary.typeRep.
Equations
Instances For
Builds a module of type StdAdversary from the record StdAdversary.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of StdAdversary.structure (StdAdversary.mk_destruct, StdAdversary.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas StdAdversary.guess.mk_simp.
Equations
- GaudisCrypt.EC.DLog.DLog.StdAdversary.mk theRecord✝ = theRecord✝.guess
Instances For
@[simp]: StdAdversary.structure (StdAdversary.mk r) = r — destructing a module built from a record gives that record back.
@[simp]: applying DLogStdExperiment.main to the parameters proc main uses (A) is Module.proc (DLogStdExperiment.main.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
@[simp]: applying DLogStdExperiment to a tuple of its single parameter A — the record of its procedures DLogStdExperiment.main, each applied to the parameters it uses.
This is the lemma that unfolds a module use: simp rewrites with it, then with the field lemmas of the module type (N.f.mk_simp) to get at the one procedure the goal is about, and then with DLogStdExperiment.main.apply_simp to fill that procedure's holes.
The body of proc main of module DLogStdExperiment, as a procedure of its own: the one call it makes to a module parameter (A) is its single hole.
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 DLogStdExperiment.main.procedure.apply_simp) rather than run. Use DLogStdExperiment.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of DLogStdExperiment.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [DLogStdExperiment.main.procedure.apply_simp]).
proc main of module DLogStdExperiment as a module, abstracted over the module parameters it uses (A, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma DLogStdExperiment.main.apply_simp, which fills the holes of DLogStdExperiment.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module DLogStdExperiment, abstracted over its single parameter A, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the anonymous product of the procedures' own types, the declaration naming no module type.
Applied to such a tuple it is the record of its procedures DLogStdExperiment.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DLogStdExperiment.apply_simp says.
Equations
Instances For
@[simp]: Adversary.structure (Adversary.mk r) = r — destructing a module built from a record gives that record back.
Builds a module of type Adversary from the record Adversary.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of Adversary.structure (Adversary.mk_destruct, Adversary.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Adversary.guess.mk_simp.
Equations
- GaudisCrypt.EC.DLog.DLog.Adversary.mk theRecord✝ = theRecord✝.guess
Instances For
The record of a module's fields: Adversary.structure m is Adversary.Structure.mk applied to Adversary.guess of m.
Inverse of Adversary.mk (Adversary.mk_destruct, Adversary.destruct_mk).
Instances For
The IsModule Adversary instance: Adversary is a module type, with representation Adversary.typeRep.
It is what lets the name Adversary stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Adversary.typeRep would do on its own but Adversary, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.EC.DLog.DLog.instIsModuleAdversary = { moduleTypeRep := GaudisCrypt.EC.DLog.DLog.Adversary.typeRep, isModule := ⋯ }
The ModuleTypeRep underlying Adversary, the module type declared by moduletype Adversary: the right-nested product of its 1 field types, in declaration order.
Adversary is by definition Module Adversary.typeRep.
Equations
Instances For
@[simp]: Adversary.mk (Adversary.structure m) = m — rebuilding a module from its own fields gives that module back.
What is derivable about the accessor Adversary.guess, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Adversary.guess.utilities.accessorModule : Adversary →ₘ …— the accessor as a module, a projection being a module morphism;Adversary.guess.utilities.apply_simp—Module.app Adversary.guess.utilities.accessorModule m = Adversary.guess m: applying that module is the accessor;Adversary.guess.utilities.expression_eq— the same at the level of expressions:(Adversary.guess m).expression = (Adversary.guess.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The field guess of a module of type Adversary: the projection onto component 0 of the right-nested tuple Adversary.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Adversary.guess.mk_simp reads this field back off a module built by Adversary.mk; Adversary.guess.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named h, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Instances For
@[simp]: reading the field guess back off a module built from a record — Adversary.guess (Adversary.mk r) = r.guess.
It is what carries the right-hand side of an X.apply_simp (which is an Adversary.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.guess.apply_simp.
The record of the fields of a module of type Adversary: the fields guess, one per moduletype field, each of that field's own module type.
Adversary.mk turns such a record into a Adversary, Adversary.structure turns a Adversary back into one.
Instances For
The module type declared by moduletype Adversary, with fields guess: the type Module Adversary.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with Adversary.mk, read a single field off one with the accessors Adversary.guess, and get the whole record back with Adversary.structure.
Equations
Instances For
The body of proc main of module DLogExperiment, as a procedure of its own: the one call it makes to a module parameter (A) is its single hole.
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 DLogExperiment.main.procedure.apply_simp) rather than run. Use DLogExperiment.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DLogExperiment to a tuple of its single parameter A — the record of its procedures DLogExperiment.main, each applied to the parameters it uses.
This is the lemma that unfolds a module use: simp rewrites with it, then with the field lemmas of the module type (N.f.mk_simp) to get at the one procedure the goal is about, and then with DLogExperiment.main.apply_simp to fill that procedure's holes.
Instantiating the holes of DLogExperiment.main.procedure with a tuple holeArgs of procedures: the body of proc main 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 [DLogExperiment.main.procedure.apply_simp]).
proc main of module DLogExperiment as a module, abstracted over the module parameters it uses (A, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma DLogExperiment.main.apply_simp, which fills the holes of DLogExperiment.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying DLogExperiment.main to the parameters proc main uses (A) is Module.proc (DLogExperiment.main.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
The module declared by module DLogExperiment, abstracted over its single parameter A, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the anonymous product of the procedures' own types, the declaration naming no module type.
Applied to such a tuple it is the record of its procedures DLogExperiment.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DLogExperiment.apply_simp says.
Equations
Instances For
Reduction of the experiment admitting failure to the standard one #
@[simp]: applying StdRedAdversary to a tuple of its single parameter L — the record of its procedures StdRedAdversary.guess, each applied to the parameters it uses.
This is the lemma that unfolds a module use: simp rewrites with it, then with the field lemmas of the module type (N.f.mk_simp) to get at the one procedure the goal is about, and then with StdRedAdversary.guess.apply_simp to fill that procedure's holes.
The body of proc guess of module StdRedAdversary, as a procedure of its own: the one call it makes to a module parameter (L) is its single hole.
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 StdRedAdversary.guess.procedure.apply_simp) rather than run. Use StdRedAdversary.guess for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The module declared by module StdRedAdversary, abstracted over its single parameter L, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the anonymous product of the procedures' own types, the declaration naming no module type.
Applied to such a tuple it is the record of its procedures StdRedAdversary.guess, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma StdRedAdversary.apply_simp says.
Equations
Instances For
Instantiating the holes of StdRedAdversary.guess.procedure with a tuple holeArgs of procedures: the body of proc guess 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 [StdRedAdversary.guess.procedure.apply_simp]).
@[simp]: applying StdRedAdversary.guess to the parameters proc guess uses (L) is Module.proc (StdRedAdversary.guess.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.
proc guess of module StdRedAdversary as a module, abstracted over the module parameters it uses (L, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma StdRedAdversary.guess.apply_simp, which fills the holes of StdRedAdversary.guess.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.