ballot_weight
def
The function ballot_weight taking two natural numbers $p$ and $k$ and returning the natural number defined as: if $k = 0$ then $\binom{p}{0}$, and otherwise the natural number difference $\binom{p}{k} - \binom{p}{k-1}$.
Statement
def ballot_weight (p k : ℕ) : ℕ- Defined in
- arXiv:2611.06860 "Largest Sperner families with bounded VC-dimension", Section 2, above Lemma 2.5
- Verified
- 08 Nov 2026
- Axioms
- none listed
- Used by 4
- ballot_weight_zeroFor any natural number $p$, the value of ballot_weight $p$ at 0 equals 1.
- sum_ballot_weight_eqFor natural numbers $d$ and $a$ with $a \le d - 1$, the sum $\sum_{s \in \text{range}(a + 1)} \text{ballot\_weight}(2d - 1, s)$ equals…
- sum_ballot_weight_min_eqFor natural numbers $d$ and $j$ with $1 \le d$ and $j \le d$, the sum…
- binomial_convolution_restricted_weightsFor natural numbers $d$ and $n$ with $1 \le d$ and $2d - 1 \le n$, the double sum…
Read back from the Lean
ballot_weight is a function taking two natural numbers p and k and returning a natural number, defined as: if k = 0, then p.choose 0 (which is 1); otherwise (k ≠ 0), p.choose k - p.choose (k - 1) using truncated natural number subtraction.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
Lean source view module on GitHub
/-- The ballot weight b(p, k) as a natural number: p.choose 0 if k = 0, else p.choose k - p.choose (k - 1). -/ def ballot_weight (p k : ℕ) : ℕ := if k = 0 then p.choose 0 else p.choose k - p.choose (k - 1)