More about lengths and simples #
This file continues the study of lengths of permutations, building on the basic definitions of inversions and Lehmer codes. The main results are:
- The length of a permutation equals the length of its inverse
- The single swap lemma: how length changes when multiplying by a simple transposition
- How length changes when multiplying by an arbitrary transposition
- The first reduced word theorem: every permutation can be written as a product of exactly ℓ(σ) simple transpositions
- Properties of length under composition
Main definitions #
Equiv.Perm.simpleTransposition- The simple transposition s_k that swaps k and k+1 (equivalent toAlgebraicCombinatorics.simpleTransposition, seesimpleTransposition_eq_canonical)Equiv.Perm.inversions- The set of inversions (equivalent toAlgebraicCombinatorics.Perm.inv)Equiv.Perm.length- The length/inversion count (equivalent toAlgebraicCombinatorics.Perm.invCount)Equiv.Perm.lehmerEntry- Alias forAlgebraicCombinatorics.Perm.lehmerEntryEquiv.Perm.lehmerCode- The Lehmer code as a list (usesAlgebraicCombinatorics.Perm.lehmerCode_toList)Equiv.Perm.lehmerBlock- The block of simple transpositions for row iEquiv.Perm.canonicalReducedWord- The canonical reduced word from the Lehmer code
Equivalence lemmas #
This file defines local versions of concepts from Inversions1.lean and Basics.lean, providing explicit equivalence lemmas to bridge between the different naming conventions:
inversions_eq_inv-Equiv.Perm.inversions σ = AlgebraicCombinatorics.Perm.inv σlength_eq_invCount-Equiv.Perm.length σ = AlgebraicCombinatorics.Perm.invCount σsimpleTransposition_eq_canonical-Equiv.Perm.simpleTransposition k = AlgebraicCombinatorics.simpleTransposition k
Which definitions to use? #
The definitions in this file (Equiv.Perm.inversions, Equiv.Perm.length, etc.) and those in
Inversions1.lean (AlgebraicCombinatorics.Perm.inv, AlgebraicCombinatorics.Perm.invCount, etc.)
are definitionally equal (provable by rfl). Choose based on context:
| Use case | Recommended namespace |
|---|---|
| Basic inversion properties | AlgebraicCombinatorics.Perm (Inversions1.lean) |
| Lehmer codes (function form) | AlgebraicCombinatorics.Perm (Inversions1.lean) |
| Longest element w₀ | AlgebraicCombinatorics.Perm (Inversions1.lean) |
| Reduced words | Equiv.Perm (this file) |
| Simple transposition products | Equiv.Perm (this file) |
| Coxeter-style arguments | Equiv.Perm (this file) |
| Lehmer codes (list form) | Equiv.Perm (this file) |
Since the definitions are rfl-equal, you can freely use theorems from either file.
The @[simp] lemmas inversions_eq_inv and length_eq_invCount help the simplifier
rewrite between the two forms automatically.
Main results #
Equiv.Perm.length_inv- ℓ(σ⁻¹) = ℓ(σ)Equiv.Perm.length_mul_swap_right- Single swap lemma (right multiplication)Equiv.Perm.length_mul_swap_left- Single swap lemma (left multiplication)Equiv.Perm.length_mul_transposition- Length change for arbitrary transpositionEquiv.Perm.exists_reduced_word- First reduced word theorem (existence)Equiv.Perm.length_le_word_length- First reduced word theorem (minimality)Equiv.Perm.length_mul_mod_two- ℓ(στ) ≡ ℓ(σ) + ℓ(τ) (mod 2)Equiv.Perm.length_mul_le- ℓ(στ) ≤ ℓ(σ) + ℓ(τ)Equiv.Perm.generated_by_simples- S_n is generated by simple transpositionsEquiv.Perm.canonicalReducedWord_prod- The canonical reduced word produces σEquiv.Perm.canonicalReducedWord_isReduced- The canonical reduced word is reduced
References #
- Darij Grinberg, Notes on Algebraic Combinatorics, Chapter on Permutations
- [detnotes] Exercise 5.2 and related exercises
Tags #
permutation, inversion, length, simple transposition, reduced word, Lehmer code
Simple transpositions #
Design note: This definition is equivalent to AlgebraicCombinatorics.simpleTransposition
from Basics.lean. The equivalence is proven by simpleTransposition_eq_canonical.
The canonical definition in Basics.lean is preferred for new code. This definition exists
for historical reasons and uses a dite guard that simplifies proof automation within this file.
Both definitions compute the same permutation: Equiv.swap k (k+1).
The simple transposition s_k that swaps k and k+1 in Fin n.
For k : Fin (n-1), this swaps positions k.castSucc and k.succ.
Note: This is equivalent to AlgebraicCombinatorics.simpleTransposition k from Basics.lean.
See simpleTransposition_eq_canonical for the proof of equivalence.
Recommended: For new code, prefer AlgebraicCombinatorics.simpleTransposition (the canonical
definition). Use this definition when working with reduced words and Coxeter-style arguments
within this file.
Equations
- Equiv.Perm.simpleTransposition k = if h : n > 0 then Equiv.swap (Fin.castLE ⋯ k.castSucc) (Fin.castLE ⋯ k.succ) else 1
Instances For
Notation: s k for the simple transposition swapping k and k+1.
Equations
- Equiv.Perm.termS = Lean.ParserDescr.node `Equiv.Perm.termS 1024 (Lean.ParserDescr.symbol "s")
Instances For
Helper: position k as an element of Fin n.
Equations
- Equiv.Perm.posK k = Fin.castLE ⋯ k.castSucc
Instances For
Helper: position k+1 as an element of Fin n.
Equations
- Equiv.Perm.posK1 k = Fin.castLE ⋯ k.succ
Instances For
The simple transposition applies to position k.
The simple transposition applies to position k+1.
Equivalence with Basics.lean simpleTransposition #
Equiv.Perm.simpleTransposition equals AlgebraicCombinatorics.simpleTransposition.
Both definitions represent the simple transposition s_k that swaps positions k and k+1. The definitions differ slightly in their construction:
Equiv.Perm.simpleTranspositionuses aditeto handle n = 0 caseAlgebraicCombinatorics.simpleTranspositiondirectly constructs the swap
But they produce the same permutation for all valid inputs.
Inversions and length #
The length of a permutation is the number of its inversions.
Equations
- σ.length = σ.inversions.card
Instances For
Notation for length.
Equations
- Equiv.Perm.termℓ = Lean.ParserDescr.node `Equiv.Perm.termℓ 1024 (Lean.ParserDescr.symbol "ℓ")
Instances For
Equivalence with Inversions1 definitions #
Equiv.Perm.inversions equals AlgebraicCombinatorics.Perm.inv.
Equiv.Perm.length equals AlgebraicCombinatorics.Perm.invCount.
Length of inverse (Proposition prop.perm.len.inv) #
The bijection between inversions of σ and inversions of σ⁻¹. If (i,j) is an inversion of σ (meaning i < j and σ(i) > σ(j)), then (σ(j), σ(i)) is an inversion of σ⁻¹.
Equations
- σ.inversionsBijection = Equiv.ofBijective (fun (p : ↥σ.inversions) => ⟨Equiv.Perm.inversionBijAux✝ σ ↑p, ⋯⟩) ⋯
Instances For
Proposition prop.perm.len.inv: The length of a permutation equals the length of its inverse: ℓ(σ⁻¹) = ℓ(σ).
The proof establishes a bijection between inversions of σ and inversions of σ⁻¹: if (i,j) is an inversion of σ, then (σ(j), σ(i)) is an inversion of σ⁻¹.
Single swap lemma (Lemma lem.perm.len.ssl) #
Helper definitions and lemmas for the single swap lemma #
Lemma lem.perm.len.ssl (a): When multiplying a permutation σ on the right by a simple transposition s_k:
- If σ(k) < σ(k+1), then ℓ(σ·s_k) = ℓ(σ) + 1
- If σ(k) > σ(k+1), then ℓ(σ·s_k) = ℓ(σ) - 1
This lemma is fundamental for understanding how length changes under composition.
Lemma lem.perm.len.ssl (b): When multiplying a permutation σ on the left by a simple transposition s_k:
- If σ⁻¹(k) < σ⁻¹(k+1), then ℓ(s_k·σ) = ℓ(σ) + 1
- If σ⁻¹(k) > σ⁻¹(k+1), then ℓ(s_k·σ) = ℓ(σ) - 1
Note: σ⁻¹(i) is the position where i appears in the one-line notation of σ.
Length change for arbitrary transpositions (Proposition prop.perm.lisitij) #
The set Q from Proposition prop.perm.lisitij: Q = {k ∈ {i+1, ..., j-1} | σ(i) > σ(k) > σ(j)} This counts elements between i and j whose images are strictly between σ(j) and σ(i).
Instances For
The set R from Proposition prop.perm.lisitij: R = {k ∈ {i+1, ..., j-1} | σ(i) < σ(k) < σ(j)} This counts elements between i and j whose images are strictly between σ(i) and σ(j).
Instances For
Key counting lemma for prop.perm.lisitij: When σ(i) > σ(j), the number of lost inversions exceeds gained inversions by exactly 2|Q| + 1.
The proof proceeds by partitioning pairs (a, b) with a < b into categories:
- The pair (i, j) itself: loses 1 inversion
- Pairs (i, k) and (k, j) for k ∈ Q: each loses 1 inversion (total 2|Q|)
- Pairs (a, i) and (a, j) for a < i: swap status, so net 0
- Pairs (i, b) and (j, b) for b > j: swap status, so net 0
- Pairs (i, k) and (k, j) for i < k < j, k ∉ Q: unchanged or swap, net 0
- Other pairs: unchanged
Total: lost - gained = 2|Q| + 1
Proposition prop.perm.lisitij (b): The exact formula for length change:
- If σ(i) > σ(j): ℓ(σ·t_{i,j}) = ℓ(σ) - 2|Q| - 1
- If σ(i) < σ(j): ℓ(σ·t_{i,j}) = ℓ(σ) + 2|R| + 1
where Q and R are the sets of "intermediate" elements.
Proposition prop.perm.lisitij (a): For a transposition t_{i,j} with i < j:
- ℓ(σ·t_{i,j}) < ℓ(σ) if σ(i) > σ(j)
- ℓ(σ·t_{i,j}) > ℓ(σ) if σ(i) < σ(j)
The length decreases if (i,j) was an inversion, increases if it wasn't.
This follows immediately from part (b): when σ(i) > σ(j), the formula gives ℓ(σ·t_{i,j}) = ℓ(σ) - 2|Q| - 1 < ℓ(σ), and when σ(i) < σ(j), the formula gives ℓ(σ·t_{i,j}) = ℓ(σ) + 2|R| + 1 > ℓ(σ).
First reduced word theorem (Theorem thm.perm.len.redword1) #
A word is a list of indices representing simple transpositions.
Equations
- Equiv.Perm.Word n = List (Fin (n - 1))
Instances For
The product of simple transpositions corresponding to a word.
Equations
Instances For
A word is reduced if its length equals the length of the permutation it represents.
Equations
- Equiv.Perm.IsReduced w = (List.length w = (Equiv.Perm.wordProd w).length)
Instances For
Helper lemmas for the first reduced word theorem #
Theorem thm.perm.len.redword1 (a): Every permutation can be written as a composition of ℓ(σ) simple transpositions.
This is proved by induction on ℓ(σ): if σ has an inversion at position k (meaning σ(k) > σ(k+1)), then ℓ(σ·s_k) = ℓ(σ) - 1, so by induction σ·s_k can be written with ℓ(σ) - 1 simples, and thus σ = (σ·s_k)·s_k can be written with ℓ(σ) simples.
Theorem thm.perm.len.redword1 (b): The length ℓ(σ) is the minimum number of simple transpositions needed to express σ.
This follows from the fact that multiplying by a simple transposition changes the length by at most 1.
Combining parts (a) and (b): ℓ(σ) is exactly the minimum word length.
Corollaries (Corollary cor.perm.red.sigtau) #
Corollary cor.perm.red.sigtau (a): The length of a product has the same parity as the sum of lengths: ℓ(στ) ≡ ℓ(σ) + ℓ(τ) (mod 2).
This follows from the fact that multiplying by a simple transposition always changes the length by exactly 1 (either +1 or -1).
Corollary cor.perm.red.sigtau (c): For any word representing σ, the word length is at least ℓ(σ) and has the same parity as ℓ(σ).
Generation by simples (Corollary cor.perm.generated) #
Corollary cor.perm.generated: The symmetric group S_n is generated by the simple transpositions s_1, s_2, ..., s_{n-1}.
This is a direct consequence of the first reduced word theorem.
Lehmer code and reduced words (Remark rmk.perm.redword-lehmer and #
Proposition prop.perm.redword-lehmer)
Alias for the canonical Lehmer entry definition from AlgebraicCombinatorics.Perm.lehmerEntry.
Counts inversions (i, j) with first coordinate i.
Equations
Instances For
The Lehmer code of a permutation as a list of Lehmer entries.
This is the list representation of AlgebraicCombinatorics.Perm.lehmerCode.
Equations
Instances For
Equations
- σ.instDecidableInRotheDiagram i j = inferInstanceAs (Decidable (j < σ i ∧ i < σ⁻¹ j))
Lehmer entry bounds #
The Lehmer entry at position i is strictly less than n - i. This is because ℓ_i(σ) counts elements j > i such that σ(j) < σ(i), and there are only n - 1 - i elements greater than i.
Key characterization: σ(0) equals the Lehmer entry at position 0. This is because lehmerEntry σ 0 counts how many of σ(1), ..., σ(n-1) are less than σ(0), which equals σ(0) since σ is a bijection onto {0, ..., n-1}.
Key bound: i + ℓ_i(σ) ≤ n - 1 for any position i. This ensures that the indices in the row word are valid.
Canonical reduced word construction (Proposition prop.perm.redword-lehmer) #
Helper function to create the index for the row word. For row i with Lehmer entry ℓ_i, the j-th element (0-indexed) of the word is the simple transposition s_{i+ℓ_i-1-j}.
Equations
- σ.rowWordIndex i j = ⟨↑i + σ.lehmerEntry i - 1 - ↑j, ⋯⟩
Instances For
The word for row i in the Lehmer-based reduced word construction. For row i with Lehmer entry ℓ_i, this produces [s_{i+ℓ_i-1}, s_{i+ℓ_i-2}, ..., s_i], which corresponds to the cycle (i+ℓ_i, i+ℓ_i-1, ..., i) = s_{i+ℓ_i-1} s_{i+ℓ_i-2} ... s_i.
This is the explicit formula from Proposition prop.perm.redword-lehmer: a_i = cyc_{i', i'-1, ..., i} where i' = i + ℓ_i(σ).
Equations
- σ.rowWord i = List.map (σ.rowWordIndex i) (List.finRange (σ.lehmerEntry i))
Instances For
The length of the row word equals the Lehmer entry.
The Lehmer entry ℓ_i(σ) satisfies i + ℓ_i(σ) ≤ n - 1. This is because ℓ_i(σ) counts j with i < j, and there are at most n - 1 - i such j.
The sum of Lehmer entries equals the length.
Helper: given k < ℓ_i(σ), the index i + ℓ_i(σ) - 1 - k is < n - 1. This ensures that all indices in the Lehmer block are valid.
The block a_i for row i: [s_{i'-1}, s_{i'-2}, ..., s_i] where i' = i + ℓ_i(σ). This is a descending sequence of simple transpositions. If ℓ_i(σ) = 0, this is the empty list.
The product of this block is the cycle (i', i'-1, ..., i) which moves element at position i to position i'.
Equations
- σ.lehmerBlock i = List.map (fun (k : Fin (σ.lehmerEntry i)) => ⟨↑i + σ.lehmerEntry i - 1 - ↑k, ⋯⟩) (List.finRange (σ.lehmerEntry i))
Instances For
The length of a Lehmer block equals the Lehmer entry.
Helper lemmas for wordProd of descending words #
Key characterization lemmas for the canonical reduced word proof #
Key identity: smallerBefore + largerBefore = i. The elements j < i are partitioned into those with σ(j) < σ(i) and those with σ(j) > σ(i).
Corollary: largerBefore = i - smallerBefore.
Key characterization: σ(i) = smallerBefore(σ, i) + lehmerEntry(σ, i). This is the fundamental formula connecting the permutation value to the Lehmer code.
Key formula: The final position after applying all blocks is σ(p). This follows from p + lehmerEntry σ p - largerBefore σ p = σ(p).
Key formula: The upper bound of block i's range equals σ(i) + largerBefore(σ, i).
Key characterization: lehmerEntry(σ, i) ≥ lehmerEntry(σ, i+1) + 1 iff σ(i) > σ(i+1). This is crucial for determining when block i shifts a position.
Proposition prop.perm.redword-lehmer: The canonical reduced word for σ. For each i, define a_i = cyc_{i', i'-1, ..., i} = s_{i'-1} s_{i'-2} ... s_i where i' = i + ℓ_i(σ). Then σ = a_1 a_2 ... a_n.
This gives an explicit algorithm to construct a reduced word from the Lehmer code. The word is constructed by concatenating the Lehmer blocks for each position i = 0, 1, ..., n-1.
Equations
- σ.canonicalReducedWord = (List.map σ.lehmerBlock (List.finRange n)).flatten
Instances For
The length of the canonical reduced word equals the length of σ. This follows from the fact that each row word has length equal to the corresponding Lehmer entry, and the sum of Lehmer entries equals ℓ(σ).
The canonical reduced word produces σ. This is the main content of Proposition prop.perm.redword-lehmer.
The proof uses the key insight that each lehmerBlock σ i produces a cycle that moves position i to position i + lehmerEntry σ i, while shifting intermediate positions down by 1. When composed in order from i = 0 to i = n-1, these cycles reconstruct σ.
Proof outline: For each position p, we track where it ends up after applying all blocks. The blocks are applied in the order: B_{n-1} first, then B_{n-2}, ..., then B_0.
- Blocks n-1, ..., p+1 fix p (since p < i for all these, p is outside their ranges).
- Block p maps p to p + lehmerEntry σ p (by wordProd_lehmerBlock_at_i).
- For each j < p, block j shifts the current position down by 1 iff σ(j) > σ(p). This is because the condition "j < q ≤ j + lehmerEntry σ j" holds iff σ(j) > σ(p), using careful counting of elements in the Lehmer code.
- The total number of shifts by blocks 0, ..., p-1 equals largerBefore σ p.
- Final position = p + lehmerEntry σ p - largerBefore σ p = smallerBefore σ p + lehmerEntry σ p (since p = smallerBefore + largerBefore) = σ(p) (by sigma_eq_smallerBefore_add_lehmerEntry).
The detailed combinatorial argument is in Exercise 5.21 of detnotes.
The canonical reduced word is indeed reduced.