THE CATALAN SCALPEL
Infrastructure for the Catalan recurrence C_{n+1} = Σ C_k · C_{n-k}.
The key insight: vertex 0 pairs with some odd vertex 2k+1, partitioning the remaining 2n vertices into two independent noncrossing domains:
- Inside: {1, ..., 2k} of size 2k (supporting C_k noncrossing pairings)
- Outside: {2k+2, ..., 2n+1} of size 2(n-k) (supporting C_{n-k})
Our shiftTwoEquiv / contractZeroOne is the boundary case k = 0.
Architecture:
- insideEquiv: Fin(2k) ≃ {i : Fin(2(n+1)) | 0 < i < 2k+1}
- outsideEquiv: Fin(2(n-k)) ≃ {i : Fin(2(n+1)) | 2k+1 < i}
- Parity theorem: p(0) is always odd for noncrossing p
- catalanEquiv: NoncrossingPairing(n+1) ≃ Σ k, NCP(k) × NCP(n-k)
1. The Translation Dictionaries #
2. Arc-Crossing ↔ Recursive Noncrossing Bridge #
Two definitions of "noncrossing":
- Recursive (our
IsNoncrossing): peelable via adjacent pairs - Arc-based (
¬HasCrossing): no two chords interleave
The bridge connects them, using several helper lemmas:
finRotate_val: value-level characterization of finRotategeneral_shadow: shadow closure for arbitrary arcsno_crossing_has_adjacent: every crossing-free pairing has an adjacent pairHasCrossing_conj_forward: rotation preserves crossings (5-case analysis)contraction_crossing_lifts: contraction preserves crossings
Helper lemmas for the bridge #
Forward crossing projection lemmas #
The Bridge Theorems #
Bridge direction 1: recursive noncrossing implies no arc crossings. Proof: induction on n. An adjacent pair cannot participate in any crossing. Any crossing among other vertices lifts to a crossing in the contracted pairing, contradicting the induction hypothesis.
Bridge direction 2: no arc crossings implies recursive noncrossing. Proof: find an adjacent pair (by no_crossing_has_adjacent), delete it, and show the contracted pairing is also crossing-free (contrapositively: a crossing in the contracted pairing lifts to one in the original).
4. The Parity Theorem #
The shadow-closure lemma is proved from ¬ HasCrossing using only order
logic and injectivity. The parity theorem combines this closure with the
even-cardinality lemma for fixed-point-free involutions.
Shadow closure: if p has no crossings, the shadow of the chord (0, p(0)) is closed under p. Proof: p(x) > 0 by involution, p(x) < p(0) by contradiction (otherwise 0 < x < p(0) < p(x) is a crossing).
Vertex 0 always pairs with an odd vertex in a noncrossing pairing.
Proof by contradiction: if p(0) is even = 2k, define the shadow S = {i : Fin(2(n+1)) | 0 < i < 2k}. Its cardinality is 2k - 1 (odd). Shadow closure shows S is closed under p. Since p is a fixed-point-free involution, S must have even cardinality. Parity contradiction.
4. The Catalan Equivalence #
The full bijection NoncrossingPairing(n+1) ≃ Σ k, NCP(k) × NCP(n-k) that yields the Catalan recurrence when we take cardinalities.
Noncrossing pairings: the subtype of pairings that are noncrossing.
Equations
- NoncrossingPairing n = { p : Pairing n // p.IsNoncrossing }
Instances For
Helper: extracting k from p(0) = 2k+1 #
extractK gives a value ≤ n (so k ≤ n).
Helper: shadow closure for outside complement #
The outside complement {i | 2k+1 < i} is closed under p when p is noncrossing and p(0) = 2k+1.
Proof: p(x) cannot be 0 (involution would force p(0)=x, but p(0)<x). p(x) cannot equal p(0) (injectivity, x≠0). p(x) cannot be in the shadow (shadow closure would force x into the shadow). So p(x) > 2k+1.
Helper: the inside pairing #
Given a noncrossing pairing p on 2(n+1) with p(0) = 2k+1, the shadow
{1,...,2k} is closed under p. Restricting p to this interval and
translating via insideEquiv gives a noncrossing pairing on 2k points.
The construction requires:
1. Building the restricted permutation (shadow closure + involution → bijection)
2. Proving it's a pairing (inherited involution + fpf)
3. Proving it's noncrossing (no crossing lifts to crossing of p)
The restricted permutation on the inside interval Fin(2k). Maps j to p(j+1) - 1. The involution of p provides the inverse.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The inside noncrossing pairing extracted from a noncrossing pairing p on 2(n+1) points with p(0) = 2k+1.
Equations
- insidePairing p h_nc = ⟨⟨restrictInsidePerm p h_nc, ⋯⟩, ⋯⟩
Instances For
The restricted permutation on the outside interval Fin(2(n-k)). Maps j to p(j + 2k + 2) - (2k + 2).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The outside noncrossing pairing extracted from a noncrossing pairing p on 2(n+1) points with p(0) = 2k+1.
Equations
- outsidePairing p h_nc = ⟨⟨restrictOutsidePerm p h_nc, ⋯⟩, ⋯⟩
Instances For
Assembly: the inverse direction #
Given k and noncrossing pairings on the inside and outside intervals, assemble a noncrossing pairing on 2(n+1) points.
The assembly function: given k, p_in on Fin(2k), p_out on Fin(2(n-k)), build the permutation on Fin(2(n+1)) that sends 0↔2k+1 and translates p_in to the inside interval and p_out to the outside.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Build the assembled Perm from the involutive function.
Equations
- assemblePerm n k p_in p_out hinv_in hinv_out = Function.Involutive.toPerm (assembleF n k p_in p_out) ⋯
Instances For
The inverse of catalanDecompose: assemble a noncrossing pairing from k and independent inside/outside pairings.
Equations
- catalanAssemble n x = ⟨⟨assemblePerm n x.fst ↑↑x.snd.1 ↑↑x.snd.2 ⋯ ⋯, ⋯⟩, ⋯⟩
Instances For
Round-trip lemmas for the Catalan equivalence #
The Catalan equivalence #
The Catalan decomposition (forward direction): a noncrossing pairing on 2(n+1) points decomposes into k and independent noncrossing pairings on the inside and outside intervals.
Equations
- catalanDecompose n p = ⟨extractK ↑p ⋯, (insidePairing ↑p ⋯, outsidePairing ↑p ⋯)⟩
Instances For
The Catalan decomposition: a noncrossing pairing on 2(n+1) points decomposes into a choice of chord target k and independent noncrossing pairings on the inside and outside intervals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
5. Counting: NoncrossingPairing n has catalan n elements #
genus_zero_count conceptually belongs with the genus/noncrossing story in
GenusNoncrossing.lean, but is proved here because it requires catalanEquiv
and the finitary cardinality machinery. The import direction
(CatalanRecurrence imports GenusNoncrossing) makes this the only valid home.
IsNoncrossing is decidable (via the genus characterization).
Equations
- instDecidableIsNoncrossing p = decidable_of_iff (p.genus = 0) ⋯
The number of noncrossing pairings on 2n points equals the nth Catalan number.