Documentation

GaudisCrypt.Examples.HashedElGamal

Hashed ElGamal is IND-CPA under DDH and entropy smoothing #

(EasyCrypt examples/hashed_elgamal_std.ec)

EC's file, declaration by declaration and script line by line; all five lemmas are proven.

Translation (as Examples/ElGamal.lean):

Gap list (the examples' infrastructure batch; numbers as in Examples/ElGamal.lean where the gap is the same):

EC's op k : { int | 0 < k } as gt0_k.

Instances

    clone import BitWord as Bits with op n <- k proof gt0_n by exact/gt0_k rename "word" as "bits" "dunifin" as "dbits"

    Assumption: entropy smoothing #

    EC's type hkey, op dhkey : { hkey distr | is_lossless dhkey } as dhkey_ll and op hash : hkey -> group -> bits.

    Instances
      def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.typeRep [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

      The ModuleTypeRep underlying AdvES, the module type declared by moduletype AdvES: the right-nested product of its 1 field types, in declaration order.

      AdvES is by definition Module AdvES.typeRep.

      Equations
      Instances For
        @[simp]
        theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.guess.mk_simp [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (theRecord✝ : Structure) :
        (mk theRecord✝).guess = theRecord✝.guess

        @[simp]: reading the field guess back off a module built from a record — AdvES.guess (AdvES.mk r) = r.guess.

        It is what carries the right-hand side of an X.apply_simp (which is an AdvES.mk) on to the field the caller actually asked for, so that simp chains X.apply_simp into X.guess.apply_simp.

        noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.guess [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

        The field guess of a module of type AdvES: the projection onto component 0 of the right-nested tuple AdvES.typeRep, as a chain of Module.fst'/Module.snd'. Tagged @[module_accessor].

        AdvES.guess.mk_simp reads this field back off a module built by AdvES.mk; AdvES.guess.utilities has the accessor as a module, and the lemmas about it.

        Its parameters are named hk, h, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).

        Equations
        • theModule✝.guess = theModule✝
        Instances For
          noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.structure [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

          The record of a module's fields: AdvES.structure m is AdvES.Structure.mk applied to AdvES.guess of m.

          Inverse of AdvES.mk (AdvES.mk_destruct, AdvES.destruct_mk).

          Equations
          Instances For
            @[implicit_reducible]
            instance GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.instIsModuleAdvES [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

            The IsModule AdvES instance: AdvES is a module type, with representation AdvES.typeRep.

            It is what lets the name AdvES stand where a module type is expected — in Module.Arr/Module.Prod (→ₘ/×ₘ), say — which the underlying Module AdvES.typeRep would do on its own but AdvES, a plain (non-reducible) def, would not.

            Equations
            @[simp]
            theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.mk_destruct [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (theRecord✝ : Structure) :
            (mk theRecord✝).structure = theRecord✝

            @[simp]: AdvES.structure (AdvES.mk r) = r — destructing a module built from a record gives that record back.

            def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

            The module type declared by moduletype AdvES, with fields guess: the type Module AdvES.typeRep of modules that are a right-nested tuple of the field types.

            Build one from a record of its fields with AdvES.mk, read a single field off one with the accessors AdvES.guess, and get the whole record back with AdvES.structure.

            Equations
            Instances For
              @[reducible]
              noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.mk [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

              Builds a module of type AdvES from the record AdvES.Structure of its fields, as a right-nested Module.pair'. @[reducible].

              Inverse of AdvES.structure (AdvES.mk_destruct, AdvES.destruct_mk); a single field of a module built this way is read back by the @[simp] lemmas AdvES.guess.mk_simp.

              Equations
              Instances For
                @[simp]
                theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.destruct_mk [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (theModule✝ : AdvES) :
                mk theModule✝.structure = theModule✝

                @[simp]: AdvES.mk (AdvES.structure m) = m — rebuilding a module from its own fields gives that module back.

                noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.guess.utilities [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                What is derivable about the accessor AdvES.guess, bundled into one ModuleTypeUtilities (one name per field in the namespace, rather than one per fact):

                • AdvES.guess.utilities.accessorModule : AdvES →ₘ … — the accessor as a module, a projection being a module morphism;
                • AdvES.guess.utilities.apply_simp — Module.app AdvES.guess.utilities.accessorModule m = AdvES.guess m: applying that module is the accessor;
                • AdvES.guess.utilities.expression_eq — the same at the level of expressions: (AdvES.guess m).expression = (AdvES.guess.utilities.proj m.expression).reduce.
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  structure GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.AdvES.Structure [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                  The record of the fields of a module of type AdvES: the fields guess, one per moduletype field, each of that field's own module type.

                  AdvES.mk turns such a record into a AdvES, AdvES.structure turns a AdvES back into one.

                  Instances For
                    theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES0.main.procedure.apply_simp [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (holeArgs✝ : (HoleSigs.cons (procsig (hkey, bits) → Bool) HoleSigs.empty).Instantiation) :
                    procedure.instantiate holeArgs✝ = proc () : Bool { var hk : hkey, h : bits, b : Bool; hk <$ dhkey; h <$ dbits; b <- call (holeArgs✝.lookup HoleIndex.zero) (§hk, §h); return §b }

                    Instantiating the holes of ES0.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 [ES0.main.procedure.apply_simp]).

                    @[simp]
                    theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES0.main.apply_simp [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (A : AdvES) :

                    @[simp]: applying ES0.main to the parameters proc main uses (A) is Module.proc (ES0.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]
                    theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES0.apply_simp [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (A : AdvES) :
                    ES0(A).main = Module.app main A

                    @[simp]: applying ES0 to a tuple of its single parameter A — the record of its procedures ES0.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 ES0.main.apply_simp to fill that procedure's holes.

                    noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES0.main.procedure [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                    The body of proc main of module ES0, 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 ES0.main.procedure.apply_simp) rather than run. Use ES0.main for this procedure as a module.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES0 [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                      The module declared by module ES0, 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 ES0.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma ES0.apply_simp says.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES0.main [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                        proc main of module ES0 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 ES0.main.apply_simp, which fills the holes of ES0.main.procedure with the callees the body called.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES1 [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                          The module declared by module ES1, 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 ES1.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma ES1.apply_simp says.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[simp]
                            theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES1.main.apply_simp [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (A : AdvES) :

                            @[simp]: applying ES1.main to the parameters proc main uses (A) is Module.proc (ES1.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.

                            theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES1.main.procedure.apply_simp [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (holeArgs✝ : (HoleSigs.cons (procsig (hkey, bits) → Bool) HoleSigs.empty).Instantiation) :
                            procedure.instantiate holeArgs✝ = proc () : Bool { var hk : hkey, z : exp, b : Bool; hk <$ dhkey; z <$ EC.CyclicGroup.dt; b <- call (holeArgs✝.lookup HoleIndex.zero) (§hk, hash (§hk) (EC.CyclicGroup.g ^ §z)); return §b }

                            Instantiating the holes of ES1.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 [ES1.main.procedure.apply_simp]).

                            noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES1.main.procedure [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                            The body of proc main of module ES1, 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 ES1.main.procedure.apply_simp) rather than run. Use ES1.main for this procedure as a module.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              noncomputable def GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES1.main [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] :

                              proc main of module ES1 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 ES1.main.apply_simp, which fills the holes of ES1.main.procedure with the callees the body called.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[simp]
                                theorem GaudisCrypt.Examples.HashedElGamal.EntropySmoothing.ES1.apply_simp [HashedElGamal.Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : Params group hkey] (A : AdvES) :
                                ES1(A).main = Module.app main A

                                @[simp]: applying ES1 to a tuple of its single parameter A — the record of its procedures ES1.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 ES1.main.apply_simp to fill that procedure's holes.

                                theorem GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.kg.procedure.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                procedure.instantiate holeArgs✝ = proc () : ((hkey × group) × hkey × exp) { var hk : hkey, sk : exp; hk <$ EntropySmoothing.dhkey; sk <$ EC.CyclicGroup.dt; return ((§hk, EC.CyclicGroup.g ^ §sk), §hk, §sk) }

                                Instantiating the holes of Hashed_ElGamal.kg.procedure with a tuple holeArgs of procedures: the body of proc kg 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 [Hashed_ElGamal.kg.procedure.apply_simp]).

                                noncomputable def GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.kg [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                procmod () → ((hkey × group) × hkey × exp)

                                proc kg of module Hashed_ElGamal as a module: Module.proc Hashed_ElGamal.kg.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Hashed_ElGamal.kg.apply_simp says exactly that.

                                Equations
                                Instances For
                                  noncomputable def GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.enc [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                  procmod (hkey × group, bits) → (group × bits)

                                  proc enc of module Hashed_ElGamal as a module: Module.proc Hashed_ElGamal.enc.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Hashed_ElGamal.enc.apply_simp says exactly that.

                                  Equations
                                  Instances For
                                    noncomputable def GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.enc.procedure [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                    proctype (hkey × group, bits) -> group × bits

                                    The body of proc enc of module Hashed_ElGamal, 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 Hashed_ElGamal.enc.procedure.apply_simp) rather than run. Use Hashed_ElGamal.enc for this procedure as a module.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      theorem GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.dec.procedure.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                      procedure.instantiate holeArgs✝ = proc (sk : hkey × exp, c : group × bits) : (Option bits) { var gy : group, hm : bits, h : bits; gy, hm <- §c; h <- EntropySmoothing.hash (§sk).1 (§gy ^ (§sk).2); return some (§h +^ §hm) }

                                      Instantiating the holes of Hashed_ElGamal.dec.procedure with a tuple holeArgs of procedures: the body of proc dec 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 [Hashed_ElGamal.dec.procedure.apply_simp]).

                                      @[simp]
                                      theorem GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.enc.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                      @[simp]: Hashed_ElGamal.enc = Module.proc Hashed_ElGamal.enc.procedure — true by definition, proc enc using no module parameter and so having no holes to fill.

                                      noncomputable def GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.dec.procedure [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                      proctype (hkey × exp, group × bits) -> Option bits

                                      The body of proc dec of module Hashed_ElGamal, 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 Hashed_ElGamal.dec.procedure.apply_simp) rather than run. Use Hashed_ElGamal.dec for this procedure as a module.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        theorem GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.enc.procedure.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                        procedure.instantiate holeArgs✝ = proc (pk : hkey × group, m : bits) : (group × bits) { var y : exp, h : bits; y <$ EC.CyclicGroup.dt; h <- EntropySmoothing.hash (§pk).1 ((§pk).2 ^ §y); return (EC.CyclicGroup.g ^ §y, §h +^ §m) }

                                        Instantiating the holes of Hashed_ElGamal.enc.procedure with a tuple holeArgs of procedures: the body of proc enc 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 [Hashed_ElGamal.enc.procedure.apply_simp]).

                                        noncomputable def GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.kg.procedure [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                        proctype () -> (hkey × group) × hkey × exp

                                        The body of proc kg of module Hashed_ElGamal, 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 Hashed_ElGamal.kg.procedure.apply_simp) rather than run. Use Hashed_ElGamal.kg for this procedure as a module.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          @[simp]
                                          theorem GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.dec.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                          @[simp]: Hashed_ElGamal.dec = Module.proc Hashed_ElGamal.dec.procedure — true by definition, proc dec using no module parameter and so having no holes to fill.

                                          noncomputable def GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.dec [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                          procmod (hkey × exp, group × bits) → Option bits

                                          proc dec of module Hashed_ElGamal as a module: Module.proc Hashed_ElGamal.dec.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — Hashed_ElGamal.dec.apply_simp says exactly that.

                                          Equations
                                          Instances For
                                            @[simp]
                                            theorem GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal.kg.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                            @[simp]: Hashed_ElGamal.kg = Module.proc Hashed_ElGamal.kg.procedure — true by definition, proc kg using no module parameter and so having no holes to fill.

                                            noncomputable def GaudisCrypt.Examples.HashedElGamal.Hashed_ElGamal [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                            PKE_.Scheme

                                            The module declared by module Hashed_ElGamal: the record of its procedures Hashed_ElGamal.kg, Hashed_ElGamal.enc.

                                            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 Hashed_ElGamal.apply_simp to apply it with.

                                            Equations
                                            Instances For
                                              noncomputable def GaudisCrypt.Examples.HashedElGamal.DDHAdv.guess.procedure [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                              The body of proc guess of module DDHAdv, as a procedure of its own: the 2 calls it makes to module parameters (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 DDHAdv.guess.procedure.apply_simp) rather than run. Use DDHAdv.guess for this procedure as a module.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                @[simp]
                                                theorem GaudisCrypt.Examples.HashedElGamal.DDHAdv.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (A : PKE_.Adversary) :

                                                @[simp]: applying DDHAdv to a tuple of its single parameter A — the record of its procedures DDHAdv.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 DDHAdv.guess.apply_simp to fill that procedure's holes.

                                                noncomputable def GaudisCrypt.Examples.HashedElGamal.DDHAdv [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                                The module declared by module DDHAdv, 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 DDHAdv.guess, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DDHAdv.apply_simp says.

                                                Equations
                                                Instances For
                                                  noncomputable def GaudisCrypt.Examples.HashedElGamal.DDHAdv.guess [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                                  proc guess of module DDHAdv 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 DDHAdv.guess.apply_simp, which fills the holes of DDHAdv.guess.procedure with the callees the body called.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    @[simp]
                                                    theorem GaudisCrypt.Examples.HashedElGamal.DDHAdv.guess.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (A : PKE_.Adversary) :

                                                    @[simp]: applying DDHAdv.guess to the parameters proc guess uses (A) is Module.proc (DDHAdv.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.

                                                    theorem GaudisCrypt.Examples.HashedElGamal.DDHAdv.guess.procedure.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (holeArgs✝ : (HoleSigs.cons (procsig (hkey × group) → bits × bits) (HoleSigs.cons (procsig (group × bits) → Bool) HoleSigs.empty)).Instantiation) :
                                                    procedure.instantiate holeArgs✝ = proc (gx : group, gy : group, gz : group) : Bool { var hk : hkey, m0 : bits, m1 : bits, b : Bool, h : bits, b' : Bool; hk <$ EntropySmoothing.dhkey; m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero) (§hk, §gx); b <$ EC.dbool; h <- EntropySmoothing.hash §hk §gz; b' <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§gy, §h +^ if §b = true then §m1 else §m0); return decide (§b' = §b) }

                                                    Instantiating the holes of DDHAdv.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 [DDHAdv.guess.procedure.apply_simp]).

                                                    noncomputable def GaudisCrypt.Examples.HashedElGamal.ESAdv.guess [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                                    Module.Arr PKE_.Adversary (procmod (hkey, bits) → Bool)

                                                    proc guess of module ESAdv 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 ESAdv.guess.apply_simp, which fills the holes of ESAdv.guess.procedure with the callees the body called.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      @[simp]
                                                      theorem GaudisCrypt.Examples.HashedElGamal.ESAdv.guess.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (A : PKE_.Adversary) :

                                                      @[simp]: applying ESAdv.guess to the parameters proc guess uses (A) is Module.proc (ESAdv.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.

                                                      theorem GaudisCrypt.Examples.HashedElGamal.ESAdv.guess.procedure.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (holeArgs✝ : (HoleSigs.cons (procsig (hkey × group) → bits × bits) (HoleSigs.cons (procsig (group × bits) → Bool) HoleSigs.empty)).Instantiation) :
                                                      procedure.instantiate holeArgs✝ = proc (hk : hkey, h : bits) : Bool { var x : exp, y : exp, m0 : bits, m1 : bits, b : Bool, b' : Bool; x <$ EC.CyclicGroup.dt; y <$ EC.CyclicGroup.dt; m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero) (§hk, EC.CyclicGroup.g ^ §x); b <$ EC.dbool; b' <- call (holeArgs✝.lookup HoleIndex.zero.succ) (EC.CyclicGroup.g ^ §y, §h +^ if §b = true then §m1 else §m0); return decide (§b' = §b) }

                                                      Instantiating the holes of ESAdv.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 [ESAdv.guess.procedure.apply_simp]).

                                                      @[simp]
                                                      theorem GaudisCrypt.Examples.HashedElGamal.ESAdv.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (A : PKE_.Adversary) :
                                                      ESAdv(A).guess = Module.app guess A

                                                      @[simp]: applying ESAdv to a tuple of its single parameter A — the record of its procedures ESAdv.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 ESAdv.guess.apply_simp to fill that procedure's holes.

                                                      noncomputable def GaudisCrypt.Examples.HashedElGamal.ESAdv [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                                      Module.Arr PKE_.Adversary (procmod (hkey, bits) → Bool)

                                                      The module declared by module ESAdv, 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 ESAdv.guess, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma ESAdv.apply_simp says.

                                                      Equations
                                                      Instances For
                                                        noncomputable def GaudisCrypt.Examples.HashedElGamal.ESAdv.guess.procedure [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                                        The body of proc guess of module ESAdv, as a procedure of its own: the 2 calls it makes to module parameters (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 ESAdv.guess.procedure.apply_simp) rather than run. Use ESAdv.guess for this procedure as a module.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          @[simp]
                                                          theorem GaudisCrypt.Examples.HashedElGamal.Gb.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (A : PKE_.Adversary) :
                                                          Gb(A).main = Module.app main A

                                                          @[simp]: applying Gb to a tuple of its single parameter A — the record of its procedures Gb.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 Gb.main.apply_simp to fill that procedure's holes.

                                                          noncomputable def GaudisCrypt.Examples.HashedElGamal.Gb.main [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                                          Module.Arr PKE_.Adversary (procmod () → Bool)

                                                          proc main of module Gb 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 Gb.main.apply_simp, which fills the holes of Gb.main.procedure with the callees the body called.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            noncomputable def GaudisCrypt.Examples.HashedElGamal.Gb.main.procedure [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :

                                                            The body of proc main of module Gb, as a procedure of its own: the 2 calls it makes to module parameters (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 Gb.main.procedure.apply_simp) rather than run. Use Gb.main for this procedure as a module.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              theorem GaudisCrypt.Examples.HashedElGamal.Gb.main.procedure.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (holeArgs✝ : (HoleSigs.cons (procsig (hkey × group) → bits × bits) (HoleSigs.cons (procsig (group × bits) → Bool) HoleSigs.empty)).Instantiation) :
                                                              procedure.instantiate holeArgs✝ = proc () : Bool { var hk : hkey, x : exp, y : exp, m0 : bits, m1 : bits, v : bits, b' : Bool, b : Bool; hk <$ EntropySmoothing.dhkey; x <$ EC.CyclicGroup.dt; y <$ EC.CyclicGroup.dt; m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero) (§hk, EC.CyclicGroup.g ^ §x); v <$ dbits; b' <- call (holeArgs✝.lookup HoleIndex.zero.succ) (EC.CyclicGroup.g ^ §y, §v); b <$ EC.dbool; return decide (§b' = §b) }

                                                              Instantiating the holes of Gb.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 [Gb.main.procedure.apply_simp]).

                                                              noncomputable def GaudisCrypt.Examples.HashedElGamal.Gb [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] :
                                                              Module.Arr PKE_.Adversary (procmod () → Bool)

                                                              The module declared by module Gb, 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 Gb.main, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Gb.apply_simp says.

                                                              Equations
                                                              Instances For
                                                                @[simp]
                                                                theorem GaudisCrypt.Examples.HashedElGamal.Gb.main.apply_simp [Params] {group exp : Type} [_gaudiParam0 : CommGroup group] [_gaudiParam1 : Field exp] [_gaudiParam2 : Fintype exp] [_gaudiParam3 : EC.CyclicGroup.Params group exp] {hkey : Type} [_gaudiParam4 : Inhabited hkey] [_gaudiParam5 : EntropySmoothing.Params group hkey] (A : PKE_.Adversary) :

                                                                @[simp]: applying Gb.main to the parameters proc main uses (A) is Module.proc (Gb.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.

                                                                theorem GaudisCrypt.Examples.HashedElGamal.cpa_ddh0 [Params] {group exp : Type} [CommGroup group] [Field exp] [Fintype exp] [EC.CyclicGroup.Params group exp] {hkey : Type} [Inhabited hkey] [EntropySmoothing.Params group hkey] (A : PKE_.Adversary) [Module.Declared A ⊥] (m : VariableAssignment) :
                                                                Pr[ PKE_.CPA(Hashed_ElGamal, A).main () @ &m : §res = true ] = Pr[ EC.DiffieHellman.DDH.DDH0(DDHAdv(A)).main () @ &m : §res = true ]

                                                                EC's local lemma cpa_ddh0 &m: Pr[CPA(Hashed_ElGamal,A).main() @ &m : res] = Pr[DDH0(DDHAdv(A)).main() @ &m : res].

                                                                theorem GaudisCrypt.Examples.HashedElGamal.ddh1_es1 [Params] {group exp : Type} [CommGroup group] [Field exp] [Fintype exp] [EC.CyclicGroup.Params group exp] {hkey : Type} [Inhabited hkey] [EntropySmoothing.Params group hkey] (A : PKE_.Adversary) [Module.Declared A ⊥] (m : VariableAssignment) :
                                                                Pr[ EC.DiffieHellman.DDH.DDH1(DDHAdv(A)).main () @ &m : §res = true ] = Pr[ EntropySmoothing.ES1(ESAdv(A)).main () @ &m : §res = true ]

                                                                EC's local lemma ddh1_es1 &m: Pr[DDH1(DDHAdv(A)).main() @ &m : res] = Pr[ES1(ESAdv(A)).main() @ &m : res].

                                                                theorem GaudisCrypt.Examples.HashedElGamal.es0_Gb [Params] {group exp : Type} [CommGroup group] [Field exp] [Fintype exp] [EC.CyclicGroup.Params group exp] {hkey : Type} [Inhabited hkey] [EntropySmoothing.Params group hkey] (A : PKE_.Adversary) [Module.Declared A ⊥] (m : VariableAssignment) :
                                                                Pr[ EntropySmoothing.ES0(ESAdv(A)).main () @ &m : §res = true ] = Pr[ Gb(A).main () @ &m : §res = true ]

                                                                EC's local lemma es0_Gb &m: Pr[ES0(ESAdv(A)).main() @ &m : res] = Pr[Gb.main()@ &m : res].

                                                                theorem GaudisCrypt.Examples.HashedElGamal.Gb_half [Params] {group exp : Type} [CommGroup group] [Field exp] [Fintype exp] [EC.CyclicGroup.Params group exp] {hkey : Type} [Inhabited hkey] [EntropySmoothing.Params group hkey] (A : PKE_.Adversary) [Module.Declared A ⊥] (Ac_ll : A.choose.procedure.IsLossless) (Ag_ll : A.guess.procedure.IsLossless) (m : VariableAssignment) :
                                                                Pr[ Gb(A).main () @ &m : §res = true ] = 1 / 2

                                                                EC's local lemma Gb_half &m: Pr[Gb.main()@ &m : res] = 1%r/2%r.

                                                                theorem GaudisCrypt.Examples.HashedElGamal.conclusion [Params] {group exp : Type} [CommGroup group] [Field exp] [Fintype exp] [EC.CyclicGroup.Params group exp] {hkey : Type} [Inhabited hkey] [EntropySmoothing.Params group hkey] (A : PKE_.Adversary) [Module.Declared A ⊥] (Ac_ll : A.choose.procedure.IsLossless) (Ag_ll : A.guess.procedure.IsLossless) (m : VariableAssignment) :
                                                                |Pr[ PKE_.CPA(Hashed_ElGamal, A).main () @ &m : §res = true ] - 1 / 2| ≤ |Pr[ EC.DiffieHellman.DDH.DDH0(DDHAdv(A)).main () @ &m : §res = true ] - Pr[ EC.DiffieHellman.DDH.DDH1(DDHAdv(A)).main () @ &m : §res = true ]| + |Pr[ EntropySmoothing.ES0(ESAdv(A)).main () @ &m : §res = true ] - Pr[ EntropySmoothing.ES1(ESAdv(A)).main () @ &m : §res = true ]|

                                                                EC's lemma conclusion &m : | Pr[CPA(Hashed_ElGamal,A).main() @ &m : res] - 1%r/2%r | <= | Pr[DDH0(DDHAdv(A)).main() @ &m : res] - Pr[DDH1(DDHAdv(A)).main() @ &m : res] | + | Pr[ES0(ESAdv(A)).main() @ &m : res] - Pr[ES1(ESAdv(A)).main() @ &m : res]|`.