Documentation

GaudisCrypt.Examples.BR93

Bellare and Rogaway's encryption scheme is IND-CPA (EasyCrypt examples/br93.ec) #

Bellare and Rogaway, "Random oracles are practical: a paradigm for designing efficient protocols" (1993): enc pk m = (f pk r, H r +^ m) for a one-way trapdoor permutation f and a random oracle H. EC's file, declaration by declaration and script line by line, in its two parts:

All of EC's lemmas are proven.

Translation:

Gap list (what keeps the file from reading as EC's):

class GaudisCrypt.Examples.BR93.Params (ptxt rand pkey skey : outParam Type) :

The abstract scenario of EC's abstract theory BR93.

Instances

    EC's op (+^): ptxt -> ptxt -> ptxt.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem GaudisCrypt.Examples.BR93.addpK {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] (p1 p2 : ptxt) :
      p1 +^ p2 +^ p2 = p1
      theorem GaudisCrypt.Examples.BR93.dptxt_ll {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.dptxt_uni {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.dptxt_fu {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.dptxt_funi {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.drand_ll {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.drand_uni {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.dkeys_ll {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.dkeys_funi {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] :
      theorem GaudisCrypt.Examples.BR93.fI {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] (pk : pkey) (x y : rand) :
      (∃ (sk : skey), (pk, sk) ∈ dkeys.support) → f pk x = f pk y → x = y
      @[simp]
      theorem GaudisCrypt.Examples.BR93.BR93.dec.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (H : H.Oracle) :

      @[simp]: applying BR93.dec to the parameters proc dec uses (H) is Module.proc (BR93.dec.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.BR93.BR93.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (H : H.Oracle) :

      @[simp]: applying BR93 to a tuple of its single parameter H — the record of its procedures BR93.keygen, BR93.enc, BR93.dec, 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 BR93.keygen.apply_simp, BR93.enc.apply_simp, BR93.dec.apply_simp to fill that procedure's holes.

      noncomputable def GaudisCrypt.Examples.BR93.BR93 {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
      Module.Arr H.Oracle (Module.Prod (procmod () → (pkey × skey)) (Module.Prod (procmod (pkey, ptxt) → (rand × ptxt)) (procmod (skey, rand × ptxt) → ptxt)))

      The module declared by module BR93, abstracted over its single parameter H, 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 BR93.keygen, BR93.enc, BR93.dec, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma BR93.apply_simp says.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[simp]
        theorem GaudisCrypt.Examples.BR93.BR93.keygen.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

        noncomputable def GaudisCrypt.Examples.BR93.BR93.keygen {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
        procmod () → (pkey × skey)

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

        Equations
        Instances For
          theorem GaudisCrypt.Examples.BR93.BR93.dec.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (rand) → ptxt) HoleSigs.empty).Instantiation) :
          procedure.instantiate holeArgs✝ = proc (sk : skey, c : rand × ptxt) : ptxt { var r : rand, m : ptxt, h : ptxt; r, m <- §c; r <- fi §sk §r; h <- call (holeArgs✝.lookup HoleIndex.zero) (§r); return §h +^ §m }

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

          theorem GaudisCrypt.Examples.BR93.BR93.enc.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (rand) → ptxt) HoleSigs.empty).Instantiation) :
          procedure.instantiate holeArgs✝ = proc (pk : pkey, m : ptxt) : (rand × ptxt) { var r : rand, h : ptxt; r <$ drand; h <- call (holeArgs✝.lookup HoleIndex.zero) (§r); return (f §pk §r, §h +^ §m) }

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

          noncomputable def GaudisCrypt.Examples.BR93.BR93.enc {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
          Module.Arr H.Oracle (procmod (pkey, ptxt) → (rand × ptxt))

          proc enc of module BR93 as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

          Apply it with the @[simp] lemma BR93.enc.apply_simp, which fills the holes of BR93.enc.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.BR93.BR93.dec.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
            proctype (skey, rand × ptxt) → ptxt uses ((rand) → ptxt)

            The body of proc dec of module BR93, as a procedure of its own: the one call it makes to a module parameter (H) 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 BR93.dec.procedure.apply_simp) rather than run. Use BR93.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.BR93.BR93.keygen.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : HoleSigs.empty.Instantiation) :
              procedure.instantiate holeArgs✝ = proc () : (pkey × skey) { var kp : pkey × skey; kp <$ dkeys; return §kp }

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

              noncomputable def GaudisCrypt.Examples.BR93.BR93.dec {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
              Module.Arr H.Oracle (procmod (skey, rand × ptxt) → ptxt)

              proc dec of module BR93 as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

              Apply it with the @[simp] lemma BR93.dec.apply_simp, which fills the holes of BR93.dec.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.BR93.BR93.enc.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                proctype (pkey, ptxt) → rand × ptxt uses ((rand) → ptxt)

                The body of proc enc of module BR93, as a procedure of its own: the one call it makes to a module parameter (H) 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 BR93.enc.procedure.apply_simp) rather than run. Use BR93.enc 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.BR93.BR93.keygen.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                  proctype () -> pkey × skey

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

                  Equations
                  Instances For
                    @[simp]
                    theorem GaudisCrypt.Examples.BR93.BR93.enc.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (H : H.Oracle) :

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

                    We can quickly prove it correct as a sanity check.

                    noncomputable def GaudisCrypt.Examples.BR93.Correctness.main.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                    The body of proc main of module Correctness, 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 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
                      @[simp]
                      theorem GaudisCrypt.Examples.BR93.Correctness.main.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                      theorem GaudisCrypt.Examples.BR93.Correctness.main.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                      procedure.instantiate holeArgs✝ = proc (m : ptxt) : Bool { var pk : pkey, sk : skey, c : rand × ptxt, m' : ptxt; pk, sk <- call BR93.keygen.procedure (); c <- call (Module.app BR93.enc H.Lazy.LRO).procedure (§pk, §m); m' <- call (Module.app BR93.dec H.Lazy.LRO).procedure (§sk, §c); return decide (§m = §m') }

                      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]).

                      noncomputable def GaudisCrypt.Examples.BR93.Correctness.main {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                      Equations
                      Instances For
                        noncomputable def GaudisCrypt.Examples.BR93.Correctness {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                        The module declared by module Correctness: the record of its procedures Correctness.main.

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

                        Equations
                        Instances For
                          theorem GaudisCrypt.Examples.BR93.BR93_correct {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (m : VariableAssignment) (m₀ : ptxt) :
                          Pr[ Correctness.main (m₀) @ &m : §res = true ] = 1

                          We use cloning to get definitions for OWTP security

                          But we can't do it (yet) for IND-CPA because of the random oracle. Instead, we define CPA for BR93 with that particular RO.

                          @[simp]
                          theorem GaudisCrypt.Examples.BR93.AdvProcs.mk_destruct {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (theRecord✝ : Structure) :
                          (mk theRecord✝).structure = theRecord✝

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

                          def GaudisCrypt.Examples.BR93.AdvProcs {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

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

                          Equations
                          Instances For
                            noncomputable def GaudisCrypt.Examples.BR93.AdvProcs.a2.utilities {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                            • AdvProcs.a2.utilities.accessorModule : AdvProcs →ₘ … — the accessor as a module, a projection being a module morphism;
                            • AdvProcs.a2.utilities.apply_simp — Module.app AdvProcs.a2.utilities.accessorModule m = AdvProcs.a2 m: applying that module is the accessor;
                            • AdvProcs.a2.utilities.expression_eq — the same at the level of expressions: (AdvProcs.a2 m).expression = (AdvProcs.a2.utilities.proj m.expression).reduce.
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              noncomputable def GaudisCrypt.Examples.BR93.AdvProcs.a1 {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                              AdvProcs → procmod (pkey) → (ptxt × ptxt)

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

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

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

                              Equations
                              Instances For
                                noncomputable def GaudisCrypt.Examples.BR93.AdvProcs.structure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                                The record of a module's fields: AdvProcs.structure m is AdvProcs.Structure.mk applied to AdvProcs.a1, AdvProcs.a2 of m.

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

                                Equations
                                Instances For
                                  structure GaudisCrypt.Examples.BR93.AdvProcs.Structure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

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

                                  Instances For
                                    @[simp]
                                    theorem GaudisCrypt.Examples.BR93.AdvProcs.a1.mk_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (theRecord✝ : Structure) :
                                    (mk theRecord✝).a1 = theRecord✝.a1

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

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

                                    def GaudisCrypt.Examples.BR93.AdvProcs.typeRep {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                                    AdvProcs is by definition Module AdvProcs.typeRep.

                                    Equations
                                    Instances For
                                      @[simp]
                                      theorem GaudisCrypt.Examples.BR93.AdvProcs.destruct_mk {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (theModule✝ : AdvProcs) :
                                      mk theModule✝.structure = theModule✝

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

                                      @[reducible]
                                      noncomputable def GaudisCrypt.Examples.BR93.AdvProcs.mk {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

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

                                      Equations
                                      Instances For
                                        noncomputable def GaudisCrypt.Examples.BR93.AdvProcs.a1.utilities {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                                        • AdvProcs.a1.utilities.accessorModule : AdvProcs →ₘ … — the accessor as a module, a projection being a module morphism;
                                        • AdvProcs.a1.utilities.apply_simp — Module.app AdvProcs.a1.utilities.accessorModule m = AdvProcs.a1 m: applying that module is the accessor;
                                        • AdvProcs.a1.utilities.expression_eq — the same at the level of expressions: (AdvProcs.a1 m).expression = (AdvProcs.a1.utilities.proj m.expression).reduce.
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          @[simp]
                                          theorem GaudisCrypt.Examples.BR93.AdvProcs.a2.mk_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (theRecord✝ : Structure) :
                                          (mk theRecord✝).a2 = theRecord✝.a2

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

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

                                          noncomputable def GaudisCrypt.Examples.BR93.AdvProcs.a2 {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                          AdvProcs → procmod (rand × ptxt) → Bool

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

                                          AdvProcs.a2.mk_simp reads this field back off a module built by AdvProcs.mk; AdvProcs.a2.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
                                          Instances For
                                            @[implicit_reducible]
                                            instance GaudisCrypt.Examples.BR93.instIsModuleAdvProcs {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

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

                                            Equations
                                            @[reducible, inline]
                                            abbrev GaudisCrypt.Examples.BR93.Adv {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :

                                            EC's module type Adv (ARO : POracle) = { proc a1(p:pkey): (ptxt * ptxt) proc a2(c:ctxt): bool }.

                                            Equations
                                            Instances For

                                              We need to log the random oracle queries made to the adversary in order to express the final theorem.

                                              instance GaudisCrypt.Examples.BR93.instIsGlobalVarListQsMk {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                              Log.qs.IsGlobalVar (VariableName.mk "GaudisCrypt.Examples.BR93.Log.qs" (List rand))
                                              noncomputable def GaudisCrypt.Examples.BR93.Log.qs {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                              Equations
                                              Instances For
                                                theorem GaudisCrypt.Examples.BR93.Log.o.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (rand) → ptxt) HoleSigs.empty).Instantiation) :
                                                procedure.instantiate holeArgs✝ = proc (x : rand) : ptxt { var r : ptxt; qs <- §x :: §qs; r <- call (holeArgs✝.lookup HoleIndex.zero) (§x); return §r }

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

                                                noncomputable def GaudisCrypt.Examples.BR93.Log.init.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                                                The body of proc init of module Log, as a procedure of its own: the one call it makes to a module parameter (H) 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 Log.init.procedure.apply_simp) rather than run. Use Log.init for this procedure as a module.

                                                Equations
                                                Instances For
                                                  noncomputable def GaudisCrypt.Examples.BR93.Log.o.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                  proctype (rand) → ptxt uses ((rand) → ptxt)

                                                  The body of proc o of module Log, as a procedure of its own: the one call it makes to a module parameter (H) 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 Log.o.procedure.apply_simp) rather than run. Use Log.o 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.BR93.Log.init.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (H : H.Oracle) :

                                                    @[simp]: applying Log.init to the parameters proc init uses (H) is Module.proc (Log.init.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.BR93.Log.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (H : H.Oracle) :

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

                                                    noncomputable def GaudisCrypt.Examples.BR93.Log {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                    Module.Arr H.Oracle H.Oracle

                                                    The module declared by module Log, abstracted over its single parameter H, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the module type it was declared with.

                                                    Applied to such a tuple it is the record of its procedures Log.init, Log.o, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma Log.apply_simp says.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      @[simp]
                                                      theorem GaudisCrypt.Examples.BR93.Log.o.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (H : H.Oracle) :

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

                                                      noncomputable def GaudisCrypt.Examples.BR93.Log.init {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                                                      proc init of module Log as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                      Apply it with the @[simp] lemma Log.init.apply_simp, which fills the holes of Log.init.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.BR93.Log.o {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                        Module.Arr H.Oracle (procmod (rand) → ptxt)

                                                        proc o of module Log as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                        Apply it with the @[simp] lemma Log.o.apply_simp, which fills the holes of Log.o.procedure with the callees the body called.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          theorem GaudisCrypt.Examples.BR93.Log.init.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig () → Unit) HoleSigs.empty).Instantiation) :
                                                          procedure.instantiate holeArgs✝ = proc () : Unit { qs <- []; call (holeArgs✝.lookup HoleIndex.zero) (); return () }

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

                                                          theorem GaudisCrypt.Examples.BR93.fvP_Log {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :

                                                          glob Log: its list Log.qs (read off the code; for the footprint tactics).

                                                          theorem GaudisCrypt.Examples.BR93.BR93_CPA.main.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (pkey) → ptxt × ptxt) (HoleSigs.cons (procsig (rand × ptxt) → Bool) HoleSigs.empty)).Instantiation) :
                                                          procedure.instantiate holeArgs✝ = proc () : Bool { var pk : pkey, sk : skey, m0 : ptxt, m1 : ptxt, b : Bool, c : rand × ptxt, b' : Bool; call Log(H.Lazy.LRO).init.procedure (); pk, sk <- call BR93.keygen.procedure (); m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero) (§pk); b <$ EC.dbool; c <- call (Module.app BR93.enc H.Lazy.LRO).procedure (§pk, if §b = true then §m0 else §m1); b' <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§c); return decide (§b' = §b) }

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

                                                          noncomputable def GaudisCrypt.Examples.BR93.BR93_CPA.main.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                          proctype () → Bool uses ((pkey) → ptxt × ptxt, (rand × ptxt) → Bool)

                                                          The body of proc main of module BR93_CPA, 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 BR93_CPA.main.procedure.apply_simp) rather than run. Use BR93_CPA.main 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.BR93.BR93_CPA.main.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :
                                                            Module.app main A = Module.proc (procedure.instantiate (A(Log(H.Lazy.LRO)).a1.procedure, A(Log(H.Lazy.LRO)).a2.procedure))

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

                                                            noncomputable def GaudisCrypt.Examples.BR93.BR93_CPA {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                                                            Equations
                                                            Instances For
                                                              noncomputable def GaudisCrypt.Examples.BR93.BR93_CPA.main {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                                                              proc main of module BR93_CPA 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 BR93_CPA.main.apply_simp, which fills the holes of BR93_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]
                                                                theorem GaudisCrypt.Examples.BR93.BR93_CPA.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :

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

                                                                We construct I as follows, using A.a1 and A.a2 as black boxes

                                                                noncomputable def GaudisCrypt.Examples.BR93.I.x {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                Equations
                                                                Instances For
                                                                  instance GaudisCrypt.Examples.BR93.instIsGlobalVarXMk {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                  I.x.IsGlobalVar (VariableName.mk "GaudisCrypt.Examples.BR93.I.x" rand)
                                                                  theorem GaudisCrypt.Examples.BR93.I.invert.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (pkey) → ptxt × ptxt) (HoleSigs.cons (procsig (rand × ptxt) → Bool) HoleSigs.empty)).Instantiation) :
                                                                  procedure.instantiate holeArgs✝ = proc (pk : pkey, y : rand) : rand { var m0 : ptxt, m1 : ptxt, h : ptxt, b : Bool; call Log(H.Lazy.LRO).init.procedure (); m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero) (§pk); h <$ dptxt; b <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§y, §h); x <- EC.nth default (§Log.qs) (EC.find (fun (p : rand) => decide (f (§pk) p = §y)) §Log.qs); return §x }

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

                                                                  @[simp]
                                                                  theorem GaudisCrypt.Examples.BR93.I.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :

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

                                                                  noncomputable def GaudisCrypt.Examples.BR93.I.invert.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                                  proctype (pkey, rand) → rand uses ((pkey) → ptxt × ptxt, (rand × ptxt) → Bool)

                                                                  The body of proc invert of module I, 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 I.invert.procedure.apply_simp) rather than run. Use I.invert 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.BR93.I {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                                    Module.Arr Adv OW_rand.Inverter

                                                                    The module declared by module I, abstracted over its single parameter A, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the module type it was declared with.

                                                                    Applied to such a tuple it is the record of its procedures I.invert, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma I.apply_simp says.

                                                                    Equations
                                                                    Instances For
                                                                      noncomputable def GaudisCrypt.Examples.BR93.I.invert {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                                                                      proc invert of module I 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 I.invert.apply_simp, which fills the holes of I.invert.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.BR93.I.invert.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :

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

                                                                        We now prove the result using a sequence of games

                                                                        noncomputable def GaudisCrypt.Examples.BR93.Game1.r {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                        Equations
                                                                        Instances For
                                                                          instance GaudisCrypt.Examples.BR93.instIsGlobalVarRMk {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                          Game1.r.IsGlobalVar (VariableName.mk "GaudisCrypt.Examples.BR93.Game1.r" rand)
                                                                          @[simp]
                                                                          theorem GaudisCrypt.Examples.BR93.Game1.main.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :
                                                                          Module.app main A = Module.proc (procedure.instantiate (A(Log(H.Lazy.LRO)).a1.procedure, A(Log(H.Lazy.LRO)).a2.procedure))

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

                                                                          noncomputable def GaudisCrypt.Examples.BR93.Game1.main {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                                                                          proc main of module Game1 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 Game1.main.apply_simp, which fills the holes of Game1.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.BR93.Game1 {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                                                                            Equations
                                                                            Instances For
                                                                              @[simp]
                                                                              theorem GaudisCrypt.Examples.BR93.Game1.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :

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

                                                                              theorem GaudisCrypt.Examples.BR93.Game1.main.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (pkey) → ptxt × ptxt) (HoleSigs.cons (procsig (rand × ptxt) → Bool) HoleSigs.empty)).Instantiation) :
                                                                              procedure.instantiate holeArgs✝ = proc () : Bool { var pk : pkey, sk : skey, m0 : ptxt, m1 : ptxt, b : Bool, h : ptxt, c : rand × ptxt, b' : Bool; call Log(H.Lazy.LRO).init.procedure (); pk, sk <$ dkeys; m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero) (§pk); b <$ EC.dbool; r <$ drand; h <$ dptxt; c <- (f §pk §r, §h +^ if §b = true then §m0 else §m1); b' <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§c); return decide (§b' = §b) }

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

                                                                              noncomputable def GaudisCrypt.Examples.BR93.Game1.main.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                                              proctype () → Bool uses ((pkey) → ptxt × ptxt, (rand × ptxt) → Bool)

                                                                              The body of proc main of module Game1, 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 Game1.main.procedure.apply_simp) rather than run. Use Game1.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.BR93.Game2.r {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                                Equations
                                                                                Instances For
                                                                                  instance GaudisCrypt.Examples.BR93.instIsGlobalVarRMk_1 {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                                  Game2.r.IsGlobalVar (VariableName.mk "GaudisCrypt.Examples.BR93.Game2.r" rand)
                                                                                  @[simp]
                                                                                  theorem GaudisCrypt.Examples.BR93.Game2.main.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :
                                                                                  Module.app main A = Module.proc (procedure.instantiate (A(Log(H.Lazy.LRO)).a1.procedure, A(Log(H.Lazy.LRO)).a2.procedure))

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

                                                                                  noncomputable def GaudisCrypt.Examples.BR93.Game2.main.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                                                  proctype () → Bool uses ((pkey) → ptxt × ptxt, (rand × ptxt) → Bool)

                                                                                  The body of proc main of module Game2, 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 Game2.main.procedure.apply_simp) rather than run. Use Game2.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.BR93.Game2.main.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (pkey) → ptxt × ptxt) (HoleSigs.cons (procsig (rand × ptxt) → Bool) HoleSigs.empty)).Instantiation) :
                                                                                    procedure.instantiate holeArgs✝ = proc () : Bool { var pk : pkey, sk : skey, m0 : ptxt, m1 : ptxt, b : Bool, h : ptxt, c : rand × ptxt, b' : Bool; call Log(H.Lazy.LRO).init.procedure (); pk, sk <$ dkeys; m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero) (§pk); b <$ EC.dbool; r <$ drand; h <$ dptxt; c <- (f §pk §r, §h); b' <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§c); return decide (§b' = §b) }

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

                                                                                    noncomputable def GaudisCrypt.Examples.BR93.Game2 {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

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

                                                                                    Equations
                                                                                    Instances For
                                                                                      noncomputable def GaudisCrypt.Examples.BR93.Game2.main {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :

                                                                                      proc main of module Game2 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 Game2.main.apply_simp, which fills the holes of Game2.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.BR93.Game2.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (A : Adv) :

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

                                                                                        instance GaudisCrypt.Examples.BR93.instIsGlobalVarXMk_1 {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                                        OWr.x.IsGlobalVar (VariableName.mk "GaudisCrypt.Examples.BR93.OWr.x" rand)
                                                                                        noncomputable def GaudisCrypt.Examples.BR93.OWr.x {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] :
                                                                                        Equations
                                                                                        Instances For
                                                                                          @[simp]
                                                                                          theorem GaudisCrypt.Examples.BR93.OWr.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (I : OW_rand.Inverter) :
                                                                                          OWr(I).main = Module.app main I

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

                                                                                          noncomputable def GaudisCrypt.Examples.BR93.OWr.main {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                                                          Module.Arr OW_rand.Inverter (procmod () → Bool)

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

                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For
                                                                                            theorem GaudisCrypt.Examples.BR93.OWr.main.procedure.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (holeArgs✝ : (HoleSigs.cons (procsig (pkey, rand) → rand) HoleSigs.empty).Instantiation) :
                                                                                            procedure.instantiate holeArgs✝ = proc () : Bool { var pk : pkey, sk : skey, x' : rand; pk, sk <$ dkeys; x <$ drand; x' <- call (holeArgs✝.lookup HoleIndex.zero) (§pk, f §pk §x); return decide (§x = §x') }

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

                                                                                            noncomputable def GaudisCrypt.Examples.BR93.OWr {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                                                            Module.Arr OW_rand.Inverter (procmod () → Bool)

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

                                                                                            Equations
                                                                                            Instances For
                                                                                              noncomputable def GaudisCrypt.Examples.BR93.OWr.main.procedure {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] :
                                                                                              proctype () → Bool uses ((pkey, rand) → rand)

                                                                                              The body of proc main of module OWr, 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 OWr.main.procedure.apply_simp) rather than run. Use OWr.main 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.BR93.OWr.main.apply_simp {ptxt rand pkey skey : Type} [_gaudiParam0 : Inhabited ptxt] [_gaudiParam1 : Inhabited rand] [_gaudiParam2 : Inhabited pkey] [_gaudiParam3 : Inhabited skey] [_gaudiParam4 : Params ptxt rand pkey skey] [_gaudiParam5 : DecidableEq ptxt] [_gaudiParam6 : DecidableEq rand] [_gaudiParam7 : Countable rand] (I : OW_rand.Inverter) :

                                                                                                @[simp]: applying OWr.main to the parameters proc main uses (I) is Module.proc (OWr.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.BR93.pr_Game0_Game1 {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] {R : Footprint VariableAssignment} [Module.ECGlob A R] [R.Restricted (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] (A_a1_ll : ∀ (O : H.POracle) [Module.Declared O R], O.o.procedure.IsLossless → A(O).a1.procedure.IsLossless) (A_a2_ll : ∀ (O : H.POracle) [Module.Declared O R], O.o.procedure.IsLossless → A(O).a2.procedure.IsLossless) (m : VariableAssignment) :
                                                                                                Pr[ BR93_CPA(A).main () @ &m : §res = true ] ≤ Pr[ Game1(A).main () @ &m : §res = true ] + Pr[ Game1(A).main () @ &m : §Game1.r ∈ §Log.qs ]
                                                                                                theorem GaudisCrypt.Examples.BR93.eq_Game1_Game2 {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] :
                                                                                                equiv[ Game1(A).main ~ Game2(A).main : ={(FVP.fvP A).touched_getter} ==> ={Log.qs.footprint.touched_getter, res} ∧ §Game1.r{1} = §Game2.r{2} ]
                                                                                                theorem GaudisCrypt.Examples.BR93.pr_Game1_Game2 {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] (m : VariableAssignment) :
                                                                                                Pr[ Game1(A).main () @ &m : §res = true ] = Pr[ Game2(A).main () @ &m : §res = true ]
                                                                                                theorem GaudisCrypt.Examples.BR93.pr_bad_Game1_Game2 {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] (m : VariableAssignment) :
                                                                                                Pr[ Game1(A).main () @ &m : §Game1.r ∈ §Log.qs ] = Pr[ Game2(A).main () @ &m : §Game2.r ∈ §Log.qs ]
                                                                                                theorem GaudisCrypt.Examples.BR93.pr_Game2 {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] {R : Footprint VariableAssignment} [Module.ECGlob A R] [R.Restricted (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] (A_a1_ll : ∀ (O : H.POracle) [Module.Declared O R], O.o.procedure.IsLossless → A(O).a1.procedure.IsLossless) (A_a2_ll : ∀ (O : H.POracle) [Module.Declared O R], O.o.procedure.IsLossless → A(O).a2.procedure.IsLossless) (m : VariableAssignment) :
                                                                                                Pr[ Game2(A).main () @ &m : §res = true ] = 1 / 2
                                                                                                theorem GaudisCrypt.Examples.BR93.OW_OWr {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (m : VariableAssignment) (I : OW_rand.Inverter) [Module.Declared I OWr.x.footprint] :
                                                                                                Pr[ OW_rand.OW(I).main () @ &m : §res = true ] = Pr[ OWr(I).main () @ &m : §res = true ]
                                                                                                theorem GaudisCrypt.Examples.BR93.pr_Game2_OW {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] (m : VariableAssignment) :
                                                                                                Pr[ Game2(A).main () @ &m : §Game2.r ∈ §Log.qs ] ≤ Pr[ OW_rand.OW(I(A)).main () @ &m : §res = true ]
                                                                                                theorem GaudisCrypt.Examples.BR93.Reduction {ptxt rand pkey skey : Type} [Inhabited ptxt] [Inhabited rand] [Inhabited pkey] [Inhabited skey] [Params ptxt rand pkey skey] [DecidableEq ptxt] [DecidableEq rand] [Countable rand] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] {R : Footprint VariableAssignment} [Module.ECGlob A R] [R.Restricted (H.Lazy.LRO.m.footprint ⊔ Log.qs.footprint ⊔ Game1.r.footprint ⊔ Game2.r.footprint ⊔ OWr.x.footprint)] (A_a1_ll : ∀ (O : H.POracle) [Module.Declared O R], O.o.procedure.IsLossless → A(O).a1.procedure.IsLossless) (A_a2_ll : ∀ (O : H.POracle) [Module.Declared O R], O.o.procedure.IsLossless → A(O).a2.procedure.IsLossless) (m : VariableAssignment) :
                                                                                                Pr[ BR93_CPA(A).main () @ &m : §res = true ] - 1 / 2 ≤ Pr[ OW_rand.OW(I(A)).main () @ &m : §res = true ]

                                                                                                The concrete instance (EC lines 425–659) #

                                                                                                We now consider a concrete instance:

                                                                                                The operators and axioms of the second half of EC's file: the lengths k, l, a set pkey * skey of keypairs with a lossless, full, uniform distribution dkeys, and a family f of trapdoor permutations over rand with inverse family fi.

                                                                                                Instances
                                                                                                  @[reducible, inline]
                                                                                                  abbrev GaudisCrypt.Examples.BR93Concrete.ptxt {pkey skey : Type} [Params pkey skey] :

                                                                                                  EC's clone import BitWord as Plaintext with op n <- k … rename "word" as "ptxt".

                                                                                                  Equations
                                                                                                  Instances For
                                                                                                    @[reducible, inline]
                                                                                                    abbrev GaudisCrypt.Examples.BR93Concrete.rand {pkey skey : Type} [Params pkey skey] :

                                                                                                    EC's clone import BitWord as Randomness with op n <- l … rename "word" as "rand".

                                                                                                    Equations
                                                                                                    Instances For
                                                                                                      theorem GaudisCrypt.Examples.BR93Concrete.gt0_n {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] :
                                                                                                      0 < n
                                                                                                      @[reducible, inline]
                                                                                                      abbrev GaudisCrypt.Examples.BR93Concrete.ctxt {pkey skey : Type} [Params pkey skey] :

                                                                                                      EC's clone import BitWord as Ciphertext with op n <- n … rename "word" as "ctxt".

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        @[reducible, inline]
                                                                                                        noncomputable abbrev GaudisCrypt.Examples.BR93Concrete.dptxt {pkey skey : Type} [Params pkey skey] :

                                                                                                        EC's Plaintext.DWord.dunifin, renamed dptxt.

                                                                                                        Equations
                                                                                                        Instances For
                                                                                                          @[reducible, inline]
                                                                                                          noncomputable abbrev GaudisCrypt.Examples.BR93Concrete.drand {pkey skey : Type} [Params pkey skey] :

                                                                                                          EC's Randomness.DWord.dunifin, renamed drand.

                                                                                                          Equations
                                                                                                          Instances For

                                                                                                            Parsing and Formatting

                                                                                                            def GaudisCrypt.Examples.BR93Concrete.cat {pkey skey : Type} [Params pkey skey] (r : rand) (p : ptxt) :

                                                                                                            EC's op (||) (r:rand) (p:ptxt) : ctxt = mkctxt ((ofrand r) ++ (ofptxt p)).

                                                                                                            Equations
                                                                                                            Instances For

                                                                                                              EC's op (||) (r:rand) (p:ptxt) : ctxt = mkctxt ((ofrand r) ++ (ofptxt p)).

                                                                                                              Equations
                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                              Instances For
                                                                                                                def GaudisCrypt.Examples.BR93Concrete.parse {pkey skey : Type} [Params pkey skey] (c : ctxt) :

                                                                                                                EC's op parse (c:ctxt): rand * ptxt.

                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Instances For
                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.parseK {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] (r : rand) (p : ptxt) :
                                                                                                                  parse (r ∥ p) = (r, p)
                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.formatI {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] (r : rand) (p : ptxt) (r' : rand) (p' : ptxt) :
                                                                                                                  r ∥ p = r' ∥ p' → (r, p) = (r', p')

                                                                                                                  Random Oracle

                                                                                                                  A Definition for OWTP Security

                                                                                                                  structure GaudisCrypt.Examples.BR93Concrete.Inverter.Structure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                  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
                                                                                                                    noncomputable def GaudisCrypt.Examples.BR93Concrete.Inverter.structure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                    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).

                                                                                                                    Equations
                                                                                                                    Instances For
                                                                                                                      @[simp]
                                                                                                                      theorem GaudisCrypt.Examples.BR93Concrete.Inverter.mk_destruct {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                      (mk theRecord✝).structure = theRecord✝

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

                                                                                                                      noncomputable def GaudisCrypt.Examples.BR93Concrete.Inverter.invert.utilities {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                      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]
                                                                                                                        theorem GaudisCrypt.Examples.BR93Concrete.Inverter.invert.mk_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                        (mk theRecord✝).invert = theRecord✝.invert

                                                                                                                        @[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.

                                                                                                                        @[implicit_reducible]
                                                                                                                        instance GaudisCrypt.Examples.BR93Concrete.instIsModuleInverter {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                        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
                                                                                                                        @[simp]
                                                                                                                        theorem GaudisCrypt.Examples.BR93Concrete.Inverter.destruct_mk {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theModule✝ : Inverter) :
                                                                                                                        mk theModule✝.structure = theModule✝

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

                                                                                                                        noncomputable def GaudisCrypt.Examples.BR93Concrete.Inverter.invert {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                        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, x, in that order (recorded in @[gaudiProcParamNames], a ProcedureSignature holding only their types).

                                                                                                                        Equations
                                                                                                                        Instances For
                                                                                                                          def GaudisCrypt.Examples.BR93Concrete.Inverter.typeRep {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                          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
                                                                                                                            def GaudisCrypt.Examples.BR93Concrete.Inverter {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                            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.

                                                                                                                            Equations
                                                                                                                            Instances For
                                                                                                                              @[reducible]
                                                                                                                              noncomputable def GaudisCrypt.Examples.BR93Concrete.Inverter.mk {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                              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
                                                                                                                              Instances For
                                                                                                                                noncomputable def GaudisCrypt.Examples.BR93Concrete.Exp_OW {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                Equations
                                                                                                                                Instances For
                                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.Exp_OW.main.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (holeArgs✝ : (HoleSigs.cons (procsig (pkey, rand) → rand) HoleSigs.empty).Instantiation) :
                                                                                                                                  procedure.instantiate holeArgs✝ = proc () : Bool { var pk : pkey, sk : skey, x : rand, x' : rand; pk, sk <$ dkeys; x <$ drand; x' <- call (holeArgs✝.lookup HoleIndex.zero) (§pk, f §pk §x); return decide (§x = §x') }

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

                                                                                                                                  @[simp]
                                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.Exp_OW.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (I : Inverter) :

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

                                                                                                                                  @[simp]
                                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.Exp_OW.main.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (I : Inverter) :

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

                                                                                                                                  noncomputable def GaudisCrypt.Examples.BR93Concrete.Exp_OW.main {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                  proc main of module Exp_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 Exp_OW.main.apply_simp, which fills the holes of Exp_OW.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.BR93Concrete.Exp_OW.main.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                    Equations
                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                    Instances For

                                                                                                                                      A Definition for CPA Security

                                                                                                                                      noncomputable def GaudisCrypt.Examples.BR93Concrete.SchemeProcs.structure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                      The record of a module's fields: SchemeProcs.structure m is SchemeProcs.Structure.mk applied to SchemeProcs.keygen, SchemeProcs.enc of m.

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

                                                                                                                                      Equations
                                                                                                                                      Instances For
                                                                                                                                        noncomputable def GaudisCrypt.Examples.BR93Concrete.SchemeProcs.keygen.utilities {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                        • SchemeProcs.keygen.utilities.accessorModule : SchemeProcs →ₘ … — the accessor as a module, a projection being a module morphism;
                                                                                                                                        • SchemeProcs.keygen.utilities.apply_simp — Module.app SchemeProcs.keygen.utilities.accessorModule m = SchemeProcs.keygen m: applying that module is the accessor;
                                                                                                                                        • SchemeProcs.keygen.utilities.expression_eq — the same at the level of expressions: (SchemeProcs.keygen m).expression = (SchemeProcs.keygen.utilities.proj m.expression).reduce.
                                                                                                                                        Equations
                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                        Instances For
                                                                                                                                          @[simp]
                                                                                                                                          theorem GaudisCrypt.Examples.BR93Concrete.SchemeProcs.mk_destruct {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                                          (mk theRecord✝).structure = theRecord✝

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

                                                                                                                                          @[implicit_reducible]
                                                                                                                                          instance GaudisCrypt.Examples.BR93Concrete.instIsModuleSchemeProcs {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                          Equations
                                                                                                                                          def GaudisCrypt.Examples.BR93Concrete.SchemeProcs.typeRep {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                          SchemeProcs is by definition Module SchemeProcs.typeRep.

                                                                                                                                          Equations
                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                          Instances For
                                                                                                                                            @[simp]
                                                                                                                                            theorem GaudisCrypt.Examples.BR93Concrete.SchemeProcs.destruct_mk {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theModule✝ : SchemeProcs) :
                                                                                                                                            mk theModule✝.structure = theModule✝

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

                                                                                                                                            noncomputable def GaudisCrypt.Examples.BR93Concrete.SchemeProcs.keygen {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :
                                                                                                                                            SchemeProcs → procmod () → (pkey × skey)

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

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

                                                                                                                                            It takes no parameters (recorded in @[gaudiProcParamNames]).

                                                                                                                                            Equations
                                                                                                                                            Instances For
                                                                                                                                              structure GaudisCrypt.Examples.BR93Concrete.SchemeProcs.Structure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                              Instances For
                                                                                                                                                def GaudisCrypt.Examples.BR93Concrete.SchemeProcs {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                                Equations
                                                                                                                                                Instances For
                                                                                                                                                  noncomputable def GaudisCrypt.Examples.BR93Concrete.SchemeProcs.enc.utilities {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                                  • SchemeProcs.enc.utilities.accessorModule : SchemeProcs →ₘ … — the accessor as a module, a projection being a module morphism;
                                                                                                                                                  • SchemeProcs.enc.utilities.apply_simp — Module.app SchemeProcs.enc.utilities.accessorModule m = SchemeProcs.enc m: applying that module is the accessor;
                                                                                                                                                  • SchemeProcs.enc.utilities.expression_eq — the same at the level of expressions: (SchemeProcs.enc m).expression = (SchemeProcs.enc.utilities.proj m.expression).reduce.
                                                                                                                                                  Equations
                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                  Instances For
                                                                                                                                                    @[simp]
                                                                                                                                                    theorem GaudisCrypt.Examples.BR93Concrete.SchemeProcs.enc.mk_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                                                    (mk theRecord✝).enc = theRecord✝.enc

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

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

                                                                                                                                                    @[reducible]
                                                                                                                                                    noncomputable def GaudisCrypt.Examples.BR93Concrete.SchemeProcs.mk {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                                    Equations
                                                                                                                                                    Instances For
                                                                                                                                                      noncomputable def GaudisCrypt.Examples.BR93Concrete.SchemeProcs.enc {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                                      SchemeProcs.enc.mk_simp reads this field back off a module built by SchemeProcs.mk; SchemeProcs.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
                                                                                                                                                      Instances For
                                                                                                                                                        @[simp]
                                                                                                                                                        theorem GaudisCrypt.Examples.BR93Concrete.SchemeProcs.keygen.mk_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                                                        (mk theRecord✝).keygen = theRecord✝.keygen

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

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

                                                                                                                                                        @[reducible, inline]
                                                                                                                                                        abbrev GaudisCrypt.Examples.BR93Concrete.Scheme {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] :

                                                                                                                                                        EC's module type Scheme (RO : Oracle) = { proc keygen(): (pkey * skey) proc enc(pk:pkey, m:ptxt): ctxt }.

                                                                                                                                                        Equations
                                                                                                                                                        Instances For
                                                                                                                                                          @[implicit_reducible]
                                                                                                                                                          instance GaudisCrypt.Examples.BR93Concrete.instIsModuleAdvProcs {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                                          Equations
                                                                                                                                                          def GaudisCrypt.Examples.BR93Concrete.AdvProcs {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                                          Equations
                                                                                                                                                          Instances For
                                                                                                                                                            @[simp]
                                                                                                                                                            theorem GaudisCrypt.Examples.BR93Concrete.AdvProcs.mk_destruct {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                                                            (mk theRecord✝).structure = theRecord✝

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

                                                                                                                                                            noncomputable def GaudisCrypt.Examples.BR93Concrete.AdvProcs.a1 {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

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

                                                                                                                                                            Equations
                                                                                                                                                            Instances For
                                                                                                                                                              noncomputable def GaudisCrypt.Examples.BR93Concrete.AdvProcs.a1.utilities {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                                              • AdvProcs.a1.utilities.accessorModule : AdvProcs →ₘ … — the accessor as a module, a projection being a module morphism;
                                                                                                                                                              • AdvProcs.a1.utilities.apply_simp — Module.app AdvProcs.a1.utilities.accessorModule m = AdvProcs.a1 m: applying that module is the accessor;
                                                                                                                                                              • AdvProcs.a1.utilities.expression_eq — the same at the level of expressions: (AdvProcs.a1 m).expression = (AdvProcs.a1.utilities.proj m.expression).reduce.
                                                                                                                                                              Equations
                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                              Instances For
                                                                                                                                                                @[simp]
                                                                                                                                                                theorem GaudisCrypt.Examples.BR93Concrete.AdvProcs.destruct_mk {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theModule✝ : AdvProcs) :
                                                                                                                                                                mk theModule✝.structure = theModule✝

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

                                                                                                                                                                noncomputable def GaudisCrypt.Examples.BR93Concrete.AdvProcs.a2 {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                                                AdvProcs.a2.mk_simp reads this field back off a module built by AdvProcs.mk; AdvProcs.a2.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
                                                                                                                                                                Instances For
                                                                                                                                                                  noncomputable def GaudisCrypt.Examples.BR93Concrete.AdvProcs.structure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                  The record of a module's fields: AdvProcs.structure m is AdvProcs.Structure.mk applied to AdvProcs.a1, AdvProcs.a2 of m.

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

                                                                                                                                                                  Equations
                                                                                                                                                                  Instances For
                                                                                                                                                                    structure GaudisCrypt.Examples.BR93Concrete.AdvProcs.Structure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                                                    Instances For
                                                                                                                                                                      def GaudisCrypt.Examples.BR93Concrete.AdvProcs.typeRep {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                                                      AdvProcs is by definition Module AdvProcs.typeRep.

                                                                                                                                                                      Equations
                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                      Instances For
                                                                                                                                                                        @[simp]
                                                                                                                                                                        theorem GaudisCrypt.Examples.BR93Concrete.AdvProcs.a1.mk_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                                                                        (mk theRecord✝).a1 = theRecord✝.a1

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

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

                                                                                                                                                                        @[reducible]
                                                                                                                                                                        noncomputable def GaudisCrypt.Examples.BR93Concrete.AdvProcs.mk {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

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

                                                                                                                                                                        Equations
                                                                                                                                                                        Instances For
                                                                                                                                                                          noncomputable def GaudisCrypt.Examples.BR93Concrete.AdvProcs.a2.utilities {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                                                          • AdvProcs.a2.utilities.accessorModule : AdvProcs →ₘ … — the accessor as a module, a projection being a module morphism;
                                                                                                                                                                          • AdvProcs.a2.utilities.apply_simp — Module.app AdvProcs.a2.utilities.accessorModule m = AdvProcs.a2 m: applying that module is the accessor;
                                                                                                                                                                          • AdvProcs.a2.utilities.expression_eq — the same at the level of expressions: (AdvProcs.a2 m).expression = (AdvProcs.a2.utilities.proj m.expression).reduce.
                                                                                                                                                                          Equations
                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                          Instances For
                                                                                                                                                                            @[simp]
                                                                                                                                                                            theorem GaudisCrypt.Examples.BR93Concrete.AdvProcs.a2.mk_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (theRecord✝ : Structure) :
                                                                                                                                                                            (mk theRecord✝).a2 = theRecord✝.a2

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

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

                                                                                                                                                                            @[reducible, inline]
                                                                                                                                                                            abbrev GaudisCrypt.Examples.BR93Concrete.Adv {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] :

                                                                                                                                                                            EC's module type Adv (ARO : POracle) = { proc a1(p:pkey): (ptxt * ptxt) proc a2(c:ctxt): bool }.

                                                                                                                                                                            Equations
                                                                                                                                                                            Instances For
                                                                                                                                                                              @[simp]
                                                                                                                                                                              theorem GaudisCrypt.Examples.BR93Concrete.CPA.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (O : H.Oracle) (S : Scheme) (A : Adv) :
                                                                                                                                                                              CPA(O, S, A).main = Module.app (Module.app (Module.app main O) S) A

                                                                                                                                                                              @[simp]: applying CPA to a tuple of its 3 parameters O, 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.

                                                                                                                                                                              noncomputable def GaudisCrypt.Examples.BR93Concrete.CPA.main {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                              proc main of module CPA as a module, abstracted over the module parameters it uses (O, 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
                                                                                                                                                                                noncomputable def GaudisCrypt.Examples.BR93Concrete.CPA {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                The module declared by module CPA, abstracted over its 3 parameters O, 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
                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                Instances For
                                                                                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.CPA.main.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (holeArgs✝ : (HoleSigs.cons (procsig () → Unit) (HoleSigs.cons (procsig () → pkey × skey) (HoleSigs.cons (procsig (pkey) → ptxt × ptxt) (HoleSigs.cons (procsig (pkey, ptxt) → ctxt) (HoleSigs.cons (procsig (ctxt) → Bool) HoleSigs.empty))))).Instantiation) :
                                                                                                                                                                                  procedure.instantiate holeArgs✝ = proc () : Bool { var pk : pkey, sk : skey, m0 : ptxt, m1 : ptxt, b : Bool, c : ctxt, b' : Bool; call (holeArgs✝.lookup HoleIndex.zero) (); pk, sk <- call (holeArgs✝.lookup HoleIndex.zero.succ) (); m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ) (§pk); b <$ EC.dbool; c <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ.succ) (§pk, if §b = true then §m0 else §m1); b' <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ.succ.succ) (§c); return decide (§b' = §b) }

                                                                                                                                                                                  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]).

                                                                                                                                                                                  noncomputable def GaudisCrypt.Examples.BR93Concrete.CPA.main.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                  The body of proc main of module CPA, as a procedure of its own: the 5 calls it makes to module parameters (O, 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
                                                                                                                                                                                    @[simp]
                                                                                                                                                                                    theorem GaudisCrypt.Examples.BR93Concrete.CPA.main.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (O : H.Oracle) (S : Scheme) (A : Adv) :

                                                                                                                                                                                    @[simp]: applying CPA.main to the parameters proc main uses (O, 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.

                                                                                                                                                                                    And a definition for the concrete Bellare-Rogaway Scheme

                                                                                                                                                                                    noncomputable def GaudisCrypt.Examples.BR93Concrete.BR {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                    The module declared by module BR, abstracted over its single parameter H, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the module type it was declared with.

                                                                                                                                                                                    Applied to such a tuple it is the record of its procedures BR.keygen, BR.enc, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma BR.apply_simp says.

                                                                                                                                                                                    Equations
                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      theorem GaudisCrypt.Examples.BR93Concrete.BR.enc.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (holeArgs✝ : (HoleSigs.cons (procsig (rand) → ptxt) HoleSigs.empty).Instantiation) :
                                                                                                                                                                                      procedure.instantiate holeArgs✝ = proc (pk : pkey, m : ptxt) : ctxt { var r : rand, h : ptxt; r <$ drand; h <- call (holeArgs✝.lookup HoleIndex.zero) (§r); return f §pk §r ∥ §m +^ §h }

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

                                                                                                                                                                                      noncomputable def GaudisCrypt.Examples.BR93Concrete.BR.enc.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                      The body of proc enc of module BR, as a procedure of its own: the one call it makes to a module parameter (H) 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 BR.enc.procedure.apply_simp) rather than run. Use BR.enc 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.BR93Concrete.BR.dec.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                        The body of proc dec of module BR, as a procedure of its own: the one call it makes to a module parameter (H) 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 BR.dec.procedure.apply_simp) rather than run. Use BR.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.BR93Concrete.BR.keygen.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                                                                                                                                                                          procedure.instantiate holeArgs✝ = proc () : (pkey × skey) { var pk : pkey, sk : skey; pk, sk <$ dkeys; return (§pk, §sk) }

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

                                                                                                                                                                                          noncomputable def GaudisCrypt.Examples.BR93Concrete.BR.keygen.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :
                                                                                                                                                                                          proctype () -> pkey × skey

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

                                                                                                                                                                                          Equations
                                                                                                                                                                                          Instances For
                                                                                                                                                                                            noncomputable def GaudisCrypt.Examples.BR93Concrete.BR.keygen {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :
                                                                                                                                                                                            procmod () → (pkey × skey)

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

                                                                                                                                                                                            Equations
                                                                                                                                                                                            Instances For
                                                                                                                                                                                              noncomputable def GaudisCrypt.Examples.BR93Concrete.BR.dec {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                              proc dec of module BR as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                                                                                                                                                              Apply it with the @[simp] lemma BR.dec.apply_simp, which fills the holes of BR.dec.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.BR93Concrete.BR.dec.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (H : H.Oracle) :

                                                                                                                                                                                                @[simp]: applying BR.dec to the parameters proc dec uses (H) is Module.proc (BR.dec.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.BR93Concrete.BR.enc.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (H : H.Oracle) :

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

                                                                                                                                                                                                noncomputable def GaudisCrypt.Examples.BR93Concrete.BR.enc {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                                proc enc of module BR as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                                                                                                                                                                Apply it with the @[simp] lemma BR.enc.apply_simp, which fills the holes of BR.enc.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.BR93Concrete.BR.keygen.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

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

                                                                                                                                                                                                  @[simp]
                                                                                                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.BR.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (H : H.Oracle) :

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

                                                                                                                                                                                                  theorem GaudisCrypt.Examples.BR93Concrete.BR.dec.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (holeArgs✝ : (HoleSigs.cons (procsig (rand) → ptxt) HoleSigs.empty).Instantiation) :
                                                                                                                                                                                                  procedure.instantiate holeArgs✝ = proc (sk : skey, c : ctxt) : ptxt { var r : rand, p : ptxt, h : ptxt; r, p <- parse §c; r <- fi §sk §r; h <- call (holeArgs✝.lookup HoleIndex.zero) (§r); return §p +^ §h }

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

                                                                                                                                                                                                  And our inverter

                                                                                                                                                                                                  instance GaudisCrypt.Examples.BR93Concrete.instIsGlobalVarListRandQsMk {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] :
                                                                                                                                                                                                  I.qs.IsGlobalVar (VariableName.mk "GaudisCrypt.Examples.BR93Concrete.I.qs" (List rand))
                                                                                                                                                                                                  noncomputable def GaudisCrypt.Examples.BR93Concrete.I.qs {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] :
                                                                                                                                                                                                  Equations
                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                    The body of proc o of module I.QRO, as a procedure of its own: the one call it makes to a module parameter (H) 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 I.QRO.o.procedure.apply_simp) rather than run. Use I.QRO.o 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.BR93Concrete.I.QRO {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] :
                                                                                                                                                                                                      Module.Arr H.Oracle H.POracle

                                                                                                                                                                                                      The module declared by module I.QRO, abstracted over its single parameter H, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the module type it was declared with.

                                                                                                                                                                                                      Applied to such a tuple it is the record of its procedures I.QRO.o, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma I.QRO.apply_simp says.

                                                                                                                                                                                                      Equations
                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                        @[simp]

                                                                                                                                                                                                        @[simp]: applying I.QRO.o to the parameters proc o uses (H) is Module.proc (I.QRO.o.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.BR93Concrete.I.QRO.apply_simp {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] (H : H.Oracle) :

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

                                                                                                                                                                                                        theorem GaudisCrypt.Examples.BR93Concrete.I.QRO.o.procedure.apply_simp {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] (holeArgs✝ : (HoleSigs.cons (procsig (rand) → ptxt) HoleSigs.empty).Instantiation) :
                                                                                                                                                                                                        procedure.instantiate holeArgs✝ = proc (x : rand) : ptxt { var r : ptxt; qs <- §x :: §qs; r <- call (holeArgs✝.lookup HoleIndex.zero) (§x); return §r }

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

                                                                                                                                                                                                        noncomputable def GaudisCrypt.Examples.BR93Concrete.I.QRO.o {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] :

                                                                                                                                                                                                        proc o of module I.QRO as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                                                                                                                                                                        Apply it with the @[simp] lemma I.QRO.o.apply_simp, which fills the holes of I.QRO.o.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.BR93Concrete.I.invert.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                                          The body of proc invert of module I, as a procedure of its own: the 3 calls it makes to module parameters (A, H) 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 I.invert.procedure.apply_simp) rather than run. Use I.invert 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.BR93Concrete.I.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) (H : H.Oracle) :
                                                                                                                                                                                                            I(A, H).invert = Module.app (Module.app invert A) H

                                                                                                                                                                                                            @[simp]: applying I to a tuple of its 2 parameters A, H — the record of its procedures I.invert, 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 I.invert.apply_simp to fill that procedure's holes.

                                                                                                                                                                                                            @[simp]
                                                                                                                                                                                                            theorem GaudisCrypt.Examples.BR93Concrete.I.invert.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) (H : H.Oracle) :

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

                                                                                                                                                                                                            noncomputable def GaudisCrypt.Examples.BR93Concrete.I {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                                            The module declared by module I, abstracted over its 2 parameters A, H, 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 I.invert, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma I.apply_simp says.

                                                                                                                                                                                                            Equations
                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                              theorem GaudisCrypt.Examples.BR93Concrete.I.invert.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (holeArgs✝ : (HoleSigs.cons (procsig () → Unit) (HoleSigs.cons (procsig (pkey) → ptxt × ptxt) (HoleSigs.cons (procsig (ctxt) → Bool) HoleSigs.empty))).Instantiation) :
                                                                                                                                                                                                              procedure.instantiate holeArgs✝ = proc (pk : pkey, y : rand) : rand { var m0 : ptxt, m1 : ptxt, h : ptxt, b : Bool, x : rand; qs <- []; call (holeArgs✝.lookup HoleIndex.zero) (); m0, m1 <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§pk); h <$ dptxt; b <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ) (§y ∥ §h); x <- EC.nth default (§qs) (EC.find (fun (p : EC.BitWord.word l) => decide (f (§pk) p = §y)) §qs); return §x }

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

                                                                                                                                                                                                              noncomputable def GaudisCrypt.Examples.BR93Concrete.I.invert {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] :

                                                                                                                                                                                                              proc invert of module I as a module, abstracted over the module parameters it uses (A, H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                                                                                                                                                                              Apply it with the @[simp] lemma I.invert.apply_simp, which fills the holes of I.invert.procedure with the callees the body called.

                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                We will need to turn a concrete CPA adversary into an abstract one. We do not need to do it for the inverter as the types coincide.

                                                                                                                                                                                                                theorem GaudisCrypt.Examples.BR93Concrete.A_CPA.a1.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) (holeArgs✝ : (HoleSigs.cons (procsig (pkey) → ptxt × ptxt) HoleSigs.empty).Instantiation) :
                                                                                                                                                                                                                (procedure A).instantiate holeArgs✝ = proc (p : pkey) : (ptxt × ptxt) { var r : ptxt × ptxt; r <- call (holeArgs✝.lookup HoleIndex.zero) (§p); return §r }

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

                                                                                                                                                                                                                @[simp]
                                                                                                                                                                                                                theorem GaudisCrypt.Examples.BR93Concrete.A_CPA.a2.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) (H : H.POracle) :

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

                                                                                                                                                                                                                noncomputable def GaudisCrypt.Examples.BR93Concrete.A_CPA.a2 {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) :

                                                                                                                                                                                                                proc a2 of module A_CPA as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                                                                                                                                                                                Apply it with the @[simp] lemma A_CPA.a2.apply_simp, which fills the holes of A_CPA.a2.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.BR93Concrete.A_CPA.a2.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) :

                                                                                                                                                                                                                  The body of proc a2 of module A_CPA, as a procedure of its own: the one call it makes to a module parameter (H) 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 A_CPA.a2.procedure.apply_simp) rather than run. Use A_CPA.a2 for this procedure as a module.

                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                    theorem GaudisCrypt.Examples.BR93Concrete.A_CPA.a2.procedure.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) (holeArgs✝ : (HoleSigs.cons (procsig (ctxt) → Bool) HoleSigs.empty).Instantiation) :
                                                                                                                                                                                                                    (procedure A).instantiate holeArgs✝ = proc (c : rand × ptxt) : Bool { var b : Bool; b <- call (holeArgs✝.lookup HoleIndex.zero) ((§c).1 ∥ (§c).2); return §b }

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

                                                                                                                                                                                                                    noncomputable def GaudisCrypt.Examples.BR93Concrete.A_CPA {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) :
                                                                                                                                                                                                                    Module.Arr H.POracle Instance.AdvProcs

                                                                                                                                                                                                                    The module declared by module A_CPA, abstracted over its single parameter H, which it takes as one right-nested tuple: Module.Arr (T₁ ×ₘ (… ×ₘ Tₙ)) M, with M the module type it was declared with.

                                                                                                                                                                                                                    Applied to such a tuple it is the record of its procedures A_CPA.a1, A_CPA.a2, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma A_CPA.apply_simp says.

                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                      @[simp]
                                                                                                                                                                                                                      theorem GaudisCrypt.Examples.BR93Concrete.A_CPA.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) (H : H.POracle) :

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

                                                                                                                                                                                                                      noncomputable def GaudisCrypt.Examples.BR93Concrete.A_CPA.a1.procedure {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) :

                                                                                                                                                                                                                      The body of proc a1 of module A_CPA, as a procedure of its own: the one call it makes to a module parameter (H) 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 A_CPA.a1.procedure.apply_simp) rather than run. Use A_CPA.a1 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.BR93Concrete.A_CPA.a1.apply_simp {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) (H : H.POracle) :

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

                                                                                                                                                                                                                        noncomputable def GaudisCrypt.Examples.BR93Concrete.A_CPA.a1 {pkey skey : Type} [_gaudiParam0 : Inhabited pkey] [_gaudiParam1 : Inhabited skey] [_gaudiParam2 : Params pkey skey] (A : Adv) :

                                                                                                                                                                                                                        proc a1 of module A_CPA as a module, abstracted over the module parameters it uses (H, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                                                                                                                                                                                        Apply it with the @[simp] lemma A_CPA.a1.apply_simp, which fills the holes of A_CPA.a1.procedure with the callees the body called.

                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                          theorem GaudisCrypt.Examples.BR93Concrete.fvP_A_CPA {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] (A : Adv) :

                                                                                                                                                                                                                          A_CPA(A) touches what A does. Not an EC lemma.

                                                                                                                                                                                                                          EC's glob A_CPA(A): glob A (A_CPA has no variables).

                                                                                                                                                                                                                          theorem GaudisCrypt.Examples.BR93Concrete.Reduction {pkey skey : Type} [Inhabited pkey] [Inhabited skey] [Params pkey skey] (A : Adv) [Module.Declared A (H.Lazy.LRO.m.footprint ⊔ I.qs.footprint ⊔ Instance.Log.qs.footprint ⊔ Instance.H.Lazy.LRO.m.footprint ⊔ Instance.Game1.r.footprint ⊔ Instance.Game2.r.footprint ⊔ Instance.OWr.x.footprint)] (A_a1_ll : ∀ (O : H.POracle) [Module.Declared O (FVP.fvP A).glob], O.o.procedure.IsLossless → A(O).a1.procedure.IsLossless) (A_a2_ll : ∀ (O : H.POracle) [Module.Declared O (FVP.fvP A).glob], O.o.procedure.IsLossless → A(O).a2.procedure.IsLossless) (m : VariableAssignment) :
                                                                                                                                                                                                                          Pr[ CPA(H.Lazy.LRO, BR, A).main () @ &m : §res = true ] - 1 / 2 ≤ Pr[ Exp_OW(I(A, H.Lazy.LRO)).main () @ &m : §res = true ]