Lean / Reader
Lean reader

DecayRamseyUpper.lean

87 lines3 declarationsno sorryimports DecayForcing Mathlib.Combinatorics.Pigeonhole

Lean 4 Web has Mathlib, so it can check files that import only Mathlib. This one also imports DecayForcing, which it does not have: you can read it there, but it will not check. Build the project itself to check it.

  1. import DecayForcing
  2. import Mathlib.Combinatorics.Pigeonhole
  3. namespace DecayClassification
  4. /-- Extract t vertices whose outgoing edges to later selected vertices
  5. depend only on the earlier vertex. -/
  6. theorem extract_vertices {n : ℕ} (c : Fin n × Fin n → ℕ) (r : ℕ) (hr : 2 ≤ r) :
  7. ∀ t (s : Finset (Fin n)), r^t ≤ s.card →
  8. (∀ x ∈ s, ∀ y ∈ s, x < y → c (x,y) < r) →
  9. ∃ H ⊆ s, H.card = t ∧ ∃ label : Fin n → ℕ,
  10. (∀ x ∈ H, label x < r) ∧ ∀ x ∈ H, ∀ y ∈ H, x < y → c (x,y) = label x := by
  11. classical
  12. intro t
  13. induction t with
  14. | zero =>
  15. intro s _ _
  16. exact ⟨∅,Finset.empty_subset _,rfl,fun _ => 0,by simp,by simp⟩
  17. | succ t ih =>
  18. intro s size colored
  19. have hpow : 0 < r^t := pow_pos (by omega) _
  20. have hn : s.Nonempty := Finset.card_pos.mp (lt_of_lt_of_le (pow_pos (by omega) _) size)
  21. let u := s.min' hn
  22. have hu : u ∈ s := s.min'_mem hn
  23. let R := s.erase u
  24. have above (v : Fin n) (hv : v ∈ R) : u < v :=
  25. lt_of_le_of_ne (s.min'_le v (Finset.mem_of_mem_erase hv)) (Finset.ne_of_mem_erase hv).symm
  26. have enough : (Finset.range r).card * (r^t-1) < R.card := by
  27. dsimp [R]; rw [Finset.card_erase_of_mem hu,Finset.card_range, Nat.mul_sub, Nat.mul_one]
  28. rw [pow_succ,mul_comm] at size
  29. have enough : r ≤ r*r^t := by nlinarith [Nat.mul_le_mul_left r (show 1 ≤ r^t by omega)]
  30. omega
  31. obtain ⟨p,hp,hpcount⟩ := Finset.exists_lt_card_fiber_of_mul_lt_card_of_maps_to
  32. (f := fun v => c (u,v)) (s := R) (t := Finset.range r)
  33. (fun v hv => Finset.mem_range.mpr (colored _ hu _ (Finset.mem_of_mem_erase hv) (above v hv))) enough
  34. let T := R.filter fun v => c (u,v) = p
  35. have count : r^t ≤ T.card := by dsimp [T]; omega
  36. have sub (x : Fin n) (hx : x ∈ T) : x ∈ s := Finset.mem_of_mem_erase (Finset.mem_filter.mp hx).1
  37. obtain ⟨H,hHT,hsize,f,hf,hedge⟩ :=
  38. ih T count (fun x hx y hy => colored x (sub x hx) y (sub y hy))
  39. have huH : u ∉ H := fun h => (lt_irrefl u) (above u (Finset.mem_filter.mp (hHT h)).1)
  40. refine ⟨insert u H,Finset.insert_subset hu (fun x hx => sub x (hHT hx)),
  41. by rw [Finset.card_insert_of_notMem huH,hsize], Function.update f u p, ?_, ?_⟩
  42. · intro x hx
  43. rcases Finset.mem_insert.mp hx with eq | hx
  44. · subst x; simpa using Finset.mem_range.mp hp
  45. · rw [Function.update_of_ne (by intro eq; exact huH (eq ▸ hx) : x ≠ u)]
  46. exact hf x hx
  47. · intro x hx y hy hxy
  48. rcases Finset.mem_insert.mp hx with eq | hx
  49. · subst x
  50. have hyH := (Finset.mem_insert.mp hy).resolve_left hxy.ne'
  51. simpa using (Finset.mem_filter.mp (hHT hyH)).2
  52. · have yne : y ≠ u := by
  53. have := above x (Finset.mem_filter.mp (hHT hx)).1
  54. exact (this.trans hxy).ne'
  55. have hyH := (Finset.mem_insert.mp hy).resolve_left yne
  56. rw [Function.update_of_ne (by intro eq; exact huH (eq ▸ hx) : x ≠ u)]
  57. exact hedge _ hx _ hyH hxy
  58. theorem ramsey_supplier : RamseySupplier := by
  59. intro r k hr hk
  60. have hM : 2 ≤ r^(r*k) := by
  61. have := pow_le_pow_right₀ (by omega : 1 ≤ r) (show 1 ≤ r*k by nlinarith)
  62. simpa using hr.trans (by simpa using this)
  63. refine ⟨r^(r*k),hM,le_rfl,?_⟩
  64. intro n c s hs colored
  65. obtain ⟨H,_,hc,f,hf,hedge⟩ := extract_vertices c r hr (r*k) s hs.ge colored
  66. obtain ⟨i,_,hcount⟩ := Finset.exists_le_card_fiber_of_mul_le_card_of_maps_to
  67. (f := f) (s := H) (t := Finset.range r)
  68. (fun x hx => Finset.mem_range.mpr (hf x hx))
  69. (Finset.nonempty_range_iff.mpr (by omega)) (by simpa using hc.ge : (Finset.range r).card*k ≤ H.card)
  70. obtain ⟨K,sub,hK⟩ := Finset.exists_subset_card_eq hcount
  71. refine ⟨K,hK,i,?_⟩
  72. intro x hx y hy hxy
  73. exact (hedge x (Finset.mem_filter.mp (sub hx)).1 y (Finset.mem_filter.mp (sub hy)).1 hxy).trans
  74. (Finset.mem_filter.mp (sub hx)).2
  75. /-- Unconditional forcing direction of the classification, with finite integer
  76. color counts and the paper's strict tail condition. -/
  77. theorem tail_implies_decay_ramsey (a : ℕ → ℝ) : TailTest a → DecayRamsey a :=
  78. forcing_of_tail ramsey_supplier a
  79. #print axioms tail_implies_decay_ramsey
  80. end DecayClassification