Lean / Reader
Lean readerhirsch-bridge-check.lean
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.
import OAI.Geometry.Hirsch.Mainimport Mathlib.Analysis.SpecialFunctions.Log.Basicimport Mathlib.Analysis.SpecialFunctions.Pow.Realimport Mathlib.Tactic/-!# My bridge proofs for the Hirsch check (desk task 430)All proofs in this file are mine. The file uses the definitions and the theoremsof the claimant only as given constants.-/open scoped Topology Pointwisenamespace CheckHirschopen Set Module Filteropen OAI.Geometry.Hirsch/-! ### 1. The graph for one move is the graph of the edges -/section Skeletonvariable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E]{body face : Set E}/-- My lemma. A set of dimension at most 1 that contains two different extremepoints of `body` is a subset of the segment between the two points. -/theorem face_subset_segment {u v : E} (hsub : face ⊆ body)(hu : u ∈ body.extremePoints ℝ) (hv : v ∈ body.extremePoints ℝ) (huv : u ≠ v)(hfu : u ∈ face) (hfv : v ∈ face) (hdim : finrank ℝ (vectorSpan ℝ face) ≤ 1) :face ⊆ segment ℝ u v := byhave hne : (v -ᵥ u : E) ≠ 0 := byintro hhave h' : v - u = 0 := hexact huv (sub_eq_zero.1 h').symmhave hle : Submodule.span ℝ {v -ᵥ u} ≤ vectorSpan ℝ face :=Submodule.span_le.2 fun x hx => byrw [mem_singleton_iff.1 hx]; exact vsub_mem_vectorSpan ℝ hfv hfuhave hfr : finrank ℝ (Submodule.span ℝ {v -ᵥ u}) = finrank ℝ (vectorSpan ℝ face) :=le_antisymm (Submodule.finrank_mono hle) (by rw [finrank_span_singleton hne]; exact hdim)have heq : Submodule.span ℝ {v -ᵥ u} = vectorSpan ℝ face :=Submodule.eq_of_le_of_finrank_eq hle hfrintro w hwhave hwu : w -ᵥ u ∈ vectorSpan ℝ face := vsub_mem_vectorSpan ℝ hw hfurw [← heq, Submodule.mem_span_singleton] at hwuobtain ⟨t, ht⟩ := hwuhave ht' : w - u = t • (v - u) := ht.symmhave hwu' : w = t • (v - u) + u := by rw [sub_eq_iff_eq_add] at ht'; exact ht'have hwb : w ∈ body := hsub hwhave hub : u ∈ body := hu.1have hvb : v ∈ body := hv.1rcases lt_or_ge t 0 with ht0 | ht0· exfalsohave hmem : u ∈ openSegment ℝ w v := byrw [openSegment_eq_image_lineMap]refine ⟨-t / (1 - t), mem_Ioo.mpr ⟨div_pos (neg_pos.2 ht0) (by linarith),(div_lt_one (by linarith : (0 : ℝ) < 1 - t)).2 (by linarith)⟩, ?_⟩rw [AffineMap.lineMap_apply_module']have hexp : (((-t / (1 - t)) • (v - w) + w) - u) =(((-t / (1 - t)) * (1 - t) + t) • (v - u)) := byrw [hwu']; modulerw [div_mul_cancel₀ (-t) (by linarith : (1 - t : ℝ) ≠ 0), show (-t + t : ℝ) = 0 by ring,zero_smul] at hexprw [sub_eq_zero] at hexpexact hexprw [hu.2 hwb hvb hmem] at ht'rcases smul_eq_zero.1 (ht'.symm.trans (sub_self u)) with h | h· linarith· exact huv (sub_eq_zero.1 h).symm· rcases le_or_gt t 1 with ht1 | ht1· rw [segment_eq_image_lineMap]refine ⟨t, mem_Icc.mpr ⟨ht0, ht1⟩, ?_⟩rw [AffineMap.lineMap_apply_module']exact hwu'.symm· exfalsohave hmem : v ∈ openSegment ℝ u w := byrw [openSegment_eq_image_lineMap]refine ⟨1 / t, mem_Ioo.mpr ⟨div_pos (by linarith) (by linarith),(div_lt_one (by linarith : (0 : ℝ) < t)).2 (by linarith)⟩, ?_⟩rw [AffineMap.lineMap_apply_module']have hexp : (((1 / t) • (w - u) + u) - v) = (((1 / t) * t - 1) • (v - u)) := byrw [hwu']; modulerw [one_div_mul_cancel (by linarith : (t : ℝ) ≠ 0), show ((1 : ℝ) - 1) = 0 by ring,zero_smul] at hexprw [sub_eq_zero] at hexpexact hexpexact huv (hv.2 hub hwb hmem)/-- My theorem. Two vertices are adjacent in the graph of the claimant for onemove if and only if they are different and the segment between them is a face.So the graph is the graph of the vertices and the edges of the polytope. -/theorem adj_one_iff {body : Set E} (u v : Vertex body) :(graph body 1).Adj u v ↔ u ≠ v ∧ IsFace body (segment ℝ u.val v.val) := byconstructor· rintro ⟨hne, face, hface, hdim, hu, hv⟩have hne' : (u.val : E) ≠ v.val := fun h => hne (Subtype.ext h)have hsub := face_subset_segment hface.2.1 u.property v.property hne' hu hv hdimhave hseg : segment ℝ u.val v.val ⊆ face := hface.1.segment_subset hu hvhave hext : IsExtreme ℝ body (segment ℝ u.val v.val) := byrefine ⟨subset_trans hseg hface.2.1, ?_⟩intro x hx y hy z hz hzsegexact hsub (hface.2.left_mem_of_mem_openSegment hx hy (hseg hz) hzseg)exact ⟨hne, convex_segment u.val v.val, hext⟩· rintro ⟨hne, hseg⟩have hvne : (v.val : E) -ᵥ u.val ≠ 0 := byintro hhave h' : v.val - u.val = 0 := hexact hne (Subtype.ext (sub_eq_zero.1 h').symm)have hle : vectorSpan ℝ (segment ℝ u.val v.val) ≤ Submodule.span ℝ {v.val -ᵥ u.val} := byrw [vectorSpan_def, Submodule.span_le]rintro x ⟨p, hp, q, hq, rfl⟩rw [segment_eq_image_lineMap] at hp hqobtain ⟨a, ha, rfl⟩ := (mem_image _ _ _).1 hpobtain ⟨b, hb, rfl⟩ := (mem_image _ _ _).1 hqrefine Submodule.mem_span_singleton.2 ⟨a - b, ?_⟩show (a - b) • (v.val - u.val) =AffineMap.lineMap u.val v.val a - AffineMap.lineMap u.val v.val brw [AffineMap.lineMap_apply_module', AffineMap.lineMap_apply_module']modulehave hu' : u.val ∈ segment ℝ u.val v.val := left_mem_segment ℝ u.val v.valhave hv' : v.val ∈ segment ℝ u.val v.val := right_mem_segment ℝ u.val v.valrefine ⟨hne, segment ℝ u.val v.val, hseg, ?_, hu', hv'⟩show finrank ℝ (vectorSpan ℝ (segment ℝ u.val v.val)) ≤ 1exact le_trans (Submodule.finrank_mono hle) (by rw [finrank_span_singleton hvne])end Skeleton/-! ### 2. The diameter is the largest distance in a connected graph -//-- My lemma. It is also a check by `rfl` that the distance in the statement`not_polynomialHirsch` is the distance in the graph of the same statements. -/theorem dist_one_is_graph_dist (poly : Polytope) (first last : poly.V) :poly.dist 1 first last = (graph poly.body 1).dist first last := rfl/-- My lemma. -/theorem diam_le_of_dist_le {α : Type*} [Nonempty α] [Finite α] {G : SimpleGraph α}(hconn : G.Connected) {k : ℕ} (h : ∀ u v, G.dist u v ≤ k) : G.diam ≤ k := byhave htop : G.ediam ≠ ⊤ := SimpleGraph.connected_iff_ediam_ne_top.1 hconnhave hle : G.ediam ≤ (k : ℕ∞) := SimpleGraph.ediam_le_iff.2 fun u v => byrw [← (hconn.1 u v).coe_dist_eq_edist]exact_mod_cast h u vhave hd : ((G.diam : ℕ) : ℕ∞) = G.ediam := SimpleGraph.natCast_diam_eq_ediam_iff.2 htoprw [← hd] at hleexact_mod_cast hle/-- My lemma. -/theorem le_diam_of_dist_eq {α : Type*} [Nonempty α] [Finite α] {G : SimpleGraph α} (hconn : G.Connected){u v : α} {k : ℕ} (h : G.dist u v = k) : k ≤ G.diam := byhave htop : G.ediam ≠ ⊤ := SimpleGraph.connected_iff_ediam_ne_top.1 hconnrw [← h]exact SimpleGraph.dist_le_diam htop/-! ### 3. The two asymptotic definitions give the notation of the paper -//-- My theorem. If a sequence is `Superpolynomial`, then the ratio of itslogarithm to the logarithm of `n` tends to infinity. -/theorem tendsto_atTop_of_superpolynomial {seq : ℕ → ℕ} (h : Superpolynomial seq) :Tendsto (fun n => Real.log ((seq n : ℕ) : ℝ) / Real.log (n : ℝ)) atTop atTop := byrefine Filter.tendsto_atTop.2 fun b => ?_filter_upwards [h (max b 1), h 0, eventually_ge_atTop 2] with n hn1 hn0 hn2have hn0' : (1 : ℝ) ≤ ((seq n : ℕ) : ℝ) := by rw [Real.rpow_zero] at hn0; exact_mod_cast hn0have hn2' : (1 : ℝ) < n := by exact_mod_cast hn2have hlog : (max b 1 : ℝ) * Real.log (n : ℝ) ≤ Real.log ((seq n : ℕ) : ℝ) := byrw [← Real.log_rpow (by positivity : (0 : ℝ) < (n : ℝ)) (max b 1)]exact Real.log_le_log (by positivity : (0 : ℝ) < ((n : ℕ) : ℝ) ^ (max b 1)) hn1rw [le_div_iff₀ (Real.log_pos hn2')]have := mul_le_mul_of_nonneg_right (le_max_left b 1) (Real.log_nonneg (le_of_lt hn2'))linarith/-- My theorem. If a sequence is `Subpolynomial`, then the ratio of itslogarithm to the logarithm of `n` tends to zero. -/theorem tendsto_zero_of_subpolynomial {seq : ℕ → ℕ} (h : Subpolynomial seq) :Tendsto (fun n => Real.log ((seq n : ℕ) : ℝ) / Real.log (n : ℝ)) atTop (𝓝 0) := byrefine Metric.tendsto_nhds.2 fun eps heps => ?_filter_upwards [h (eps / 2) (by linarith), eventually_ge_atTop 2] with n hn hn2have hn2' : (1 : ℝ) < n := by exact_mod_cast hn2have hlogn : 0 < Real.log (n : ℝ) := Real.log_pos hn2'have hnn : (0 : ℝ) < n := by positivityhave hge1 : (1 : ℝ) ≤ (n : ℝ) := le_of_lt hn2'have heps2 : (0 : ℝ) ≤ eps / 2 := by linarithrcases Nat.eq_zero_or_pos (seq n) with h0 | hpos· have hz : Real.log ((seq n : ℕ) : ℝ) = 0 := by rw [h0]; simprw [hz, Real.dist_eq, sub_zero, zero_div, abs_zero]exact heps· have hcast : (0 : ℝ) < ((seq n : ℕ) : ℝ) := by exact_mod_cast hposhave hnneg : (0 : ℝ) ≤ Real.log ((seq n : ℕ) : ℝ) :=Real.log_nonneg (by exact_mod_cast (by linarith : (1 : ℕ) ≤ seq n))have hratio : Real.log ((seq n : ℕ) : ℝ) / Real.log (n : ℝ) ≤ eps / 2 := byrw [div_le_iff₀ hlogn, ← Real.log_rpow hnn (eps / 2)]exact Real.log_le_log hcast hnrw [Real.dist_eq, sub_zero, abs_of_nonneg (div_nonneg hnneg hlogn.le)]exact lt_of_le_of_lt hratio (by linarith)/-- My lemma. -/theorem one_subpolynomial : Subpolynomial (fun _ : ℕ => 1) := byintro eps hepsfilter_upwards [eventually_ge_atTop 1] with n hnhave : (1 : ℝ) ≤ (n : ℝ) ^ eps := Real.one_le_rpow (by exact_mod_cast hn) (le_of_lt heps)exact_mod_cast this/-! ### 4. The claim and the theorems of the claimant -//-- My theorem. The claim on the site is the theorem `theorem_1_1` of theclaimant with the number of moves equal to 1 (the fourth part is not used). -/theorem claim_of_theorem_1_1 :∃ family : ℕ → Polytope,(∀ᶠ n in atTop, Simple (family n).body ∧ (graph (family n).body 1).Connected ∧(family n).facetCount = n) ∧Subpolynomial (fun n => (family n).dimension) ∧Superpolynomial (fun n => (graph (family n).body 1).diam) := byobtain ⟨family, h1, h2, h3, -⟩ :=OAI.Geometry.Hirsch.theorem_1_1 (fun _ => 1) (fun _ => Nat.zero_lt_one) one_subpolynomialrefine ⟨fun n => (family n).poly, ?_, h2, h3⟩filter_upwards [h1] with n hnexact hn/-- My theorem. The claim on the site gives the negation in the file of theclaimant: no number `coeff` and no exponent `power` give a bound`coeff * (n + 1) ^ power` for the distance in all simple polytopes with `n`facets. The statement below is a copy of the statement `not_polynomialHirsch`of the claimant. -/theorem not_polynomialHirsch_of_claim(H : ∃ family : ℕ → Polytope,(∀ᶠ n in atTop, Simple (family n).body ∧ (graph (family n).body 1).Connected ∧(family n).facetCount = n) ∧Subpolynomial (fun n => (family n).dimension) ∧Superpolynomial (fun n => (graph (family n).body 1).diam)) :¬ (∃ coeff power : ℕ, ∀ poly : Polytope, Simple poly.body → (graph poly.body 1).Connected →∀ first last : poly.V, poly.dist 1 first last ≤ coeff * (poly.facetCount + 1) ^ power) := byrintro ⟨coeff, power, hbound⟩obtain ⟨family, hfam, -, hdiam⟩ := Hhave hup : ∀ᶠ n in atTop,(graph (family n).body 1).diam ≤ coeff * (n + 1) ^ power := byfilter_upwards [hfam] with n hnobtain ⟨hs, hc, hcount⟩ := hnhave hb := diam_le_of_dist_le hc (k := coeff * ((family n).facetCount + 1) ^ power)(fun u v => hbound (family n) hs hc u v)rwa [hcount] at hbhave hdown : ∀ᶠ n in atTop, n ^ (power + 1) ≤ (graph (family n).body 1).diam := byfilter_upwards [hdiam (power + 1)] with n hnhave hb : ((n ^ (power + 1) : ℕ) : ℝ) ≤ ((graph (family n).body 1).diam : ℝ) := byrw [Nat.cast_pow]exact_mod_cast hnexact_mod_cast hbhave hup' : ∀ᶠ n in atTop, n ^ (power + 1) ≤ coeff * 2 ^ power * n ^ power := byfilter_upwards [hup, hdown, eventually_ge_atTop 1] with n h1 h2 hn1have h2n : (n + 1) ^ power ≤ (2 * n) ^ power := Nat.pow_le_pow_left (by omega) powercalc n ^ (power + 1) = n * n ^ power := pow_succ' n power_ ≤ (graph (family n).body 1).diam := by rw [← pow_succ' n power]; exact h2_ ≤ coeff * (n + 1) ^ power := h1_ ≤ coeff * ((2 * n) ^ power) := Nat.mul_le_mul_left _ h2n_ = coeff * 2 ^ power * n ^ power := by rw [Nat.mul_pow, Nat.mul_assoc]obtain ⟨A, hA⟩ : ∃ A : ℕ, coeff * 2 ^ power = A := ⟨_, rfl⟩rw [hA] at hup'have hfalse : ∀ᶠ n : ℕ in atTop, False := byfilter_upwards [hup', eventually_ge_atTop (max 1 (A + 1))] with n hn hlargehave hn1 : 1 ≤ n := le_trans (le_max_left _ _) hlargehave hAl : A < n := lt_of_lt_of_le (lt_add_one _) (le_trans (le_max_right _ _) hlarge)have hmul : n * n ^ power ≤ A * n ^ power := by rw [← pow_succ' n power]; exact hnhave hkey := Nat.le_of_mul_le_mul_right hmul (Nat.pow_pos (by omega : 0 < n))omegaobtain ⟨N, hN⟩ := Filter.eventually_atTop.1 hfalseexact hN N (le_refl N)end CheckHirsch#print axioms CheckHirsch.face_subset_segment#print axioms CheckHirsch.adj_one_iff#print axioms CheckHirsch.dist_one_is_graph_dist#print axioms CheckHirsch.diam_le_of_dist_le#print axioms CheckHirsch.le_diam_of_dist_eq#print axioms CheckHirsch.tendsto_atTop_of_superpolynomial#print axioms CheckHirsch.tendsto_zero_of_subpolynomial#print axioms CheckHirsch.one_subpolynomial#print axioms CheckHirsch.claim_of_theorem_1_1#print axioms CheckHirsch.not_polynomialHirsch_of_claim