Mixed-radix encoding, with the top-level orbit digit most significant.
Equations
- (Hex.PermGroup.Chain.leaf generators words).encode x_2 = ⟨0, Nat.zero_lt_one⟩
- (Hex.PermGroup.Chain.cons level tail).encode digits = ⟨↑digits.fst * tail.orbitProduct + ↑(tail.encode digits.snd), ⋯⟩
Instances For
Exact division and remainder recover the mixed-radix digits. An in-range index itself proves that every radix encountered on its path is positive.
Equations
- (Hex.PermGroup.Chain.leaf generators words).decode x_2 = PUnit.unit
- (Hex.PermGroup.Chain.cons level tail).decode k = (⟨↑k / tail.orbitProduct, ⋯⟩, tail.decode ⟨↑k % tail.orbitProduct, ⋯⟩)
Instances For
Sifting with bounded orbit digits. Failures carry no choice and cannot be used as a rank; membership still comes from the complete-chain checker.
Equations
- One or more equations did not get rendered due to their size.
- (Hex.PermGroup.Chain.leaf generators words).choose x✝¹ x✝ = if x✝ = Hex.Perm.id n then some PUnit.unit else none
Instances For
def
Hex.PermGroup.Group.sampleFrom
{n : Nat}
{m : Type → Type}
[Functor m]
(draw : (bound : Nat) → 0 < bound → m (Fin bound))
(G : Group n)
:
m (Element G)
Apply unranking to one index from the supplied source. The source receives
the positive exact order; its effects and failures are preserved by map.
Equations
- Hex.PermGroup.Group.sampleFrom draw G = G.unrank <$> draw G.order ⋯