Documentation

GaudisCrypt.Examples.SHA3.SmartCounter.Gconcl

Conclusion of the squeezeless sponge proof (EasyCrypt proof/smart_counter/Gconcl.ec) — #

EC-fidelity port

The equivalences G2_G3, G3_G4, G4_Ideal in EC's scripts, over the old port's declarations of IF, S, G3, G4 (section FirstPort below), as SmartCounter/Gext.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):

EC's module IF = { proc init = F.RO.init proc f = F.RO.get }.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    instance GaudisCrypt.SHA3.Gconcl.instIsGlobalVarSmapMMk [SLCommon.Params] :
    S.m.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Gconcl.S.m" SLCommon.smap)

    EC's S.m.

    Equations
    Instances For

      EC's S.mi.

      Equations
      Instances For
        instance GaudisCrypt.SHA3.Gconcl.instIsGlobalVarSmapMiMk [SLCommon.Params] :
        S.mi.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Gconcl.S.mi" SLCommon.smap)

        EC's S.paths.

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

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

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

            The body of proc f of module S, as a procedure of its own: the one call it makes to a module parameter (F) 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 S.f.procedure.apply_simp) rather than run. Use S.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 S.f to the parameters proc f uses (F) is Module.proc (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 S, abstracted over its single parameter F, 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 S.init, S.f, S.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma S.apply_simp says.

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

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

                Equations
                Instances For
                  @[simp]

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

                  @[simp]

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

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

                  Apply it with the @[simp] lemma S.f.apply_simp, which fills the holes of S.f.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.Gconcl.S.fi.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                    procedure.instantiate holeArgs✝ = proc (x : state) : state { var y1 : Common.block, y2 : Common.capacity, y : state; if (!decide (EC.FMap.dom §mi §x)) { y1 <$ Common.bdistr; y2 <$ Common.cdistr; y <- (§y1, §y2); mi <- EC.FMap.set §mi §x §y; m <- EC.FMap.set §m §y §x; } else { y <- EC.oget (EC.FMap.get §mi §x); } return §y }

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

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

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

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

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

                      Equations
                      Instances For
                        theorem GaudisCrypt.SHA3.Gconcl.S.f.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : (HoleSigs.cons (procsig (List Common.block) → Common.block) 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; if (!decide (EC.FMap.dom §m §x)) { if (decide ((§paths).dom (§x).2)) { p, v <- EC.oget ((§paths).get (§x).2); y1 <- call (holeArgs✝.lookup HoleIndex.zero) (EC.rcons (§p) (§v +^ (§x).1)); } else { y1 <$ Common.bdistr; } y2 <$ Common.cdistr; y <- (§y1, §y2); m <- EC.FMap.set §m §x §y; mi <- EC.FMap.set §mi §y §x; if (decide ((§paths).dom (§x).2)) { p, v <- EC.oget ((§paths).get (§x).2); paths <- (§paths).set (§y).2 (EC.rcons (§p) (§v +^ (§x).1), (§y).1); } } else { y <- EC.oget (EC.FMap.get §m §x); } return §y }

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

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

                        The section #

                        The body of proc f of module G3.M, as a procedure of its own: the 2 calls it makes to module parameters (RO) 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 G3.M.f.procedure.apply_simp) rather than run. Use G3.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 G3.M to a tuple of its single parameter RO — the record of its procedures G3.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 G3.M.f.apply_simp to fill that procedure's holes.

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

                          Apply it with the @[simp] lemma G3.M.f.apply_simp, which fills the holes of G3.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 G3.M.f to the parameters proc f uses (RO) is Module.proc (G3.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.

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

                            Equations
                            Instances For
                              theorem GaudisCrypt.SHA3.Gconcl.G3.M.f.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : (HoleSigs.cons (procsig (List Common.block) → Unit) (HoleSigs.cons (procsig (List Common.block) → Common.block) HoleSigs.empty)).Instantiation) :
                              procedure.instantiate holeArgs✝ = proc (p : List Common.block) : Common.block { var h : SLCommon.handle, i : ℤ, counter : ℤ, sa : Common.block, sa' : Common.block; h <- 0; i <- 0; counter <- 0; sa <- Common.b0; while (decide (§i < EC.size §p)) { if (decide (EC.FMap.dom §Handle.G1.mh (§sa +^ EC.nth default §p §i, §h))) { call (holeArgs✝.lookup HoleIndex.zero) (EC.take (§i + 1) §p); sa, h <- EC.oget (EC.FMap.get §Handle.G1.mh (§sa +^ EC.nth default §p §i, §h)); } else { if (decide (§counter < EC.size §p - SLCommon.Prefix.prefix (§p) (SLCommon.Prefix.get_max_prefix (§p) (EC.FSet.elems (§SLCommon.C.queries).fdom)))) { call (EC.PROM.FullRO.FRO_T.sample SLCommon.handle Common.capacity Gext.RRO).procedure (§Handle.G1.chandle); sa' <- call (holeArgs✝.lookup HoleIndex.zero.succ) (EC.take (§i + 1) §p); sa <- §sa +^ EC.nth default §p §i; Handle.G1.mh <- EC.FMap.set §Handle.G1.mh (§sa, §h) (§sa', §Handle.G1.chandle); Handle.G1.mhi <- EC.FMap.set §Handle.G1.mhi (§sa', §Handle.G1.chandle) (§sa, §h); sa, h <- (§sa', §Handle.G1.chandle); Handle.G1.chandle <- §Handle.G1.chandle + 1; counter <- §counter + 1; } else { call (holeArgs✝.lookup HoleIndex.zero) (EC.take (§i + 1) §p); } } i <- §i + 1; } sa <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§p); return §sa }

                              Instantiating the holes of G3.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 [G3.M.f.procedure.apply_simp]).

                              @[simp]

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

                              @[simp]

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

                              theorem GaudisCrypt.SHA3.Gconcl.G3.S.fi.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                              procedure.instantiate holeArgs✝ = proc (x : state) : state { var handles_ : EC.FMap SLCommon.handle Common.capacity, hx2 : SLCommon.handle, t : Bool, y1 : Common.block, y2 : Common.capacity, y : state, 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); 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); y1 <$ Common.bdistr; y2 <$ Common.cdistr; y <- (§y1, §y2); 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)); Handle.FRO.m <- (§Handle.FRO.m).set §hy2 (§y2, EC.PROM.Known); 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 G3.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 [G3.S.fi.procedure.apply_simp]).

                              theorem GaudisCrypt.SHA3.Gconcl.G3.S.f.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : (HoleSigs.cons (procsig (List Common.block) → Common.block) 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 (holeArgs✝.lookup HoleIndex.zero) (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; Handle.FRO.m <- (§Handle.FRO.m).set §hy2 (§y2, EC.PROM.Known); 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 G3.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 [G3.S.f.procedure.apply_simp]).

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

                              Apply it with the @[simp] lemma G3.S.f.apply_simp, which fills the holes of G3.S.f.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 fi of module G3.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 G3.S.fi.procedure.apply_simp) rather than run. Use G3.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 G3.S as a module: Module.proc G3.S.fi.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — G3.S.fi.apply_simp says exactly that.

                                  Equations
                                  Instances For

                                    The body of proc f of module G3.S, as a procedure of its own: the one call it makes to a module parameter (RO) 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 G3.S.f.procedure.apply_simp) rather than run. Use G3.S.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 G3.S.f to the parameters proc f uses (RO) is Module.proc (G3.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 G3.S, abstracted over its single parameter RO, 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 G3.S.f, G3.S.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma G3.S.apply_simp says.

                                      Equations
                                      Instances For

                                        The body of proc distinguish of module G3, as a procedure of its own: the 2 calls it makes to module parameters (RO) 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 G3.distinguish.procedure.apply_simp) rather than run. Use G3.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 G3 to a tuple of its single parameter RO — the record of its procedures G3.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 G3.distinguish.apply_simp to fill that procedure's holes.

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

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

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

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

                                            Equations
                                            Instances For

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

                                              @[simp]

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

                                              @[simp]

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

                                              theorem GaudisCrypt.SHA3.Gconcl.G4.C.f.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : (HoleSigs.cons (procsig (List Common.block) → Unit) (HoleSigs.cons (procsig (List Common.block) → Common.block) HoleSigs.empty)).Instantiation) :
                                              procedure.instantiate holeArgs✝ = proc (p : List Common.block) : Common.block { var h : SLCommon.handle, i : ℤ, sa : Common.block; h <- 0; i <- 0; sa <- Common.b0; while (decide (§i < EC.size §p)) { call (holeArgs✝.lookup HoleIndex.zero) (EC.take (§i + 1) §p); i <- §i + 1; } sa <- call (holeArgs✝.lookup HoleIndex.zero.succ) (§p); return §sa }

                                              Instantiating the holes of G4.C.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 [G4.C.f.procedure.apply_simp]).

                                              @[simp]

                                              @[simp]: applying G4.C.f to the parameters proc f uses (RO) is Module.proc (G4.C.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 body of proc f of module G4.C, as a procedure of its own: the 2 calls it makes to module parameters (RO) 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 G4.C.f.procedure.apply_simp) rather than run. Use G4.C.f for this procedure as a module.

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

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

                                                Equations
                                                Instances For

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

                                                  Apply it with the @[simp] lemma G4.C.f.apply_simp, which fills the holes of G4.C.f.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 f of module G4.S, as a procedure of its own: the one call it makes to a module parameter (RO) 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 G4.S.f.procedure.apply_simp) rather than run. Use G4.S.f for this procedure as a module.

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

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

                                                      Instantiating the holes of G4.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 [G4.S.f.procedure.apply_simp]).

                                                      Instantiating the holes of G4.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 [G4.S.fi.procedure.apply_simp]).

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

                                                      Apply it with the @[simp] lemma G4.S.f.apply_simp, which fills the holes of G4.S.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 G4.S to a tuple of its single parameter RO — the record of its procedures G4.S.f, G4.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 G4.S.f.apply_simp, G4.S.fi.apply_simp to fill that procedure's holes.

                                                        @[simp]

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

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

                                                        Equations
                                                        Instances For

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

                                                          Equations
                                                          Instances For

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

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

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

                                                              Equations
                                                              Instances For
                                                                @[simp]

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

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

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

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

                                                                  @[simp]

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

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

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

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

                                                                    The oracles' steps #

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

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

                                                                    Real_Ideal #

                                                                    D's restriction also names the local modules of Gext, Gcol and ConcreteF (fresh in EC) that Real_G2 excludes.

                                                                    theorem GaudisCrypt.SHA3.Pilot.Gconcl.Real_Ideal [SLCommon.Params] (D : SLCommon.DISTINGUISHER) [Module.Declared D (SLCommon.C.c.footprint ⊔ SLCommon.C.queries.footprint ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ SLCommon.F.FRO.m.footprint ⊔ Gconcl.S.m.footprint ⊔ Gconcl.S.mi.footprint ⊔ Gconcl.S.paths.footprint ⊔ SLCommon.Redo.prefixes.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 ⊔ ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ Gext.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 ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ SLCommon.F.FRO.m.footprint ⊔ Gconcl.S.m.footprint ⊔ Gconcl.S.mi.footprint ⊔ Gconcl.S.paths.footprint ⊔ SLCommon.Redo.prefixes.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 ⊔ ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ Gext.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_Ideal &m: Pr[GReal(D).main() @ &m: res /\ C.c <= max_size] <= Pr[IdealIndif(IF,S,DRestr(D)).main() @ &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).