lean/FeedbackChannel/SelectionTieFree.lean

View on GitHub

 1import FeedbackChannel.SelectionContainment
 2import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus
 3
 4/-!
 5# The tie-free value of Theorem B
 6
 7Source: `paper/selection_law_kl_containment.md`, draft 0.3, §2, proof step (ii): in the tie-free
 8(continuous) case the best-of-`K` law has density `K u^{K-1}` against the probability-integral
 9transform `u`, and its KL divergence is
10`∫₀¹ K u^{K-1} ln(K u^{K-1}) du = ln K - (K - 1)/K = λ_K`.
11
12`tieFree_integral` proves this integral identity (by the fundamental theorem of calculus with the
13antiderivative `G` of `SelectionContainment`). It is the integral that the discrete proof of
14Theorem B telescopes to; the measure-theoretic statement that an atomless score law attains it
15(the density computation of step (ii)) is not formalized.
16-/
17
18namespace FeedbackChannel.SelectionTieFree
19
20open Real MeasureTheory FeedbackChannel.SelectionContainment
21
22theorem mul_log_h {K : ℕ} (hK : 1 ≤ K) {x : ℝ} (hx : 0 < x) :
23    (K * x ^ (K - 1)) * log (K * x ^ (K - 1)) = K * x ^ (K - 1) * (log K + (K - 1) * log x) := by
24  have hK0 : (0 : ℝ) < K := by exact_mod_cast hK
25  rw [Real.log_mul (by positivity) (by positivity), Real.log_pow]
26  push_cast [Nat.cast_sub hK]
27  ring
28
29/-- **Tie-free value** (Theorem B, step (ii)):
30`∫₀¹ K u^{K-1} ln(K u^{K-1}) du = ln K - (K - 1)/K`. -/
31theorem tieFree_integral {K : ℕ} (hK : 1 ≤ K) :
32    ∫ u in (0 : ℝ)..1, (K * u ^ (K - 1)) * log (K * u ^ (K - 1)) = lam K := by
33  rw [intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one
34    (continuous_G hK).continuousOn
35    (fun x hx => (hasDerivAt_G hK hx.1).congr_deriv (mul_log_h hK hx.1).symm)
36    (Continuous.intervalIntegrable (by fun_prop) 0 1)]
37  rw [G_one, G_zero hK, sub_zero]
38
39end FeedbackChannel.SelectionTieFree