import Mathlibnamespace PermutohedronMatchingnoncomputable section/-- Monotonicity comparison used for successive decrements of the reciprocal binomial. -/theorem reciprocal_binomial_decrement_ratio (c t : ℝ) (hc : 0 ≤ c) (ht : 0 ≤ t) :(t + 2) ^ 2 ≤ (t + 1) * (c + t + 4) := bynlinarith [mul_nonneg hc ht]/-- One adjacent run empty, including the empty configuration. -/theorem single_run_bound (b : ℝ) (hb : 0 ≤ b) :1 / 2 + 2 / ((b + 2) * (b + 3)) ≤ (5 / 6 : ℝ) := byhave hp : 0 < (b + 2) * (b + 3) := by positivityhave hd : 6 ≤ (b + 2) * (b + 3) := by nlinarith [sq_nonneg b]have hh : 2 / ((b + 2) * (b + 3)) ≤ (1 / 3 : ℝ) := byapply (div_le_iff₀ hp).2linarithlinarith/-- The exact quadratic remaining from the Poisson-equation flow bound. -/theorem analytic_margin_identity (m k : ℝ) :(m / 2 - 5 / 6 * k) * (m / 2 - 2 * (5 / 6) * k) -k * ((m - k) / 2) * (5 / 6) =(9 * m ^ 2 - 60 * m * k + 65 * k ^ 2) / 36 := byringtheorem margin_nonneg (m k : ℝ) (hk : 0 ≤ k)(h : (10 + Real.sqrt 35) * k ≤ 3 * m) :0 ≤ 9 * m ^ 2 - 60 * m * k + 65 * k ^ 2 := byhave hs := Real.sq_sqrt (show (0 : ℝ) ≤ 35 by norm_num)have ha : 0 ≤ 3 * m - 10 * k - Real.sqrt 35 * k := by linarithhave hb : 0 ≤ 3 * m - 10 * k + Real.sqrt 35 * k := bylinarith [mul_nonneg (Real.sqrt_nonneg 35) hk]calc0 ≤ (3 * m - 10 * k - Real.sqrt 35 * k) *(3 * m - 10 * k + Real.sqrt 35 * k) := mul_nonneg ha hb_ = 9 * m ^ 2 - 60 * m * k + 65 * k ^ 2 := bylinear_combination -k ^ 2 * hsdef b (m : ℝ) : ℝ := m * (m - 2) / ((m - 1) * (3 * m - 2))def scale (m : ℝ) : ℝ := (m - 2) ^ 2 / (3 * m - 2)/-- Column equalization and the two strict edge margins for the codimension-three formula. -/theorem third_codimension_constants (m : ℝ) (hm : 3 ≤ m) :2 * b m * (m - 3) + 4 * b m / m = 2 * scale m ∧(1 - 2 * b m) * (m - 2) - 2 * b m = scale m ∧0 < b m - 2 * b m / m ∧ 0 < 1 - 2 * b m - 2 * b m / m := byhave hm0 : m ≠ 0 := by linarithhave h1 : 0 < m - 1 := by linarithhave h2 : 0 < 3 * m - 2 := by linarithhave h3 : 0 < m - 2 := by linarithhave h4 : 0 ≤ m - 3 := by linarithhave hmpos : 0 < m := by linarithhave hb : 0 < b m := by unfold b; positivityrefine ⟨?_, ?_, ?_, ?_⟩· unfold b scalefield_simp [hm0, ne_of_gt h1, ne_of_gt h2]ring· unfold b scalefield_simp [ne_of_gt h1, ne_of_gt h2]ring_nffield_simp [ne_of_gt (show 0 < -2 + m * 3 by linarith)]ring· have ha : 2 * b m / m < b m := byapply (div_lt_iff₀ hmpos).2nlinarith [mul_pos hb h3]linarith· have he : 1 - 2 * b m - 2 * b m / m =(m * (m - 3) + 6) / ((m - 1) * (3 * m - 2)) := byunfold bfield_simp [hm0, ne_of_gt h1, ne_of_gt h2]ring_nffield_simp [ne_of_gt (show 0 < -2 + m * 3 by linarith)]ringrw [he]positivityendend PermutohedronMatching