Documentation

GaudisCrypt.Examples.SHA3.SmartCounter.Gext

The extension event (EasyCrypt proof/smart_counter/Gext.eca) — EC-fidelity port #

Real_G2 bounds the real game by the eager G2 plus the switching bound and the probabilities of collisions (Pr_G1col) and extensions (Pr_ext, through the resampling game Gext). Over the old port's declarations of G2, Eager, RRO (section FirstPort below), as SmartCounter/Handle.lean and SmartCounter/Gcol.lean.

Translation:

Declarations of the first port #

Definitions and plain lemmas of the first port of this file (2026-10/11) that the proofs below use; its program-logic proofs are gone.

The first port's translation notes (some mention declarations that went with its proofs):

The game G2 #

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

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

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

    @[simp]: applying G2.M.f to the parameters proc f uses (HS) is Module.proc (G2.M.f.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]

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

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

    Equations
    Instances For

      proc f of module G2.M as a module, abstracted over the module parameters it uses (HS, in declaration order): Module.Arr … (Module.Proc (procsig …)).

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

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

        @[simp]: applying G2.S.f to the parameters proc f uses (HS) is Module.proc (G2.S.f.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.

        The module declared by module G2.S, abstracted over its single parameter HS, 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 G2.S.f, G2.S.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma G2.S.apply_simp says.

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

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

          proc fi of module G2.S as a module, abstracted over the module parameters it uses (HS, in declaration order): Module.Arr … (Module.Proc (procsig …)).

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

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem GaudisCrypt.SHA3.Gext.G2.S.f.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : (HoleSigs.cons (procsig () → EC.FMap SLCommon.handle Common.capacity) (HoleSigs.cons (procsig (SLCommon.handle, Common.capacity) → Unit) (HoleSigs.cons (procsig (SLCommon.handle, EC.PROM.flag) → Bool) (HoleSigs.cons (procsig (SLCommon.handle) → Common.capacity) HoleSigs.empty)))).Instantiation) :
            procedure.instantiate holeArgs✝ = proc (x : state) : state { var p : List Common.block, v : Common.block, y1 : Common.block, y2 : Common.capacity, y : state, handles_ : EC.FMap SLCommon.handle Common.capacity, hx2 : SLCommon.handle, t : Bool, hy2 : SLCommon.handle; if (!decide (EC.FMap.dom §Handle.G1.m §x)) { if (decide ((§Handle.G1.paths).dom (§x).2)) { p, v <- EC.oget ((§Handle.G1.paths).get (§x).2); y1 <- call (EC.PROM.FullRO.ROmap.get (List Common.block) Common.block SLCommon.F.RO).procedure (EC.rcons (§p) (§v +^ (§x).1)); y2 <$ Common.cdistr; } else { y1 <$ Common.bdistr; y2 <$ Common.cdistr; } y <- (§y1, §y2); handles_ <- call (holeArgs✝.lookup HoleIndex.zero) (); if (!decide ((§handles_).rng (§x).2)) { call (holeArgs✝.lookup HoleIndex.zero.succ) (§Handle.G1.chandle, (§x).2); Handle.G1.chandle <- §Handle.G1.chandle + 1; } handles_ <- call (holeArgs✝.lookup HoleIndex.zero) (); hx2 <- EC.oget (hinvc (§handles_) (§x).2); t <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ) ((EC.oget (EC.FMap.get §Handle.G1.mh ((§x).1, §hx2))).2, EC.PROM.Unknown); if (decide (EC.FMap.dom §Handle.G1.mh ((§x).1, §hx2)) && §t) { hy2 <- (EC.oget (EC.FMap.get §Handle.G1.mh ((§x).1, §hx2))).2; y2 <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ.succ) (§hy2); Handle.G1.bext <- §Handle.G1.bext || decide (bad_ext §Handle.G1.m §Handle.G1.mi §y2) || decide (§y2 = (§x).2); y <- ((§y).1, §y2); Handle.G1.m <- EC.FMap.set §Handle.G1.m §x §y; Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §y §x; } else { hy2 <- §Handle.G1.chandle; Handle.G1.chandle <- §Handle.G1.chandle + 1; call (holeArgs✝.lookup HoleIndex.zero.succ) (§hy2, (§y).2); Handle.G1.m <- EC.FMap.set §Handle.G1.m §x §y; Handle.G1.mh <- EC.FMap.set §Handle.G1.mh ((§x).1, §hx2) ((§y).1, §hy2); Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §y §x; Handle.G1.mhi <- EC.FMap.set §Handle.G1.mhi ((§y).1, §hy2) ((§x).1, §hx2); } if (decide ((§Handle.G1.paths).dom (§x).2)) { p, v <- EC.oget ((§Handle.G1.paths).get (§x).2); Handle.G1.paths <- (§Handle.G1.paths).set (§y).2 (EC.rcons (§p) (§v +^ (§x).1), (§y).1); } } else { y <- EC.oget (EC.FMap.get §Handle.G1.m §x); } return §y }

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

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

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem GaudisCrypt.SHA3.Gext.G2.S.fi.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : (HoleSigs.cons (procsig () → EC.FMap SLCommon.handle Common.capacity) (HoleSigs.cons (procsig (SLCommon.handle, Common.capacity) → Unit) (HoleSigs.cons (procsig (SLCommon.handle, EC.PROM.flag) → Bool) (HoleSigs.cons (procsig (SLCommon.handle) → Common.capacity) HoleSigs.empty)))).Instantiation) :
              procedure.instantiate holeArgs✝ = proc (x : state) : state { var handles_ : EC.FMap SLCommon.handle Common.capacity, hx2 : SLCommon.handle, y1 : Common.block, y2 : Common.capacity, y : state, t : Bool, hy2 : SLCommon.handle; if (!decide (EC.FMap.dom §Handle.G1.mi §x)) { handles_ <- call (holeArgs✝.lookup HoleIndex.zero) (); if (!decide ((§handles_).rng (§x).2)) { call (holeArgs✝.lookup HoleIndex.zero.succ) (§Handle.G1.chandle, (§x).2); Handle.G1.chandle <- §Handle.G1.chandle + 1; } handles_ <- call (holeArgs✝.lookup HoleIndex.zero) (); hx2 <- EC.oget (hinvc (§handles_) (§x).2); y1 <$ Common.bdistr; y2 <$ Common.cdistr; y <- (§y1, §y2); t <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ) ((EC.oget (EC.FMap.get §Handle.G1.mhi ((§x).1, §hx2))).2, EC.PROM.Unknown); if (decide (EC.FMap.dom §Handle.G1.mhi ((§x).1, §hx2)) && §t) { y1, hy2 <- EC.oget (EC.FMap.get §Handle.G1.mhi ((§x).1, §hx2)); y2 <- call (holeArgs✝.lookup HoleIndex.zero.succ.succ.succ) (§hy2); y <- ((§y).1, §y2); Handle.G1.bext <- §Handle.G1.bext || decide (bad_ext §Handle.G1.m §Handle.G1.mi §y2) || decide (§y2 = (§x).2); Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §x §y; Handle.G1.m <- EC.FMap.set §Handle.G1.m §y §x; } else { hy2 <- §Handle.G1.chandle; Handle.G1.chandle <- §Handle.G1.chandle + 1; call (holeArgs✝.lookup HoleIndex.zero.succ) (§hy2, (§y).2); Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §x §y; Handle.G1.mhi <- EC.FMap.set §Handle.G1.mhi ((§x).1, §hx2) ((§y).1, §hy2); Handle.G1.m <- EC.FMap.set §Handle.G1.m §y §x; Handle.G1.mh <- EC.FMap.set §Handle.G1.mh ((§y).1, §hy2) ((§x).1, §hx2); } } else { y <- EC.oget (EC.FMap.get §Handle.G1.mi §x); } return §y }

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

              @[simp]

              @[simp]: applying G2.S.fi to the parameters proc fi uses (HS) is Module.proc (G2.S.fi.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.

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

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

                proc f of module G2.S as a module, abstracted over the module parameters it uses (HS, in declaration order): Module.Arr … (Module.Proc (procsig …)).

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

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

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

                  @[simp]

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

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

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

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

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

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

                      @[simp]: applying G2.distinguish to the parameters proc distinguish uses (HS) is Module.proc (G2.distinguish.procedure.instantiate …) — the procedure with its holes filled by the callees they were made from, each written as it was in the body (with the arguments in place of the module parameters) and turned into a Procedure by Module.Proc.procedure.

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

                      Equations
                      Instances For

                        G2(DRestr(D)) touches glob D and the variables of C, F.RO and G1 (not FRO.m). Not an EC lemma: EasyCrypt reads a concrete module's globals off its code (for Eager_1_2's side conditions, in Real_G2).

                        @[reducible, inline]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[reducible, inline]
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            @[reducible, inline]
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[reducible, inline]
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[reducible, inline]
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  The first section: G1 and the lazy G2 #

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Equations
                                    Instances For
                                      theorem GaudisCrypt.SHA3.Gext.rng_restr {«from» «to» φ : Type} [DecidableEq «from»] [DecidableEq φ] (m : EC.FMap «from» («to» × φ)) (f : φ) (x : «to») :
                                      (EC.FMap.restr f m).rng x ↔ m.rng (x, f)

                                      cdistr is lossless (DCapacity.dunifin_ll), as an expectation.

                                      theorem GaudisCrypt.SHA3.Gext.inv_ext_set_fresh [SLCommon.Params] {m mi : SLCommon.smap} {F : SLCommon.handles} {ch : ℤ} (hf : ∀ (h : ℤ), EC.FMap.dom F h → h < ch) (v : Common.capacity × EC.PROM.flag) (h : inv_ext m mi F) :
                                      inv_ext m mi (EC.FMap.set F ch v)

                                      A write at a fresh handle keeps inv_ext.

                                      theorem GaudisCrypt.SHA3.Gext.fresh_set [SLCommon.Params] {F : SLCommon.handles} {ch : ℤ} (hf : ∀ (h : ℤ), EC.FMap.dom F h → h < ch) (v : Common.capacity × EC.PROM.flag) (h : ℤ) :
                                      (EC.FMap.set F ch v).dom h → h < ch + 1

                                      The handles stay below G1.chandle after a write at it and its increment.

                                      A fresh write keeps the bindings of F.

                                      inv_ext for an extension of F.

                                      G1's update of G1.bext at the start of S.f, S.fi, against inv_ext1: the bad event, an unknown handle for x.2, or inv_ext, all for the (extended) map F'.

                                      theorem GaudisCrypt.SHA3.Gext.inv_ext1_of_weak [SLCommon.Params] {b1 b2 : Bool} {m mi m' mi' : SLCommon.smap} {F F' : SLCommon.handles} {x : state} (hb : b1 = true → b2 = true ∨ EC.FMap.rng F (x.2, EC.PROM.Unknown) ∨ inv_ext m mi F) (hx : x ∈ EC.FMap.fdom m' ∪ EC.FMap.fdom mi') (hm : EC.FMap.fdom m ∪ EC.FMap.fdom mi ⊆ EC.FMap.fdom m' ∪ EC.FMap.fdom mi') (hF : ∀ (h : SLCommon.handle) (v : SLCommon.ccapacity), EC.FMap.get F h = some v → EC.FMap.get F' h = some v) :
                                      inv_ext1 b1 b2 m' mi' F'

                                      Back to inv_ext1 from the weakened implication, after x entered G1.m or G1.mi and F grew.

                                      inv_ext1_of_weak when the unknown handle hy is resampled (G2's FRO.get): a witness at hy makes G2's update of G1.bext fire.

                                      The section EXT #

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          theorem GaudisCrypt.SHA3.Gext.fset0_eqP {α : Type} (s : EC.FSet α) :
                                          s = EC.FSet.fset0 ↔ ∀ (x : α), x ∉ s
                                          theorem GaudisCrypt.SHA3.Gext.size_set {α β : Type} [DecidableEq α] (m : EC.FMap α β) (x : α) (y : β) :
                                          ↑(m.set x y).fdom.card = ↑(if m.dom x then m.fdom.card else m.fdom.card + 1)
                                          theorem GaudisCrypt.SHA3.Gext.size_set_le {α β : Type} [DecidableEq α] (m : EC.FMap α β) (x : α) (y : β) :
                                          ↑(m.set x y).fdom.card ≤ ↑m.fdom.card + 1
                                          theorem GaudisCrypt.SHA3.Gext.size_rem {α β : Type} [DecidableEq α] (m : EC.FMap α β) (x : α) :
                                          ↑(m.rem x).fdom.card = ↑(if m.dom x then m.fdom.card - 1 else m.fdom.card)
                                          theorem GaudisCrypt.SHA3.Gext.size_rem_le {α β : Type} [DecidableEq α] (m : EC.FMap α β) (x : α) :
                                          ↑(m.rem x).fdom.card ≤ ↑m.fdom.card
                                          theorem GaudisCrypt.SHA3.Gext.size_ge0 {α β : Type} (m : EC.FMap α β) :
                                          0 ≤ ↑m.fdom.card
                                          theorem GaudisCrypt.SHA3.Gext.inv_lt.step [SLCommon.Params] {m2 mi2 m2' mi2' : SLCommon.smap} {c1 : ℤ} {Fm2 Fm2' : SLCommon.handles} {count2 count2' : ℤ} (h : inv_lt m2 mi2 c1 Fm2 count2) (hm : ↑(EC.FMap.fdom m2').card ≤ ↑(EC.FMap.fdom m2).card + 1) (hmi : ↑(EC.FMap.fdom mi2').card ≤ ↑(EC.FMap.fdom mi2).card + 1) (hF : count2' + ↑(EC.FMap.restr EC.PROM.Unknown Fm2').fdom.card ≤ count2 + ↑(EC.FMap.restr EC.PROM.Unknown Fm2).fdom.card) :
                                          inv_le m2' mi2' c1 Fm2' count2'

                                          One oracle step from inv_lt to inv_le: each of G1.m, G1.mi gains at most a binding, and the count plus the unknown handles does not grow.

                                          theorem GaudisCrypt.SHA3.Gext.set_set_same {α β : Type} [DecidableEq α] (m : EC.FMap α β) (x : α) (b c : β) :
                                          (m.set x b).set x c = m.set x c

                                          set_set_eqE.

                                          G2's update of G1.bext is ReSample.f1's: bad_ext is membership in the capacities of G1.m, G1.mi.

                                          theorem GaudisCrypt.SHA3.Gext.inv_le.mono [SLCommon.Params] {m2 mi2 : SLCommon.smap} {c1 c1' : ℤ} {Fm2 : SLCommon.handles} {count2 : ℤ} (h : inv_le m2 mi2 c1 Fm2 count2) (hc : c1 ≤ c1') (hc' : c1' ≤ SLCommon.max_size) :
                                          inv_le m2 mi2 c1' Fm2 count2

                                          inv_le at a larger budget (below max_size).

                                          Gap list (batch-fix later, see TRANSFER_SKILL.md §1.6):

                                          @[reducible, inline]

                                          EC's state (SLCommonCore's, named here: a root state exists).

                                          Equations
                                          Instances For

                                            The footprints of RRO's procedures (as Lib/EC/PROM.lean's for RO; to move there).

                                            The footprint of the functor G2.S (for the solver, which reads concrete modules off their code but not a functor's): G1's variables and F.RO.m (EC reads a module's globals off its code).

                                            The first section: G1 and the lazy G2 #

                                            The section EXT #

                                            instance GaudisCrypt.SHA3.Pilot.Gext.instIsGlobalVarIntCountMk :
                                            ReSample.count.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Pilot.Gext.ReSample.count" ℤ)

                                            EC's ReSample.count.

                                            Equations
                                            Instances For
                                              @[simp]

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

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

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

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

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

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

                                                Equations
                                                Instances For

                                                  The module declared by module ReSample: the record of its procedures ReSample.f, ReSample.f1.

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

                                                  Equations
                                                  Instances For

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

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

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

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

                                                      Equations
                                                      Instances For
                                                        @[simp]

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

                                                        The module declared by module Gext.resample: the record of its procedures Gext.resample.resample.

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

                                                        Equations
                                                        Instances For

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

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

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

                                                            Equations
                                                            Instances For

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

                                                              @[simp]

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

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

                                                              The module declared by module Gext.M: the record of its procedures Gext.M.f.

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

                                                              Equations
                                                              Instances For

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

                                                                Equations
                                                                Instances For

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

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

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

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

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

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

                                                                      Equations
                                                                      Instances For
                                                                        theorem GaudisCrypt.SHA3.Pilot.Gext.Gext.S.f.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                                                        procedure.instantiate holeArgs✝ = proc (x : SLCommon.state) : SLCommon.state { var p : List Common.block, v : Common.block, y1 : Common.block, y2 : Common.capacity, y : SLCommon.state, handles_ : EC.FMap SLCommon.handle Common.capacity, hx2 : SLCommon.handle, t : Bool, hy2 : SLCommon.handle; if (!decide (EC.FMap.dom §Handle.G1.m §x)) { if (decide ((§Handle.G1.paths).dom (§x).2)) { p, v <- EC.oget ((§Handle.G1.paths).get (§x).2); y1 <- call (EC.PROM.FullRO.ROmap.get (List Common.block) Common.block SLCommon.F.RO).procedure (EC.rcons (§p) (§v +^ (§x).1)); } else { y1 <$ Common.bdistr; } y2 <$ Common.cdistr; y <- (§y1, §y2); handles_ <- call (EC.PROM.FullRO.FRO_T.allKnown SLCommon.handle Common.capacity Gext.RRO).procedure (); if (!decide ((§handles_).rng (§x).2)) { call (EC.PROM.FullRO.FRO_T.set SLCommon.handle Common.capacity Gext.RRO).procedure (§Handle.G1.chandle, (§x).2); Handle.G1.chandle <- §Handle.G1.chandle + 1; } handles_ <- call (EC.PROM.FullRO.FRO_T.allKnown SLCommon.handle Common.capacity Gext.RRO).procedure (); hx2 <- EC.oget (Gext.hinvc (§handles_) (§x).2); t <- call (EC.PROM.FullRO.FRO_T.queried SLCommon.handle Common.capacity Gext.RRO).procedure ((EC.oget (EC.FMap.get §Handle.G1.mh ((§x).1, §hx2))).2, EC.PROM.Unknown); if (decide (EC.FMap.dom §Handle.G1.mh ((§x).1, §hx2)) && §t) { hy2 <- (EC.oget (EC.FMap.get §Handle.G1.mh ((§x).1, §hx2))).2; call ReSample.f1.procedure ((§x).2, §hy2); y2 <- call (EC.PROM.FullRO.FRO_T.get SLCommon.handle Common.capacity Handle.ROhandle.FRO).procedure (§hy2); y <- ((§y).1, §y2); Handle.G1.m <- EC.FMap.set §Handle.G1.m §x §y; Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §y §x; } else { hy2 <- §Handle.G1.chandle; Handle.G1.chandle <- §Handle.G1.chandle + 1; call (EC.PROM.FullRO.FRO_T.set SLCommon.handle Common.capacity Gext.RRO).procedure (§hy2, (§y).2); Handle.G1.m <- EC.FMap.set §Handle.G1.m §x §y; Handle.G1.mh <- EC.FMap.set §Handle.G1.mh ((§x).1, §hx2) ((§y).1, §hy2); Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §y §x; Handle.G1.mhi <- EC.FMap.set §Handle.G1.mhi ((§y).1, §hy2) ((§x).1, §hx2); } if (decide ((§Handle.G1.paths).dom (§x).2)) { p, v <- EC.oget ((§Handle.G1.paths).get (§x).2); Handle.G1.paths <- (§Handle.G1.paths).set (§y).2 (EC.rcons (§p) (§v +^ (§x).1), (§y).1); } } else { y <- EC.oget (EC.FMap.get §Handle.G1.m §x); } return §y }

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

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

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

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

                                                                          Equations
                                                                          Instances For
                                                                            @[simp]

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

                                                                            The module declared by module Gext.S: the record of its procedures Gext.S.f, Gext.S.fi.

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

                                                                            Equations
                                                                            Instances For
                                                                              theorem GaudisCrypt.SHA3.Pilot.Gext.Gext.S.fi.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                                                              procedure.instantiate holeArgs✝ = proc (x : SLCommon.state) : SLCommon.state { var handles_ : EC.FMap SLCommon.handle Common.capacity, hx2 : SLCommon.handle, y1 : Common.block, y2 : Common.capacity, y : SLCommon.state, t : Bool, hy2 : SLCommon.handle; if (!decide (EC.FMap.dom §Handle.G1.mi §x)) { handles_ <- call (EC.PROM.FullRO.FRO_T.allKnown SLCommon.handle Common.capacity Gext.RRO).procedure (); if (!decide ((§handles_).rng (§x).2)) { call (EC.PROM.FullRO.FRO_T.set SLCommon.handle Common.capacity Gext.RRO).procedure (§Handle.G1.chandle, (§x).2); Handle.G1.chandle <- §Handle.G1.chandle + 1; } handles_ <- call (EC.PROM.FullRO.FRO_T.allKnown SLCommon.handle Common.capacity Gext.RRO).procedure (); hx2 <- EC.oget (Gext.hinvc (§handles_) (§x).2); y1 <$ Common.bdistr; y2 <$ Common.cdistr; y <- (§y1, §y2); t <- call (EC.PROM.FullRO.FRO_T.queried SLCommon.handle Common.capacity Gext.RRO).procedure ((EC.oget (EC.FMap.get §Handle.G1.mhi ((§x).1, §hx2))).2, EC.PROM.Unknown); if (decide (EC.FMap.dom §Handle.G1.mhi ((§x).1, §hx2)) && §t) { y1, hy2 <- EC.oget (EC.FMap.get §Handle.G1.mhi ((§x).1, §hx2)); call ReSample.f1.procedure ((§x).2, §hy2); y2 <- call (EC.PROM.FullRO.FRO_T.get SLCommon.handle Common.capacity Handle.ROhandle.FRO).procedure (§hy2); y <- ((§y).1, §y2); Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §x §y; Handle.G1.m <- EC.FMap.set §Handle.G1.m §y §x; } else { hy2 <- §Handle.G1.chandle; Handle.G1.chandle <- §Handle.G1.chandle + 1; call (EC.PROM.FullRO.FRO_T.set SLCommon.handle Common.capacity Gext.RRO).procedure (§hy2, (§y).2); Handle.G1.mi <- EC.FMap.set §Handle.G1.mi §x §y; Handle.G1.mhi <- EC.FMap.set §Handle.G1.mhi ((§x).1, §hx2) ((§y).1, §hy2); Handle.G1.m <- EC.FMap.set §Handle.G1.m §y §x; Handle.G1.mh <- EC.FMap.set §Handle.G1.mh ((§y).1, §hy2) ((§x).1, §hx2); } } else { y <- EC.oget (EC.FMap.get §Handle.G1.mi §x); } return §y }

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

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

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

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

                                                                                The module declared by module Gext: the record of its procedures Gext.distinguish.

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

                                                                                Equations
                                                                                Instances For

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

                                                                                  Equations
                                                                                  Instances For

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

                                                                                    EC's case (l)=>//=; smt w=List.size_ge0: a list that is not empty has a positive size.

                                                                                    EC's closer of the resampling loops' body in EG2_Gext (case(l{mr})=>[//|h1 l1/=Hle Hext c ?/=];split. + smt w=(drop0 size_ge0). rewrite drop0=>-[H|[x h][#]];1:by rewrite Hext // H. rewrite get_setE;case (h=h1)=> [/=->Hin->_ | Hneq ???]. + by right;apply (mem_image snd _ x). by rewrite Hext 2://;right;exists x h;rewrite Hneq.): one handle head l resampled.

                                                                                    EC's closer of EG2_Gext's oracles when the unknown handle k is resampled (rewrite … restr_set /= size_rem dom_restr Hin //=; smt w=size_set_le.): the invariant steps from inv_lt to inv_le (G2's update of G1.bext is ReSample.f1's: the old port's bext_eq).

                                                                                    EC's local equiv RROset_inv_lt : RRO.set ~ RRO.set : ={x, y, FRO.m} /\ inv_lt G1.m{2} G1.mi{2} C.c{1} FRO.m{2} ReSample.count{2} ==> ={res,FRO.m} /\ inv_lt G1.m{2} G1.mi{2} C.c{1} FRO.m{2} ReSample.count{2}.

                                                                                    Real_G2 #

                                                                                    In EC's section EXT; here a section of its own, D's restriction also naming the local modules of Gcol and ConcreteF (fresh in EC) that Pr_G1col and Real_G1 exclude.

                                                                                    theorem GaudisCrypt.SHA3.Pilot.Gext.Real_G2 [SLCommon.Params] (D : SLCommon.DISTINGUISHER) [Module.Declared D (SLCommon.C.c.footprint ⊔ SLCommon.C.queries.footprint ⊔ ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ Handle.G1.m.footprint ⊔ Handle.G1.mi.footprint ⊔ Handle.G1.mh.footprint ⊔ Handle.G1.mhi.footprint ⊔ Handle.G1.bext.footprint ⊔ Handle.G1.bcol.footprint ⊔ Handle.ROhandle.FRO.m.footprint ⊔ Handle.G1.paths.footprint ⊔ Handle.G1.chandle.footprint ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ SLCommon.Redo.prefixes.footprint ⊔ ReSample.count.footprint ⊔ Gcol.Gcol.count.footprint ⊔ ConcreteF.Switching.DBounder.FBounder.c.footprint ⊔ ConcreteF.Switching.ARP.coll.footprint ⊔ ConcreteF.Switching.ARP.m.footprint ⊔ ConcreteF.Switching.ARP.mi.footprint ⊔ ConcreteF.Switching.PRPi.m.footprint ⊔ ConcreteF.Switching.PRPi.mi.footprint)] {R : Footprint VariableAssignment} [Module.ECGlob D R] [R.Restricted (SLCommon.C.c.footprint ⊔ SLCommon.C.queries.footprint ⊔ ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ Handle.G1.m.footprint ⊔ Handle.G1.mi.footprint ⊔ Handle.G1.mh.footprint ⊔ Handle.G1.mhi.footprint ⊔ Handle.G1.bext.footprint ⊔ Handle.G1.bcol.footprint ⊔ Handle.ROhandle.FRO.m.footprint ⊔ Handle.G1.paths.footprint ⊔ Handle.G1.chandle.footprint ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ SLCommon.Redo.prefixes.footprint ⊔ ReSample.count.footprint ⊔ Gcol.Gcol.count.footprint ⊔ ConcreteF.Switching.DBounder.FBounder.c.footprint ⊔ ConcreteF.Switching.ARP.coll.footprint ⊔ ConcreteF.Switching.ARP.m.footprint ⊔ ConcreteF.Switching.ARP.mi.footprint ⊔ ConcreteF.Switching.PRPi.m.footprint ⊔ ConcreteF.Switching.PRPi.mi.footprint)] (D_ll : ∀ (F : SLCommon.DFUNCTIONALITY) [Module.Declared F R] (P : SLCommon.DPRIMITIVE) [Module.Declared P R], (SHA3.Indifferentiability.DPRIMITIVE.f SHA3.SLCommon.state (List Common.block) Common.block P).procedure.IsLossless → (SHA3.Indifferentiability.DPRIMITIVE.fi SHA3.SLCommon.state (List Common.block) Common.block P).procedure.IsLossless → (SHA3.Indifferentiability.DFUNCTIONALITY.f SHA3.SLCommon.state (List Common.block) Common.block F).procedure.IsLossless → (Module.app D (Module.pair F P)).procedure.IsLossless) (m : VariableAssignment) :

                                                                                    EC's lemma Real_G2 &m: Pr[GReal(D).main() @ &m: res /\ C.c <= max_size] <= Pr[Eager(G2(DRestr(D))).main2() @ &m: res] + (max_size ^ 2 - max_size)%r / 2%r * mu dstate (pred1 witness) + max_size%r * ((2*max_size)%r / (2^c)%r) + max_size%r * ((2*max_size)%r / (2^c)%r).