Documentation

Atlas.AlgebraicCombinatorics.code.SpernerProperty

Graded Posets and the Sperner Property #

This file formalizes Definition 4.1 and related notions from Chapter 4 of Algebraic Combinatorics by Richard Stanley.

Definitions #

Implementation notes #

The book's poset is finite by definition. We capture this with Fintype α. Mathlib's GradeMinOrder ℕ α provides a rank function where minimal elements have grade 0 and covers increase grade by 1. This matches the book's rank function ρ.

For B_n, we use Finset (Fin n) which already has instances for PartialOrder, BoundedOrder, Fintype, and GradeMinOrder.

Posets #

class SpernerProperty.Poset (α : Type u_1) extends PartialOrder α, Fintype α :
Type u_1

Definition 4.1 (Poset). A poset (partially ordered set) is a finite set together with a binary relation satisfying:

  • (P1) Reflexivity: x ≤ x for all x ∈ P;
  • (P2) Antisymmetry: if x ≤ y and y ≤ x then x = y;
  • (P3) Transitivity: if x ≤ y and y ≤ z then x ≤ z.

In Lean/Mathlib, properties (P1)–(P3) are captured by the PartialOrder typeclass, and finiteness by Fintype.

Instances
    @[implicit_reducible]
    instance SpernerProperty.Poset.mk' (α : Type u_1) [PartialOrder α] [Fintype α] :

    Any type with PartialOrder and Fintype instances is a Poset.

    Graded Posets #

    A graded poset of rank n is a finite partially ordered set equipped with an -grading (rank function) where minimal elements have grade 0 and the maximum grade attained is n. This formalizes Definition 4.1 from the book, specifically the notion of a poset that is "graded of rank n".

    We assume GradeMinOrder ℕ α is already available (so the grading is provided externally, e.g., by Mathlib instances for Finset), and record only the maximum rank and the boundedness condition.

    • rank :

      The rank of the graded poset (length of every maximal chain).

    • grade_le_rank (a : α) : grade a rank α

      Every element has grade at most rank.

    • grade_rank_exists : ∃ (a : α), grade a = rank α

      The maximum grade rank is attained by some element.

    Instances

      Rank counting #

      The number of elements of rank i in a graded poset. This is p_i = |P_i| in the book's notation where P_i = ρ⁻¹(i).

      Instances For

        Rank-symmetric #

        A graded poset of rank n is rank-symmetric if |P_i| = |P_{n-i}| for all 0 ≤ i ≤ n. (Definition 4.1, Stanley's Algebraic Combinatorics)

        Instances For

          Rank-unimodal #

          A graded poset of rank n is rank-unimodal if there exists j with 0 ≤ j ≤ n such that |P_0| ≤ |P_1| ≤ ... ≤ |P_j| ≥ |P_{j+1}| ≥ ... ≥ |P_n|. (Definition 4.1, Stanley's Algebraic Combinatorics)

          Instances For

            Antichain #

            An antichain in a poset P is a subset A of P such that no two distinct elements of A are comparable, i.e., we never have x, y ∈ A with x < y. This uses Mathlib's IsAntichain (· ≤ ·). (Definition 4.1, Stanley)

            Instances For

              Sperner Property #

              The maximum rank count of a graded poset, i.e., max{|P_i| : 0 ≤ i ≤ n} where n is the rank. This uses Finset.sup over Finset.range (rank + 1), which for returns the maximum value (with ⊥ = 0 for the empty range, which cannot occur here since rank + 1 > 0).

              Instances For

                A graded poset of rank n has the Sperner property if max{|A| : A is an antichain of P} = max{|P_i| : 0 ≤ i ≤ n}. Equivalently (as stated in the book, Definition 4.2), no antichain is larger than the largest level P_i. Since each level P_i is itself an antichain, the maximum antichain size is at least maxRankCount α; hence the Sperner property reduces to the upper bound. (Definition 4.2, Stanley's Algebraic Combinatorics)

                Instances For

                  Boolean Algebra B_n #

                  @[reducible, inline]

                  The Boolean algebra B_n is the poset of all subsets of [n] = {1,...,n} ordered by inclusion. We model this as Finset (Fin n) with its natural subset ordering. We use the name BooleanPoset to avoid conflict with Mathlib's BooleanAlgebra class. (Definition 4.1, Stanley's Algebraic Combinatorics)

                  Instances For

                    The rank (grade) of a subset s in B_n is its cardinality.

                    @[implicit_reducible]

                    B_n is a graded poset of rank n.

                    Order-Matchings #

                    An order-raising matching at rank i is a one-to-one function φ : P_i → P_{i+1} satisfying x < φ(x) for all x ∈ P_i. (Definition before Proposition 4.4, Stanley's Algebraic Combinatorics).

                    Formalized as the existence of a total function φ : α → α that is grade-raising, order-raising, and injective when restricted to grade-i elements.

                    Instances For

                      An order-lowering matching at rank i is a one-to-one function ψ : P_i → P_{i-1} satisfying ψ(x) < x for all x ∈ P_i. (Definition before Proposition 4.4, Stanley's Algebraic Combinatorics).

                      Instances For

                        The hypothesis of Proposition 4.4: there exists a pivot j with 0 ≤ j ≤ n and order-matchings P_0 → P_1 → ⋯ → P_j ← P_{j+1} ← ⋯ ← P_n.

                        Instances For

                          Iterated matching helpers #

                          noncomputable def SpernerProperty.raise {α : Type u_1} (φ : αα) (start : ) :
                          αα

                          Iterate raising matchings k steps starting from rank start. raise φ start k x applies φ_start, φ_{start+1}, ..., φ_{start+k-1} to x.

                          Instances For
                            noncomputable def SpernerProperty.lower {α : Type u_1} (ψ : αα) (start : ) :
                            αα

                            Iterate lowering matchings k steps starting from rank start. lower ψ start k x applies ψ_start, ψ_{start-1}, ..., ψ_{start-k+1} to x.

                            Instances For
                              theorem SpernerProperty.raise_grade {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (φ : αα) (start : ) ( : ∀ (i : ) (x : α), grade x = igrade (φ i x) = i + 1) (x : α) (hx : grade x = start) (k : ) :
                              grade (raise φ start k x) = start + k
                              theorem SpernerProperty.raise_le {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (φ : αα) (start : ) (hφ_grade : ∀ (i : ) (x : α), grade x = igrade (φ i x) = i + 1) (hφ_lt : ∀ (i : ) (x : α), grade x = ix < φ i x) (x : α) (hx : grade x = start) (k : ) :
                              x raise φ start k x
                              theorem SpernerProperty.raise_injective {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (φ : αα) (start : ) (hφ_grade : ∀ (i : ) (x : α), grade x = igrade (φ i x) = i + 1) (hφ_inj : ∀ (i : ) (x y : α), grade x = igrade y = iφ i x = φ i yx = y) (x y : α) (hx : grade x = start) (hy : grade y = start) (k : ) :
                              raise φ start k x = raise φ start k yx = y
                              theorem SpernerProperty.raise_split {α : Type u_1} (φ : αα) (start k m : ) (x : α) :
                              raise φ start (k + m) x = raise φ (start + k) m (raise φ start k x)
                              theorem SpernerProperty.lower_grade {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (ψ : αα) (start : ) ( : ∀ (i : ) (x : α), grade x = igrade (ψ i x) = i - 1) (x : α) (hx : grade x = start) (k : ) (hk : k start) :
                              grade (lower ψ start k x) = start - k
                              theorem SpernerProperty.lower_le {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (ψ : αα) (start : ) (hψ_grade : ∀ (i : ) (x : α), grade x = igrade (ψ i x) = i - 1) (hψ_lt : ∀ (i : ) (x : α), grade x = iψ i x < x) (x : α) (hx : grade x = start) (k : ) (hk : k start) :
                              lower ψ start k x x
                              theorem SpernerProperty.lower_injective {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (ψ : αα) (start : ) (hψ_grade : ∀ (i : ) (x : α), grade x = igrade (ψ i x) = i - 1) (hψ_inj : ∀ (i : ) (x y : α), grade x = igrade y = iψ i x = ψ i yx = y) (x y : α) (hx : grade x = start) (hy : grade y = start) (k : ) (hk : k start) :
                              lower ψ start k x = lower ψ start k yx = y
                              theorem SpernerProperty.lower_split {α : Type u_1} (ψ : αα) (start k m : ) (x : α) (hkm : k + m start) :
                              lower ψ start (k + m) x = lower ψ (start - k) m (lower ψ start k x)
                              theorem SpernerProperty.raise_comparable {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (φ : αα) (j : ) (hφ_grade : i < j, ∀ (x : α), grade x = igrade (φ i x) = i + 1) (hφ_lt : i < j, ∀ (x : α), grade x = ix < φ i x) (hφ_inj : i < j, ∀ (x y : α), grade x = igrade y = iφ i x = φ i yx = y) (x y : α) (hx : grade x j) (hy : grade y j) (hxy : grade x grade y) (heq : raise φ (grade x) (j - grade x) x = raise φ (grade y) (j - grade y) y) :
                              x y

                              If two raising-side elements map to the same rank-j element, the one with smaller grade is ≤ the other. Key step for the antichain injectivity. Uses bounded hypotheses: φ properties only required for i < j.

                              theorem SpernerProperty.lower_comparable {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (ψ : αα) (j n : ) (hψ_grade : ∀ (i : ), j < ii n∀ (x : α), grade x = igrade (ψ i x) = i - 1) (hψ_lt : ∀ (i : ), j < ii n∀ (x : α), grade x = iψ i x < x) (hψ_inj : ∀ (i : ), j < ii n∀ (x y : α), grade x = igrade y = iψ i x = ψ i yx = y) (x y : α) (hx : j grade x) (hy : j grade y) (hxn : grade x n) (hyn : grade y n) (hxy : grade y grade x) (heq : lower ψ (grade x) (grade x - j) x = lower ψ (grade y) (grade y - j) y) :
                              y x

                              If two lowering-side elements map to the same rank-j element, the one with larger grade is ≥ the other. Key step for the antichain injectivity. Uses bounded hypotheses: ψ properties only required for j < i and i ≤ n.

                              theorem SpernerProperty.raise_le_bounded {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (φ : αα) (start bound : ) (hφ_grade : i < bound, ∀ (x : α), grade x = igrade (φ i x) = i + 1) (hφ_lt : i < bound, ∀ (x : α), grade x = ix < φ i x) (x : α) (hx : grade x = start) (k : ) (hk : start + k bound) :
                              x raise φ start k x

                              Bounded raise_le: x ≤ raise φ start k x when φ properties hold for i < bound.

                              theorem SpernerProperty.lower_le_bounded {α : Type u_1} [PartialOrder α] [GradeMinOrder α] (ψ : αα) (start j_bound n_bound : ) (hψ_grade : ∀ (i : ), j_bound < ii n_bound∀ (x : α), grade x = igrade (ψ i x) = i - 1) (hψ_lt : ∀ (i : ), j_bound < ii n_bound∀ (x : α), grade x = iψ i x < x) (x : α) (hx : grade x = start) (k : ) (hk : k start - j_bound) (hn : start n_bound) :
                              lower ψ start k x x

                              Bounded lower_le: lower ψ start k x ≤ x when ψ properties hold for j < i ≤ n.

                              Proposition 4.4 #

                              Proposition 4.4 (Rank-unimodal part). If a graded poset P of rank n has order-matchings P_0 → P_1 → ⋯ → P_j ← P_{j+1} ← ⋯ ← P_n, then P is rank-unimodal.

                              Proposition 4.4 (Sperner property part). If a graded poset P of rank n has order-matchings P_0 → P_1 → ⋯ → P_j ← P_{j+1} ← ⋯ ← P_n, then P has the Sperner property.

                              Proof: Define a graph G whose edges come from the matchings. G decomposes into disjoint paths (chains in P), all passing through P_j. Any antichain meets each chain at most once, so |A| ≤ p_j ≤ maxRankCount.

                              Transfer of Sperner property via order isomorphism #

                              If P has the Sperner property and e : P ≃o Q is an order isomorphism that preserves grades, then Q also has the Sperner property.

                              The key idea: an order isomorphism maps antichains bijectively (preserving cardinality), and if it preserves grades then rankCount and maxRankCount are the same on both sides.

                              A grade-preserving order isomorphism transfers rank-unimodality. If e : P ≃o Q preserves grades and P is rank-unimodal, then so is Q.