Concentrated.lean

Lean 4 source, lean/DataMiningAsObservation/Concentrated.lean at commit bccca4f. Appendix C, Machine-checked statements, says what each file proves. All Lean files.

/-
Concentrated.lean. Chapter 0 section 0.4 and equation 0.7, a concentrated spectrum.

A spectrum is concentrated when a few eigenvalues carry most of the total. If one
eigenvalue carries a fraction `f` of the total, the effective rank is at most `1 / f²`, so a
spectrum with half its mass in one direction has effective rank at most four, and one with
nine tenths in one direction has effective rank at most one and a quarter. The allocation
report's caution below effective rank two is the same statement read from the rank side.
-/
import Mathlib
import DataMiningAsObservation.EffectiveRank

namespace DMO.Concentrated

open Finset DMO.EffectiveRank

variable {n : ℕ}

/-- One eigenvalue's square is at most the sum of the squares. -/
theorem sq_le_sum_sq (lam : Fin n → ℝ) (i : Fin n) : lam i ^ 2 ≤ ∑ j, lam j ^ 2 :=
  Finset.single_le_sum (f := fun j => lam j ^ 2) (fun j _ => sq_nonneg (lam j)) (Finset.mem_univ i)

/-- **A concentrated spectrum has low effective rank.** If eigenvalue `i` carries a fraction
`f` of the total, the effective rank is at most `1 / f²`. -/
theorem effRank_le_of_fraction (lam : Fin n → ℝ) (i : Fin n) (f : ℝ)
    (hf : 0 < f) (hfrac : lam i = f * ∑ j, lam j) (hpos : 0 < ∑ j, lam j) :
    effRank lam ≤ 1 / f ^ 2 := by
  unfold effRank
  have hsq : 0 < ∑ j, lam j ^ 2 := by
    have : 0 < lam i ^ 2 := by rw [hfrac]; positivity
    exact lt_of_lt_of_le this (sq_le_sum_sq lam i)
  rw [div_le_div_iff₀ hsq (by positivity)]
  have h := sq_le_sum_sq lam i
  rw [hfrac] at h
  nlinarith [h, sq_nonneg (∑ j, lam j), hf]

/-- **Half the mass in one direction gives effective rank at most four.** -/
theorem effRank_le_four (lam : Fin n → ℝ) (i : Fin n)
    (hfrac : lam i = (1 / 2) * ∑ j, lam j) (hpos : 0 < ∑ j, lam j) : effRank lam ≤ 4 := by
  have := effRank_le_of_fraction lam i (1 / 2) (by norm_num) hfrac hpos
  norm_num at this
  exact this

end DMO.Concentrated