Documentation

GaudisCrypt.Examples.SHA3.SmartCounter.SLCommon

The squeezeless sponge: common definitions (EasyCrypt proof/smart_counter/SLCommon.ec) — #

EC-fidelity port

The construction SqueezelessSponge, the counting and restricting wrappers C, PC, DPRestr, FC, DFRestr, DRestr, and their lemmas. The operators without modules (the parameter class with max_size, state, the Prefix theory, the handle operators) are SmartCounter/SLCommonCore.lean, shared with the first port.

Translation (as the pilots' IndifRO_is_secure):

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

`clone include Indifferentiability with type p <- state, type f_in <- block list, #

type f_out <- block rename [module] "GReal" as "RealIndif" [module] "GIdeal" as "IdealIndif"`

@[implicit_reducible]

EC's subtyping PRIMITIVE <: DPRIMITIVE (its f, fi).

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

EC's subtyping FUNCTIONALITY <: DFUNCTIONALITY (its f).

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

The ideal functionality #

The clone's module variable F.RO.m.

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

    The clone's module variable F.FRO.m.

    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]

        F.RO as its type RO (PROM.FullRO.RO.asRO).

        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 squeezeless sponge #

                EC's Redo.prefixes.

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

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

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

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

                    Equations
                    Instances For

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

                      The module declared by module Redo: the record of its procedures Redo.init.

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

                      Equations
                      Instances For
                        @[simp]

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

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

                        Apply it with the @[simp] lemma SqueezelessSponge.f.apply_simp, which fills the holes of SqueezelessSponge.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 SqueezelessSponge, as a procedure of its own: the one call it makes to a module parameter (P) 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 SqueezelessSponge.f.procedure.apply_simp) rather than run. Use SqueezelessSponge.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 SqueezelessSponge to a tuple of its single parameter P — the record of its procedures SqueezelessSponge.init, SqueezelessSponge.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 SqueezelessSponge.init.apply_simp, SqueezelessSponge.f.apply_simp to fill that procedure's holes.

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

                            Equations
                            Instances For

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

                              @[simp]

                              @[simp]: applying SqueezelessSponge.f to the parameters proc f uses (P) is Module.proc (SqueezelessSponge.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 init of module SqueezelessSponge as a module: Module.proc SqueezelessSponge.init.procedure, of type Module.Proc (procsig …). It uses no module parameter, so it is not a function — SqueezelessSponge.init.apply_simp says exactly that.

                              Equations
                              Instances For
                                @[simp]

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

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

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  theorem GaudisCrypt.SHA3.SLCommon.SqueezelessSponge.f.procedure.apply_simp [Params] (holeArgs✝ : (HoleSigs.cons (procsig (state) → state) HoleSigs.empty).Instantiation) :
                                  procedure.instantiate holeArgs✝ = proc (p : List Common.block) : Common.block { var sa : Common.block, sc : Common.capacity, i : ℤ; sa, sc <- (Common.b0, Common.c0); i <- 0; while (decide (§i < EC.size §p)) { if (decide ((§Redo.prefixes).dom (EC.take (§i + 1) §p))) { sa, sc <- EC.oget ((§Redo.prefixes).get (EC.take (§i + 1) §p)); } else { sa, sc <- (§sa +^ EC.nth default §p §i, §sc); sa, sc <- call (holeArgs✝.lookup HoleIndex.zero) (§sa, §sc); Redo.prefixes <- (§Redo.prefixes).set (EC.take (§i + 1) §p) (§sa, §sc); } i <- §i + 1; } return §sa }

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

                                  Counting and restricting #

                                  EC's C.c.

                                  Equations
                                  Instances For
                                    instance GaudisCrypt.SHA3.SLCommon.instIsGlobalVarIntCMk :
                                    C.c.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.SLCommon.C.c" ℤ)

                                    EC's C.queries.

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

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

                                      @[simp]

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

                                      The module declared by module C: the record of its procedures C.init.

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

                                      Equations
                                      Instances For

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

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

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

                                          Equations
                                          Instances For
                                            @[simp]

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

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

                                            Apply it with the @[simp] lemma PC.fi.apply_simp, which fills the holes of PC.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.SLCommon.PC.f.procedure.apply_simp [Params] (holeArgs✝ : (HoleSigs.cons (procsig (state) → state) HoleSigs.empty).Instantiation) :
                                              procedure.instantiate holeArgs✝ = proc (x : state) : state { var y : state; y <- (Common.b0, Common.c0); y <- call (holeArgs✝.lookup HoleIndex.zero) (§x); C.c <- §C.c + 1; return §y }

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

                                              @[simp]

                                              @[simp]: applying PC.f to the parameters proc f uses (P) is Module.proc (PC.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 PC, abstracted over its single parameter P, 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 PC.init, PC.f, PC.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma PC.apply_simp says.

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

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

                                                  Equations
                                                  Instances For
                                                    theorem GaudisCrypt.SHA3.SLCommon.PC.fi.procedure.apply_simp [Params] (holeArgs✝ : (HoleSigs.cons (procsig (state) → state) HoleSigs.empty).Instantiation) :
                                                    procedure.instantiate holeArgs✝ = proc (x : state) : state { var y : state; y <- (Common.b0, Common.c0); y <- call (holeArgs✝.lookup HoleIndex.zero) (§x); C.c <- §C.c + 1; return §y }

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

                                                    @[simp]

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

                                                    @[simp]

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

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

                                                    Apply it with the @[simp] lemma PC.f.apply_simp, which fills the holes of PC.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 PC.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 [PC.init.procedure.apply_simp]).

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

                                                      Apply it with the @[simp] lemma PC.init.apply_simp, which fills the holes of PC.init.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 PC, as a procedure of its own: the one call it makes to a module parameter (P) 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 PC.f.procedure.apply_simp) rather than run. Use PC.f 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 DPRestr as a module, abstracted over the module parameters it uses (P, in declaration order): Module.Arr … (Module.Proc (procsig …)).

                                                          Apply it with the @[simp] lemma DPRestr.fi.apply_simp, which fills the holes of DPRestr.fi.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 DPRestr, abstracted over its single parameter P, 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 DPRestr.f, DPRestr.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DPRestr.apply_simp says.

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

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

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

                                                                    @[simp]

                                                                    @[simp]: applying DPRestr.f to the parameters proc f uses (P) is Module.proc (DPRestr.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 DPRestr to a tuple of its single parameter P — the record of its procedures DPRestr.f, DPRestr.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 DPRestr.f.apply_simp, DPRestr.fi.apply_simp to fill that procedure's holes.

                                                                    @[simp]

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

                                                                    theorem GaudisCrypt.SHA3.SLCommon.DPRestr.f.procedure.apply_simp [Params] (holeArgs✝ : (HoleSigs.cons (procsig (state) → state) HoleSigs.empty).Instantiation) :
                                                                    procedure.instantiate holeArgs✝ = proc (x : state) : state { var y : state; y <- (Common.b0, Common.c0); if (decide (§C.c + 1 ≤ max_size)) { y <- call (holeArgs✝.lookup HoleIndex.zero) (§x); C.c <- §C.c + 1; } return §y }

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

                                                                    proc init of module FC 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 FC.init.apply_simp, which fills the holes of FC.init.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 FC, 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 FC.f.procedure.apply_simp) rather than run. Use FC.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 FC, 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 FC.init, FC.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma FC.apply_simp says.

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

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

                                                                          Equations
                                                                          Instances For
                                                                            @[simp]

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

                                                                            proc f of module FC 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 FC.f.apply_simp, which fills the holes of FC.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 FC to a tuple of its single parameter F — the record of its procedures FC.init, FC.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 FC.init.apply_simp, FC.f.apply_simp to fill that procedure's holes.

                                                                              theorem GaudisCrypt.SHA3.SLCommon.FC.f.procedure.apply_simp [Params] (holeArgs✝ : (HoleSigs.cons (procsig (List Common.block) → Common.block) HoleSigs.empty).Instantiation) :
                                                                              procedure.instantiate holeArgs✝ = proc (bs : List Common.block) : Common.block { (localVarLens "b" Common.block) <- Common.b0; if (!decide ((§C.queries).dom §bs)) { C.c <- §C.c + EC.size §bs - Prefix.prefix (§bs) (Prefix.get_max_prefix (§bs) (EC.FSet.elems (§C.queries).fdom)); (localVarLens "b" Common.block) <- call (holeArgs✝.lookup HoleIndex.zero) (§bs); C.queries <- (§C.queries).set §bs §(localVarLens "b" Common.block); } else { (localVarLens "b" Common.block) <- EC.oget ((§C.queries).get §bs); } return §(localVarLens "b" Common.block) }

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

                                                                              @[simp]

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

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

                                                                              proc f of module DFRestr 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 DFRestr.f.apply_simp, which fills the holes of DFRestr.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 DFRestr to a tuple of its single parameter F — the record of its procedures DFRestr.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 DFRestr.f.apply_simp to fill that procedure's holes.

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

                                                                                @[simp]

                                                                                @[simp]: applying DFRestr.f to the parameters proc f uses (F) is Module.proc (DFRestr.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 DFRestr, 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 DFRestr.f.procedure.apply_simp) rather than run. Use DFRestr.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 DFRestr, 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 DFRestr.f, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DFRestr.apply_simp says.

                                                                                  Equations
                                                                                  Instances For

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

                                                                                    Apply it with the @[simp] lemma DRestr.distinguish.apply_simp, which fills the holes of DRestr.distinguish.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 DRestr to a tuple of its 2 parameters F, P — the record of its procedures DRestr.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 DRestr.distinguish.apply_simp to fill that procedure's holes.

                                                                                      @[simp]

                                                                                      @[simp]: applying DRestr.distinguish to the parameters proc distinguish uses (F, P) is Module.proc (DRestr.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 DRestr, abstracted over its 2 parameters F, P, 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 DRestr.distinguish, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma DRestr.apply_simp says.

                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For
                                                                                        theorem GaudisCrypt.SHA3.SLCommon.DRestr.distinguish.procedure.apply_simp [Params] (D : DISTINGUISHER) (holeArgs✝ : (HoleSigs.cons (procsig () → Bool) HoleSigs.empty).Instantiation) :
                                                                                        (procedure D).instantiate holeArgs✝ = proc () : Bool { var b : Bool; call C.init.procedure (); b <- call (holeArgs✝.lookup HoleIndex.zero) (); return §b }

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

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

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

                                                                                          EC's type state = block * capacity (SLCommonCore's, named here: a root state exists).

                                                                                          Equations
                                                                                          Instances For

                                                                                            The module types, the module variables and the modules C, Redo, SqueezelessSponge, PC, DPRestr, FC, DFRestr, DRestr are declared in the section FirstPort above: one declaration per EC variable, shared with Handle, Gcol, Gext, Gconcl.

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

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

                                                                                            Apply it with the @[simp] lemma PRestr.fi.apply_simp, which fills the holes of PRestr.fi.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 PRestr, abstracted over its single parameter P, 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 PRestr.init, PRestr.f, PRestr.fi, each applied to the parameters that procedure itself uses — which is what the @[simp] lemma PRestr.apply_simp says.

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

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

                                                                                                Apply it with the @[simp] lemma PRestr.init.apply_simp, which fills the holes of PRestr.init.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 PRestr, as a procedure of its own: the one call it makes to a module parameter (P) 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 PRestr.f.procedure.apply_simp) rather than run. Use PRestr.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 PRestr.f to the parameters proc f uses (P) is Module.proc (PRestr.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 f of module PRestr as a module, abstracted over the module parameters it uses (P, in declaration order): Module.Arr … (Module.Proc (procsig …)).

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

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

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

                                                                                                        @[simp]

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

                                                                                                        @[simp]

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

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

                                                                                                        Equations
                                                                                                        Instances For

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

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

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

                                                                                                          @[simp]

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

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

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

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

                                                                                                            proc f of module FRestr 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 FRestr.f.apply_simp, which fills the holes of FRestr.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 FRestr.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 [FRestr.f.procedure.apply_simp]).

                                                                                                              The body of proc f of module FRestr, 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 FRestr.f.procedure.apply_simp) rather than run. Use FRestr.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 FRestr.f to the parameters proc f uses (F) is Module.proc (FRestr.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 init of module FRestr 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 FRestr.init.apply_simp, which fills the holes of FRestr.init.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 init of module FRestr, 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 FRestr.init.procedure.apply_simp) rather than run. Use FRestr.init for this procedure as a module.

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

                                                                                                                    EC's lemma DRestr_ll (D <: DISTINGUISHER{-C}): (forall (F <: DFUNCTIONALITY{-D}) (P <: DPRIMITIVE{-D}), islossless P.f => islossless P.fi => islossless F.f => islossless D(F,P).distinguish) => forall (F <: DFUNCTIONALITY{-DRestr(D)}) (P <: DPRIMITIVE{-DRestr(D)}), islossless P.f => islossless P.fi => islossless F.f => islossless DRestr(D, F, P).distinguish; {-DRestr(D)} is {-D, -C}, its globals.

                                                                                                                    Section RESTR #

                                                                                                                    Section COUNT #

                                                                                                                    theorem GaudisCrypt.SHA3.Pilot.SLCommon.Pr_restr [SLCommon.Params] (P : SLCommon.PRIMITIVE) [Module.Declared P (SLCommon.C.c.footprint ⊔ SLCommon.C.queries.footprint)] (CO : SLCommon.CONSTRUCTION) [Module.Declared CO (SLCommon.C.c.footprint ⊔ SLCommon.C.queries.footprint ⊔ (FVP.fvP P).glob)] (D : SLCommon.DISTINGUISHER) [Module.Declared D (SLCommon.C.c.footprint ⊔ SLCommon.C.queries.footprint ⊔ (FVP.fvP P).glob ⊔ (FVP.fvP CO).glob)] {R : Footprint VariableAssignment} [Module.ECGlob D R] [R.Restricted (SLCommon.C.c.footprint ⊔ SLCommon.C.queries.footprint ⊔ (FVP.fvP P).glob ⊔ (FVP.fvP CO).glob)] (f_ll : (SHA3.Indifferentiability.PRIMITIVE.f SHA3.SLCommon.state (List Common.block) Common.block P).procedure.IsLossless) (fi_ll : (SHA3.Indifferentiability.PRIMITIVE.fi SHA3.SLCommon.state (List Common.block) Common.block P).procedure.IsLossless) (CO_ll : CO(P).f.procedure.IsLossless) (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 Pr_restr &m : Pr[Indif(FC(CO(P)), PC(P), D).main()@ &m:res /\ C.c <= max_size] <= Pr[Indif(CO(P), P, DRestr(D)).main()@ &m:res].

                                                                                                                    EC's proof, step for step: byequiv (_: ={glob D, glob P, glob CO} ==> …); symmetry; proc; inline *; wp; call (_: max_size < C.c, ={glob P, glob CO, glob C}), then per oracle its equivalence (proc; sp; if{1}, the call kept by sim, EC's call (_: true); call{2} f_ll past the bad event), the left oracle's losslessness and the right one's phoare (call f_ll keeping C.c, phoare_call f_ll / C.c); EC's auto => /# is auto_close, its smt(prefix_sizel) the instance of prefix_sizel and auto_close. Deviation: the right oracles' islossless (exception E11).

                                                                                                                    @[implicit_reducible]

                                                                                                                    module GReal(D : DISTINGUISHER) = RealIndif(SqueezelessSponge, PC(Perm), D), Perm the PRIMITIVE of Common's permutation (EC's clone of RP at block * capacity).

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