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
- Hex.PermGroup.Kernel.width n = Nat.rec 1 (fun (x w : Nat) => bif (Nat.shiftLeft 1 w).ble n then w.succ else w) n
Instances For
2^W - 1, the mask of one field.
Equations
- Hex.PermGroup.Kernel.mask W = (Nat.shiftLeft 1 W).sub 1
Instances For
Field i of x.
Equations
- Hex.PermGroup.Kernel.field W x i = (x.shiftRight (i.mul W)).land (Hex.PermGroup.Kernel.mask W)
Instances For
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
- Hex.PermGroup.Kernel.comp n W x y = Hex.PermGroup.Kernel.packFn W (fun (i : Nat) => Hex.PermGroup.Kernel.field W x (Hex.PermGroup.Kernel.field W y i)) n
Instances For
The packed identity of degree n.
Equations
- Hex.PermGroup.Kernel.ident n W = Hex.PermGroup.Kernel.packFn W (fun (i : Nat) => i) n
Instances For
The packing of a permutation of Fin n, with the width width n.
Equations
- Hex.PermGroup.Kernel.pack p = Hex.PermGroup.Kernel.packFn (Hex.PermGroup.Kernel.width n) (fun (i : Nat) => if h : i < n then ↑(p.get ⟨i, h⟩) else 0) n