structure
Hex.Perm.Cycle.Decomposition
{n : Nat}
(p : Perm n)
(seen : Vector Bool n)
(cs : Array (Array (Fin n)))
:
The accumulated cycles are valid and disjoint, and account for exactly the marked points.
- distinct : (List.flatMap Array.toList cs.toList).Nodup
Instances For
theorem
Hex.Perm.Cycle.Decomposition.push
{n : Nat}
{p : Perm n}
{seen next : Vector Bool n}
{cs : Array (Array (Fin n))}
{c : Array (Fin n)}
(h : Decomposition p seen cs)
(hc : Valid p c)
(hm : ∀ (x : Fin n), next[↑x] = true ↔ seen[↑x] = true ∨ x ∈ c)
(hd : ∀ (x : Fin n), x ∈ c → seen[↑x] = false)
:
Decomposition p next (cs.push c)
theorem
Hex.Perm.Cycle.scan_complete
{n : Nat}
(p : Perm n)
(xs : List (Fin n))
(seen : Vector Bool n)
(cs : Array (Array (Fin n)))
(h : Decomposition p seen cs)
(outside : ∀ (x : Fin n), ¬x ∈ xs → seen[↑x] = true)
:
The scan preserves the partial decomposition. Every point outside the remaining list is marked, so exhausting that list gives a full partition.
theorem
Hex.Perm.allCycles_valid
{n : Nat}
(p : Perm n)
(c : Array (Fin n))
(hc : c ∈ p.allCycles)
:
Cycle.Valid p c
Every emitted cycle follows the permutation, including wrap-around.
No point occurs twice in the cycle decomposition.