Lean / Reader
Lean reader

Erdos506Spectrum.lean

95 lines7 declarationsno sorryimports Mathlib.Tactic
  1. import Mathlib.Tactic
  2. namespace Erdos506Spectrum
  3. /-- A real dilation mapping a nonempty finite set of nonzero reals to itself is nonexpanding. -/
  4. theorem abs_scale_le_one (S : Finset ℝ) (hne : S.Nonempty)
  5. (hnz : ∀ x ∈ S, x ≠ 0) (r : ℝ) (h : ∀ x ∈ S, r*x ∈ S) : |r| ≤ 1 := by
  6. obtain ⟨x, hx, hmax⟩ := S.exists_max_image (fun x : ℝ => |x|) hne
  7. have hpos := abs_pos.mpr (hnz x hx)
  8. have hle := hmax (r*x) (h x hx)
  9. change |r*x| ≤ |x| at hle
  10. rw [abs_mul] at hle
  11. nlinarith
  12. /-- Two inversions x ↦ a/x preserving the same such set have equal coefficient magnitudes. -/
  13. theorem abs_coeff_eq (S : Finset ℝ) (hne : S.Nonempty)
  14. (hnz : ∀ x ∈ S, x ≠ 0) (a b : ℝ) (ha : a ≠ 0) (hb : b ≠ 0)
  15. (hA : ∀ x ∈ S, a/x ∈ S) (hB : ∀ x ∈ S, b/x ∈ S) : |a| = |b| := by
  16. have le (u v : ℝ) (hv : v ≠ 0)
  17. (huS : ∀ x ∈ S, u/x ∈ S) (hvS : ∀ x ∈ S, v/x ∈ S) : |u| ≤ |v| := by
  18. have hscale := abs_scale_le_one S hne hnz (u/v) (by
  19. intro x hx
  20. have heq : u / (v / x) = (u/v)*x := by simp [div_eq_mul_inv, mul_comm, mul_left_comm]
  21. rw [← heq]
  22. exact huS _ (hvS _ hx))
  23. rw [abs_div, div_le_one (abs_pos.mpr hv)] at hscale
  24. exact hscale
  25. exact le_antisymm (le a b hb hA hB) (le b a ha hB hA)
  26. /-- Three distinct real coefficients cannot give three involutions of the indicated form. -/
  27. theorem three_inv_impossible (S : Finset ℝ) (hne : S.Nonempty) (hnz : ∀ x ∈ S, x ≠ 0)
  28. (a b c : ℝ) (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0)
  29. (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c)
  30. (hA : ∀ x ∈ S, a/x ∈ S) (hB : ∀ x ∈ S, b/x ∈ S) (hC : ∀ x ∈ S, c/x ∈ S) : False := by
  31. have habs := abs_coeff_eq S hne hnz a b ha hb hA hB
  32. have hacs := abs_coeff_eq S hne hnz a c ha hc hA hC
  33. rcases le_total 0 a with ha' | ha' <;>
  34. rcases le_total 0 b with hb' | hb' <;> rcases le_total 0 c with hc' | hc' <;>
  35. simp_all [abs_of_nonneg, abs_of_nonpos]
  36. /-- Distinct affine reflections fixing infinity cannot both preserve a nonempty finite real set. -/
  37. theorem reflection_coeff_eq (S : Finset ℝ) (hne : S.Nonempty) (a b : ℝ)
  38. (hA : ∀ x ∈ S, -x+a ∈ S) (hB : ∀ x ∈ S, -x+b ∈ S) : a=b := by
  39. let x := S.max' hne
  40. have hx : x ∈ S := S.max'_mem hne
  41. have h₁ := S.le_max' _ (hA _ (hB _ hx))
  42. have h₂ := S.le_max' _ (hB _ (hA _ hx))
  43. change -(-x+b)+a ≤ x at h₁
  44. change -(-x+a)+b ≤ x at h₂
  45. linarith
  46. /-- The three bounds in the incidence reduction exceed the maximum over the two parities. -/
  47. theorem bulk (n : ℝ) (hn : 32 ≤ n) :
  48. let U := n^2-13*n/2+25/2
  49. U < n*(n^2-3*n+20)/36 ∧ U < 1+(n-1)*(n+1)*(n-3)/32 ∧
  50. U < 1+3*(n-3)*(2*n-12)/4 := by
  51. dsimp
  52. have h₁ : 0 ≤ n-32 := by linarith
  53. have h₂ := sq_nonneg (n-32)
  54. have h₃ := mul_nonneg h₂ h₁
  55. constructor
  56. · nlinarith
  57. constructor <;> nlinarith
  58. /-- The same incidence bounds exceed the entire second band under general position. -/
  59. theorem general_position_bulk (n : ℝ) (hn : 35 ≤ n) :
  60. let V := (n-2)^2+1
  61. V < n*(n^2-3*n+20)/36 ∧ V < 1+(n-1)*(n+1)*(n-3)/32 ∧
  62. V < 1+3*(n-3)*(2*n-12)/4 := by
  63. dsimp
  64. have h₁ : 0 ≤ n-35 := by linarith
  65. have h₂ := sq_nonneg (n-35)
  66. have h₃ := mul_nonneg h₂ h₁
  67. constructor
  68. · nlinarith
  69. constructor <;> nlinarith
  70. #print axioms general_position_bulk
  71. /-- The counting identity gives the parity improvement once the simultaneous odd equality is ruled out. -/
  72. theorem pair_count_bound (k d t s p q : ℕ) (base count : ℤ)
  73. (hp : p ≤ k/2) (hq : q ≤ k/2) (hpartition : 2*t+s+d=k)
  74. (hcount : count = base - p - q - t + s)
  75. (hodd : k%2=1 → d=1 → p=k/2 → q=k/2 → t=k/2 → False) :
  76. base - 3*(↑(k/2) : ℤ) + ↑(k%2) ≤ count := by
  77. by_contra h
  78. have he : k%2 = 1 := by omega
  79. exact hodd he (by omega) (by omega) (by omega) (by omega)
  80. #print axioms pair_count_bound
  81. #print axioms three_inv_impossible
  82. #print axioms reflection_coeff_eq
  83. #print axioms bulk
  84. end Erdos506Spectrum