Lean / Reader
Lean reader

DecayIntegral.lean

70 lines1 declarationsno sorryimports DecayClassification DecayEdgeRefinement

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.

  1. import DecayClassification
  2. import DecayEdgeRefinement
  3. namespace DecayClassification
  4. /-- From strict excess on some finite prefix of each tail, construct the actual
  5. first-crossing blocks and obtain arbitrarily large simultaneous cutoffs. -/
  6. theorem good_blocks (d b : ℕ → ℝ) (hd : Antitone d) (hd0 : ∀ i, 0 ≤ d i)
  7. (hb : ∀ j, 0 < b j)
  8. (excess : ∀ s, ∃ l ≥ s, ∑ i ∈ Finset.Icc s l, d i > ∑ i ∈ Finset.Icc s l, 20*b i) :
  9. ∀ N, ∃ J ≥ N, 4*b J ≤ d J ∧
  10. ∀ j ≤ J, d j < 4*b j → ∃ B ⊆ Finset.Icc j J,
  11. 16*b j ≤ ∑ i ∈ B, d i ∧ ∀ i ∈ B, d i ≤ 4*b j := by
  12. classical
  13. have first : ∀ j, ∃ l, j ≤ l ∧ 16*b j ≤ ∑ i ∈ Finset.Icc j l, d i := by
  14. intro j
  15. obtain ⟨l, hjl, h⟩ := excess j
  16. have term := Finset.single_le_sum (s := Finset.Icc j l) (f := fun i => 20*b i)
  17. (fun i _ => by linarith [hb i]) (Finset.mem_Icc.mpr ⟨le_rfl,hjl⟩)
  18. exact ⟨l,hjl, by linarith [hb j]⟩
  19. let m (j : ℕ) := Nat.find (first j)
  20. let block (j : ℕ) := if d j < 4*b j then Finset.Icc j (m j) else ∅
  21. have left : ∀ j i, i ∈ block j → j ≤ i := by
  22. intro j i hi
  23. by_cases h : d j < 4*b j
  24. · exact (Finset.mem_Icc.mp (by simpa [block,h] using hi)).1
  25. · simp [block,h] at hi
  26. have interval : ∀ j i k, i ∈ block j → j ≤ k → k ≤ i → k ∈ block j := by
  27. intro j i k hi hjk hki
  28. by_cases h : d j < 4*b j
  29. · simp only [block,h,if_true,Finset.mem_Icc] at hi ⊢
  30. exact ⟨hjk,hki.trans hi.2⟩
  31. · simp [block,h] at hi
  32. have cost : ∀ j, ∑ i ∈ block j, d i ≤ 20*b j := by
  33. intro j
  34. by_cases h : d j < 4*b j
  35. · simp only [block,h,if_true]
  36. have hjm : j ≤ m j := (Nat.find_spec (first j)).1
  37. by_cases eq : j = m j
  38. · rw [← eq]; simp; linarith [hb j]
  39. · obtain ⟨v,hv⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : m j ≠ 0)
  40. have hjv : j ≤ v := by omega
  41. have prev := Nat.find_min (first j) (m := v) (by change v < m j; omega)
  42. have below : ∑ i ∈ Finset.Icc j v, d i < 16*b j := by
  43. by_contra! hn; exact prev ⟨hjv,hn⟩
  44. have split : Finset.Icc j (v+1) = insert (v+1) (Finset.Icc j v) := by
  45. ext i
  46. simp only [Finset.mem_insert,Finset.mem_Icc]
  47. omega
  48. rw [hv, split, Finset.sum_insert]
  49. · have dl : d (v+1) ≤ d j := hd (by omega)
  50. linarith
  51. · simp
  52. · simp [block,h]; linarith [hb j]
  53. intro N
  54. obtain ⟨J,hJN,hJ⟩ := DecayRamseyPacking.unbounded_uncovered d b hd0 block left interval cost
  55. (fun s => (excess s).imp (fun l h => h.2)) N
  56. have inside (j : ℕ) (h : d j < 4*b j) : j ∈ block j := by
  57. simp [block,h,(Nat.find_spec (first j)).1, m]
  58. have good : 4*b J ≤ d J := le_of_not_gt (fun h => hJ J (inside J h))
  59. refine ⟨J,hJN,good,?_⟩
  60. intro j hj h
  61. refine ⟨block j, ?_, ?_, ?_⟩
  62. · intro i hi
  63. exact Finset.mem_Icc.mpr ⟨left _ _ hi, le_of_not_gt (fun hlt => hJ j (interval j i J hi hj hlt.le))⟩
  64. · simpa [block,h,m] using (Nat.find_spec (first j)).2
  65. · exact fun i hi => (hd (left _ _ hi)).trans h.le
  66. end DecayClassification