AFTD Auto-Formalizing Theoretical Domains

higher_bruhat_exists_modular_level_set_card_ge

theoremverified

For all natural numbers n and k with 0 < n and 0 < k, there exists a natural number c < n such that the ceiling of choose(n, k+1) / n (in ℝ) is at most the cardinality of the family of subsets A of Fin n of size k+1 satisfying (∑ a ∈ A, a.val) % n = c.

Statement

lemma higher_bruhat_exists_modular_level_set_card_ge (n k : ℕ) (hn : 0 < n) (hk : 0 < k) :
    ∃ c < n, Nat.ceil ((n.choose (k + 1) : ℝ) / (n : ℝ)) ≤
      ((Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).filter
        (fun A => (∑ a ∈ A, a.val) % n = c)).card
Source
arXiv:2611.17465, Section 2.1, Proof of Proposition 2
Verified
23 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1
  • higher_bruhat_inc_poset_dimension_geFor integers k ≥ 2 and n ≥ k+1, the Dushnik–Miller dimension of the inclusion higher Bruhat order B_inc(n, k) satisfies dim B_inc(n, k) ≥…

Read back from the Lean

For all natural numbers $n$ and $k$ such that $0 < n$ and $0 < k$, there exists a natural number $c < n$ such that $\lceil \binom{n}{k+1} / n \rceil$ (the ceiling of the real division of $\binom{n}{k+1}$ by $n$) is less than or equal to the number of subsets $A \subseteq \{0, \dots, n-1\}$ (elements of Finset (Fin n)) having cardinality $k + 1$ and satisfying $(\sum_{a \in A} a) \pmod n = c$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The theorem is an application of the pigeonhole principle to the family of subsets of Fin n of cardinality k + 1, partitioned into fibers by their element sum modulo n. A private helper lemma first proves the general pigeonhole principle for fibers: any map from a finite set S to {0, ..., n - 1} with n > 0 has some fiber of cardinality at least ⌈|S| / n⌉. The main theorem then counts the total number of (k + 1)-subsets as choose(n, k + 1) and applies this helper lemma directly to the modular sum function.

  1. There exists a residue c₀ < n that maximizes the fiber size |{A ∈ S | g A = c}|, and it suffices to bound ⌈|S| / n⌉ by this maximal fiber size.

    Since n > 0, the range {0, ..., n - 1} is non-empty. We select c₀ in this range maximizing the fiber size |{A ∈ S | g A = c}|. Providing c₀ as the existential witness, the remaining goal is to show ⌈|S| / n⌉ ≤ |{A ∈ S | g A = c₀}|.

    lines 4–7

    uses Finset.exists_max_image, Finset.mem_range.mpr, Finset.mem_range.mp

      classical
      obtain ⟨c₀, hc₀, hmax⟩ := Finset.exists_max_image (Finset.range n)
        (fun c => (S.filter (fun A => g A = c)).card) ⟨0, Finset.mem_range.mpr hn⟩
      refine ⟨c₀, Finset.mem_range.mp hc₀, ?_⟩
  2. The function g maps S into the range {0, ..., n - 1}.

    By assumption, every element A ∈ S satisfies g(A) < n, so g maps S into the set of natural numbers strictly less than n, which is the range {0, ..., n - 1}.

    lines 8–11

    uses Finset.coe_range, Set.mem_Iio

      have hmaps : Set.MapsTo g (↑S) (↑(Finset.range n)) := by
        intro a ha
        simp only [Finset.coe_range, Set.mem_Iio]
        exact hg a ha
  3. The cardinality of S is at most n times the size of the maximal fiber: |S| ≤ n * |{A ∈ S | g A = c₀}|.

    Partitioning S into fibers of g gives |S| = ∑ c ∈ {0, ..., n - 1}, |{A ∈ S | g A = c}|. Since every fiber has size at most that of the maximal fiber c₀, this sum is bounded by ∑ c ∈ {0, ..., n - 1}, |{A ∈ S | g A = c₀}| = n * |{A ∈ S | g A = c₀}|.

    lines 12–20

    uses Finset.card_eq_sum_card_fiberwise, Finset.sum_le_sum, Finset.sum_const, Finset.card_range, smul_eq_mul

      have hsum := Finset.card_eq_sum_card_fiberwise hmaps
      have hle : ∑ c ∈ Finset.range n, (S.filter (fun A => g A = c)).card
          ≤ n * (S.filter (fun A => g A = c₀)).card := by
        calc ∑ c ∈ Finset.range n, (S.filter (fun A => g A = c)).card
            ≤ ∑ _c ∈ Finset.range n, (S.filter (fun A => g A = c₀)).card :=
              Finset.sum_le_sum (fun c hc => hmax c hc)
          _ = n * (S.filter (fun A => g A = c₀)).card := by
              rw [Finset.sum_const, Finset.card_range, smul_eq_mul]
      have hkey : S.card ≤ n * (S.filter (fun A => g A = c₀)).card := hsum.trans_le hle
  4. ⌈|S| / n⌉ ≤ |{A ∈ S | g A = c₀}|.

    By the definition of the ceiling function, ⌈|S| / n⌉ ≤ m is equivalent to |S| / n ≤ m. Since n > 0, this is equivalent to |S| ≤ m * n, which was established in the previous step.

    lines 21–24

    uses Nat.ceil_le, div_le_iff₀

      rw [Nat.ceil_le, div_le_iff₀ (by exact_mod_cast hn)]
      have h' : (S.card : ℝ) ≤ (n : ℝ) * ((S.filter (fun A => g A = c₀)).card : ℝ) := by
        exact_mod_cast hkey
      linarith
  5. The family of (k + 1)-element subsets of Fin n has cardinality choose(n, k + 1).

    The subsets of Fin n of size k + 1 are precisely the elements of the powerset family powersetCard (k + 1) of the universal finset on Fin n. Since |Fin n| = n, the cardinality of this family is choose(n, k + 1).

    lines 31–39

    uses Finset.mem_powersetCard, Finset.card_powersetCard

      classical
      have hScard : (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).card
          = n.choose (k + 1) := by
        have heq : Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)
            = (Finset.univ : Finset (Fin n)).powersetCard (k + 1) := by
          ext A
          simp [Finset.mem_powersetCard]
        rw [heq, Finset.card_powersetCard]
        simp
  6. There exists c < n such that the number of (k + 1)-subsets with element sum congruent to c modulo n is at least ⌈choose(n, k + 1) / n⌉.

    We apply the fiberwise pigeonhole lemma to the family of (k + 1)-subsets of Fin n and the modular sum map A ↦ (∑ a ∈ A, a.val) % n, which takes values strictly less than n. Substituting the total cardinality choose(n, k + 1) for the size of the family yields the desired residue class c.

    lines 40–45

    uses higher_bruhat_exists_modular_level_set_card_ge_fiber, Nat.mod_lt

      obtain ⟨c, hc, h⟩ := higher_bruhat_exists_modular_level_set_card_ge_fiber n hn
        (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1))
        (fun A => (∑ a ∈ A, a.val) % n)
        (fun A _ => Nat.mod_lt _ hn)
      rw [hScard] at h
      exact ⟨c, hc, h⟩
