GENUS ZERO ↔ NONCROSSING
The combinatorial heart of the Wigner semicircle law: a pairing of {0, ..., 2n-1} has genus zero if and only if it is noncrossing. Consequently, the number of genus-zero pairings equals the Catalan number Cₙ.
Key design choices:
Pairing nas a subtype (no dependent proof parameters)Equiv.Perm.numCyclescounting ALL cycles including fixed pointsfinRotatefor the long cycle (notcycleOf)- Recursive noncrossing predicate, with a separate bridge to arc crossings
- Three-stage proof decomposition via cycle count bound
1. Total Cycle Count #
Mathlib's cycleType.card counts only nontrivial cycles (length ≥ 2).
The genus formula needs ALL cycles, including fixed points (1-cycles).
We define numCycles as the sum of nontrivial cycles and fixed points.
Using cycleType.card alone gives wrong genera.
For γπ = (1,3,5)(2)(4)(6), cycleType.card = 1 but numCycles = 4.
The genus formula requires 4, not 1.
Total number of cycles of a permutation, including fixed points.
Equations
- σ.numCycles = σ.cycleType.card + Fintype.card ↑(Function.fixedPoints ⇑σ)
Instances For
2. The Long Cycle #
The canonical cyclic permutation on Fin (2n), sending i ↦ i + 1 mod 2n.
Mathlib provides this as finRotate. Key properties we need:
- It is a single (2n)-cycle for n ≥ 1.
isCycle_finRotateandcycleType_finRotateare available.
3. Pairings as a Subtype #
A pairing is a fixed-point-free involution. Making it a subtype avoids carrying proof terms through every definition and theorem.
Equations
- instCoeOutPairingPermFinHMulNatOfNat n = { coe := Subtype.val }
4. Genus #
Genus is defined as a plain function on pairings. For a pairing π, the composition γπ is a permutation of Fin(2n), and its total cycle count determines the genus via:
genus(π) = (n + 1 - numCycles(γ * π)) / 2
We prove separately that for pairings: (a) numCycles(γ * π) ≤ n + 1, so the numerator is nonneg (b) the numerator is always even, so division is exact
Transposition bound infrastructure #
The key structural fact: multiplying a permutation by a single transposition changes numCycles by at most 1. This is the fundamental property of the Cayley distance on the symmetric group.
We prove this via cycle_induction_on, analyzing how swap(a,b) interacts with the cycle decomposition of σ. The three cases are: (1) σ = 1 (trivial) (2) σ is a single cycle (swap splits or shortens) (3) σ = c * d with c, d disjoint (reduce to sub-cases)
Sign-based parity infrastructure #
The parity of numCycles(γπ) matches the parity of n + 1. This follows from the sign equation sign(γπ) = sign(γ) * sign(π) = (-1)^(n+1), combined with sign(σ) = (-1)^(σ.support.card + σ.cycleType.card).
5. Noncrossing Predicate (Recursive) #
A noncrossing pairing is defined recursively:
- The empty pairing (n = 0) is noncrossing.
- A pairing on 2n points is noncrossing if there exists an adjacent pair (i, i+1 mod 2n) in the pairing whose removal yields a noncrossing pairing on 2(n-1) points.
"Adjacent" means: π(i) = finRotate(i), i.e., π sends some element to its cyclic successor.
This definition is better for Lean than the "no crossing arcs" formulation because:
- It is structurally recursive (induction is immediate).
- It aligns with Catalan recursion.
- It avoids the cyclic-order normalization headaches.
Deletion of an adjacent pair: given a pairing with π(i) = i+1, remove the pair {i, i+1} and reindex to get a pairing on 2(n-1) points.
This requires careful construction. The idea:
- Let j = finRotate(i) = i + 1 mod 2n.
- Define the restriction of π to Fin(2n) \ {i, j}.
- Identify Fin(2n) \ {i, j} with Fin(2(n-1)) via an order-preserving map.
- Show the resulting permutation is again a pairing.
This is the most technically demanding definition in the file. It requires building the injection Fin(2n-2) ↪ Fin(2n) that skips i and j, and proving the conjugated permutation is a fixed-point-free involution.
Equations
Instances For
Recursive noncrossing predicate.
Equations
- x_2.IsNoncrossing = True
- p.IsNoncrossing = ∃ (i : Fin (2 * (n + 1))) (h : p.hasAdjacentAt i), (p.deleteAdjacent i h).IsNoncrossing
Instances For
6. The Bridge Theorem (Three Stages) #
We prove the equivalence in stages:
Stage A: numCycles(γπ) ≤ n + 1 for all pairings (upper bound) Stage B: numCycles(γπ) = n + 1 → noncrossing (equality → noncrossing) Stage C: noncrossing → numCycles(γπ) = n + 1 (noncrossing → equality)
Then genus = 0 ↔ numCycles = n + 1 ↔ noncrossing.
The cycle-splitting lemma: removing an adjacent pair from a pairing decreases numCycles(γπ) by 1. Equivalently, the pairing with the adjacent pair has one more cycle than the contracted one. Requires n ≥ 1 so the target Pairing n is on ≥ 2 elements.
Helpers for Stage B: fixed points imply adjacent pairs #
Stage B: If the cycle count achieves its maximum, the pairing is noncrossing.
Proof: by induction on n. The key insight is that numCycles = n+1 forces the composition gamma*pi to have fixed points (at least 2). Each fixed point yields an adjacent pair via the involution property. After deleting that adjacent pair, the cycle-splitting lemma gives numCycles = n for the contracted pairing, and induction applies.
Stage C: Noncrossing pairings achieve maximum cycle count.
Proof: induction on n using the recursive noncrossing definition. Base case (n = 1): direct computation — the unique pairing on Fin 2 composed with the long cycle gives the identity, which has 2 cycles. Inductive step: if p is noncrossing, it has an adjacent pair at some i. Deleting this pair gives a noncrossing pairing p' on 2n points with numCycles(γ' * p') = n + 1 by induction. The cycle-splitting lemma gives numCycles(γπ) = numCycles(γ'π') + 1.
Requires n ≥ 1: on Fin 0, numCycles = 0 ≠ 1 = 0 + 1.
7. Main Theorem and Corollary #
The Bridge Theorem: genus zero ↔ noncrossing.
Equations
8. Proof Dependencies and Estimated Effort #
Lemmas that need building (not in Mathlib): #
numCycles_eq_num_orbits— total cycles = orbits of ⟨σ⟩-actionPairing.deleteAdjacent— the deletion/reindexing constructionnumCycles_insert_adjacent— the cycle-splitting lemmaPairing.numCycles_le— upper bound on cycles for pairingsPairing.maxCycles_imp_noncrossing— contrapositive via crossing→mergerPairing.noncrossing_imp_maxCycles— induction via deletion
What Mathlib provides: #
finRotateandisCycle_finRotatefor the long cycleEquiv.Perm.cycleTypefor nontrivial cycle structureFunction.fixedPointsandFintype.cardfor fixed point countcatalanandcatalan_succfor Catalan numbers- Basic
Finarithmetic andPermalgebra
Estimated scope: 800–1500 lines of Lean 4. #
The hardest part: #
The deletion/reindexing machinery (Lemma 2 above). Removing two points from Fin(2n) and reindexing to Fin(2(n-1)) while preserving the pairing structure requires building an explicit embedding Fin(2n-2) ↪ Fin(2n) and conjugating the permutation through it. This is conceptually simple but technically fiddly in dependent type theory. It is exactly the kind of thing an autoformalization agent (Gauss, Aristotle) handles well with human scaffolding.
The most satisfying part: #
Once the bridge theorem compiles, the connection to the semicircle law becomes a clean chain: E[Tr(W^{2n})/N] → trace expansion → pairing sum → genus filter → genus 0 = noncrossing = Catalan → semicircle moments Each arrow is a separate formalizable step, and this file handles the crucial middle link.