One-way trapdoor permutations (EasyCrypt theories/crypto/OW.ec) #
The theory's types D, R, pkey, skey are outParams of the class Params; its
operators (dkeys, challenge, f, finv) and axioms are the class's fields: a clone is
clone import GaudisCrypt.EC.OW as OW_rand with type D <- …, op dkeys <- … proof * by ….
EC's pred valid_keys (ks:pkey * skey) = support dkeys ks.
Equations
- GaudisCrypt.EC.OW.valid_keys' dkeys ks = (ks ∈ dkeys.support)
Instances For
EC's pred valid_pkey (pk:pkey) = exists sk, valid_keys (pk,sk).
Equations
- GaudisCrypt.EC.OW.valid_pkey' dkeys pk = ∃ (sk : skey), GaudisCrypt.EC.OW.valid_keys' dkeys (pk, sk)
Instances For
EC's pred f_dom (pk:pkey) (x:D) = valid_pkey pk => x \in (challenge pk).
Equations
- GaudisCrypt.EC.OW.f_dom' dkeys challenge pk x = (GaudisCrypt.EC.OW.valid_pkey' dkeys pk → x ∈ (challenge pk).support)
Instances For
EC's pred f_rng (pk:pkey) (y:R) = valid_pkey pk => exists x, f_dom pk x /\ y = f pk x.
Equations
- GaudisCrypt.EC.OW.f_rng' dkeys challenge f pk y = (GaudisCrypt.EC.OW.valid_pkey' dkeys pk → ∃ (x : D), GaudisCrypt.EC.OW.f_dom' dkeys challenge pk x ∧ y = f pk x)
Instances For
EC's abstract declarations of the theory: the domain and range D, R, the keys, the
distribution of the keys and of the challenge, the permutation f and its inverse finv, and
the axioms dkeys_ll, challenge_ll, challenge_uni, finv_correct, finvof, fofinv.
- dkeys : SubProbability (pkey × skey)
- dkeys_ll : is_lossless dkeys
- challenge : pkey → SubProbability D
- challenge_ll (pk : pkey) : valid_pkey' dkeys pk → is_lossless (challenge pk)
- challenge_uni (pk : pkey) : valid_pkey' dkeys pk → is_uniform (challenge pk)
- f : pkey → D → R
- finv : skey → R → D
Instances
EC's pred valid_keys.
Instances For
EC's pred f_dom.
Equations
Instances For
EC's pred f_rng.
Equations
Instances For
We can now define the module types and modules that define security
What is derivable about the accessor Inverter.invert, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):
Inverter.invert.utilities.accessorModule : Inverter →ₘ …— the accessor as a module, a projection being a module morphism;Inverter.invert.utilities.apply_simp—Module.app Inverter.invert.utilities.accessorModule m = Inverter.invert m: applying that module is the accessor;Inverter.invert.utilities.expression_eq— the same at the level of expressions:(Inverter.invert m).expression = (Inverter.invert.utilities.proj m.expression).reduce.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]: Inverter.structure (Inverter.mk r) = r — destructing a module built from a record gives that record back.
The module type declared by moduletype Inverter, with fields invert: the type Module Inverter.typeRep of modules that are a right-nested tuple of the field types.
Build one from a record of its fields with Inverter.mk, read a single field off one with the accessors Inverter.invert, and get the whole record back with Inverter.structure.
Instances For
Builds a module of type Inverter from the record Inverter.Structure of its fields, as a right-nested Module.pair'. @[reducible].
Inverse of Inverter.structure (Inverter.mk_destruct, Inverter.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas Inverter.invert.mk_simp.
Equations
- GaudisCrypt.EC.OW.Inverter.mk theRecord✝ = theRecord✝.invert
Instances For
The IsModule Inverter instance: Inverter is a module type, with representation Inverter.typeRep.
It is what lets the name Inverter stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module Inverter.typeRep would do on its own but Inverter, a plain (non-reducible) def, would not.
Equations
- GaudisCrypt.EC.OW.instIsModuleInverter = { moduleTypeRep := GaudisCrypt.EC.OW.Inverter.typeRep, isModule := ⋯ }
The field invert of a module of type Inverter: the projection onto component 0 of the right-nested tuple Inverter.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].
Inverter.invert.mk_simp reads this field back off a module built by Inverter.mk; Inverter.invert.utilities has the accessor as a module, and the lemmas about it.
Its parameters are named pk, y, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).
Instances For
@[simp]: Inverter.mk (Inverter.structure m) = m — rebuilding a module from its own fields gives that module back.
The record of a module's fields: Inverter.structure m is Inverter.Structure.mk applied to Inverter.invert of m.
Inverse of Inverter.mk (Inverter.mk_destruct, Inverter.destruct_mk).
Instances For
The record of the fields of a module of type Inverter: the fields invert, one per moduletype field, each of that field's own module type.
Inverter.mk turns such a record into a Inverter, Inverter.structure turns a Inverter back into one.
Instances For
The ModuleTypeRep underlying Inverter, the module type declared by moduletype Inverter: the right-nested product of its 1 field types, in declaration order.
Inverter is by definition Module Inverter.typeRep.
Equations
Instances For
@[simp]: reading the field invert back off a module built from a record — Inverter.invert (Inverter.mk r) = r.invert.
It is what carries the right-hand side of an X.apply_simp (which is an Inverter.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.invert.apply_simp.
@[simp]: applying OW.main to the parameters proc main uses (I) is Module.proc (OW.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 OW, abstracted over its single parameter I, 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 OW.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma OW.apply_simp says.
Equations
Instances For
proc main of module OW as a module, abstracted over the module parameters it uses (I, in declaration order): Module.Arr … (Module.Proc (procsig …)).
Apply it with the @[simp] lemma OW.main.apply_simp, which fills the holes of OW.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 OW to a tuple of its single parameter I — the record of its procedures OW.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 OW.main.apply_simp to fill that procedure's holes.
The body of proc main of module OW, as a procedure of its own: the one call it makes to a module parameter (I) 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 OW.main.procedure.apply_simp) rather than run. Use OW.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 OW.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 [OW.main.procedure.apply_simp]).