Finset.exists_max_image
Any non-empty finite set contains an element that maximizes the value of a given function into a linearly ordered type.
Finset.mem_range.mpr
A natural number strictly less than n belongs to the finite range {0, ..., n - 1}.
Finset.mem_range.mp
An element of the finite range {0, ..., n - 1} is strictly less than n.
Finset.coe_range
The coercion of the finite range {0, ..., n - 1} to a set equals the set of natural numbers strictly less than n.
Set.mem_Iio
An element belongs to the open interval (-∞, b) if and only if it is strictly less than b.
Finset.card_eq_sum_card_fiberwise
If a function maps a finite set s into a finite set t, the cardinality of s equals the sum of the cardinalities of the fibers over all elements of t.
Finset.sum_le_sum
If f(i) ≤ g(i) for all elements i in a finite set, then the sum of f over the set is at most the sum of g.
Finset.sum_const
The sum of a constant value over a finite set equals the cardinality of the set times that value.
Finset.card_range
The finite range {0, ..., n - 1} has cardinality n.
smul_eq_mul
Scalar multiplication by a natural number coincides with multiplication in a semiring.
Nat.ceil_le
The ceiling of a real number is at most a natural number m if and only if the real number is at most m.
div_le_iff₀
For a strictly positive divisor c, the quotient b / c is at most a if and only if b ≤ a * c.
Finset.mem_powersetCard
A subset belongs to the collection of m-element sub-finsets of t if and only if it is a subset of t and has cardinality m.
Finset.card_powersetCard
The number of subsets of size m of a finite set s is choose(|s|, m).
higher_bruhat_exists_modular_level_set_card_ge_fiber
For any map from a finite set S into {0, ..., n - 1} with n > 0, there exists an output c < n whose fiber has cardinality at least ceil(|S| / n).
Nat.mod_lt
For any positive natural number y, the remainder x % y is strictly less than y.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

