Vacuity.lean
Lean 4 source, lean/DataMiningAsObservation/Vacuity.lean at commit bccca4f. Appendix C, Machine-checked statements, says what each file proves. All Lean files.
/-
Vacuity.lean. Equation 9.3, the vacuity threshold.
The clustering certificate compares the standardized margin of the true candidate, `μ̂`,
with the expected maximum of the distractors under a noise model, `μ_crit`, and reports the
ratio `ρ`. At `ρ = 1` the certificate is vacuous, since the true candidate scores no higher
than noise would. Two facts about the threshold are checked here. The maximum over more
distractors is never smaller, so the bar rises with the candidate count and a fixed margin
that clears it for few candidates need not clear it for many. And the ratio is one exactly
when the margin equals the bar.
-/
import Mathlib
namespace DMO.Vacuity
open Finset
variable {ι : Type*}
/-- The maximum of the distractor scores over a nonempty set of distractors. -/
noncomputable def maxOver (S : Finset ι) (hS : S.Nonempty) (score : ι → ℝ) : ℝ :=
S.sup' hS score
/-- **The bar rises with the candidate count.** The maximum over a larger set of distractors
is at least the maximum over a smaller one. -/
theorem maxOver_mono (S T : Finset ι) (hS : S.Nonempty) (hT : T.Nonempty) (hST : S ⊆ T)
(score : ι → ℝ) : maxOver S hS score ≤ maxOver T hT score := by
unfold maxOver
exact Finset.sup'_mono score hST hS
/-- The ratio of equation 9.3. -/
noncomputable def rho (muHat muCrit : ℝ) : ℝ := muHat / muCrit
/-- **Vacuity.** With a positive bar, the ratio is one exactly when the margin equals the bar. -/
theorem rho_eq_one_iff (muHat muCrit : ℝ) (h : 0 < muCrit) : rho muHat muCrit = 1 ↔ muHat = muCrit := by
unfold rho
rw [div_eq_one_iff_eq h.ne']
/-- A margin below the bar gives a ratio below one, and the certificate proves nothing. -/
theorem rho_lt_one_of_lt (muHat muCrit : ℝ) (h : 0 < muCrit) (hlt : muHat < muCrit) :
rho muHat muCrit < 1 := by
unfold rho
rwa [div_lt_one h]
end DMO.Vacuity