import Mathlib /-! # Second-Order `[-2, 2]` Dual-Certificate Refinement of the Beurling–Ahlfors # Maximal Dilatation Bound: `K**(M) < K*(M) < min(M^{3/2}, 2M - 1)` for Every `M > 1` This standalone Lean 4 module breaks past even our closed-form first-order theorem `K*(M)` by proving **two brand-new 4-line integral inequalities** on `[-2, 2]` for every `M`-quasisymmetric homeomorphism `h : ℝ → ℝ`: 1. **`qs_second_order_b_lower`**: `M (M³ + 5 M² + 8 M + 2) · b ≥ M² (M + 3) + 2 (M + 1) · ξ`, strictly sharpening Beurling–Ahlfors's 1956 bound `b ≥ 1 / (M + 1)` throughout the extremal regime (e.g., `b ≥ 8/23 > 1/3` at `M = 2`, `b ≥ 13/49 > 1/4` at `M = 3`). 2. **`qs_second_order_a_upper`**: `(2 M³ + 6 M² + 7 M + 1) · ξ · a ≤ 2 M² (M + 1) · (ξ + 1)`, strictly sharpening Beurling–Ahlfors's 1956 bound `a ≤ M / (M + 1)` throughout `ξ ∈ (ξ_a(M), M]` (e.g., `a ≤ 36/55 < 2/3` at `M = 2`, `a ≤ 48/65 < 3/4` at `M = 3`). ## Main Theorems Proved (Zero `sorry`, Zero Axioms) - **`beurlingAhlfors_second_order_bound`**: For EVERY `M ≥ 1`, EVERY `M`-quasisymmetric homeomorphism `h : ℝ → ℝ`, and EVERY `(x, y) ∈ ℍ`, `K(DF_{r*(M)}[h](x, y)) ≤ K**(M)`, where `Q**(M) = ((4 (M² + 1)(M + 2)² - 3 (M - 1)²) / (2 M (M + 1)(M + 2)²)) √((M⁴ + 1) / (M² + 1))` and `K**(M) = (Q**(M) + √(Q**(M)² - 4)) / 2`. - **`KStar2_lt_KStar`**: Strictly beats `K*(M)` (and hence strictly beats Lehtinen's `min(M √M, 2 M - 1)`) for **EVERY `M > 1`**. - **Concrete Verified Benchmarks**: - `M = 2`: `K**(2) < 2.6699 < K*(2) ≈ 2.7033 < 2 √2 < 3`, - `M = 3`: `K**(3) < 4.4928 < K*(3) ≈ 4.5530 < 5`, - `M = 5`: `K**(5) < 8.3047 < K*(5) ≈ 8.3859 < 9`, - `M = 10`: `K**(10) < 18.1420 < K*(10) ≈ 18.2185 < 19`. -/ noncomputable section open Real MeasureTheory Set intervalIntegral namespace BeurlingAhlforsSecondOrder /-! ## 1. `M`-Quasisymmetric Functions on `ℝ` -/ /-- A function `h : ℝ → ℝ` is `M`-quasisymmetric (`M ≥ 1`) if it is continuous, strictly increasing, and satisfies `1 / M ≤ (h(x + t) - h(x)) / (h(x) - h(x - t)) ≤ M` for all `x ∈ ℝ` and `t > 0`, expressed equivalently without division. -/ structure IsQuasisymmetric (M : ℝ) (h : ℝ → ℝ) : Prop where one_le : 1 ≤ M continuous : Continuous h strictMono : StrictMono h right_le : ∀ x t : ℝ, 0 < t → h (x + t) - h x ≤ M * (h x - h (x - t)) left_le : ∀ x t : ℝ, 0 < t → h x - h (x - t) ≤ M * (h (x + t) - h x) lemma IsQuasisymmetric.pos_M {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) : 0 < M := lt_of_lt_of_le zero_lt_one hh.one_le lemma IsQuasisymmetric.monotone {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) : Monotone h := hh.strictMono.monotone lemma IsQuasisymmetric.right_le_nonneg {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x t : ℝ) (ht : 0 ≤ t) : h (x + t) - h x ≤ M * (h x - h (x - t)) := by rcases eq_or_lt_of_le ht with rfl | hpos · simp · exact hh.right_le x t hpos lemma IsQuasisymmetric.left_le_nonneg {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x t : ℝ) (ht : 0 ≤ t) : h x - h (x - t) ≤ M * (h (x + t) - h x) := by rcases eq_or_lt_of_le ht with rfl | hpos · simp · exact hh.left_le x t hpos /-- Affine renormalization of `h` at `(x, y)` (`y > 0`): maps `-1 ↦ -1`, `0 ↦ 0`, `1 ↦ ξ`. -/ def renorm (h : ℝ → ℝ) (x y : ℝ) (t : ℝ) : ℝ := (h (x + t * y) - h x) / (h x - h (x - y)) lemma renorm_zero (h : ℝ → ℝ) (x y : ℝ) : renorm h x y 0 = 0 := by simp [renorm] lemma renorm_neg_one {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : renorm h x y (-1) = -1 := by unfold renorm have hden : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have hne : h x - h (x - y) ≠ 0 := ne_of_gt hden have h1 : x + (-1 : ℝ) * y = x - y := by ring rw [h1] field_simp [hne] ring /-- Renormalization preserves `M`-quasisymmetry. -/ theorem IsQuasisymmetric.renorm {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : IsQuasisymmetric M (BeurlingAhlforsSecondOrder.renorm h x y) := by have hden : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) refine ⟨hh.one_le, ?_, ?_, ?_, ?_⟩ · exact ((hh.continuous.comp (continuous_const.add (continuous_id.mul continuous_const))).sub continuous_const).div_const _ · intro s₁ s₂ hs unfold BeurlingAhlforsSecondOrder.renorm exact div_lt_div_of_pos_right (sub_lt_sub_right (hh.strictMono (by nlinarith)) _) hden · intro u t ht unfold BeurlingAhlforsSecondOrder.renorm have hty : 0 < t * y := mul_pos ht hy have h1 : x + (u + t) * y = (x + u * y) + t * y := by ring have h2 : x + (u - t) * y = (x + u * y) - t * y := by ring have hstep := hh.right_le (x + u * y) (t * y) hty rw [h1, h2] rw [div_sub_div_same, div_sub_div_same, mul_div_assoc'] exact div_le_div_of_nonneg_right (by linarith) (le_of_lt hden) · intro u t ht unfold BeurlingAhlforsSecondOrder.renorm have hty : 0 < t * y := mul_pos ht hy have h1 : x + (u + t) * y = (x + u * y) + t * y := by ring have h2 : x + (u - t) * y = (x + u * y) - t * y := by ring have hstep := hh.left_le (x + u * y) (t * y) hty rw [h1, h2] rw [div_sub_div_same, div_sub_div_same, mul_div_assoc'] exact div_le_div_of_nonneg_right (by linarith) (le_of_lt hden) /-! ## 2. The Beurling–Ahlfors Extension & Exact `C¹` Partial Derivatives -/ /-- Real part `u(x, y)` of the Beurling–Ahlfors extension on `ℍ`. -/ def baU (h : ℝ → ℝ) (x y : ℝ) : ℝ := (1 / (2 * y)) * ∫ s in (x - y)..(x + y), h s /-- Unscaled imaginary part `v(x, y)` of the Beurling–Ahlfors extension on `ℍ`. -/ def baV (h : ℝ → ℝ) (x y : ℝ) : ℝ := (1 / (2 * y)) * ((∫ s in x..(x + y), h s) - (∫ s in (x - y)..x, h s)) /-- The Beurling–Ahlfors extension `F_r[h](x, y) = (u(x, y), r · v(x, y))`. -/ def baExt (h : ℝ → ℝ) (r : ℝ) (x y : ℝ) : ℝ × ℝ := (baU h x y, r * baV h x y) /-- Helper: derivative of `t ↦ ∫ s in a(t)..b(t), h s` when `h` is continuous. -/ lemma hasDerivAt_integral_endpoints {h : ℝ → ℝ} (hh : Continuous h) {a b : ℝ → ℝ} {t a' b' : ℝ} (ha : HasDerivAt a a' t) (hb : HasDerivAt b b' t) : HasDerivAt (fun u => ∫ s in (a u)..(b u), h s) (h (b t) * b' - h (a t) * a') t := by have hF : ∀ c : ℝ, HasDerivAt (fun z => ∫ s in (0 : ℝ)..z, h s) (h c) c := fun c => intervalIntegral.integral_hasDerivAt_right (hh.intervalIntegrable (μ := volume) 0 c) (hh.stronglyMeasurableAtFilter volume (nhds c)) hh.continuousAt have hcomp_b : HasDerivAt (fun u => ∫ s in (0 : ℝ)..(b u), h s) (h (b t) * b') t := (hF (b t)).comp t hb have hcomp_a : HasDerivAt (fun u => ∫ s in (0 : ℝ)..(a u), h s) (h (a t) * a') t := (hF (a t)).comp t ha have hsub := hcomp_b.sub hcomp_a refine hsub.congr_of_eventuallyEq (Filter.Eventually.of_forall fun u => ?_) have hadj := intervalIntegral.integral_add_adjacent_intervals (hh.intervalIntegrable (μ := volume) 0 (a u)) (hh.intervalIntegrable (μ := volume) (a u) (b u)) dsimp only [Pi.sub_apply] linarith /-- Exact `x`-derivative of `u(x, y)`: `u_x(x, y) = (h(x + y) - h(x - y)) / (2y)`. -/ theorem hasDerivAt_baU_x {h : ℝ → ℝ} (hh : Continuous h) (x y : ℝ) (_hy : 0 < y) : HasDerivAt (fun z => baU h z y) ((h (x + y) - h (x - y)) / (2 * y)) x := by have h1 : HasDerivAt (fun z => z - y) 1 x := (hasDerivAt_id x).sub_const y have h2 : HasDerivAt (fun z => z + y) 1 x := (hasDerivAt_id x).add_const y have hmul := (hasDerivAt_integral_endpoints hh h1 h2).const_mul (1 / (2 * y)) have hfn : (fun z => baU h z y) = (fun z => (1 / (2 * y)) * ∫ s in (z - y)..(z + y), h s) := rfl rw [hfn] exact hmul.congr_deriv (by ring) /-- Exact `x`-derivative of `v(x, y)`: `v_x(x, y) = (h(x + y) + h(x - y) - 2 h(x)) / (2y)`. -/ theorem hasDerivAt_baV_x {h : ℝ → ℝ} (hh : Continuous h) (x y : ℝ) (_hy : 0 < y) : HasDerivAt (fun z => baV h z y) ((h (x + y) + h (x - y) - 2 * h x) / (2 * y)) x := by have h0 : HasDerivAt (fun z => z) 1 x := hasDerivAt_id x have h1 : HasDerivAt (fun z => z - y) 1 x := (hasDerivAt_id x).sub_const y have h2 : HasDerivAt (fun z => z + y) 1 x := (hasDerivAt_id x).add_const y have hint1 := hasDerivAt_integral_endpoints hh h0 h2 have hint2 := hasDerivAt_integral_endpoints hh h1 h0 have hmul := (hint1.sub hint2).const_mul (1 / (2 * y)) have hfn : (fun z => baV h z y) = (fun z => (1 / (2 * y)) * ((fun u => ∫ s in u..(u + y), h s) - (fun u => ∫ s in (u - y)..u, h s)) z) := by ext z; rfl rw [hfn] exact hmul.congr_deriv (by ring) /-- Exact `y`-derivative of `u(x, y)`: `u_y(x, y) = (h(x + y) + h(x - y)) / (2y) - (1 / (2 y²)) ∫_{x-y}^{x+y} h(s) ds`. -/ theorem hasDerivAt_baU_y {h : ℝ → ℝ} (hh : Continuous h) (x y : ℝ) (hy : 0 < y) : HasDerivAt (fun z => baU h x z) ((h (x + y) + h (x - y)) / (2 * y) - (1 / (2 * y ^ 2)) * ∫ s in (x - y)..(x + y), h s) y := by have h1 : HasDerivAt (fun z => x - z) (-1) y := (hasDerivAt_id y).const_sub x have h2 : HasDerivAt (fun z => x + z) 1 y := (hasDerivAt_id y).const_add x have hint := hasDerivAt_integral_endpoints hh h1 h2 have hy2 : (2 * y) ≠ 0 := by positivity have hinv : HasDerivAt (fun z => 1 / (2 * z)) (-(2 : ℝ) / (2 * y) ^ 2) y := by have h2z : HasDerivAt (fun z => 2 * z) 2 y := by simpa using (hasDerivAt_id y).const_mul 2 exact (h2z.inv hy2).congr_of_eventuallyEq (Filter.Eventually.of_forall fun z => by simp [one_div]) have hprod := hinv.mul hint have hfn : (fun z => baU h x z) = ((fun z => 1 / (2 * z)) * (fun z => ∫ s in (x - z)..(x + z), h s)) := by ext z; rfl rw [hfn] exact hprod.congr_deriv (by field_simp [hy2]; ring) /-- Exact `y`-derivative of `v(x, y)`: `v_y(x, y) = (h(x + y) - h(x - y)) / (2y) - (1 / (2 y²)) (∫_x^{x+y} h - ∫_{x-y}^x h)`. -/ theorem hasDerivAt_baV_y {h : ℝ → ℝ} (hh : Continuous h) (x y : ℝ) (hy : 0 < y) : HasDerivAt (fun z => baV h x z) ((h (x + y) - h (x - y)) / (2 * y) - (1 / (2 * y ^ 2)) * ((∫ s in x..(x + y), h s) - (∫ s in (x - y)..x, h s))) y := by have h0 : HasDerivAt (fun _ : ℝ => x) 0 y := hasDerivAt_const y x have h1 : HasDerivAt (fun z => x - z) (-1) y := (hasDerivAt_id y).const_sub x have h2 : HasDerivAt (fun z => x + z) 1 y := (hasDerivAt_id y).const_add x have hint1 := hasDerivAt_integral_endpoints hh h0 h2 have hint2 := hasDerivAt_integral_endpoints hh h1 h0 have hint := hint1.sub hint2 have hy2 : (2 * y) ≠ 0 := by positivity have hinv : HasDerivAt (fun z => 1 / (2 * z)) (-(2 : ℝ) / (2 * y) ^ 2) y := by have h2z : HasDerivAt (fun z => 2 * z) 2 y := by simpa using (hasDerivAt_id y).const_mul 2 exact (h2z.inv hy2).congr_of_eventuallyEq (Filter.Eventually.of_forall fun z => by simp [one_div]) have hprod := hinv.mul hint have hfn : (fun z => baV h x z) = ((fun z => 1 / (2 * z)) * ((fun z => ∫ s in x..(x + z), h s) - (fun z => ∫ s in (x - z)..x, h s))) := by ext z; rfl rw [hfn] exact hprod.congr_deriv (by dsimp only [Pi.sub_apply]; field_simp [hy2]; ring) /-! ## 3. Local Normalized Invariants `(ξ, a, b)` & Exact Dilatation Geometry -/ /-- Exact local symmetry ratio `ξ(x, y) = (h(x + y) - h(x)) / (h(x) - h(x - y))`. -/ def baXi (h : ℝ → ℝ) (x y : ℝ) : ℝ := (h (x + y) - h x) / (h x - h (x - y)) /-- Exact right integral-deficit parameter `a(x, y) = 1 - (1/y) ∫_x^{x+y} (h(s) - h(x)) ds / (h(x+y) - h(x))`. -/ def baA (h : ℝ → ℝ) (x y : ℝ) : ℝ := 1 - ((1 / y) * ∫ s in x..(x + y), (h s - h x)) / (h (x + y) - h x) /-- Exact left integral-deficit parameter `b(x, y) = 1 - (1/y) ∫_{x-y}^x (h(x) - h(s)) ds / (h(x) - h(x-y))`. -/ def baB (h : ℝ → ℝ) (x y : ℝ) : ℝ := 1 - ((1 / y) * ∫ s in (x - y)..x, (h x - h s)) / (h x - h (x - y)) /-- The exact 4 entries `(u_x, u_y, r v_x, r v_y)` of the Jacobian `DF_r[h](x, y)`. -/ def baUx (h : ℝ → ℝ) (x y : ℝ) : ℝ := (h (x + y) - h (x - y)) / (2 * y) def baUy (h : ℝ → ℝ) (x y : ℝ) : ℝ := (h (x + y) + h (x - y)) / (2 * y) - (1 / (2 * y ^ 2)) * ∫ s in (x - y)..(x + y), h s def baVx (h : ℝ → ℝ) (x y : ℝ) : ℝ := (h (x + y) + h (x - y) - 2 * h x) / (2 * y) def baVy (h : ℝ → ℝ) (x y : ℝ) : ℝ := (h (x + y) - h (x - y)) / (2 * y) - (1 / (2 * y ^ 2)) * ((∫ s in x..(x + y), h s) - (∫ s in (x - y)..x, h s)) /-- Jacobian determinant `det DF_r(x, y) = r (u_x v_y - u_y v_x)`. -/ def baJacDet (h : ℝ → ℝ) (r x y : ℝ) : ℝ := r * (baUx h x y * baVy h x y - baUy h x y * baVx h x y) /-- Squared Frobenius norm `‖DF_r(x, y)‖_F² = u_x² + u_y² + r² (v_x² + v_y²)`. -/ def baJacFrobSq (h : ℝ → ℝ) (r x y : ℝ) : ℝ := baUx h x y ^ 2 + baUy h x y ^ 2 + r ^ 2 * (baVx h x y ^ 2 + baVy h x y ^ 2) /-- Exact maximal dilatation `K(J) = (‖J‖_F² + √(‖J‖_F⁴ - 4 (det J)²)) / (2 det J)` of an orientation-preserving `2 × 2` Jacobian `J` (equivalently `(|f_z| + |f_z̄|) / (|f_z| - |f_z̄|)`). -/ def matDilatation (frobSq det : ℝ) : ℝ := (frobSq + Real.sqrt (frobSq ^ 2 - 4 * det ^ 2)) / (2 * det) /-- Pointwise maximal dilatation `K(DF_r[h](x, y))` of the Beurling–Ahlfors extension. -/ def baDilatation (h : ℝ → ℝ) (r x y : ℝ) : ℝ := matDilatation (baJacFrobSq h r x y) (baJacDet h r x y) /-- Normalized Beurling–Ahlfors dilatation quotient `Q(ξ, a, b, r) = K + 1/K`. -/ def baQ (ξ a b r : ℝ) : ℝ := ((ξ + 1) ^ 2 + (ξ * a - b) ^ 2 + r ^ 2 * ((ξ - 1) ^ 2 + (ξ * a + b) ^ 2)) / (2 * r * ξ * (a + b)) /-- Helper: `baQ` expressed in terms of `A = (ξ+1)² + (ξa-b)²` and `B = (ξ-1)² + (ξa+b)²`. -/ lemma baQ_eq_div (ξ a b r : ℝ) : baQ ξ a b r = ((ξ + 1) ^ 2 + (ξ * a - b) ^ 2 + r ^ 2 * ((ξ - 1) ^ 2 + (ξ * a + b) ^ 2)) / (2 * r * ξ * (a + b)) := rfl /-- Exact symmetry `Q(1/ξ, b, a, r) = Q(ξ, a, b, r)` for `ξ ≠ 0`. -/ theorem baQ_inv_symm {ξ a b r : ℝ} (hξ : ξ ≠ 0) : baQ (1 / ξ) b a r = baQ ξ a b r := by unfold baQ field_simp [hξ] ring /-- Exact formula for `baA` in terms of the renormalized function `g(t) = renorm h x y t`. -/ lemma baA_eq_renorm {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : baA h x y = 1 - (∫ t in (0 : ℝ)..1, renorm h x y t) / baXi h x y := by unfold baA baXi renorm have hAm : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have hAp : 0 < h (x + y) - h x := sub_pos.mpr (hh.strictMono (by linarith)) have hsub : ∫ t in (0 : ℝ)..1, (h (x + t * y) - h x) = y⁻¹ * ∫ s in x..(x + y), (h s - h x) := by have hcomp := intervalIntegral.integral_comp_mul_right (fun u => h (x + u) - h x) (ne_of_gt hy) (a := (0 : ℝ)) (b := 1) have hcomp2 := intervalIntegral.integral_comp_add_left (fun s => h s - h x) x (a := (0 : ℝ)) (b := y) simp only [zero_mul, one_mul, add_zero, smul_eq_mul] at hcomp hcomp2 rw [hcomp, hcomp2] rw [intervalIntegral.integral_div, hsub] have hAm_ne : h x - h (x - y) ≠ 0 := ne_of_gt hAm have hAp_ne : h (x + y) - h x ≠ 0 := ne_of_gt hAp have hy_ne : y ≠ 0 := ne_of_gt hy field_simp [hAm_ne, hAp_ne, hy_ne] /-- Exact formula for `baB` in terms of the renormalized function `g(t) = renorm h x y t`. -/ lemma baB_eq_renorm {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : baB h x y = 1 - ∫ t in (-1 : ℝ)..0, (-renorm h x y t) := by unfold baB renorm have hAm : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have hsub : ∫ t in (-1 : ℝ)..0, (h x - h (x + t * y)) = y⁻¹ * ∫ s in (x - y)..x, (h x - h s) := by have hcomp := intervalIntegral.integral_comp_mul_right (fun u => h x - h (x + u)) (ne_of_gt hy) (a := (-1 : ℝ)) (b := 0) have hcomp2 := intervalIntegral.integral_comp_add_left (fun s => h x - h s) x (a := (-y)) (b := 0) simp only [zero_mul, neg_mul, one_mul, add_zero, smul_eq_mul] at hcomp hcomp2 have hxy : x + -y = x - y := by ring rw [hxy] at hcomp2 rw [hcomp, hcomp2] have hneg : ∫ t in (-1 : ℝ)..0, -((h (x + t * y) - h x) / (h x - h (x - y))) = (∫ t in (-1 : ℝ)..0, (h x - h (x + t * y))) / (h x - h (x - y)) := by rw [← intervalIntegral.integral_div] congr 1; ext t; ring rw [hneg, hsub] have hAm_ne : h x - h (x - y) ≠ 0 := ne_of_gt hAm have hy_ne : y ≠ 0 := ne_of_gt hy field_simp [hAm_ne, hy_ne] /-- Exact expression of the 4 partial derivatives `(baUx, baUy, baVx, baVy)` in terms of `A₋ = h(x) - h(x - y)`, `ξ = baXi`, `a = baA`, `b = baB`. -/ lemma baPartials_eq {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : let Am := h x - h (x - y) let ξ := baXi h x y let a := baA h x y let b := baB h x y baUx h x y = (Am / (2 * y)) * (ξ + 1) ∧ baVx h x y = (Am / (2 * y)) * (ξ - 1) ∧ baUy h x y = (Am / (2 * y)) * (ξ * a - b) ∧ baVy h x y = (Am / (2 * y)) * (ξ * a + b) := by intro Am ξ a b have hAm : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have hAp : 0 < h (x + y) - h x := sub_pos.mpr (hh.strictMono (by linarith)) have hAm_ne : h x - h (x - y) ≠ 0 := ne_of_gt hAm have hAp_ne : h (x + y) - h x ≠ 0 := ne_of_gt hAp have hy_ne : y ≠ 0 := ne_of_gt hy have hξ_mul : Am * ξ = h (x + y) - h x := by dsimp only [Am, ξ, baXi]; field_simp [hAm_ne] have hIntR : ∫ s in x..(x + y), (h s - h x) = (∫ s in x..(x + y), h s) - y * h x := by rw [intervalIntegral.integral_sub (hh.continuous.intervalIntegrable _ _) (continuous_const.intervalIntegrable _ _)] simp only [intervalIntegral.integral_const, smul_eq_mul] ring have hIntL : ∫ s in (x - y)..x, (h x - h s) = y * h x - ∫ s in (x - y)..x, h s := by rw [intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) (hh.continuous.intervalIntegrable _ _)] simp only [intervalIntegral.integral_const, smul_eq_mul] ring have hIntTot : ∫ s in (x - y)..(x + y), h s = (∫ s in (x - y)..x, h s) + (∫ s in x..(x + y), h s) := (intervalIntegral.integral_add_adjacent_intervals (hh.continuous.intervalIntegrable _ _) (hh.continuous.intervalIntegrable _ _)).symm have hξa : Am * (ξ * a) = (h (x + y) - h x) - (1 / y) * ((∫ s in x..(x + y), h s) - y * h x) := by have : Am * (ξ * a) = (Am * ξ) * a := by ring rw [this, hξ_mul] dsimp only [a, baA] rw [hIntR] field_simp [hAp_ne, hy_ne] have hb_mul : Am * b = (h x - h (x - y)) - (1 / y) * (y * h x - ∫ s in (x - y)..x, h s) := by dsimp only [Am, b, baB] rw [hIntL] field_simp [hAm_ne, hy_ne] refine ⟨?_, ?_, ?_, ?_⟩ · unfold baUx have : Am * (ξ + 1) = h (x + y) - h (x - y) := by have : Am * (ξ + 1) = Am * ξ + Am := by ring rw [this, hξ_mul]; dsimp only [Am]; ring rw [div_mul_eq_mul_div, this] · unfold baVx have : Am * (ξ - 1) = h (x + y) + h (x - y) - 2 * h x := by have : Am * (ξ - 1) = Am * ξ - Am := by ring rw [this, hξ_mul]; dsimp only [Am]; ring rw [div_mul_eq_mul_div, this] · unfold baUy rw [hIntTot] have hdiff : Am * (ξ * a - b) = Am * (ξ * a) - Am * b := by ring symm rw [div_mul_eq_mul_div, hdiff, hξa, hb_mul] field_simp [hy_ne] ring · unfold baVy have hsum : Am * (ξ * a + b) = Am * (ξ * a) + Am * b := by ring symm rw [div_mul_eq_mul_div, hsum, hξa, hb_mul] field_simp [hy_ne] ring /-- Exact Jacobian determinant identity in terms of `(ξ, a, b)`. -/ theorem baJacDet_eq {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (r x y : ℝ) (hy : 0 < y) : baJacDet h r x y = ((h x - h (x - y)) / (2 * y)) ^ 2 * (2 * r * baXi h x y * (baA h x y + baB h x y)) := by rcases baPartials_eq hh x y hy with ⟨hux, hvx, huy, hvy⟩ unfold baJacDet rw [hux, hvx, huy, hvy] ring /-- Exact Frobenius norm squared identity in terms of `(ξ, a, b)`. -/ theorem baJacFrobSq_eq {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (r x y : ℝ) (hy : 0 < y) : baJacFrobSq h r x y = ((h x - h (x - y)) / (2 * y)) ^ 2 * ((baXi h x y + 1) ^ 2 + (baXi h x y * baA h x y - baB h x y) ^ 2 + r ^ 2 * ((baXi h x y - 1) ^ 2 + (baXi h x y * baA h x y + baB h x y) ^ 2)) := by rcases baPartials_eq hh x y hy with ⟨hux, hvx, huy, hvy⟩ unfold baJacFrobSq rw [hux, hvx, huy, hvy] ring /-- Exact algebraic inequality `2 det ≤ ‖J‖_F²` for any real `2 × 2` matrix. -/ lemma two_mul_det_le_frobSq (ux uy vx vy r : ℝ) : 2 * (r * (ux * vy - uy * vx)) ≤ ux ^ 2 + uy ^ 2 + r ^ 2 * (vx ^ 2 + vy ^ 2) := by have h : 0 ≤ (ux - r * vy) ^ 2 + (uy + r * vx) ^ 2 := by positivity nlinarith /-- For any positive `det` and `frobSq ≥ 2 det`, `K = matDilatation frobSq det` satisfies `1 ≤ K` and `K + K⁻¹ = frobSq / det`. -/ lemma matDilatation_ge_one {frobSq det : ℝ} (hdet : 0 < det) (hge : 2 * det ≤ frobSq) : 1 ≤ matDilatation frobSq det := by unfold matDilatation have hsq : 0 ≤ Real.sqrt (frobSq ^ 2 - 4 * det ^ 2) := Real.sqrt_nonneg _ rw [one_le_div (by positivity)] linarith lemma matDilatation_add_inv {frobSq det : ℝ} (hdet : 0 < det) (hge : 2 * det ≤ frobSq) : matDilatation frobSq det + (matDilatation frobSq det)⁻¹ = frobSq / det := by have hK1 : 1 ≤ matDilatation frobSq det := matDilatation_ge_one hdet hge have hKpos : 0 < matDilatation frobSq det := by linarith have hdisc : 0 ≤ frobSq ^ 2 - 4 * det ^ 2 := by nlinarith set s := Real.sqrt (frobSq ^ 2 - 4 * det ^ 2) have hs2 : s ^ 2 = frobSq ^ 2 - 4 * det ^ 2 := Real.sq_sqrt hdisc have hmul : (frobSq + s) * (frobSq - s) = 4 * det ^ 2 := by nlinarith have hK : matDilatation frobSq det = (frobSq + s) / (2 * det) := rfl have hfp : frobSq + s ≠ 0 := by have : 0 < frobSq + s := by linarith [Real.sqrt_nonneg (frobSq ^ 2 - 4 * det ^ 2)] exact ne_of_gt this have hdet_ne : det ≠ 0 := ne_of_gt hdet rw [hK] field_simp [hfp, hdet_ne] nlinarith /-- Monotonicity bridge: if `K ≥ 1` and `K + K⁻¹ ≤ Q` (with `2 ≤ Q`), then `K ≤ (Q + √(Q² - 4)) / 2`. -/ lemma le_of_add_inv_le {K Q : ℝ} (hK : 1 ≤ K) (hQ : K + K⁻¹ ≤ Q) : K ≤ (Q + Real.sqrt (Q ^ 2 - 4)) / 2 := by have hKpos : 0 < K := by linarith have hQ2 : 2 ≤ Q := by have : 0 ≤ (K - 1) ^ 2 / K := by positivity have h2 : 2 ≤ K + K⁻¹ := by have : K + K⁻¹ - 2 = (K - 1) ^ 2 / K := by field_simp [ne_of_gt hKpos]; ring linarith linarith have hdisc : 0 ≤ Q ^ 2 - 4 := by nlinarith have hquad : (2 * K - Q) ^ 2 ≤ Q ^ 2 - 4 := by have h1 : K ^ 2 + 1 ≤ Q * K := by have := mul_le_mul_of_nonneg_right hQ (le_of_lt hKpos) rw [add_mul, inv_mul_cancel₀ (ne_of_gt hKpos)] at this nlinarith nlinarith have hsqrt : 2 * K - Q ≤ Real.sqrt (Q ^ 2 - 4) := by by_cases hsign : 2 * K - Q ≤ 0 · linarith [Real.sqrt_nonneg (Q ^ 2 - 4)] · push Not at hsign have := Real.sqrt_le_sqrt hquad rwa [Real.sqrt_sq (le_of_lt hsign)] at this linarith /-! ## 4. Integral Inequalities for `M`-Quasisymmetric Functions -/ /-- Exact symmetry ratio bounds `1 / M ≤ ξ ≤ M`. -/ theorem qs_xi_bounds {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : 1 / M ≤ baXi h x y ∧ baXi h x y ≤ M := by unfold baXi have hAm : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have hM : 0 < M := hh.pos_M have hr := hh.right_le x y hy have hl := hh.left_le x y hy constructor · rw [div_le_div_iff₀ hM hAm]; linarith · rw [div_le_iff₀ hAm]; exact hr /-- **Core Unit-Interval Integral Bound (Beurling–Ahlfors 1956)**: For any `M`-quasisymmetric function `g : ℝ → ℝ` with `g 0 = 0` and `g 1 = c > 0`, `c / (M + 1) ≤ ∫ t in 0..1, g t ≤ M * c / (M + 1)`. -/ theorem qs_unit_integral_bounds {M : ℝ} {g : ℝ → ℝ} (hg : IsQuasisymmetric M g) (hg0 : g 0 = 0) : g 1 / (M + 1) ≤ (∫ t in (0 : ℝ)..1, g t) ∧ (∫ t in (0 : ℝ)..1, g t) ≤ M * g 1 / (M + 1) := by have hM : 0 < M := hg.pos_M have hM1 : 0 < M + 1 := by linarith set I := ∫ t in (0 : ℝ)..1, g t set I₁ := ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g t set I₂ := ∫ t in (1 / 2 : ℝ)..1, g t have hI_split : I = I₁ + I₂ := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm -- Change of variables: ∫_0^{1/2} g(2t) dt = I / 2 have hscale : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (2 * t) = I / 2 := by have hc := intervalIntegral.integral_comp_mul_left g (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := (1 / 2 : ℝ)) simp only [mul_zero, smul_eq_mul] at hc have h2 : (2 : ℝ) * (1 / 2 : ℝ) = 1 := by norm_num rw [h2] at hc linarith -- Change of variables: ∫_0^{1/2} g(1 - t) dt = I₂ have hrefl1 : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (1 - t) = I₂ := by rw [intervalIntegral.integral_comp_sub_left g (1 : ℝ)] have h1 : (1 : ℝ) - 1 / 2 = 1 / 2 := by norm_num have h2 : (1 : ℝ) - 0 = 1 := by norm_num rw [h1, h2] -- Change of variables: ∫_0^{1/2} g(1 - 2t) dt = I / 2 have hrefl2 : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (1 - 2 * t) = I / 2 := by have hc1 := intervalIntegral.integral_comp_mul_left (fun u => g (1 - u)) (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := (1 / 2 : ℝ)) simp only [mul_zero, smul_eq_mul] at hc1 have h2 : (2 : ℝ) * (1 / 2 : ℝ) = 1 := by norm_num rw [h2, intervalIntegral.integral_comp_sub_left g (1 : ℝ)] at hc1 have h3 : (1 : ℝ) - 1 = 0 := by norm_num have h4 : (1 : ℝ) - 0 = 1 := by norm_num rw [h3, h4] at hc1 linarith -- Integrability helpers have hint_g : IntervalIntegrable g volume 0 (1 / 2 : ℝ) := hg.continuous.intervalIntegrable _ _ have hint_g2 : IntervalIntegrable (fun t => g (2 * t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.mul continuous_id)).intervalIntegrable _ _ have hint_r1 : IntervalIntegrable (fun t => g (1 - t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.sub continuous_id)).intervalIntegrable _ _ have hint_r2 : IntervalIntegrable (fun t => g (1 - 2 * t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.sub (continuous_const.mul continuous_id))).intervalIntegrable _ _ -- (A) From triple (0, t, 2t) for t ∈ [0, 1/2]: -- g(2t) - g(t) ≤ M * g(t) and g(t) ≤ M * (g(2t) - g(t)) have hA1 : I / 2 - I₁ ≤ M * I₁ := by have hpt : ∀ t ∈ uIcc (0 : ℝ) (1 / 2 : ℝ), g (2 * t) - g t ≤ M * g t := by intro t ht rw [uIcc_of_le (by norm_num : (0 : ℝ) ≤ 1 / 2)] at ht have h := hg.right_le_nonneg t t ht.1 have h1 : t + t = 2 * t := by ring have h2 : t - t = 0 := by ring rw [h1, h2, hg0, sub_zero] at h exact h have hint := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) (hint_g2.sub hint_g) (hint_g.const_mul M) (fun t ht => hpt t (by rwa [uIcc_of_le (by norm_num)])) rw [intervalIntegral.integral_sub hint_g2 hint_g, intervalIntegral.integral_const_mul, hscale] at hint exact hint have hA2 : I₁ ≤ M * (I / 2 - I₁) := by have hpt : ∀ t ∈ uIcc (0 : ℝ) (1 / 2 : ℝ), g t ≤ M * (g (2 * t) - g t) := by intro t ht rw [uIcc_of_le (by norm_num : (0 : ℝ) ≤ 1 / 2)] at ht have h := hg.left_le_nonneg t t ht.1 have h1 : t + t = 2 * t := by ring have h2 : t - t = 0 := by ring rw [h1, h2, hg0, sub_zero] at h exact h have hint := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) hint_g ((hint_g2.sub hint_g).const_mul M) (fun t ht => hpt t (by rwa [uIcc_of_le (by norm_num)])) rw [intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hint_g2 hint_g, hscale] at hint exact hint -- (B) From triple (1 - 2t, 1 - t, 1) for t ∈ [0, 1/2]: -- g(1) - g(1 - t) ≤ M * (g(1 - t) - g(1 - 2t)) and reverse have hB1 : g 1 / 2 - I₂ ≤ M * (I₂ - I / 2) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g 1 - g (1 - t) ≤ M * (g (1 - t) - g (1 - 2 * t)) := by intro t ht have h := hg.right_le_nonneg (1 - t) t ht.1 have h1 : (1 - t) + t = 1 := by ring have h2 : (1 - t) - t = 1 - 2 * t := by ring rw [h1, h2] at h exact h have hint := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) ((continuous_const.intervalIntegrable _ _).sub hint_r1) ((hint_r1.sub hint_r2).const_mul M) hpt rw [intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hint_r1, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hint_r1 hint_r2, intervalIntegral.integral_const, hrefl1, hrefl2] at hint simp only [sub_zero, smul_eq_mul] at hint linarith have hB2 : I₂ - I / 2 ≤ M * (g 1 / 2 - I₂) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g (1 - t) - g (1 - 2 * t) ≤ M * (g 1 - g (1 - t)) := by intro t ht have h := hg.left_le_nonneg (1 - t) t ht.1 have h1 : (1 - t) + t = 1 := by ring have h2 : (1 - t) - t = 1 - 2 * t := by ring rw [h1, h2] at h exact h have hint := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) (hint_r1.sub hint_r2) (((continuous_const.intervalIntegrable _ _).sub hint_r1).const_mul M) hpt rw [intervalIntegral.integral_sub hint_r1 hint_r2, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hint_r1, intervalIntegral.integral_const, hrefl1, hrefl2] at hint simp only [sub_zero, smul_eq_mul] at hint linarith -- Combine hA1, hB2 for lower bound and hA2, hB1 for upper bound: constructor · rw [div_le_iff₀ hM1] nlinarith · rw [le_div_iff₀ hM1] nlinarith /-- Classical box bounds `1 / (M + 1) ≤ a ≤ M / (M + 1)` for `baA`. -/ theorem qs_a_bounds {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : 1 / (M + 1) ≤ baA h x y ∧ baA h x y ≤ M / (M + 1) := by have hg := hh.renorm x y hy have hg0 : renorm h x y 0 = 0 := renorm_zero h x y have hξ_eq : renorm h x y 1 = baXi h x y := by simp [renorm, baXi] have hξ_pos : 0 < baXi h x y := by unfold baXi exact div_pos (sub_pos.mpr (hh.strictMono (by linarith))) (sub_pos.mpr (hh.strictMono (by linarith))) have hM1 : 0 < M + 1 := by linarith [hh.one_le] rcases qs_unit_integral_bounds hg hg0 with ⟨hlo, hhi⟩ rw [hξ_eq] at hlo hhi rw [baA_eq_renorm hh x y hy] constructor · have h1 : (∫ t in (0 : ℝ)..1, renorm h x y t) / baXi h x y ≤ M / (M + 1) := by rw [div_le_iff₀ hξ_pos] calc ∫ t in (0 : ℝ)..1, renorm h x y t ≤ M * baXi h x y / (M + 1) := hhi _ = M / (M + 1) * baXi h x y := by ring have : 1 - M / (M + 1) = 1 / (M + 1) := by field_simp [ne_of_gt hM1]; ring linarith · have h1 : 1 / (M + 1) ≤ (∫ t in (0 : ℝ)..1, renorm h x y t) / baXi h x y := by rw [le_div_iff₀ hξ_pos] calc 1 / (M + 1) * baXi h x y = baXi h x y / (M + 1) := by ring _ ≤ ∫ t in (0 : ℝ)..1, renorm h x y t := hlo have : 1 - 1 / (M + 1) = M / (M + 1) := by field_simp [ne_of_gt hM1]; ring linarith /-- Mirror of `h`: `t ↦ -g(-t)` is also `M`-quasisymmetric. -/ lemma IsQuasisymmetric.neg_comp_neg {M : ℝ} {g : ℝ → ℝ} (hg : IsQuasisymmetric M g) : IsQuasisymmetric M (fun t => -g (-t)) := by refine ⟨hg.one_le, ?_, ?_, ?_, ?_⟩ · exact (hg.continuous.comp continuous_neg).neg · intro s₁ s₂ hs exact neg_lt_neg (hg.strictMono (neg_lt_neg hs)) · intro u t ht have h := hg.left_le (-u) t ht have h1 : -(u + t) = -u - t := by ring have h2 : -(u - t) = -u + t := by ring rw [h1, h2] linarith · intro u t ht have h := hg.right_le (-u) t ht have h1 : -(u + t) = -u - t := by ring have h2 : -(u - t) = -u + t := by ring rw [h1, h2] linarith /-- Classical box bounds `1 / (M + 1) ≤ b ≤ M / (M + 1)` for `baB`. -/ theorem qs_b_bounds {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : 1 / (M + 1) ≤ baB h x y ∧ baB h x y ≤ M / (M + 1) := by have hg := (hh.renorm x y hy).neg_comp_neg have hg0 : -renorm h x y (-0) = 0 := by simp [renorm_zero] have hg1 : -renorm h x y (-1) = 1 := by rw [renorm_neg_one hh x y hy]; ring have hM1 : 0 < M + 1 := by linarith [hh.one_le] rcases qs_unit_integral_bounds hg hg0 with ⟨hlo, hhi⟩ rw [hg1] at hlo hhi have hrefl : ∫ t in (0 : ℝ)..1, (-renorm h x y (-t)) = ∫ t in (-1 : ℝ)..0, (-renorm h x y t) := by rw [intervalIntegral.integral_comp_neg (fun u => -renorm h x y u)] simp rw [hrefl] at hlo hhi rw [baB_eq_renorm hh x y hy] constructor · have : 1 - M * 1 / (M + 1) = 1 / (M + 1) := by field_simp [ne_of_gt hM1]; ring linarith · have : 1 - 1 / (M + 1) = M / (M + 1) := by field_simp [ne_of_gt hM1]; ring linarith /-- **Strict Jacobian Positivity**: for every `M`-quasisymmetric `h` and `r > 0`, `det DF_r[h](x, y) > 0` everywhere on `ℍ`. -/ theorem baJacDet_pos {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) {r x y : ℝ} (hr : 0 < r) (hy : 0 < y) : 0 < baJacDet h r x y := by rw [baJacDet_eq hh r x y hy] have hAm : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have hM := hh.pos_M have hM1 : 0 < M + 1 := by linarith [hh.one_le] have hξ : 0 < baXi h x y := lt_of_lt_of_le (by positivity) (qs_xi_bounds hh x y hy).1 have ha : 0 < baA h x y := lt_of_lt_of_le (by positivity) (qs_a_bounds hh x y hy).1 have hb : 0 < baB h x y := lt_of_lt_of_le (by positivity) (qs_b_bounds hh x y hy).1 positivity /-- **Exact Pointwise Dilatation Identity**: `K(DF_r[h](x, y)) + K(DF_r[h](x, y))⁻¹ = baQ (baXi h x y) (baA h x y) (baB h x y) r`. -/ theorem baDilatation_add_inv_eq {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) {r x y : ℝ} (hr : 0 < r) (hy : 0 < y) : baDilatation h r x y + (baDilatation h r x y)⁻¹ = baQ (baXi h x y) (baA h x y) (baB h x y) r := by have hdet : 0 < baJacDet h r x y := baJacDet_pos hh hr hy have hge : 2 * baJacDet h r x y ≤ baJacFrobSq h r x y := two_mul_det_le_frobSq (baUx h x y) (baUy h x y) (baVx h x y) (baVy h x y) r unfold baDilatation rw [matDilatation_add_inv hdet hge, baJacFrobSq_eq hh r x y hy, baJacDet_eq hh r x y hy] have hAm : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have hscale : ((h x - h (x - y)) / (2 * y)) ^ 2 ≠ 0 := by positivity unfold baQ exact mul_div_mul_left _ _ hscale theorem baDilatation_ge_one {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) {r x y : ℝ} (hr : 0 < r) (hy : 0 < y) : 1 ≤ baDilatation h r x y := matDilatation_ge_one (baJacDet_pos hh hr hy) (two_mul_det_le_frobSq (baUx h x y) (baUy h x y) (baVx h x y) (baVy h x y) r) /-- **Coupled Integral Inequality (Right)**: integrating the `M`-quasisymmetric triple `(-1, -t, 1 - 2t)` over `t ∈ [0, 1]` gives `ξ · a + (2M + 1) · b ≥ ξ + 1`. -/ theorem qs_coupled_ineq_right {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : baXi h x y + 1 ≤ baXi h x y * baA h x y + (2 * M + 1) * baB h x y := by set g := renorm h x y have hg : IsQuasisymmetric M g := hh.renorm x y hy have hg1 : g 1 = baXi h x y := by simp [g, renorm, baXi] have hgm1 : g (-1) = -1 := renorm_neg_one hh x y hy have hξ_pos : 0 < baXi h x y := lt_of_lt_of_le (by positivity [hh.pos_M]) (qs_xi_bounds hh x y hy).1 set Ip := ∫ t in (0 : ℝ)..1, g t set Im := ∫ t in (-1 : ℝ)..0, (-g t) have hIp_eq : Ip = baXi h x y * (1 - baA h x y) := by rw [baA_eq_renorm hh x y hy] field_simp [ne_of_gt hξ_pos] ring have hIm_eq : Im = 1 - baB h x y := by rw [baB_eq_renorm hh x y hy] ring -- Change of variables: ∫_0^1 g(1 - 2t) dt = (Ip - Im) / 2 have hcomp1 : ∫ t in (0 : ℝ)..1, g (1 - 2 * t) = (Ip - Im) / 2 := by have hc1 := intervalIntegral.integral_comp_mul_left (fun u => g (1 - u)) (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := 1) simp only [mul_zero, mul_one, smul_eq_mul] at hc1 rw [intervalIntegral.integral_comp_sub_left g (1 : ℝ)] at hc1 have h1 : (1 : ℝ) - 2 = -1 := by norm_num have h2 : (1 : ℝ) - 0 = 1 := by norm_num rw [h1, h2] at hc1 have hadj : (∫ u in (-1 : ℝ)..1, g u) = (∫ u in (-1 : ℝ)..0, g u) + (∫ u in (0 : ℝ)..1, g u) := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm have hneg : (∫ u in (-1 : ℝ)..0, g u) = -Im := by simp only [Im, intervalIntegral.integral_neg, neg_neg] linarith -- Change of variables: ∫_0^1 g(-t) dt = -Im have hcomp2 : ∫ t in (0 : ℝ)..1, g (-t) = -Im := by have hc := intervalIntegral.integral_comp_neg g (a := (0 : ℝ)) (b := 1) simp only [neg_zero] at hc rw [hc] simp only [Im, intervalIntegral.integral_neg, neg_neg] -- Pointwise M-QS on (-1, -t, 1 - 2t) for t ∈ [0, 1] (step 1 - t ≥ 0): -- g(1 - 2t) - g(-t) ≤ M * (g(-t) - g(-1)) = M * (g(-t) + 1) have hpt : ∀ t ∈ Icc (0 : ℝ) 1, g (1 - 2 * t) - g (-t) ≤ M * (g (-t) + 1) := by intro t ht have h := hg.right_le_nonneg (-t) (1 - t) (by linarith [ht.2]) have h1 : -t + (1 - t) = 1 - 2 * t := by ring have h2 : -t - (1 - t) = -1 := by ring rw [h1, h2, hgm1] at h linarith have hint1 : IntervalIntegrable (fun t => g (1 - 2 * t)) volume 0 1 := (hg.continuous.comp (continuous_const.sub (continuous_const.mul continuous_id))).intervalIntegrable _ _ have hint2 : IntervalIntegrable (fun t => g (-t)) volume 0 1 := (hg.continuous.comp continuous_neg).intervalIntegrable _ _ have hint := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1) (hint1.sub hint2) ((hint2.add (continuous_const.intervalIntegrable _ _)).const_mul M) hpt rw [intervalIntegral.integral_sub hint1 hint2, intervalIntegral.integral_const_mul, intervalIntegral.integral_add hint2 (continuous_const.intervalIntegrable _ _), intervalIntegral.integral_const, hcomp1, hcomp2] at hint simp only [sub_zero, smul_eq_mul, mul_one] at hint rw [hIp_eq, hIm_eq] at hint linarith /-- **Coupled Integral Inequality (Left)**: integrating the `M`-quasisymmetric triple `(2t - 1, t, 1)` over `t ∈ [0, 1]` gives `(2M + 1) · ξ · a + b ≥ ξ + 1`. -/ theorem qs_coupled_ineq_left {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : baXi h x y + 1 ≤ (2 * M + 1) * baXi h x y * baA h x y + baB h x y := by set g := renorm h x y have hg : IsQuasisymmetric M g := hh.renorm x y hy have hg1 : g 1 = baXi h x y := by simp [g, renorm, baXi] have hξ_pos : 0 < baXi h x y := lt_of_lt_of_le (by positivity [hh.pos_M]) (qs_xi_bounds hh x y hy).1 set Ip := ∫ t in (0 : ℝ)..1, g t set Im := ∫ t in (-1 : ℝ)..0, (-g t) have hIp_eq : Ip = baXi h x y * (1 - baA h x y) := by rw [baA_eq_renorm hh x y hy] field_simp [ne_of_gt hξ_pos] ring have hIm_eq : Im = 1 - baB h x y := by rw [baB_eq_renorm hh x y hy] ring -- Change of variables: ∫_0^1 g(2t - 1) dt = (Ip - Im) / 2 have hcomp1 : ∫ t in (0 : ℝ)..1, g (2 * t - 1) = (Ip - Im) / 2 := by have hc1 := intervalIntegral.integral_comp_mul_left (fun u => g (u - 1)) (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := 1) simp only [mul_zero, mul_one, smul_eq_mul] at hc1 rw [intervalIntegral.integral_comp_sub_right g (1 : ℝ)] at hc1 have h1 : (0 : ℝ) - 1 = -1 := by norm_num have h2 : (2 : ℝ) - 1 = 1 := by norm_num rw [h1, h2] at hc1 have hadj : (∫ u in (-1 : ℝ)..1, g u) = (∫ u in (-1 : ℝ)..0, g u) + (∫ u in (0 : ℝ)..1, g u) := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm have hneg : (∫ u in (-1 : ℝ)..0, g u) = -Im := by simp only [Im, intervalIntegral.integral_neg, neg_neg] linarith -- Pointwise M-QS on (2t - 1, t, 1) for t ∈ [0, 1] (step 1 - t ≥ 0): -- g(t) - g(2t - 1) ≤ M * (g(1) - g(t)) have hpt : ∀ t ∈ Icc (0 : ℝ) 1, g t - g (2 * t - 1) ≤ M * (baXi h x y - g t) := by intro t ht have h := hg.left_le_nonneg t (1 - t) (by linarith [ht.2]) have h1 : t + (1 - t) = 1 := by ring have h2 : t - (1 - t) = 2 * t - 1 := by ring rw [h1, h2, hg1] at h exact h have hint1 : IntervalIntegrable g volume 0 1 := hg.continuous.intervalIntegrable _ _ have hint2 : IntervalIntegrable (fun t => g (2 * t - 1)) volume 0 1 := (hg.continuous.comp ((continuous_const.mul continuous_id).sub continuous_const)).intervalIntegrable _ _ have hint := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1) (hint1.sub hint2) (((continuous_const.intervalIntegrable _ _).sub hint1).const_mul M) hpt rw [intervalIntegral.integral_sub hint1 hint2, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hint1, intervalIntegral.integral_const, hcomp1] at hint simp only [sub_zero, smul_eq_mul, one_mul] at hint have hIp' : (∫ t in (0 : ℝ)..1, g t) = Ip := rfl rw [hIp', hIp_eq, hIm_eq] at hint linarith /-! ## 5. The Two New 4-Line `[-2, 2]` Second-Order Integral Inequalities -/ /-- **New Second-Order Lower Bound on `b`** (4-line `[-2, 2]` dual certificate): For every `M`-quasisymmetric `h : ℝ → ℝ` and every `(x, y) ∈ ℍ`, `M (M³ + 5 M² + 8 M + 2) · b ≥ M² (M + 3) + 2 (M + 1) · ξ`. -/ theorem qs_second_order_b_lower {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : M ^ 2 * (M + 3) + 2 * (M + 1) * baXi h x y ≤ M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) * baB h x y := by set g := renorm h x y have hg : IsQuasisymmetric M g := hh.renorm x y hy have hg0 : g 0 = 0 := renorm_zero h x y have hg1 : g 1 = baXi h x y := by simp [g, renorm, baXi] have hgm1 : g (-1) = -1 := renorm_neg_one hh x y hy have hM1_le : 1 ≤ M := hh.one_le set Jm4 := ∫ t in (-2 : ℝ)..(-3 / 2 : ℝ), g t set Jm3 := ∫ t in (-3 / 2 : ℝ)..(-1 : ℝ), g t set Jm2 := ∫ t in (-1 : ℝ)..(-1 / 2 : ℝ), g t set Jm1 := ∫ t in (-1 / 2 : ℝ)..0, g t have hb_eq : baB h x y = 1 + Jm2 + Jm1 := by rw [baB_eq_renorm hh x y hy] have hadj : (∫ t in (-1 : ℝ)..0, g t) = Jm2 + Jm1 := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm have hneg : (∫ t in (-1 : ℝ)..0, -g t) = -(∫ t in (-1 : ℝ)..0, g t) := intervalIntegral.integral_neg linarith have hcv_m1_sub : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (-1 - t) = Jm3 := by rw [intervalIntegral.integral_comp_sub_left g (-1 : ℝ)] have h1 : (-1 : ℝ) - 1 / 2 = -3 / 2 := by norm_num have h2 : (-1 : ℝ) - 0 = -1 := by norm_num rw [h1, h2] have hcv_m1_add : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (-1 + t) = Jm2 := by rw [intervalIntegral.integral_comp_add_left g (-1 : ℝ)] have h1 : (-1 : ℝ) + 0 = -1 := by norm_num have h2 : (-1 : ℝ) + 1 / 2 = -1 / 2 := by norm_num rw [h1, h2] have hcv_m2_add : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (-2 + t) = Jm4 := by rw [intervalIntegral.integral_comp_add_left g (-2 : ℝ)] have h1 : (-2 : ℝ) + 0 = -2 := by norm_num have h2 : (-2 : ℝ) + 1 / 2 = -3 / 2 := by norm_num rw [h1, h2] have hcv_m32_add : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (-3 / 2 + t) = Jm3 := by rw [intervalIntegral.integral_comp_add_left g (-3 / 2 : ℝ)] have h1 : (-3 / 2 : ℝ) + 0 = -3 / 2 := by norm_num have h2 : (-3 / 2 : ℝ) + 1 / 2 = -1 := by norm_num rw [h1, h2] have hcv_neg : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (-t) = Jm1 := by rw [intervalIntegral.integral_comp_neg g] have h1 : -(1 / 2 : ℝ) = -1 / 2 := by norm_num have h2 : -(0 : ℝ) = 0 := by norm_num rw [h1, h2] have hcv_neg2 : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (-(2 * t)) = (Jm2 + Jm1) / 2 := by have hc := intervalIntegral.integral_comp_mul_left (fun u => g (-u)) (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := (1 / 2 : ℝ)) simp only [mul_zero, smul_eq_mul] at hc have h2 : (2 : ℝ) * (1 / 2 : ℝ) = 1 := by norm_num rw [h2, intervalIntegral.integral_comp_neg g] at hc simp only [neg_zero] at hc have hadj : (∫ u in (-1 : ℝ)..0, g u) = Jm2 + Jm1 := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm linarith have hcv_m1_2t : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (-1 - 2 * t) = (Jm4 + Jm3) / 2 := by have hc := intervalIntegral.integral_comp_mul_left (fun u => g (-1 - u)) (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := (1 / 2 : ℝ)) simp only [mul_zero, smul_eq_mul] at hc have h2 : (2 : ℝ) * (1 / 2 : ℝ) = 1 := by norm_num rw [h2, intervalIntegral.integral_comp_sub_left g (-1 : ℝ)] at hc have h3 : (-1 : ℝ) - 1 = -2 := by norm_num have h4 : (-1 : ℝ) - 0 = -1 := by norm_num rw [h3, h4] at hc have hadj : (∫ u in (-2 : ℝ)..(-1 : ℝ), g u) = Jm4 + Jm3 := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm linarith have hi_m1s : IntervalIntegrable (fun t => g (-1 - t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.sub continuous_id)).intervalIntegrable _ _ have hi_m1a : IntervalIntegrable (fun t => g (-1 + t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable _ _ have hi_m2a : IntervalIntegrable (fun t => g (-2 + t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable _ _ have hi_m32a : IntervalIntegrable (fun t => g (-3 / 2 + t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable _ _ have hi_neg : IntervalIntegrable (fun t => g (-t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp continuous_neg).intervalIntegrable _ _ have hi_neg2 : IntervalIntegrable (fun t => g (-(2 * t))) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.mul continuous_id).neg).intervalIntegrable _ _ have hi_m12t : IntervalIntegrable (fun t => g (-1 - 2 * t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.sub (continuous_const.mul continuous_id))).intervalIntegrable _ _ have hI1 : -1 / 2 - Jm3 ≤ M * (Jm2 + 1 / 2) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g (-1) - g (-1 - t) ≤ M * (g (-1 + t) - g (-1)) := fun t ht => hg.left_le_nonneg (-1) t ht.1 have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) ((continuous_const.intervalIntegrable _ _).sub hi_m1s) ((hi_m1a.sub (continuous_const.intervalIntegrable _ _)).const_mul M) hpt rw [intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hi_m1s, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_m1a (continuous_const.intervalIntegrable _ _), intervalIntegral.integral_const, hgm1, hcv_m1_sub, hcv_m1_add] at h simp only [sub_zero, smul_eq_mul] at h linarith have hI2 : Jm3 - Jm4 ≤ M * (Jm2 - Jm3) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g (-3 / 2 + t) - g (-2 + t) ≤ M * (g (-1 + t) - g (-3 / 2 + t)) := by intro t _ have h := hg.left_le (-3 / 2 + t) (1 / 2) (by norm_num) have h1 : (-3 / 2 + t) + 1 / 2 = -1 + t := by ring have h2 : (-3 / 2 + t) - 1 / 2 = -2 + t := by ring rw [h1, h2] at h; exact h have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) (hi_m32a.sub hi_m2a) ((hi_m1a.sub hi_m32a).const_mul M) hpt rw [intervalIntegral.integral_sub hi_m32a hi_m2a, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_m1a hi_m32a, hcv_m32_add, hcv_m2_add, hcv_m1_add] at h exact h have hI3 : -2 * Jm1 ≤ M * (Jm1 - Jm2) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g 0 - g (-t) ≤ M * (g (-t) - g (-(2 * t))) := by intro t ht have h := hg.right_le_nonneg (-t) t ht.1 have h1 : -t + t = 0 := by ring have h2 : -t - t = -(2 * t) := by ring rw [h1, h2] at h; exact h have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) ((continuous_const.intervalIntegrable _ _).sub hi_neg) ((hi_neg.sub hi_neg2).const_mul M) hpt rw [intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hi_neg, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_neg hi_neg2, intervalIntegral.integral_const, hg0, hcv_neg, hcv_neg2] at h simp only [sub_zero, smul_eq_mul, mul_zero] at h linarith have hI4 : baXi h x y - 2 * Jm1 ≤ M * (2 * Jm1 - Jm4 - Jm3) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g 1 - g (-t) ≤ M * (g (-t) - g (-1 - 2 * t)) := by intro t ht have h := hg.right_le_nonneg (-t) (1 + t) (by linarith [ht.1]) have h1 : -t + (1 + t) = 1 := by ring have h2 : -t - (1 + t) = -1 - 2 * t := by ring rw [h1, h2] at h; exact h have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) ((continuous_const.intervalIntegrable _ _).sub hi_neg) ((hi_neg.sub hi_m12t).const_mul M) hpt rw [intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hi_neg, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_neg hi_m12t, intervalIntegral.integral_const, hg1, hcv_neg, hcv_m1_2t] at h simp only [sub_zero, smul_eq_mul] at h linarith have hcomb : M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) * (1 + Jm2 + Jm1) - (M ^ 2 * (M + 3) + 2 * (M + 1) * baXi h x y) = 2 * (M + 1) * (M * (2 * Jm1 - Jm4 - Jm3) - (baXi h x y - 2 * Jm1)) + 2 * M * (M + 1) * (M * (Jm2 - Jm3) - (Jm3 - Jm4)) + 2 * M * (M + 1) * (M + 2) * (M * (Jm2 + 1 / 2) - (-1 / 2 - Jm3)) + (M ^ 3 + 3 * M ^ 2 - 2 * M - 2) * (M * (Jm1 - Jm2) - (-2 * Jm1)) := by ring have hc4 : 0 ≤ M ^ 3 + 3 * M ^ 2 - 2 * M - 2 := by set s := M - 1; have hs : 0 ≤ s := by linarith have : M ^ 3 + 3 * M ^ 2 - 2 * M - 2 = 7 * s + 6 * s ^ 2 + s ^ 3 := by dsimp only [s]; ring rw [this]; positivity rw [hb_eq] have h1' : 0 ≤ M * (2 * Jm1 - Jm4 - Jm3) - (baXi h x y - 2 * Jm1) := by linarith have h2' : 0 ≤ M * (Jm2 - Jm3) - (Jm3 - Jm4) := by linarith have h3' : 0 ≤ M * (Jm2 + 1 / 2) - (-1 / 2 - Jm3) := by linarith have h4' : 0 ≤ M * (Jm1 - Jm2) - (-2 * Jm1) := by linarith have hM0 : 0 ≤ M := by linarith have hnonneg : 0 ≤ M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) * (1 + Jm2 + Jm1) - (M ^ 2 * (M + 3) + 2 * (M + 1) * baXi h x y) := by rw [hcomb]; positivity linarith /-- **New Second-Order Upper Bound on `a`** (4-line `[-2, 2]` dual certificate): For every `M`-quasisymmetric `h : ℝ → ℝ` and every `(x, y) ∈ ℍ`, `(2 M³ + 6 M² + 7 M + 1) · ξ · a ≤ 2 M² (M + 1) · (ξ + 1)`. -/ theorem qs_second_order_a_upper {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * baXi h x y * baA h x y ≤ 2 * M ^ 2 * (M + 1) * (baXi h x y + 1) := by set g := renorm h x y have hg : IsQuasisymmetric M g := hh.renorm x y hy have hg1 : g 1 = baXi h x y := by simp [g, renorm, baXi] have hgm1 : g (-1) = -1 := renorm_neg_one hh x y hy have hM1_le : 1 ≤ M := hh.one_le have hM0_pos : 0 < M := hh.pos_M have hξ_pos : 0 < baXi h x y := lt_of_lt_of_le (by positivity) (qs_xi_bounds hh x y hy).1 set J0 := ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g t set J1 := ∫ t in (1 / 2 : ℝ)..1, g t set J2 := ∫ t in (1 : ℝ)..(3 / 2 : ℝ), g t set J3 := ∫ t in (3 / 2 : ℝ)..2, g t have hIp_eq : J0 + J1 = baXi h x y * (1 - baA h x y) := by have hadj : (∫ t in (0 : ℝ)..1, g t) = J0 + J1 := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm rw [baA_eq_renorm hh x y hy] have : ∫ t in (0 : ℝ)..1, renorm h x y t = J0 + J1 := hadj rw [this] field_simp [ne_of_gt hξ_pos] ring have hcv_1s : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (1 - t) = J1 := by rw [intervalIntegral.integral_comp_sub_left g (1 : ℝ)] have h1 : (1 : ℝ) - 1 / 2 = 1 / 2 := by norm_num have h2 : (1 : ℝ) - 0 = 1 := by norm_num rw [h1, h2] have hcv_12s : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (1 - 2 * t) = (J0 + J1) / 2 := by have hc := intervalIntegral.integral_comp_mul_left (fun u => g (1 - u)) (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := (1 / 2 : ℝ)) simp only [mul_zero, smul_eq_mul] at hc have h2 : (2 : ℝ) * (1 / 2 : ℝ) = 1 := by norm_num rw [h2, intervalIntegral.integral_comp_sub_left g (1 : ℝ)] at hc have h3 : (1 : ℝ) - 1 = 0 := by norm_num have h4 : (1 : ℝ) - 0 = 1 := by norm_num rw [h3, h4] at hc have hadj : (∫ u in (0 : ℝ)..1, g u) = J0 + J1 := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm linarith have hcv_1a : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (1 + t) = J2 := by rw [intervalIntegral.integral_comp_add_left g (1 : ℝ)] have h1 : (1 : ℝ) + 0 = 1 := by norm_num have h2 : (1 : ℝ) + 1 / 2 = 3 / 2 := by norm_num rw [h1, h2] have hcv_h2a : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (1 / 2 + t) = J1 := by rw [intervalIntegral.integral_comp_add_left g (1 / 2 : ℝ)] have h1 : (1 / 2 : ℝ) + 0 = 1 / 2 := by norm_num have h2 : (1 / 2 : ℝ) + 1 / 2 = 1 := by norm_num rw [h1, h2] have hcv_32a : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (3 / 2 + t) = J3 := by rw [intervalIntegral.integral_comp_add_left g (3 / 2 : ℝ)] have h1 : (3 / 2 : ℝ) + 0 = 3 / 2 := by norm_num have h2 : (3 / 2 : ℝ) + 1 / 2 = 2 := by norm_num rw [h1, h2] have hcv_12a : ∫ t in (0 : ℝ)..(1 / 2 : ℝ), g (1 + 2 * t) = (J2 + J3) / 2 := by have hc := intervalIntegral.integral_comp_mul_left (fun u => g (1 + u)) (by norm_num : (2 : ℝ) ≠ 0) (a := (0 : ℝ)) (b := (1 / 2 : ℝ)) simp only [mul_zero, smul_eq_mul] at hc have h2 : (2 : ℝ) * (1 / 2 : ℝ) = 1 := by norm_num rw [h2, intervalIntegral.integral_comp_add_left g (1 : ℝ)] at hc have h3 : (1 : ℝ) + 0 = 1 := by norm_num have h4 : (1 : ℝ) + 1 = 2 := by norm_num rw [h3, h4] at hc have hadj : (∫ u in (1 : ℝ)..2, g u) = J2 + J3 := (intervalIntegral.integral_add_adjacent_intervals (hg.continuous.intervalIntegrable _ _) (hg.continuous.intervalIntegrable _ _)).symm linarith have hi_0 : IntervalIntegrable g volume 0 (1 / 2 : ℝ) := hg.continuous.intervalIntegrable _ _ have hi_1s : IntervalIntegrable (fun t => g (1 - t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.sub continuous_id)).intervalIntegrable _ _ have hi_12s : IntervalIntegrable (fun t => g (1 - 2 * t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.sub (continuous_const.mul continuous_id))).intervalIntegrable _ _ have hi_1a : IntervalIntegrable (fun t => g (1 + t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable _ _ have hi_h2a : IntervalIntegrable (fun t => g (1 / 2 + t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable _ _ have hi_32a : IntervalIntegrable (fun t => g (3 / 2 + t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.add continuous_id)).intervalIntegrable _ _ have hi_12a : IntervalIntegrable (fun t => g (1 + 2 * t)) volume 0 (1 / 2 : ℝ) := (hg.continuous.comp (continuous_const.add (continuous_const.mul continuous_id))).intervalIntegrable _ _ have hI1 : baXi h x y - 2 * J1 ≤ M * (J1 - J0) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g 1 - g (1 - t) ≤ M * (g (1 - t) - g (1 - 2 * t)) := by intro t ht have h := hg.right_le_nonneg (1 - t) t ht.1 have h1 : (1 - t) + t = 1 := by ring have h2 : (1 - t) - t = 1 - 2 * t := by ring rw [h1, h2] at h; exact h have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) ((continuous_const.intervalIntegrable _ _).sub hi_1s) ((hi_1s.sub hi_12s).const_mul M) hpt rw [intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hi_1s, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_1s hi_12s, intervalIntegral.integral_const, hg1, hcv_1s, hcv_12s] at h simp only [sub_zero, smul_eq_mul] at h linarith have hI2 : baXi h x y / 2 - J1 ≤ M * (J2 - baXi h x y / 2) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g 1 - g (1 - t) ≤ M * (g (1 + t) - g 1) := fun t ht => hg.left_le_nonneg 1 t ht.1 have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) ((continuous_const.intervalIntegrable _ _).sub hi_1s) ((hi_1a.sub (continuous_const.intervalIntegrable _ _)).const_mul M) hpt rw [intervalIntegral.integral_sub (continuous_const.intervalIntegrable _ _) hi_1s, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_1a (continuous_const.intervalIntegrable _ _), intervalIntegral.integral_const, hg1, hcv_1s, hcv_1a] at h simp only [sub_zero, smul_eq_mul] at h linarith have hI3 : J2 - J1 ≤ M * (J3 - J2) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g (1 + t) - g (1 / 2 + t) ≤ M * (g (3 / 2 + t) - g (1 + t)) := by intro t _ have h := hg.left_le (1 + t) (1 / 2) (by norm_num) have h1 : (1 + t) + 1 / 2 = 3 / 2 + t := by ring have h2 : (1 + t) - 1 / 2 = 1 / 2 + t := by ring rw [h1, h2] at h; exact h have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) (hi_1a.sub hi_h2a) ((hi_32a.sub hi_1a).const_mul M) hpt rw [intervalIntegral.integral_sub hi_1a hi_h2a, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_32a hi_1a, hcv_1a, hcv_h2a, hcv_32a] at h exact h have hI4 : (J2 + J3) / 2 - J0 ≤ M * (J0 + 1 / 2) := by have hpt : ∀ t ∈ Icc (0 : ℝ) (1 / 2 : ℝ), g (1 + 2 * t) - g t ≤ M * (g t - g (-1)) := by intro t ht have h := hg.right_le_nonneg t (1 + t) (by linarith [ht.1]) have h1 : t + (1 + t) = 1 + 2 * t := by ring have h2 : t - (1 + t) = -1 := by ring rw [h1, h2] at h; exact h have h := intervalIntegral.integral_mono_on (by norm_num : (0 : ℝ) ≤ 1 / 2) (hi_12a.sub hi_0) ((hi_0.sub (continuous_const.intervalIntegrable _ _)).const_mul M) hpt rw [intervalIntegral.integral_sub hi_12a hi_0, intervalIntegral.integral_const_mul, intervalIntegral.integral_sub hi_0 (continuous_const.intervalIntegrable _ _), intervalIntegral.integral_const, hgm1, hcv_12a] at h simp only [sub_zero, smul_eq_mul] at h linarith have hcomb : M * ((2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (J0 + J1) - ((4 * M ^ 2 + 7 * M + 1) * baXi h x y - 2 * M ^ 2 * (M + 1))) = 4 * M ^ 2 * (M + 1) * (M * (J0 + 1 / 2) - ((J2 + J3) / 2 - J0)) + 2 * M * (M + 1) * (M * (J3 - J2) - (J2 - J1)) + 2 * (M + 1) * (2 * M + 1) * (M * (J2 - baXi h x y / 2) - (baXi h x y / 2 - J1)) + (2 * M ^ 3 + 2 * M ^ 2 - 3 * M - 1) * (M * (J1 - J0) - (baXi h x y - 2 * J1)) := by ring have hc4 : 0 ≤ 2 * M ^ 3 + 2 * M ^ 2 - 3 * M - 1 := by set s := M - 1; have hs : 0 ≤ s := by linarith have : 2 * M ^ 3 + 2 * M ^ 2 - 3 * M - 1 = 7 * s + 8 * s ^ 2 + 2 * s ^ 3 := by dsimp only [s]; ring rw [this]; positivity have h1' : 0 ≤ M * (J1 - J0) - (baXi h x y - 2 * J1) := by linarith have h2' : 0 ≤ M * (J2 - baXi h x y / 2) - (baXi h x y / 2 - J1) := by linarith have h3' : 0 ≤ M * (J3 - J2) - (J2 - J1) := by linarith have h4' : 0 ≤ M * (J0 + 1 / 2) - ((J2 + J3) / 2 - J0) := by linarith have hnonneg : 0 ≤ (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (J0 + J1) - ((4 * M ^ 2 + 7 * M + 1) * baXi h x y - 2 * M ^ 2 * (M + 1)) := by refine nonneg_of_mul_nonneg_right ?_ hM0_pos rw [hcomb] have hM0 : 0 ≤ M := by linarith positivity rw [hIp_eq] at hnonneg linarith /-! ## 6. Second-Order Closed-Form Bound `Q**(M)` and `K**(M)` -/ def rStar (M : ℝ) : ℝ := (M + 1) * Real.sqrt ((M ^ 2 + 1) / (M ^ 4 + 1)) def QStar (M : ℝ) : ℝ := 2 * Real.sqrt ((M ^ 2 + 1) * (M ^ 4 + 1)) / (M * (M + 1)) def KStar (M : ℝ) : ℝ := (Real.sqrt ((M ^ 2 + 1) * (M ^ 4 + 1)) + M ^ 3 - 1) / (M * (M + 1)) def QStar2 (M : ℝ) : ℝ := (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (2 * M * (M + 1) * (M + 2) ^ 2) * Real.sqrt ((M ^ 4 + 1) / (M ^ 2 + 1)) def KStar2 (M : ℝ) : ℝ := (QStar2 M + Real.sqrt (QStar2 M ^ 2 - 4)) / 2 lemma rStar_pos {M : ℝ} (hM : 1 ≤ M) : 0 < rStar M := by unfold rStar; have : 0 < M + 1 := by linarith exact mul_pos this (Real.sqrt_pos.mpr (by positivity)) lemma rStar_sq {M : ℝ} (_hM : 1 ≤ M) : rStar M ^ 2 = (M + 1) ^ 2 * (M ^ 2 + 1) / (M ^ 4 + 1) := by unfold rStar; rw [mul_pow, Real.sq_sqrt (by positivity)]; ring lemma two_mul_rStar_mul_QStar2 {M : ℝ} (hM : 1 ≤ M) : 2 * rStar M * QStar2 M = (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (M * (M + 2) ^ 2) := by unfold rStar QStar2 have hM0 : M ≠ 0 := by linarith have hM1 : M + 1 ≠ 0 := by linarith have hMp2 : M + 2 ≠ 0 := by linarith have hM2 : (0 : ℝ) < M ^ 2 + 1 := by positivity have hM4 : (0 : ℝ) < M ^ 4 + 1 := by positivity have hsq : Real.sqrt ((M ^ 2 + 1) / (M ^ 4 + 1)) * Real.sqrt ((M ^ 4 + 1) / (M ^ 2 + 1)) = 1 := by rw [← Real.sqrt_mul (by positivity)] have hmul : (M ^ 2 + 1) / (M ^ 4 + 1) * ((M ^ 4 + 1) / (M ^ 2 + 1)) = 1 := by field_simp [ne_of_gt hM2, ne_of_gt hM4] rw [hmul, Real.sqrt_one] have hring : 2 * ((M + 1) * Real.sqrt ((M ^ 2 + 1) / (M ^ 4 + 1))) * ((4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (2 * M * (M + 1) * (M + 2) ^ 2) * Real.sqrt ((M ^ 4 + 1) / (M ^ 2 + 1))) = (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (M * (M + 2) ^ 2) * (Real.sqrt ((M ^ 2 + 1) / (M ^ 4 + 1)) * Real.sqrt ((M ^ 4 + 1) / (M ^ 2 + 1))) := by field_simp [hM0, hM1, hMp2] rw [hring, hsq, mul_one] /-- `Q**(M) < Q*(M)` strictly for EVERY `M > 1`. -/ theorem QStar2_lt_QStar {M : ℝ} (hM : 1 < M) : QStar2 M < QStar M := by have hr : 0 < rStar M := rStar_pos (le_of_lt hM) have h2r : 0 < 2 * rStar M := by linarith suffices h : 2 * rStar M * QStar2 M < 2 * rStar M * QStar M from lt_of_mul_lt_mul_left h (le_of_lt h2r) rw [two_mul_rStar_mul_QStar2 (le_of_lt hM)] have h1 : 2 * rStar M * QStar M = 4 * (M ^ 2 + 1) / M := by unfold rStar QStar have hM0 : M ≠ 0 := by linarith have hM1 : M + 1 ≠ 0 := by linarith have hM2 : (0 : ℝ) ≤ M ^ 2 + 1 := by positivity have hM4 : (0 : ℝ) < M ^ 4 + 1 := by positivity have hsq : Real.sqrt ((M ^ 2 + 1) / (M ^ 4 + 1)) * Real.sqrt ((M ^ 2 + 1) * (M ^ 4 + 1)) = M ^ 2 + 1 := by rw [← Real.sqrt_mul (by positivity)] have hmul : (M ^ 2 + 1) / (M ^ 4 + 1) * ((M ^ 2 + 1) * (M ^ 4 + 1)) = (M ^ 2 + 1) ^ 2 := by field_simp [ne_of_gt hM4] rw [hmul, Real.sqrt_sq hM2] have hring : 2 * ((M + 1) * Real.sqrt ((M ^ 2 + 1) / (M ^ 4 + 1))) * (2 * Real.sqrt ((M ^ 2 + 1) * (M ^ 4 + 1)) / (M * (M + 1))) = 4 * (Real.sqrt ((M ^ 2 + 1) / (M ^ 4 + 1)) * Real.sqrt ((M ^ 2 + 1) * (M ^ 4 + 1))) / M := by field_simp [hM0, hM1]; ring rw [hring, hsq] rw [h1] have hdiff : 4 * (M ^ 2 + 1) / M - (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (M * (M + 2) ^ 2) = 3 * (M - 1) ^ 2 / (M * (M + 2) ^ 2) := by have hM0 : M ≠ 0 := by linarith have hMp2 : M + 2 ≠ 0 := by linarith field_simp [hM0, hMp2]; ring have hpos : 0 < 3 * (M - 1) ^ 2 / (M * (M + 2) ^ 2) := by have : 0 < M - 1 := by linarith positivity linarith lemma two_le_QStar2 {M : ℝ} (hM : 1 ≤ M) : 2 ≤ QStar2 M := by unfold QStar2 have hden : 0 < 2 * M * (M + 1) * (M + 2) ^ 2 := by positivity have hnum_pos : 0 < 4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2 := by set s := M - 1; have hs : 0 ≤ s := by linarith have : 4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2 = 72 + 120 * s + 89 * s ^ 2 + 32 * s ^ 3 + 4 * s ^ 4 := by dsimp only [s]; ring rw [this]; positivity have hrew : (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (2 * M * (M + 1) * (M + 2) ^ 2) * Real.sqrt ((M ^ 4 + 1) / (M ^ 2 + 1)) = Real.sqrt (((4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (2 * M * (M + 1) * (M + 2) ^ 2)) ^ 2 * ((M ^ 4 + 1) / (M ^ 2 + 1))) := by rw [Real.sqrt_mul (by positivity), Real.sqrt_sq (by positivity)] rw [hrew] calc (2 : ℝ) = Real.sqrt (2 ^ 2) := (Real.sqrt_sq (by norm_num)).symm _ ≤ Real.sqrt (((4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (2 * M * (M + 1) * (M + 2) ^ 2)) ^ 2 * ((M ^ 4 + 1) / (M ^ 2 + 1))) := by apply Real.sqrt_le_sqrt have hD : 0 < (2 * M * (M + 1) * (M + 2) ^ 2) ^ 2 * (M ^ 2 + 1) := by positivity rw [div_pow, div_mul_div_comm, le_div_iff₀ hD] set s := M - 1; have hs : 0 ≤ s := by linarith rw [show M = 1 + s by ring] have hdiff : (4 * ((1 + s) ^ 2 + 1) * ((1 + s) + 2) ^ 2 - 3 * ((1 + s) - 1) ^ 2) ^ 2 * ((1 + s) ^ 4 + 1) - 2 ^ 2 * ((2 * (1 + s) * ((1 + s) + 1) * ((1 + s) + 2) ^ 2) ^ 2 * ((1 + s) ^ 2 + 1)) = 22464 * s ^ 2 + 97920 * s ^ 3 + 199506 * s ^ 4 + 248868 * s ^ 5 + 209334 * s ^ 6 + 123444 * s ^ 7 + 51441 * s ^ 8 + 14880 * s ^ 9 + 2840 * s ^ 10 + 320 * s ^ 11 + 16 * s ^ 12 := by ring have hpos : 0 ≤ 22464 * s ^ 2 + 97920 * s ^ 3 + 199506 * s ^ 4 + 248868 * s ^ 5 + 209334 * s ^ 6 + 123444 * s ^ 7 + 51441 * s ^ 8 + 14880 * s ^ 9 + 2840 * s ^ 10 + 320 * s ^ 11 + 16 * s ^ 12 := by positivity linarith /-- **Strict Superiority Over Theorem 1 (`K*(M)`) for EVERY `M > 1`**: `K**(M) < K*(M)`. -/ theorem KStar2_lt_KStar {M : ℝ} (hM : 1 < M) : KStar2 M < KStar M := by have hQlt : QStar2 M < QStar M := QStar2_lt_QStar hM have hQ2 : 2 ≤ QStar2 M := two_le_QStar2 (le_of_lt hM) have hKstar_eq : KStar M = (QStar M + Real.sqrt (QStar M ^ 2 - 4)) / 2 := by unfold QStar KStar have hMpos : 0 < M * (M + 1) := by positivity have hMne : M * (M + 1) ≠ 0 := ne_of_gt hMpos have hM3 : 0 ≤ M ^ 3 - 1 := by nlinarith have hsq : QStar M ^ 2 - 4 = (2 * (M ^ 3 - 1) / (M * (M + 1))) ^ 2 := by unfold QStar; rw [div_pow, mul_pow, Real.sq_sqrt (by positivity)]; field_simp [hMne]; ring change _ = (2 * Real.sqrt ((M ^ 2 + 1) * (M ^ 4 + 1)) / (M * (M + 1)) + Real.sqrt (QStar M ^ 2 - 4)) / 2 rw [hsq, Real.sqrt_sq (by positivity)]; field_simp [hMne]; ring rw [hKstar_eq] unfold KStar2 have hsq_lt : Real.sqrt (QStar2 M ^ 2 - 4) < Real.sqrt (QStar M ^ 2 - 4) := Real.sqrt_lt_sqrt (by nlinarith) (by nlinarith) linarith /-! ## 7. Second-Order Concave Defect & 2-Regime Pentagon Reduction -/ def polyDefect2 (M ξ a b : ℝ) : ℝ := (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) * (M ^ 4 + 1) * ξ * (a + b) - M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((ξ + 1) ^ 2 + (ξ * a - b) ^ 2) - M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) * ((ξ - 1) ^ 2 + (ξ * a + b) ^ 2) lemma polyDefect2_segment_nonneg {M ξ a₁ b₁ a₂ b₂ t : ℝ} (hM : 1 ≤ M) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) (h1 : 0 ≤ polyDefect2 M ξ a₁ b₁) (h2 : 0 ≤ polyDefect2 M ξ a₂ b₂) : 0 ≤ polyDefect2 M ξ ((1 - t) * a₁ + t * a₂) ((1 - t) * b₁ + t * b₂) := by have hident : polyDefect2 M ξ ((1 - t) * a₁ + t * a₂) ((1 - t) * b₁ + t * b₂) = (1 - t) * polyDefect2 M ξ a₁ b₁ + t * polyDefect2 M ξ a₂ b₂ + t * (1 - t) * (M * (M + 2) ^ 2 * (M ^ 4 + 1) * (ξ * (a₁ - a₂) - (b₁ - b₂)) ^ 2 + M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) * (ξ * (a₁ - a₂) + (b₁ - b₂)) ^ 2) := by unfold polyDefect2; ring rw [hident] have hMpos : 0 ≤ M := by linarith have h1mt : 0 ≤ 1 - t := by linarith positivity lemma polyDefect2_div (M ξ Na Nb D : ℝ) (hD : D ≠ 0) : D ^ 2 * polyDefect2 M ξ (Na / D) (Nb / D) = (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) * (M ^ 4 + 1) * ξ * D * (Na + Nb) - M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((ξ + 1) ^ 2 * D ^ 2 + (ξ * Na - Nb) ^ 2) - M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) * ((ξ - 1) ^ 2 * D ^ 2 + (ξ * Na + Nb) ^ 2) := by unfold polyDefect2; field_simp [hD] lemma polyDefect2_div2 (M Nxi Dxi Na Nb Dab : ℝ) (hDxi : Dxi ≠ 0) (hDab : Dab ≠ 0) : Dxi ^ 2 * Dab ^ 2 * polyDefect2 M (Nxi / Dxi) (Na / Dab) (Nb / Dab) = (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) * (M ^ 4 + 1) * Nxi * Dxi * Dab * (Na + Nb) - M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((Nxi + Dxi) ^ 2 * Dab ^ 2 + (Nxi * Na - Dxi * Nb) ^ 2) - M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) * ((Nxi - Dxi) ^ 2 * Dab ^ 2 + (Nxi * Na + Dxi * Nb) ^ 2) := by unfold polyDefect2; field_simp [hDxi, hDab] /-- Coefficient of `w ^ k` (`k ∈ Fin 7`) in the generic `polyDefect2_div2` expansion for linear `N = n0 + n1*w`, `D = d0 + d1*w` and quadratic `S, P, Q`. -/ private def polyDefect2W_coeff (C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 : ℝ) (k : Fin 7) : ℝ := let m0 := n0 * d0 let m1 := n0 * d1 + n1 * d0 let m2 := n1 * d1 let pq0 := p0 + q0; let pq1 := p1 + q1; let pq2 := p2 + q2 let r0 := s0 * pq0 let r1 := s0 * pq1 + s1 * pq0 let r2 := s0 * pq2 + s1 * pq1 + s2 * pq0 let r3 := s1 * pq2 + s2 * pq1 let r4 := s2 * pq2 let u0 := (n0 + d0) * s0 let u1 := (n0 + d0) * s1 + (n1 + d1) * s0 let u2 := (n0 + d0) * s2 + (n1 + d1) * s1 let u3 := (n1 + d1) * s2 let v0 := (n0 - d0) * s0 let v1 := (n0 - d0) * s1 + (n1 - d1) * s0 let v2 := (n0 - d0) * s2 + (n1 - d1) * s1 let v3 := (n1 - d1) * s2 let x0 := n0 * p0 - d0 * q0 let x1 := n0 * p1 + n1 * p0 - d0 * q1 - d1 * q0 let x2 := n0 * p2 + n1 * p1 - d0 * q2 - d1 * q1 let x3 := n1 * p2 - d1 * q2 let y0 := n0 * p0 + d0 * q0 let y1 := n0 * p1 + n1 * p0 + d0 * q1 + d1 * q0 let y2 := n0 * p2 + n1 * p1 + d0 * q2 + d1 * q1 let y3 := n1 * p2 + d1 * q2 match k with | 0 => C1 * (m0 * r0) - C2 * (u0 ^ 2 + x0 ^ 2) - C3 * (v0 ^ 2 + y0 ^ 2) | 1 => C1 * (m0 * r1 + m1 * r0) - C2 * (2 * u0 * u1 + 2 * x0 * x1) - C3 * (2 * v0 * v1 + 2 * y0 * y1) | 2 => C1 * (m0 * r2 + m1 * r1 + m2 * r0) - C2 * (u1 ^ 2 + 2 * u0 * u2 + x1 ^ 2 + 2 * x0 * x2) - C3 * (v1 ^ 2 + 2 * v0 * v2 + y1 ^ 2 + 2 * y0 * y2) | 3 => C1 * (m0 * r3 + m1 * r2 + m2 * r1) - C2 * (2 * u0 * u3 + 2 * u1 * u2 + 2 * x0 * x3 + 2 * x1 * x2) - C3 * (2 * v0 * v3 + 2 * v1 * v2 + 2 * y0 * y3 + 2 * y1 * y2) | 4 => C1 * (m0 * r4 + m1 * r3 + m2 * r2) - C2 * (u2 ^ 2 + 2 * u1 * u3 + x2 ^ 2 + 2 * x1 * x3) - C3 * (v2 ^ 2 + 2 * v1 * v3 + y2 ^ 2 + 2 * y1 * y3) | 5 => C1 * (m1 * r4 + m2 * r3) - C2 * (2 * u2 * u3 + 2 * x2 * x3) - C3 * (2 * v2 * v3 + 2 * y2 * y3) | 6 => C1 * (m2 * r4) - C2 * (u3 ^ 2 + x3 ^ 2) - C3 * (v3 ^ 2 + y3 ^ 2) private lemma polyDefect2W_expand (C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 w : ℝ) : C1 * (n0 + n1 * w) * (d0 + d1 * w) * (s0 + s1 * w + s2 * w ^ 2) * ((p0 + p1 * w + p2 * w ^ 2) + (q0 + q1 * w + q2 * w ^ 2)) - C2 * (((n0 + n1 * w) + (d0 + d1 * w)) ^ 2 * (s0 + s1 * w + s2 * w ^ 2) ^ 2 + ((n0 + n1 * w) * (p0 + p1 * w + p2 * w ^ 2) - (d0 + d1 * w) * (q0 + q1 * w + q2 * w ^ 2)) ^ 2) - C3 * (((n0 + n1 * w) - (d0 + d1 * w)) ^ 2 * (s0 + s1 * w + s2 * w ^ 2) ^ 2 + ((n0 + n1 * w) * (p0 + p1 * w + p2 * w ^ 2) + (d0 + d1 * w) * (q0 + q1 * w + q2 * w ^ 2)) ^ 2) = polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 0 + polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 1 * w + polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 2 * w ^ 2 + polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 3 * w ^ 3 + polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 4 * w ^ 4 + polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 5 * w ^ 5 + polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 6 * w ^ 6 := by unfold polyDefect2W_coeff; dsimp only; ring lemma polyDefect2_V1 {M ξ : ℝ} (hξ1 : 1 ≤ ξ) (hξM : ξ ≤ M) : 0 ≤ polyDefect2 M ξ (M / (M + 1)) (M / (M + 1)) := by have hM1 : (0 : ℝ) < M + 1 := by linarith refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < (M + 1) ^ 2) rw [polyDefect2_div M ξ M M (M + 1) (ne_of_gt hM1)] set u := ξ - 1; set v := M - ξ have hu : 0 ≤ u := by linarith have hv : 0 ≤ v := by linarith rw [show ξ = 1 + u by ring, show M = 1 + u + v by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ (102 * u ^ 2 + 894 * u ^ 3 + 2798 * u ^ 4 + 4668 * u ^ 5 + 4792 * u ^ 6 + 3198 * u ^ 7 + 1396 * u ^ 8 + 384 * u ^ 9 + 60 * u ^ 10 + 4 * u ^ 11) + (1104 * u + 6510 * u ^ 2 + 18480 * u ^ 3 + 31484 * u ^ 4 + 34560 * u ^ 5 + 25062 * u ^ 6 + 11934 * u ^ 7 + 3578 * u ^ 8 + 608 * u ^ 9 + 44 * u ^ 10) * v + (552 + 8148 * u + 33742 * u ^ 2 + 72596 * u ^ 3 + 94940 * u ^ 4 + 79566 * u ^ 5 + 42954 * u ^ 6 + 14406 * u ^ 7 + 2712 * u ^ 8 + 216 * u ^ 9) * v ^ 2 + (2532 + 23236 * u + 75564 * u ^ 2 + 130000 * u ^ 3 + 133830 * u ^ 4 + 85286 * u ^ 5 + 32914 * u ^ 6 + 7008 * u ^ 7 + 624 * u ^ 8) * v ^ 3 + (5176 + 35936 * u + 94080 * u ^ 2 + 128970 * u ^ 3 + 102090 * u ^ 4 + 46942 * u ^ 5 + 11592 * u ^ 6 + 1176 * u ^ 7) * v ^ 4 + (6152 + 33872 * u + 70818 * u ^ 2 + 75066 * u ^ 3 + 43134 * u ^ 4 + 12768 * u ^ 5 + 1512 * u ^ 6) * v ^ 5 + (4620 + 20202 * u + 32734 * u ^ 2 + 25298 * u ^ 3 + 9408 * u ^ 4 + 1344 * u ^ 5) * v ^ 6 + (2226 + 7554 * u + 8966 * u ^ 2 + 4512 * u ^ 3 + 816 * u ^ 4) * v ^ 7 + (666 + 1674 * u + 1308 * u ^ 2 + 324 * u ^ 3) * v ^ 8 + (112 + 192 * u + 76 * u ^ 2) * v ^ 9 + (8 + 8 * u) * v ^ 10) (by ring) lemma polyDefect2_V2 {M ξ : ℝ} (hξ1 : 1 ≤ ξ) (hξM : ξ ≤ M) : 0 ≤ polyDefect2 M ξ (1 / (M + 1)) (M / (M + 1)) := by have hM1 : (0 : ℝ) < M + 1 := by linarith refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < (M + 1) ^ 2) rw [polyDefect2_div M ξ 1 M (M + 1) (ne_of_gt hM1)] set u := ξ - 1; set v := M - ξ have hu : 0 ≤ u := by linarith have hv : 0 ≤ v := by linarith rw [show ξ = 1 + u by ring, show M = 1 + u + v by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ (336 * u ^ 2 + 1584 * u ^ 3 + 3412 * u ^ 4 + 4432 * u ^ 5 + 3812 * u ^ 6 + 2230 * u ^ 7 + 877 * u ^ 8 + 221 * u ^ 9 + 32 * u ^ 10 + 2 * u ^ 11) + (1392 * u + 7416 * u ^ 2 + 18300 * u ^ 3 + 27086 * u ^ 4 + 26248 * u ^ 5 + 17108 * u ^ 6 + 7428 * u ^ 7 + 2052 * u ^ 8 + 324 * u ^ 9 + 22 * u ^ 10) * v + (606 + 8070 * u + 30268 * u ^ 2 + 58794 * u ^ 3 + 69710 * u ^ 4 + 53366 * u ^ 5 + 26512 * u ^ 6 + 8234 * u ^ 7 + 1444 * u ^ 8 + 108 * u ^ 9) * v ^ 2 + (2238 + 19284 * u + 58186 * u ^ 2 + 92600 * u ^ 3 + 88260 * u ^ 4 + 52196 * u ^ 5 + 18746 * u ^ 6 + 3728 * u ^ 7 + 312 * u ^ 8) * v ^ 3 + (3904 + 26174 * u + 64840 * u ^ 2 + 83490 * u ^ 3 + 61890 * u ^ 4 + 26628 * u ^ 5 + 6160 * u ^ 6 + 588 * u ^ 7) * v ^ 4 + (4128 + 22352 * u + 44780 * u ^ 2 + 44972 * u ^ 3 + 24346 * u ^ 4 + 6776 * u ^ 5 + 756 * u ^ 6) * v ^ 5 + (2838 + 12338 * u + 19288 * u ^ 2 + 14182 * u ^ 3 + 4984 * u ^ 4 + 672 * u ^ 5) * v ^ 6 + (1276 + 4332 * u + 4974 * u ^ 2 + 2384 * u ^ 3 + 408 * u ^ 4) * v ^ 7 + (361 + 911 * u + 688 * u ^ 2 + 162 * u ^ 3) * v ^ 8 + (58 + 100 * u + 38 * u ^ 2) * v ^ 9 + (4 + 4 * u) * v ^ 10) (by ring) lemma polyDefect2_V5 {M ξ : ℝ} (hξ1 : 1 ≤ ξ) (hξM : ξ ≤ M) : 0 ≤ polyDefect2 M ξ (1 / (M + 1)) ((M * ξ + M + 1) / ((M + 1) * (2 * M + 1))) := by have hM1 : (0 : ℝ) < M + 1 := by linarith have h2M1 : (0 : ℝ) < 2 * M + 1 := by linarith have hD : (0 : ℝ) < (M + 1) * (2 * M + 1) := by positivity have h1 : 1 / (M + 1) = (2 * M + 1) / ((M + 1) * (2 * M + 1)) := by rw [mul_comm (M + 1), div_mul_eq_div_div, div_self (ne_of_gt h2M1)] rw [h1] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < ((M + 1) * (2 * M + 1)) ^ 2) rw [polyDefect2_div M ξ (2 * M + 1) (M * ξ + M + 1) ((M + 1) * (2 * M + 1)) (ne_of_gt hD)] set u := ξ - 1; set v := M - ξ have hu : 0 ≤ u := by linarith have hv : 0 ≤ v := by linarith rw [show ξ = 1 + u by ring, show M = 1 + u + v by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ (1800 * u ^ 2 + 8616 * u ^ 3 + 18434 * u ^ 4 + 23560 * u ^ 5 + 20292 * u ^ 6 + 12548 * u ^ 7 + 5723 * u ^ 8 + 1906 * u ^ 9 + 439 * u ^ 10 + 62 * u ^ 11 + 4 * u ^ 12) + (10368 * u + 58476 * u ^ 2 + 148402 * u ^ 3 + 224114 * u ^ 4 + 224942 * u ^ 5 + 158244 * u ^ 6 + 79553 * u ^ 7 + 28271 * u ^ 8 + 6770 * u ^ 9 + 978 * u ^ 10 + 64 * u ^ 11) * v + (4968 + 70416 * u + 280682 * u ^ 2 + 576534 * u ^ 3 + 732540 * u ^ 4 + 622450 * u ^ 5 + 364427 * u ^ 6 + 146317 * u ^ 7 + 38612 * u ^ 8 + 6028 * u ^ 9 + 420 * u ^ 10) * v ^ 2 + (20556 + 189894 * u + 620518 * u ^ 2 + 1086580 * u ^ 3 + 1177770 * u ^ 4 + 836437 * u ^ 5 + 392735 * u ^ 6 + 117856 * u ^ 7 + 20472 * u ^ 8 + 1560 * u ^ 9) * v ^ 3 + (39180 + 290090 * u + 809540 * u ^ 2 + 1212280 * u ^ 3 + 1099525 * u ^ 4 + 626773 * u ^ 5 + 220346 * u ^ 6 + 43668 * u ^ 7 + 3720 * u ^ 8) * v ^ 4 + (45552 + 286542 * u + 684568 * u ^ 2 + 858403 * u ^ 3 + 625121 * u ^ 4 + 266980 * u ^ 5 + 62076 * u ^ 6 + 6048 * u ^ 7) * v ^ 5 + (35692 + 192754 * u + 386393 * u ^ 2 + 389431 * u ^ 3 + 212660 * u ^ 4 + 60144 * u ^ 5 + 6888 * u ^ 6) * v ^ 6 + (19450 + 88967 * u + 143957 * u ^ 2 + 109072 * u ^ 3 + 39528 * u ^ 4 + 5520 * u ^ 5) * v ^ 7 + (7292 + 27445 * u + 33671 * u ^ 2 + 17022 * u ^ 3 + 3060 * u ^ 4) * v ^ 8 + (1788 + 5306 * u + 4418 * u ^ 2 + 1120 * u ^ 3) * v ^ 9 + (256 + 564 * u + 244 * u ^ 2) * v ^ 10 + (16 + 24 * u) * v ^ 11) (by ring) def xiA (M : ℝ) : ℝ := 2 * M * (M + 1) ^ 2 / (2 * M ^ 2 + 5 * M + 1) lemma polyDefect2_regA_V3 {M ξ : ℝ} (hM : 1 ≤ M) (hξ1 : 1 ≤ ξ) (hξA : ξ ≤ xiA M) : 0 ≤ polyDefect2 M ξ (M / (M + 1)) (1 / (M + 1)) := by have hQa : 0 < 2 * M ^ 2 + 5 * M + 1 := by positivity have hM1 : 0 < M + 1 := by linarith by_cases htop : ξ = xiA M · subst htop refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < (2 * M ^ 2 + 5 * M + 1) ^ 2 * (M + 1) ^ 2) unfold xiA rw [polyDefect2_div2 M (2 * M * (M + 1) ^ 2) (2 * M ^ 2 + 5 * M + 1) M 1 (M + 1) (ne_of_gt hQa) (ne_of_gt hM1)] set s := M - 1; have hs : 0 ≤ s := by linarith rw [show M = 1 + s by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 6654 * s ^ 2 + 41862 * s ^ 3 + 121936 * s ^ 4 + 218090 * s ^ 5 + 267458 * s ^ 6 + 237512 * s ^ 7 + 156916 * s ^ 8 + 77778 * s ^ 9 + 28684 * s ^ 10 + 7656 * s ^ 11 + 1398 * s ^ 12 + 156 * s ^ 13 + 8 * s ^ 14) (by ring) · have hlt : ξ < xiA M := lt_of_le_of_ne hξA htop set w := (ξ - 1) / (xiA M - ξ) have hw : 0 ≤ w := div_nonneg (by linarith) (by linarith) have hDxi : 0 < (1 + w) * (2 * M ^ 2 + 5 * M + 1) := by positivity have hξ_eq : ξ = ((2 * M ^ 2 + 5 * M + 1) + w * (2 * M * (M + 1) ^ 2)) / ((1 + w) * (2 * M ^ 2 + 5 * M + 1)) := by have hgap : xiA M - ξ ≠ 0 := by linarith have hw_mul : w * (xiA M - ξ) = ξ - 1 := div_mul_cancel₀ _ hgap have hlin : (1 + w) * ξ = 1 + w * xiA M := by linarith rw [eq_div_iff (ne_of_gt hDxi)] have hmul : ξ * ((1 + w) * (2 * M ^ 2 + 5 * M + 1)) = ((1 + w) * ξ) * (2 * M ^ 2 + 5 * M + 1) := by ring rw [hmul, hlin]; unfold xiA; field_simp [ne_of_gt hQa] rw [hξ_eq] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < ((1 + w) * (2 * M ^ 2 + 5 * M + 1)) ^ 2 * (M + 1) ^ 2) rw [polyDefect2_div2 M ((2 * M ^ 2 + 5 * M + 1) + w * (2 * M * (M + 1) ^ 2)) ((1 + w) * (2 * M ^ 2 + 5 * M + 1)) M 1 (M + 1) (ne_of_gt hDxi) (ne_of_gt hM1)] set s := M - 1; have hs : 0 ≤ s := by linarith rw [show M = 1 + s by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ (38784 * s ^ 2 + 230496 * s ^ 3 + 640606 * s ^ 4 + 1101078 * s ^ 5 + 1300208 * s ^ 6 + 1106296 * s ^ 7 + 691766 * s ^ 8 + 318564 * s ^ 9 + 106689 * s ^ 10 + 25230 * s ^ 11 + 3984 * s ^ 12 + 376 * s ^ 13 + 16 * s ^ 14) + (67488 * s ^ 2 + 430068 * s ^ 3 + 1289812 * s ^ 4 + 2411308 * s ^ 5 + 3130206 * s ^ 6 + 2970920 * s ^ 7 + 2113482 * s ^ 8 + 1136816 * s ^ 9 + 460729 * s ^ 10 + 138514 * s ^ 11 + 29942 * s ^ 12 + 4396 * s ^ 13 + 392 * s ^ 14 + 16 * s ^ 15) * w + (6654 * s ^ 2 + 41862 * s ^ 3 + 121936 * s ^ 4 + 218090 * s ^ 5 + 267458 * s ^ 6 + 237512 * s ^ 7 + 156916 * s ^ 8 + 77778 * s ^ 9 + 28684 * s ^ 10 + 7656 * s ^ 11 + 1398 * s ^ 12 + 156 * s ^ 13 + 8 * s ^ 14) * w ^ 2) (by ring) private def regAV4_c (s : ℝ) (k : Fin 7) : ℝ := let M := 1 + s let C1 := (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * s ^ 2) * (M ^ 4 + 1) let C2 := M * (M + 2) ^ 2 * (M ^ 4 + 1) let C3 := M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) let Qa := 2 * M ^ 2 + 5 * M + 1 let Da := 2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1 let Db := M ^ 3 + 5 * M ^ 2 + 8 * M + 2 let n0 := Qa; let n1 := 2 * M * (M + 1) ^ 2 let d0 := Qa; let d1 := Qa let s0 := Qa * (M + 1); let s1 := 2 * M * (M + 1) ^ 2 * (M + 1); let s2 := 0 let p0 := Qa * (M + 1) - Qa * M; let p1 := 2 * M * (M + 1) ^ 2 * (M + 1) - Qa * M; let p2 := 0 let q0 := Qa; let q1 := 2 * M * (M + 1) ^ 2; let q2 := 0 let _ := (Qa, Da, Db) polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 k private lemma regAV4_c0_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regAV4_c s 0 := by unfold regAV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 2260992 * s ^ 2 + 16515072 * s ^ 3 + 56335360 * s ^ 4 + 119422720 * s ^ 5 + 176412840 * s ^ 6 + 192690508 * s ^ 7 + 160840092 * s ^ 8 + 104374768 * s ^ 9 + 52977212 * s ^ 10 + 20968442 * s ^ 11 + 6396900 * s ^ 12 + 1472020 * s ^ 13 + 246528 * s ^ 14 + 28288 * s ^ 15 + 1984 * s ^ 16 + 64 * s ^ 17) (by ring) private lemma regAV4_c1_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regAV4_c s 1 := by unfold regAV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 9560064 * s ^ 2 + 78498816 * s ^ 3 + 304424832 * s ^ 4 + 742474640 * s ^ 5 + 1277931276 * s ^ 6 + 1648746686 * s ^ 7 + 1650723714 * s ^ 8 + 1308346818 * s ^ 9 + 829356904 * s ^ 10 + 421772599 * s ^ 11 + 171602737 * s ^ 12 + 55388424 * s ^ 13 + 13974006 * s ^ 14 + 2691924 * s ^ 15 + 381664 * s ^ 16 + 37472 * s ^ 17 + 2272 * s ^ 18 + 64 * s ^ 19) (by ring) private lemma regAV4_c2_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regAV4_c s 2 := by unfold regAV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 12856320 * s ^ 2 + 116530944 * s ^ 3 + 501579952 * s ^ 4 + 1365481264 * s ^ 5 + 2639109072 * s ^ 6 + 3848425134 * s ^ 7 + 4387248066 * s ^ 8 + 3993902826 * s ^ 9 + 2938390092 * s ^ 10 + 1756642597 * s ^ 11 + 853514081 * s ^ 12 + 335537512 * s ^ 13 + 105727002 * s ^ 14 + 26293676 * s ^ 15 + 5039704 * s ^ 16 + 717376 * s ^ 17 + 71328 * s ^ 18 + 4416 * s ^ 19 + 128 * s ^ 20) (by ring) private lemma regAV4_c3_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regAV4_c s 3 := by unfold regAV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 6076416 * s ^ 2 + 59674368 * s ^ 3 + 279189504 * s ^ 4 + 829049152 * s ^ 5 + 1754733024 * s ^ 6 + 2815243104 * s ^ 7 + 3550827304 * s ^ 8 + 3600668776 * s ^ 9 + 2975240424 * s ^ 10 + 2017748504 * s ^ 11 + 1125756540 * s ^ 12 + 515808212 * s ^ 13 + 192968896 * s ^ 14 + 58341812 * s ^ 15 + 14028740 * s ^ 16 + 2618752 * s ^ 17 + 365576 * s ^ 18 + 35888 * s ^ 19 + 2208 * s ^ 20 + 64 * s ^ 21) (by ring) private lemma regAV4_c4_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regAV4_c s 4 := by unfold regAV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 519168 * s ^ 2 + 5127168 * s ^ 3 + 23970304 * s ^ 4 + 70649728 * s ^ 5 + 147404608 * s ^ 6 + 231568768 * s ^ 7 + 284214016 * s ^ 8 + 278859192 * s ^ 9 + 221794872 * s ^ 10 + 144053712 * s ^ 11 + 76545032 * s ^ 12 + 33169692 * s ^ 13 + 11622108 * s ^ 14 + 3243708 * s ^ 15 + 704204 * s ^ 16 + 114560 * s ^ 17 + 13128 * s ^ 18 + 944 * s ^ 19 + 32 * s ^ 20) (by ring) private lemma regAV4_c5_nonneg {s : ℝ} (_hs : 0 ≤ s) : 0 ≤ regAV4_c s 5 := by unfold regAV4_c polyDefect2W_coeff dsimp only exact le_of_le_of_eq (le_refl 0) (by ring) private lemma regAV4_c6_nonneg {s : ℝ} (_hs : 0 ≤ s) : 0 ≤ regAV4_c s 6 := by unfold regAV4_c polyDefect2W_coeff dsimp only exact le_of_le_of_eq (le_refl 0) (by ring) lemma polyDefect2_regA_V4 {M ξ : ℝ} (hM : 1 ≤ M) (hξ1 : 1 ≤ ξ) (hξA : ξ ≤ xiA M) : 0 ≤ polyDefect2 M ξ ((ξ * (M + 1) - M) / (ξ * (M + 1))) (1 / (M + 1)) := by have hM1 : 0 < M + 1 := by linarith have hQa : 0 < 2 * M ^ 2 + 5 * M + 1 := by positivity by_cases htop : ξ = xiA M · subst htop set Nxi := 2 * M * (M + 1) ^ 2 set Dxi := 2 * M ^ 2 + 5 * M + 1 have hNxi : 0 < Nxi := by dsimp only [Nxi]; positivity have hDxi : 0 < Dxi := hQa have hrew_a : (xiA M * (M + 1) - M) / (xiA M * (M + 1)) = (Nxi * (M + 1) - Dxi * M) / (Nxi * (M + 1)) := by unfold xiA; dsimp only [Nxi, Dxi] rw [div_eq_div_iff (by positivity) (by positivity)] field_simp [ne_of_gt hDxi] have hrew_b : 1 / (M + 1) = Nxi / (Nxi * (M + 1)) := by rw [div_eq_div_iff (ne_of_gt hM1) (by positivity)]; ring rw [hrew_a, hrew_b] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < Dxi ^ 2 * (Nxi * (M + 1)) ^ 2) have hxi_eq : xiA M = Nxi / Dxi := rfl rw [hxi_eq, polyDefect2_div2 M Nxi Dxi (Nxi * (M + 1) - Dxi * M) Nxi (Nxi * (M + 1)) (ne_of_gt hDxi) (by positivity)] dsimp only [Nxi, Dxi] set s := M - 1; have hs : 0 ≤ s := by linarith rw [show M = 1 + s by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 519168 * s ^ 2 + 5127168 * s ^ 3 + 23970304 * s ^ 4 + 70649728 * s ^ 5 + 147404608 * s ^ 6 + 231568768 * s ^ 7 + 284214016 * s ^ 8 + 278859192 * s ^ 9 + 221794872 * s ^ 10 + 144053712 * s ^ 11 + 76545032 * s ^ 12 + 33169692 * s ^ 13 + 11622108 * s ^ 14 + 3243708 * s ^ 15 + 704204 * s ^ 16 + 114560 * s ^ 17 + 13128 * s ^ 18 + 944 * s ^ 19 + 32 * s ^ 20) (by ring) · have hlt : ξ < xiA M := lt_of_le_of_ne hξA htop set w := (ξ - 1) / (xiA M - ξ) have hw : 0 ≤ w := div_nonneg (by linarith) (by linarith) set Nxi := (2 * M ^ 2 + 5 * M + 1) + w * (2 * M * (M + 1) ^ 2) set Dxi := (1 + w) * (2 * M ^ 2 + 5 * M + 1) have hNxi : 0 < Nxi := by dsimp only [Nxi]; positivity have hDxi : 0 < Dxi := by dsimp only [Dxi]; positivity have hξ_eq : ξ = Nxi / Dxi := by have hgap : xiA M - ξ ≠ 0 := by linarith have hw_mul : w * (xiA M - ξ) = ξ - 1 := div_mul_cancel₀ _ hgap have hlin : (1 + w) * ξ = 1 + w * xiA M := by linarith rw [eq_div_iff (ne_of_gt hDxi)] dsimp only [Nxi, Dxi] have hmul : ξ * ((1 + w) * (2 * M ^ 2 + 5 * M + 1)) = ((1 + w) * ξ) * (2 * M ^ 2 + 5 * M + 1) := by ring rw [hmul, hlin]; unfold xiA; field_simp [ne_of_gt hQa] have hrew_a : (ξ * (M + 1) - M) / (ξ * (M + 1)) = (Nxi * (M + 1) - Dxi * M) / (Nxi * (M + 1)) := by rw [hξ_eq, div_eq_div_iff (by positivity) (by positivity)] field_simp [ne_of_gt hDxi] have hrew_b : 1 / (M + 1) = Nxi / (Nxi * (M + 1)) := by rw [div_eq_div_iff (ne_of_gt hM1) (by positivity)]; ring rw [hrew_a, hrew_b, hξ_eq] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < Dxi ^ 2 * (Nxi * (M + 1)) ^ 2) rw [polyDefect2_div2 M Nxi Dxi (Nxi * (M + 1) - Dxi * M) Nxi (Nxi * (M + 1)) (ne_of_gt hDxi) (by positivity)] dsimp only [Nxi, Dxi] set s := M - 1; have hs : 0 ≤ s := by linarith have hM_eq : M = 1 + s := by dsimp only [s]; ring rw [hM_eq] have h0 := regAV4_c0_nonneg hs have h1 := regAV4_c1_nonneg hs have h2 := regAV4_c2_nonneg hs have h3 := regAV4_c3_nonneg hs have h4 := regAV4_c4_nonneg hs have h5 := regAV4_c5_nonneg hs have h6 := regAV4_c6_nonneg hs refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ regAV4_c s 0 + regAV4_c s 1 * w + regAV4_c s 2 * w ^ 2 + regAV4_c s 3 * w ^ 3 + regAV4_c s 4 * w ^ 4 + regAV4_c s 5 * w ^ 5 + regAV4_c s 6 * w ^ 6) ?_ unfold regAV4_c; dsimp only rw [← polyDefect2W_expand] ring private def regBV3_c (s : ℝ) (k : Fin 7) : ℝ := let M := 1 + s let C1 := (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * s ^ 2) * (M ^ 4 + 1) let C2 := M * (M + 2) ^ 2 * (M ^ 4 + 1) let C3 := M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) let Qa := 2 * M ^ 2 + 5 * M + 1 let Da := 2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1 let Db := M ^ 3 + 5 * M ^ 2 + 8 * M + 2 let n0 := M * (2 * (M + 1) ^ 2); let n1 := M * Qa let d0 := Qa; let d1 := Qa let s0 := (2 * (M + 1) ^ 2) * Da * (Qa * Db); let s1 := (2 * (M + 1) ^ 2) * Da * (Qa * Db) + Qa * Da * (Qa * Db); let s2 := Qa * Da * (Qa * Db) let p0 := 2 * M * (M + 1) * (M * (2 * (M + 1) ^ 2) + Qa) * (Qa * Db); let p1 := 2 * M * (M + 1) * ((M * (2 * (M + 1) ^ 2) + Qa) * (Qa * Db) + (M * Qa + Qa) * (Qa * Db)); let p2 := 2 * M * (M + 1) * (M * Qa + Qa) * (Qa * Db) let q0 := (M * (M + 3) * Qa + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * (2 * (M + 1) ^ 2 * Da); let q1 := (M * (M + 3) * Qa + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * (Qa * Da) + (M * (M + 3) * Qa + 2 * (M + 1) * Qa) * (2 * (M + 1) ^ 2 * Da); let q2 := (M * (M + 3) * Qa + 2 * (M + 1) * Qa) * (Qa * Da) let _ := (Qa, Da, Db) polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 k private lemma regBV3_c0_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV3_c s 0 := by unfold regBV3_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 446542381056 * s ^ 2 + 6886627737600 * s ^ 3 + 51299845931008 * s ^ 4 + 245858598649856 * s ^ 5 + 851849539362816 * s ^ 6 + 2273047924795392 * s ^ 7 + 4858627714822912 * s ^ 8 + 8542814555616768 * s ^ 9 + 12590264607369216 * s ^ 10 + 15768074252389248 * s ^ 11 + 16953469666498928 * s ^ 12 + 15767717509032256 * s ^ 13 + 12756448786523544 * s ^ 14 + 9012744714188712 * s ^ 15 + 5575351132196208 * s ^ 16 + 3023938890179112 * s ^ 17 + 1438377822518384 * s ^ 18 + 599536210324040 * s ^ 19 + 218556229805288 * s ^ 20 + 69464488681512 * s ^ 21 + 19163637386904 * s ^ 22 + 4561227085360 * s ^ 23 + 929161444824 * s ^ 24 + 160292047088 * s ^ 25 + 23090623488 * s ^ 26 + 2725075648 * s ^ 27 + 256522720 * s ^ 28 + 18515008 * s ^ 29 + 961792 * s ^ 30 + 32000 * s ^ 31 + 512 * s ^ 32) (by ring) private lemma regBV3_c1_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV3_c s 1 := by unfold regBV3_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 2263716200448 * s ^ 2 + 35065757171712 * s ^ 3 + 262231257251840 * s ^ 4 + 1261047763042304 * s ^ 5 + 4382156204015616 * s ^ 6 + 11722796626454528 * s ^ 7 + 25111461903783680 * s ^ 8 + 44233627274247872 * s ^ 9 + 65291326477682752 * s ^ 10 + 81876729461291280 * s ^ 11 + 88126603496457936 * s ^ 12 + 82034951350975032 * s ^ 13 + 66414395671979472 * s ^ 14 + 46947675966803888 * s ^ 15 + 29051848408445936 * s ^ 16 + 15759163219372096 * s ^ 17 + 7495437255562572 * s ^ 18 + 3123182158058144 * s ^ 19 + 1137847589761104 * s ^ 20 + 361318149397560 * s ^ 21 + 99555039994140 * s ^ 22 + 23657174926856 * s ^ 23 + 4809402264088 * s ^ 24 + 827635770664 * s ^ 25 + 118873543856 * s ^ 26 + 13980804848 * s ^ 27 + 1310849056 * s ^ 28 + 94184832 * s ^ 29 + 4867584 * s ^ 30 + 161024 * s ^ 31 + 2560 * s ^ 32) (by ring) private lemma regBV3_c2_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV3_c s 2 := by unfold regBV3_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 4601117933568 * s ^ 2 + 71609402523648 * s ^ 3 + 537710366818304 * s ^ 4 + 2594891197448192 * s ^ 5 + 9044101444657152 * s ^ 6 + 24254289430095872 * s ^ 7 + 52062466835136512 * s ^ 8 + 91863508002478240 * s ^ 9 + 135784992697745676 * s ^ 10 + 170472379084598896 * s ^ 11 + 183657583571335406 * s ^ 12 + 171094049310965106 * s ^ 13 + 138601381111643860 * s ^ 14 + 98022924690783874 * s ^ 15 + 60678179400817580 * s ^ 16 + 32920556424275414 * s ^ 17 + 15657590427069622 * s ^ 18 + 6522635138402754 * s ^ 19 + 2375166913253342 * s ^ 20 + 753618254319608 * s ^ 21 + 207407148650602 * s ^ 22 + 49209510663668 * s ^ 23 + 9984115163816 * s ^ 24 + 1713865983440 * s ^ 25 + 245419756824 * s ^ 26 + 28760211552 * s ^ 27 + 2685213248 * s ^ 28 + 191993152 * s ^ 29 + 9867136 * s ^ 30 + 324352 * s ^ 31 + 5120 * s ^ 32) (by ring) private lemma regBV3_c3_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV3_c s 3 := by unfold regBV3_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 4698157350912 * s ^ 2 + 73507761291264 * s ^ 3 + 554445131743232 * s ^ 4 + 2685631131287552 * s ^ 5 + 9388769805828096 * s ^ 6 + 25239549702522880 * s ^ 7 + 54280014810090752 * s ^ 8 + 95916486679087904 * s ^ 9 + 141935089967330812 * s ^ 10 + 178348502399710760 * s ^ 11 + 192275160960920094 * s ^ 12 + 179223234918035524 * s ^ 13 + 145256250299564370 * s ^ 14 + 102771641905859608 * s ^ 15 + 63639389094635777 * s ^ 16 + 34535735643689746 * s ^ 17 + 16427768396875174 * s ^ 18 + 6843068790666900 * s ^ 19 + 2491105133860903 * s ^ 20 + 789925987308900 * s ^ 21 + 217186201076494 * s ^ 22 + 51456044998962 * s ^ 23 + 10419577076932 * s ^ 24 + 1784079725364 * s ^ 25 + 254658111464 * s ^ 26 + 29725878880 * s ^ 27 + 2762297152 * s ^ 28 + 196404032 * s ^ 29 + 10028160 * s ^ 30 + 327168 * s ^ 31 + 5120 * s ^ 32) (by ring) private lemma regBV3_c4_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV3_c s 4 := by unfold regBV3_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 2426790739968 * s ^ 2 + 38225024385024 * s ^ 3 + 289887775883264 * s ^ 4 + 1410140525035520 * s ^ 5 + 4945490264350720 * s ^ 6 + 13325033546928128 * s ^ 7 + 28700060343790976 * s ^ 8 + 50761568746392768 * s ^ 9 + 75152959672135426 * s ^ 10 + 94454950286085210 * s ^ 11 + 101840927441868490 * s ^ 12 + 94936006056928486 * s ^ 13 + 76954925320243774 * s ^ 14 + 54460905604955634 * s ^ 15 + 33735995891462101 * s ^ 16 + 18315703050613192 * s ^ 17 + 8716135680890842 * s ^ 18 + 3632042272430224 * s ^ 19 + 1322402057609937 * s ^ 20 + 419270027348974 * s ^ 21 + 115208571358418 * s ^ 22 + 27263832061916 * s ^ 23 + 5510549193676 * s ^ 24 + 941008797964 * s ^ 25 + 133830793448 * s ^ 26 + 15548207824 * s ^ 27 + 1436258592 * s ^ 28 + 101376320 * s ^ 29 + 5130624 * s ^ 30 + 165632 * s ^ 31 + 2560 * s ^ 32) (by ring) private lemma regBV3_c5_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV3_c s 5 := by unfold regBV3_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 524254445568 * s ^ 2 + 8355355557888 * s ^ 3 + 63924413136896 * s ^ 4 + 312865222688768 * s ^ 5 + 1101393105944576 * s ^ 6 + 2972880123170816 * s ^ 7 + 6404400367874816 * s ^ 8 + 11316460427896032 * s ^ 9 + 16725575489062656 * s ^ 10 + 20978707919312812 * s ^ 11 + 22574506803022210 * s ^ 12 + 21010052902929200 * s ^ 13 + 17013338547613782 * s ^ 14 + 12036672706580772 * s ^ 15 + 7459406853234759 * s ^ 16 + 4054242111472994 * s ^ 17 + 1932408536732094 * s ^ 18 + 806725198124284 * s ^ 19 + 294255796676741 * s ^ 20 + 93431295150952 * s ^ 21 + 25693758440486 * s ^ 22 + 6079059659498 * s ^ 23 + 1226785160324 * s ^ 24 + 208815782804 * s ^ 25 + 29542301448 * s ^ 26 + 3406054864 * s ^ 27 + 311369760 * s ^ 28 + 21679040 * s ^ 29 + 1078144 * s ^ 30 + 34048 * s ^ 31 + 512 * s ^ 32) (by ring) private lemma regBV3_c6_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV3_c s 6 := by unfold regBV3_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 11676942336 * s ^ 2 + 207819374592 * s ^ 3 + 1702813499392 * s ^ 4 + 8653795885056 * s ^ 5 + 30877867417600 * s ^ 6 + 82855550328832 * s ^ 7 + 174722187998848 * s ^ 8 + 298683076744032 * s ^ 9 + 423774956825902 * s ^ 10 + 508536157241498 * s ^ 11 + 524290580697416 * s ^ 12 + 470466295013908 * s ^ 13 + 371229300746446 * s ^ 14 + 259415569316048 * s ^ 15 + 161117931840583 * s ^ 16 + 88942609467118 * s ^ 17 + 43510258690992 * s ^ 18 + 18762525692310 * s ^ 19 + 7083319630181 * s ^ 20 + 2322661507318 * s ^ 21 + 655642115196 * s ^ 22 + 157709774372 * s ^ 23 + 31938699028 * s ^ 24 + 5364450340 * s ^ 25 + 732783008 * s ^ 26 + 79243568 * s ^ 27 + 6521408 * s ^ 28 + 383424 * s ^ 29 + 14336 * s ^ 30 + 256 * s ^ 31) (by ring) lemma polyDefect2_regB_V3 {M ξ : ℝ} (hM : 1 ≤ M) (hξA : xiA M ≤ ξ) (hξM : ξ ≤ M) : 0 ≤ polyDefect2 M ξ (2 * M ^ 2 * (M + 1) * (ξ + 1) / (ξ * (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1))) ((M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2))) := by have hQa : 0 < 2 * M ^ 2 + 5 * M + 1 := by positivity have hDa : 0 < 2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1 := by positivity have hDb : 0 < M ^ 3 + 5 * M ^ 2 + 8 * M + 2 := by positivity have hM0 : 0 < M := by linarith by_cases htop : ξ = M · subst ξ have hrew_a : 2 * M ^ 2 * (M + 1) * (M + 1) / (M * (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1)) = (2 * M * (M + 1) ^ 2 * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) / ((2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) := by rw [div_eq_div_iff (ne_of_gt (by positivity)) (ne_of_gt (by positivity))]; ring have hrew_b : (M ^ 2 * (M + 3) + 2 * (M + 1) * M) / (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) = ((M ^ 2 + 5 * M + 2) * (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1)) / ((2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) := by rw [div_eq_div_iff (ne_of_gt (by positivity)) (ne_of_gt (by positivity))]; ring rw [hrew_a, hrew_b] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < ((2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) ^ 2) rw [polyDefect2_div M M _ _ _ (by positivity)] set s := M - 1; have hs : 0 ≤ s := by linarith rw [show M = 1 + s by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 44544 * s ^ 2 + 492096 * s ^ 3 + 2261614 * s ^ 4 + 6021138 * s ^ 5 + 10696360 * s ^ 6 + 13795804 * s ^ 7 + 13759006 * s ^ 8 + 11176680 * s ^ 9 + 7671887 * s ^ 10 + 4503386 * s ^ 11 + 2228724 * s ^ 12 + 902750 * s ^ 13 + 289229 * s ^ 14 + 70706 * s ^ 15 + 12632 * s ^ 16 + 1548 * s ^ 17 + 116 * s ^ 18 + 4 * s ^ 19) (by ring) · have hlt : ξ < M := lt_of_le_of_ne hξM htop set w := (ξ - xiA M) / (M - ξ) have hw : 0 ≤ w := div_nonneg (by linarith) (by linarith) set Nxi_r := 2 * (M + 1) ^ 2 + w * (2 * M ^ 2 + 5 * M + 1) set Nxi := M * Nxi_r set Dxi := (1 + w) * (2 * M ^ 2 + 5 * M + 1) have hNxi_r : 0 < Nxi_r := by dsimp only [Nxi_r]; positivity have hNxi : 0 < Nxi := by dsimp only [Nxi]; positivity have hDxi : 0 < Dxi := by dsimp only [Dxi]; positivity have hξ_eq : ξ = Nxi / Dxi := by have hgap : M - ξ ≠ 0 := by linarith rw [eq_div_iff (ne_of_gt hDxi)] dsimp only [w, Nxi, Nxi_r, Dxi]; unfold xiA field_simp [hgap, ne_of_gt hQa]; ring set Da_p := 2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1 set Db_p := M ^ 3 + 5 * M ^ 2 + 8 * M + 2 set Nb_r := M * (M + 3) * Dxi + 2 * (M + 1) * Nxi_r set Db_r := Dxi * Db_p set Dab := Nxi_r * Da_p * Db_r have hDab : 0 < Dab := by dsimp only [Dab, Da_p, Db_r, Db_p]; positivity have hrew_a : 2 * M ^ 2 * (M + 1) * (ξ + 1) / (ξ * Da_p) = (2 * M * (M + 1) * (Nxi + Dxi) * Db_r) / Dab := by rw [hξ_eq, div_eq_div_iff (by positivity) (ne_of_gt hDab)] dsimp only [Dab, Nxi, Db_r, Db_p, Da_p] field_simp [ne_of_gt hDxi] have hrew_b : (M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * Db_p) = (Nb_r * (Nxi_r * Da_p)) / Dab := by rw [hξ_eq, div_eq_div_iff (by positivity) (ne_of_gt hDab)] dsimp only [Dab, Nb_r, Nxi, Db_r, Db_p, Da_p] field_simp [ne_of_gt hDxi] change 0 ≤ polyDefect2 M ξ (2 * M ^ 2 * (M + 1) * (ξ + 1) / (ξ * Da_p)) ((M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * Db_p)) rw [hrew_a, hrew_b, hξ_eq] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < Dxi ^ 2 * Dab ^ 2) rw [polyDefect2_div2 M Nxi Dxi _ _ Dab (ne_of_gt hDxi) (ne_of_gt hDab)] set s := M - 1; have hs : 0 ≤ s := by linarith have hM_eq : M = 1 + s := by dsimp only [s]; ring have hmatch : (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) * (M ^ 4 + 1) * Nxi * Dxi * Dab * (2 * M * (M + 1) * (Nxi + Dxi) * Db_r + Nb_r * (Nxi_r * Da_p)) - M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((Nxi + Dxi) ^ 2 * Dab ^ 2 + (Nxi * (2 * M * (M + 1) * (Nxi + Dxi) * Db_r) - Dxi * (Nb_r * (Nxi_r * Da_p))) ^ 2) - M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) * ((Nxi - Dxi) ^ 2 * Dab ^ 2 + (Nxi * (2 * M * (M + 1) * (Nxi + Dxi) * Db_r) + Dxi * (Nb_r * (Nxi_r * Da_p))) ^ 2) = regBV3_c s 0 + regBV3_c s 1 * w + regBV3_c s 2 * w ^ 2 + regBV3_c s 3 * w ^ 3 + regBV3_c s 4 * w ^ 4 + regBV3_c s 5 * w ^ 5 + regBV3_c s 6 * w ^ 6 := by unfold regBV3_c; dsimp only rw [← polyDefect2W_expand, ← hM_eq] have hN : Nxi = M * (2 * (M + 1) ^ 2) + M * (2 * M ^ 2 + 5 * M + 1) * w := by dsimp only [Nxi, Nxi_r]; ring have hD : Dxi = (2 * M ^ 2 + 5 * M + 1) + (2 * M ^ 2 + 5 * M + 1) * w := by dsimp only [Dxi]; ring have hS : Dab = (2 * (M + 1) ^ 2) * Da_p * ((2 * M ^ 2 + 5 * M + 1) * Db_p) + ((2 * (M + 1) ^ 2) * Da_p * ((2 * M ^ 2 + 5 * M + 1) * Db_p) + (2 * M ^ 2 + 5 * M + 1) * Da_p * ((2 * M ^ 2 + 5 * M + 1) * Db_p)) * w + (2 * M ^ 2 + 5 * M + 1) * Da_p * ((2 * M ^ 2 + 5 * M + 1) * Db_p) * w ^ 2 := by dsimp only [Dab, Nxi_r, Db_r, Dxi]; ring have hP : 2 * M * (M + 1) * (Nxi + Dxi) * Db_r = 2 * M * (M + 1) * (M * (2 * (M + 1) ^ 2) + (2 * M ^ 2 + 5 * M + 1)) * ((2 * M ^ 2 + 5 * M + 1) * Db_p) + (2 * M * (M + 1) * ((M * (2 * (M + 1) ^ 2) + (2 * M ^ 2 + 5 * M + 1)) * ((2 * M ^ 2 + 5 * M + 1) * Db_p) + (M * (2 * M ^ 2 + 5 * M + 1) + (2 * M ^ 2 + 5 * M + 1)) * ((2 * M ^ 2 + 5 * M + 1) * Db_p))) * w + 2 * M * (M + 1) * (M * (2 * M ^ 2 + 5 * M + 1) + (2 * M ^ 2 + 5 * M + 1)) * ((2 * M ^ 2 + 5 * M + 1) * Db_p) * w ^ 2 := by dsimp only [Nxi, Nxi_r, Dxi, Db_r]; ring have hQ : Nb_r * (Nxi_r * Da_p) = (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * (2 * (M + 1) ^ 2 * Da_p) + ((M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * ((2 * M ^ 2 + 5 * M + 1) * Da_p) + (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * M ^ 2 + 5 * M + 1)) * (2 * (M + 1) ^ 2 * Da_p)) * w + (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * M ^ 2 + 5 * M + 1)) * ((2 * M ^ 2 + 5 * M + 1) * Da_p) * w ^ 2 := by dsimp only [Nb_r, Dxi, Nxi_r]; ring rw [hP, hQ, hS, hN, hD] rw [hmatch] have h0 := regBV3_c0_nonneg hs have h1 := regBV3_c1_nonneg hs have h2 := regBV3_c2_nonneg hs have h3 := regBV3_c3_nonneg hs have h4 := regBV3_c4_nonneg hs have h5 := regBV3_c5_nonneg hs have h6 := regBV3_c6_nonneg hs positivity private def regBV4_c (s : ℝ) (k : Fin 7) : ℝ := let M := 1 + s let C1 := (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * s ^ 2) * (M ^ 4 + 1) let C2 := M * (M + 2) ^ 2 * (M ^ 4 + 1) let C3 := M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) let Qa := 2 * M ^ 2 + 5 * M + 1 let Da := 2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1 let Db := M ^ 3 + 5 * M ^ 2 + 8 * M + 2 let n0 := M * (2 * (M + 1) ^ 2); let n1 := M * Qa let d0 := Qa; let d1 := Qa let s0 := M * (2 * (M + 1) ^ 2) * (Qa * Db); let s1 := M * (2 * (M + 1) ^ 2) * (Qa * Db) + M * Qa * (Qa * Db); let s2 := M * Qa * (Qa * Db) let p0 := ((M * (2 * (M + 1) ^ 2) + Qa) * Db - (2 * M + 1) * (M * (M + 3) * Qa + 2 * (M + 1) * (2 * (M + 1) ^ 2))) * Qa; let p1 := ((M * (2 * (M + 1) ^ 2) + Qa) * Db - (2 * M + 1) * (M * (M + 3) * Qa + 2 * (M + 1) * (2 * (M + 1) ^ 2))) * Qa + ((M * Qa + Qa) * Db - (2 * M + 1) * (M * (M + 3) * Qa + 2 * (M + 1) * Qa)) * Qa; let p2 := ((M * Qa + Qa) * Db - (2 * M + 1) * (M * (M + 3) * Qa + 2 * (M + 1) * Qa)) * Qa let q0 := (M * (M + 3) * Qa + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * (M * (2 * (M + 1) ^ 2)); let q1 := (M * (M + 3) * Qa + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * (M * Qa) + (M * (M + 3) * Qa + 2 * (M + 1) * Qa) * (M * (2 * (M + 1) ^ 2)); let q2 := (M * (M + 3) * Qa + 2 * (M + 1) * Qa) * (M * Qa) let _ := (Qa, Da, Db) polyDefect2W_coeff C1 C2 C3 n0 n1 d0 d1 s0 s1 s2 p0 p1 p2 q0 q1 q2 k private lemma regBV4_c0_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV4_c s 0 := by unfold regBV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 2126512128 * s ^ 2 + 30090461184 * s ^ 3 + 203196645376 * s ^ 4 + 873104019456 * s ^ 5 + 2684998481664 * s ^ 6 + 6300702034688 * s ^ 7 + 11743675284864 * s ^ 8 + 17861930176640 * s ^ 9 + 22595116280304 * s ^ 10 + 24096691916816 * s ^ 11 + 21874266717264 * s ^ 12 + 17013310313832 * s ^ 13 + 11383754502072 * s ^ 14 + 6565410526056 * s ^ 15 + 3263861682208 * s ^ 16 + 1396155586868 * s ^ 17 + 512073383652 * s ^ 18 + 160162772584 * s ^ 19 + 42393763336 * s ^ 20 + 9398399460 * s ^ 21 + 1720911108 * s ^ 22 + 255359632 * s ^ 23 + 29896696 * s ^ 24 + 2654672 * s ^ 25 + 167808 * s ^ 26 + 6720 * s ^ 27 + 128 * s ^ 28) (by ring) private lemma regBV4_c1_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV4_c s 1 := by unfold regBV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 11173625856 * s ^ 2 + 158176641024 * s ^ 3 + 1068476203008 * s ^ 4 + 4591705518080 * s ^ 5 + 14119782375424 * s ^ 6 + 33126008647104 * s ^ 7 + 61718506953728 * s ^ 8 + 93826996378224 * s ^ 9 + 118626913053680 * s ^ 10 + 126443941063056 * s ^ 11 + 114726190477576 * s ^ 12 + 89191851009824 * s ^ 13 + 59653645650056 * s ^ 14 + 34388440281376 * s ^ 15 + 17085635464148 * s ^ 16 + 7302816802840 * s ^ 17 + 2675531923800 * s ^ 18 + 835567401956 * s ^ 19 + 220721509468 * s ^ 20 + 48805196472 * s ^ 21 + 8907576176 * s ^ 22 + 1316563244 * s ^ 23 + 153421928 * s ^ 24 + 13549696 * s ^ 25 + 851264 * s ^ 26 + 33856 * s ^ 27 + 640 * s ^ 28) (by ring) private lemma regBV4_c2_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV4_c s 2 := by unfold regBV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 23894949888 * s ^ 2 + 337932976128 * s ^ 3 + 2280186413056 * s ^ 4 + 9786193678336 * s ^ 5 + 30047810673920 * s ^ 6 + 70375358509440 * s ^ 7 + 130882325986780 * s ^ 8 + 198605593375716 * s ^ 9 + 250651445931012 * s ^ 10 + 266730142215290 * s ^ 11 + 241666088138366 * s ^ 12 + 187655454123482 * s ^ 13 + 125386790107064 * s ^ 14 + 72222795879565 * s ^ 15 + 35856163911137 * s ^ 16 + 15313051992270 * s ^ 17 + 5604361026874 * s ^ 18 + 1747776597541 * s ^ 19 + 460811633417 * s ^ 20 + 101637554672 * s ^ 21 + 18490551814 * s ^ 22 + 2722036200 * s ^ 23 + 315672320 * s ^ 24 + 27720016 * s ^ 25 + 1730016 * s ^ 26 + 68288 * s ^ 27 + 1280 * s ^ 28) (by ring) private lemma regBV4_c3_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV4_c s 3 := by unfold regBV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 26373783552 * s ^ 2 + 371755843584 * s ^ 3 + 2499611394048 * s ^ 4 + 10687539253248 * s ^ 5 + 32683055537664 * s ^ 6 + 76222423538880 * s ^ 7 + 141139205793912 * s ^ 8 + 213245295068808 * s ^ 9 + 268022450125872 * s ^ 10 + 284152389722190 * s ^ 11 + 256624466484208 * s ^ 12 + 198749387625132 * s ^ 13 + 132531621201308 * s ^ 14 + 76224343235827 * s ^ 15 + 37800817474638 * s ^ 16 + 16128699957443 * s ^ 17 + 5897259787446 * s ^ 18 + 1836895679803 * s ^ 19 + 483493715958 * s ^ 20 + 106390112021 * s ^ 21 + 19293725882 * s ^ 22 + 2828525360 * s ^ 23 + 326314304 * s ^ 24 + 28472272 * s ^ 25 + 1763488 * s ^ 26 + 68992 * s ^ 27 + 1280 * s ^ 28) (by ring) private lemma regBV4_c4_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV4_c s 4 := by unfold regBV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 15590227968 * s ^ 2 + 218079166464 * s ^ 3 + 1454526873600 * s ^ 4 + 6165934235648 * s ^ 5 + 18685043709440 * s ^ 6 + 43164252318208 * s ^ 7 + 79152409412812 * s ^ 8 + 118440821830372 * s ^ 9 + 147496933179832 * s ^ 10 + 155059935283874 * s ^ 11 + 139019013116152 * s ^ 12 + 107029263280768 * s ^ 13 + 71050639929926 * s ^ 14 + 40737344649161 * s ^ 15 + 20162840887828 * s ^ 16 + 8593195937029 * s ^ 17 + 3139691720144 * s ^ 18 + 977222876061 * s ^ 19 + 256912247196 * s ^ 20 + 56419729955 * s ^ 21 + 10199811790 * s ^ 22 + 1488584260 * s ^ 23 + 170677176 * s ^ 24 + 14773584 * s ^ 25 + 905888 * s ^ 26 + 35008 * s ^ 27 + 640 * s ^ 28) (by ring) private lemma regBV4_c5_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV4_c s 5 := by unfold regBV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 4529848320 * s ^ 2 + 62282268672 * s ^ 3 + 407764074496 * s ^ 4 + 1694121951232 * s ^ 5 + 5023242514432 * s ^ 6 + 11336837030144 * s ^ 7 + 20286022331552 * s ^ 8 + 29604731125904 * s ^ 9 + 35968432119520 * s ^ 10 + 36943716447954 * s ^ 11 + 32443627248848 * s ^ 12 + 24552787013940 * s ^ 13 + 16087875446336 * s ^ 14 + 9143104858557 * s ^ 15 + 4502877768798 * s ^ 16 + 1915349477817 * s ^ 17 + 699828868358 * s ^ 18 + 218004728601 * s ^ 19 + 57344912862 * s ^ 20 + 12583756935 * s ^ 21 + 2268238958 * s ^ 22 + 329078812 * s ^ 23 + 37371256 * s ^ 24 + 3189968 * s ^ 25 + 191904 * s ^ 26 + 7232 * s ^ 27 + 128 * s ^ 28) (by ring) private lemma regBV4_c6_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ regBV4_c s 6 := by unfold regBV4_c polyDefect2W_coeff dsimp only refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 465567744 * s ^ 2 + 6112149504 * s ^ 3 + 37941739520 * s ^ 4 + 148134789120 * s ^ 5 + 408227562496 * s ^ 6 + 844956353792 * s ^ 7 + 1365324394736 * s ^ 8 + 1768677190208 * s ^ 9 + 1874299907924 * s ^ 10 + 1653277817220 * s ^ 11 + 1234916238850 * s ^ 12 + 795997930814 * s ^ 13 + 451957758638 * s ^ 14 + 230337320978 * s ^ 15 + 106464226411 * s ^ 16 + 44462721933 * s ^ 17 + 16494448934 * s ^ 18 + 5305564174 * s ^ 19 + 1442494339 * s ^ 20 + 323381341 * s ^ 21 + 58266304 * s ^ 22 + 8187324 * s ^ 23 + 861296 * s ^ 24 + 63664 * s ^ 25 + 2944 * s ^ 26 + 64 * s ^ 27) (by ring) lemma polyDefect2_regB_V4 {M ξ : ℝ} (hM : 1 ≤ M) (hξA : xiA M ≤ ξ) (hξM : ξ ≤ M) : let bnew := (M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) 0 ≤ polyDefect2 M ξ ((ξ + 1 - (2 * M + 1) * bnew) / ξ) bnew := by intro bnew have hQa : 0 < 2 * M ^ 2 + 5 * M + 1 := by positivity have hDb : 0 < M ^ 3 + 5 * M ^ 2 + 8 * M + 2 := by positivity have hM0 : 0 < M := by linarith by_cases htop : ξ = M · subst ξ have hrew_b : bnew = (M ^ 2 + 5 * M + 2) / (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) := by dsimp only [bnew]; rw [div_eq_div_iff (ne_of_gt (by positivity)) (ne_of_gt hDb)]; ring have hrew_a : (M + 1 - (2 * M + 1) * bnew) / M = ((M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - (2 * M + 1) * (M ^ 2 + 5 * M + 2)) / (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) := by rw [hrew_b, div_eq_div_iff (ne_of_gt hM0) (ne_of_gt (by positivity))] field_simp [ne_of_gt hDb] have hrew_b2 : bnew = (M * (M ^ 2 + 5 * M + 2)) / (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) := by rw [hrew_b, div_eq_div_iff (ne_of_gt hDb) (ne_of_gt (by positivity))]; ring rw [hrew_a, hrew_b2] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) ^ 2) rw [polyDefect2_div M M _ _ _ (by positivity)] set s := M - 1; have hs : 0 ≤ s := by linarith rw [show M = 1 + s by ring] refine le_of_le_of_eq (by positivity : (0 : ℝ) ≤ 1776 * s ^ 2 + 11328 * s ^ 3 + 31892 * s ^ 4 + 52212 * s ^ 5 + 55330 * s ^ 6 + 40502 * s ^ 7 + 22190 * s ^ 8 + 10514 * s ^ 9 + 4939 * s ^ 10 + 2145 * s ^ 11 + 710 * s ^ 12 + 154 * s ^ 13 + 19 * s ^ 14 + s ^ 15) (by ring) · have hlt : ξ < M := lt_of_le_of_ne hξM htop set w := (ξ - xiA M) / (M - ξ) have hw : 0 ≤ w := div_nonneg (by linarith) (by linarith) set Nxi_r := 2 * (M + 1) ^ 2 + w * (2 * M ^ 2 + 5 * M + 1) set Nxi := M * Nxi_r set Dxi := (1 + w) * (2 * M ^ 2 + 5 * M + 1) have hNxi_r : 0 < Nxi_r := by dsimp only [Nxi_r]; positivity have hNxi : 0 < Nxi := by dsimp only [Nxi]; positivity have hDxi : 0 < Dxi := by dsimp only [Dxi]; positivity have hξ_eq : ξ = Nxi / Dxi := by have hgap : M - ξ ≠ 0 := by linarith rw [eq_div_iff (ne_of_gt hDxi)] dsimp only [w, Nxi, Nxi_r, Dxi]; unfold xiA field_simp [hgap, ne_of_gt hQa]; ring set Db_p := M ^ 3 + 5 * M ^ 2 + 8 * M + 2 set Nb_r := M * (M + 3) * Dxi + 2 * (M + 1) * Nxi_r set Db_r := Dxi * Db_p set Dab := Nxi * Db_r have hDab : 0 < Dab := by dsimp only [Dab, Db_r, Db_p]; positivity have hrew_b : bnew = (Nb_r * Nxi) / Dab := by dsimp only [bnew] rw [hξ_eq, div_eq_div_iff (by positivity) (ne_of_gt hDab)] dsimp only [Dab, Nb_r, Nxi, Db_r, Db_p] field_simp [ne_of_gt hDxi] have hrew_a : (ξ + 1 - (2 * M + 1) * bnew) / ξ = (((Nxi + Dxi) * Db_p - (2 * M + 1) * Nb_r) * Dxi) / Dab := by rw [hrew_b, hξ_eq, div_eq_div_iff (by positivity) (ne_of_gt hDab)] dsimp only [Dab, Db_r, Db_p] field_simp [ne_of_gt hNxi, ne_of_gt hDxi, ne_of_gt hDb] rw [hrew_a, hrew_b, hξ_eq] refine nonneg_of_mul_nonneg_right ?_ (by positivity : (0 : ℝ) < Dxi ^ 2 * Dab ^ 2) rw [polyDefect2_div2 M Nxi Dxi _ _ Dab (ne_of_gt hDxi) (ne_of_gt hDab)] set s := M - 1; have hs : 0 ≤ s := by linarith have hM_eq : M = 1 + s := by dsimp only [s]; ring have hmatch : (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) * (M ^ 4 + 1) * Nxi * Dxi * Dab * ((((Nxi + Dxi) * Db_p - (2 * M + 1) * Nb_r) * Dxi) + Nb_r * Nxi) - M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((Nxi + Dxi) ^ 2 * Dab ^ 2 + (Nxi * (((Nxi + Dxi) * Db_p - (2 * M + 1) * Nb_r) * Dxi) - Dxi * (Nb_r * Nxi)) ^ 2) - M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) * ((Nxi - Dxi) ^ 2 * Dab ^ 2 + (Nxi * (((Nxi + Dxi) * Db_p - (2 * M + 1) * Nb_r) * Dxi) + Dxi * (Nb_r * Nxi)) ^ 2) = regBV4_c s 0 + regBV4_c s 1 * w + regBV4_c s 2 * w ^ 2 + regBV4_c s 3 * w ^ 3 + regBV4_c s 4 * w ^ 4 + regBV4_c s 5 * w ^ 5 + regBV4_c s 6 * w ^ 6 := by unfold regBV4_c; dsimp only rw [← polyDefect2W_expand, ← hM_eq] have hN : Nxi = M * (2 * (M + 1) ^ 2) + M * (2 * M ^ 2 + 5 * M + 1) * w := by dsimp only [Nxi, Nxi_r]; ring have hD : Dxi = (2 * M ^ 2 + 5 * M + 1) + (2 * M ^ 2 + 5 * M + 1) * w := by dsimp only [Dxi]; ring have hS : Dab = M * (2 * (M + 1) ^ 2) * ((2 * M ^ 2 + 5 * M + 1) * Db_p) + (M * (2 * (M + 1) ^ 2) * ((2 * M ^ 2 + 5 * M + 1) * Db_p) + M * (2 * M ^ 2 + 5 * M + 1) * ((2 * M ^ 2 + 5 * M + 1) * Db_p)) * w + M * (2 * M ^ 2 + 5 * M + 1) * ((2 * M ^ 2 + 5 * M + 1) * Db_p) * w ^ 2 := by dsimp only [Dab, Nxi, Nxi_r, Db_r, Dxi]; ring have hP : ((Nxi + Dxi) * Db_p - (2 * M + 1) * Nb_r) * Dxi = ((M * (2 * (M + 1) ^ 2) + (2 * M ^ 2 + 5 * M + 1)) * Db_p - (2 * M + 1) * (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * (M + 1) ^ 2))) * (2 * M ^ 2 + 5 * M + 1) + (((M * (2 * (M + 1) ^ 2) + (2 * M ^ 2 + 5 * M + 1)) * Db_p - (2 * M + 1) * (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * (M + 1) ^ 2))) * (2 * M ^ 2 + 5 * M + 1) + ((M * (2 * M ^ 2 + 5 * M + 1) + (2 * M ^ 2 + 5 * M + 1)) * Db_p - (2 * M + 1) * (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * M ^ 2 + 5 * M + 1))) * (2 * M ^ 2 + 5 * M + 1)) * w + ((M * (2 * M ^ 2 + 5 * M + 1) + (2 * M ^ 2 + 5 * M + 1)) * Db_p - (2 * M + 1) * (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * M ^ 2 + 5 * M + 1))) * (2 * M ^ 2 + 5 * M + 1) * w ^ 2 := by dsimp only [Nxi, Nxi_r, Dxi, Nb_r]; ring have hQ : Nb_r * Nxi = (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * (M * (2 * (M + 1) ^ 2)) + ((M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * (M + 1) ^ 2)) * (M * (2 * M ^ 2 + 5 * M + 1)) + (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * M ^ 2 + 5 * M + 1)) * (M * (2 * (M + 1) ^ 2))) * w + (M * (M + 3) * (2 * M ^ 2 + 5 * M + 1) + 2 * (M + 1) * (2 * M ^ 2 + 5 * M + 1)) * (M * (2 * M ^ 2 + 5 * M + 1)) * w ^ 2 := by dsimp only [Nb_r, Dxi, Nxi, Nxi_r]; ring rw [hP, hQ, hS, hN, hD] rw [hmatch] have h0 := regBV4_c0_nonneg hs have h1 := regBV4_c1_nonneg hs have h2 := regBV4_c2_nonneg hs have h3 := regBV4_c3_nonneg hs have h4 := regBV4_c4_nonneg hs have h5 := regBV4_c5_nonneg hs have h6 := regBV4_c6_nonneg hs positivity /-- Helper: an affine function `c₁ * ξ + c₀` that is `≥ 0` at `L` and `R` is `≥ 0` on `[L, R]`. -/ lemma linear_nonneg_on_Icc {c₁ c₀ L R ξ : ℝ} (hL : L ≤ ξ) (hR : ξ ≤ R) (h0 : 0 ≤ c₁ * L + c₀) (h1 : 0 ≤ c₁ * R + c₀) : 0 ≤ c₁ * ξ + c₀ := by by_cases heq : L = R · have : ξ = L := by linarith rw [this]; exact h0 · have hLR : L < R := lt_of_le_of_ne (le_trans hL hR) heq have hgap : 0 < R - L := by linarith have hident : (R - L) * (c₁ * ξ + c₀) = (R - ξ) * (c₁ * L + c₀) + (ξ - L) * (c₁ * R + c₀) := by ring refine nonneg_of_mul_nonneg_right ?_ hgap rw [hident] have : 0 ≤ R - ξ := by linarith have : 0 ≤ ξ - L := by linarith positivity lemma polyDefect2_generic_pentagon {M ξ a b aupper bfloor : ℝ} (hM : 1 ≤ M) (hξ0 : 0 < ξ) (ha_lo : 1 / (M + 1) ≤ a) (ha_hi : a ≤ aupper) (haupper_hi : aupper ≤ M / (M + 1)) (hb_lo : bfloor ≤ b) (hb_hi : b ≤ M / (M + 1)) (hcut : ξ + 1 ≤ ξ * a + (2 * M + 1) * b) (hlo_le_acut : 1 / (M + 1) ≤ (ξ + 1 - (2 * M + 1) * bfloor) / ξ) (_hacut_le_au : (ξ + 1 - (2 * M + 1) * bfloor) / ξ ≤ aupper) (hV1 : 0 ≤ polyDefect2 M ξ (M / (M + 1)) (M / (M + 1))) (hV2 : 0 ≤ polyDefect2 M ξ (1 / (M + 1)) (M / (M + 1))) (hV3 : 0 ≤ polyDefect2 M ξ aupper bfloor) (hV4 : 0 ≤ polyDefect2 M ξ ((ξ + 1 - (2 * M + 1) * bfloor) / ξ) bfloor) (hV5 : 0 ≤ polyDefect2 M ξ (1 / (M + 1)) ((M * ξ + M + 1) / ((M + 1) * (2 * M + 1)))) : 0 ≤ polyDefect2 M ξ a b := by have hM1 : 0 < M + 1 := by linarith have h2M1 : 0 < 2 * M + 1 := by linarith set lo := 1 / (M + 1) set hi := M / (M + 1) set acut := (ξ + 1 - (2 * M + 1) * bfloor) / ξ set bcut := (M * ξ + M + 1) / ((M + 1) * (2 * M + 1)) have hTop : 0 ≤ polyDefect2 M ξ a hi := by by_cases hM_eq : M = 1 · have : lo = hi := by dsimp only [lo, hi]; rw [hM_eq] have ha_eq : a = hi := by linarith rw [ha_eq]; exact hV1 · have hgap : 0 < hi - lo := by dsimp only [lo, hi]; rw [← sub_div] exact div_pos (by linarith [lt_of_le_of_ne hM (Ne.symm hM_eq)]) hM1 set t := (a - lo) / (hi - lo) have ht0 : 0 ≤ t := div_nonneg (by linarith) (le_of_lt hgap) have ht1 : t ≤ 1 := (div_le_one hgap).mpr (by linarith) have hseg := polyDefect2_segment_nonneg hM ht0 ht1 hV2 hV1 have ha_eq : (1 - t) * lo + t * hi = a := by dsimp only [t]; field_simp [ne_of_gt hgap]; ring have hb_eq : (1 - t) * hi + t * hi = hi := by ring rwa [ha_eq, hb_eq] at hseg by_cases ha_side : a ≤ acut · set bmin := (ξ + 1 - ξ * a) / (2 * M + 1) have hb_ge : bmin ≤ b := by dsimp only [bmin]; rw [div_le_iff₀ h2M1]; linarith have hbmin_le_hi : bmin ≤ hi := le_trans hb_ge hb_hi have hBot : 0 ≤ polyDefect2 M ξ a bmin := by by_cases hgap0 : acut = lo · have ha_eq : a = lo := by linarith have hb_eq : bmin = bcut := by dsimp only [bmin, bcut]; rw [ha_eq]; dsimp only [lo] field_simp [ne_of_gt hM1, ne_of_gt h2M1]; ring rw [ha_eq, hb_eq]; exact hV5 · have hgap : 0 < acut - lo := sub_pos.mpr (lt_of_le_of_ne hlo_le_acut (Ne.symm hgap0)) set t := (a - lo) / (acut - lo) have ht0 : 0 ≤ t := div_nonneg (by linarith) (le_of_lt hgap) have ht1 : t ≤ 1 := (div_le_one hgap).mpr (by linarith) have hseg := polyDefect2_segment_nonneg hM ht0 ht1 hV5 hV4 have ha_eq : (1 - t) * lo + t * acut = a := by dsimp only [t]; field_simp [ne_of_gt hgap]; ring have hb_eq : (1 - t) * bcut + t * bfloor = bmin := by have h1 : bcut - bfloor = (ξ * (acut - lo)) / (2 * M + 1) := by dsimp only [bcut, lo, acut]; field_simp [ne_of_gt hξ0, ne_of_gt hM1, ne_of_gt h2M1]; ring have h2 : bcut - bmin = (ξ * (a - lo)) / (2 * M + 1) := by dsimp only [bcut, bmin, lo]; field_simp [ne_of_gt hM1, ne_of_gt h2M1]; ring dsimp only [t] have hlin : (1 - (a - lo) / (acut - lo)) * bcut + ((a - lo) / (acut - lo)) * bfloor = bcut - ((a - lo) / (acut - lo)) * (bcut - bfloor) := by ring rw [hlin, h1] have : (a - lo) / (acut - lo) * (ξ * (acut - lo) / (2 * M + 1)) = ξ * (a - lo) / (2 * M + 1) := by field_simp [ne_of_gt hgap] rw [this]; linarith rwa [ha_eq, hb_eq] at hseg by_cases hveq : hi = bmin · have hb_eq : b = hi := by linarith rw [hb_eq]; exact hTop · have hvgap : 0 < hi - bmin := sub_pos.mpr (lt_of_le_of_ne hbmin_le_hi (Ne.symm hveq)) set s := (b - bmin) / (hi - bmin) have hs0 : 0 ≤ s := div_nonneg (by linarith) (le_of_lt hvgap) have hs1 : s ≤ 1 := (div_le_one hvgap).mpr (by linarith) have hseg := polyDefect2_segment_nonneg hM hs0 hs1 hBot hTop have ha_eq : (1 - s) * a + s * a = a := by ring have hb_eq : (1 - s) * bmin + s * hi = b := by dsimp only [s]; field_simp [ne_of_gt hvgap]; ring rwa [ha_eq, hb_eq] at hseg · push Not at ha_side have hBot : 0 ≤ polyDefect2 M ξ a bfloor := by have hgap : 0 < aupper - acut := sub_pos.mpr (lt_of_lt_of_le ha_side ha_hi) set t := (a - acut) / (aupper - acut) have ht0 : 0 ≤ t := div_nonneg (by linarith) (le_of_lt hgap) have ht1 : t ≤ 1 := (div_le_one hgap).mpr (by linarith) have hseg := polyDefect2_segment_nonneg hM ht0 ht1 hV4 hV3 have ha_eq : (1 - t) * acut + t * aupper = a := by dsimp only [t]; field_simp [ne_of_gt hgap]; ring have hb_eq : (1 - t) * bfloor + t * bfloor = bfloor := by ring rwa [ha_eq, hb_eq] at hseg by_cases hveq : hi = bfloor · have hb_eq : b = hi := by linarith rw [hb_eq]; exact hTop · have hvgap : 0 < hi - bfloor := sub_pos.mpr (lt_of_le_of_ne (le_trans hb_lo hb_hi) (Ne.symm hveq)) set s := (b - bfloor) / (hi - bfloor) have hs0 : 0 ≤ s := div_nonneg (by linarith) (le_of_lt hvgap) have hs1 : s ≤ 1 := (div_le_one hvgap).mpr (by linarith) have hseg := polyDefect2_segment_nonneg hM hs0 hs1 hBot hTop have ha_eq : (1 - s) * a + s * a = a := by ring have hb_eq : (1 - s) * bfloor + s * hi = b := by dsimp only [s]; field_simp [ne_of_gt hvgap]; ring rwa [ha_eq, hb_eq] at hseg /-- **Master Algebraic Theorem 2 (`1 ≤ ξ ≤ M`)**. -/ theorem polyDefect2_nonneg_ge_one {M ξ a b : ℝ} (hξ1 : 1 ≤ ξ) (hξM : ξ ≤ M) (ha_lo : 1 / (M + 1) ≤ a) (ha_hi : a ≤ M / (M + 1)) (hb_lo : 1 / (M + 1) ≤ b) (hb_hi : b ≤ M / (M + 1)) (hcut : ξ + 1 ≤ ξ * a + (2 * M + 1) * b) (hb2 : M ^ 2 * (M + 3) + 2 * (M + 1) * ξ ≤ M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) * b) (ha2 : (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * ξ * a ≤ 2 * M ^ 2 * (M + 1) * (ξ + 1)) : 0 ≤ polyDefect2 M ξ a b := by have hM : 1 ≤ M := le_trans hξ1 hξM have hξ0 : 0 < ξ := by linarith have hM1 : 0 < M + 1 := by linarith have hV1 := polyDefect2_V1 hξ1 hξM have hV2 := polyDefect2_V2 hξ1 hξM have hV5 := polyDefect2_V5 hξ1 hξM by_cases hreg : ξ ≤ xiA M · have hV3 := polyDefect2_regA_V3 hM hξ1 hreg have hV4 := polyDefect2_regA_V4 hM hξ1 hreg have hV4' : 0 ≤ polyDefect2 M ξ ((ξ + 1 - (2 * M + 1) * (1 / (M + 1))) / ξ) (1 / (M + 1)) := by have : (ξ + 1 - (2 * M + 1) * (1 / (M + 1))) / ξ = (ξ * (M + 1) - M) / (ξ * (M + 1)) := by field_simp [ne_of_gt hξ0, ne_of_gt hM1]; ring rwa [this] refine polyDefect2_generic_pentagon hM hξ0 ha_lo ha_hi (le_refl _) hb_lo hb_hi hcut ?_ ?_ hV1 hV2 hV3 hV4' hV5 · rw [div_le_div_iff₀ hM1 hξ0] have hrew : (ξ + 1 - (2 * M + 1) * (1 / (M + 1))) * (M + 1) - 1 * ξ = M * (ξ - 1) := by field_simp [ne_of_gt hM1]; ring have : 0 ≤ M * (ξ - 1) := by nlinarith linarith · rw [div_le_div_iff₀ hξ0 hM1] have hrew : M * ξ - (ξ + 1 - (2 * M + 1) * (1 / (M + 1))) * (M + 1) = M - ξ := by field_simp [ne_of_gt hM1]; ring linarith · push Not at hreg have hξA : xiA M ≤ ξ := le_of_lt hreg set a_new := 2 * M ^ 2 * (M + 1) * (ξ + 1) / (ξ * (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1)) set b_new := (M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) have hQa : 0 < 2 * M ^ 2 + 5 * M + 1 := by positivity have hDa : 0 < 2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1 := by positivity have hDb : 0 < M ^ 3 + 5 * M ^ 2 + 8 * M + 2 := by positivity have hM0 : 0 < M := by linarith have hMs : 0 ≤ M - 1 := by linarith have ha_le_anew : a ≤ a_new := by dsimp only [a_new]; rw [le_div_iff₀ (by positivity)]; linarith have hb_ge_bnew : b_new ≤ b := by dsimp only [b_new]; rw [div_le_iff₀ (by positivity)]; linarith have hanew_le_hi : a_new ≤ M / (M + 1) := by dsimp only [a_new] rw [div_le_div_iff₀ (by positivity) hM1] have hξA' : 2 * M * (M + 1) ^ 2 ≤ ξ * (2 * M ^ 2 + 5 * M + 1) := by unfold xiA at hξA; exact (div_le_iff₀ hQa).mp hξA have hdiff : M * (ξ * (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1)) - 2 * M ^ 2 * (M + 1) * (ξ + 1) * (M + 1) = M * (ξ * (2 * M ^ 2 + 5 * M + 1) - 2 * M * (M + 1) ^ 2) := by ring nlinarith have hlo_le_acut : 1 / (M + 1) ≤ (ξ + 1 - (2 * M + 1) * b_new) / ξ := by rw [div_le_div_iff₀ hM1 hξ0] dsimp only [b_new] set Db := M ^ 3 + 5 * M ^ 2 + 8 * M + 2 set c₁ := M ^ 2 * Db - 2 * (2 * M + 1) * (M + 1) ^ 2 set c₀ := M * (M + 1) * Db - (2 * M + 1) * (M + 1) * (M ^ 2 * (M + 3)) have hclear : M * Db * ((ξ + 1 - (2 * M + 1) * ((M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * Db))) * (M + 1) - 1 * ξ) = c₁ * ξ + c₀ := by dsimp only [c₁, c₀]; field_simp [ne_of_gt hM0, ne_of_gt hDb]; ring have hEndA : 0 ≤ c₁ * xiA M + c₀ := by refine nonneg_of_mul_nonneg_right ?_ hQa unfold xiA; dsimp only [c₁, c₀, Db] have hEq : (2 * M ^ 2 + 5 * M + 1) * ((M ^ 2 * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - 2 * (2 * M + 1) * (M + 1) ^ 2) * (2 * M * (M + 1) ^ 2 / (2 * M ^ 2 + 5 * M + 1)) + (M * (M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - (2 * M + 1) * (M + 1) * (M ^ 2 * (M + 3)))) = 112 * (M - 1) + 472 * (M - 1) ^ 2 + 846 * (M - 1) ^ 3 + 831 * (M - 1) ^ 4 + 478 * (M - 1) ^ 5 + 159 * (M - 1) ^ 6 + 28 * (M - 1) ^ 7 + 2 * (M - 1) ^ 8 := by field_simp [ne_of_gt hQa]; ring rw [hEq] positivity have hEndM : 0 ≤ c₁ * M + c₀ := by dsimp only [c₁, c₀, Db] have hEq : (M ^ 2 * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - 2 * (2 * M + 1) * (M + 1) ^ 2) * M + (M * (M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - (2 * M + 1) * (M + 1) * (M ^ 2 * (M + 3))) = 13 * (M - 1) + 45 * (M - 1) ^ 2 + 59 * (M - 1) ^ 3 + 36 * (M - 1) ^ 4 + 10 * (M - 1) ^ 5 + (M - 1) ^ 6 := by ring rw [hEq] positivity have hlin := linear_nonneg_on_Icc hξA hξM hEndA hEndM have hpos : 0 ≤ (ξ + 1 - (2 * M + 1) * ((M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * Db))) * (M + 1) - 1 * ξ := nonneg_of_mul_nonneg_right (by rw [hclear]; exact hlin) (by positivity) linarith have hacut_le_anew : (ξ + 1 - (2 * M + 1) * b_new) / ξ ≤ a_new := by dsimp only [a_new, b_new] rw [div_le_div_iff₀ hξ0 (by positivity)] set Da := 2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1 set Db := M ^ 3 + 5 * M ^ 2 + 8 * M + 2 set c₁ := 2 * M ^ 3 * (M + 1) * Db - Da * (M * Db) + Da * ((2 * M + 1) * (2 * (M + 1))) set c₀ := 2 * M ^ 3 * (M + 1) * Db - Da * (M * Db) + Da * ((2 * M + 1) * (M ^ 2 * (M + 3))) have hclear : M * Db * (2 * M ^ 2 * (M + 1) * (ξ + 1) * ξ - (ξ + 1 - (2 * M + 1) * ((M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * Db))) * (ξ * Da)) = ξ * (c₁ * ξ + c₀) := by dsimp only [c₁, c₀]; field_simp [ne_of_gt hM0, ne_of_gt hDb]; ring have hEndA : 0 ≤ c₁ * xiA M + c₀ := by refine nonneg_of_mul_nonneg_right ?_ hQa unfold xiA; dsimp only [c₁, c₀, Da, Db] have hEq : (2 * M ^ 2 + 5 * M + 1) * ((2 * M ^ 3 * (M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) + (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * ((2 * M + 1) * (2 * (M + 1)))) * (2 * M * (M + 1) ^ 2 / (2 * M ^ 2 + 5 * M + 1)) + (2 * M ^ 3 * (M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) + (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * ((2 * M + 1) * (M ^ 2 * (M + 3))))) = 128 * (M - 1) + 776 * (M - 1) ^ 2 + 1812 * (M - 1) ^ 3 + 2171 * (M - 1) ^ 4 + 1464 * (M - 1) ^ 5 + 563 * (M - 1) ^ 6 + 116 * (M - 1) ^ 7 + 10 * (M - 1) ^ 8 := by field_simp [ne_of_gt hQa]; ring rw [hEq] positivity have hEndM : 0 ≤ c₁ * M + c₀ := by dsimp only [c₁, c₀, Da, Db] have hEq : (2 * M ^ 3 * (M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) + (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * ((2 * M + 1) * (2 * (M + 1)))) * M + (2 * M ^ 3 * (M + 1) * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2) - (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * (M * (M ^ 3 + 5 * M ^ 2 + 8 * M + 2)) + (2 * M ^ 3 + 6 * M ^ 2 + 7 * M + 1) * ((2 * M + 1) * (M ^ 2 * (M + 3)))) = 16 * (M - 1) + 59 * (M - 1) ^ 2 + 85 * (M - 1) ^ 3 + 60 * (M - 1) ^ 4 + 21 * (M - 1) ^ 5 + 3 * (M - 1) ^ 6 := by ring rw [hEq] positivity have hlin := linear_nonneg_on_Icc hξA hξM hEndA hEndM have hpos : 0 ≤ 2 * M ^ 2 * (M + 1) * (ξ + 1) * ξ - (ξ + 1 - (2 * M + 1) * ((M ^ 2 * (M + 3) + 2 * (M + 1) * ξ) / (M * Db))) * (ξ * Da) := nonneg_of_mul_nonneg_right (by rw [hclear]; exact mul_nonneg (le_of_lt hξ0) hlin) (by positivity) linarith exact polyDefect2_generic_pentagon hM hξ0 ha_lo ha_le_anew hanew_le_hi hb_ge_bnew hb_hi hcut hlo_le_acut hacut_le_anew hV1 hV2 (polyDefect2_regB_V3 hM hξA hξM) (polyDefect2_regB_V4 hM hξA hξM) hV5 lemma baQ_le_QStar2_of_polyDefect2 {M ξ a b : ℝ} (hM : 1 ≤ M) (hξ : 0 < ξ) (hab : 0 < a + b) (hdef : 0 ≤ polyDefect2 M ξ a b) : baQ ξ a b (rStar M) ≤ QStar2 M := by have hr : 0 < rStar M := rStar_pos hM have hden : 0 < 2 * rStar M * ξ * (a + b) := by positivity unfold baQ rw [div_le_iff₀ hden, rStar_sq hM] have hprod : QStar2 M * (2 * rStar M * ξ * (a + b)) = (2 * rStar M * QStar2 M) * (ξ * (a + b)) := by ring rw [hprod, two_mul_rStar_mul_QStar2 hM] have hM0 : 0 < M := by linarith have hMp2 : 0 < M + 2 := by linarith have hM4 : 0 < M ^ 4 + 1 := by positivity have hclear : M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((ξ + 1) ^ 2 + (ξ * a - b) ^ 2 + (M + 1) ^ 2 * (M ^ 2 + 1) / (M ^ 4 + 1) * ((ξ - 1) ^ 2 + (ξ * a + b) ^ 2)) ≤ M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (M * (M + 2) ^ 2) * (ξ * (a + b))) := by have hL : M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((ξ + 1) ^ 2 + (ξ * a - b) ^ 2 + (M + 1) ^ 2 * (M ^ 2 + 1) / (M ^ 4 + 1) * ((ξ - 1) ^ 2 + (ξ * a + b) ^ 2)) = M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((ξ + 1) ^ 2 + (ξ * a - b) ^ 2) + M * (M + 2) ^ 2 * (M + 1) ^ 2 * (M ^ 2 + 1) * ((ξ - 1) ^ 2 + (ξ * a + b) ^ 2) := by field_simp [ne_of_gt hM4] have hR : M * (M + 2) ^ 2 * (M ^ 4 + 1) * ((4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) / (M * (M + 2) ^ 2) * (ξ * (a + b))) = (4 * (M ^ 2 + 1) * (M + 2) ^ 2 - 3 * (M - 1) ^ 2) * (M ^ 4 + 1) * ξ * (a + b) := by field_simp [ne_of_gt hM0, ne_of_gt hMp2] rw [hL, hR] unfold polyDefect2 at hdef linarith exact le_of_mul_le_mul_left hclear (by positivity) /-! ## 8. Main Theorem 2: Second-Order Universal Bound & Concrete Benchmarks -/ /-- Mirror reduction: for `hrev(t) = -h(-t)` at `(-x, y)`, `(ξ, a, b)` becomes `(1/ξ, b, a)`. -/ lemma baInvariants_neg_comp_neg {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : let hrev : ℝ → ℝ := fun t => -h (-t) baXi hrev (-x) y = 1 / baXi h x y ∧ baA hrev (-x) y = baB h x y ∧ baB hrev (-x) y = baA h x y := by intro hrev have hAp : 0 < h (x + y) - h x := sub_pos.mpr (hh.strictMono (by linarith)) have hAm : 0 < h x - h (x - y) := sub_pos.mpr (hh.strictMono (by linarith)) have h1 : -x + y = -(x - y) := by ring have h2 : -x - y = -(x + y) := by ring refine ⟨?_, ?_, ?_⟩ · unfold baXi; dsimp only [hrev] simp only [h1, h2, neg_neg] have h3 : -h (x - y) - -h x = h x - h (x - y) := by ring have h4 : -h x - -h (x + y) = h (x + y) - h x := by ring rw [h3, h4, one_div, inv_div] · unfold baA baB; dsimp only [hrev] simp only [h1, neg_neg] have h3 : -h (x - y) - -h x = h x - h (x - y) := by ring rw [h3] have hint : ∫ s in (-x)..(-(x - y)), (-h (-s) - -h x) = ∫ s in (x - y)..x, (h x - h s) := by have hc := intervalIntegral.integral_comp_neg (fun u => h x - h u) (a := (-x)) (b := -(x - y)) simp only [neg_neg] at hc have hfn : (fun s => -h (-s) - -h x) = (fun s => h x - h (-s)) := by ext s; ring rw [hfn, hc] rw [hint] · unfold baB baA; dsimp only [hrev] simp only [h2, neg_neg] have h4 : -h x - -h (x + y) = h (x + y) - h x := by ring rw [h4] have hint : ∫ s in (-(x + y))..(-x), (-h x - -h (-s)) = ∫ s in x..(x + y), (h s - h x) := by have hc := intervalIntegral.integral_comp_neg (fun u => h u - h x) (a := -(x + y)) (b := -x) simp only [neg_neg] at hc have hfn : (fun s => -h x - -h (-s)) = (fun s => h (-s) - h x) := by ext s; ring rw [hfn, hc] rw [hint] /-- **MAIN THEOREM 2 (Second-Order `[-2, 2]` Beurling–Ahlfors Dilatation Theorem)**: For EVERY `M ≥ 1`, EVERY `M`-quasisymmetric homeomorphism `h : ℝ → ℝ`, and EVERY `(x, y) ∈ ℍ`, `K(DF_{r*(M)}[h](x, y)) ≤ K**(M)`. -/ theorem beurlingAhlfors_second_order_bound {M : ℝ} {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : baDilatation h (rStar M) x y ≤ KStar2 M := by have hr : 0 < rStar M := rStar_pos hh.one_le have hK1 : 1 ≤ baDilatation h (rStar M) x y := baDilatation_ge_one hh hr hy have hadd := baDilatation_add_inv_eq hh (x := x) hr hy have hQ : baQ (baXi h x y) (baA h x y) (baB h x y) (rStar M) ≤ QStar2 M := by rcases qs_xi_bounds hh x y hy with ⟨hξ_lo, hξ_hi⟩ have hM0 : 0 < M := hh.pos_M have hξ_pos : 0 < baXi h x y := lt_of_lt_of_le (by positivity) hξ_lo have hM1 : 0 < M + 1 := by linarith [hh.one_le] by_cases h1 : 1 ≤ baXi h x y · rcases qs_a_bounds hh x y hy with ⟨ha_lo, ha_hi⟩ rcases qs_b_bounds hh x y hy with ⟨hb_lo, hb_hi⟩ have hab : 0 < baA h x y + baB h x y := by have : 0 < 1 / (M + 1) := by positivity linarith exact baQ_le_QStar2_of_polyDefect2 hh.one_le hξ_pos hab (polyDefect2_nonneg_ge_one h1 hξ_hi ha_lo ha_hi hb_lo hb_hi (qs_coupled_ineq_right hh x y hy) (qs_second_order_b_lower hh x y hy) (qs_second_order_a_upper hh x y hy)) · push Not at h1 set hrev : ℝ → ℝ := fun t => -h (-t) have hhrev : IsQuasisymmetric M hrev := hh.neg_comp_neg rcases baInvariants_neg_comp_neg hh x y hy with ⟨hξr, har, hbr⟩ rw [← baQ_inv_symm (ne_of_gt hξ_pos), ← hξr, ← har, ← hbr] have hξr1 : 1 ≤ baXi hrev (-x) y := by rw [hξr]; exact (one_le_div hξ_pos).mpr (le_of_lt h1) have hξrM : baXi hrev (-x) y ≤ M := (qs_xi_bounds hhrev (-x) y hy).2 rcases qs_a_bounds hhrev (-x) y hy with ⟨ha_lo, ha_hi⟩ rcases qs_b_bounds hhrev (-x) y hy with ⟨hb_lo, hb_hi⟩ have hab : 0 < baA hrev (-x) y + baB hrev (-x) y := by have : 0 < 1 / (M + 1) := by positivity linarith exact baQ_le_QStar2_of_polyDefect2 hh.one_le (by linarith) hab (polyDefect2_nonneg_ge_one hξr1 hξrM ha_lo ha_hi hb_lo hb_hi (qs_coupled_ineq_right hhrev (-x) y hy) (qs_second_order_b_lower hhrev (-x) y hy) (qs_second_order_a_upper hhrev (-x) y hy)) have hQ' : baDilatation h (rStar M) x y + (baDilatation h (rStar M) x y)⁻¹ ≤ QStar2 M := by rwa [hadd] exact le_of_add_inv_le hK1 hQ' /-- **Headline Strict Nesting Corollary**: for EVERY `M > 1`, `K(DF_{r*(M)}[h](x, y)) ≤ K**(M) < K*(M)`. -/ theorem beurlingAhlfors_second_order_strict {M : ℝ} (hM : 1 < M) {h : ℝ → ℝ} (hh : IsQuasisymmetric M h) (x y : ℝ) (hy : 0 < y) : baDilatation h (rStar M) x y ≤ KStar2 M ∧ KStar2 M < KStar M := ⟨beurlingAhlfors_second_order_bound hh x y hy, KStar2_lt_KStar hM⟩ /-- Concrete benchmark helper: if `Q**(M) < q` (with `2 ≤ q`), then `K**(M) < (q + √(q² - 4)) / 2`. -/ lemma KStar2_lt_of_QStar2_lt {M q K : ℝ} (hM : 1 ≤ M) (hq : QStar2 M < q) (hK : (q + Real.sqrt (q ^ 2 - 4)) / 2 ≤ K) : KStar2 M < K := by have hQ2 : 2 ≤ QStar2 M := two_le_QStar2 hM unfold KStar2 have hsq : Real.sqrt (QStar2 M ^ 2 - 4) < Real.sqrt (q ^ 2 - 4) := Real.sqrt_lt_sqrt (by nlinarith) (by nlinarith) linarith /-- **Concrete Benchmark at `M = 2`**: `K**(2) < 2.670` (strictly beating `K*(2) ≈ 2.7033`, `2 √2 ≈ 2.8284`, and Lehtinen's `2M - 1 = 3`!). -/ theorem KStar2_two_lt : KStar2 2 < 267 / 100 := by refine KStar2_lt_of_QStar2_lt (by norm_num) (q := 30445 / 10000) ?_ ?_ · unfold QStar2 have hsq : Real.sqrt (((2 : ℝ) ^ 4 + 1) / ((2 : ℝ) ^ 2 + 1)) < 184391 / 100000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith · have hsq : Real.sqrt ((30445 / 10000 : ℝ) ^ 2 - 4) < 22955 / 10000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith /-- **Concrete Benchmark at `M = 3`**: `K**(3) < 4.493` (strictly beating `K*(3) ≈ 4.5530` and `5`). -/ theorem KStar2_three_lt : KStar2 3 < 4493 / 1000 := by refine KStar2_lt_of_QStar2_lt (by norm_num) (q := 47154 / 10000) ?_ ?_ · unfold QStar2 have hsq : Real.sqrt (((3 : ℝ) ^ 4 + 1) / ((3 : ℝ) ^ 2 + 1)) < 28636 / 10000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith · have hsq : Real.sqrt ((47154 / 10000 : ℝ) ^ 2 - 4) < 42703 / 10000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith /-- **Concrete Benchmark at `M = 5`**: `K**(5) < 8.305` (strictly beating `K*(5) ≈ 8.3859` and `9`). -/ theorem KStar2_five_lt : KStar2 5 < 8305 / 1000 := by refine KStar2_lt_of_QStar2_lt (by norm_num) (q := 84251 / 10000) ?_ ?_ · unfold QStar2 have hsq : Real.sqrt (((5 : ℝ) ^ 4 + 1) / ((5 : ℝ) ^ 2 + 1)) < 490683 / 100000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith · have hsq : Real.sqrt ((84251 / 10000 : ℝ) ^ 2 - 4) < 81843 / 10000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith /-- **Concrete Benchmark at `M = 10`**: `K**(10) < 18.143` (strictly beating `K*(10) ≈ 18.2185` and `19`). -/ theorem KStar2_ten_lt : KStar2 10 < 18143 / 1000 := by refine KStar2_lt_of_QStar2_lt (by norm_num) (q := 18198 / 1000) ?_ ?_ · unfold QStar2 have hsq : Real.sqrt (((10 : ℝ) ^ 4 + 1) / ((10 : ℝ) ^ 2 + 1)) < 9951 / 1000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith · have hsq : Real.sqrt ((18198 / 1000 : ℝ) ^ 2 - 4) < 18088 / 1000 := by rw [Real.sqrt_lt' (by norm_num)]; norm_num linarith #print axioms qs_second_order_b_lower #print axioms qs_second_order_a_upper #print axioms QStar2_lt_QStar #print axioms KStar2_lt_KStar #print axioms polyDefect2_nonneg_ge_one #print axioms beurlingAhlfors_second_order_bound #print axioms beurlingAhlfors_second_order_strict #print axioms KStar2_two_lt #print axioms KStar2_three_lt #print axioms KStar2_five_lt #print axioms KStar2_ten_lt end BeurlingAhlforsSecondOrder