Lean / Reader
Lean readerDecayIntegral.lean
Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports DecayClassification, DecayEdgeRefinement, which it does not have: you can read it there, but it will not check. Build the project itself to check it.
import DecayClassificationimport DecayEdgeRefinementnamespace DecayClassification/-- From strict excess on some finite prefix of each tail, construct the actualfirst-crossing blocks and obtain arbitrarily large simultaneous cutoffs. -/theorem good_blocks (d b : ℕ → ℝ) (hd : Antitone d) (hd0 : ∀ i, 0 ≤ d i)(hb : ∀ j, 0 < b j)(excess : ∀ s, ∃ l ≥ s, ∑ i ∈ Finset.Icc s l, d i > ∑ i ∈ Finset.Icc s l, 20*b i) :∀ N, ∃ J ≥ N, 4*b J ≤ d J ∧∀ j ≤ J, d j < 4*b j → ∃ B ⊆ Finset.Icc j J,16*b j ≤ ∑ i ∈ B, d i ∧ ∀ i ∈ B, d i ≤ 4*b j := byclassicalhave first : ∀ j, ∃ l, j ≤ l ∧ 16*b j ≤ ∑ i ∈ Finset.Icc j l, d i := byintro jobtain ⟨l, hjl, h⟩ := excess jhave term := Finset.single_le_sum (s := Finset.Icc j l) (f := fun i => 20*b i)(fun i _ => by linarith [hb i]) (Finset.mem_Icc.mpr ⟨le_rfl,hjl⟩)exact ⟨l,hjl, by linarith [hb j]⟩let m (j : ℕ) := Nat.find (first j)let block (j : ℕ) := if d j < 4*b j then Finset.Icc j (m j) else ∅have left : ∀ j i, i ∈ block j → j ≤ i := byintro j i hiby_cases h : d j < 4*b j· exact (Finset.mem_Icc.mp (by simpa [block,h] using hi)).1· simp [block,h] at hihave interval : ∀ j i k, i ∈ block j → j ≤ k → k ≤ i → k ∈ block j := byintro j i k hi hjk hkiby_cases h : d j < 4*b j· simp only [block,h,if_true,Finset.mem_Icc] at hi ⊢exact ⟨hjk,hki.trans hi.2⟩· simp [block,h] at hihave cost : ∀ j, ∑ i ∈ block j, d i ≤ 20*b j := byintro jby_cases h : d j < 4*b j· simp only [block,h,if_true]have hjm : j ≤ m j := (Nat.find_spec (first j)).1by_cases eq : j = m j· rw [← eq]; simp; linarith [hb j]· obtain ⟨v,hv⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : m j ≠ 0)have hjv : j ≤ v := by omegahave prev := Nat.find_min (first j) (m := v) (by change v < m j; omega)have below : ∑ i ∈ Finset.Icc j v, d i < 16*b j := byby_contra! hn; exact prev ⟨hjv,hn⟩have split : Finset.Icc j (v+1) = insert (v+1) (Finset.Icc j v) := byext isimp only [Finset.mem_insert,Finset.mem_Icc]omegarw [hv, split, Finset.sum_insert]· have dl : d (v+1) ≤ d j := hd (by omega)linarith· simp· simp [block,h]; linarith [hb j]intro Nobtain ⟨J,hJN,hJ⟩ := DecayRamseyPacking.unbounded_uncovered d b hd0 block left interval cost(fun s => (excess s).imp (fun l h => h.2)) Nhave inside (j : ℕ) (h : d j < 4*b j) : j ∈ block j := bysimp [block,h,(Nat.find_spec (first j)).1, m]have good : 4*b J ≤ d J := le_of_not_gt (fun h => hJ J (inside J h))refine ⟨J,hJN,good,?_⟩intro j hj hrefine ⟨block j, ?_, ?_, ?_⟩· intro i hiexact Finset.mem_Icc.mpr ⟨left _ _ hi, le_of_not_gt (fun hlt => hJ j (interval j i J hi hj hlt.le))⟩· simpa [block,h,m] using (Nat.find_spec (first j)).2· exact fun i hi => (hd (left _ _ hi)).trans h.leend DecayClassification