Documentation

CslibFrontier.Foundations.Analysis.SpecialFunctions.DescFactorialExp

Falling factorials against the exponential #

Bounds on the ratio (n)_k / n ^ k = n.descFactorial k / n ^ k, which is the probability that k independent uniform samples from a set of size n are distinct. Writing the ratio as the product ∏_{i < k} (n - i) / n (Nat.cast_descFactorial_div_pow) and comparing factor by factor with exp (-i / n) gives an upper bound valid for all n and k, and comparing with exp (-2 i / n) gives a lower bound when 0 < n and 2 k ≤ n + 2, using the scalar inequality exp (-x) ≤ 1 - x / 2 on [0, 1].

CslibFrontier.Probability.IID.Birthday turns these into bounds on the collision probability of independent samples.

Main results #

theorem Real.exp_neg_le_one_sub_div_two {x : ℝ} (h0 : 0 ≤ x) (h1 : x ≤ 1) :
exp (-x) ≤ 1 - x / 2

exp (-x) ≤ 1 - x / 2 for x ∈ [0, 1].

theorem Nat.cast_descFactorial_div_pow {K : Type u_1} [Semifield K] (n k : ℕ) :
↑(n.descFactorial k) / ↑n ^ k = ∏ i ∈ Finset.range k, ↑(n - i) / ↑n

(n)_k / n ^ k = ∏_{i < k} (n - i) / n in any semifield, with truncated subtraction.

theorem Nat.descFactorial_div_pow_le_exp (n k : ℕ) :
↑(n.descFactorial k) / ↑n ^ k ≤ Real.exp (-(↑k * (↑k - 1) / (2 * ↑n)))

(n)_k / n ^ k ≤ exp (-k (k - 1) / (2 n)), for all n and k: at n = 0 both sides are 1 for k = 0 and the left side is 0 otherwise, and for k > n the left side is 0.

theorem Nat.exp_le_descFactorial_div_pow {n k : ℕ} (hn : 0 < n) (hk : 2 * k ≤ n + 2) :
Real.exp (-(↑k * (↑k - 1) / ↑n)) ≤ ↑(n.descFactorial k) / ↑n ^ k

exp (-k (k - 1) / n) ≤ (n)_k / n ^ k when 0 < n and 2 k ≤ n + 2, that is, when every factor 1 - i / n with i < k has 2 i / n ≤ 1.