Documentation

CslibFrontier.Foundations.Data.Nat.Choose.Real

Real bounds for partial binomial sums #

The binomial generating function gives ∑ j ≤ e, q.choose j ≤ exp (q / T) * T ^ e for any real T ≥ 1. For 0 < e ≤ q, choosing T = q / e gives (exp 1 * q / e) ^ e. This bound remains valid above half the dimension. At radius zero the sum and bound are both one.

The generating-function proof is shared with the sparsification lemma. The logarithmic consequences turn an exponential lower bound on the square of a partial binomial sum into size-activity bounds; they include the zero-radius case using the usual total real operations.

An exact integer logarithm test also bounds the tail of dimension C * N and radius Γ * N / M by 2 ^ (N / B) for every N. This is an original specialization of the generating-function bound, motivated by the geometric thresholds in Appendix A.3 of [OAI26k]; it does not construct the parameters or bound the cost of selecting them.

Main results #

References #

theorem Cslib.sum_choose_le_exp_mul_pow (q e : ℕ) (T : ℝ) (hT : 1 ≤ T) :
∑ j ∈ Finset.range (e + 1), ↑(q.choose j) ≤ Real.exp (↑q / T) * T ^ e

A partial binomial sum is at most exp (q / T) * T ^ e for every real T ≥ 1. The radius e may exceed q.

theorem Cslib.sum_choose_le_exp_one_mul_div_pow {q e : ℕ} (heq : e ≤ q) :
∑ j ∈ Finset.range (e + 1), ↑(q.choose j) ≤ (Real.exp 1 * ↑q / ↑e) ^ e

The standard bound (exp 1 * q / e) ^ e holds throughout e ≤ q, not just for e ≤ q / 2. At e = 0 both sides are one.

theorem Nat.choose_le_exp_mul_div_pow (n k : ℕ) :
↑(n.choose k) ≤ (Real.exp 1 * ↑n / ↑k) ^ k

A single binomial coefficient is at most (exp 1 * n / k)^k, including k = 0. This follows from Cslib.sum_choose_le_exp_one_mul_div_pow when k ≤ n; otherwise the coefficient vanishes. The statement is also present in Anthropic's formal source; this proof reuses the partial-sum bound.

theorem Cslib.sum_choose_le_two_rpow_div {C Γ M B : ℕ} (hC : 4 ≤ C) (hΓ : 4 ≤ Γ) (hM : Γ ≤ M) (hB : 1 ≤ B) (hbudget : B * Γ * Nat.clog 2 (4 * C * M) ≤ M) (N : ℕ) :
∑ j ∈ Finset.range (Γ * N / M + 1), ↑((C * N).choose j) ≤ 2 ^ (↑N / ↑B)

For any input size N, the tail with dimension C * N and radius Γ * N / M is at most 2 ^ (N / B) when the exact integer test B * Γ * ⌈log₂ (4 * C * M)⌉ ≤ M holds. This is an original corollary of sum_choose_le_exp_mul_pow, motivated by Appendix A.3 of [OAI26k], rather than a verbatim result from that source. Zero input and zero radius are included. The parameters are supplied; no parameter-selection or complexity bound is asserted.

theorem Cslib.sum_choose_le_two_pow_div_add_one {C Γ M B : ℕ} (hC : 4 ≤ C) (hΓ : 4 ≤ Γ) (hM : Γ ≤ M) (hB : 1 ≤ B) (hbudget : B * Γ * Nat.clog 2 (4 * C * M) ≤ M) (N : ℕ) :
∑ j ∈ Finset.range (Γ * N / M + 1), (C * N).choose j ≤ 2 ^ (N / B + 1)

The natural-number rounding of sum_choose_le_two_rpow_div, suitable for a discrete leaf-count or round budget. The division in the conclusion is natural-number division.

theorem Cslib.le_mul_logb_of_two_pow_le_sum_choose_sq {m q e : ℕ} (heq : e ≤ q) (h : 2 ^ m ≤ (∑ j ∈ Finset.range (e + 1), q.choose j) ^ 2) :
↑m / 2 ≤ ↑e * Real.logb 2 (Real.exp 1 * ↑q / ↑e)

If the square of the radius-e binomial sum is at least 2 ^ m, then m / 2 ≤ e * log₂ (exp 1 * q / e). The statement includes e = 0, which forces m = 0.

