cfahlgren1/math / lean /OAI /Analysis /LipschitzHilbert /Trees /HierarchyVariation.lean
cfahlgren1's picture
download
raw
3.68 kB
import Mathlib.Analysis.SpecialFunctions.Log.Basic
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Tactic
namespace OAI
/-! The full-root logarithmic variation bound for shifted angular blocks. -/
noncomputable section
open scoped BigOperators
namespace LipschitzHilbert
theorem sliding_window_sum_le (P : ℕ → ℝ) (N K : ℕ)
(hP : ∀ j < N, 0 ≤ P j) :
(∑ i ∈ Finset.range N, ∑ j ∈ Finset.Ico (i + 1 - K) (i + 1), P j) ≤
(K : ℝ) * ∑ j ∈ Finset.range N, P j := by
classical
have hrow (i : ℕ) (hi : i ∈ Finset.range N) :
(∑ j ∈ Finset.Ico (i + 1 - K) (i + 1), P j) =
∑ j ∈ Finset.range N, if j ∈ Finset.Ico (i + 1 - K) (i + 1) then P j else 0 := by
rw [← Finset.sum_filter]
congr 1
ext j
simp only [Finset.mem_filter, Finset.mem_range, Finset.mem_Ico] at *
omega
rw [Finset.sum_congr rfl hrow, Finset.sum_comm, Finset.mul_sum]
apply Finset.sum_le_sum
intro j hj
rw [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul]
apply mul_le_mul_of_nonneg_right _ (hP j (Finset.mem_range.mp hj))
have hsub : (Finset.range N).filter (fun i => j ∈ Finset.Ico (i + 1 - K) (i + 1)) ⊆
Finset.Ico j (j + K) := by
intro i hi
simp only [Finset.mem_filter, Finset.mem_range, Finset.mem_Ico] at *
omega
have hcard := Finset.card_le_card hsub
simp only [Nat.card_Ico, Nat.add_sub_cancel_left] at hcard
exact_mod_cast hcard
theorem sum_log_ratios (n : ℕ → ℝ) (N : ℕ) (hn : ∀ j ≤ N, 0 < n j) :
(∑ j ∈ Finset.range N, Real.log (n j / n (j + 1))) = Real.log (n 0 / n N) := by
have hterm (j : ℕ) (hj : j ∈ Finset.range N) :
Real.log (n j / n (j + 1)) = Real.log (n j) - Real.log (n (j + 1)) :=
Real.log_div (hn j (by have := Finset.mem_range.mp hj; omega)).ne'
(hn (j + 1) (by have := Finset.mem_range.mp hj; omega)).ne'
rw [Finset.sum_congr rfl hterm, Finset.sum_range_sub']
exact (Real.log_div (hn 0 (Nat.zero_le N)).ne' (hn N le_rfl).ne').symm
theorem sum_log_ratios_Ico (n : ℕ → ℝ) (a b : ℕ) (hab : a ≤ b)
(hn : ∀ j ≤ b, 0 < n j) :
(∑ j ∈ Finset.Ico a b, Real.log (n j / n (j + 1))) = Real.log (n a / n b) := by
rw [Finset.sum_Ico_eq_sub _ hab, sum_log_ratios n b hn,
sum_log_ratios n a (fun j hj => hn j (hj.trans hab))]
rw [Real.log_div (hn 0 (Nat.zero_le b)).ne' (hn b le_rfl).ne',
Real.log_div (hn 0 (Nat.zero_le b)).ne' (hn a hab).ne',
Real.log_div (hn a hab).ne' (hn b le_rfl).ne']
ring
theorem full_root_log_variation (n R : ℕ → ℝ) (N K : ℕ)
(hn : ∀ j ≤ N, 0 < n j) (hmono : AntitoneOn n (Set.Iic N))
(hR : ∀ i < N, R i ≤ Real.log (n (i + 1 - K) / n (i + 1))) :
(∑ i ∈ Finset.range N, R i) ≤ (K : ℝ) * Real.log (n 0 / n N) := by
have hP (j : ℕ) (hj : j < N) : 0 ≤ Real.log (n j / n (j + 1)) := by
apply Real.log_nonneg
exact (one_le_div (hn (j + 1) (by omega))).2
(hmono (by change j ≤ N; omega) (by change j + 1 ≤ N; omega) (by omega))
have hwindow (i : ℕ) (hi : i ∈ Finset.range N) :
R i ≤ ∑ j ∈ Finset.Ico (i + 1 - K) (i + 1), Real.log (n j / n (j + 1)) := by
rw [sum_log_ratios_Ico n _ _ (Nat.sub_le _ _) (fun j hj => hn j
(hj.trans (by have := Finset.mem_range.mp hi; omega)))]
exact hR i (Finset.mem_range.mp hi)
calc
_ ≤ ∑ i ∈ Finset.range N, ∑ j ∈ Finset.Ico (i + 1 - K) (i + 1),
Real.log (n j / n (j + 1)) := Finset.sum_le_sum hwindow
_ ≤ (K : ℝ) * ∑ j ∈ Finset.range N, Real.log (n j / n (j + 1)) :=
sliding_window_sum_le _ N K hP
_ = _ := by rw [sum_log_ratios n N hn]
end LipschitzHilbert
end
end OAI

Xet Storage Details

Size:
3.68 kB
·
Xet hash:
3bab2fa182634237aa080f518bb05f6f655e2d4e3a2f1266faad569b467e5c03

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.