Basic definitions, transpositions, cycles and involutions #
This file formalizes the basic definitions of permutations, transpositions, cycles, and involutions from the Algebraic Combinatorics textbook.
Main definitions #
Equiv.Perm: The type of permutations of a set (from Mathlib)Equiv.swap: The transposition swapping two elements (from Mathlib)cyc: The k-cyclecyc_{i₁, i₂, ..., iₖ}that cyclically permutes elements (def.perm.cycs)Equiv.Perm.IsCycle: Predicate for a permutation being a cycle (from Mathlib)simpleTransposition: The simple transposition swappingiandi+1IsInvolution: Predicate for a permutation being an involution
Main results #
symmetricGroup_card: The symmetric group hasn!elementssymmetricGroup_conj_iso: Bijections induce isomorphisms of symmetric groupstransposition_apply_left:t_{i,j}(i) = j(def.perm.tij)transposition_apply_right:t_{i,j}(j) = i(def.perm.tij)transposition_apply_of_ne_of_ne:t_{i,j}(x) = xforx ≠ i, j(def.perm.tij)transposition_symm: Transpositions are symmetric:t_{i,j} = t_{j,i}transposition_sq_eq_one: Transpositions are involutions:t_{i,j}² = idnum_transpositions: The number of transpositions in S_X is C(|X|, 2)simpleTransposition_eq_transposition:s_i = t_{i,i+1}(def.perm.si)simpleTransposition_apply_self:s_i(i) = i+1(def.perm.si)simpleTransposition_apply_succ:s_i(i+1) = i(def.perm.si)simpleTransposition_apply_of_ne:s_i(k) = kfork ≠ i, i+1(def.perm.si)simpleTransposition_support: support ofs_iis{i, i+1}(def.perm.si)simpleTransposition_isSwap:s_iis a swap (def.perm.si)simpleTransposition_isCycle:s_iis a 2-cycle (def.perm.si)simpleTransposition_sq_eq_one: Simple transpositions satisfys_i² = idsimpleTransposition_comm: Simple transpositions commute when|i-j| > 1simpleTransposition_braid: The braid relations_i s_{i+1} s_i = s_{i+1} s_i s_{i+1}cyc_pair: 2-cycles are exactly transpositions:cyc [i, j] = swap i jcyc_rotate: Cyclic rotation doesn't change the cyclecyc_apply_getElem: The cycle sendsl[j]tol[(j+1) % l.length]cycle_eq_transposition: 2-cycles are exactly transpositionsnum_kCycles_formula: The number of k-cycles inS_nisC(n,k) * (k-1)!
References #
See AlgebraicCombinatorics/tex/Permutations/Basics.tex for the LaTeX source.
Design note: simpleTransposition duplication #
The simpleTransposition function is defined in this file (AlgebraicCombinatorics.simpleTransposition)
and also in Inversions2.lean (Equiv.Perm.simpleTransposition). Both definitions produce the same
permutation (proven by Equiv.Perm.simpleTransposition_eq_canonical).
Which to use:
- Use
AlgebraicCombinatorics.simpleTransposition(this file) for basic properties of simple transpositions as swaps/cycles - Use
Equiv.Perm.simpleTransposition(Inversions2.lean) when working with reduced words, length functions, and Coxeter-style arguments
Tags #
permutation, symmetric group, transposition, cycle, involution
Basic definitions (def.perm.perm) #
This section formalizes Definition def.perm.perm from the textbook:
(a) A permutation of X means a bijection from X to X.
In Mathlib, this is Equiv.Perm X := X ≃ X.
(b) The set of all permutations of X is a group under composition, called the
symmetric group of X, denoted S_X. Its neutral element is id_X, and its size is |X|!.
In Mathlib, Equiv.Perm X has a Group instance automatically.
(c) We write αβ for composition α ∘ β when α, β ∈ S_X. This sends each x ∈ X
to α(β(x)). In Mathlib, (α * β) x = α (β x).
(d) If α ∈ S_X and i ∈ ℤ, then α^i denotes the i-th power of α in the group S_X.
α^i = α ∘ α ∘ ⋯ ∘ α(i times) ifi ≥ 0α^0 = id_Xα^(-1)is the inverse of α
A permutation of a type X is a bijection from X to itself. (def.perm.perm (a))
In Mathlib, this is Equiv.Perm X := X ≃ X, i.e., the type of equivalences from X to X.
Equations
Instances For
The symmetric group of a type X is the group of all permutations of X.
(def.perm.perm (b))
In Mathlib, this is Equiv.Perm X with its natural Group instance.
Equations
Instances For
The n-th symmetric group (def.perm.Sn-iven) #
In the textbook, [n] denotes the set {1, 2, ..., n}, which is an n-element set
for n ≥ 0 and empty for n ≤ 0.
In Lean/Mathlib, we use Fin n = {0, 1, ..., n-1} instead, which is also an n-element
set. This is a standard convention difference (0-indexed vs 1-indexed), but the
symmetric groups are isomorphic since both are n-element sets.
The symmetric group S_[n] (denoted S_n) is the group of all permutations of [n].
Its size is n! when n ≥ 0.
The set [n] from the textbook is represented by Fin n in Lean.
In the textbook (def.perm.Sn-iven), [n] denotes {1, 2, ..., n}.
In Lean, Fin n represents {0, 1, ..., n-1}.
Both are n-element sets for n ≥ 0, so their symmetric groups are isomorphic.
We use Fin n as it is the standard representation in Mathlib.
Equations
Instances For
The n-th symmetric group S_n is the group of permutations of [n].
(def.perm.Sn-iven)
In the textbook, S_n is defined as S_[n], the symmetric group of [n] = {1, 2, ..., n}.
In Lean, we represent this as Equiv.Perm (Fin n), the group of permutations of
Fin n = {0, 1, ..., n-1}.
The size of S_n is n! (see sn_card).
Equations
Instances For
The symmetric group of a finite type has |X|! elements. (def.perm.perm (b))
The symmetric group S_n has n! elements. (def.perm.Sn-iven)
This is the key cardinality result: |S_n| = n!
S_0 is trivial (has exactly one element, the identity).
S_1 is trivial (has exactly one element, the identity).
S_2 has exactly 2 elements.
S_3 has exactly 6 elements.
[n] has exactly n elements.
S_n is a finite group.
Equations
S_n has decidable equality.
Equations
Composition notation (def.perm.perm (c)) #
In the textbook, αβ denotes the composition α ∘ β, which sends x to α(β(x)).
In Mathlib, this is the group multiplication α * β.
The composition α * β sends x to α(β(x)). (def.perm.perm (c))
Composition is associative: (αβ)γ = α(βγ).
The identity permutation is the neutral element: id * α = α.
The identity permutation is the neutral element: α * id = α.
Powers of permutations (def.perm.perm (d)) #
The i-th power α^i is defined for any integer i.
α^0 = id. (def.perm.perm (d))
α^0 = id for integer exponents. (def.perm.perm (d))
α^1 = α.
For i ≥ 0, α^i = α ∘ α ∘ ⋯ ∘ α (i times). (def.perm.perm (d))
Alternative form: α^(n+1) = α * α^n.
α^(-1) is the inverse of α. (def.perm.perm (d))
The inverse satisfies α * α⁻¹ = id.
The inverse satisfies α⁻¹ * α = id.
Applying α^n to x gives the n-fold application of α.
For integer powers, α^(-n) applies the inverse n times.
Conjugation isomorphism (prop.perm.Sf) #
If f : X ≃ Y is a bijection, then the map σ ↦ f ∘ σ ∘ f⁻¹ is a group isomorphism
from S_X to S_Y.
Given a bijection f : X ≃ Y, conjugation by f gives a group isomorphism
from Perm X to Perm Y. (prop.perm.Sf)
For each permutation σ of X, the map f ∘ σ ∘ f⁻¹ : Y → Y is a permutation of Y.
Furthermore, the map S_f : S_X → S_Y, σ ↦ f ∘ σ ∘ f⁻¹ is a group isomorphism.
Equations
Instances For
The conjugation isomorphism sends σ to f ∘ σ ∘ f⁻¹.
For each permutation σ of X, the map f ∘ σ ∘ f⁻¹ : Y → Y is a permutation of Y.
This is the first part of prop.perm.Sf.
The conjugation map explicitly: S_f(σ)(y) = f(σ(f⁻¹(y))).
The conjugation isomorphism is bijective (part of being an isomorphism).
The conjugation isomorphism is a group homomorphism (part of being an isomorphism).
The conjugation isomorphism preserves identity.
The inverse of the conjugation isomorphism is conjugation by f⁻¹.
Symmetric groups of bijective sets are isomorphic. (Conclusion of prop.perm.Sf)
If Y = X in prop.perm.Sf, then S_f is conjugation by f in the group S_X.
(Remark after prop.perm.Sf)
Permutation notations (def.perm.notations) #
This section formalizes Definition def.perm.notations from the textbook, which introduces
three notations for representing permutations:
(a) A two-line notation of σ is a 2×n-array where the top row contains elements of [n] in some order, and the bottom row contains their images under σ.
(b) The one-line notation (OLN) of σ is the n-tuple (σ(1), σ(2), ..., σ(n)).
(c) The cycle digraph of σ is a directed graph with vertices 1, 2, ..., n and arcs i → σ(i) for all i ∈ [n].
In Lean, we formalize these as follows:
- Two-line notation: a function that maps each element to its image (essentially the permutation itself)
- One-line notation: a
Fin n → Fin nfunction, or equivalently aVector (Fin n) n - Cycle digraph: a
SimpleGraphwith edges determined by the permutation
Two-line notation (def.perm.notations (a)) #
A two-line notation of σ ∈ S_n is a 2×n-array where:
- The top row contains the elements p₁, p₂, ..., pₙ of [n] in some order
- The bottom row contains σ(p₁), σ(p₂), ..., σ(pₙ)
The most common form uses pᵢ = i, giving the array: ⎛ 1 2 ... n ⎞ ⎝ σ(1) σ(2) ... σ(n) ⎠
In Lean, a permutation σ : Equiv.Perm (Fin n) already encodes this information: the "two-line notation" is essentially the graph of σ as a function.
The two-line notation of a permutation σ ∈ S_n, represented as a list of pairs [(1, σ(1)), (2, σ(2)), ..., (n, σ(n))].
This corresponds to the standard two-line notation: ⎛ 1 2 ... n ⎞ ⎝ σ(1) σ(2) ... σ(n) ⎠
(def.perm.notations (a))
Equations
- AlgebraicCombinatorics.twoLineNotation σ = List.map (fun (i : Fin n) => (i, σ i)) (List.finRange n)
Instances For
The two-line notation has length n.
The first components of the two-line notation are exactly 0, 1, ..., n-1.
The second components of the two-line notation are σ(0), σ(1), ..., σ(n-1).
Two permutations are equal iff their two-line notations are equal.
One-line notation (def.perm.notations (b)) #
The one-line notation (OLN) of σ ∈ S_n is the n-tuple (σ(1), σ(2), ..., σ(n)).
In Lean, a permutation σ : Sn n = Equiv.Perm (Fin n) is already essentially its OLN, since we can evaluate σ at any index. We provide explicit conversions.
The one-line notation of a permutation σ ∈ S_n, as a list [σ(0), σ(1), ..., σ(n-1)].
Note: We use 0-indexing (Fin n starts at 0), so this is [σ(0), σ(1), ..., σ(n-1)] rather than [σ(1), σ(2), ..., σ(n)] as in the textbook.
(def.perm.notations (b))
Equations
Instances For
The one-line notation has length n.
The one-line notation contains no duplicates.
Two permutations are equal iff their one-line notations are equal.
Convert a list to a permutation, if it's a valid one-line notation. Returns the permutation represented by the list.
Equations
- AlgebraicCombinatorics.oneLineNotationToPerm l hl hnodup = Equiv.ofBijective (fun (i : Fin n) => l[↑i]) ⋯
Instances For
Round-trip: converting a permutation to OLN and back gives the original permutation.
Cycle digraph (def.perm.notations (c)) #
The cycle digraph of σ ∈ S_n is a directed graph with:
- Vertices: 1, 2, ..., n (or 0, 1, ..., n-1 in 0-indexed form)
- Arcs: i → σ(i) for all i ∈ [n]
In Lean, we represent this as a SimpleGraph where there's an edge between i and j
iff σ(i) = j (and i ≠ j to avoid self-loops in the SimpleGraph sense).
Note: The cycle digraph is naturally a directed graph, but for simplicity we can also consider the underlying undirected graph structure.
The cycle digraph of a permutation σ, as an undirected simple graph.
There is an edge between i and j iff σ(i) = j or σ(j) = i (and i ≠ j). This captures the "orbit structure" of the permutation.
(def.perm.notations (c))
Equations
Instances For
If σ(i) = j and i ≠ j, then i and j are adjacent in the cycle digraph.
The identity permutation has a cycle digraph with no edges.
Transpositions (def.perm.tij) #
A transposition t_{i,j} swaps i and j and fixes all other elements.
From the textbook (def.perm.tij):
Let
iandjbe two distinct elements of a setX. Then, the transpositiont_{i,j}is the permutation ofXthat sendsitoj, sendsjtoi, and leaves all other elements ofXunchanged.
In Mathlib, this is Equiv.swap i j.
The transposition swapping i and j. In Mathlib, this is Equiv.swap i j.
(def.perm.tij)
A transposition t_{i,j} is the permutation of X that:
- sends
itoj(seetransposition_apply_left) - sends
jtoi(seetransposition_apply_right) - leaves all other elements unchanged (see
transposition_apply_of_ne_of_ne)
Equations
Instances For
The transposition t_{i,j} sends i to j. (def.perm.tij)
The transposition t_{i,j} sends j to i. (def.perm.tij)
The transposition t_{i,j} leaves all other elements unchanged. (def.perm.tij)
Transpositions are symmetric: t_{i,j} = t_{j,i}.
A transposition is its own inverse: t_{i,j}⁻¹ = t_{i,j}.
A transposition squared is the identity: t_{i,j}² = id.
The number of transpositions (2-cycles) in S_X is C(|X|, 2). This follows from the fact that each 2-element subset {i,j} of X gives rise to exactly one transposition t_{i,j}. (Example after def.perm.cycs in source)
Simple transpositions (def.perm.si) #
The simple transposition s_i swaps i and i+1.
The simple transposition s_i swaps i and i+1 in Fin n.
Here i : Fin (n - 1) ensures i+1 < n.
(def.perm.si)
This is the canonical definition for simple transpositions in the codebase.
Equivalent definition in Inversions2.lean:
Equiv.Perm.simpleTransposition in Inversions2.lean defines the same permutation
using a slightly different construction (with castSucc/succ). The equivalence is
proven by Equiv.Perm.simpleTransposition_eq_canonical.
See the equivalence lemmas simpleTransposition_eq_swap_* below for other formulations.
Equations
- AlgebraicCombinatorics.simpleTransposition i = Equiv.swap ⟨↑i, ⋯⟩ ⟨↑i + 1, ⋯⟩
Instances For
Notation for simple transposition.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Simple transposition s_i equals the transposition t_{i,i+1}. (def.perm.si)
Simple transpositions are swaps (i.e., 2-cycles). (def.perm.si)
Simple transpositions are cycles (2-cycles). (def.perm.si)
The support of a simple transposition has cardinality 2. (def.perm.si)
Simple transposition is not the identity (for n ≥ 2). (def.perm.si)
Properties of simple transpositions (prop.perm.si.rules) #
Simple transpositions are involutions: s_i² = id. (prop.perm.si.rules (a))
Simple transpositions are self-inverse: s_i⁻¹ = s_i. (prop.perm.si.rules (a))
The braid relation: s_i s_{i+1} s_i = s_{i+1} s_i s_{i+1}. (prop.perm.si.rules (c))
Equivalence lemmas for simpleTransposition #
The simpleTransposition function is the canonical definition for the simple transposition
s_i that swaps i and i+1 in Fin n. Other files may define local versions with slightly
different signatures. These lemmas establish the equivalence between formulations.
Alternative formulations in the codebase:
Equiv.Perm.simpleTranspositioninInversions2.lean- usescastSucc/succpatternsimpleTranspositioninSymmetricFunctions/Definitions.lean- usesNat.lt_of_lt_predsimpleTranspositioninSchurBasics.lean- takesFin Nwith explicit proofhk : k.val + 1 < N
All these definitions compute the same permutation: Equiv.swap k (k+1).
The canonical simpleTransposition equals Equiv.swap on the appropriate Fin elements.
This is the fundamental characterization used to prove equivalence with other formulations.
Alternative characterization: simpleTransposition using castSucc and succ.
This matches the formulation in Inversions2.lean.
Alternative characterization: when given k : Fin N and a proof hk : k.val + 1 < N,
this equals Equiv.swap k ⟨k.val + 1, hk⟩.
This matches the formulation in SchurBasics.lean.
Conversion from Fin (N - 1) index to explicit proof form.
Given i : Fin (N - 1), we can express simpleTransposition i as a swap
with explicit bounds proofs. This matches the formulation in Definitions.lean.
Cycles (def.perm.cycs) #
A k-cycle is a permutation that cyclically permutes k elements and fixes all others.
The textbook defines cyc_{i₁, i₂, ..., iₖ} as the permutation that sends
i₁ ↦ i₂i₂ ↦ i₃- ...
iₖ₋₁ ↦ iₖiₖ ↦ i₁and fixes all other elements.
In Mathlib, this is List.formPerm. The predicate Equiv.Perm.IsCycle captures
when a permutation is a cycle.
The k-cycle cyc_{i₁, i₂, ..., iₖ} is the permutation that sends
i₁ ↦ i₂ ↦ i₃ ↦ ... ↦ iₖ ↦ i₁ and fixes all other elements.
(def.perm.cycs)
This is the constructive definition from the textbook. In Mathlib,
this is List.formPerm.
Equations
Instances For
The cycle cyc [i, j] equals the transposition swap i j.
This shows that 2-cycles are exactly transpositions.
The cycle cyc [] is the identity.
The cycle cyc [x] is the identity.
The cycle applied to an element not in the list returns the element unchanged. This is the "otherwise" case in def.perm.cycs.
A cycle sends each element to the next in the list.
Cyclic rotation of the list doesn't change the cycle.
This formalizes the textbook statement that
cyc_{i₁,i₂,...,iₖ} = cyc_{i₂,i₃,...,iₖ,i₁} = ... = cyc_{iₖ,i₁,...,iₖ₋₁}.
The cycle sends l[j] to l[(j+1) % l.length] for a nodup list.
This is the formal statement of def.perm.cycs from the textbook:
"cyc_{i₁,...,iₖ}(p) = i_{j+1} if p = i_j for some j ∈ {1,...,k}"
For k-cycles with k ≥ 2 distinct elements, the cycle uniquely determines the elements up to cyclic rotation. This is stated in the solution to exe.perm.cyc.how-many-kcyc.
A permutation is a cycle if any two non-fixed points are related by repeated application of the permutation.
Equations
Instances For
The support of a cycle (the set of elements it moves).
Equations
Instances For
A 2-cycle is exactly a transposition. (Example after def.perm.cycs)
Counting k-cycles (exe.perm.cyc.how-many-kcyc) #
The number of k-cycles in S_n (for k > 1) is n(n-1)...(n-k+1)/k = C(n,k) * (k-1)!.
The number of k-cycles in S_n is C(n,k) * (k-1)! for k > 1.
(exe.perm.cyc.how-many-kcyc)
The formula counts the number of ways to choose k elements from n (giving C(n,k)) and then arrange them in a cycle (giving (k-1)! since cyclic rotations are equivalent).
For k = 1, the only "1-cycle" would be the identity, but IsCycle excludes the identity. So there are no 1-cycles satisfying IsCycle.
Involutions (def.perm.invol) #
An involution is a permutation equal to its own inverse.
A permutation is an involution if σ ∘ σ = id. (def.perm.invol)
From the textbook:
An involution of X means a map f: X → X that satisfies f ∘ f = id. Clearly, an involution is always a permutation, and equals its own inverse.
Equivalent characterizations:
IsInvolution σ ↔ σ * σ = 1(definition)IsInvolution σ ↔ σ⁻¹ = σ(seeisInvolution_iff_eq_inv)IsInvolution σ ↔ Function.Involutive σ(seeisInvolution_iff_involutive)IsInvolution σ ↔ ∀ x, σ (σ x) = x(seeisInvolution_iff_forall)
Equations
- AlgebraicCombinatorics.IsInvolution σ = (σ * σ = 1)
Instances For
Decidable instance for IsInvolution on finite types.
Equations
An involution is equal to its own inverse.
Characterization: σ is an involution iff σ⁻¹ = σ.
Characterization: σ is an involution iff it is involutive as a function.
Characterization: σ is an involution iff σ(σ(x)) = x for all x.
An involution applied twice is the identity.
The identity is an involution.
Any transposition is an involution.
Simple transpositions are involutions.
The order of an involution divides 2.
An involution has order 1 or 2.
An involution is the identity iff its order is 1.
A nontrivial involution has order exactly 2.
A k-cycle with k > 2 is never an involution.
Products of disjoint transpositions are involutions. (This is stated informally in the source after def.perm.invol)
The cycle digraph of an involution consists of 1-cycles and 2-cycles. (Stated informally at the end of the source)
An involution of a finite set is a product of disjoint transpositions. (Stated informally in the source)