private lemma higher_bruhat_exists_modular_level_set_card_ge_fiber (n : ℕ) (hn : 0 < n) {α : Type*}    (S : Finset α) (g : α → ℕ) (hg : ∀ A ∈ S, g A < n) :    ∃ c < n, Nat.ceil ((S.card : ℝ) / (n : ℝ)) ≤ (S.filter (fun A => g A = c)).card := by  classical  obtain ⟨c₀, hc₀, hmax⟩ := Finset.exists_max_image (Finset.range n)    (fun c => (S.filter (fun A => g A = c)).card) ⟨0, Finset.mem_range.mpr hn⟩  refine ⟨c₀, Finset.mem_range.mp hc₀, ?_⟩  have hmaps : Set.MapsTo g (↑S) (↑(Finset.range n)) := by    intro a ha    simp only [Finset.coe_range, Set.mem_Iio]    exact hg a ha  have hsum := Finset.card_eq_sum_card_fiberwise hmaps  have hle : ∑ c ∈ Finset.range n, (S.filter (fun A => g A = c)).card      ≤ n * (S.filter (fun A => g A = c₀)).card := by    calc ∑ c ∈ Finset.range n, (S.filter (fun A => g A = c)).card        ≤ ∑ _c ∈ Finset.range n, (S.filter (fun A => g A = c₀)).card :=          Finset.sum_le_sum (fun c hc => hmax c hc)      _ = n * (S.filter (fun A => g A = c₀)).card := by          rw [Finset.sum_const, Finset.card_range, smul_eq_mul]  have hkey : S.card ≤ n * (S.filter (fun A => g A = c₀)).card := hsum.trans_le hle  rw [Nat.ceil_le, div_le_iff₀ (by exact_mod_cast hn)]  have h' : (S.card : ℝ) ≤ (n : ℝ) * ((S.filter (fun A => g A = c₀)).card : ℝ) := by    exact_mod_cast hkey  linarith/-- By the pigeonhole principle, some modular level set has cardinality at least ceil(choose(n, k+1) / n). -/lemma higher_bruhat_exists_modular_level_set_card_ge (n k : ℕ) (hn : 0 < n) (hk : 0 < k) :    ∃ c < n, Nat.ceil ((n.choose (k + 1) : ℝ) / (n : ℝ)) ≤      ((Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).filter        (fun A => (∑ a ∈ A, a.val) % n = c)).card := by  classical  have hScard : (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)).card      = n.choose (k + 1) := by    have heq : Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1)        = (Finset.univ : Finset (Fin n)).powersetCard (k + 1) := by      ext A      simp [Finset.mem_powersetCard]    rw [heq, Finset.card_powersetCard]    simp  obtain ⟨c, hc, h⟩ := higher_bruhat_exists_modular_level_set_card_ge_fiber n hn    (Finset.univ.filter (fun A : Finset (Fin n) => A.card = k + 1))    (fun A => (∑ a ∈ A, a.val) % n)    (fun A _ => Nat.mod_lt _ hn)  rw [hScard] at h  exact ⟨c, hc, h⟩
See it in the graphDiscuss this resultChallenge it