A maximal constant-count run inside one original cell. Both endpoints are inclusive, as in the cached endpoint array.
Instances For
structure
Hex.GraphIso.Nauty.Sparse.Index.Runs
(n first last upto : Nat)
(lab hits starts ends : Array Nat)
:
Cache entries for the completed runs of a count split. This invariant does not require the next run's boundary to have been written yet.
Instances For
theorem
Hex.GraphIso.Nauty.Sparse.Index.Runs.of_first
{n first last b : Nat}
{lab hits starts ends : Array Nat}
(hr : Run lab hits first last first b)
(hb : b < n)
(hs : starts.size = n)
(he : ends.size = n)
(hv : ∀ (q : Nat), first ≤ q → q ≤ b → starts[lab[q]!]! = if first = b then n else first)
:
Runs n first last (b + 1) lab hits starts (ends.setIfInBounds first b)
The first completed run has no earlier run to preserve.
theorem
Hex.GraphIso.Nauty.Sparse.Index.Runs.extend
{n first last a b : Nat}
{lab hits starts ends out : Array Nat}
(h : Runs n first last a lab hits starts ends)
(hr : Run lab hits first last a b)
(hb : b < n)
(hs : out.size = n)
(ho : ∀ (q : Nat), q < n → out[lab[q]!]! = if a ≤ q ∧ q ≤ b then if a = b then n else a else starts[lab[q]!]!)
:
Runs n first last (b + 1) lab hits out (ends.setIfInBounds a b)
Scattering one whole run preserves every preceding run's entries and extends the completed prefix through the newly stored endpoint.
theorem
Hex.GraphIso.Nauty.Sparse.Index.Scatter.prepend
{n : Nat}
{lab before after : Array Nat}
{a b : Nat}
(h : Scatter n lab before after (a + 1) (b + 1) a)
(hbound : ∀ (i : Nat), i < n → lab[i]! < n)
(hinj : ∀ (i j : Nat), i < n → j < n → lab[i]! = lab[j]! → i = j)
(hab : a ≤ b)
(hb : b < n)
:
The tail scan writes positions after the run's first vertex. The final first-vertex write completes that scatter, with the singleton sentinel.