Commitment schemes (EasyCrypt theories/crypto/Commitment.ec) #
EC's theory CommitmentProtocol: the module type of a commitment scheme and the experiments for
correctness, hiding and binding. The theory's types are outParams of the (field-less) class
Params: a clone is clone import GaudisCrypt.EC.CommitmentProtocol as CM with type value <- ….
EC's type value, message, commitment, openingkey.
Instances
@[simp]: CommitmentScheme.mk (CommitmentScheme.structure m) = m — rebuilding a module from its own fields gives that module back.
What is derivable about the accessor CommitmentScheme.verify, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
CommitmentScheme.verify.utilities.accessorModule : CommitmentScheme →ₘ …— the accessor as a module, a projection being a module morphism;CommitmentScheme.verify.utilities.apply_simp—Module.app CommitmentScheme.verify.utilities.accessorModule m = CommitmentScheme.verify m: applying that module is the accessor;CommitmentScheme.verify.utilities.expression_eq— the same at the level of expressions:(CommitmentScheme.verify m).expression = (CommitmentScheme.verify.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: reading the field commit back off a module built from a record — CommitmentScheme.commit (CommitmentScheme.mk r) = r.commit.
It is what carries the right-hand side of an X.apply_simp (which is an CommitmentScheme.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.commit.apply_simp.
@[simp]: reading the field verify back off a module built from a record — CommitmentScheme.verify (CommitmentScheme.mk r) = r.verify.
It is what carries the right-hand side of an X.apply_simp (which is an CommitmentScheme.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.verify.apply_simp.
The record of a module's fields: CommitmentScheme.structure m is CommitmentScheme.Structure.mk applied to CommitmentScheme.gen, CommitmentScheme.commit, CommitmentScheme.verify of m.
Inverse of CommitmentScheme.mk (CommitmentScheme.mk_destruct, CommitmentScheme.destruct_mk).
Equations
Instances For
Builds a module of type CommitmentScheme from the record CommitmentScheme.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of CommitmentScheme.structure (CommitmentScheme.mk_destruct, CommitmentScheme.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas CommitmentScheme.gen.mk_simp, CommitmentScheme.commit.mk_simp, CommitmentScheme.verify.mk_simp.
Equations
- GaudisCrypt.EC.CommitmentProtocol.CommitmentScheme.mk theRecord✝ = GaudisCrypt.Module.pair' theRecord✝.gen (GaudisCrypt.Module.pair' theRecord✝.commit theRecord✝.verify)
Instances For
@[simp]: CommitmentScheme.structure (CommitmentScheme.mk r) = r — destructing a module built from a record gives that record back.
The field commit of a module of type CommitmentScheme: the projection onto component 1 of the right-nested tuple CommitmentScheme.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
CommitmentScheme.commit.mk_simp reads this field back off a module built by CommitmentScheme.mk; CommitmentScheme.commit.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named x, m, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Equations
- theModule✝.commit = (GaudisCrypt.Module.snd' theModule✝).fst'
Instances For
The module type declared by moduletype CommitmentScheme, with fields gen, commit, verify: the type Module CommitmentScheme.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with CommitmentScheme.mk, read a single field off one with the accessors CommitmentScheme.gen, CommitmentScheme.commit, CommitmentScheme.verify, and get the whole record back with CommitmentScheme.structure.
Equations
Instances For
The field verify of a module of type CommitmentScheme: the projection onto component 2 of the right-nested tuple CommitmentScheme.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
CommitmentScheme.verify.mk_simp reads this field back off a module built by CommitmentScheme.mk; CommitmentScheme.verify.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named x, m, c, d, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Equations
- theModule✝.verify = (GaudisCrypt.Module.snd' theModule✝).snd'
Instances For
The field gen of a module of type CommitmentScheme: the projection onto component 0 of the right-nested tuple CommitmentScheme.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
CommitmentScheme.gen.mk_simp reads this field back off a module built by CommitmentScheme.mk; CommitmentScheme.gen.utilities has the accessor as a module, and the lemmas about it.
It takes no parameters (recorded in @[gaudiProcParamNames]).
Equations
- theModule✝.gen = GaudisCrypt.Module.fst' theModule✝
Instances For
The ModuleTypeRep underlying CommitmentScheme, the module type declared by moduletype CommitmentScheme: the right-nested product of its 3 field types, in declaration order.
CommitmentScheme is by definition Module CommitmentScheme.typeRep.
Equations
- One or more equations did not get rendered due to their size.
Instances For
What is derivable about the accessor CommitmentScheme.commit, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
CommitmentScheme.commit.utilities.accessorModule : CommitmentScheme →ₘ …— the accessor as a module, a projection being a module morphism;CommitmentScheme.commit.utilities.apply_simp—Module.app CommitmentScheme.commit.utilities.accessorModule m = CommitmentScheme.commit m: applying that module is the accessor;CommitmentScheme.commit.utilities.expression_eq— the same at the level of expressions:(CommitmentScheme.commit m).expression = (CommitmentScheme.commit.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: reading the field gen back off a module built from a record — CommitmentScheme.gen (CommitmentScheme.mk r) = r.gen.
It is what carries the right-hand side of an X.apply_simp (which is an CommitmentScheme.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.gen.apply_simp.
The record of the fields of a module of type CommitmentScheme: the fields gen, commit, verify, one per moduletype field, each of that field's own module type.
CommitmentScheme.mk turns such a record into a CommitmentScheme, CommitmentScheme.structure turns a CommitmentScheme back into one.
Instances For
What is derivable about the accessor CommitmentScheme.gen, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
CommitmentScheme.gen.utilities.accessorModule : CommitmentScheme →ₘ …— the accessor as a module, a projection being a module morphism;CommitmentScheme.gen.utilities.apply_simp—Module.app CommitmentScheme.gen.utilities.accessorModule m = CommitmentScheme.gen m: applying that module is the accessor;CommitmentScheme.gen.utilities.expression_eq— the same at the level of expressions:(CommitmentScheme.gen m).expression = (CommitmentScheme.gen.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The IsModule CommitmentScheme instance: CommitmentScheme is a module type, with representation CommitmentScheme.typeRep.
It is what lets the name CommitmentScheme stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module CommitmentScheme.typeRep would do on its own but CommitmentScheme, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.EC.CommitmentProtocol.instIsModuleCommitmentScheme = { moduleTypeRep := GaudisCrypt.EC.CommitmentProtocol.CommitmentScheme.typeRep, isModule := ⋯ }
Instantiating the holes of Correctness.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 [Correctness.main.procedure.apply_simp]).
@[simp]: applying Correctness to a tuple of its single parameter S — the record of its procedures Correctness.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 Correctness.main.apply_simp to fill that procedure's holes.
@[simp]: applying Correctness.main to the parameters proc main uses (S) is Module.proc (Correctness.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 Correctness, abstracted over its single parameter S, 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 Correctness.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Correctness.apply_simp says.
Equations
Instances For
proc main of module Correctness as a module, abstracted over the module parameters it uses (S, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma Correctness.main.apply_simp, which fills the holes of Correctness.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc main of module Correctness, as a procedure of its own: the 3 calls it makes to module parameters (S) are its holes, in the order the body makes them.
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 Correctness.main.procedure.apply_simp) rather than run. Use Correctness.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The ModuleTypeRep underlying Unhider, the module type declared by moduletype Unhider: the right-nested product of its 2 field types, in declaration order.
Unhider is by definition Module Unhider.typeRep.
Equations
Instances For
The IsModule Unhider instance: Unhider is a module type, with representation Unhider.typeRep.
It is what lets the name Unhider stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Unhider.typeRep would do on its own but Unhider, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.EC.CommitmentProtocol.instIsModuleUnhider = { moduleTypeRep := GaudisCrypt.EC.CommitmentProtocol.Unhider.typeRep, isModule := ⋯ }
The record of a module's fields: Unhider.structure m is Unhider.Structure.mk applied to Unhider.choose, Unhider.guess of m.
Inverse of Unhider.mk (Unhider.mk_destruct, Unhider.destruct_mk).
Instances For
What is derivable about the accessor Unhider.choose, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Unhider.choose.utilities.accessorModule : Unhider →ₘ …— the accessor as a module, a projection being a module morphism;Unhider.choose.utilities.apply_simp—Module.app Unhider.choose.utilities.accessorModule m = Unhider.choose m: applying that module is the accessor;Unhider.choose.utilities.expression_eq— the same at the level of expressions:(Unhider.choose m).expression = (Unhider.choose.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The field choose of a module of type Unhider: the projection onto component 0 of the right-nested tuple Unhider.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Unhider.choose.mk_simp reads this field back off a module built by Unhider.mk; Unhider.choose.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✝.choose = GaudisCrypt.Module.fst' theModule✝
Instances For
@[simp]: Unhider.mk (Unhider.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 — Unhider.guess (Unhider.mk r) = r.guess.
It is what carries the right-hand side of an X.apply_simp (which is an Unhider.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.guess.apply_simp.
@[simp]: reading the field choose back off a module built from a record — Unhider.choose (Unhider.mk r) = r.choose.
It is what carries the right-hand side of an X.apply_simp (which is an Unhider.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.choose.apply_simp.
@[simp]: Unhider.structure (Unhider.mk r) = r — destructing a module built from a record gives that record back.
Builds a module of type Unhider from the record Unhider.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of Unhider.structure (Unhider.mk_destruct, Unhider.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Unhider.choose.mk_simp, Unhider.guess.mk_simp.
Equations
- GaudisCrypt.EC.CommitmentProtocol.Unhider.mk theRecord✝ = GaudisCrypt.Module.pair' theRecord✝.choose theRecord✝.guess
Instances For
What is derivable about the accessor Unhider.guess, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Unhider.guess.utilities.accessorModule : Unhider →ₘ …— the accessor as a module, a projection being a module morphism;Unhider.guess.utilities.apply_simp—Module.app Unhider.guess.utilities.accessorModule m = Unhider.guess m: applying that module is the accessor;Unhider.guess.utilities.expression_eq— the same at the level of expressions:(Unhider.guess m).expression = (Unhider.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 Unhider: the projection onto component 1 of the right-nested tuple Unhider.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Unhider.guess.mk_simp reads this field back off a module built by Unhider.mk; Unhider.guess.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named c, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Equations
- theModule✝.guess = GaudisCrypt.Module.snd' theModule✝
Instances For
The module type declared by moduletype Unhider, with fields choose, guess: the type Module Unhider.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with Unhider.mk, read a single field off one with the accessors Unhider.choose, Unhider.guess, and get the whole record back with Unhider.structure.
Equations
Instances For
The record of the fields of a module of type Unhider: the fields choose, guess, one per moduletype field, each of that field's own module type.
Unhider.mk turns such a record into a Unhider, Unhider.structure turns a Unhider back into one.
Instances For
The module declared by module HidingExperiment, abstracted over its 2 parameters S, U, 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 HidingExperiment.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma HidingExperiment.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instantiating the holes of HidingExperiment.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 [HidingExperiment.main.procedure.apply_simp]).
@[simp]: applying HidingExperiment.main to the parameters proc main uses (S, U) is Module.proc (HidingExperiment.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 HidingExperiment to a tuple of its 2 parameters S, U — the record of its procedures HidingExperiment.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 HidingExperiment.main.apply_simp to fill that procedure's holes.
The body of proc main of module HidingExperiment, as a procedure of its own: the 4 calls it makes to module parameters (S, U) are its holes, in the order the body makes them.
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 HidingExperiment.main.procedure.apply_simp) rather than run. Use HidingExperiment.main for this procedure as a module.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc main of module HidingExperiment as a module, abstracted over the module parameters it uses (S, U, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma HidingExperiment.main.apply_simp, which fills the holes of HidingExperiment.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: Binder.structure (Binder.mk r) = r — destructing a module built from a record gives that record back.
@[simp]: reading the field bind back off a module built from a record — Binder.bind (Binder.mk r) = r.bind.
It is what carries the right-hand side of an X.apply_simp (which is an Binder.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.bind.apply_simp.
The record of a module's fields: Binder.structure m is Binder.Structure.mk applied to Binder.bind of m.
Inverse of Binder.mk (Binder.mk_destruct, Binder.destruct_mk).
Instances For
Builds a module of type Binder from the record Binder.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of Binder.structure (Binder.mk_destruct, Binder.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Binder.bind.mk_simp.
Equations
- GaudisCrypt.EC.CommitmentProtocol.Binder.mk theRecord✝ = theRecord✝.bind
Instances For
The record of the fields of a module of type Binder: the fields bind, one per moduletype field, each of that field's own module type.
Binder.mk turns such a record into a Binder, Binder.structure turns a Binder back into one.
Instances For
The IsModule Binder instance: Binder is a module type, with representation Binder.typeRep.
It is what lets the name Binder stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Binder.typeRep would do on its own but Binder, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.EC.CommitmentProtocol.instIsModuleBinder = { moduleTypeRep := GaudisCrypt.EC.CommitmentProtocol.Binder.typeRep, isModule := ⋯ }
@[simp]: Binder.mk (Binder.structure m) = m — rebuilding a module from its own fields gives that module back.
The field bind of a module of type Binder: the projection onto component 0 of the right-nested tuple Binder.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Binder.bind.mk_simp reads this field back off a module built by Binder.mk; Binder.bind.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 Binder, with fields bind: the type Module Binder.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with Binder.mk, read a single field off one with the accessors Binder.bind, and get the whole record back with Binder.structure.
Equations
Instances For
The ModuleTypeRep underlying Binder, the module type declared by moduletype Binder: the right-nested product of its 1 field types, in declaration order.
Binder is by definition Module Binder.typeRep.
Equations
Instances For
What is derivable about the accessor Binder.bind, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Binder.bind.utilities.accessorModule : Binder →ₘ …— the accessor as a module, a projection being a module morphism;Binder.bind.utilities.apply_simp—Module.app Binder.bind.utilities.accessorModule m = Binder.bind m: applying that module is the accessor;Binder.bind.utilities.expression_eq— the same at the level of expressions:(Binder.bind m).expression = (Binder.bind.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
proc main of module BindingExperiment as a module, abstracted over the module parameters it uses (S, B, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma BindingExperiment.main.apply_simp, which fills the holes of BindingExperiment.main.procedure with the callees the body called.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The body of proc main of module BindingExperiment, as a procedure of its own: the 3 calls it makes to module parameters (S, B) are its holes, in the order the body makes them.
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 BindingExperiment.main.procedure.apply_simp) rather than run. Use BindingExperiment.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 BindingExperiment.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 [BindingExperiment.main.procedure.apply_simp]).
@[simp]: applying BindingExperiment.main to the parameters proc main uses (S, B) is Module.proc (BindingExperiment.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 BindingExperiment, abstracted over its 2 parameters S, B, 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 BindingExperiment.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma BindingExperiment.apply_simp says.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: applying BindingExperiment to a tuple of its 2 parameters S, B — the record of its procedures BindingExperiment.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 BindingExperiment.main.apply_simp to fill that procedure's holes.