Odd-even transposition routes #
An n-round sorting network gives the alternating permutation route used for complete flags.
Lean Pool port of wewantmoore commit d59bd80ea93fabb9faf769e790ab47692645e022. The port adds a namespace and adapts proofs to the current Mathlib APIs and repository style.
Sort each disjoint consecutive pair of list entries.
Equations
- MooreBound.OddEvenSorting.pairPhase (a :: b :: xs) = min a b :: max a b :: MooreBound.OddEvenSorting.pairPhase xs
- MooreBound.OddEvenSorting.pairPhase x✝ = x✝
Instances For
Apply a comparator layer, optionally leaving the first entry fixed.
Equations
Instances For
The integer count of true bits among the first i entries.
Equations
- MooreBound.OddEvenSorting.pref xs i = ↑(List.count true (List.take i xs))
Instances For
The comparator layer whose offset alternates with the round number.
Equations
- MooreBound.OddEvenSorting.phaseN q xs = MooreBound.OddEvenSorting.phase (decide (q % 2 = 1)) xs
Instances For
The total number of true bits in a Boolean list.
Equations
Instances For
Iterate alternating comparator layers starting with round q.
Equations
- MooreBound.OddEvenSorting.evolve q xs 0 = xs
- MooreBound.OddEvenSorting.evolve q xs t.succ = MooreBound.OddEvenSorting.phaseN (q + t) (MooreBound.OddEvenSorting.evolve q xs t)
Instances For
Prefix count in the sorted Boolean word with z zeroes.
Equations
- MooreBound.OddEvenSorting.low z i = max 0 (↑i - ↑z)
Instances For
A positive excess of the prefix count above its sorted lower bound.
Equations
- MooreBound.OddEvenSorting.Bad z xs i h = (1 ≤ h ∧ MooreBound.OddEvenSorting.low z i + h ≤ MooreBound.OddEvenSorting.pref xs i)
Instances For
The monotone Boolean threshold used in the zero-one sorting argument.
Equations
- MooreBound.OddEvenSorting.threshold a x = decide (a ≤ x)
Instances For
The permutation whose one-line notation is l.
Equations
- MooreBound.OddEvenSorting.permOfList l hp = (finCongr ⋯).trans (List.Nodup.getEquivOfForallMemList l ⋯ ⋯)
Instances For
A layer preserves prefix sets at every inactive rank.
Equations
- MooreBound.OddEvenSorting.OrderingStep2 s σ τ = ∀ (i : Fin (n + 1)), ↑i % 2 ≠ (↑s + 1) % 2 → MooreBound.OddEvenSorting.PrefixSet2 σ i = MooreBound.OddEvenSorting.PrefixSet2 τ i
Instances For
Odd--even transposition routing, in the exact combinatorial form needed for Lemma 2.1.