Documentation

GaudisCrypt.Examples.SHA3.SmartCounter.SLCommonCore

The squeezeless sponge's common operators (EasyCrypt proof/smart_counter/SLCommon.ec, the part #

without modules)

The parameter class (op max_size), the state and handle types, permutations, handle paths, the Prefix theory and the handle operators: what both the port SLCommon.lean and its EC-fidelity port Pilot/SLCommon.lean use, under the same names (namespace GaudisCrypt.SHA3.SLCommon). prefix is a Lean keyword, hence «prefix».

EasyCrypt's op max_size : { int | 0 <= max_size } as max_ge0: the maximal number of calls to the permutation and its inverse, including those performed by the construction.

Instances
    @[reducible, inline]
    abbrev GaudisCrypt.SHA3.SLCommon.«[+]» {α : Type u_1} {β : Type u_2} (x : β) :
    α → β

    abbrev ([+]) (x : 'b) = fun (_ : 'a) => x.

    Equations
    Instances For

      clone export Tuple as TupleBl with type t <- block, op Support.enum <- Block.blocks.

      Equations
      Instances For

        Useful types and operators for the proof #

        def GaudisCrypt.SHA3.SLCommon.incl {α β : Type} [DecidableEq α] (m m' : EC.FMap α β) :
        Equations
        Instances For
          @[reducible, inline]
          Equations
          Instances For
            Equations
            Instances For
              theorem GaudisCrypt.SHA3.SLCommon.half_permutation_set {α : Type} [DecidableEq α] (m' mi' : EC.FMap α α) (x' y' : α) :
              (∀ (x : α), m'.rng x → mi'.dom x) → ∀ (x : α), (m'.set x' y').rng x → (mi'.set y' x').dom x
              theorem GaudisCrypt.SHA3.SLCommon.pre_permutation_set [Params] {α : Type} [DecidableEq α] (m mi : EC.FMap α α) (x y : α) :
              is_pre_permutation m mi → is_pre_permutation (m.set x y) (mi.set y x)

              Functional version of the construction, using handles.

              Equations
              Instances For
                Instances For

                  Prefixes (EC's theory Prefix) #

                  theorem GaudisCrypt.SHA3.SLCommon.Prefix.take_take {α : Type} (l : List α) (i j : ℤ) :
                  EC.take i (EC.take j l) = EC.take (min i j) l
                  theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_take_leq {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) (i : ℤ) :
                  i ≤ «prefix» l1 l2 → EC.take i l1 = EC.take i l2
                  theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_nth {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) :
                  have i := «prefix» l1 l2; ∀ (j : ℤ), 0 ≤ j ∧ j < i → EC.nth default l1 j = EC.nth default l2 j
                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.aux_mem_get_max_prefix {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) (ll : List (List α)) :
                      max_prefix l1 l2 ll = l2 ∨ max_prefix l1 l2 ll ∈ ll

                      Not an EasyCrypt lemma: elems (fdom m) lists the domain (EasyCrypt's memE and mem_fdom together).

                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.take_get_max_prefix2 [Params] (l : List Common.block) (prefixes : EC.FMap (List Common.block) state) (i : ℤ) :
                      (∃ (b : List Common.block), prefixes.dom b) → all_prefixes prefixes → i ≤ «prefix» l (get_max_prefix l (EC.FSet.elems prefixes.fdom)) → prefixes.dom (EC.take i l)
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_take_min {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) (i : ℤ) :
                      «prefix» (EC.take i l1) l2 = min («prefix» l1 l2) (max i 0)

                      Not an EasyCrypt lemma: the common prefix of a truncated list.

                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_cat {α : Type} [DecidableEq α] [Inhabited α] (l l1 l2 : List α) :
                      «prefix» (l ++ l1) (l ++ l2) = EC.size l + «prefix» l1 l2
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_leq_take {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) (i : ℤ) :
                      0 ≤ i ∧ i ≤ min (EC.size l1) (EC.size l2) → EC.take i l1 = EC.take i l2 → i ≤ «prefix» l1 l2
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.get_prefix {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) (i : ℤ) :
                      0 ≤ i ∧ i ≤ min (EC.size l1) (EC.size l2) → EC.drop i l1 = [] ∨ EC.drop i l2 = [] ∨ i < min (EC.size l1) (EC.size l2) ∧ EC.nth default l1 i ≠ EC.nth default l2 i → EC.take i l1 = EC.take i l2 → i = «prefix» l1 l2
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.get_max_prefix_is_max {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) (ll : List (List α)) (l3 : List α) :
                      l3 ∈ ll → «prefix» l1 l3 ≤ «prefix» l1 (max_prefix l1 l2 ll)
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.get_max_prefix_max {α : Type} [DecidableEq α] [Inhabited α] (l : List α) (ll : List (List α)) (l2 : List α) :
                      l2 ∈ ll → «prefix» l l2 ≤ «prefix» l (get_max_prefix l ll)
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_inv_leq [Params] (l : List Common.block) (i : ℤ) (prefixes : EC.FMap (List Common.block) state) (queries : EC.FMap (List Common.block) Common.block) :
                      0 ≤ i ∧ i ≤ EC.size l → EC.FSet.elems queries.fdom ≠ [] → all_prefixes prefixes → prefixes.dom (EC.take i l) → prefix_inv queries prefixes → i ≤ «prefix» l (get_max_prefix l (EC.FSet.elems queries.fdom))
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_max_prefix_eq_size {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 : List α) (ll : List (List α)) :
                      l1 = l2 ∨ l1 ∈ ll → «prefix» l1 (max_prefix l1 l2 ll) = EC.size l1
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.get_max_prefix_exists {α : Type} [DecidableEq α] [Inhabited α] (l : List α) (ll : List (List α)) :
                      ll ≠ [] → ∃ (l2 : List α), EC.take («prefix» l (get_max_prefix l ll)) l ++ l2 ∈ ll
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.max_prefix_congr {α : Type} [DecidableEq α] [Inhabited α] (l1 l1' l2 : List α) (ll : List (List α)) (h : ∀ (l' : List α), l' = l2 ∨ l' ∈ ll → «prefix» l1 l' = «prefix» l1' l') :
                      max_prefix l1 l2 ll = max_prefix l1' l2 ll

                      Not an EasyCrypt lemma: max_prefix depends on its first argument only through the common prefixes with the candidates.

                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_prefix_prefix {α : Type} [DecidableEq α] [Inhabited α] (l1 l2 l3 : List α) (ll : List (List α)) :
                      «prefix» l1 l2 ≤ «prefix» l1 l3 → «prefix» l1 (max_prefix l1 l2 ll) ≤ «prefix» l1 (max_prefix l1 l3 ll)
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_lt_size {α : Type} [DecidableEq α] [Inhabited α] (l : List α) (ll : List (List α)) :
                      «prefix» l (get_max_prefix l ll) < EC.size l → ∀ (i : ℤ), «prefix» l (get_max_prefix l ll) < i → EC.take i l ∉ ll
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.asfadst [Params] (queries : EC.FMap (List Common.block) Common.block) (prefixes : EC.FMap (List Common.block) state) (bs : List Common.block) :
                      prefix_inv queries prefixes → EC.FSet.elems queries.fdom ≠ [] → all_prefixes prefixes → (∀ (j : ℤ), 0 ≤ j ∧ j ≤ EC.size bs → prefixes.dom (EC.take j bs)) → EC.take («prefix» bs (get_max_prefix bs (EC.FSet.elems queries.fdom)) + 1) bs = bs
                      theorem GaudisCrypt.SHA3.SLCommon.Prefix.prefix_exchange_prefix_inv [Params] {α : Type} [DecidableEq α] [Inhabited α] (ll1 ll2 : List (List α)) (l : List α) :
                      (∀ l2 ∈ ll1, l2 ∈ ll2) → (∀ l2 ∈ ll1, ∀ (i : ℤ), EC.take i l2 ∈ ll2) → (∀ l2 ∈ ll2, ∃ (l3 : List α), l2 ++ l3 ∈ ll1) → «prefix» l (get_max_prefix l ll1) = «prefix» l (get_max_prefix l ll2)
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def GaudisCrypt.SHA3.SLCommon.Prefix.invm {α β : Type} [DecidableEq α] [DecidableEq β] (m mi : EC.FMap (α × β) (α × β)) :
                        Equations
                        Instances For
                          theorem GaudisCrypt.SHA3.SLCommon.Prefix.invm_set {α β : Type} [DecidableEq α] [DecidableEq β] (m mi : EC.FMap (α × β) (α × β)) (x y : α × β) :
                          ¬m.dom x → ¬m.rng y → invm m mi → invm (m.set x y) (mi.set y x)

                          Operators and properties of handles #

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem GaudisCrypt.SHA3.SLCommon.hinvP [Params] (handles : handles) (c : Common.capacity) :
                              if hinv handles c = none then ∀ (h : handle) (f : EC.PROM.flag), EC.FMap.get handles h ≠ some (c, f) else ∃ (f : EC.PROM.flag), EC.FMap.get handles (EC.oget (hinv handles c)) = some (c, f)
                              theorem GaudisCrypt.SHA3.SLCommon.huniq_hinv [Params] (handles : handles) (h : handle) :
                              huniq handles → EC.FMap.dom handles h → hinv handles (EC.oget (EC.FMap.get handles h)).1 = some h
                              theorem GaudisCrypt.SHA3.SLCommon.huniq_hinvK_h [Params] (h : handle) (handles : handles) (c : Common.capacity) :
                              huniq handles → EC.FMap.get handles h = some (c, EC.PROM.Known) → hinvK handles c = some h