The number of 63-bit limbs holding n vertices.
Equations
- Hex.GraphIso.Nauty.limbCount n = (n + 62) / 63
Instances For
A vertex renaming: injective everywhere and range-preserving in both directions. Images under renamings are the equivariance the search theory works with.
The underlying vertex map.
Global injectivity.
The vertex range is preserved in both directions.
Instances For
A vertex set over n vertices: limbCount n limbs, each an unboxed
63-bit word, with no vertex at or above n.
The limbs, least significant first.
Instances For
Equality compares the limb arrays. Hex.instDecidableEqArray keeps
the comparison kernel-reducible across the module boundary.
A limb array is well formed for n vertices when it has limbCount n
limbs, every limb is a 63-bit word, and no bit at or above n is set.
The runtime never checks this. Each operation preserves it by proof.
Instances For
The empty set.
Equations
Instances For
Equations
The limbwise combination of two packed sets. Hex.Array.zipWith'
reduces in the kernel where Lean's own Array.zipWith stalls, and
compiles to the same loop.
Equations
- Hex.GraphIso.Nauty.VSet.zipLimbs op s t = Hex.Array.zipWith' op s.limbs t.limbs
Instances For
Intersection.
Equations
- s.inter t = Hex.GraphIso.Nauty.VSet.ofLimbs (Hex.GraphIso.Nauty.VSet.zipLimbs (fun (x1 x2 : Nat) => x1 &&& x2) s t) ⋯
Instances For
Union.
Equations
- s.union t = Hex.GraphIso.Nauty.VSet.ofLimbs (Hex.GraphIso.Nauty.VSet.zipLimbs (fun (x1 x2 : Nat) => x1 ||| x2) s t) ⋯
Instances For
Symmetric difference.
Equations
- s.xor t = Hex.GraphIso.Nauty.VSet.ofLimbs (Hex.GraphIso.Nauty.VSet.zipLimbs (fun (x1 x2 : Nat) => x1 ^^^ x2) s t) ⋯
Instances For
The members of limb i, in order, as vertex numbers.
Equations
- s.limbMembers i = List.map (fun (x : Nat) => 63 * i + x) (List.filter s.limbs[i]!.testBit (List.range 63))
Instances For
The members below 63 * k, as the concatenation of the limb blocks.
Fold a function of corresponding limb pairs over all limbs.
Equations
- Hex.GraphIso.Nauty.VSet.foldLimbs f s t init = Hex.GraphIso.Nauty.VSet.foldLimbs.go f s t s.limbs.size 0 init
Instances For
Equations
- Hex.GraphIso.Nauty.VSet.foldLimbs.go f s t 0 a✝¹ a✝ = a✝
- Hex.GraphIso.Nauty.VSet.foldLimbs.go f s t fuel.succ a✝¹ a✝ = Hex.GraphIso.Nauty.VSet.foldLimbs.go f s t fuel (a✝¹ + 1) (f s.limbs[a✝¹]! t.limbs[a✝¹]! a✝)
Instances For
Whether every limb satisfies a predicate of the limb pair, with early exit.
Equations
- Hex.GraphIso.Nauty.VSet.allLimbs p s t = Hex.GraphIso.Nauty.VSet.allLimbs.go p s t s.limbs.size 0
Instances For
The number of members.
Equations
- s.card = Array.foldl (fun (acc x : Nat) => acc + Hex.GraphIso.Nauty.popCount x) 0 s.limbs
Instances For
card (s.inter t) without materializing the intersection.
Equations
- s.cardInter t = Hex.GraphIso.Nauty.VSet.foldLimbs (fun (a b acc : Nat) => acc + Hex.GraphIso.Nauty.popCount (a &&& b)) s t 0
Instances For
isEmpty (s.inter t) without materializing the intersection.
Equations
- s.interIsEmpty t = Hex.GraphIso.Nauty.VSet.allLimbs (fun (a b : Nat) => a &&& b == 0) s t
Instances For
The number of members below a bound: the counting specification of
card.
Equations
- s.countBelow k = List.countP s.mem (List.range k)
Instances For
The least vertex at or after limb i, if any.
Equations
Instances For
The least member greater than pos, or none: nauty's
nextelement, iterating a set in ascending vertex order. pos = none
starts from the least member.
Equations
Instances For
Equations
- Hex.GraphIso.Nauty.VSet.toList.go s 0 a✝¹ a✝ = a✝
- Hex.GraphIso.Nauty.VSet.toList.go s fuel.succ a✝¹ a✝ = Hex.GraphIso.Nauty.VSet.toList.go s fuel (a✝¹ + 1) (Hex.GraphIso.Nauty.toListGo (63 * a✝¹) 63 s.limbs[a✝¹]! a✝)
Instances For
The row order.
Equations
- s.rowCmp t = Hex.GraphIso.Nauty.VSet.rowCmp.go s t s.limbs.size 0
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Hex.GraphIso.Nauty.VSet.rowCmp.go s t 0 a✝ = Ordering.eq
Instances For
The outcome of the limb scan from i with fuel limbs. Equal
prefixes give .eq. Otherwise the first differing limb decides, by its
least differing bit.
The row order is transitive.
The set of vertices below n satisfying a predicate.
Equations
- Hex.GraphIso.Nauty.VSet.ofFn f = List.foldl (fun (s : Hex.GraphIso.Nauty.VSet n) (v : Nat) => if f v = true then s.insert v else s) Hex.GraphIso.Nauty.VSet.empty (List.range n)
Instances For
The set of the vertices of a list.
Equations
Instances For
One limb of ofFn: Horner accumulation over the limb's vertices,
most significant first, so the accumulator stays a scalar throughout.
Equations
Instances For
The limbs of ofFn, least significant first.
Equations
- Hex.GraphIso.Nauty.VSet.ofFnLimbs f 0 x✝ = x✝
- Hex.GraphIso.Nauty.VSet.ofFnLimbs f i.succ x✝ = Hex.GraphIso.Nauty.VSet.ofFnLimbs f i (x✝.push (Hex.GraphIso.Nauty.VSet.ofFnLimb f (63 * x✝.size) 63 0))
Instances For
ofFn built one limb at a time: allocation-free and without the
List.range fold.
Equations
Instances For
The image of a set under a vertex map, dropping targets outside the
range: nauty's permset.
Equations
- Hex.GraphIso.Nauty.VSet.image σ s = List.foldl (fun (t : Hex.GraphIso.Nauty.VSet n) (v : Nat) => if s.mem v = true then t.insert (σ v) else t) Hex.GraphIso.Nauty.VSet.empty (List.range n)
Instances For
The set bits of one limb, by repeated lowest-bit extraction, each
inserted through σ.
Equations
- One or more equations did not get rendered due to their size.
- Hex.GraphIso.Nauty.VSet.imageLimb σ base 0 x✝¹ x✝ = x✝
Instances For
image walking the set bits of each limb by repeated lowest-bit
extraction, so the cost is proportional to the members and the limbs,
never to n bit tests.
Equations
Instances For
Emptiness of an intersection is preserved by a renaming.