Documentation

HexGraphIso.Kernel.Packed

@[simp]
theorem Hex.GraphIso.Nauty.land_eq (a b : Nat) :
a.land b = a &&& b
@[simp]
theorem Hex.GraphIso.Nauty.lor_eq (a b : Nat) :
a.lor b = a ||| b
@[simp]
theorem Hex.GraphIso.Nauty.xor_eq (a b : Nat) :
a.xor b = a ^^^ b
@[simp]
@[simp]
@[simp]
theorem Hex.GraphIso.Nauty.mul_eq (a b : Nat) :
a.mul b = a * b
@[simp]
theorem Hex.GraphIso.Nauty.add_eq (a b : Nat) :
a.add b = a + b
@[simp]
theorem Hex.GraphIso.Nauty.sub_eq (a b : Nat) :
a.sub b = a - b
@[simp]
theorem Hex.GraphIso.Nauty.div_eq (a b : Nat) :
a.div b = a / b
@[simp]
theorem Hex.GraphIso.Nauty.mod_eq (a b : Nat) :
a.mod b = a % b
theorem Hex.GraphIso.Nauty.cond_beq {α : Type} (a b : Nat) (x y : α) :
(bif a.beq b then x else y) = if a = b then x else y
theorem Hex.GraphIso.Nauty.cond_blt {α : Type} (a b : Nat) (x y : α) :
(bif a.blt b then x else y) = if a < b then x else y
theorem Hex.GraphIso.Nauty.cond_ble {α : Type} (a b : Nat) (x y : α) :
(bif a.ble b then x else y) = if a b then x else y
theorem Hex.GraphIso.Nauty.beq_eq_beq (a b : Nat) :
a.beq b = (a == b)
theorem Hex.GraphIso.Nauty.cond_beq_true {α : Type} (a : Bool) (x y : α) :
(bif a then x else y) = if a = true then x else y
def Hex.GraphIso.Nauty.iterUpImpl {α : Type} (k : Nat) (f : Natαα) (a : α) :
α

The compiled form of iterUp.

