Documentation

GaudisCrypt.Examples.SHA3.SmartCounter.Handle

Handle.eca's CF_G1 in EC's form — the tactic experiment #

EC's CF_G1 (the game-level equivalence of CF and G1 up to the bad events, through EC's up-to-bad call (_: bad, inv, inv') over the distinguisher's three oracle procedures), stated and proven as EC does, over the old port's declarations (section FirstPort below). It drove the tactics the SmartCounter files need (notes/SHA3/Refactor.md, phase 3): equiv_call (_ : bad, I, J), glob D in conditions, equiv_conseq H, phoare_while I V, sp keeping the precondition, glob_simp. The declarations move to EC's form with the port of SLCommon, ConcreteF, Handle.

Deviations from EC's proof:

Declarations of the first port #

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

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

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

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

    The clone's module variable ROhandle.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]
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          The game G1 #

          EC's G1.m.

          Equations
          Instances For
            instance GaudisCrypt.SHA3.Handle.instIsGlobalVarSmapMMk [SLCommon.Params] :
            G1.m.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Handle.G1.m" SLCommon.smap)

            EC's G1.mi.

            Equations
            Instances For
              instance GaudisCrypt.SHA3.Handle.instIsGlobalVarSmapMiMk [SLCommon.Params] :
              G1.mi.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Handle.G1.mi" SLCommon.smap)
              instance GaudisCrypt.SHA3.Handle.instIsGlobalVarHsmapMhMk [SLCommon.Params] :
              G1.mh.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Handle.G1.mh" SLCommon.hsmap)

              EC's G1.mh.

              Equations
              Instances For

                EC's G1.mhi.

                Equations
                Instances For
                  instance GaudisCrypt.SHA3.Handle.instIsGlobalVarIntChandleMk :
                  G1.chandle.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Handle.G1.chandle" ℤ)

                  EC's G1.chandle.

                  Equations
                  Instances For

                    EC's G1.paths.

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

                      EC's G1.bext.

                      Equations
                      Instances For
                        instance GaudisCrypt.SHA3.Handle.instIsGlobalVarBoolBextMk :
                        G1.bext.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Handle.G1.bext" Bool)

                        EC's G1.bcol.

                        Equations
                        Instances For
                          instance GaudisCrypt.SHA3.Handle.instIsGlobalVarBoolBcolMk :
                          G1.bcol.IsGlobalVar (VariableName.mk "GaudisCrypt.SHA3.Handle.G1.bcol" Bool)

                          The body of proc f of module G1.M, as a procedure of its own: it calls no module parameter, so it has no holes.

                          A hole stands for a call whose callee is not known here — a module parameter is supplied only when the module is applied — so the body is a ProcedureWithHoles, to be instantiated (see G1.M.f.procedure.apply_simp) rather than run. Use G1.M.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 G1.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 [G1.M.f.procedure.apply_simp]).

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

                            The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no G1.M.apply_simp to apply it with.

                            Equations
                            Instances For
                              @[simp]

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

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

                              Equations
                              Instances For
                                @[simp]

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

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

                                Equations
                                Instances For
                                  theorem GaudisCrypt.SHA3.Handle.G1.S.fi.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : HoleSigs.empty.Instantiation) :
                                  procedure.instantiate holeArgs✝ = proc (x : state) : state { var hx2 : SLCommon.handle, y1 : Common.block, y2 : Common.capacity, y : state, hy2 : SLCommon.handle; if (!decide (EC.FMap.dom §mi §x)) { bext <- §bext || decide ((§FRO.m).rng ((§x).2, EC.PROM.Unknown)); if (!decide ((§FRO.m).rng ((§x).2, EC.PROM.Known))) { FRO.m <- (§FRO.m).set §chandle ((§x).2, EC.PROM.Known); chandle <- §chandle + 1; } hx2 <- EC.oget (SLCommon.hinvK (§FRO.m) (§x).2); y1 <$ Common.bdistr; y2 <$ Common.cdistr; y <- (§y1, §y2); if (decide (EC.FMap.dom §mhi ((§x).1, §hx2) ∧ (§FRO.m).in_dom_with (EC.oget (EC.FMap.get §mhi ((§x).1, §hx2))).2 EC.PROM.Unknown)) { y1, hy2 <- EC.oget (EC.FMap.get §mhi ((§x).1, §hx2)); y <- ((§y).1, (EC.oget ((§FRO.m).get §hy2)).1); FRO.m <- (§FRO.m).set §hy2 ((§y).2, EC.PROM.Known); mi <- EC.FMap.set §mi §x §y; m <- EC.FMap.set §m §y §x; } else { bcol <- §bcol || decide (SLCommon.hinv (§FRO.m) (§y).2 ≠ none); hy2 <- §chandle; chandle <- §chandle + 1; FRO.m <- (§FRO.m).set §hy2 ((§y).2, EC.PROM.Known); mi <- EC.FMap.set §mi §x §y; mhi <- EC.FMap.set §mhi ((§x).1, §hx2) ((§y).1, §hy2); m <- EC.FMap.set §m §y §x; mh <- EC.FMap.set §mh ((§y).1, §hy2) ((§x).1, §hx2); } } else { y <- EC.oget (EC.FMap.get §mi §x); } return §y }

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

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

                                  Equations
                                  Instances For
                                    theorem GaudisCrypt.SHA3.Handle.G1.S.f.procedure.apply_simp [SLCommon.Params] (holeArgs✝ : 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, hx2 : SLCommon.handle, hy2 : SLCommon.handle; if (!decide (EC.FMap.dom §m §x)) { if (decide ((§paths).dom (§x).2)) { p, v <- EC.oget ((§paths).get (§x).2); y1 <- call (EC.PROM.FullRO.ROmap.get (List Common.block) Common.block SLCommon.F.RO).procedure (EC.rcons (§p) (§v +^ (§x).1)); y2 <$ Common.cdistr; } else { y1 <$ Common.bdistr; y2 <$ Common.cdistr; } y <- (§y1, §y2); bext <- §bext || decide ((§FRO.m).rng ((§x).2, EC.PROM.Unknown)); if (!decide ((§FRO.m).rng ((§x).2, EC.PROM.Known))) { FRO.m <- (§FRO.m).set §chandle ((§x).2, EC.PROM.Known); chandle <- §chandle + 1; } hx2 <- EC.oget (SLCommon.hinvK (§FRO.m) (§x).2); if (decide (EC.FMap.dom §mh ((§x).1, §hx2) ∧ (§FRO.m).in_dom_with (EC.oget (EC.FMap.get §mh ((§x).1, §hx2))).2 EC.PROM.Unknown)) { hy2 <- (EC.oget (EC.FMap.get §mh ((§x).1, §hx2))).2; y <- ((§y).1, (EC.oget ((§FRO.m).get §hy2)).1); FRO.m <- (§FRO.m).set §hy2 ((§y).2, EC.PROM.Known); m <- EC.FMap.set §m §x §y; mi <- EC.FMap.set §mi §y §x; } else { bcol <- §bcol || decide (SLCommon.hinv (§FRO.m) (§y).2 ≠ none); hy2 <- §chandle; chandle <- §chandle + 1; FRO.m <- (§FRO.m).set §hy2 ((§y).2, EC.PROM.Known); m <- EC.FMap.set §m §x §y; mh <- EC.FMap.set §mh ((§x).1, §hx2) ((§y).1, §hy2); mi <- EC.FMap.set §mi §y §x; mhi <- EC.FMap.set §mhi ((§y).1, §hy2) ((§x).1, §hx2); } 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 G1.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 [G1.S.f.procedure.apply_simp]).

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

                                    The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no G1.S.apply_simp to apply it with.

                                    Equations
                                    Instances For

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

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

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

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

                                          Equations
                                          Instances For

                                            Instantiating the holes of G1.main.procedure with a tuple holeArgs of procedures: the body of proc main as written, with each hole call replaced by the matching holeArgs.lookup (HoleIndex.zero being the first hole the body declared). True by rfl.

                                            Deliberately not @[simp], unlike the other apply_simp lemmas: its right-hand side is the whole body written out, so letting it fire on its own would turn any goal mentioning an instantiated procedure into that body. Inlining a procedure is a step to ask for by name (simp [G1.main.procedure.apply_simp]).

                                            @[simp]

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

                                            The body of proc main of module G1, 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 G1.main.procedure.apply_simp) rather than run. Use G1.main 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 G1: the record of its procedures G1.main.

                                              The declaration has no parameter list, so no procedure of it can call one either and the module is not a function — it is the plain record itself, and there is no G1.apply_simp to apply it with.

                                              Equations
                                              Instances For

                                                The invariant #

                                                The state of CF contains the map PF.m (the primitive's map) and Redo.prefixes (all the prefix computations of the sponge construction). The state of G1 contains the map hs from handles to flagged capacities, G1.m (the public view of PF.m), G1.mh (PF.m with handle-based indirection), the functionality ro, and pi, the known path to a capacity if it exists.

                                                Relational: map, handle-map and handles are compatible.

                                                Instances For

                                                  Well-formedness: map and prefixes are compatible.

                                                  Instances For

                                                    Relational: prefixes and the random oracle are compatible.

                                                    Instances For

                                                      Well-formedness: handles, map, handle-map and random oracle are compatible.

                                                      Instances For

                                                        Well-formedness: handles, handle-map and paths are compatible.

                                                        Instances For

                                                          Well-formedness: handles are well formed.

                                                          Instances For
                                                            inductive GaudisCrypt.SHA3.Handle.inv_spec {α β : Type} [DecidableEq α] [DecidableEq β] (m : EC.FMap α β) (mi : EC.FMap β α) :
                                                            Instances For
                                                              Instances For

                                                                Structural projections #

                                                                Handles #

                                                                theorem GaudisCrypt.SHA3.Handle.notin_m_notin_Gm [SLCommon.Params] {α β : Type} [DecidableEq α] (m Gm : EC.FMap α β) (x : α) :
                                                                SLCommon.incl Gm m → m.get x = none → Gm.get x = none
                                                                theorem GaudisCrypt.SHA3.Handle.mi_mhi_addh_addmi [SLCommon.Params] (hs : SLCommon.handles) (mi : SLCommon.smap) (mhi : SLCommon.hsmap) (hx : SLCommon.handle) (xa : Common.block) (xc : Common.capacity) (hy : SLCommon.handle) (ya : Common.block) (yc : Common.capacity) (fx fy : EC.PROM.flag) :
                                                                m_mh hs mi mhi → (∀ (f : EC.PROM.flag) (h : SLCommon.handle), EC.FMap.get hs h ≠ some (yc, f)) → EC.FMap.get hs hx = some (xc, fx) → EC.FMap.get hs hy = none → m_mh (EC.FMap.set hs hy (yc, fy)) (EC.FMap.set mi (ya, yc) (xa, xc)) (EC.FMap.set mhi (ya, hy) (xa, hx))
                                                                theorem GaudisCrypt.SHA3.Handle.inv_mh_inv_Pm [SLCommon.Params] (hs : SLCommon.handles) (Pm Pmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) :
                                                                m_mh hs Pm mh → m_mh hs Pmi mhi → inv_spec mh mhi → inv_spec Pm Pmi
                                                                theorem GaudisCrypt.SHA3.Handle.inv_incl_none [SLCommon.Params] {α β : Type} [DecidableEq α] [DecidableEq β] (Pm : EC.FMap α β) (Pmi : EC.FMap β α) (Gm : EC.FMap α β) (x : α) (Gmi : EC.FMap β α) (y : β) :
                                                                inv_spec Pm Pmi → inv_spec Gm Gmi → SLCommon.incl Gm Pm → SLCommon.incl Gmi Pmi → Pm.get x = some y → (Gm.get x = none ↔ Gmi.get y = none)
                                                                theorem GaudisCrypt.SHA3.Handle.inv_addm [SLCommon.Params] {α β : Type} [DecidableEq α] [DecidableEq β] (m : EC.FMap α β) (mi : EC.FMap β α) (x : α) (y : β) :
                                                                inv_spec m mi → m.get x = none → mi.get y = none → inv_spec (m.set x y) (mi.set y x)
                                                                theorem GaudisCrypt.SHA3.Handle.incl_addm [SLCommon.Params] {α β : Type} [DecidableEq α] (m m' : EC.FMap α β) (x : α) (y : β) :
                                                                SLCommon.incl m m' → SLCommon.incl (m.set x y) (m'.set x y)

                                                                Handle paths #

                                                                Preservation of the invariant #

                                                                theorem GaudisCrypt.SHA3.Handle.lemma1 [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (x1 : Common.block) (x2 : Common.capacity) (y1 : Common.block) (y2 : Common.capacity) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → x2 ≠ y2 → EC.FMap.get Pm (x1, x2) = none → EC.FMap.get Gm (x1, x2) = none → (∀ (f : EC.PROM.flag) (h : SLCommon.handle), EC.FMap.get hs h ≠ some (x2, f)) → (∀ (f : EC.PROM.flag) (h : SLCommon.handle), EC.FMap.get hs h ≠ some (y2, f)) → INV_CF_G1 ((EC.FMap.set hs ch (x2, EC.PROM.Known)).set (ch + 1) (y2, EC.PROM.Known)) (ch + 2) (EC.FMap.set Pm (x1, x2) (y1, y2)) (EC.FMap.set Pmi (y1, y2) (x1, x2)) (EC.FMap.set Gm (x1, x2) (y1, y2)) (EC.FMap.set Gmi (y1, y2) (x1, x2)) (EC.FMap.set mh (x1, ch) (y1, ch + 1)) (EC.FMap.set mhi (y1, ch + 1) (x1, ch)) ro pi prefixes queries

                                                                EC's lemma lemma1, in EC's script.

                                                                theorem GaudisCrypt.SHA3.Handle.lemma1' [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (x1 : Common.block) (x2 : Common.capacity) (y1 : Common.block) (y2 : Common.capacity) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → ¬EC.FMap.dom Pm (y1, y2) → x2 ≠ y2 → EC.FMap.get Pmi (x1, x2) = none → EC.FMap.get Gmi (x1, x2) = none → (∀ (f : EC.PROM.flag) (h : SLCommon.handle), EC.FMap.get hs h ≠ some (x2, f)) → (∀ (f : EC.PROM.flag) (h : SLCommon.handle), EC.FMap.get hs h ≠ some (y2, f)) → INV_CF_G1 ((EC.FMap.set hs ch (x2, EC.PROM.Known)).set (ch + 1) (y2, EC.PROM.Known)) (ch + 2) (EC.FMap.set Pm (y1, y2) (x1, x2)) (EC.FMap.set Pmi (x1, x2) (y1, y2)) (EC.FMap.set Gm (y1, y2) (x1, x2)) (EC.FMap.set Gmi (x1, x2) (y1, y2)) (EC.FMap.set mh (y1, ch + 1) (x1, ch)) (EC.FMap.set mhi (x1, ch) (y1, ch + 1)) ro pi prefixes queries

                                                                EC's lemma lemma1', in EC's script.

                                                                theorem GaudisCrypt.SHA3.Handle.lemma2 [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (PFm PFmi G1m G1mi : SLCommon.smap) (G1mh G1mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (x1 : Common.block) (x2 : Common.capacity) (y1 : Common.block) (y2 : Common.capacity) (hx : SLCommon.handle) :
                                                                INV_CF_G1 hs ch PFm PFmi G1m G1mi G1mh G1mhi ro pi prefixes queries → EC.FMap.get PFm (x1, x2) = none → EC.FMap.get G1m (x1, x2) = none → pi.get x2 = none → EC.FMap.get hs hx = some (x2, EC.PROM.Known) → (∀ (f : EC.PROM.flag) (h : SLCommon.handle), EC.FMap.get hs h ≠ some (y2, f)) → INV_CF_G1 (EC.FMap.set hs ch (y2, EC.PROM.Known)) (ch + 1) (EC.FMap.set PFm (x1, x2) (y1, y2)) (EC.FMap.set PFmi (y1, y2) (x1, x2)) (EC.FMap.set G1m (x1, x2) (y1, y2)) (EC.FMap.set G1mi (y1, y2) (x1, x2)) (EC.FMap.set G1mh (x1, hx) (y1, ch)) (EC.FMap.set G1mhi (y1, ch) (x1, hx)) ro pi prefixes queries

                                                                EC's lemma lemma2, in EC's script.

                                                                theorem GaudisCrypt.SHA3.Handle.lemma2' [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (PFm PFmi G1m G1mi : SLCommon.smap) (G1mh G1mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (x1 : Common.block) (x2 : Common.capacity) (y1 : Common.block) (y2 : Common.capacity) (hx : SLCommon.handle) :
                                                                INV_CF_G1 hs ch PFm PFmi G1m G1mi G1mh G1mhi ro pi prefixes queries → ¬EC.FMap.dom PFm (y1, y2) → EC.FMap.get PFmi (x1, x2) = none → EC.FMap.get G1mi (x1, x2) = none → EC.FMap.get hs hx = some (x2, EC.PROM.Known) → (∀ (f : EC.PROM.flag) (h : SLCommon.handle), EC.FMap.get hs h ≠ some (y2, f)) → INV_CF_G1 (EC.FMap.set hs ch (y2, EC.PROM.Known)) (ch + 1) (EC.FMap.set PFm (y1, y2) (x1, x2)) (EC.FMap.set PFmi (x1, x2) (y1, y2)) (EC.FMap.set G1m (y1, y2) (x1, x2)) (EC.FMap.set G1mi (x1, x2) (y1, y2)) (EC.FMap.set G1mh (y1, ch) (x1, hx)) (EC.FMap.set G1mhi (x1, hx) (y1, ch)) ro pi prefixes queries

                                                                EC's lemma lemma2', in EC's script.

                                                                theorem GaudisCrypt.SHA3.Handle.lemma3 [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (xa : Common.block) (xc : Common.capacity) (hx : SLCommon.handle) (ya : Common.block) (yc : Common.capacity) (hy : SLCommon.handle) (p : List Common.block) (b : Common.block) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → EC.FMap.get Pm (xa, xc) = some (ya, yc) → EC.FMap.get Gm (xa, xc) = none → EC.FMap.get mh (xa, hx) = some (ya, hy) → EC.FMap.get hs hx = some (xc, EC.PROM.Known) → EC.FMap.get hs hy = some (yc, EC.PROM.Unknown) → pi.get xc = some (p, b) → INV_CF_G1 (EC.FMap.set hs hy (yc, EC.PROM.Known)) ch Pm Pmi (EC.FMap.set Gm (xa, xc) (ya, yc)) (EC.FMap.set Gmi (ya, yc) (xa, xc)) mh mhi ro (pi.set yc (EC.rcons p (b +^ xa), ya)) prefixes queries

                                                                EC's lemma lemma3, in EC's script.

                                                                theorem GaudisCrypt.SHA3.Handle.m_mh_None [SLCommon.Params] (hs0 : SLCommon.handles) (PFm : SLCommon.smap) (G1mh : SLCommon.hsmap) (hx2 : SLCommon.handle) (x2 : Common.capacity) (k : EC.PROM.flag) (x1 : Common.block) :
                                                                m_mh hs0 PFm G1mh → EC.FMap.get hs0 hx2 = some (x2, k) → EC.FMap.get PFm (x1, x2) = none → EC.FMap.get G1mh (x1, hx2) = none
                                                                theorem GaudisCrypt.SHA3.Handle.build_hpath_upd_ch [SLCommon.Params] (ha ch : SLCommon.handle) (mh : SLCommon.hsmap) (xa ya : Common.block) (p : List Common.block) (v : Common.block) (hx : SLCommon.handle) :
                                                                0 ≠ ch → ha ≠ ch → (∀ (xa xb : Common.block) (ha hb : SLCommon.handle), EC.FMap.get mh (xa, ha) = some (xb, hb) → ha ≠ ch ∧ hb ≠ ch) → SLCommon.build_hpath (EC.FMap.set mh (xa, ha) (ya, ch)) p = some (v, hx) → if hx = ch then ∃ (p0 : List Common.block) (x : Common.block), SLCommon.build_hpath mh p0 = some (x, ha) ∧ p = EC.rcons p0 (x +^ xa) ∧ v = ya else SLCommon.build_hpath mh p = some (v, hx)
                                                                theorem GaudisCrypt.SHA3.Handle.build_hpath_upd_ch_iff [SLCommon.Params] (ha ch : SLCommon.handle) (mh : SLCommon.hsmap) (xa ya : Common.block) (p : List Common.block) (v : Common.block) (hx : SLCommon.handle) :
                                                                EC.FMap.get mh (xa, ha) = none → 0 ≠ ch → ha ≠ ch → (∀ (xa xb : Common.block) (ha hb : SLCommon.handle), EC.FMap.get mh (xa, ha) = some (xb, hb) → ha ≠ ch ∧ hb ≠ ch) → (SLCommon.build_hpath (EC.FMap.set mh (xa, ha) (ya, ch)) p = some (v, hx) ↔ if hx = ch then ∃ (p0 : List Common.block) (x : Common.block), SLCommon.build_hpath mh p0 = some (x, ha) ∧ p = EC.rcons p0 (x +^ xa) ∧ v = ya else SLCommon.build_hpath mh p = some (v, hx))
                                                                theorem GaudisCrypt.SHA3.Handle.lemma4 [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (i : ℤ) (p : List Common.block) (sa : Common.block) (sc : Common.capacity) (h : SLCommon.handle) (f : EC.PROM.flag) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → 0 ≤ i ∧ i < EC.size p → prefixes.dom (EC.take (i + 1) p) → prefixes.get (EC.take i p) = some (sa, sc) → SLCommon.build_hpath mh (EC.take i p) = some (sa, h) → ro.get (EC.take (i + 1) p) = some (EC.oget (prefixes.get (EC.take (i + 1) p))).1 → EC.FMap.get hs h = some (sc, f) → EC.FMap.dom mh (sa +^ EC.nth default p i, h)

                                                                The oracles of CF and G1 agree up to the bad events #

                                                                theorem GaudisCrypt.SHA3.Handle.rcons_inj_both {α : Type} {p q : List α} {a b : α} :
                                                                EC.rcons p a = EC.rcons q b → p = q ∧ a = b

                                                                rcons is injective in both arguments (EC's rconssI/rconsIs).

                                                                Block xor cancels on the left: a +^ (a +^ b) = b.

                                                                theorem GaudisCrypt.SHA3.Handle.f_path_ro_none [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (x1 : Common.block) (x2 : Common.capacity) (hx2 : SLCommon.handle) (p0 : List Common.block) (v0 : Common.block) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → EC.FMap.get Pm (x1, x2) = none → EC.FMap.get hs hx2 = some (x2, EC.PROM.Known) → SLCommon.build_hpath mh p0 = some (v0, hx2) → ro.get (EC.rcons p0 (v0 +^ x1)) = none

                                                                In the path case of eq_f the query rcons p0 (v0 +^ x1) is fresh for ro.

                                                                theorem GaudisCrypt.SHA3.Handle.f_path_inv [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (x1 : Common.block) (x2 : Common.capacity) (y1 : Common.block) (y2 : Common.capacity) (hx2 : SLCommon.handle) (p0 : List Common.block) (v0 : Common.block) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → EC.FMap.get Pm (x1, x2) = none → pi.get x2 = some (p0, v0) → EC.FMap.get hs hx2 = some (x2, EC.PROM.Known) → SLCommon.build_hpath mh p0 = some (v0, hx2) → SLCommon.hinv hs y2 = none → INV_CF_G1 (EC.FMap.set hs ch (y2, EC.PROM.Known)) (ch + 1) (EC.FMap.set Pm (x1, x2) (y1, y2)) (EC.FMap.set Pmi (y1, y2) (x1, x2)) (EC.FMap.set Gm (x1, x2) (y1, y2)) (EC.FMap.set Gmi (y1, y2) (x1, x2)) (EC.FMap.set mh (x1, hx2) (y1, ch)) (EC.FMap.set mhi (y1, ch) (x1, hx2)) (ro.set (EC.rcons p0 (v0 +^ x1)) y1) (pi.set y2 (EC.rcons p0 (v0 +^ x1), y1)) prefixes queries

                                                                The path case of EC's eq_f: x2 has a known path (p0, v0), the oracle answers the fresh query rcons p0 (v0 +^ x1) with y1.

                                                                theorem GaudisCrypt.SHA3.Handle.head_nth [SLCommon.Params] {α : Type} (w : α) (l : List α) :
                                                                EC.head w l = EC.nth w l 0
                                                                theorem GaudisCrypt.SHA3.Handle.drop_add [SLCommon.Params] {α : Type} (n1 n2 : ℤ) (l : List α) :
                                                                0 ≤ n1 → 0 ≤ n2 → EC.drop (n1 + n2) l = EC.drop n2 (EC.drop n1 l)
                                                                theorem GaudisCrypt.SHA3.Handle.incl_upd_nin [SLCommon.Params] {α β : Type} [DecidableEq α] (m1 m2 : EC.FMap α β) (x : α) (y : β) :
                                                                SLCommon.incl m1 m2 → ¬m2.dom x → SLCommon.incl m1 (m2.set x y)
                                                                theorem GaudisCrypt.SHA3.Handle.lemma5 [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (i : ℤ) (p : List Common.block) (b : Common.block) (c : Common.capacity) (h : SLCommon.handle) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → 0 ≤ i ∧ i < EC.size p → prefixes.dom (EC.take (i + 1) p) → prefixes.get (EC.take i p) = some (b, c) → (∃ (f : EC.PROM.flag), EC.FMap.get hs h = some (c, f)) → ∃ (b' : Common.block) (c' : Common.capacity) (h' : SLCommon.handle), EC.FMap.get Pm (b +^ EC.nth default p i, c) = some (b', c') ∧ EC.FMap.get mh (b +^ EC.nth default p i, h) = some (b', h')
                                                                theorem GaudisCrypt.SHA3.Handle.lemma5' [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (i : ℤ) (p : List Common.block) (b : Common.block) (c : Common.capacity) (h : SLCommon.handle) :
                                                                INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → 0 ≤ i ∧ i < EC.size p → prefixes.get (EC.take i p) = some (b, c) → (∃ (f : EC.PROM.flag), EC.FMap.get hs h = some (c, f)) → (∃ (b' : Common.block) (c' : Common.capacity) (h' : SLCommon.handle), EC.FMap.get Pm (b +^ EC.nth default p i, c) = some (b', c') ∧ EC.FMap.get mh (b +^ EC.nth default p i, h) = some (b', h')) ∨ EC.FMap.get Pm (b +^ EC.nth default p i, c) = none ∧ EC.FMap.get mh (b +^ EC.nth default p i, h) = none

                                                                The invariants of PFf_Cf's two loops and their steps #

                                                                @[reducible, inline]

                                                                The longest prefix of p in the queries Q, EC's prefix p (get_max_prefix p (elems (fdom C.queries))). An abbreviation, not an EC declaration.

                                                                Equations
                                                                Instances For

                                                                  The invariant of PFf_Cf's first loop (the blocks of p already queried): EC's while (…) invariant of the first splitwhile half, without the bad event (which this loop does not touch). pref is Redo.prefixes{1}; (sa, sc) the left state, (sa, h) the right one.

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

                                                                    The left-hand part of the invariant of PFf_Cf's second loop (the new blocks), which holds whatever the bad event: pref0 is Redo.prefixes{1} before the loop (EC's alias).

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

                                                                      The invariant of PFf_Cf's second loop before the bad event (EC's !(G1.bcol{2} \/ G1.bext{2}) => …): INV_CF_G1 with the query take i p answered sa.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        theorem GaudisCrypt.SHA3.Handle.size_take_of_le {α : Type} (k : ℤ) (p : List α) (h0 : 0 ≤ k) (h : k ≤ EC.size p) :
                                                                        EC.size (EC.take k p) = k

                                                                        A prefix of p of length k has size k (for 0 ≤ k ≤ size p).

                                                                        theorem GaudisCrypt.SHA3.Handle.take_ne_take_of_ne {α : Type} (j k : ℤ) (p : List α) (hj0 : 0 ≤ j) (hj : j ≤ EC.size p) (hk0 : 0 ≤ k) (hk : k ≤ EC.size p) (hne : j ≠ k) :

                                                                        Prefixes of p of different lengths (within size p) differ.

                                                                        theorem GaudisCrypt.SHA3.Handle.take_take_of_le {α : Type} (j k : ℤ) (p : List α) (h : j ≤ k) :
                                                                        EC.take j (EC.take k p) = EC.take j p

                                                                        A shorter prefix of a prefix is a prefix.

                                                                        theorem GaudisCrypt.SHA3.Handle.nth_take_of_lt {α : Type} (x0 : α) (j k : ℤ) (p : List α) (h0 : 0 ≤ j) (h : j < k) :
                                                                        EC.nth x0 (EC.take k p) j = EC.nth x0 p j

                                                                        The blocks of a prefix are those of the list.

                                                                        theorem GaudisCrypt.SHA3.Handle.m_p_step [SLCommon.Params] (Pm : SLCommon.smap) (pref : EC.FMap (List Common.block) state) (Q : EC.FMap (List Common.block) Common.block) (p : List Common.block) (i : ℤ) (sa : Common.block) (sc : Common.capacity) :
                                                                        m_p Pm pref Q → 0 ≤ i ∧ i < EC.size p → pref.dom (EC.take (i + 1) p) → pref.get (EC.take i p) = some (sa, sc) → EC.FMap.get Pm (sa +^ EC.nth default p i, sc) = pref.get (EC.take (i + 1) p)

                                                                        m_p's third component at a step: Pm maps the state recorded for take i p, xored with the next block, to the state recorded for take (i + 1) p.

                                                                        theorem GaudisCrypt.SHA3.Handle.PJ1_step [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (pref : EC.FMap (List Common.block) state) (Q : EC.FMap (List Common.block) Common.block) (p : List Common.block) (i : ℤ) (sa : Common.block) (sc : Common.capacity) (h : SLCommon.handle) (hJ : PJ1 hs ch Pm Pmi Gm Gmi mh mhi ro pi pref Q p i sa sc h) (hi : i < qpre p Q) :
                                                                        pref.dom (EC.take (i + 1) p) ∧ EC.FMap.dom mh (sa +^ EC.nth default p i, h) ∧ (EC.oget (pref.get (EC.take (i + 1) p))).1 = (EC.oget (EC.FMap.get mh (sa +^ EC.nth default p i, h))).1 ∧ PJ1 hs ch Pm Pmi Gm Gmi mh mhi ro pi pref Q p (i + 1) (EC.oget (pref.get (EC.take (i + 1) p))).1 (EC.oget (pref.get (EC.take (i + 1) p))).2 (EC.oget (EC.FMap.get mh (sa +^ EC.nth default p i, h))).2

                                                                        A step of the first loop: both sides find the block known.

                                                                        theorem GaudisCrypt.SHA3.Handle.PJ1_PJ2 [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (pref : EC.FMap (List Common.block) state) (Q : EC.FMap (List Common.block) Common.block) (p : List Common.block) (i : ℤ) (sa : Common.block) (sc : Common.capacity) (h : SLCommon.handle) (hJ : PJ1 hs ch Pm Pmi Gm Gmi mh mhi ro pi pref Q p i sa sc h) (hi : ¬i < qpre p Q) :
                                                                        PJ2 hs ch Pm Pmi Gm Gmi mh mhi ro pi pref pref Q p i sa sc h ∧ PJ2L pref pref Q p i sa sc

                                                                        From the first loop to the second: at i = qpre p Q.

                                                                        theorem GaudisCrypt.SHA3.Handle.PJ2L_step [SLCommon.Params] (pref pref0 : EC.FMap (List Common.block) state) (Q : EC.FMap (List Common.block) Common.block) (p : List Common.block) (i : ℤ) (sa : Common.block) (sc : Common.capacity) (a : Common.block) (b : Common.capacity) (hJ : PJ2L pref pref0 Q p i sa sc) (hi : i < EC.size p) (hpre0 : SLCommon.Prefix.all_prefixes pref0) :
                                                                        PJ2L (pref.set (EC.take (i + 1) p) (a, b)) pref0 Q p (i + 1) a b

                                                                        The left-hand part of the second loop's invariant, through a step (whatever the bad event): the new prefix take (i + 1) p gets the state (a, b). Needs pref0 closed under prefixes.

                                                                        theorem GaudisCrypt.SHA3.Handle.PJ2_known [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (pref pref0 : EC.FMap (List Common.block) state) (Q : EC.FMap (List Common.block) Common.block) (p : List Common.block) (i : ℤ) (sa : Common.block) (sc : Common.capacity) (h : SLCommon.handle) (hJ : PJ2 hs ch Pm Pmi Gm Gmi mh mhi ro pi pref pref0 Q p i sa sc h) (hL : PJ2L pref pref0 Q p i sa sc) (hi : i < EC.size p) (hd : EC.FMap.dom Pm (sa +^ EC.nth default p i, sc)) :
                                                                        EC.FMap.dom mh (sa +^ EC.nth default p i, h) ∧ (EC.oget (EC.FMap.get Pm (sa +^ EC.nth default p i, sc))).1 = (EC.oget (EC.FMap.get mh (sa +^ EC.nth default p i, h))).1 ∧ PJ2 hs ch Pm Pmi Gm Gmi mh mhi ro pi (pref.set (EC.take (i + 1) p) (EC.oget (EC.FMap.get Pm (sa +^ EC.nth default p i, sc)))) pref0 Q p (i + 1) (EC.oget (EC.FMap.get Pm (sa +^ EC.nth default p i, sc))).1 (EC.oget (EC.FMap.get Pm (sa +^ EC.nth default p i, sc))).2 (EC.oget (EC.FMap.get mh (sa +^ EC.nth default p i, h))).2

                                                                        A step of the second loop on a known block: PF.m and G1.mh both know it (lemma5').

                                                                        m_p survives adding a fresh entry to the map: every prefix step PF.m already answers.

                                                                        theorem GaudisCrypt.SHA3.Handle.f_fresh_inv [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) (prefixes' : EC.FMap (List Common.block) state) (queries' : EC.FMap (List Common.block) Common.block) (x1 : Common.block) (x2 : Common.capacity) (y1 : Common.block) (y2 : Common.capacity) (hx2 : SLCommon.handle) (fx : EC.PROM.flag) (p0 : List Common.block) (v0 : Common.block) :
                                                                        INV_CF_G1 hs ch Pm Pmi Gm Gmi mh mhi ro pi prefixes queries → EC.FMap.get Pm (x1, x2) = none → EC.FMap.get hs hx2 = some (x2, fx) → SLCommon.build_hpath mh p0 = some (v0, hx2) → SLCommon.hinv hs y2 = none → m_p (EC.FMap.set Pm (x1, x2) (y1, y2)) prefixes' queries' → INV_CF_G1 (EC.FMap.set hs ch (y2, EC.PROM.Unknown)) (ch + 1) (EC.FMap.set Pm (x1, x2) (y1, y2)) (EC.FMap.set Pmi (y1, y2) (x1, x2)) Gm Gmi (EC.FMap.set mh (x1, hx2) (y1, ch)) (EC.FMap.set mhi (y1, ch) (x1, hx2)) (ro.set (EC.rcons p0 (v0 +^ x1)) y1) pi prefixes' queries'

                                                                        The fresh-block step of G1.M.f (EC's PFf_Cf, second loop): the block x1 after the known path (p0, v0) to the handle hx2 is unknown to PF.m; the oracle answers the fresh query rcons p0 (v0 +^ x1) with y1, the new handle ch gets the unknown capacity y2. The prefix part m_p of the invariant is a hypothesis (the prefixes change with the caller).

                                                                        theorem GaudisCrypt.SHA3.Handle.PJ2_fresh [SLCommon.Params] (hs : SLCommon.handles) (ch : SLCommon.handle) (Pm Pmi Gm Gmi : SLCommon.smap) (mh mhi : SLCommon.hsmap) (ro : EC.FMap (List Common.block) Common.block) (pi : EC.FMap Common.capacity (List Common.block × Common.block)) (pref pref0 : EC.FMap (List Common.block) state) (Q : EC.FMap (List Common.block) Common.block) (p : List Common.block) (i : ℤ) (sa : Common.block) (sc : Common.capacity) (h : SLCommon.handle) (hJ : PJ2 hs ch Pm Pmi Gm Gmi mh mhi ro pi pref pref0 Q p i sa sc h) (hL : PJ2L pref pref0 Q p i sa sc) (hi : i < EC.size p) (hd : ¬EC.FMap.dom Pm (sa +^ EC.nth default p i, sc)) :
                                                                        ¬EC.FMap.dom mh (sa +^ EC.nth default p i, h) ∧ ¬ro.dom (EC.take (i + 1) p) ∧ ∀ (y1 : Common.block) (y2 : Common.capacity), SLCommon.hinv hs y2 = none → PJ2 (EC.FMap.set hs ch (y2, EC.PROM.Unknown)) (ch + 1) (EC.FMap.set Pm (sa +^ EC.nth default p i, sc) (y1, y2)) (EC.FMap.set Pmi (y1, y2) (sa +^ EC.nth default p i, sc)) Gm Gmi (EC.FMap.set mh (sa +^ EC.nth default p i, h) (y1, ch)) (EC.FMap.set mhi (y1, ch) (sa +^ EC.nth default p i, h)) (ro.set (EC.take (i + 1) p) y1) pi (pref.set (EC.take (i + 1) p) (y1, y2)) pref0 Q p (i + 1) y1 y2 ch

                                                                        A step of the second loop on a fresh block: neither PF.m nor G1.mh know it, nor ro the query take (i + 1) p; the new block gets (y1, y2) on both sides (EC's big inline proof).

                                                                        CF_G1: the oracles' losslessness, footprints, and EC's invariant #

                                                                        @[simp]

                                                                        EC's Block.DBlock.dunifin_ll, as the expectation of 1 (what auto leaves).

                                                                        @[simp]

                                                                        EC's Capacity.DCapacity.dunifin_ll, as the expectation of 1.

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

                                                                        EC's equiv eq_fi (D <: DISTINGUISHER {-PF, -RO, -G1}) : DPRestr(PF).fi ~ DPRestr(G1(DRestr(D)).S).fi : …, its proof EC's: the call with its invariant, exists*, the ambient cases on INV_CF_G1, PF.mi, G1.mi and the handle's flag, EC's rcondt/rcondf positions, and EC's closers (lemma1', lemma2', m_p_of_INV; EC's smt as smt_close). D is not a parameter: neither procedure calls it (EC's restriction only frames the call).

                                                                        EC's equiv eq_f (D <: DISTINGUISHER {-PF, -RO, -G1}) : DPRestr(PF).f ~ DPRestr(G1(DRestr(D)).S).f : …, its proof EC's: the call with its invariant, exists*, the ambient cases, seq 2 2/seq 0 3/seq 0 1 with EC's conditions, swap{2} 3 -2, EC's rcondt/rcondf positions (inline F.RO.get between them), and EC's closers (lemma1, lemma2, lemma3, m_p_of_INV; EC's smt as smt_close). Deviations: EC's inline closer of the path case (~100 lines) is the old port's f_path_inv; one conseq to G1.bext{2} before the last auto of the Unknown branch (auto with INV_CF_G1 through the inlined oracle is too slow).

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

                                                                        EC's first bullet of PFf_Cf's first loop body (prefix_gt0_mem, prefix_take_leq, the m_p part of the invariant): the next prefix of a queried path is known.

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

                                                                        EC's equiv PFf_Cf (D <: DISTINGUISHER) : DFRestr(SqueezelessSponge(PF)).f ~ DFRestr(G1(DRestr(D)).M).f : …, its proof EC's, block by block (EC's lines as comments): proc; sp; inline*, the ifs with 1,3:auto, swap, wp 1 5, conseq, seq 1 1, splitwhile, the two loops with EC's invariants, alias, case, rcondt/rcondf at EC's positions. Deviations: hand closers where smt_close fails (EC's smt); EC's long inline closers are the old port's lemmas (PJ1_step, PJ1_PJ2, PJ2_known, PJ2_fresh, PJ2L_step); ={bs} added to the first loop's invariant and the left's samplings swapped for EC's swap{2} -3 (the gaps listed above).

                                                                        theorem GaudisCrypt.SHA3.Pilot.Handle.CF_G1 [SLCommon.Params] (D : SLCommon.DISTINGUISHER) [Module.Declared D (ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ Handle.G1.m.footprint ⊔ Handle.G1.mi.footprint ⊔ Handle.G1.mh.footprint ⊔ Handle.G1.mhi.footprint ⊔ Handle.G1.bext.footprint ⊔ Handle.G1.bcol.footprint ⊔ SLCommon.C.queries.footprint ⊔ Handle.ROhandle.FRO.m.footprint ⊔ Handle.G1.paths.footprint ⊔ Handle.G1.chandle.footprint ⊔ SLCommon.Redo.prefixes.footprint ⊔ SLCommon.C.c.footprint ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.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 (ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ Handle.G1.m.footprint ⊔ Handle.G1.mi.footprint ⊔ Handle.G1.mh.footprint ⊔ Handle.G1.mhi.footprint ⊔ Handle.G1.bext.footprint ⊔ Handle.G1.bcol.footprint ⊔ SLCommon.C.queries.footprint ⊔ Handle.ROhandle.FRO.m.footprint ⊔ Handle.G1.paths.footprint ⊔ Handle.G1.chandle.footprint ⊔ SLCommon.Redo.prefixes.footprint ⊔ SLCommon.C.c.footprint ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.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) :
                                                                        equiv[ (ConcreteF.CF (SLCommon.DRestr D)) ~ (Handle.G1 (SLCommon.DRestr D)) : ={(FVP.fvP D).touched_getter} ==> ¬(§Handle.G1.bcol{2} = true ∨ §Handle.G1.bext{2} = true) → ={res} ]

                                                                        EC's equiv CF_G1 : CF(DRestr(D)).main ~ G1(DRestr(D)).main : ={glob D} ==> !(G1.bcol \/ G1.bext){2} => ={res}, its proof EC's (see the module docstring).

                                                                        theorem GaudisCrypt.SHA3.Pilot.Handle.Real_G1 [SLCommon.Params] (D : SLCommon.DISTINGUISHER) [Module.Declared D (ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ Handle.G1.m.footprint ⊔ Handle.G1.mi.footprint ⊔ Handle.G1.mh.footprint ⊔ Handle.G1.mhi.footprint ⊔ Handle.G1.bext.footprint ⊔ Handle.G1.bcol.footprint ⊔ SLCommon.C.queries.footprint ⊔ Handle.ROhandle.FRO.m.footprint ⊔ Handle.G1.paths.footprint ⊔ Handle.G1.chandle.footprint ⊔ SLCommon.Redo.prefixes.footprint ⊔ SLCommon.C.c.footprint ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.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 (ConcreteF.PF.m.footprint ⊔ ConcreteF.PF.mi.footprint ⊔ SLCommon.F.RO.m.footprint ⊔ Handle.ROhandle.RO.m.footprint ⊔ Handle.G1.m.footprint ⊔ Handle.G1.mi.footprint ⊔ Handle.G1.mh.footprint ⊔ Handle.G1.mhi.footprint ⊔ Handle.G1.bext.footprint ⊔ Handle.G1.bcol.footprint ⊔ SLCommon.C.queries.footprint ⊔ Handle.ROhandle.FRO.m.footprint ⊔ Handle.G1.paths.footprint ⊔ Handle.G1.chandle.footprint ⊔ SLCommon.Redo.prefixes.footprint ⊔ SLCommon.C.c.footprint ⊔ Common.Perm.m.footprint ⊔ Common.Perm.mi.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_G1 &m : Pr[GReal(D).main() @ &m: res /\ C.c <= max_size] <= Pr[G1(DRestr(D)).main() @ &m: res] + (max_size ^ 2 - max_size)%r * inv 2%r * mu dstate (pred1 witness) + Pr[G1(DRestr(D)).main() @&m: G1.bcol] + Pr[G1(DRestr(D)).main() @&m: G1.bext].