Lean / Reader
Lean reader

hirsch-bridge-check.lean

278 lines10 declarationsno sorryimports OAI.Geometry.Hirsch.Main Mathlib.Analysis.SpecialFunctions.Log.Basic Mathlib.Analysis.SpecialFunctions.Pow.Real Mathlib.Tactic

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

  1. import OAI.Geometry.Hirsch.Main
  2. import Mathlib.Analysis.SpecialFunctions.Log.Basic
  3. import Mathlib.Analysis.SpecialFunctions.Pow.Real
  4. import Mathlib.Tactic
  5. /-!
  6. # My bridge proofs for the Hirsch check (desk task 430)
  7. All proofs in this file are mine. The file uses the definitions and the theorems
  8. of the claimant only as given constants.
  9. -/
  10. open scoped Topology Pointwise
  11. namespace CheckHirsch
  12. open Set Module Filter
  13. open OAI.Geometry.Hirsch
  14. /-! ### 1. The graph for one move is the graph of the edges -/
  15. section Skeleton
  16. variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]
  17. {body face : Set E}
  18. /-- My lemma. A set of dimension at most 1 that contains two different extreme
  19. points of `body` is a subset of the segment between the two points. -/
  20. theorem face_subset_segment {u v : E} (hsub : face ⊆ body)
  21. (hu : u ∈ body.extremePoints ℝ) (hv : v ∈ body.extremePoints ℝ) (huv : u ≠ v)
  22. (hfu : u ∈ face) (hfv : v ∈ face) (hdim : finrank ℝ (vectorSpan ℝ face) ≤ 1) :
  23. face ⊆ segment ℝ u v := by
  24. have hne : (v -ᵥ u : E) ≠ 0 := by
  25. intro h
  26. have h' : v - u = 0 := h
  27. exact huv (sub_eq_zero.1 h').symm
  28. have hle : Submodule.span ℝ {v -ᵥ u} ≤ vectorSpan ℝ face :=
  29. Submodule.span_le.2 fun x hx => by
  30. rw [mem_singleton_iff.1 hx]; exact vsub_mem_vectorSpan ℝ hfv hfu
  31. have hfr : finrank ℝ (Submodule.span ℝ {v -ᵥ u}) = finrank ℝ (vectorSpan ℝ face) :=
  32. le_antisymm (Submodule.finrank_mono hle) (by rw [finrank_span_singleton hne]; exact hdim)
  33. have heq : Submodule.span ℝ {v -ᵥ u} = vectorSpan ℝ face :=
  34. Submodule.eq_of_le_of_finrank_eq hle hfr
  35. intro w hw
  36. have hwu : w -ᵥ u ∈ vectorSpan ℝ face := vsub_mem_vectorSpan ℝ hw hfu
  37. rw [← heq, Submodule.mem_span_singleton] at hwu
  38. obtain ⟨t, ht⟩ := hwu
  39. have ht' : w - u = t • (v - u) := ht.symm
  40. have hwu' : w = t • (v - u) + u := by rw [sub_eq_iff_eq_add] at ht'; exact ht'
  41. have hwb : w ∈ body := hsub hw
  42. have hub : u ∈ body := hu.1
  43. have hvb : v ∈ body := hv.1
  44. rcases lt_or_ge t 0 with ht0 | ht0
  45. · exfalso
  46. have hmem : u ∈ openSegment ℝ w v := by
  47. rw [openSegment_eq_image_lineMap]
  48. refine ⟨-t / (1 - t), mem_Ioo.mpr ⟨div_pos (neg_pos.2 ht0) (by linarith),
  49. (div_lt_one (by linarith : (0 : ℝ) < 1 - t)).2 (by linarith)⟩, ?_⟩
  50. rw [AffineMap.lineMap_apply_module']
  51. have hexp : (((-t / (1 - t)) • (v - w) + w) - u) =
  52. (((-t / (1 - t)) * (1 - t) + t) • (v - u)) := by
  53. rw [hwu']; module
  54. rw [div_mul_cancel₀ (-t) (by linarith : (1 - t : ℝ) ≠ 0), show (-t + t : ℝ) = 0 by ring,
  55. zero_smul] at hexp
  56. rw [sub_eq_zero] at hexp
  57. exact hexp
  58. rw [hu.2 hwb hvb hmem] at ht'
  59. rcases smul_eq_zero.1 (ht'.symm.trans (sub_self u)) with h | h
  60. · linarith
  61. · exact huv (sub_eq_zero.1 h).symm
  62. · rcases le_or_gt t 1 with ht1 | ht1
  63. · rw [segment_eq_image_lineMap]
  64. refine ⟨t, mem_Icc.mpr ⟨ht0, ht1⟩, ?_⟩
  65. rw [AffineMap.lineMap_apply_module']
  66. exact hwu'.symm
  67. · exfalso
  68. have hmem : v ∈ openSegment ℝ u w := by
  69. rw [openSegment_eq_image_lineMap]
  70. refine ⟨1 / t, mem_Ioo.mpr ⟨div_pos (by linarith) (by linarith),
  71. (div_lt_one (by linarith : (0 : ℝ) < t)).2 (by linarith)⟩, ?_⟩
  72. rw [AffineMap.lineMap_apply_module']
  73. have hexp : (((1 / t) • (w - u) + u) - v) = (((1 / t) * t - 1) • (v - u)) := by
  74. rw [hwu']; module
  75. rw [one_div_mul_cancel (by linarith : (t : ℝ) ≠ 0), show ((1 : ℝ) - 1) = 0 by ring,
  76. zero_smul] at hexp
  77. rw [sub_eq_zero] at hexp
  78. exact hexp
  79. exact huv (hv.2 hub hwb hmem)
  80. /-- My theorem. Two vertices are adjacent in the graph of the claimant for one
  81. move if and only if they are different and the segment between them is a face.
  82. So the graph is the graph of the vertices and the edges of the polytope. -/
  83. theorem adj_one_iff {body : Set E} (u v : Vertex body) :
  84. (graph body 1).Adj u v ↔ u ≠ v ∧ IsFace body (segment ℝ u.val v.val) := by
  85. constructor
  86. · rintro ⟨hne, face, hface, hdim, hu, hv⟩
  87. have hne' : (u.val : E) ≠ v.val := fun h => hne (Subtype.ext h)
  88. have hsub := face_subset_segment hface.2.1 u.property v.property hne' hu hv hdim
  89. have hseg : segment ℝ u.val v.val ⊆ face := hface.1.segment_subset hu hv
  90. have hext : IsExtreme ℝ body (segment ℝ u.val v.val) := by
  91. refine ⟨subset_trans hseg hface.2.1, ?_⟩
  92. intro x hx y hy z hz hzseg
  93. exact hsub (hface.2.left_mem_of_mem_openSegment hx hy (hseg hz) hzseg)
  94. exact ⟨hne, convex_segment u.val v.val, hext⟩
  95. · rintro ⟨hne, hseg⟩
  96. have hvne : (v.val : E) -ᵥ u.val ≠ 0 := by
  97. intro h
  98. have h' : v.val - u.val = 0 := h
  99. exact hne (Subtype.ext (sub_eq_zero.1 h').symm)
  100. have hle : vectorSpan ℝ (segment ℝ u.val v.val) ≤ Submodule.span ℝ {v.val -ᵥ u.val} := by
  101. rw [vectorSpan_def, Submodule.span_le]
  102. rintro x ⟨p, hp, q, hq, rfl⟩
  103. rw [segment_eq_image_lineMap] at hp hq
  104. obtain ⟨a, ha, rfl⟩ := (mem_image _ _ _).1 hp
  105. obtain ⟨b, hb, rfl⟩ := (mem_image _ _ _).1 hq
  106. refine Submodule.mem_span_singleton.2 ⟨a - b, ?_⟩
  107. show (a - b) • (v.val - u.val) =
  108. AffineMap.lineMap u.val v.val a - AffineMap.lineMap u.val v.val b
  109. rw [AffineMap.lineMap_apply_module', AffineMap.lineMap_apply_module']
  110. module
  111. have hu' : u.val ∈ segment ℝ u.val v.val := left_mem_segment ℝ u.val v.val
  112. have hv' : v.val ∈ segment ℝ u.val v.val := right_mem_segment ℝ u.val v.val
  113. refine ⟨hne, segment ℝ u.val v.val, hseg, ?_, hu', hv'⟩
  114. show finrank ℝ (vectorSpan ℝ (segment ℝ u.val v.val)) ≤ 1
  115. exact le_trans (Submodule.finrank_mono hle) (by rw [finrank_span_singleton hvne])
  116. end Skeleton
  117. /-! ### 2. The diameter is the largest distance in a connected graph -/
  118. /-- My lemma. It is also a check by `rfl` that the distance in the statement
  119. `not_polynomialHirsch` is the distance in the graph of the same statements. -/
  120. theorem dist_one_is_graph_dist (poly : Polytope) (first last : poly.V) :
  121. poly.dist 1 first last = (graph poly.body 1).dist first last := rfl
  122. /-- My lemma. -/
  123. theorem diam_le_of_dist_le {α : Type*} [Nonempty α] [Finite α] {G : SimpleGraph α}
  124. (hconn : G.Connected) {k : ℕ} (h : ∀ u v, G.dist u v ≤ k) : G.diam ≤ k := by
  125. have htop : G.ediam ≠ ⊤ := SimpleGraph.connected_iff_ediam_ne_top.1 hconn
  126. have hle : G.ediam ≤ (k : ℕ∞) := SimpleGraph.ediam_le_iff.2 fun u v => by
  127. rw [← (hconn.1 u v).coe_dist_eq_edist]
  128. exact_mod_cast h u v
  129. have hd : ((G.diam : ℕ) : ℕ∞) = G.ediam := SimpleGraph.natCast_diam_eq_ediam_iff.2 htop
  130. rw [← hd] at hle
  131. exact_mod_cast hle
  132. /-- My lemma. -/
  133. theorem le_diam_of_dist_eq {α : Type*} [Nonempty α] [Finite α] {G : SimpleGraph α} (hconn : G.Connected)
  134. {u v : α} {k : ℕ} (h : G.dist u v = k) : k ≤ G.diam := by
  135. have htop : G.ediam ≠ ⊤ := SimpleGraph.connected_iff_ediam_ne_top.1 hconn
  136. rw [← h]
  137. exact SimpleGraph.dist_le_diam htop
  138. /-! ### 3. The two asymptotic definitions give the notation of the paper -/
  139. /-- My theorem. If a sequence is `Superpolynomial`, then the ratio of its
  140. logarithm to the logarithm of `n` tends to infinity. -/
  141. theorem tendsto_atTop_of_superpolynomial {seq : ℕ → ℕ} (h : Superpolynomial seq) :
  142. Tendsto (fun n => Real.log ((seq n : ℕ) : ℝ) / Real.log (n : ℝ)) atTop atTop := by
  143. refine Filter.tendsto_atTop.2 fun b => ?_
  144. filter_upwards [h (max b 1), h 0, eventually_ge_atTop 2] with n hn1 hn0 hn2
  145. have hn0' : (1 : ℝ) ≤ ((seq n : ℕ) : ℝ) := by rw [Real.rpow_zero] at hn0; exact_mod_cast hn0
  146. have hn2' : (1 : ℝ) < n := by exact_mod_cast hn2
  147. have hlog : (max b 1 : ℝ) * Real.log (n : ℝ) ≤ Real.log ((seq n : ℕ) : ℝ) := by
  148. rw [← Real.log_rpow (by positivity : (0 : ℝ) < (n : ℝ)) (max b 1)]
  149. exact Real.log_le_log (by positivity : (0 : ℝ) < ((n : ℕ) : ℝ) ^ (max b 1)) hn1
  150. rw [le_div_iff₀ (Real.log_pos hn2')]
  151. have := mul_le_mul_of_nonneg_right (le_max_left b 1) (Real.log_nonneg (le_of_lt hn2'))
  152. linarith
  153. /-- My theorem. If a sequence is `Subpolynomial`, then the ratio of its
  154. logarithm to the logarithm of `n` tends to zero. -/
  155. theorem tendsto_zero_of_subpolynomial {seq : ℕ → ℕ} (h : Subpolynomial seq) :
  156. Tendsto (fun n => Real.log ((seq n : ℕ) : ℝ) / Real.log (n : ℝ)) atTop (𝓝 0) := by
  157. refine Metric.tendsto_nhds.2 fun eps heps => ?_
  158. filter_upwards [h (eps / 2) (by linarith), eventually_ge_atTop 2] with n hn hn2
  159. have hn2' : (1 : ℝ) < n := by exact_mod_cast hn2
  160. have hlogn : 0 < Real.log (n : ℝ) := Real.log_pos hn2'
  161. have hnn : (0 : ℝ) < n := by positivity
  162. have hge1 : (1 : ℝ) ≤ (n : ℝ) := le_of_lt hn2'
  163. have heps2 : (0 : ℝ) ≤ eps / 2 := by linarith
  164. rcases Nat.eq_zero_or_pos (seq n) with h0 | hpos
  165. · have hz : Real.log ((seq n : ℕ) : ℝ) = 0 := by rw [h0]; simp
  166. rw [hz, Real.dist_eq, sub_zero, zero_div, abs_zero]
  167. exact heps
  168. · have hcast : (0 : ℝ) < ((seq n : ℕ) : ℝ) := by exact_mod_cast hpos
  169. have hnneg : (0 : ℝ) ≤ Real.log ((seq n : ℕ) : ℝ) :=
  170. Real.log_nonneg (by exact_mod_cast (by linarith : (1 : ℕ) ≤ seq n))
  171. have hratio : Real.log ((seq n : ℕ) : ℝ) / Real.log (n : ℝ) ≤ eps / 2 := by
  172. rw [div_le_iff₀ hlogn, ← Real.log_rpow hnn (eps / 2)]
  173. exact Real.log_le_log hcast hn
  174. rw [Real.dist_eq, sub_zero, abs_of_nonneg (div_nonneg hnneg hlogn.le)]
  175. exact lt_of_le_of_lt hratio (by linarith)
  176. /-- My lemma. -/
  177. theorem one_subpolynomial : Subpolynomial (fun _ : ℕ => 1) := by
  178. intro eps heps
  179. filter_upwards [eventually_ge_atTop 1] with n hn
  180. have : (1 : ℝ) ≤ (n : ℝ) ^ eps := Real.one_le_rpow (by exact_mod_cast hn) (le_of_lt heps)
  181. exact_mod_cast this
  182. /-! ### 4. The claim and the theorems of the claimant -/
  183. /-- My theorem. The claim on the site is the theorem `theorem_1_1` of the
  184. claimant with the number of moves equal to 1 (the fourth part is not used). -/
  185. theorem claim_of_theorem_1_1 :
  186. ∃ family : ℕ → Polytope,
  187. (∀ᶠ n in atTop, Simple (family n).body ∧ (graph (family n).body 1).Connected ∧
  188. (family n).facetCount = n) ∧
  189. Subpolynomial (fun n => (family n).dimension) ∧
  190. Superpolynomial (fun n => (graph (family n).body 1).diam) := by
  191. obtain ⟨family, h1, h2, h3, -⟩ :=
  192. OAI.Geometry.Hirsch.theorem_1_1 (fun _ => 1) (fun _ => Nat.zero_lt_one) one_subpolynomial
  193. refine ⟨fun n => (family n).poly, ?_, h2, h3⟩
  194. filter_upwards [h1] with n hn
  195. exact hn
  196. /-- My theorem. The claim on the site gives the negation in the file of the
  197. claimant: no number `coeff` and no exponent `power` give a bound
  198. `coeff * (n + 1) ^ power` for the distance in all simple polytopes with `n`
  199. facets. The statement below is a copy of the statement `not_polynomialHirsch`
  200. of the claimant. -/
  201. theorem not_polynomialHirsch_of_claim
  202. (H : ∃ family : ℕ → Polytope,
  203. (∀ᶠ n in atTop, Simple (family n).body ∧ (graph (family n).body 1).Connected ∧
  204. (family n).facetCount = n) ∧
  205. Subpolynomial (fun n => (family n).dimension) ∧
  206. Superpolynomial (fun n => (graph (family n).body 1).diam)) :
  207. ¬ (∃ coeff power : ℕ, ∀ poly : Polytope, Simple poly.body → (graph poly.body 1).Connected →
  208. ∀ first last : poly.V, poly.dist 1 first last ≤ coeff * (poly.facetCount + 1) ^ power) := by
  209. rintro ⟨coeff, power, hbound⟩
  210. obtain ⟨family, hfam, -, hdiam⟩ := H
  211. have hup : ∀ᶠ n in atTop,
  212. (graph (family n).body 1).diam ≤ coeff * (n + 1) ^ power := by
  213. filter_upwards [hfam] with n hn
  214. obtain ⟨hs, hc, hcount⟩ := hn
  215. have hb := diam_le_of_dist_le hc (k := coeff * ((family n).facetCount + 1) ^ power)
  216. (fun u v => hbound (family n) hs hc u v)
  217. rwa [hcount] at hb
  218. have hdown : ∀ᶠ n in atTop, n ^ (power + 1) ≤ (graph (family n).body 1).diam := by
  219. filter_upwards [hdiam (power + 1)] with n hn
  220. have hb : ((n ^ (power + 1) : ℕ) : ℝ) ≤ ((graph (family n).body 1).diam : ℝ) := by
  221. rw [Nat.cast_pow]
  222. exact_mod_cast hn
  223. exact_mod_cast hb
  224. have hup' : ∀ᶠ n in atTop, n ^ (power + 1) ≤ coeff * 2 ^ power * n ^ power := by
  225. filter_upwards [hup, hdown, eventually_ge_atTop 1] with n h1 h2 hn1
  226. have h2n : (n + 1) ^ power ≤ (2 * n) ^ power := Nat.pow_le_pow_left (by omega) power
  227. calc n ^ (power + 1) = n * n ^ power := pow_succ' n power
  228. _ ≤ (graph (family n).body 1).diam := by rw [← pow_succ' n power]; exact h2
  229. _ ≤ coeff * (n + 1) ^ power := h1
  230. _ ≤ coeff * ((2 * n) ^ power) := Nat.mul_le_mul_left _ h2n
  231. _ = coeff * 2 ^ power * n ^ power := by rw [Nat.mul_pow, Nat.mul_assoc]
  232. obtain ⟨A, hA⟩ : ∃ A : ℕ, coeff * 2 ^ power = A := ⟨_, rfl⟩
  233. rw [hA] at hup'
  234. have hfalse : ∀ᶠ n : ℕ in atTop, False := by
  235. filter_upwards [hup', eventually_ge_atTop (max 1 (A + 1))] with n hn hlarge
  236. have hn1 : 1 ≤ n := le_trans (le_max_left _ _) hlarge
  237. have hAl : A < n := lt_of_lt_of_le (lt_add_one _) (le_trans (le_max_right _ _) hlarge)
  238. have hmul : n * n ^ power ≤ A * n ^ power := by rw [← pow_succ' n power]; exact hn
  239. have hkey := Nat.le_of_mul_le_mul_right hmul (Nat.pow_pos (by omega : 0 < n))
  240. omega
  241. obtain ⟨N, hN⟩ := Filter.eventually_atTop.1 hfalse
  242. exact hN N (le_refl N)
  243. end CheckHirsch
  244. #print axioms CheckHirsch.face_subset_segment
  245. #print axioms CheckHirsch.adj_one_iff
  246. #print axioms CheckHirsch.dist_one_is_graph_dist
  247. #print axioms CheckHirsch.diam_le_of_dist_le
  248. #print axioms CheckHirsch.le_diam_of_dist_eq
  249. #print axioms CheckHirsch.tendsto_atTop_of_superpolynomial
  250. #print axioms CheckHirsch.tendsto_zero_of_subpolynomial
  251. #print axioms CheckHirsch.one_subpolynomial
  252. #print axioms CheckHirsch.claim_of_theorem_1_1
  253. #print axioms CheckHirsch.not_polynomialHirsch_of_claim