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