Equations
Instances For
    @[implemented_by Hex.GraphIso.Nauty.iterUpImpl]
    def Hex.GraphIso.Nauty.iterUp {α : Type} (k : Nat) (f : Natαα) (a : α) :
    α

    iterUp k f a = f (k - 1) (… (f 0 a)), one Nat.rec step per iteration.

    Equations
    Instances For
      theorem Hex.GraphIso.Nauty.iterUp_go {α : Type} (k : Nat) (f : Natαα) (j : Nat) (a : α) :
      j kNat.rec (motive := fun (x : Nat) => αα) (fun (a : α) => a) (fun (i : Nat) (ih : αα) (a : α) => ih (f ((k.sub 1).sub i) a)) j a = List.foldl (fun (a : α) (i : Nat) => f i a) a (List.range' (k - j) j)
      theorem Hex.GraphIso.Nauty.iterUp_eq_foldl {α : Type} (k : Nat) (f : Natαα) (a : α) :
      iterUp k f a = List.foldl (fun (a : α) (i : Nat) => f i a) a (List.range k)
      def Hex.GraphIso.Nauty.fuelRecImpl {β : Type} :
      Natβ(ββ)β

      The compiled form of fuelRec.

      Equations
      Instances For
        @[implemented_by Hex.GraphIso.Nauty.fuelRecImpl]
        def Hex.GraphIso.Nauty.fuelRec {β : Type} (k : Nat) (base : β) (step : ββ) :
        β

        fuelRec k base step = step (… (step base)), k times: the fuel-bounded recursion of a loop with an early exit as one Nat.rec step per unfolding (β is the loop's function type).

        Equations
        Instances For
          theorem Hex.GraphIso.Nauty.fuelRec_zero {β : Type} (base : β) (step : ββ) :
          fuelRec 0 base step = base
          theorem Hex.GraphIso.Nauty.fuelRec_succ {β : Type} (k : Nat) (base : β) (step : ββ) :
          fuelRec (k + 1) base step = step (fuelRec k base step)
          def Hex.GraphIso.Nauty.mapRange {α : Type} (k : Nat) (f : Natα) :
          List α

          (List.range k).map f, built by the loop driver.

          Equations
          Instances For
            theorem Hex.GraphIso.Nauty.mapRange_eq {α : Type} (k : Nat) (f : Natα) :

            (List.range k).all p, by the loop driver.

            Equations
            Instances For

              Membership with the accelerated steps only.

              Equations
              Instances For

                NatSet.insert, raw: a no-op outside the vertex range.

                Equations
                Instances For

                  NatSet.erase, raw: a no-op outside the vertex range.

                  Equations
                  Instances For

                    mash, raw.

                    Equations
                    Instances For

                      cleanup, raw.

                      Equations
                      Instances For

                        popCount of every byte, four bits per entry.

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

                          lowBit of every nonzero byte (and 0 for the zero byte), four bits per entry.

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

                            The table entry of byte b.

                            Equations
                            Instances For

                              The byte loop of popCountK.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem Hex.GraphIso.Nauty.popCountKGo_succ (fuel s acc : Nat) :
                                popCountKGo (fuel + 1) s acc = bif s.beq 0 then acc else popCountKGo fuel (s.shiftRight 8) (acc.add (byteEntry popCountTable (s.land 255)))

                                popCount by bytes, raw.

                                Equations
                                Instances For
                                  theorem Hex.GraphIso.Nauty.popCountK_go_eq (fuel s acc : Nat) :
                                  s < fuelpopCountKGo fuel s acc = acc + popCount s

                                  The byte loop of lowBitK.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    theorem Hex.GraphIso.Nauty.lowBitKGo_succ (fuel s shift : Nat) :
                                    lowBitKGo (fuel + 1) s shift = bif s.beq 0 then 0 else bif (s.land 255).beq 0 then lowBitKGo fuel (s.shiftRight 8) (shift.add 8) else shift.add (byteEntry lowBitTable (s.land 255))

                                    lowBit by bytes, raw.

                                    Equations
                                    Instances For
                                      theorem Hex.GraphIso.Nauty.lowBitK_go_eq (fuel s shift : Nat) :
                                      s < fuellowBitKGo fuel s shift = if s = 0 then 0 else shift + lowBit s

                                      nextElem, raw.

                                      Equations
                                      Instances For

                                        The packed number of a list, low field first.

                                        Equations
                                        Instances For

                                          The kernel-facing read of field i; m = 2 ^ w - 1 is the field mask, passed rather than recomputed. Fields beyond the list read as 0, matching atD.

                                          Equations
                                          Instances For
                                            def Hex.GraphIso.Nauty.pset (w m len a i v : Nat) :

                                            The kernel-facing write of field i below len; a write at or beyond len is the identity, matching List.set.

                                            Equations
                                            Instances For

                                              Every entry below 2 ^ w.

                                              Equations
                                              Instances For
                                                theorem Hex.GraphIso.Nauty.pack_cons (w x : Nat) (l : List Nat) :
                                                pack w (x :: l) = x + 2 ^ w * pack w l
                                                theorem Hex.GraphIso.Nauty.pack_lt (w : Nat) (l : List Nat) :
                                                Small w lpack w l < 2 ^ (w * l.length)
                                                theorem Hex.GraphIso.Nauty.pack_append (w : Nat) (l : List Nat) (v : Nat) :
                                                pack w (l ++ [v]) = pack w l + 2 ^ (w * l.length) * v
                                                theorem Hex.GraphIso.Nauty.pget_eq (w a i : Nat) :
                                                pget w (2 ^ w - 1) a i = a / 2 ^ (w * i) % 2 ^ w

                                                The arithmetic form of a field read.

                                                theorem Hex.GraphIso.Nauty.pget_lt (w a i : Nat) :
                                                pget w (2 ^ w - 1) a i < 2 ^ w
                                                theorem Hex.GraphIso.Nauty.pget_pack (w : Nat) (l : List Nat) (i : Nat) :
                                                Small w lpget w (2 ^ w - 1) (pack w l) i = atD l i 0
                                                theorem Hex.GraphIso.Nauty.pset_pack (w : Nat) (l : List Nat) (i v : Nat) :
                                                Small w lv < 2 ^ wpset w (2 ^ w - 1) l.length (pack w l) i v = pack w (l.set i v)
                                                theorem Hex.GraphIso.Nauty.pack_injective (w : Nat) (l₁ l₂ : List Nat) :
                                                Small w l₁Small w l₂l₁.length = l₂.lengthpack w l₁ = pack w l₂l₁ = l₂
                                                theorem Hex.GraphIso.Nauty.Small.set {w : Nat} {l : List Nat} (h : Small w l) {v : Nat} (hv : v < 2 ^ w) (i : Nat) :
                                                Small w (l.set i v)
                                                theorem Hex.GraphIso.Nauty.Small.append {w : Nat} {l : List Nat} (h : Small w l) {v : Nat} (hv : v < 2 ^ w) :
                                                Small w (l ++ [v])
                                                theorem Hex.GraphIso.Nauty.Small.atD {w : Nat} {l : List Nat} :
                                                Small w l∀ (i : Nat), GraphIso.atD l i 0 < 2 ^ w
                                                structure Hex.GraphIso.Nauty.Rep (w n a : Nat) (l : List Nat) :

                                                The correspondence between a packed number and a list of n entries below 2 ^ w.

                                                Instances For
                                                  theorem Hex.GraphIso.Nauty.Rep.get {w n a : Nat} {l : List Nat} (h : Rep w n a l) (i : Nat) :
                                                  pget w (2 ^ w - 1) a i = atD l i 0
                                                  theorem Hex.GraphIso.Nauty.Rep.get_lt {w n a : Nat} {l : List Nat} :
                                                  Rep w n a l∀ (i : Nat), pget w (2 ^ w - 1) a i < 2 ^ w
                                                  theorem Hex.GraphIso.Nauty.Rep.set {w n a : Nat} {l : List Nat} (h : Rep w n a l) (i : Nat) {v : Nat} (hv : v < 2 ^ w) :
                                                  Rep w n (pset w (2 ^ w - 1) n a i v) (l.set i v)
                                                  theorem Hex.GraphIso.Nauty.Rep.push {w n a : Nat} {l : List Nat} (h : Rep w n a l) {v : Nat} (hv : v < 2 ^ w) :
                                                  Rep w (n + 1) (a.add (v.shiftLeft (w.mul n))) (l ++ [v])
                                                  theorem Hex.GraphIso.Nauty.Rep.ofList {w : Nat} {l : List Nat} (h : Small w l) :
                                                  Rep w l.length (pack w l) l

                                                  Adjacency rows rebuilt from the flat literal as single-Nat bitsets: the flat list is cut into rows once, and each row folds over its own short segment instead of probing the flat list. This is the row form the kernel replay computes with.

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

                                                    The same rows as packed vertex sets: the form the specification side consumes.

                                                    Equations
                                                    Instances For

                                                      The kernel's Nat rows are the packed rows read as bitsets.

                                                      theorem Hex.GraphIso.size_flatRows (nn : Nat) (flat : List Bool) :
                                                      (flatRows nn flat).size = nn
                                                      theorem Hex.GraphIso.flatRows_small (nn : Nat) (flat : List Bool) (r : Nat) :
                                                      r (flatRows nn flat).toListr < 2 ^ nn

                                                      The bit set of a row segment whose head sits at position j.

                                                      Equations
                                                      Instances For
                                                        theorem Hex.GraphIso.atD_of_length_le {α : Type} (l : List α) (i : Nat) (d : α) :
                                                        l.length iatD l i d = d
                                                        theorem Hex.GraphIso.testBit_rowOfSegK (seg : List Bool) (j i : Nat) :
                                                        (rowOfSegK seg j).testBit i = (decide (j i) && atD seg (i - j) false)
                                                        theorem Hex.GraphIso.testBit_rowFold (nn : Nat) (seg : List Bool) (len a acc i : Nat) :
                                                        a + len nn(List.foldl (fun (row j : Nat) => if atD seg j false = true then Nauty.NatSet.insert nn row j else row) acc (List.range' a len)).testBit i = (acc.testBit i || decide (a i i < a + len) && atD seg i false)
                                                        theorem Hex.GraphIso.rowOfSegK_eq (nn : Nat) (seg : List Bool) (hlen : seg.length nn) :
                                                        rowOfSegK seg 0 = List.foldl (fun (row j : Nat) => if atD seg j false = true then Nauty.NatSet.insert nn row j else row) 0 (List.range nn)
                                                        theorem Hex.GraphIso.chunkRows_length_le (m r : Nat) (l seg : List Bool) :
                                                        seg chunkRows r m lseg.length m

                                                        The rows packed with width n, read off the flat literal one segment at a time.

                                                        Equations
                                                        Instances For
                                                          theorem Hex.GraphIso.Kernel.packRows_eq (nn : Nat) (flat : List Bool) :
                                                          packRows nn flat = Nauty.pack nn (flatRows nn flat).toList