theorem Cslib.mul_rpow_le_of_two_pow_le_sum_choose_sq {m q e : ℕ} (heq : e ≤ q) (h : 2 ^ m ≤ (∑ j ∈ Finset.range (e + 1), q.choose j) ^ 2) :
↑e / Real.exp 1 * 2 ^ (↑m / (2 * ↑e)) ≤ ↑q

The logarithmic partial-binomial-sum bound rearranged as a lower bound on q. At radius zero the lower bound is zero.

theorem Cslib.div_pow_le_choose {N k : ℕ} (hk : k ≤ N) :
(↑N / ↑k) ^ k ≤ ↑(N.choose k)

Real-division form of Nat.choose_mul_pow_le at a = k: ((N : ℝ) / k) ^ k ≤ N.choose k.

theorem Cslib.mul_logb_div_le_logb_choose {N k : ℕ} (hk₀ : 1 ≤ k) (hk : k ≤ N) :
↑k * Real.logb 2 (↑N / ↑k) ≤ Real.logb 2 ↑(N.choose k)

Base-2 logarithmic form of div_pow_le_choose for 1 ≤ k ≤ N.

theorem Cslib.logb_choose_le_mul_logb_exp_mul_div {N k : ℕ} (hk : k ≤ N) :
Real.logb 2 ↑(N.choose k) ≤ ↑k * Real.logb 2 (Real.exp 1 * ↑N / ↑k)

Base-2 logarithmic form of Nat.choose_le_exp_mul_div_pow for k ≤ N.

theorem Cslib.logb_add_choose_le {n m : ℕ} (hm₀ : 1 ≤ m) (hmn : m ≤ n) :
Real.logb 2 ↑((n + m).choose m) ≤ 3 * ↑m + ↑m * Real.logb 2 (↑n / ↑m)

Base-2 logarithm of (n + m).choose m for 1 ≤ m ≤ n ([LLYZ23b], Section 5.2, p. 25 / PDF p. 26): log₂ C(n + m, m) ≤ 3 * m + m * log₂ (n / m).

theorem Cslib.log_add_choose_le_two_mul_sqrt (m n : ℕ) :
Real.log ↑((m + n).choose n) ≤ 2 * √(↑m * ↑n)

The logarithm of a binomial coefficient is at most 2 √(m n), a step in the proof of Theorem 4.1 of [KPS26] (the paper's Fact 2.1, §2, p. 11): log C(m + n, n) ≤ 2 √(m n), with the natural logarithm. The source states it for positive m, n; it also holds when either is zero, where both sides vanish. The term C(m + n, n) mᵐ nⁿ of the binomial expansion of (m + n) ^ (m + n) gives log C(m + n, n) ≤ m log (n / m + 1) + n log (m / n + 1), and log (x + 1) ≤ √x (Real.log_add_one_le_sqrt) bounds each term by √(m n).

theorem Cslib.logb_choose_sub_logb_choose_sub_le {U d k : ℕ} (hk : k ≤ U - d) (h : 2 * d + k ≤ U + 1) :
Real.logb 2 ↑(U.choose k) - Real.logb 2 ↑((U - d).choose k) ≤ ↑k

Logarithmic form of choose_le_two_pow_mul_choose_sub ([LLYZ23b], Section 5.2, pp. 24–25 / PDF pp. 25–26): log₂ C(U, k) - log₂ C(U - d, k) ≤ k.

theorem Cslib.logb_choose_sub_logb_sub_three_mul_choose_sub_le {U n m : ℕ} (hU : 3 * n ≤ U) (hm1 : 1 ≤ m) (hmn : m ≤ n) :
Real.logb 2 ↑(U.choose n) - Real.logb 2 ↑((U - 3 * m).choose (n - m)) ≤ ↑m * Real.logb 2 (↑U / ↑n) + 5 * ↑m

Binomial difference estimate for simultaneously shrinking ground set by 3 * m and subset size by m ([LLYZ23b], Section 8, p. 30 / PDF p. 31): for 3 * n ≤ U and 1 ≤ m ≤ n, log₂ C(U, n) - log₂ C(U - 3 * m, n - m) ≤ m * log₂ (U / n) + 5 * m.

theorem Real.exists_one_le_and_mul_pow_le_pow (C : ℝ) (d : ℕ) {r : ℝ} (hr : 1 < r) :
∃ (α : ℕ), 1 ≤ α ∧ C * ↑α ^ d ≤ r ^ α

A polynomial is eventually below an exponential with base r > 1.