Documentation

HexPermGroup.Kernel.Pack

The field width for degree n: the least W ≥ 1 with n < 2^W. It is computed by n doubling steps rather than Nat.log2, which the kernel reduces through well-founded recursion.

Equations
Instances For

    2^W - 1, the mask of one field.

    Equations
    Instances For

      Field i of x.

      Equations
      Instances For
        def Hex.PermGroup.Kernel.packFn (W : Nat) (f : Nat → Nat) (k : Nat) :

        The number whose field i is f i for i < k, with no higher bits, assuming every f i is below 2^W.

        Equations
        Instances For

          Composition (x * y)(i) = x(y(i)) of packed permutations of degree n.

          Equations
          Instances For

            The packed identity of degree n.

            Equations
            Instances For

              The packing of a permutation of Fin n, with the width width n.

              Equations
              Instances For
                theorem Hex.PermGroup.Kernel.one_le_width_go (n k : Nat) :
                1 ≤ Nat.rec 1 (fun (x w : Nat) => bif (Nat.shiftLeft 1 w).ble n then w.succ else w) k
                theorem Hex.PermGroup.Kernel.width_go_spec (n k : Nat) :
                have w := Nat.rec 1 (fun (x w : Nat) => bif (Nat.shiftLeft 1 w).ble n then w.succ else w) k; n < 2 ^ w ∨ w = k + 1

                After k steps the width is either k + 1 or already large enough.

                theorem Hex.PermGroup.Kernel.field_eq (W x i : Nat) :
                field W x i = x / 2 ^ (i * W) % 2 ^ W
                theorem Hex.PermGroup.Kernel.field_lt (W x i : Nat) :
                field W x i < 2 ^ W
                theorem Hex.PermGroup.Kernel.packFn_succ (W : Nat) (f : Nat → Nat) (k : Nat) :
                packFn W f (k + 1) = packFn W f k + f k * 2 ^ (k * W)
                theorem Hex.PermGroup.Kernel.packFn_lt (W : Nat) (f : Nat → Nat) (k : Nat) :
                (∀ (i : Nat), i < k → f i < 2 ^ W) → packFn W f k < 2 ^ (k * W)
                theorem Hex.PermGroup.Kernel.field_packFn (W : Nat) (f : Nat → Nat) (k : Nat) :
                (∀ (i : Nat), i < k → f i < 2 ^ W) → ∀ (i : Nat), i < k → field W (packFn W f k) i = f i

                Reading back a field of a packed value.

                theorem Hex.PermGroup.Kernel.field_ident {n W i : Nat} (hn : n < 2 ^ W) (hi : i < n) :
                field W (ident n W) i = i
                theorem Hex.PermGroup.Kernel.field_comp (n W x y : Nat) {i : Nat} (hi : i < n) :
                field W (comp n W x y) i = field W x (field W y i)
                theorem Hex.PermGroup.Kernel.field_pack {n : Nat} (p : Perm n) (i : Fin n) :
                field (width n) (pack p) ↑i = ↑(p.get i)