import Mathlib /-! # Sharp Algebraic Padé–Landen Theory of the Grötzsch Ring Modulus, # Hersch–Pfluger Distortion, and Agard–Lehto–Virtanen Linear Distortion This standalone Lean 4 formalization develops a completely self-contained, zero-complex-analysis theory of the central conformal invariants of planar quasiconformal mappings from Gauss's arithmetic–geometric mean (AGM) and Landen's transformation: 1. **Gauss AGM (`agm`) & Exact Elliptic Integral Identity**: We define the Gauss AGM iteration `(a_n, b_n)` directly, prove monotone and quadratic convergence, homogeneity, symmetry, strict monotonicity, continuity, and Landen invariance, and prove Gauss's theorem `agm a b = π / (2 * I(a, b))` via the elementary substitution `s = (t - a*b/t) / 2` together with a two-line symmetry pinch yielding the exact logarithmic asymptotic `I(1, r) ~ log(4 / r)` as `r → 0⁺`. 2. **Grötzsch Ring Modulus `μ(r)` & Master Algebraic Landen-Invariant Principle**: Defining `μ(r) = (π / 2) * agm(1, r') / agm(1, r)` (`r' = √(1 - r²)`), we prove modularity `μ(r) * μ(r') = π² / 4`, exact descending/ascending Landen laws `μ(r) = (1/2) μ(L(r)) = 2 μ(A(r))`, strict antitonicity, continuity, bijection `(0, 1) ≃ (0, ∞)`, and our **Master Algebraic Landen-Invariant Principle**: any positive profile `P` with `P(1) = 1` satisfying the purely algebraic inequality `4 P(t²)² ≥ (1 + t²)² P(2t / (1 + t²))` (resp. `≤`) yields a globally valid and Landen-monotone upper (resp. lower) bound `μ(r) ≤ log(4 P(r') / r)`. 3. **10-Rung Rational Padé–Landen Hierarchy for `μ(r)`**: Via exact positive-coefficient polynomial defect identities (zero calculus), we establish a strictly nested 10-rung rational ladder from classical Qiu–Vuorinen `[1/0]` and Anderson–Vamanamurthy–Vuorinen `[1/0]` up to our Padé `[3/2]` lower and `[2/2]` upper Landen invariants, plus the globally self-dual modularity bracket achieving `< 4.7 × 10⁻⁶` (0-step) and `< 3.5 × 10⁻¹³` (1-step Landen) relative width across all `r ∈ (0, 1)`. 4. **Hersch–Pfluger Distortion `φ_K(r)` & Linear Distortion `λ(K)`**: We define `φ_K(r) = μ⁻¹(μ(r) / K)`, prove the exact conformal group laws, modularity `φ_K(r)² + φ_{1/K}(r')² = 1`, exact `K = 2` and `K = 1/2` formulas, derivative-free monotonicity of `P*(x) = (√(1 - x²)/4) exp(μ(√(1 - x²)))`, our universal sub-unity Padé–Hersch–Pfluger bound strictly beating `4^{1 - 1/K} r^{1/K}` everywhere, exact values `λ(1) = 1` and `λ(2) = 16 + 12√2`, and the asymptotically exact two-sided sandwich `(1/16) e^{πK} - 1/2 + 5 / (4 (e^{πK} + 16)) < λ(K) < (1/16) e^{πK} - 1/2 + (5/4) e^{-πK}` for every `K ≥ 1`. -/ noncomputable section open Real Filter Topology Set MeasureTheory namespace QuasiconformalDistortion /-! ### Section 1: Gauss Arithmetic–Geometric Mean (`agm`) -/ /-- One step of Gauss's arithmetic–geometric mean iteration. -/ def agmPair (a b : ℝ) : ℕ → ℝ × ℝ | 0 => (a, b) | n + 1 => let p := agmPair a b n ((p.1 + p.2) / 2, Real.sqrt (p.1 * p.2)) /-- Arithmetic sequence `a_n` of the Gauss AGM iteration. -/ def agmA (a b : ℝ) (n : ℕ) : ℝ := (agmPair a b n).1 /-- Geometric sequence `b_n` of the Gauss AGM iteration. -/ def agmB (a b : ℝ) (n : ℕ) : ℝ := (agmPair a b n).2 @[simp] lemma agmA_zero (a b : ℝ) : agmA a b 0 = a := rfl @[simp] lemma agmB_zero (a b : ℝ) : agmB a b 0 = b := rfl lemma agmA_succ (a b : ℝ) (n : ℕ) : agmA a b (n + 1) = (agmA a b n + agmB a b n) / 2 := rfl lemma agmB_succ (a b : ℝ) (n : ℕ) : agmB a b (n + 1) = Real.sqrt (agmA a b n * agmB a b n) := rfl lemma agmPair_pos {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : ∀ n, 0 < agmA a b n ∧ 0 < agmB a b n | 0 => ⟨ha, hb⟩ | n + 1 => by obtain ⟨hA, hB⟩ := agmPair_pos ha hb n refine ⟨by rw [agmA_succ]; linarith, ?_⟩ rw [agmB_succ] exact Real.sqrt_pos.mpr (mul_pos hA hB) lemma agmA_pos {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (n : ℕ) : 0 < agmA a b n := (agmPair_pos ha hb n).1 lemma agmB_pos {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (n : ℕ) : 0 < agmB a b n := (agmPair_pos ha hb n).2 /-- AM-GM inequality in elementary form: `√(x * y) ≤ (x + y) / 2` for `x, y ≥ 0`. -/ lemma sqrt_mul_le_avg {x y : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) : Real.sqrt (x * y) ≤ (x + y) / 2 := by have hsq : Real.sqrt (x * y) ^ 2 ≤ ((x + y) / 2) ^ 2 := by rw [Real.sq_sqrt (mul_nonneg hx hy)] nlinarith [sq_nonneg (x - y)] nlinarith [Real.sqrt_nonneg (x * y)] /-- Strict AM-GM inequality when `x ≠ y` and `x, y ≥ 0`. -/ lemma sqrt_mul_lt_avg {x y : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) (hne : x ≠ y) : Real.sqrt (x * y) < (x + y) / 2 := by have hsq : Real.sqrt (x * y) ^ 2 < ((x + y) / 2) ^ 2 := by rw [Real.sq_sqrt (mul_nonneg hx hy)] have hpos : 0 < (x - y) ^ 2 := sq_pos_of_ne_zero (sub_ne_zero.mpr hne) nlinarith nlinarith [Real.sqrt_nonneg (x * y)] /-- For `n ≥ 1` (and `n = 0` when `b ≤ a`), `b_n ≤ a_n`. -/ lemma agmB_le_agmA_succ {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (n : ℕ) : agmB a b (n + 1) ≤ agmA a b (n + 1) := by rw [agmA_succ, agmB_succ] exact sqrt_mul_le_avg (le_of_lt (agmA_pos ha hb n)) (le_of_lt (agmB_pos ha hb n)) lemma agmB_le_agmA {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) : ∀ n, agmB a b n ≤ agmA a b n | 0 => hba | n + 1 => agmB_le_agmA_succ ha hb n /-- `a_n` is antitone for `b ≤ a`. -/ lemma agmA_antitone {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) : Antitone (agmA a b) := by refine antitone_nat_of_succ_le (fun n => ?_) rw [agmA_succ] linarith [agmB_le_agmA ha hb hba n] /-- `b_n` is monotone for `b ≤ a`. -/ lemma agmB_monotone {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) : Monotone (agmB a b) := by refine monotone_nat_of_le_succ (fun n => ?_) rw [agmB_succ] have hB := agmB_pos ha hb n have hle := agmB_le_agmA ha hb hba n calc agmB a b n = Real.sqrt (agmB a b n * agmB a b n) := by rw [Real.sqrt_mul_self (le_of_lt hB)] _ ≤ Real.sqrt (agmA a b n * agmB a b n) := by apply Real.sqrt_le_sqrt nlinarith /-- One-step halving bound on the AGM gap. -/ lemma agm_gap_succ_le {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) (n : ℕ) : agmA a b (n + 1) - agmB a b (n + 1) ≤ (agmA a b n - agmB a b n) / 2 := by have hB := agmB_monotone ha hb hba (Nat.le_succ n) rw [agmA_succ] linarith /-- Quadratic convergence inequality: `a_{n+1} - b_{n+1} ≤ (a_n - b_n)² / (8 b_n)`. -/ lemma agm_gap_quadratic {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) (n : ℕ) : agmA a b (n + 1) - agmB a b (n + 1) ≤ (agmA a b n - agmB a b n) ^ 2 / (8 * agmB a b n) := by set x := agmA a b n set y := agmB a b n have hx : 0 < x := agmA_pos ha hb n have hy : 0 < y := agmB_pos ha hb n have hxy : y ≤ x := agmB_le_agmA ha hb hba n have hsq : Real.sqrt (x * y) ≥ y := by calc y = Real.sqrt (y * y) := (Real.sqrt_mul_self (le_of_lt hy)).symm _ ≤ Real.sqrt (x * y) := Real.sqrt_le_sqrt (by nlinarith) have hpos_sum : 0 < (x + y) / 2 + Real.sqrt (x * y) := by linarith have hdiff_id : ((x + y) / 2 - Real.sqrt (x * y)) * ((x + y) / 2 + Real.sqrt (x * y)) = (x - y) ^ 2 / 4 := by have hmul : Real.sqrt (x * y) ^ 2 = x * y := Real.sq_sqrt (le_of_lt (mul_pos hx hy)) nlinarith have hsum_ge : 2 * y ≤ (x + y) / 2 + Real.sqrt (x * y) := by linarith rw [agmA_succ, agmB_succ, le_div_iff₀ (by linarith : 0 < 8 * y)] have hnonneg : 0 ≤ (x + y) / 2 - Real.sqrt (x * y) := by have := sqrt_mul_le_avg (le_of_lt hx) (le_of_lt hy) linarith nlinarith /-- Exponential gap bound: `a_n - b_n ≤ (a - b) / 2^n`. -/ lemma agm_gap_le {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) : ∀ n, agmA a b n - agmB a b n ≤ (a - b) / (2 : ℝ) ^ n | 0 => by simp | n + 1 => by have ih := agm_gap_le ha hb hba n have hstep := agm_gap_succ_le ha hb hba n have hpow : (2 : ℝ) ^ (n + 1) = (2 : ℝ) ^ n * 2 := by ring rw [hpow, ← div_div] linarith lemma agmPair_shift (a b : ℝ) : ∀ n, agmPair a b (n + 1) = agmPair ((a + b) / 2) (Real.sqrt (a * b)) n | 0 => rfl | n + 1 => by change (let p := agmPair a b (n + 1); ((p.1 + p.2) / 2, Real.sqrt (p.1 * p.2))) = (let p := agmPair ((a + b) / 2) (Real.sqrt (a * b)) n; ((p.1 + p.2) / 2, Real.sqrt (p.1 * p.2))) rw [agmPair_shift a b n] lemma agmA_shift (a b : ℝ) (n : ℕ) : agmA a b (n + 1) = agmA ((a + b) / 2) (Real.sqrt (a * b)) n := congrArg Prod.fst (agmPair_shift a b n) lemma agmB_shift (a b : ℝ) (n : ℕ) : agmB a b (n + 1) = agmB ((a + b) / 2) (Real.sqrt (a * b)) n := congrArg Prod.snd (agmPair_shift a b n) lemma agmPair_comm_succ (a b : ℝ) (n : ℕ) : agmPair a b (n + 1) = agmPair b a (n + 1) := by rw [agmPair_shift, agmPair_shift, add_comm a b, mul_comm a b] lemma agmPair_homog {c : ℝ} (hc : 0 ≤ c) (a b : ℝ) : ∀ n, agmPair (c * a) (c * b) n = (c * agmA a b n, c * agmB a b n) | 0 => rfl | n + 1 => by have ih := agmPair_homog hc a b n change (let p := agmPair (c * a) (c * b) n; ((p.1 + p.2) / 2, Real.sqrt (p.1 * p.2))) = (c * ((agmA a b n + agmB a b n) / 2), c * Real.sqrt (agmA a b n * agmB a b n)) rw [ih] ext · dsimp; ring · dsimp have hmul : c * agmA a b n * (c * agmB a b n) = (c * c) * (agmA a b n * agmB a b n) := by ring rw [hmul, Real.sqrt_mul (mul_nonneg hc hc), Real.sqrt_mul_self hc] lemma agmA_homog {c : ℝ} (hc : 0 ≤ c) (a b : ℝ) (n : ℕ) : agmA (c * a) (c * b) n = c * agmA a b n := congrArg Prod.fst (agmPair_homog hc a b n) lemma agmB_homog {c : ℝ} (hc : 0 ≤ c) (a b : ℝ) (n : ℕ) : agmB (c * a) (c * b) n = c * agmB a b n := congrArg Prod.snd (agmPair_homog hc a b n) lemma agmPair_self {a : ℝ} (ha : 0 ≤ a) : ∀ n, agmPair a a n = (a, a) | 0 => rfl | n + 1 => by change (let p := agmPair a a n; ((p.1 + p.2) / 2, Real.sqrt (p.1 * p.2))) = (a, a) rw [agmPair_self ha n] ext · dsimp; ring · dsimp; exact Real.sqrt_mul_self ha lemma agmPair_mono {a₁ b₁ a₂ b₂ : ℝ} (ha₁ : 0 ≤ a₁) (hb₁ : 0 ≤ b₁) (ha : a₁ ≤ a₂) (hb : b₁ ≤ b₂) : ∀ n, agmA a₁ b₁ n ≤ agmA a₂ b₂ n ∧ agmB a₁ b₁ n ≤ agmB a₂ b₂ n | 0 => ⟨ha, hb⟩ | n + 1 => by obtain ⟨hA, hB⟩ := agmPair_mono ha₁ hb₁ ha hb n have hA1 : 0 ≤ agmA a₁ b₁ n := by clear hA hB induction n with | zero => exact ha₁ | succ k ih => rw [agmA_succ] have hBk : 0 ≤ agmB a₁ b₁ k := by cases k with | zero => exact hb₁ | succ m => rw [agmB_succ]; exact Real.sqrt_nonneg _ linarith have hB1 : 0 ≤ agmB a₁ b₁ n := by cases n with | zero => exact hb₁ | succ m => rw [agmB_succ]; exact Real.sqrt_nonneg _ refine ⟨?_, ?_⟩ · rw [agmA_succ, agmA_succ]; linarith · rw [agmB_succ, agmB_succ] exact Real.sqrt_le_sqrt (mul_le_mul hA hB hB1 (le_trans hA1 hA)) /-- Gauss's arithmetic–geometric mean `AGM(a, b)`. -/ def agm (a b : ℝ) : ℝ := limUnder atTop (agmA a b) lemma agmA_tendsto_of_le {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) : Tendsto (agmA a b) atTop (nhds (agm a b)) := by have hbdd : BddBelow (range (agmA a b)) := by refine ⟨b, ?_⟩ rintro _ ⟨n, rfl⟩ exact le_trans (agmB_monotone ha hb hba (Nat.zero_le n)) (agmB_le_agmA ha hb hba n) have hconv := tendsto_atTop_ciInf (agmA_antitone ha hb hba) hbdd have hlim : agm a b = ⨅ n, agmA a b n := hconv.limUnder_eq rw [hlim] exact hconv lemma agmA_tendsto {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : Tendsto (agmA a b) atTop (nhds (agm a b)) := by have h1a : 0 < (a + b) / 2 := by linarith have h1b : 0 < Real.sqrt (a * b) := Real.sqrt_pos.mpr (mul_pos ha hb) have h1le : Real.sqrt (a * b) ≤ (a + b) / 2 := sqrt_mul_le_avg (le_of_lt ha) (le_of_lt hb) have hshift := agmA_tendsto_of_le h1a h1b h1le have hconv : Tendsto (fun n => agmA a b (n + 1)) atTop (nhds (agm ((a + b) / 2) (Real.sqrt (a * b)))) := by simpa only [agmA_shift] using hshift have hconv0 : Tendsto (agmA a b) atTop (nhds (agm ((a + b) / 2) (Real.sqrt (a * b)))) := (tendsto_add_atTop_iff_nat 1).mp hconv have hlim : agm a b = agm ((a + b) / 2) (Real.sqrt (a * b)) := hconv0.limUnder_eq rw [hlim] exact hconv0 lemma agm_step_eq {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : agm a b = agm ((a + b) / 2) (Real.sqrt (a * b)) := by have h0 := agmA_tendsto ha hb have h1 : Tendsto (fun n => agmA a b (n + 1)) atTop (nhds (agm a b)) := (tendsto_add_atTop_iff_nat 1).mpr h0 have h2 : Tendsto (fun n => agmA a b (n + 1)) atTop (nhds (agm ((a + b) / 2) (Real.sqrt (a * b)))) := by simpa only [agmA_shift] using agmA_tendsto (by linarith : 0 < (a + b) / 2) (Real.sqrt_pos.mpr (mul_pos ha hb)) exact tendsto_nhds_unique h1 h2 lemma agmB_tendsto {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : Tendsto (agmB a b) atTop (nhds (agm a b)) := by suffices h : Tendsto (fun n => agmB a b (n + 1)) atTop (nhds (agm a b)) from (tendsto_add_atTop_iff_nat 1).mp h rw [agm_step_eq ha hb] set a₁ := (a + b) / 2 set b₁ := Real.sqrt (a * b) have ha₁ : 0 < a₁ := by positivity have hb₁ : 0 < b₁ := Real.sqrt_pos.mpr (mul_pos ha hb) have hle : b₁ ≤ a₁ := sqrt_mul_le_avg (le_of_lt ha) (le_of_lt hb) have hA := agmA_tendsto ha₁ hb₁ have hgap : Tendsto (fun n => agmA a₁ b₁ n - agmB a₁ b₁ n) atTop (nhds 0) := by refine squeeze_zero (fun n => sub_nonneg.mpr (agmB_le_agmA ha₁ hb₁ hle n)) (fun n => agm_gap_le ha₁ hb₁ hle n) ?_ have hpow : Tendsto (fun n : ℕ => ((1 / 2 : ℝ) ^ n)) atTop (nhds 0) := tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num) (by norm_num) have hmul := hpow.const_mul (a₁ - b₁) rw [mul_zero] at hmul refine hmul.congr (fun n => ?_) rw [one_div, inv_pow, div_eq_mul_inv] have hsub := hA.sub hgap rw [sub_zero] at hsub refine hsub.congr (fun n => ?_) rw [agmB_shift] ring lemma agm_comm {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : agm a b = agm b a := by rw [agm_step_eq ha hb, agm_step_eq hb ha, add_comm a b, mul_comm a b] lemma agm_self {a : ℝ} (ha : 0 < a) : agm a a = a := by have h : agmA a a = fun _ => a := funext (fun n => congrArg Prod.fst (agmPair_self (le_of_lt ha) n)) have ht := agmA_tendsto ha ha rw [h] at ht exact tendsto_nhds_unique ht tendsto_const_nhds lemma agm_homog {c a b : ℝ} (hc : 0 < c) (ha : 0 < a) (hb : 0 < b) : agm (c * a) (c * b) = c * agm a b := by have h1 := agmA_tendsto (mul_pos hc ha) (mul_pos hc hb) have h2 := (agmA_tendsto ha hb).const_mul c have heq : agmA (c * a) (c * b) = fun n => c * agmA a b n := funext (fun n => agmA_homog (le_of_lt hc) a b n) rw [heq] at h1 exact tendsto_nhds_unique h1 h2 lemma agmB_le_agm {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) (n : ℕ) : agmB a b n ≤ agm a b := ge_of_tendsto (agmB_tendsto ha hb) (eventually_atTop.mpr ⟨n, fun _ hm => agmB_monotone ha hb hba hm⟩) lemma agm_le_agmA {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (hba : b ≤ a) (n : ℕ) : agm a b ≤ agmA a b n := le_of_tendsto (agmA_tendsto ha hb) (eventually_atTop.mpr ⟨n, fun _ hm => agmA_antitone ha hb hba hm⟩) lemma agm_pos {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : 0 < agm a b := by rw [agm_step_eq ha hb] have ha₁ : 0 < (a + b) / 2 := by linarith have hb₁ : 0 < Real.sqrt (a * b) := Real.sqrt_pos.mpr (mul_pos ha hb) exact lt_of_lt_of_le hb₁ (agmB_le_agm ha₁ hb₁ (sqrt_mul_le_avg (le_of_lt ha) (le_of_lt hb)) 0) lemma min_le_agm {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : min a b ≤ agm a b := by rcases le_total b a with hba | hab · rw [min_eq_right hba]; exact agmB_le_agm ha hb hba 0 · rw [min_eq_left hab, agm_comm ha hb]; exact agmB_le_agm hb ha hab 0 lemma agm_le_max {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : agm a b ≤ max a b := by rcases le_total b a with hba | hab · rw [max_eq_left hba]; exact agm_le_agmA ha hb hba 0 · rw [max_eq_right hab, agm_comm ha hb]; exact agm_le_agmA hb ha hab 0 lemma agm_mono {a₁ b₁ a₂ b₂ : ℝ} (ha₁ : 0 < a₁) (hb₁ : 0 < b₁) (ha : a₁ ≤ a₂) (hb : b₁ ≤ b₂) : agm a₁ b₁ ≤ agm a₂ b₂ := by have ha₂ : 0 < a₂ := lt_of_lt_of_le ha₁ ha have hb₂ : 0 < b₂ := lt_of_lt_of_le hb₁ hb exact le_of_tendsto_of_tendsto (agmA_tendsto ha₁ hb₁) (agmA_tendsto ha₂ hb₂) (Eventually.of_forall (fun n => (agmPair_mono (le_of_lt ha₁) (le_of_lt hb₁) ha hb n).1)) /-- Strict monotonicity in the second argument (using one AGM step!). -/ lemma agm_strictMono_right {a b₁ b₂ : ℝ} (ha : 0 < a) (hb₁ : 0 < b₁) (h : b₁ < b₂) : agm a b₁ < agm a b₂ := by have hb₂ : 0 < b₂ := lt_trans hb₁ h have hratio : Real.sqrt (b₁ / b₂) < 1 := by rw [Real.sqrt_lt' zero_lt_one, one_pow] exact (div_lt_one hb₂).mpr h have hscale : agm a b₁ ≤ agm (a * Real.sqrt (b₂ / b₁)) (b₁ * Real.sqrt (b₂ / b₁)) := by have hge1 : 1 ≤ Real.sqrt (b₂ / b₁) := by rw [Real.le_sqrt (by norm_num) (by positivity), one_pow] exact (one_le_div hb₁).mpr (le_of_lt h) exact agm_mono ha hb₁ (by nlinarith) (by nlinarith) -- Direct sharp comparison via 1 AGM step + homogeneity: -- Let c = √(b₁ / b₂) < 1. Wait: c * a < a and c * b₂ = √(b₁ b₂) > b₁? Better: -- Compare agm a b₁ vs agm (c * a) (c * b₂) where c := min (1) ... Actually use -- c = ((a + b₁)/(a + b₂)) < 1? No, check: -- Take c := (a + b₁) / (a + b₂) ? No, even simpler: -- Let t := min ((a + b₁) / (a + b₂)) (Real.sqrt (b₁ / b₂))? Wait: -- In 1 step: a₁' = (a + b₁)/2 < (a + b₂)/2 = a₂' AND b₁' = √(a b₁) < √(a b₂) = b₂'! -- Both coordinates are STRICTLY smaller! So choose c = max (a₁'/a₂') (b₁'/b₂') < 1! set a₁ := (a + b₁) / 2 set b₁' := Real.sqrt (a * b₁) set a₂ := (a + b₂) / 2 set b₂' := Real.sqrt (a * b₂) have ha₁ : 0 < a₁ := by positivity have hb₁' : 0 < b₁' := Real.sqrt_pos.mpr (mul_pos ha hb₁) have ha₂ : 0 < a₂ := by positivity have hb₂' : 0 < b₂' := Real.sqrt_pos.mpr (mul_pos ha hb₂) have hltA : a₁ < a₂ := by simp only [a₁, a₂]; linarith have hltB : b₁' < b₂' := Real.sqrt_lt_sqrt (le_of_lt (mul_pos ha hb₁)) (by nlinarith) set c := max (a₁ / a₂) (b₁' / b₂') have hc_pos : 0 < c := lt_of_lt_of_le (div_pos ha₁ ha₂) (le_max_left _ _) have hc_lt1 : c < 1 := max_lt ((div_lt_one ha₂).mpr hltA) ((div_lt_one hb₂').mpr hltB) have hleA : a₁ ≤ c * a₂ := by calc a₁ = (a₁ / a₂) * a₂ := (div_mul_cancel₀ a₁ (ne_of_gt ha₂)).symm _ ≤ c * a₂ := mul_le_mul_of_nonneg_right (le_max_left _ _) (le_of_lt ha₂) have hleB : b₁' ≤ c * b₂' := by calc b₁' = (b₁' / b₂') * b₂' := (div_mul_cancel₀ b₁' (ne_of_gt hb₂')).symm _ ≤ c * b₂' := mul_le_mul_of_nonneg_right (le_max_right _ _) (le_of_lt hb₂') rw [agm_step_eq ha hb₁, agm_step_eq ha hb₂] calc agm a₁ b₁' ≤ agm (c * a₂) (c * b₂') := agm_mono ha₁ hb₁' hleA hleB _ = c * agm a₂ b₂' := agm_homog hc_pos ha₂ hb₂' _ < 1 * agm a₂ b₂' := mul_lt_mul_of_pos_right hc_lt1 (agm_pos ha₂ hb₂') _ = agm a₂ b₂' := one_mul _ /-- Continuity of `agm 1 x` on `(0, ∞)`. -/ lemma agm_continuousOn_Ioi : ContinuousOn (fun x => agm 1 x) (Ioi 0) := by intro x hx have hx0 : 0 < x := hx rw [Metric.continuousWithinAt_iff] intro ε hε -- For any y > 0 with |y - x| < δ, we use homogeneity: -- if y ≥ x, agm 1 x ≤ agm 1 y ≤ (y/x) agm 1 x, so |agm 1 y - agm 1 x| ≤ ((y - x)/x) * agm 1 x! -- if y ≤ x, (y/x) agm 1 x ≤ agm 1 y ≤ agm 1 x, so |agm 1 y - agm 1 x| ≤ ((x - y)/x) * agm 1 x! -- WAIT: THAT'S A 5-LINE LIPSCHITZ PROOF WITH ZERO UNIFORM CONVERGENCE NEEDED!! have hMx : 0 < agm 1 x := agm_pos zero_lt_one hx0 refine ⟨min (x / 2) (ε * x / (2 * agm 1 x)), by positivity, fun y hy hdist => ?_⟩ have hy0 : 0 < y := hy have hdy : |y - x| < ε * x / (2 * agm 1 x) := lt_of_lt_of_le hdist (min_le_right _ _) rw [Real.dist_eq] rcases le_total x y with hxy | hyx · have hge : agm 1 x ≤ agm 1 y := agm_mono zero_lt_one hx0 le_rfl hxy have hle : agm 1 y ≤ (y / x) * agm 1 x := by rw [← agm_homog (div_pos hy0 hx0) zero_lt_one hx0, mul_one, div_mul_cancel₀ _ (ne_of_gt hx0)] exact agm_mono zero_lt_one hy0 ((one_le_div hx0).mpr hxy) le_rfl rw [abs_of_nonneg (sub_nonneg.mpr hge)] have h1 : agm 1 y - agm 1 x ≤ ((y - x) / x) * agm 1 x := by have : (y / x) * agm 1 x - agm 1 x = ((y - x) / x) * agm 1 x := by field_simp linarith have h2 : y - x < ε * x / (2 * agm 1 x) := by rwa [abs_of_nonneg (sub_nonneg.mpr hxy)] at hdy have h3 : ((y - x) / x) * agm 1 x < ε / 2 := by rw [div_mul_eq_mul_div, div_lt_iff₀ hx0] have h2' := (lt_div_iff₀ (by positivity : 0 < 2 * agm 1 x)).mp h2 nlinarith linarith · have hle : agm 1 y ≤ agm 1 x := agm_mono zero_lt_one hy0 le_rfl hyx have hge : (y / x) * agm 1 x ≤ agm 1 y := by rw [← agm_homog (div_pos hy0 hx0) zero_lt_one hx0, mul_one, div_mul_cancel₀ _ (ne_of_gt hx0)] exact agm_mono (div_pos hy0 hx0) hy0 ((div_le_one hx0).mpr hyx) le_rfl rw [abs_of_nonpos (sub_nonpos.mpr hle), neg_sub] have h1 : agm 1 x - agm 1 y ≤ ((x - y) / x) * agm 1 x := by have : agm 1 x - (y / x) * agm 1 x = ((x - y) / x) * agm 1 x := by field_simp linarith have h2 : x - y < ε * x / (2 * agm 1 x) := by rwa [abs_of_nonpos (sub_nonpos.mpr hyx), neg_sub] at hdy have h3 : ((x - y) / x) * agm 1 x < ε / 2 := by rw [div_mul_eq_mul_div, div_lt_iff₀ hx0] have h2' := (lt_div_iff₀ (by positivity : 0 < 2 * agm 1 x)).mp h2 nlinarith linarith /-! ### Section 2: Gauss's Elliptic Integral Identity `agm a b = π / (2 * I(a, b))` & Symmetry Pinch -/ /-- The elliptic integrand `((t² + a²)(t² + b²))⁻¹/²`. -/ def ellipIntegrand (a b t : ℝ) : ℝ := 1 / Real.sqrt ((t ^ 2 + a ^ 2) * (t ^ 2 + b ^ 2)) /-- Gauss's complete elliptic integral `I(a, b) = ∫₀^∞ dt / √((t² + a²)(t² + b²))`. -/ def ellipI (a b : ℝ) : ℝ := ∫ t in Ioi (0 : ℝ), ellipIntegrand a b t lemma ellipIntegrand_pos {a b : ℝ} (ha : 0 < a) (hb : 0 < b) (t : ℝ) : 0 < ellipIntegrand a b t := by unfold ellipIntegrand have h1 : 0 < t ^ 2 + a ^ 2 := by positivity have h2 : 0 < t ^ 2 + b ^ 2 := by positivity exact one_div_pos.mpr (Real.sqrt_pos.mpr (mul_pos h1 h2)) lemma ellipIntegrand_even (a b t : ℝ) : ellipIntegrand a b (-t) = ellipIntegrand a b t := by unfold ellipIntegrand rw [neg_sq] lemma ellipIntegrand_continuous {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : Continuous (ellipIntegrand a b) := by unfold ellipIntegrand refine continuous_const.div (Continuous.sqrt ?_) (fun t => ne_of_gt ?_) · fun_prop · exact Real.sqrt_pos.mpr (mul_pos (by positivity) (by positivity)) /-- Exact integral `∫₀^∞ dt / (t² + M²) = π / (2M)` for `M > 0`. -/ lemma integral_Ioi_inv_sq_add_sq {M : ℝ} (hM : 0 < M) : ∫ t in Ioi (0 : ℝ), (1 : ℝ) / (t ^ 2 + M ^ 2) = Real.pi / (2 * M) := by have hint : IntegrableOn (fun t : ℝ => (1 : ℝ) / (t ^ 2 + M ^ 2)) (Ioi 0) volume := by have h0 : Integrable (fun x : ℝ => (1 + x ^ 2)⁻¹) volume := integrable_inv_one_add_sq have h1 : Integrable (fun t : ℝ => (1 + (t / M) ^ 2)⁻¹) volume := by simpa [div_eq_mul_inv, mul_comm] using h0.comp_mul_left' (inv_ne_zero (ne_of_gt hM)) have h2 : Integrable (fun t : ℝ => (1 / M ^ 2) * (1 + (t / M) ^ 2)⁻¹) volume := h1.const_mul (1 / M ^ 2) refine (h2.congr (Eventually.of_forall fun t => ?_)).integrableOn have hne : M ≠ 0 := ne_of_gt hM field_simp ring have hderiv : ∀ t ∈ Ioi (0 : ℝ), HasDerivAt (fun x : ℝ => Real.arctan (x / M) / M) (1 / (t ^ 2 + M ^ 2)) t := by intro t _ have h1 : HasDerivAt (fun x : ℝ => x / M) (1 / M) t := (hasDerivAt_id t).div_const M have h2 : HasDerivAt (fun x : ℝ => Real.arctan (x / M)) ((1 / (1 + (t / M) ^ 2)) * (1 / M)) t := show HasDerivAt (Real.arctan ∘ fun x : ℝ => x / M) _ t from HasDerivAt.comp t (Real.hasDerivAt_arctan (t / M)) h1 have h3 := h2.div_const M refine h3.congr_deriv ?_ have hne : M ≠ 0 := ne_of_gt hM have hpos : t ^ 2 + M ^ 2 ≠ 0 := ne_of_gt (by positivity) field_simp ring have hcont : ContinuousWithinAt (fun x : ℝ => Real.arctan (x / M) / M) (Ici 0) 0 := by have : Continuous (fun x : ℝ => Real.arctan (x / M) / M) := by fun_prop exact this.continuousWithinAt have htend : Tendsto (fun x : ℝ => Real.arctan (x / M) / M) atTop (nhds (Real.pi / (2 * M))) := by have hdiv : Tendsto (fun x : ℝ => x / M) atTop atTop := Tendsto.atTop_div_const hM tendsto_id have harc : Tendsto (fun x : ℝ => Real.arctan (x / M)) atTop (nhds (Real.pi / 2)) := (Real.tendsto_arctan_atTop.mono_right nhdsWithin_le_nhds).comp hdiv simpa [div_div] using harc.div_const M have hval := integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv hint htend simp only [zero_div, Real.arctan_zero, sub_zero] at hval exact hval lemma ellipIntegrand_integrableOn {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : IntegrableOn (ellipIntegrand a b) (Ioi 0) volume := by set m := min a b have hm : 0 < m := lt_min ha hb have hdom : IntegrableOn (fun t : ℝ => (1 : ℝ) / (t ^ 2 + m ^ 2)) (Ioi 0) volume := by have h0 : Integrable (fun x : ℝ => (1 + x ^ 2)⁻¹) volume := integrable_inv_one_add_sq have h1 : Integrable (fun t : ℝ => (1 + (t / m) ^ 2)⁻¹) volume := by simpa [div_eq_mul_inv, mul_comm] using h0.comp_mul_left' (inv_ne_zero (ne_of_gt hm)) refine ((h1.const_mul (1 / m ^ 2)).congr (Eventually.of_forall fun t => ?_)).integrableOn have hne : m ≠ 0 := ne_of_gt hm field_simp ring refine Integrable.mono' hdom (ellipIntegrand_continuous ha hb).aestronglyMeasurable ?_ filter_upwards with t rw [Real.norm_of_nonneg (le_of_lt (ellipIntegrand_pos ha hb t))] unfold ellipIntegrand have hma : m ^ 2 ≤ a ^ 2 := sq_le_sq' (by linarith [min_le_left a b]) (min_le_left a b) have hmb : m ^ 2 ≤ b ^ 2 := sq_le_sq' (by linarith [min_le_right a b]) (min_le_right a b) have hsq : t ^ 2 + m ^ 2 ≤ Real.sqrt ((t ^ 2 + a ^ 2) * (t ^ 2 + b ^ 2)) := by rw [Real.le_sqrt (by positivity) (by positivity)] nlinarith exact one_div_le_one_div_of_le (by positivity) hsq lemma ellipI_diag {M : ℝ} (hM : 0 < M) : ellipI M M = Real.pi / (2 * M) := by unfold ellipI ellipIntegrand have heq : (fun t : ℝ => 1 / Real.sqrt ((t ^ 2 + M ^ 2) * (t ^ 2 + M ^ 2))) = fun t : ℝ => 1 / (t ^ 2 + M ^ 2) := by ext t rw [Real.sqrt_mul_self (by positivity)] rw [heq] exact integral_Ioi_inv_sq_add_sq hM lemma ellipI_mono_anti {a₁ b₁ a₂ b₂ : ℝ} (ha₁ : 0 < a₁) (hb₁ : 0 < b₁) (ha : a₁ ≤ a₂) (hb : b₁ ≤ b₂) : ellipI a₂ b₂ ≤ ellipI a₁ b₁ := by have ha₂ : 0 < a₂ := lt_of_lt_of_le ha₁ ha have hb₂ : 0 < b₂ := lt_of_lt_of_le hb₁ hb refine setIntegral_mono_on (ellipIntegrand_integrableOn ha₂ hb₂) (ellipIntegrand_integrableOn ha₁ hb₁) measurableSet_Ioi (fun t _ => ?_) unfold ellipIntegrand refine one_div_le_one_div_of_le (Real.sqrt_pos.mpr (mul_pos (by positivity) (by positivity))) ?_ refine Real.sqrt_le_sqrt ?_ have h1 : t ^ 2 + a₁ ^ 2 ≤ t ^ 2 + a₂ ^ 2 := by nlinarith have h2 : t ^ 2 + b₁ ^ 2 ≤ t ^ 2 + b₂ ^ 2 := by nlinarith exact mul_le_mul h1 h2 (by positivity) (by positivity) /-- **Gauss's 1799 Landen Integral Invariance**: `I(a, b) = I((a + b)/2, √(a b))` via the elementary bijection `s(t) = (t - a b / t) / 2` mapping `(0, ∞)` onto `ℝ`. -/ lemma ellipI_step {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : ellipI a b = ellipI ((a + b) / 2) (Real.sqrt (a * b)) := by set a₁ := (a + b) / 2 set b₁ := Real.sqrt (a * b) have ha₁ : 0 < a₁ := by positivity have hb₁ : 0 < b₁ := Real.sqrt_pos.mpr (mul_pos ha hb) have hab : 0 < a * b := mul_pos ha hb -- Define s(t) = (t - a*b/t) / 2 on Ioi 0 let s : ℝ → ℝ := fun t => (t - a * b / t) / 2 let s' : ℝ → ℝ := fun t => (1 + a * b / t ^ 2) / 2 -- Step 1: s maps Ioi 0 bijectively onto univ have hs_img : s '' Ioi (0 : ℝ) = univ := by ext y simp only [mem_image, mem_Ioi, mem_univ, iff_true] refine ⟨y + Real.sqrt (y ^ 2 + a * b), ?_, ?_⟩ · have hlt : |y| < Real.sqrt (y ^ 2 + a * b) := by rw [← Real.sqrt_sq_eq_abs] exact Real.sqrt_lt_sqrt (sq_nonneg y) (by linarith) linarith [neg_abs_le y] · set r := Real.sqrt (y ^ 2 + a * b) have hr2 : r ^ 2 = y ^ 2 + a * b := Real.sq_sqrt (by positivity) have hpos : 0 < y + r := by have hlt : |y| < r := by rw [← Real.sqrt_sq_eq_abs] exact Real.sqrt_lt_sqrt (sq_nonneg y) (by linarith) linarith [neg_abs_le y] change (y + r - a * b / (y + r)) / 2 = y have hne : y + r ≠ 0 := ne_of_gt hpos field_simp nlinarith have hs_inj : InjOn s (Ioi (0 : ℝ)) := by intro t₁ ht₁ t₂ ht₂ heq have ht₁0 : 0 < t₁ := ht₁ have ht₂0 : 0 < t₂ := ht₂ change (t₁ - a * b / t₁) / 2 = (t₂ - a * b / t₂) / 2 at heq have hmul : (t₁ - t₂) * (t₁ * t₂ + a * b) = 0 := by have h1 : t₁ - a * b / t₁ = t₂ - a * b / t₂ := by linarith have h2 := congrArg (· * (t₁ * t₂)) h1 have hne1 : t₁ ≠ 0 := ne_of_gt ht₁0 have hne2 : t₂ ≠ 0 := ne_of_gt ht₂0 field_simp at h2 nlinarith have hpos : 0 < t₁ * t₂ + a * b := by positivity rcases mul_eq_zero.mp hmul with h | h · linarith · linarith have hs_deriv : ∀ t ∈ Ioi (0 : ℝ), HasDerivWithinAt s (s' t) (Ioi 0) t := by intro t ht have hne : t ≠ 0 := ne_of_gt ht have h1 : HasDerivAt (fun x : ℝ => a * b / x) (-(a * b) / t ^ 2) t := by have hd := (hasDerivAt_const t (a * b)).div (hasDerivAt_id t) hne refine hd.congr_deriv ?_ simp only [id_eq] ring have h2 : HasDerivAt s (s' t) t := by have hd := ((hasDerivAt_id t).sub h1).div_const 2 refine hd.congr_deriv ?_ simp only [s'] ring exact h2.hasDerivWithinAt -- Step 2: Change of variables ∫_{ℝ} ellipIntegrand a₁ b₁ = ∫_{0}^∞ |s'(t)| * ellipIntegrand a₁ b₁ (s t) have hcov := integral_image_eq_integral_abs_deriv_smul measurableSet_Ioi hs_deriv hs_inj (ellipIntegrand a₁ b₁) rw [hs_img, Measure.restrict_univ] at hcov -- Step 3: Pointwise identity |s'(t)| * ellipIntegrand a₁ b₁ (s t) = 2 * ellipIntegrand a b t have hpt : ∀ t ∈ Ioi (0 : ℝ), |s' t| • ellipIntegrand a₁ b₁ (s t) = 2 * ellipIntegrand a b t := by intro t ht have ht0 : 0 < t := ht have hne : t ≠ 0 := ne_of_gt ht0 have hs'_pos : 0 < s' t := by simp only [s']; positivity rw [smul_eq_mul, abs_of_pos hs'_pos] unfold ellipIntegrand have hb1_sq : b₁ ^ 2 = a * b := Real.sq_sqrt (le_of_lt hab) have hfac1 : s t ^ 2 + a₁ ^ 2 = (t ^ 2 + a ^ 2) * (t ^ 2 + b ^ 2) / (4 * t ^ 2) := by simp only [s, a₁] field_simp ring have hfac2 : s t ^ 2 + b₁ ^ 2 = (t * s' t) ^ 2 := by simp only [s, s'] rw [hb1_sq] field_simp ring have hsqrt_prod : Real.sqrt ((s t ^ 2 + a₁ ^ 2) * (s t ^ 2 + b₁ ^ 2)) = (Real.sqrt ((t ^ 2 + a ^ 2) * (t ^ 2 + b ^ 2)) / (2 * t)) * (t * s' t) := by rw [hfac1, hfac2, Real.sqrt_mul (by positivity), Real.sqrt_div (by positivity), Real.sqrt_sq (mul_nonneg (le_of_lt ht0) (le_of_lt hs'_pos))] have h4t : Real.sqrt (4 * t ^ 2) = 2 * t := by rw [show (4 : ℝ) * t ^ 2 = (2 * t) ^ 2 by ring, Real.sqrt_sq (by linarith)] rw [h4t] rw [hsqrt_prod] have hRpos : 0 < Real.sqrt ((t ^ 2 + a ^ 2) * (t ^ 2 + b ^ 2)) := Real.sqrt_pos.mpr (mul_pos (by positivity) (by positivity)) have hRne : Real.sqrt ((t ^ 2 + a ^ 2) * (t ^ 2 + b ^ 2)) ≠ 0 := ne_of_gt hRpos have hs'ne : s' t ≠ 0 := ne_of_gt hs'_pos field_simp have h_rhs : ∫ t in Ioi (0 : ℝ), |s' t| • ellipIntegrand a₁ b₁ (s t) = 2 * ellipI a b := by rw [setIntegral_congr_fun measurableSet_Ioi hpt, integral_const_mul] rfl -- Step 4: Evenness gives ∫_{ℝ} ellipIntegrand a₁ b₁ = 2 * ellipI a₁ b₁ have h_even : ∫ x : ℝ, ellipIntegrand a₁ b₁ x = 2 * ellipI a₁ b₁ := by have hIoi := ellipIntegrand_integrableOn ha₁ hb₁ have hIic : IntegrableOn (ellipIntegrand a₁ b₁) (Iic 0) volume := by have hneg := hIoi.comp_neg rw [neg_Ioi, neg_zero] at hneg have hIio := hneg.congr_fun (fun t _ => ellipIntegrand_even a₁ b₁ t) measurableSet_Iio exact (integrableOn_Iic_iff_integrableOn_Iio).mpr hIio have hdisj : Disjoint (Iic (0 : ℝ)) (Ioi 0) := disjoint_left.mpr (fun _ hx1 hx2 => not_lt_of_ge (mem_Iic.mp hx1) (mem_Ioi.mp hx2)) have hsplit : ∫ x : ℝ, ellipIntegrand a₁ b₁ x = (∫ x in Iic (0 : ℝ), ellipIntegrand a₁ b₁ x) + (∫ x in Ioi (0 : ℝ), ellipIntegrand a₁ b₁ x) := by rw [← setIntegral_univ, ← Iic_union_Ioi (a := (0 : ℝ)), setIntegral_union hdisj measurableSet_Ioi hIic hIoi] have hneg_eq : ∫ x in Iic (0 : ℝ), ellipIntegrand a₁ b₁ x = ∫ x in Ioi (0 : ℝ), ellipIntegrand a₁ b₁ x := by have hcomp := integral_comp_neg_Ioi (c := (0 : ℝ)) (f := ellipIntegrand a₁ b₁) rw [neg_zero] at hcomp rw [← hcomp] exact setIntegral_congr_fun measurableSet_Ioi (fun t _ => ellipIntegrand_even a₁ b₁ t) rw [hsplit, hneg_eq] unfold ellipI ring linarith lemma ellipI_iter {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : ∀ n, ellipI a b = ellipI (agmA a b n) (agmB a b n) | 0 => rfl | n + 1 => by rw [ellipI_iter ha hb n, ellipI_step (agmA_pos ha hb n) (agmB_pos ha hb n)] rfl /-- **Gauss's Theorem (1799)**: `AGM(a, b) * I(a, b) = π / 2` for all `a, b > 0`. -/ theorem agm_mul_ellipI {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : agm a b * ellipI a b = Real.pi / 2 := by have h1 : ∀ n, Real.pi / (2 * agmA a b (n + 1)) ≤ ellipI a b ∧ ellipI a b ≤ Real.pi / (2 * agmB a b (n + 1)) := by intro n have hA := agmA_pos ha hb (n + 1) have hB := agmB_pos ha hb (n + 1) have hBA := agmB_le_agmA_succ ha hb n rw [ellipI_iter ha hb (n + 1), ← ellipI_diag hA, ← ellipI_diag hB] exact ⟨ellipI_mono_anti hA hB le_rfl hBA, ellipI_mono_anti hB hB hBA le_rfl⟩ have hlo : Tendsto (fun n => Real.pi / (2 * agmA a b (n + 1))) atTop (nhds (Real.pi / (2 * agm a b))) := by have hA := (tendsto_add_atTop_iff_nat 1).mpr (agmA_tendsto ha hb) exact tendsto_const_nhds.div (hA.const_mul 2) (ne_of_gt (mul_pos two_pos (agm_pos ha hb))) have hhi : Tendsto (fun n => Real.pi / (2 * agmB a b (n + 1))) atTop (nhds (Real.pi / (2 * agm a b))) := by have hB := (tendsto_add_atTop_iff_nat 1).mpr (agmB_tendsto ha hb) exact tendsto_const_nhds.div (hB.const_mul 2) (ne_of_gt (mul_pos two_pos (agm_pos ha hb))) have heq : ellipI a b = Real.pi / (2 * agm a b) := le_antisymm (ge_of_tendsto hhi (Eventually.of_forall fun n => (h1 n).2)) (le_of_tendsto hlo (Eventually.of_forall fun n => (h1 n).1)) rw [heq] have hne : agm a b ≠ 0 := ne_of_gt (agm_pos ha hb) field_simp theorem agm_eq_pi_div_two_ellipI {a b : ℝ} (ha : 0 < a) (hb : 0 < b) : agm a b = Real.pi / (2 * ellipI a b) := by have h := agm_mul_ellipI ha hb have hIpos : 0 < ellipI a b := by have hM := agm_pos ha hb nlinarith [Real.pi_pos] have hIne : ellipI a b ≠ 0 := ne_of_gt hIpos field_simp linarith /-- Elementary antiderivative integral: `∫_{a}^∞ dt / (t √(1 + t²)) = log((1 + √(1 + a²)) / a)`. -/ lemma integral_Ioi_inv_mul_sqrt_one_add_sq {a : ℝ} (ha : 0 < a) : ∫ t in Ioi a, (1 : ℝ) / (t * Real.sqrt (1 + t ^ 2)) = Real.log ((1 + Real.sqrt (1 + a ^ 2)) / a) := by let F : ℝ → ℝ := fun x => -Real.log ((1 + Real.sqrt (1 + x ^ 2)) / x) have hderiv : ∀ t ∈ Ioi a, HasDerivAt F (1 / (t * Real.sqrt (1 + t ^ 2))) t := by intro t ht have ht0 : 0 < t := lt_trans ha ht have hRpos : 0 < Real.sqrt (1 + t ^ 2) := Real.sqrt_pos.mpr (by positivity) have hnum_pos : 0 < 1 + Real.sqrt (1 + t ^ 2) := by linarith have h1 : HasDerivAt (fun x : ℝ => 1 + x ^ 2) (2 * t) t := by simpa using (hasDerivAt_pow 2 t).const_add 1 have h2 : HasDerivAt (fun x : ℝ => Real.sqrt (1 + x ^ 2)) (2 * t / (2 * Real.sqrt (1 + t ^ 2))) t := h1.sqrt (ne_of_gt (by positivity : 0 < 1 + t ^ 2)) have h3 : HasDerivAt (fun x : ℝ => 1 + Real.sqrt (1 + x ^ 2)) (2 * t / (2 * Real.sqrt (1 + t ^ 2))) t := h2.const_add 1 have h4 : HasDerivAt (fun x : ℝ => (1 + Real.sqrt (1 + x ^ 2)) / x) (((2 * t / (2 * Real.sqrt (1 + t ^ 2))) * t - (1 + Real.sqrt (1 + t ^ 2)) * 1) / t ^ 2) t := h3.div (hasDerivAt_id t) (ne_of_gt ht0) have h5 := (h4.log (ne_of_gt (div_pos hnum_pos ht0))).neg refine h5.congr_deriv ?_ have htne : t ≠ 0 := ne_of_gt ht0 have hRne : Real.sqrt (1 + t ^ 2) ≠ 0 := ne_of_gt hRpos have hnum_ne : 1 + Real.sqrt (1 + t ^ 2) ≠ 0 := ne_of_gt hnum_pos have hR2 : Real.sqrt (1 + t ^ 2) ^ 2 = 1 + t ^ 2 := Real.sq_sqrt (by positivity) field_simp nlinarith have hcont : ContinuousWithinAt F (Ici a) a := by have hRpos : 0 < Real.sqrt (1 + a ^ 2) := Real.sqrt_pos.mpr (by positivity) have harg : ContinuousAt (fun x : ℝ => (1 + Real.sqrt (1 + x ^ 2)) / x) a := by refine ContinuousAt.div ?_ continuousAt_id (ne_of_gt ha) exact continuousAt_const.add ((continuousAt_const.add (continuousAt_id.pow 2)).sqrt) exact ((harg.log (ne_of_gt (div_pos (by linarith) ha))).neg).continuousWithinAt have htend : Tendsto F atTop (nhds 0) := by have harg : Tendsto (fun x : ℝ => (1 + Real.sqrt (1 + x ^ 2)) / x) atTop (nhds 1) := by have h1 : Tendsto (fun x : ℝ => 1 / x) atTop (nhds 0) := tendsto_const_nhds.div_atTop tendsto_id have h2 : Tendsto (fun x : ℝ => Real.sqrt (1 / x ^ 2 + 1)) atTop (nhds 1) := by have hsq : Tendsto (fun x : ℝ => 1 / x ^ 2 + 1) atTop (nhds (0 + 1)) := (tendsto_const_nhds.div_atTop (tendsto_pow_atTop (by norm_num : 2 ≠ 0))).add tendsto_const_nhds rw [zero_add] at hsq simpa [Real.sqrt_one] using hsq.sqrt have hsum := h1.add h2 rw [zero_add] at hsum refine hsum.congr' ?_ filter_upwards [eventually_gt_atTop (0 : ℝ)] with x hx have hxne : x ≠ 0 := ne_of_gt hx rw [add_div] congr 1 have hmul : 1 / x ^ 2 + 1 = (1 + x ^ 2) / x ^ 2 := by field_simp rw [hmul, Real.sqrt_div (by positivity), Real.sqrt_sq (le_of_lt hx)] have hlog := harg.log (by norm_num) rw [Real.log_one] at hlog simpa [F] using hlog.neg have hint : IntegrableOn (fun t : ℝ => (1 : ℝ) / (t * Real.sqrt (1 + t ^ 2))) (Ioi a) volume := by have hdom : IntegrableOn (fun t : ℝ => (1 : ℝ) / t ^ 2) (Ioi a) volume := by have := integrableOn_Ioi_rpow_of_lt (show (-2 : ℝ) < -1 by norm_num) ha refine this.congr_fun (fun t ht => ?_) measurableSet_Ioi dsimp only have ht0 : 0 < t := lt_trans ha ht rw [show (-2 : ℝ) = -((2 : ℕ) : ℝ) by norm_num, Real.rpow_neg (le_of_lt ht0), Real.rpow_natCast, one_div] have hcont_f : ContinuousOn (fun t : ℝ => (1 : ℝ) / (t * Real.sqrt (1 + t ^ 2))) (Ioi a) := by refine continuousOn_const.div (continuousOn_id.mul ?_) (fun t ht => ?_) · exact (continuousOn_const.add (continuousOn_id.pow 2)).sqrt · exact ne_of_gt (mul_pos (lt_trans ha ht) (Real.sqrt_pos.mpr (by positivity))) refine Integrable.mono' hdom (hcont_f.aestronglyMeasurable measurableSet_Ioi) ?_ filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht have ht0 : 0 < t := lt_trans ha ht have hR : t ≤ Real.sqrt (1 + t ^ 2) := by rw [Real.le_sqrt (le_of_lt ht0) (by positivity)] linarith rw [Real.norm_of_nonneg (by positivity)] exact one_div_le_one_div_of_le (by positivity) (by nlinarith) have hval := integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv hint htend simp only [F, zero_sub, neg_neg] at hval exact hval /-- Inversion symmetry `t ↦ r / t`: `I(1, r) = 2 ∫_{√r}^∞ dt / √((t² + 1)(t² + r²))`. -/ lemma ellipI_eq_two_mul_Ioi_sqrt {r : ℝ} (hr : 0 < r) : ellipI 1 r = 2 * ∫ t in Ioi (Real.sqrt r), ellipIntegrand 1 r t := by have hsr : 0 < Real.sqrt r := Real.sqrt_pos.mpr hr have hint : IntegrableOn (ellipIntegrand 1 r) (Ioi 0) volume := ellipIntegrand_integrableOn zero_lt_one hr -- Split Ioi 0 = Ioc 0 (√r) ∪ Ioi (√r) have hunion : Ioc (0 : ℝ) (Real.sqrt r) ∪ Ioi (Real.sqrt r) = Ioi 0 := Ioc_union_Ioi_eq_Ioi (le_of_lt hsr) have hsplit : ellipI 1 r = (∫ t in Ioc (0 : ℝ) (Real.sqrt r), ellipIntegrand 1 r t) + (∫ t in Ioi (Real.sqrt r), ellipIntegrand 1 r t) := by unfold ellipI rw [← hunion, setIntegral_union (Ioc_disjoint_Ioi_same) measurableSet_Ioi (hint.mono_set Ioc_subset_Ioi_self) (hint.mono_set (Ioi_subset_Ioi (le_of_lt hsr)))] -- Also Ioo 0 (√r) has the same integral as Ioc 0 (√r) have hIoo_eq : ∫ t in Ioc (0 : ℝ) (Real.sqrt r), ellipIntegrand 1 r t = ∫ t in Ioo (0 : ℝ) (Real.sqrt r), ellipIntegrand 1 r t := integral_Ioc_eq_integral_Ioo -- Map f(t) = r / t sends Ioi (√r) bijectively onto Ioo 0 (√r) let f : ℝ → ℝ := fun t => r / t let f' : ℝ → ℝ := fun t => -r / t ^ 2 have hf_img : f '' Ioi (Real.sqrt r) = Ioo 0 (Real.sqrt r) := by ext y simp only [mem_image, mem_Ioi, mem_Ioo, f] constructor · rintro ⟨t, ht, rfl⟩ have ht0 : 0 < t := lt_trans hsr ht refine ⟨div_pos hr ht0, ?_⟩ rw [div_lt_iff₀ ht0] have hsq : Real.sqrt r * Real.sqrt r = r := Real.mul_self_sqrt (le_of_lt hr) nlinarith · rintro ⟨hy0, hylt⟩ refine ⟨r / y, ?_, ?_⟩ · rw [lt_div_iff₀ hy0] have hsq : Real.sqrt r * Real.sqrt r = r := Real.mul_self_sqrt (le_of_lt hr) nlinarith · have hyne : y ≠ 0 := ne_of_gt hy0 have hrne : r ≠ 0 := ne_of_gt hr field_simp have hf_inj : InjOn f (Ioi (Real.sqrt r)) := by intro t₁ ht₁ t₂ ht₂ heq have ht₁0 : 0 < t₁ := lt_trans hsr ht₁ have ht₂0 : 0 < t₂ := lt_trans hsr ht₂ change r / t₁ = r / t₂ at heq have hne1 : t₁ ≠ 0 := ne_of_gt ht₁0 have hne2 : t₂ ≠ 0 := ne_of_gt ht₂0 have hrne : r ≠ 0 := ne_of_gt hr field_simp at heq nlinarith have hf_deriv : ∀ t ∈ Ioi (Real.sqrt r), HasDerivWithinAt f (f' t) (Ioi (Real.sqrt r)) t := by intro t ht have ht0 : 0 < t := lt_trans hsr ht have hd := (hasDerivAt_const t r).div (hasDerivAt_id t) (ne_of_gt ht0) have h2 : HasDerivAt f (f' t) t := by refine hd.congr_deriv ?_ simp only [f', id_eq] ring exact h2.hasDerivWithinAt have hcov := integral_image_eq_integral_abs_deriv_smul measurableSet_Ioi hf_deriv hf_inj (ellipIntegrand 1 r) rw [hf_img] at hcov have hpt : ∀ t ∈ Ioi (Real.sqrt r), |f' t| • ellipIntegrand 1 r (f t) = ellipIntegrand 1 r t := by intro t ht have ht0 : 0 < t := lt_trans hsr ht have htne : t ≠ 0 := ne_of_gt ht0 rw [smul_eq_mul, show f' t = -(r / t ^ 2) by simp only [f']; ring, abs_neg, abs_of_pos (div_pos hr (sq_pos_of_pos ht0))] unfold ellipIntegrand have h1 : ((r / t) ^ 2 + 1 ^ 2) * ((r / t) ^ 2 + r ^ 2) = (r ^ 2 / t ^ 4) * ((t ^ 2 + 1 ^ 2) * (t ^ 2 + r ^ 2)) := by field_simp ring rw [h1, Real.sqrt_mul (by positivity)] have h2 : Real.sqrt (r ^ 2 / t ^ 4) = r / t ^ 2 := by rw [show r ^ 2 / t ^ 4 = (r / t ^ 2) ^ 2 by ring, Real.sqrt_sq (by positivity)] rw [h2] have hRne : Real.sqrt ((t ^ 2 + 1 ^ 2) * (t ^ 2 + r ^ 2)) ≠ 0 := ne_of_gt (Real.sqrt_pos.mpr (mul_pos (by positivity) (by positivity))) have hrne : r ≠ 0 := ne_of_gt hr field_simp have h_eq_halves : ∫ t in Ioo (0 : ℝ) (Real.sqrt r), ellipIntegrand 1 r t = ∫ t in Ioi (Real.sqrt r), ellipIntegrand 1 r t := by rw [hcov] exact setIntegral_congr_fun measurableSet_Ioi hpt rw [hsplit, hIoo_eq, h_eq_halves] ring /-- **Two-Line Symmetry Pinch for Gauss's Integral** (zero dominated convergence!): `(1 / √(1 + r)) log((1 + √(1 + r))² / r) ≤ I(1, r) ≤ log((1 + √(1 + r))² / r)` for `r > 0`. -/ theorem ellipI_symmetry_pinch {r : ℝ} (hr : 0 < r) : (1 / Real.sqrt (1 + r)) * Real.log ((1 + Real.sqrt (1 + r)) ^ 2 / r) ≤ ellipI 1 r ∧ ellipI 1 r ≤ Real.log ((1 + Real.sqrt (1 + r)) ^ 2 / r) := by have hsr : 0 < Real.sqrt r := Real.sqrt_pos.mpr hr have hsr_sq : Real.sqrt r ^ 2 = r := Real.sq_sqrt (le_of_lt hr) have hlog_eq : 2 * Real.log ((1 + Real.sqrt (1 + r)) / Real.sqrt r) = Real.log ((1 + Real.sqrt (1 + r)) ^ 2 / r) := by have hpos : 0 < (1 + Real.sqrt (1 + r)) / Real.sqrt r := by positivity rw [← Real.log_rpow hpos, show (2 : ℝ) = (2 : ℕ) by norm_num, Real.rpow_natCast, div_pow, hsr_sq] have hint_g : IntegrableOn (fun t : ℝ => (1 : ℝ) / (t * Real.sqrt (1 + t ^ 2))) (Ioi (Real.sqrt r)) volume := by have hdom : IntegrableOn (fun t : ℝ => (1 : ℝ) / t ^ 2) (Ioi (Real.sqrt r)) volume := by have := integrableOn_Ioi_rpow_of_lt (show (-2 : ℝ) < -1 by norm_num) hsr refine this.congr_fun (fun t ht => ?_) measurableSet_Ioi dsimp only have ht0 : 0 < t := lt_trans hsr ht rw [show (-2 : ℝ) = -((2 : ℕ) : ℝ) by norm_num, Real.rpow_neg (le_of_lt ht0), Real.rpow_natCast, one_div] have hcont : ContinuousOn (fun t : ℝ => (1 : ℝ) / (t * Real.sqrt (1 + t ^ 2))) (Ioi (Real.sqrt r)) := by refine continuousOn_const.div (continuousOn_id.mul ?_) (fun t ht => ?_) · exact (continuousOn_const.add (continuousOn_id.pow 2)).sqrt · exact ne_of_gt (mul_pos (lt_trans hsr ht) (Real.sqrt_pos.mpr (by positivity))) refine Integrable.mono' hdom (hcont.aestronglyMeasurable measurableSet_Ioi) ?_ filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht have ht0 : 0 < t := lt_trans hsr ht have hR : t ≤ Real.sqrt (1 + t ^ 2) := by rw [Real.le_sqrt (le_of_lt ht0) (by positivity)]; linarith rw [Real.norm_of_nonneg (by positivity)] exact one_div_le_one_div_of_le (by positivity) (by nlinarith) have hint_e : IntegrableOn (ellipIntegrand 1 r) (Ioi (Real.sqrt r)) volume := (ellipIntegrand_integrableOn zero_lt_one hr).mono_set (Ioi_subset_Ioi (le_of_lt hsr)) have hbase : ∫ t in Ioi (Real.sqrt r), (1 : ℝ) / (t * Real.sqrt (1 + t ^ 2)) = Real.log ((1 + Real.sqrt (1 + r)) / Real.sqrt r) := by simpa only [hsr_sq] using integral_Ioi_inv_mul_sqrt_one_add_sq hsr rw [ellipI_eq_two_mul_Ioi_sqrt hr, ← hlog_eq, ← hbase] constructor · have hmul : (1 / Real.sqrt (1 + r)) * (2 * ∫ t in Ioi (Real.sqrt r), (1 : ℝ) / (t * Real.sqrt (1 + t ^ 2))) = 2 * ∫ t in Ioi (Real.sqrt r), (1 / Real.sqrt (1 + r)) * ((1 : ℝ) / (t * Real.sqrt (1 + t ^ 2))) := by rw [integral_const_mul]; ring rw [hmul] refine mul_le_mul_of_nonneg_left ?_ (by norm_num) refine setIntegral_mono_on (hint_g.const_mul _) hint_e measurableSet_Ioi (fun t ht => ?_) have ht0 : 0 < t := lt_trans hsr ht have ht2 : r < t ^ 2 := by have : Real.sqrt r ^ 2 < t ^ 2 := sq_lt_sq' (by linarith) ht linarith [hsr_sq] unfold ellipIntegrand have hden_le : Real.sqrt ((t ^ 2 + 1 ^ 2) * (t ^ 2 + r ^ 2)) ≤ Real.sqrt (1 + r) * (t * Real.sqrt (1 + t ^ 2)) := by have hR : Real.sqrt (1 + r) * (t * Real.sqrt (1 + t ^ 2)) = Real.sqrt ((1 + r) * (t ^ 2 * (1 + t ^ 2))) := by rw [Real.sqrt_mul (by positivity), Real.sqrt_mul (sq_nonneg t), Real.sqrt_sq (le_of_lt ht0)] rw [hR] refine Real.sqrt_le_sqrt ?_ have hr2 : r ^ 2 ≤ r * t ^ 2 := by nlinarith nlinarith have h1 : (1 / Real.sqrt (1 + r)) * (1 / (t * Real.sqrt (1 + t ^ 2))) = 1 / (Real.sqrt (1 + r) * (t * Real.sqrt (1 + t ^ 2))) := by ring rw [h1] exact one_div_le_one_div_of_le (Real.sqrt_pos.mpr (mul_pos (by positivity) (by positivity))) hden_le · refine mul_le_mul_of_nonneg_left ?_ (by norm_num) refine setIntegral_mono_on hint_e hint_g measurableSet_Ioi (fun t ht => ?_) have ht0 : 0 < t := lt_trans hsr ht unfold ellipIntegrand have hden_ge : t * Real.sqrt (1 + t ^ 2) ≤ Real.sqrt ((t ^ 2 + 1 ^ 2) * (t ^ 2 + r ^ 2)) := by have hL : t * Real.sqrt (1 + t ^ 2) = Real.sqrt (t ^ 2 * (1 + t ^ 2)) := by rw [Real.sqrt_mul (sq_nonneg t), Real.sqrt_sq (le_of_lt ht0)] rw [hL] refine Real.sqrt_le_sqrt ?_ nlinarith exact one_div_le_one_div_of_le (mul_pos ht0 (Real.sqrt_pos.mpr (by positivity))) hden_ge /-! ### Section 3: Grötzsch Ring Modulus `μ(r)`, Exact Landen Tower & Bijection -/ /-- Complementary modulus `r' = √(1 - r²)`. -/ def compMod (r : ℝ) : ℝ := Real.sqrt (1 - r ^ 2) lemma compMod_pos {r : ℝ} (hr0 : 0 < r) (hr1 : r < 1) : 0 < compMod r := by unfold compMod exact Real.sqrt_pos.mpr (by nlinarith) lemma compMod_lt_one {r : ℝ} (hr0 : 0 < r) (_hr1 : r < 1) : compMod r < 1 := by unfold compMod rw [Real.sqrt_lt' zero_lt_one] nlinarith lemma compMod_mem_Ioo {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : compMod r ∈ Ioo (0 : ℝ) 1 := ⟨compMod_pos hr.1 hr.2, compMod_lt_one hr.1 hr.2⟩ lemma compMod_sq {r : ℝ} (hr0 : 0 ≤ r) (hr1 : r ≤ 1) : compMod r ^ 2 = 1 - r ^ 2 := Real.sq_sqrt (by nlinarith) lemma compMod_compMod {r : ℝ} (hr0 : 0 ≤ r) (hr1 : r ≤ 1) : compMod (compMod r) = r := by unfold compMod rw [Real.sq_sqrt (by nlinarith : 0 ≤ 1 - r ^ 2), sub_sub_cancel, Real.sqrt_sq hr0] lemma compMod_strictAnti {r₁ r₂ : ℝ} (hr₁ : 0 ≤ r₁) (h : r₁ < r₂) (hr₂ : r₂ ≤ 1) : compMod r₂ < compMod r₁ := by unfold compMod exact Real.sqrt_lt_sqrt (by nlinarith) (by nlinarith) lemma compMod_inv_sqrt_two : compMod (1 / Real.sqrt 2) = 1 / Real.sqrt 2 := by unfold compMod have h2 : (1 / Real.sqrt 2) ^ 2 = 1 / 2 := by rw [div_pow, one_pow, Real.sq_sqrt (by norm_num)] rw [h2, show (1 : ℝ) - 1 / 2 = (1 / Real.sqrt 2) ^ 2 by rw [h2]; norm_num, Real.sqrt_sq (by positivity)] /-- The Grötzsch ring modulus `μ(r) = (π / 2) * AGM(1, r') / AGM(1, r)`. -/ def grotzschMu (r : ℝ) : ℝ := (Real.pi / 2) * (agm 1 (compMod r) / agm 1 r) theorem grotzschMu_pos {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : 0 < grotzschMu r := by unfold grotzschMu exact mul_pos (div_pos Real.pi_pos two_pos) (div_pos (agm_pos zero_lt_one (compMod_pos hr.1 hr.2)) (agm_pos zero_lt_one hr.1)) theorem grotzschMu_eq_ellipI_ratio {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu r = (Real.pi / 2) * (ellipI 1 r / ellipI 1 (compMod r)) := by unfold grotzschMu have h1 := agm_eq_pi_div_two_ellipI zero_lt_one hr.1 have h2 := agm_eq_pi_div_two_ellipI zero_lt_one (compMod_pos hr.1 hr.2) have hI1 : 0 < ellipI 1 r := by have := agm_mul_ellipI zero_lt_one hr.1 nlinarith [Real.pi_pos, agm_pos zero_lt_one hr.1] have hI2 : 0 < ellipI 1 (compMod r) := by have := agm_mul_ellipI zero_lt_one (compMod_pos hr.1 hr.2) nlinarith [Real.pi_pos, agm_pos zero_lt_one (compMod_pos hr.1 hr.2)] rw [h1, h2] have hpi : Real.pi ≠ 0 := ne_of_gt Real.pi_pos have hI1ne : ellipI 1 r ≠ 0 := ne_of_gt hI1 have hI2ne : ellipI 1 (compMod r) ≠ 0 := ne_of_gt hI2 field_simp /-- **Modularity / Inversion Identity**: `μ(r) * μ(r') = π² / 4`. -/ theorem grotzschMu_mul_comp {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu r * grotzschMu (compMod r) = Real.pi ^ 2 / 4 := by unfold grotzschMu rw [compMod_compMod (le_of_lt hr.1) (le_of_lt hr.2)] have ha1 : agm 1 r ≠ 0 := ne_of_gt (agm_pos zero_lt_one hr.1) have ha2 : agm 1 (compMod r) ≠ 0 := ne_of_gt (agm_pos zero_lt_one (compMod_pos hr.1 hr.2)) field_simp ring /-- Exact midpoint value: `μ(1 / √2) = π / 2`. -/ theorem grotzschMu_inv_sqrt_two : grotzschMu (1 / Real.sqrt 2) = Real.pi / 2 := by unfold grotzschMu rw [compMod_inv_sqrt_two, div_self (ne_of_gt (agm_pos zero_lt_one (by positivity))), mul_one] /-- Descending Landen map `L(r) = (1 - r') / (1 + r') = r² / (1 + r')²`. -/ def landenL (r : ℝ) : ℝ := (1 - compMod r) / (1 + compMod r) /-- Ascending Landen map `A(r) = 2 √r / (1 + r)`. -/ def landenA (r : ℝ) : ℝ := 2 * Real.sqrt r / (1 + r) lemma landenL_eq_sq_div {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : landenL r = r ^ 2 / (1 + compMod r) ^ 2 := by unfold landenL have hp : 0 < 1 + compMod r := by linarith [compMod_pos hr.1 hr.2] have hsq : compMod r ^ 2 = 1 - r ^ 2 := compMod_sq (le_of_lt hr.1) (le_of_lt hr.2) have hne : 1 + compMod r ≠ 0 := ne_of_gt hp field_simp nlinarith lemma landenL_mem_Ioo {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : landenL r ∈ Ioo (0 : ℝ) 1 := by have hp := compMod_pos hr.1 hr.2 have hlt := compMod_lt_one hr.1 hr.2 unfold landenL refine ⟨div_pos (by linarith) (by linarith), (div_lt_one (by linarith)).mpr (by linarith)⟩ lemma landenA_mem_Ioo {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : landenA r ∈ Ioo (0 : ℝ) 1 := by unfold landenA have hsr : 0 < Real.sqrt r := Real.sqrt_pos.mpr hr.1 refine ⟨div_pos (by positivity) (by linarith [hr.1]), (div_lt_one (by linarith [hr.1])).mpr ?_⟩ have hne : Real.sqrt r ≠ 1 := by intro h have : r = 1 := by nlinarith [Real.sq_sqrt (le_of_lt hr.1)] linarith [hr.2] have hpos : 0 < (1 - Real.sqrt r) ^ 2 := sq_pos_of_ne_zero (sub_ne_zero.mpr hne.symm) nlinarith [Real.sq_sqrt (le_of_lt hr.1)] lemma compMod_landenL {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : compMod (landenL r) = landenA (compMod r) := by set y := compMod r have hp : 0 < y := compMod_pos hr.1 hr.2 change Real.sqrt (1 - ((1 - y) / (1 + y)) ^ 2) = 2 * Real.sqrt y / (1 + y) have h1 : 1 - ((1 - y) / (1 + y)) ^ 2 = (2 * Real.sqrt y / (1 + y)) ^ 2 := by have hne : 1 + y ≠ 0 := by linarith have hsq : Real.sqrt y ^ 2 = y := Real.sq_sqrt (le_of_lt hp) field_simp nlinarith rw [h1, Real.sqrt_sq (by positivity)] lemma compMod_landenA {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : compMod (landenA r) = (1 - r) / (1 + r) := by unfold compMod landenA have h1 : 1 - (2 * Real.sqrt r / (1 + r)) ^ 2 = ((1 - r) / (1 + r)) ^ 2 := by have hne : 1 + r ≠ 0 := ne_of_gt (by linarith [hr.1]) have hsq : Real.sqrt r ^ 2 = r := Real.sq_sqrt (le_of_lt hr.1) field_simp nlinarith rw [h1, Real.sqrt_sq (div_nonneg (by linarith [hr.2]) (by linarith [hr.1]))] lemma landenL_comp_landenA {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : landenL (landenA r) = r := by unfold landenL rw [compMod_landenA hr] have hne : 1 + r ≠ 0 := ne_of_gt (by linarith [hr.1]) field_simp ring lemma landenA_comp_landenL {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : landenA (landenL r) = r := by unfold landenA rw [landenL_eq_sq_div hr] have hp : 0 < 1 + compMod r := by linarith [compMod_pos hr.1 hr.2] have hsqrt : Real.sqrt (r ^ 2 / (1 + compMod r) ^ 2) = r / (1 + compMod r) := by rw [← div_pow, Real.sqrt_sq (div_nonneg (le_of_lt hr.1) (le_of_lt hp))] rw [hsqrt] have hsq : compMod r ^ 2 = 1 - r ^ 2 := compMod_sq (le_of_lt hr.1) (le_of_lt hr.2) have hne : 1 + compMod r ≠ 0 := ne_of_gt hp have hden : (1 + compMod r) ^ 2 + r ^ 2 = 2 * (1 + compMod r) := by nlinarith have hden_ne : 1 + r ^ 2 / (1 + compMod r) ^ 2 ≠ 0 := by positivity field_simp rw [hden] ring /-- **Exact Descending Landen Transformation**: `μ(L(r)) = 2 μ(r)`. -/ theorem grotzschMu_landenL {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu (landenL r) = 2 * grotzschMu r := by have hp := compMod_pos hr.1 hr.2 have h1p : 0 < 1 + compMod r := by linarith have h1m : 0 < 1 - compMod r := by linarith [compMod_lt_one hr.1 hr.2] have hagm1 : agm 1 (landenL r) = agm 1 r / (1 + compMod r) := by unfold landenL have hmul : (1 + compMod r) * agm 1 ((1 - compMod r) / (1 + compMod r)) = agm 1 r := by rw [← agm_homog h1p zero_lt_one (div_pos h1m h1p), mul_one, mul_div_cancel₀ _ (ne_of_gt h1p), agm_step_eq h1p h1m] have havg : (1 + compMod r + (1 - compMod r)) / 2 = 1 := by ring have hgeom : Real.sqrt ((1 + compMod r) * (1 - compMod r)) = r := by have hsq : compMod r ^ 2 = 1 - r ^ 2 := compMod_sq (le_of_lt hr.1) (le_of_lt hr.2) have : (1 + compMod r) * (1 - compMod r) = r ^ 2 := by nlinarith rw [this, Real.sqrt_sq (le_of_lt hr.1)] rw [havg, hgeom] exact eq_div_of_mul_eq (ne_of_gt h1p) (by linarith) have hagm2 : agm 1 (compMod (landenL r)) = 2 * agm 1 (compMod r) / (1 + compMod r) := by rw [compMod_landenL hr] unfold landenA have hhalf : 0 < (1 + compMod r) / 2 := by linarith have hmul : ((1 + compMod r) / 2) * agm 1 (2 * Real.sqrt (compMod r) / (1 + compMod r)) = agm 1 (compMod r) := by rw [← agm_homog hhalf zero_lt_one (div_pos (by positivity) h1p), mul_one] have harg : (1 + compMod r) / 2 * (2 * Real.sqrt (compMod r) / (1 + compMod r)) = Real.sqrt (1 * compMod r) := by have hne : 1 + compMod r ≠ 0 := ne_of_gt h1p rw [one_mul] field_simp rw [harg, ← agm_step_eq zero_lt_one hp] have hne : 1 + compMod r ≠ 0 := ne_of_gt h1p field_simp linarith unfold grotzschMu rw [hagm1, hagm2] have hne1 : 1 + compMod r ≠ 0 := ne_of_gt h1p have hne2 : agm 1 r ≠ 0 := ne_of_gt (agm_pos zero_lt_one hr.1) field_simp /-- **Exact Ascending Landen Transformation**: `μ(A(r)) = μ(r) / 2`. -/ theorem grotzschMu_landenA {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu (landenA r) = grotzschMu r / 2 := by have hA := landenA_mem_Ioo hr have h := grotzschMu_landenL hA rw [landenL_comp_landenA hr] at h linarith lemma landenL_iter_mem_Ioo {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : ∀ n, landenL^[n] r ∈ Ioo (0 : ℝ) 1 | 0 => hr | n + 1 => by rw [Function.iterate_succ_apply'] exact landenL_mem_Ioo (landenL_iter_mem_Ioo hr n) /-- **Exact Iterated Landen Tower**: `μ(L^[n](r)) = 2^n μ(r)`. -/ theorem grotzschMu_landenL_iter {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : ∀ n, grotzschMu (landenL^[n] r) = (2 : ℝ) ^ n * grotzschMu r | 0 => by simp | n + 1 => by rw [Function.iterate_succ_apply', grotzschMu_landenL (landenL_iter_mem_Ioo hr n), grotzschMu_landenL_iter hr n] ring lemma landenL_le_sq {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : landenL r ≤ r ^ 2 := by rw [landenL_eq_sq_div hr] have hp : 1 ≤ 1 + compMod r := by linarith [compMod_pos hr.1 hr.2] have hsq : 1 ≤ (1 + compMod r) ^ 2 := by nlinarith exact div_le_self (sq_nonneg r) hsq /-- Doubly exponential contraction of the Landen orbit: `L^[n](r) ≤ r^(2^n)`. -/ lemma landenL_iter_le_pow {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : ∀ n, landenL^[n] r ≤ r ^ (2 ^ n) | 0 => by simp | n + 1 => by rw [Function.iterate_succ_apply'] have hn := landenL_iter_mem_Ioo hr n calc landenL (landenL^[n] r) ≤ (landenL^[n] r) ^ 2 := landenL_le_sq hn _ ≤ (r ^ (2 ^ n)) ^ 2 := sq_le_sq' (by linarith [hn.1, pow_pos hr.1 (2 ^ n)]) (landenL_iter_le_pow hr n) _ = r ^ (2 ^ (n + 1)) := by rw [← pow_mul, pow_succ] lemma tendsto_landenL_iter {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : Tendsto (fun n => landenL^[n] r) atTop (nhds 0) := by refine squeeze_zero (fun n => le_of_lt (landenL_iter_mem_Ioo hr n).1) (fun n => landenL_iter_le_pow hr n) ?_ have h1 : Tendsto (fun k : ℕ => r ^ k) atTop (nhds 0) := tendsto_pow_atTop_nhds_zero_of_lt_one (le_of_lt hr.1) hr.2 have h2 : Tendsto (fun n : ℕ => 2 ^ n) atTop atTop := tendsto_atTop_mono (fun n => Nat.le_of_lt Nat.lt_two_pow_self) tendsto_id exact h1.comp h2 lemma tendsto_compMod_landenL_iter {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : Tendsto (fun n => compMod (landenL^[n] r)) atTop (nhds 1) := by unfold compMod have h0 := tendsto_landenL_iter hr have hsq : Tendsto (fun n => 1 - (landenL^[n] r) ^ 2) atTop (nhds (1 - 0 ^ 2)) := tendsto_const_nhds.sub (h0.pow 2) rw [zero_pow (by norm_num), sub_zero] at hsq simpa [Real.sqrt_one] using hsq.sqrt /-- **Key Asymptotic Engine**: for any profile `P` with `P(x) → 1` as `x → 1⁻`, `2⁻ⁿ log(4 P(L^[n](r)') / L^[n](r)) → μ(r)` as `n → ∞`. -/ theorem tendsto_landen_log_profile {P : ℝ → ℝ} (hP_lim : Tendsto P (nhdsWithin 1 (Iio 1)) (nhds 1)) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : Tendsto (fun n => Real.log (4 * P (compMod (landenL^[n] r)) / (landenL^[n] r)) / (2 : ℝ) ^ n) atTop (nhds (grotzschMu r)) := by set rn : ℕ → ℝ := fun n => landenL^[n] r have hrn : ∀ n, rn n ∈ Ioo (0 : ℝ) 1 := landenL_iter_mem_Ioo hr have hrn0 : Tendsto rn atTop (nhds 0) := tendsto_landenL_iter hr have hrn'1 : Tendsto (fun n => compMod (rn n)) atTop (nhdsWithin 1 (Iio 1)) := tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ (tendsto_compMod_landenL_iter hr) (Eventually.of_forall (fun n => compMod_lt_one (hrn n).1 (hrn n).2)) have hP_n : Tendsto (fun n => P (compMod (rn n))) atTop (nhds 1) := hP_lim.comp hrn'1 -- First show (1 / 2^n) * log(4 / rn n) → μ(r) using the symmetry pinch on ellipI 1 (rn n)! have hI_comp : Tendsto (fun n => ellipI 1 (compMod (rn n))) atTop (nhds (Real.pi / 2)) := by have hagm : Tendsto (fun n => agm 1 (compMod (rn n))) atTop (nhds (agm 1 1)) := (agm_continuousOn_Ioi 1 (show (1 : ℝ) ∈ Ioi 0 by norm_num)).tendsto.comp (tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ (tendsto_compMod_landenL_iter hr) (Eventually.of_forall (fun n => compMod_pos (hrn n).1 (hrn n).2))) rw [agm_self zero_lt_one] at hagm have hdiv : Tendsto (fun n => Real.pi / (2 * agm 1 (compMod (rn n)))) atTop (nhds (Real.pi / (2 * 1))) := tendsto_const_nhds.div (hagm.const_mul 2) (by norm_num) rw [mul_one] at hdiv refine hdiv.congr (fun n => ?_) have hmul := agm_mul_ellipI zero_lt_one (compMod_pos (hrn n).1 (hrn n).2) have hne : agm 1 (compMod (rn n)) ≠ 0 := ne_of_gt (agm_pos zero_lt_one (compMod_pos (hrn n).1 (hrn n).2)) field_simp linarith -- Express ellipI 1 (rn n) / 2^n = grotzschMu r * ellipI 1 (compMod (rn n)) / (π / 2) → μ(r) have hI_scaled : Tendsto (fun n => ellipI 1 (rn n) / (2 : ℝ) ^ n) atTop (nhds (grotzschMu r)) := by have hlim : Tendsto (fun n => grotzschMu r * (ellipI 1 (compMod (rn n)) / (Real.pi / 2))) atTop (nhds (grotzschMu r * ((Real.pi / 2) / (Real.pi / 2)))) := (hI_comp.div_const (Real.pi / 2)).const_mul (grotzschMu r) rw [div_self (ne_of_gt (div_pos Real.pi_pos two_pos)), mul_one] at hlim refine hlim.congr (fun n => ?_) have hmu := grotzschMu_landenL_iter hr n rw [grotzschMu_eq_ellipI_ratio (hrn n)] at hmu have hpow : (2 : ℝ) ^ n ≠ 0 := pow_ne_zero n two_ne_zero have hpi : Real.pi ≠ 0 := ne_of_gt Real.pi_pos have hI2 : ellipI 1 (compMod (rn n)) ≠ 0 := by have := agm_mul_ellipI zero_lt_one (compMod_pos (hrn n).1 (hrn n).2) have hpos : 0 < ellipI 1 (compMod (rn n)) := by nlinarith [Real.pi_pos, agm_pos zero_lt_one (compMod_pos (hrn n).1 (hrn n).2)] exact ne_of_gt hpos field_simp at hmu ⊢ linarith -- Let L_n = log((1 + √(1 + rn n))² / rn n) / 2^n; from symmetry pinch, -- ellipI 1 (rn n) / 2^n ≤ L_n ≤ √(1 + rn n) * (ellipI 1 (rn n) / 2^n), so L_n → μ(r)! have hL_tend : Tendsto (fun n => Real.log ((1 + Real.sqrt (1 + rn n)) ^ 2 / rn n) / (2 : ℝ) ^ n) atTop (nhds (grotzschMu r)) := by have hsqrt1 : Tendsto (fun n => Real.sqrt (1 + rn n)) atTop (nhds 1) := by have h1add : Tendsto (fun n => (1 : ℝ) + rn n) atTop (nhds (1 + 0)) := tendsto_const_nhds.add hrn0 rw [add_zero] at h1add simpa [Real.sqrt_one] using h1add.sqrt have hhi : Tendsto (fun n => Real.sqrt (1 + rn n) * (ellipI 1 (rn n) / (2 : ℝ) ^ n)) atTop (nhds (1 * grotzschMu r)) := hsqrt1.mul hI_scaled rw [one_mul] at hhi refine tendsto_of_tendsto_of_tendsto_of_le_of_le hI_scaled hhi (fun n => ?_) (fun n => ?_) · exact div_le_div_of_nonneg_right (ellipI_symmetry_pinch (hrn n).1).2 (by positivity) · have hpinch := (ellipI_symmetry_pinch (hrn n).1).1 have hsr_pos : 0 < Real.sqrt (1 + rn n) := Real.sqrt_pos.mpr (by linarith [(hrn n).1]) have hle : Real.log ((1 + Real.sqrt (1 + rn n)) ^ 2 / rn n) ≤ Real.sqrt (1 + rn n) * ellipI 1 (rn n) := by rw [one_div_mul_eq_div, div_le_iff₀ hsr_pos] at hpinch linarith rw [← mul_div_assoc] exact div_le_div_of_nonneg_right hle (by positivity) -- Difference between log(4 * P(rn') / rn) / 2^n and L_n is log(4 * P(rn') / (1 + √(1 + rn))²) / 2^n → 0! have hdiff : Tendsto (fun n => Real.log (4 * P (compMod (rn n)) / (1 + Real.sqrt (1 + rn n)) ^ 2) / (2 : ℝ) ^ n) atTop (nhds 0) := by have harg : Tendsto (fun n => 4 * P (compMod (rn n)) / (1 + Real.sqrt (1 + rn n)) ^ 2) atTop (nhds (4 * 1 / (1 + Real.sqrt (1 + 0)) ^ 2)) := by refine (hP_n.const_mul 4).div ?_ (by norm_num) exact (tendsto_const_nhds.add (tendsto_const_nhds.add hrn0).sqrt).pow 2 have hnum_lim : (4 * 1 / (1 + Real.sqrt (1 + 0)) ^ 2 : ℝ) = 1 := by norm_num rw [hnum_lim] at harg have hlog := harg.log (by norm_num) rw [Real.log_one] at hlog have hpow : Tendsto (fun n : ℕ => ((1 / 2 : ℝ) ^ n)) atTop (nhds 0) := tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num) (by norm_num) have hprod := hlog.mul hpow rw [mul_zero] at hprod refine hprod.congr (fun n => ?_) rw [one_div, inv_pow, ← div_eq_mul_inv] have hsum := hL_tend.add hdiff rw [add_zero] at hsum refine hsum.congr' ?_ filter_upwards [hP_n.eventually (eventually_gt_nhds (by norm_num : (0 : ℝ) < 1))] with n hPn have hrpos : 0 < rn n := (hrn n).1 have hdenpos : 0 < (1 + Real.sqrt (1 + rn n)) ^ 2 := by positivity change Real.log ((1 + Real.sqrt (1 + rn n)) ^ 2 / rn n) / (2 : ℝ) ^ n + Real.log (4 * P (compMod (rn n)) / (1 + Real.sqrt (1 + rn n)) ^ 2) / (2 : ℝ) ^ n = Real.log (4 * P (compMod (rn n)) / rn n) / (2 : ℝ) ^ n rw [← add_div, ← Real.log_mul (ne_of_gt (div_pos hdenpos hrpos)) (ne_of_gt (div_pos (mul_pos (by norm_num) hPn) hdenpos))] congr 2 have hne1 : (1 + Real.sqrt (1 + rn n)) ^ 2 ≠ 0 := ne_of_gt hdenpos have hne2 : rn n ≠ 0 := ne_of_gt hrpos field_simp /-- `μ` is strictly antitone on `(0, 1)`. -/ theorem grotzschMu_strictAnti {r₁ r₂ : ℝ} (hr₁ : r₁ ∈ Ioo (0 : ℝ) 1) (hr₂ : r₂ ∈ Ioo (0 : ℝ) 1) (h : r₁ < r₂) : grotzschMu r₂ < grotzschMu r₁ := by unfold grotzschMu have h1 : agm 1 (compMod r₂) < agm 1 (compMod r₁) := agm_strictMono_right zero_lt_one (compMod_pos hr₂.1 hr₂.2) (compMod_strictAnti (le_of_lt hr₁.1) h (le_of_lt hr₂.2)) have h2 : agm 1 r₁ < agm 1 r₂ := agm_strictMono_right zero_lt_one hr₁.1 h have ha1 : 0 < agm 1 r₁ := agm_pos zero_lt_one hr₁.1 have ha2 : 0 < agm 1 r₂ := agm_pos zero_lt_one hr₂.1 have hc1 : 0 < agm 1 (compMod r₁) := agm_pos zero_lt_one (compMod_pos hr₁.1 hr₁.2) have hdiv : agm 1 (compMod r₂) / agm 1 r₂ < agm 1 (compMod r₁) / agm 1 r₁ := by rw [div_lt_div_iff₀ ha2 ha1] nlinarith exact mul_lt_mul_of_pos_left hdiv (div_pos Real.pi_pos two_pos) /-- Continuity of `μ` on `(0, 1)`. -/ theorem grotzschMu_continuousOn : ContinuousOn grotzschMu (Ioo (0 : ℝ) 1) := by unfold grotzschMu refine continuousOn_const.mul ?_ refine ContinuousOn.div ?_ ?_ (fun r hr => ne_of_gt (agm_pos zero_lt_one hr.1)) · refine agm_continuousOn_Ioi.comp ?_ (fun r hr => compMod_pos hr.1 hr.2) unfold compMod exact (continuousOn_const.sub (continuousOn_id.pow 2)).sqrt · exact agm_continuousOn_Ioi.mono (fun _ hr => hr.1) /-- `μ(r) → +∞` as `r → 0⁺`. -/ theorem grotzschMu_tendsto_zero : Tendsto grotzschMu (nhdsWithin 0 (Ioi 0)) atTop := by -- From ellipI_symmetry_pinch, for r ∈ (0, 1), I(1, r) ≥ (1/√2) * log(4/r) and I(1, r') ≤ I(1, 1) * ... -- Actually simpler: agm 1 r' ≥ r' and agm 1 r = π / (2 I(1, r)) ≤ π / (2 * (1/√2) log(4/r)), -- so μ(r) = (π/2) * agm(1, r') / agm(1, r) ≥ (1/√2) * r' * log(4/r) → +∞! have hlog : Tendsto (fun r : ℝ => (1 / 2) * Real.log (4 / r)) (nhdsWithin 0 (Ioi 0)) atTop := by have hinv : Tendsto (fun r : ℝ => 4 / r) (nhdsWithin 0 (Ioi 0)) atTop := Tendsto.const_mul_atTop (by norm_num : (0 : ℝ) < 4) tendsto_inv_nhdsGT_zero exact Tendsto.const_mul_atTop (by norm_num : (0 : ℝ) < 1 / 2) (Real.tendsto_log_atTop.comp hinv) refine tendsto_atTop_mono' _ ?_ hlog filter_upwards [Ioo_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 2)] with r hr have hr1 : r ∈ Ioo (0 : ℝ) 1 := ⟨hr.1, lt_trans hr.2 (by norm_num)⟩ have hpinch := (ellipI_symmetry_pinch hr.1).1 have hlog_ge : Real.log (4 / r) ≤ Real.log ((1 + Real.sqrt (1 + r)) ^ 2 / r) := by refine Real.log_le_log (div_pos (by norm_num) hr.1) ?_ refine div_le_div_of_nonneg_right ?_ (le_of_lt hr.1) have h1 : (1 : ℝ) ≤ Real.sqrt (1 + r) := by rw [Real.le_sqrt (by norm_num) (by linarith [hr.1])]; linarith [hr.1] nlinarith have hsr_le : Real.sqrt (1 + r) ≤ 3 / 2 := by rw [Real.sqrt_le_left (by norm_num)]; linarith [hr.2] have hI_ge : (2 / 3) * Real.log (4 / r) ≤ ellipI 1 r := by have hlog_nn : 0 ≤ Real.log (4 / r) := Real.log_nonneg (by rw [one_le_div hr.1]; linarith [hr.2]) have h1 : (2 / 3 : ℝ) ≤ 1 / Real.sqrt (1 + r) := by rw [le_div_iff₀ (Real.sqrt_pos.mpr (by linarith [hr.1]))] linarith calc (2 / 3) * Real.log (4 / r) ≤ (1 / Real.sqrt (1 + r)) * Real.log (4 / r) := mul_le_mul_of_nonneg_right h1 hlog_nn _ ≤ (1 / Real.sqrt (1 + r)) * Real.log ((1 + Real.sqrt (1 + r)) ^ 2 / r) := mul_le_mul_of_nonneg_left hlog_ge (by positivity) _ ≤ ellipI 1 r := hpinch have hr'_ge : 3 / 4 ≤ compMod r := by unfold compMod rw [Real.le_sqrt (by norm_num) (by nlinarith [hr.1, hr.2])] nlinarith [hr.1, hr.2] have hagm'_ge : 3 / 4 ≤ agm 1 (compMod r) := by calc (3 / 4 : ℝ) ≤ min 1 (compMod r) := le_min (by norm_num) hr'_ge _ ≤ agm 1 (compMod r) := min_le_agm zero_lt_one (compMod_pos hr1.1 hr1.2) have hagm_r : agm 1 r = Real.pi / (2 * ellipI 1 r) := agm_eq_pi_div_two_ellipI zero_lt_one hr.1 unfold grotzschMu rw [hagm_r] have hpi : Real.pi ≠ 0 := ne_of_gt Real.pi_pos have hEq : Real.pi / 2 * (agm 1 (compMod r) / (Real.pi / (2 * ellipI 1 r))) = agm 1 (compMod r) * ellipI 1 r := by field_simp rw [hEq] have hlog_nn : 0 ≤ Real.log (4 / r) := Real.log_nonneg (by rw [one_le_div hr.1]; linarith [hr.2]) nlinarith /-- `μ(r) → 0` as `r → 1⁻`. -/ theorem grotzschMu_tendsto_one : Tendsto grotzschMu (nhdsWithin 1 (Iio 1)) (nhds 0) := by have hcomp : Tendsto compMod (nhdsWithin 1 (Iio 1)) (nhdsWithin 0 (Ioi 0)) := by refine tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within _ ?_ ?_ · unfold compMod have h1 : Tendsto (fun r : ℝ => 1 - r ^ 2) (nhdsWithin 1 (Iio 1)) (nhds (1 - 1 ^ 2)) := (tendsto_const_nhds.sub (continuousWithinAt_id.pow 2)) rw [one_pow, sub_self] at h1 simpa [Real.sqrt_zero] using h1.sqrt · filter_upwards [Ioo_mem_nhdsLT zero_lt_one] with r hr exact compMod_pos hr.1 hr.2 have htop : Tendsto (fun r => grotzschMu (compMod r)) (nhdsWithin 1 (Iio 1)) atTop := grotzschMu_tendsto_zero.comp hcomp have hzero : Tendsto (fun r => (Real.pi ^ 2 / 4) / grotzschMu (compMod r)) (nhdsWithin 1 (Iio 1)) (nhds 0) := tendsto_const_nhds.div_atTop htop refine hzero.congr' ?_ filter_upwards [Ioo_mem_nhdsLT zero_lt_one] with r hr have hmul := grotzschMu_mul_comp hr have hne : grotzschMu (compMod r) ≠ 0 := ne_of_gt (grotzschMu_pos (compMod_mem_Ioo hr)) field_simp linarith /-- **Bijection Theorem**: `μ` maps `(0, 1)` bijectively onto `(0, ∞)`. -/ theorem exists_unique_grotzschMu_eq {y : ℝ} (hy : 0 < y) : ∃! r : ℝ, r ∈ Ioo (0 : ℝ) 1 ∧ grotzschMu r = y := by -- Find a ∈ (0, 1) with μ(a) > y and b ∈ (0, 1) with μ(b) < y have ha_ev := grotzschMu_tendsto_zero.eventually (eventually_gt_atTop y) have ha_ex : ∃ a ∈ Ioo (0 : ℝ) 1, y < grotzschMu a := by have hmem : ∀ᶠ a in nhdsWithin (0 : ℝ) (Ioi 0), y < grotzschMu a ∧ a ∈ Ioo (0 : ℝ) 1 := ha_ev.and (Ioo_mem_nhdsGT zero_lt_one) rcases hmem.exists with ⟨a, ha1, ha2⟩ exact ⟨a, ha2, ha1⟩ have hb_ev := grotzschMu_tendsto_one.eventually (eventually_lt_nhds hy) have hb_ex : ∃ b ∈ Ioo (0 : ℝ) 1, grotzschMu b < y := by have hmem : ∀ᶠ b in nhdsWithin (1 : ℝ) (Iio 1), grotzschMu b < y ∧ b ∈ Ioo (0 : ℝ) 1 := hb_ev.and (Ioo_mem_nhdsLT zero_lt_one) rcases hmem.exists with ⟨b, hb1, hb2⟩ exact ⟨b, hb2, hb1⟩ rcases ha_ex with ⟨a, ha_mem, hay⟩ rcases hb_ex with ⟨b, hb_mem, hby⟩ have hab : a < b := by by_contra h push Not at h rcases eq_or_lt_of_le h with rfl | hba · linarith · have := grotzschMu_strictAnti hb_mem ha_mem hba linarith have hsub : Icc a b ⊆ Ioo (0 : ℝ) 1 := fun x hx => ⟨lt_of_lt_of_le ha_mem.1 hx.1, lt_of_le_of_lt hx.2 hb_mem.2⟩ have hcont : ContinuousOn grotzschMu (Icc a b) := grotzschMu_continuousOn.mono hsub have hy_mem : y ∈ Icc (grotzschMu b) (grotzschMu a) := ⟨le_of_lt hby, le_of_lt hay⟩ rcases intermediate_value_Icc' (le_of_lt hab) hcont hy_mem with ⟨r, hr_icc, hr_eq⟩ refine ⟨r, ⟨hsub hr_icc, hr_eq⟩, ?_⟩ rintro r' ⟨hr'_mem, hr'_eq⟩ rcases lt_trichotomy r' r with hlt | heq | hgt · have := grotzschMu_strictAnti hr'_mem (hsub hr_icc) hlt; linarith · exact heq · have := grotzschMu_strictAnti (hsub hr_icc) hr'_mem hgt; linarith /-! ### Section 4: Master Algebraic Landen-Invariant Principle -/ /-- The purely rational Landen defect of a profile `P`: `Δ_L[P](t) = 4 P(t²)² - (1 + t²)² P(2t / (1 + t²))`. -/ def landenDefect (P : ℝ → ℝ) (t : ℝ) : ℝ := 4 * (P (t ^ 2)) ^ 2 - (1 + t ^ 2) ^ 2 * P (2 * t / (1 + t ^ 2)) /-- The logarithmic bound induced by a profile `P`: `B_P(r) = log(4 P(r') / r)`. -/ def profileBound (P : ℝ → ℝ) (r : ℝ) : ℝ := Real.log (4 * P (compMod r) / r) /-- Exact algebraic reduction of one Landen step of `profileBound P` to `landenDefect P`. -/ lemma profileBound_landen_step_le {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, 0 ≤ landenDefect P t) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P (landenL r) / 2 ≤ profileBound P r := by set t := Real.sqrt (compMod r) have hrp := compMod_mem_Ioo hr have ht_pos : 0 < t := Real.sqrt_pos.mpr hrp.1 have ht_lt1 : t < 1 := by rw [Real.sqrt_lt' zero_lt_one, one_pow]; exact hrp.2 have ht_sq : t ^ 2 = compMod r := Real.sq_sqrt (le_of_lt hrp.1) have h1t2 : 0 < 1 + t ^ 2 := by positivity have hP1 : 0 < P (compMod r) := hP_pos _ hrp have hP2 : 0 < P (compMod (landenL r)) := hP_pos _ (compMod_mem_Ioo (landenL_mem_Ioo hr)) have hcompL : compMod (landenL r) = 2 * t / (1 + t ^ 2) := by rw [compMod_landenL hr]; unfold landenA; rw [ht_sq] have hL : landenL r = r ^ 2 / (1 + t ^ 2) ^ 2 := by rw [landenL_eq_sq_div hr, ht_sq] have hd : 0 ≤ landenDefect P t := hdef t ⟨ht_pos, ht_lt1⟩ unfold landenDefect at hd rw [← hcompL, ht_sq] at hd unfold profileBound rw [div_le_iff₀ two_pos] have h2log : Real.log (4 * P (compMod r) / r) * 2 = Real.log ((4 * P (compMod r) / r) ^ 2) := by rw [mul_comm, ← Real.log_rpow (div_pos (mul_pos (by norm_num) hP1) hr.1), show (2 : ℝ) = (2 : ℕ) by norm_num, Real.rpow_natCast] rw [h2log] refine Real.log_le_log (div_pos (mul_pos (by norm_num) hP2) (landenL_mem_Ioo hr).1) ?_ have hrne : r ≠ 0 := ne_of_gt hr.1 have h1tne : 1 + t ^ 2 ≠ 0 := ne_of_gt h1t2 have hLHS : 4 * P (compMod (landenL r)) / landenL r = 4 * ((1 + t ^ 2) ^ 2 * P (compMod (landenL r))) / r ^ 2 := by rw [div_eq_mul_inv, hL]; field_simp have hRHS : (4 * P (compMod r) / r) ^ 2 = 4 * (4 * P (compMod r) ^ 2) / r ^ 2 := by field_simp rw [hLHS, hRHS, ht_sq] exact div_le_div_of_nonneg_right (by linarith) (sq_nonneg r) lemma profileBound_landen_step_lt {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, 0 < landenDefect P t) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P (landenL r) / 2 < profileBound P r := by set t := Real.sqrt (compMod r) have hrp := compMod_mem_Ioo hr have ht_pos : 0 < t := Real.sqrt_pos.mpr hrp.1 have ht_lt1 : t < 1 := by rw [Real.sqrt_lt' zero_lt_one, one_pow]; exact hrp.2 have ht_sq : t ^ 2 = compMod r := Real.sq_sqrt (le_of_lt hrp.1) have h1t2 : 0 < 1 + t ^ 2 := by positivity have hP1 : 0 < P (compMod r) := hP_pos _ hrp have hP2 : 0 < P (compMod (landenL r)) := hP_pos _ (compMod_mem_Ioo (landenL_mem_Ioo hr)) have hcompL : compMod (landenL r) = 2 * t / (1 + t ^ 2) := by rw [compMod_landenL hr]; unfold landenA; rw [ht_sq] have hL : landenL r = r ^ 2 / (1 + t ^ 2) ^ 2 := by rw [landenL_eq_sq_div hr, ht_sq] have hd : 0 < landenDefect P t := hdef t ⟨ht_pos, ht_lt1⟩ unfold landenDefect at hd rw [← hcompL, ht_sq] at hd unfold profileBound rw [div_lt_iff₀ two_pos] have h2log : Real.log (4 * P (compMod r) / r) * 2 = Real.log ((4 * P (compMod r) / r) ^ 2) := by rw [mul_comm, ← Real.log_rpow (div_pos (mul_pos (by norm_num) hP1) hr.1), show (2 : ℝ) = (2 : ℕ) by norm_num, Real.rpow_natCast] rw [h2log] refine Real.log_lt_log (div_pos (mul_pos (by norm_num) hP2) (landenL_mem_Ioo hr).1) ?_ have hrne : r ≠ 0 := ne_of_gt hr.1 have h1tne : 1 + t ^ 2 ≠ 0 := ne_of_gt h1t2 have hLHS : 4 * P (compMod (landenL r)) / landenL r = 4 * ((1 + t ^ 2) ^ 2 * P (compMod (landenL r))) / r ^ 2 := by rw [div_eq_mul_inv, hL]; field_simp have hRHS : (4 * P (compMod r) / r) ^ 2 = 4 * (4 * P (compMod r) ^ 2) / r ^ 2 := by field_simp rw [hLHS, hRHS, ht_sq] exact div_lt_div_of_pos_right (by linarith) (sq_pos_of_pos hr.1) lemma profileBound_landen_step_ge {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, landenDefect P t ≤ 0) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P r ≤ profileBound P (landenL r) / 2 := by set t := Real.sqrt (compMod r) have hrp := compMod_mem_Ioo hr have ht_pos : 0 < t := Real.sqrt_pos.mpr hrp.1 have ht_lt1 : t < 1 := by rw [Real.sqrt_lt' zero_lt_one, one_pow]; exact hrp.2 have ht_sq : t ^ 2 = compMod r := Real.sq_sqrt (le_of_lt hrp.1) have h1t2 : 0 < 1 + t ^ 2 := by positivity have hP1 : 0 < P (compMod r) := hP_pos _ hrp have hP2 : 0 < P (compMod (landenL r)) := hP_pos _ (compMod_mem_Ioo (landenL_mem_Ioo hr)) have hcompL : compMod (landenL r) = 2 * t / (1 + t ^ 2) := by rw [compMod_landenL hr]; unfold landenA; rw [ht_sq] have hL : landenL r = r ^ 2 / (1 + t ^ 2) ^ 2 := by rw [landenL_eq_sq_div hr, ht_sq] have hd : landenDefect P t ≤ 0 := hdef t ⟨ht_pos, ht_lt1⟩ unfold landenDefect at hd rw [← hcompL, ht_sq] at hd unfold profileBound rw [le_div_iff₀ two_pos] have h2log : Real.log (4 * P (compMod r) / r) * 2 = Real.log ((4 * P (compMod r) / r) ^ 2) := by rw [mul_comm, ← Real.log_rpow (div_pos (mul_pos (by norm_num) hP1) hr.1), show (2 : ℝ) = (2 : ℕ) by norm_num, Real.rpow_natCast] rw [h2log] refine Real.log_le_log (sq_pos_of_pos (div_pos (mul_pos (by norm_num) hP1) hr.1)) ?_ have hrne : r ≠ 0 := ne_of_gt hr.1 have h1tne : 1 + t ^ 2 ≠ 0 := ne_of_gt h1t2 have hLHS : (4 * P (compMod r) / r) ^ 2 = 4 * (4 * P (compMod r) ^ 2) / r ^ 2 := by field_simp have hRHS : 4 * P (compMod (landenL r)) / landenL r = 4 * ((1 + t ^ 2) ^ 2 * P (compMod (landenL r))) / r ^ 2 := by rw [div_eq_mul_inv, hL]; field_simp rw [hLHS, hRHS, ht_sq] exact div_le_div_of_nonneg_right (by linarith) (sq_nonneg r) lemma profileBound_landen_step_gt {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, landenDefect P t < 0) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P r < profileBound P (landenL r) / 2 := by set t := Real.sqrt (compMod r) have hrp := compMod_mem_Ioo hr have ht_pos : 0 < t := Real.sqrt_pos.mpr hrp.1 have ht_lt1 : t < 1 := by rw [Real.sqrt_lt' zero_lt_one, one_pow]; exact hrp.2 have ht_sq : t ^ 2 = compMod r := Real.sq_sqrt (le_of_lt hrp.1) have h1t2 : 0 < 1 + t ^ 2 := by positivity have hP1 : 0 < P (compMod r) := hP_pos _ hrp have hP2 : 0 < P (compMod (landenL r)) := hP_pos _ (compMod_mem_Ioo (landenL_mem_Ioo hr)) have hcompL : compMod (landenL r) = 2 * t / (1 + t ^ 2) := by rw [compMod_landenL hr]; unfold landenA; rw [ht_sq] have hL : landenL r = r ^ 2 / (1 + t ^ 2) ^ 2 := by rw [landenL_eq_sq_div hr, ht_sq] have hd : landenDefect P t < 0 := hdef t ⟨ht_pos, ht_lt1⟩ unfold landenDefect at hd rw [← hcompL, ht_sq] at hd unfold profileBound rw [lt_div_iff₀ two_pos] have h2log : Real.log (4 * P (compMod r) / r) * 2 = Real.log ((4 * P (compMod r) / r) ^ 2) := by rw [mul_comm, ← Real.log_rpow (div_pos (mul_pos (by norm_num) hP1) hr.1), show (2 : ℝ) = (2 : ℕ) by norm_num, Real.rpow_natCast] rw [h2log] refine Real.log_lt_log (sq_pos_of_pos (div_pos (mul_pos (by norm_num) hP1) hr.1)) ?_ have hrne : r ≠ 0 := ne_of_gt hr.1 have h1tne : 1 + t ^ 2 ≠ 0 := ne_of_gt h1t2 have hLHS : (4 * P (compMod r) / r) ^ 2 = 4 * (4 * P (compMod r) ^ 2) / r ^ 2 := by field_simp have hRHS : 4 * P (compMod (landenL r)) / landenL r = 4 * ((1 + t ^ 2) ^ 2 * P (compMod (landenL r))) / r ^ 2 := by rw [div_eq_mul_inv, hL]; field_simp rw [hLHS, hRHS, ht_sq] exact div_lt_div_of_pos_right (by linarith) (sq_pos_of_pos hr.1) /-- **Master Algebraic Landen Upper-Bound Theorem**: If `P > 0` on `(0, 1)`, `P(x) → 1` as `x → 1⁻`, and `landenDefect P t ≥ 0` on `(0, 1)`, then `μ(r) ≤ profileBound P (L^[n](r)) / 2^n ≤ profileBound P r` for every `n : ℕ` and `r ∈ (0, 1)`. -/ theorem grotzschMu_le_landen_iter_of_super {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hP_lim : Tendsto P (nhdsWithin 1 (Iio 1)) (nhds 1)) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, 0 ≤ landenDefect P t) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) (n : ℕ) : grotzschMu r ≤ profileBound P (landenL^[n] r) / (2 : ℝ) ^ n := by have hanti : Antitone (fun k => profileBound P (landenL^[k] r) / (2 : ℝ) ^ k) := by refine antitone_nat_of_succ_le (fun k => ?_) rw [Function.iterate_succ_apply', pow_succ', ← div_div] exact div_le_div_of_nonneg_right (profileBound_landen_step_le hP_pos hdef (landenL_iter_mem_Ioo hr k)) (pow_nonneg (by norm_num : (0 : ℝ) ≤ 2) k) have htend := tendsto_landen_log_profile hP_lim hr exact le_of_tendsto htend (eventually_atTop.mpr ⟨n, fun _ hk => hanti hk⟩) theorem grotzschMu_lt_of_landenSuper {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hP_lim : Tendsto P (nhdsWithin 1 (Iio 1)) (nhds 1)) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, 0 < landenDefect P t) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu r < profileBound P r := by have h1 := grotzschMu_le_landen_iter_of_super hP_pos hP_lim (fun t ht => le_of_lt (hdef t ht)) hr 1 simp only [Function.iterate_one, pow_one] at h1 exact lt_of_le_of_lt h1 (profileBound_landen_step_lt hP_pos hdef hr) /-- **Master Algebraic Landen Lower-Bound Theorem**: If `P > 0` on `(0, 1)`, `P(x) → 1` as `x → 1⁻`, and `landenDefect P t ≤ 0` on `(0, 1)`, then `profileBound P r ≤ profileBound P (L^[n](r)) / 2^n ≤ μ(r)` for every `n : ℕ` and `r ∈ (0, 1)`. -/ theorem landen_iter_le_grotzschMu_of_sub {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hP_lim : Tendsto P (nhdsWithin 1 (Iio 1)) (nhds 1)) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, landenDefect P t ≤ 0) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) (n : ℕ) : profileBound P (landenL^[n] r) / (2 : ℝ) ^ n ≤ grotzschMu r := by have hmono : Monotone (fun k => profileBound P (landenL^[k] r) / (2 : ℝ) ^ k) := by refine monotone_nat_of_le_succ (fun k => ?_) rw [Function.iterate_succ_apply', pow_succ', ← div_div] exact div_le_div_of_nonneg_right (profileBound_landen_step_ge hP_pos hdef (landenL_iter_mem_Ioo hr k)) (pow_nonneg (by norm_num : (0 : ℝ) ≤ 2) k) have htend := tendsto_landen_log_profile hP_lim hr exact ge_of_tendsto htend (eventually_atTop.mpr ⟨n, fun _ hk => hmono hk⟩) theorem lt_grotzschMu_of_landenSub {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) (hP_lim : Tendsto P (nhdsWithin 1 (Iio 1)) (nhds 1)) (hdef : ∀ t ∈ Ioo (0 : ℝ) 1, landenDefect P t < 0) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P r < grotzschMu r := by have h1 := landen_iter_le_grotzschMu_of_sub hP_pos hP_lim (fun t ht => le_of_lt (hdef t ht)) hr 1 simp only [Function.iterate_one, pow_one] at h1 exact lt_of_lt_of_le (profileBound_landen_step_gt hP_pos hdef hr) h1 /-- **Modularity Self-Dual Upgrade**: any lower/upper Landen pair `(P_lo, P_hi)` automatically yields a globally self-dual two-sided bracket across all `r ∈ (0, 1)`. -/ theorem grotzschMu_selfDual_bracket {P_lo P_hi : ℝ → ℝ} (hlo : ∀ r ∈ Ioo (0 : ℝ) 1, 0 < profileBound P_lo r ∧ profileBound P_lo r < grotzschMu r) (hhi : ∀ r ∈ Ioo (0 : ℝ) 1, grotzschMu r < profileBound P_hi r) {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : max (profileBound P_lo r) ((Real.pi ^ 2 / 4) / profileBound P_hi (compMod r)) < grotzschMu r ∧ grotzschMu r < min (profileBound P_hi r) ((Real.pi ^ 2 / 4) / profileBound P_lo (compMod r)) := by have hrp := compMod_mem_Ioo hr have hmul := grotzschMu_mul_comp hr have hmu_r := grotzschMu_pos hr have hmu_p := grotzschMu_pos hrp have hhi_p := hhi (compMod r) hrp have hlo_p := hlo (compMod r) hrp constructor · refine max_lt (hlo r hr).2 ?_ rw [div_lt_iff₀ (lt_trans hmu_p hhi_p), ← hmul] exact mul_lt_mul_of_pos_left hhi_p hmu_r · refine lt_min (hhi r hr) ?_ rw [lt_div_iff₀ hlo_p.1, ← hmul] exact mul_lt_mul_of_pos_left hlo_p.2 hmu_r /-! ### Section 5: The 10-Rung Rational Padé–Landen Hierarchy for `μ(r)` -/ /-- Classical Qiu–Vuorinen `[1/0]` lower profile `(3x + 1) / 4`. -/ def P_QV (x : ℝ) : ℝ := (3 * x + 1) / 4 /-- Padé `[1/1]` lower profile `(5x + 1) / (2(x + 2))`. -/ def P_11_lo (x : ℝ) : ℝ := (5 * x + 1) / (2 * (x + 2)) /-- Padé `[2/1]` lower profile `(13x² + 18x + 1) / (4(7x + 1))`. -/ def P_21_lo (x : ℝ) : ℝ := (13 * x ^ 2 + 18 * x + 1) / (4 * (7 * x + 1)) /-- Padé `[2/2]` lower profile `(199x² + 210x + 7) / (4(3x² + 94x + 7))`. -/ def P_22_lo (x : ℝ) : ℝ := (199 * x ^ 2 + 210 * x + 7) / (4 * (3 * x ^ 2 + 94 * x + 7)) /-- Padé `[3/2]` lower profile `(193x³ + 809x² + 523x + 11) / (4(5x + 11)(23x + 1))`. -/ def P_32_lo (x : ℝ) : ℝ := (193 * x ^ 3 + 809 * x ^ 2 + 523 * x + 11) / (4 * (5 * x + 11) * (23 * x + 1)) /-- Padé `[2/2]` upper profile `(295x² + 482x + 119) / (11x² + 602x + 283)`. -/ def P_22_hi (x : ℝ) : ℝ := (295 * x ^ 2 + 482 * x + 119) / (11 * x ^ 2 + 602 * x + 283) /-- Padé `[2/1]` palindromic upper profile `(7x² + 18x + 7) / (16(x + 1))`. -/ def P_21_hi (x : ℝ) : ℝ := (7 * x ^ 2 + 18 * x + 7) / (16 * (x + 1)) /-- Padé `[1/1]` upper profile `(9x + 7) / (x + 15)`. -/ def P_11_hi (x : ℝ) : ℝ := (9 * x + 7) / (x + 15) /-- Classical Anderson–Vamanamurthy–Vuorinen `[1/0]` upper profile `(x + 1) / 2`. -/ def P_AVV (x : ℝ) : ℝ := (x + 1) / 2 -- Exact positive-coefficient Landen defect proofs (zero calculus!): lemma landenDefect_P_AVV_pos {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : 0 < landenDefect P_AVV t := by unfold landenDefect P_AVV have h1t : 0 < 1 + t ^ 2 := by positivity have hid : 4 * ((t ^ 2 + 1) / 2) ^ 2 - (1 + t ^ 2) ^ 2 * ((2 * t / (1 + t ^ 2) + 1) / 2) = (1 - t) ^ 2 * (t ^ 2 + 1) / 2 := by field_simp; ring rw [hid] have h1m : 0 < 1 - t := sub_pos.mpr ht.2 positivity lemma landenDefect_P_11_hi_pos {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : 0 < landenDefect P_11_hi t := by unfold landenDefect P_11_hi have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hd1 : 0 < t ^ 2 + 15 := by positivity have hd2 : 0 < 15 * t ^ 2 + 2 * t + 15 := by positivity have hd3 : 0 < 1 + t ^ 2 := by positivity have hid : 4 * ((9 * t ^ 2 + 7) / (t ^ 2 + 15)) ^ 2 - (1 + t ^ 2) ^ 2 * ((9 * (2 * t / (1 + t ^ 2)) + 7) / (2 * t / (1 + t ^ 2) + 15)) = (1 - t) ^ 3 * (7 * t ^ 7 + 39 * t ^ 6 + 327 * t ^ 5 + 1447 * t ^ 4 + 765 * t ^ 3 + 2781 * t ^ 2 + 437 * t + 1365) / ((t ^ 2 + 15) ^ 2 * (15 * t ^ 2 + 2 * t + 15)) := by have hne1 : t ^ 2 + 15 ≠ 0 := ne_of_gt hd1 have hne2 : 15 * t ^ 2 + 2 * t + 15 ≠ 0 := ne_of_gt hd2 have hne3 : 1 + t ^ 2 ≠ 0 := ne_of_gt hd3 have hne4 : 2 * t / (1 + t ^ 2) + 15 ≠ 0 := by positivity field_simp; ring rw [hid]; positivity lemma landenDefect_P_21_hi_pos {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : 0 < landenDefect P_21_hi t := by unfold landenDefect P_21_hi have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hid : 4 * ((7 * (t ^ 2) ^ 2 + 18 * t ^ 2 + 7) / (16 * (t ^ 2 + 1))) ^ 2 - (1 + t ^ 2) ^ 2 * ((7 * (2 * t / (1 + t ^ 2)) ^ 2 + 18 * (2 * t / (1 + t ^ 2)) + 7) / (16 * (2 * t / (1 + t ^ 2) + 1))) = (1 - t) ^ 4 * (21 * t ^ 6 + 38 * t ^ 5 + 75 * t ^ 4 + 84 * t ^ 3 + 75 * t ^ 2 + 38 * t + 21) / (64 * (t + 1) ^ 2 * (t ^ 2 + 1) ^ 2) := by have hne1 : t ^ 2 + 1 ≠ 0 := by positivity have hne2 : t + 1 ≠ 0 := by positivity have hne3 : 2 * t / (1 + t ^ 2) + 1 ≠ 0 := by positivity field_simp; ring rw [hid]; positivity lemma landenDefect_P_22_hi_pos {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : 0 < landenDefect P_22_hi t := by unfold landenDefect P_22_hi have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hid : 4 * ((295 * (t ^ 2) ^ 2 + 482 * t ^ 2 + 119) / (11 * (t ^ 2) ^ 2 + 602 * t ^ 2 + 283)) ^ 2 - (1 + t ^ 2) ^ 2 * ((295 * (2 * t / (1 + t ^ 2)) ^ 2 + 482 * (2 * t / (1 + t ^ 2)) + 119) / (11 * (2 * t / (1 + t ^ 2)) ^ 2 + 602 * (2 * t / (1 + t ^ 2)) + 283)) = (1 - t) ^ 5 * (14399 * t ^ 11 + 188639 * t ^ 10 + 2575617 * t ^ 9 + 24252833 * t ^ 8 + 64981078 * t ^ 7 + 82102934 * t ^ 6 + 148194434 * t ^ 5 + 95340482 * t ^ 4 + 109164731 * t ^ 3 + 43699675 * t ^ 2 + 23491885 * t + 6499661) / ((11 * t ^ 4 + 602 * t ^ 2 + 283) ^ 2 * (283 * t ^ 4 + 1204 * t ^ 3 + 610 * t ^ 2 + 1204 * t + 283)) := by have hne1 : 11 * (t ^ 2) ^ 2 + 602 * t ^ 2 + 283 ≠ 0 := by positivity have hne2 : 11 * t ^ 4 + 602 * t ^ 2 + 283 ≠ 0 := by positivity have hne3 : 283 * t ^ 4 + 1204 * t ^ 3 + 610 * t ^ 2 + 1204 * t + 283 ≠ 0 := by positivity have hne4 : 1 + t ^ 2 ≠ 0 := by positivity have hne5 : 11 * (2 * t / (1 + t ^ 2)) ^ 2 + 602 * (2 * t / (1 + t ^ 2)) + 283 ≠ 0 := by positivity field_simp; ring rw [hid]; positivity lemma landenDefect_P_QV_neg {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : landenDefect P_QV t < 0 := by unfold landenDefect P_QV have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hid : 4 * ((3 * t ^ 2 + 1) / 4) ^ 2 - (1 + t ^ 2) ^ 2 * ((3 * (2 * t / (1 + t ^ 2)) + 1) / 4) = -(t * (1 - t) * (8 * t ^ 2 + 2 * t + 6) / 4) := by have hne : 1 + t ^ 2 ≠ 0 := by positivity field_simp; ring rw [hid]; linarith [show 0 < t * (1 - t) * (8 * t ^ 2 + 2 * t + 6) / 4 by positivity] lemma landenDefect_P_11_lo_neg {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : landenDefect P_11_lo t < 0 := by unfold landenDefect P_11_lo have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hid : 4 * ((5 * t ^ 2 + 1) / (2 * (t ^ 2 + 2))) ^ 2 - (1 + t ^ 2) ^ 2 * ((5 * (2 * t / (1 + t ^ 2)) + 1) / (2 * (2 * t / (1 + t ^ 2) + 2))) = -(t * (1 - t) ^ 2 * (t ^ 7 + 12 * t ^ 6 + 30 * t ^ 5 + 108 * t ^ 4 + 105 * t ^ 3 + 132 * t ^ 2 + 44 * t + 36) / (4 * (t ^ 2 + 2) ^ 2 * (t ^ 2 + t + 1))) := by have hne1 : t ^ 2 + 2 ≠ 0 := by positivity have hne2 : t ^ 2 + t + 1 ≠ 0 := by positivity have hne3 : 1 + t ^ 2 ≠ 0 := by positivity have hne4 : 2 * t / (1 + t ^ 2) + 2 ≠ 0 := by positivity field_simp; ring rw [hid] have hpos : 0 < t * (1 - t) ^ 2 * (t ^ 7 + 12 * t ^ 6 + 30 * t ^ 5 + 108 * t ^ 4 + 105 * t ^ 3 + 132 * t ^ 2 + 44 * t + 36) / (4 * (t ^ 2 + 2) ^ 2 * (t ^ 2 + t + 1)) := by positivity linarith lemma landenDefect_P_21_lo_neg {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : landenDefect P_21_lo t < 0 := by unfold landenDefect P_21_lo have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hid : 4 * ((13 * (t ^ 2) ^ 2 + 18 * t ^ 2 + 1) / (4 * (7 * t ^ 2 + 1))) ^ 2 - (1 + t ^ 2) ^ 2 * ((13 * (2 * t / (1 + t ^ 2)) ^ 2 + 18 * (2 * t / (1 + t ^ 2)) + 1) / (4 * (7 * (2 * t / (1 + t ^ 2)) + 1))) = -(t * (1 - t) ^ 3 * (120 * t ^ 6 + 962 * t ^ 5 + 454 * t ^ 4 + 1116 * t ^ 3 + 300 * t ^ 2 + 98 * t + 22) / (4 * (7 * t ^ 2 + 1) ^ 2 * (t ^ 2 + 14 * t + 1))) := by have hne1 : 7 * t ^ 2 + 1 ≠ 0 := by positivity have hne2 : t ^ 2 + 14 * t + 1 ≠ 0 := by positivity have hne3 : 1 + t ^ 2 ≠ 0 := by positivity have hne4 : 7 * (2 * t / (1 + t ^ 2)) + 1 ≠ 0 := by positivity field_simp; ring rw [hid] have hpos : 0 < t * (1 - t) ^ 3 * (120 * t ^ 6 + 962 * t ^ 5 + 454 * t ^ 4 + 1116 * t ^ 3 + 300 * t ^ 2 + 98 * t + 22) / (4 * (7 * t ^ 2 + 1) ^ 2 * (t ^ 2 + 14 * t + 1)) := by positivity linarith lemma landenDefect_P_22_lo_neg {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : landenDefect P_22_lo t < 0 := by unfold landenDefect P_22_lo have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hid : 4 * ((199 * (t ^ 2) ^ 2 + 210 * t ^ 2 + 7) / (4 * (3 * (t ^ 2) ^ 2 + 94 * t ^ 2 + 7))) ^ 2 - (1 + t ^ 2) ^ 2 * ((199 * (2 * t / (1 + t ^ 2)) ^ 2 + 210 * (2 * t / (1 + t ^ 2)) + 7) / (4 * (3 * (2 * t / (1 + t ^ 2)) ^ 2 + 94 * (2 * t / (1 + t ^ 2)) + 7))) = -(t * (1 - t) ^ 4 * (63 * t ^ 11 + 4032 * t ^ 10 + 27114 * t ^ 9 + 332736 * t ^ 8 + 1448706 * t ^ 7 + 908584 * t ^ 6 + 2884920 * t ^ 5 + 845656 * t ^ 4 + 1536423 * t ^ 3 + 277144 * t ^ 2 + 73206 * t + 11368) / (4 * (3 * t ^ 4 + 94 * t ^ 2 + 7) ^ 2 * (7 * t ^ 4 + 188 * t ^ 3 + 26 * t ^ 2 + 188 * t + 7))) := by have hne1 : 3 * (t ^ 2) ^ 2 + 94 * t ^ 2 + 7 ≠ 0 := by positivity have hne2 : 3 * t ^ 4 + 94 * t ^ 2 + 7 ≠ 0 := by positivity have hne3 : 7 * t ^ 4 + 188 * t ^ 3 + 26 * t ^ 2 + 188 * t + 7 ≠ 0 := by positivity have hne4 : 1 + t ^ 2 ≠ 0 := by positivity have hne5 : 3 * (2 * t / (1 + t ^ 2)) ^ 2 + 94 * (2 * t / (1 + t ^ 2)) + 7 ≠ 0 := by positivity field_simp; ring rw [hid] have hpos : 0 < t * (1 - t) ^ 4 * (63 * t ^ 11 + 4032 * t ^ 10 + 27114 * t ^ 9 + 332736 * t ^ 8 + 1448706 * t ^ 7 + 908584 * t ^ 6 + 2884920 * t ^ 5 + 845656 * t ^ 4 + 1536423 * t ^ 3 + 277144 * t ^ 2 + 73206 * t + 11368) / (4 * (3 * t ^ 4 + 94 * t ^ 2 + 7) ^ 2 * (7 * t ^ 4 + 188 * t ^ 3 + 26 * t ^ 2 + 188 * t + 7)) := by positivity linarith lemma landenDefect_P_32_lo_neg {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : landenDefect P_32_lo t < 0 := by unfold landenDefect P_32_lo have ht0 := ht.1; have h1m : 0 < 1 - t := sub_pos.mpr ht.2 have hid : 4 * ((193 * (t ^ 2) ^ 3 + 809 * (t ^ 2) ^ 2 + 523 * t ^ 2 + 11) / (4 * (5 * t ^ 2 + 11) * (23 * t ^ 2 + 1))) ^ 2 - (1 + t ^ 2) ^ 2 * ((193 * (2 * t / (1 + t ^ 2)) ^ 3 + 809 * (2 * t / (1 + t ^ 2)) ^ 2 + 523 * (2 * t / (1 + t ^ 2)) + 11) / (4 * (5 * (2 * t / (1 + t ^ 2)) + 11) * (23 * (2 * t / (1 + t ^ 2)) + 1))) = -(t * (1 - t) ^ 5 * (264264 * t ^ 10 + 6708454 * t ^ 9 + 8257922 * t ^ 8 + 33212488 * t ^ 7 + 27731912 * t ^ 6 + 46828868 * t ^ 5 + 21890380 * t ^ 4 + 20297992 * t ^ 3 + 2838176 * t ^ 2 + 595078 * t + 64130) / (4 * (5 * t ^ 2 + 11) ^ 2 * (23 * t ^ 2 + 1) ^ 2 * (t ^ 2 + 46 * t + 1) * (11 * t ^ 2 + 10 * t + 11))) := by have hne1 : 5 * t ^ 2 + 11 ≠ 0 := by positivity have hne2 : 23 * t ^ 2 + 1 ≠ 0 := by positivity have hne3 : t ^ 2 + 46 * t + 1 ≠ 0 := by positivity have hne4 : 11 * t ^ 2 + 10 * t + 11 ≠ 0 := by positivity have hne5 : 1 + t ^ 2 ≠ 0 := by positivity have hne6 : 5 * (2 * t / (1 + t ^ 2)) + 11 ≠ 0 := by positivity have hne7 : 23 * (2 * t / (1 + t ^ 2)) + 1 ≠ 0 := by positivity field_simp; ring rw [hid] have hpos : 0 < t * (1 - t) ^ 5 * (264264 * t ^ 10 + 6708454 * t ^ 9 + 8257922 * t ^ 8 + 33212488 * t ^ 7 + 27731912 * t ^ 6 + 46828868 * t ^ 5 + 21890380 * t ^ 4 + 20297992 * t ^ 3 + 2838176 * t ^ 2 + 595078 * t + 64130) / (4 * (5 * t ^ 2 + 11) ^ 2 * (23 * t ^ 2 + 1) ^ 2 * (t ^ 2 + 46 * t + 1) * (11 * t ^ 2 + 10 * t + 11)) := by positivity linarith -- Exact strict nesting of all 10 rational rungs via pure monomial powers of (1 - x)! lemma P_QV_lt_P_11_lo {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_QV x < P_11_lo x := by unfold P_QV P_11_lo have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hid : (5 * x + 1) / (2 * (x + 2)) - (3 * x + 1) / 4 = 3 * x * (1 - x) / (4 * (x + 2)) := by have : x + 2 ≠ 0 := by linarith field_simp; ring linarith [show 0 < 3 * x * (1 - x) / (4 * (x + 2)) by positivity] lemma P_11_lo_lt_P_21_lo {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_11_lo x < P_21_lo x := by unfold P_11_lo P_21_lo have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hid : (13 * x ^ 2 + 18 * x + 1) / (4 * (7 * x + 1)) - (5 * x + 1) / (2 * (x + 2)) = 13 * x * (1 - x) ^ 2 / (4 * (x + 2) * (7 * x + 1)) := by have h1 : x + 2 ≠ 0 := by positivity have h2 : 7 * x + 1 ≠ 0 := by positivity field_simp; ring linarith [show 0 < 13 * x * (1 - x) ^ 2 / (4 * (x + 2) * (7 * x + 1)) by positivity] lemma P_21_lo_lt_P_22_lo {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_21_lo x < P_22_lo x := by unfold P_21_lo P_22_lo have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hid : (199 * x ^ 2 + 210 * x + 7) / (4 * (3 * x ^ 2 + 94 * x + 7)) - (13 * x ^ 2 + 18 * x + 1) / (4 * (7 * x + 1)) = 39 * x * (1 - x) ^ 3 / (4 * (7 * x + 1) * (3 * x ^ 2 + 94 * x + 7)) := by have h1 : 7 * x + 1 ≠ 0 := by positivity have h2 : 3 * x ^ 2 + 94 * x + 7 ≠ 0 := by positivity field_simp; ring linarith [show 0 < 39 * x * (1 - x) ^ 3 / (4 * (7 * x + 1) * (3 * x ^ 2 + 94 * x + 7)) by positivity] lemma P_22_lo_lt_P_32_lo {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_22_lo x < P_32_lo x := by unfold P_22_lo P_32_lo have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hid : (193 * x ^ 3 + 809 * x ^ 2 + 523 * x + 11) / (4 * (5 * x + 11) * (23 * x + 1)) - (199 * x ^ 2 + 210 * x + 7) / (4 * (3 * x ^ 2 + 94 * x + 7)) = 579 * x * (1 - x) ^ 4 / (4 * (5 * x + 11) * (23 * x + 1) * (3 * x ^ 2 + 94 * x + 7)) := by have h1 : 5 * x + 11 ≠ 0 := by positivity have h2 : 23 * x + 1 ≠ 0 := by positivity have h3 : 3 * x ^ 2 + 94 * x + 7 ≠ 0 := by positivity field_simp; ring linarith [show 0 < 579 * x * (1 - x) ^ 4 / (4 * (5 * x + 11) * (23 * x + 1) * (3 * x ^ 2 + 94 * x + 7)) by positivity] lemma P_22_hi_lt_P_21_hi {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_22_hi x < P_21_hi x := by unfold P_22_hi P_21_hi have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hid : (7 * x ^ 2 + 18 * x + 7) / (16 * (x + 1)) - (295 * x ^ 2 + 482 * x + 119) / (11 * x ^ 2 + 602 * x + 283) = 77 * (1 - x) ^ 4 / (16 * (x + 1) * (11 * x ^ 2 + 602 * x + 283)) := by have h1 : x + 1 ≠ 0 := by positivity have h2 : 11 * x ^ 2 + 602 * x + 283 ≠ 0 := by positivity field_simp; ring linarith [show 0 < 77 * (1 - x) ^ 4 / (16 * (x + 1) * (11 * x ^ 2 + 602 * x + 283)) by positivity] lemma P_21_hi_lt_P_11_hi {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_21_hi x < P_11_hi x := by unfold P_21_hi P_11_hi have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hid : (9 * x + 7) / (x + 15) - (7 * x ^ 2 + 18 * x + 7) / (16 * (x + 1)) = 7 * (1 - x) ^ 3 / (16 * (x + 1) * (x + 15)) := by have h1 : x + 1 ≠ 0 := by positivity have h2 : x + 15 ≠ 0 := by positivity field_simp; ring linarith [show 0 < 7 * (1 - x) ^ 3 / (16 * (x + 1) * (x + 15)) by positivity] lemma P_11_hi_lt_P_AVV {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_11_hi x < P_AVV x := by unfold P_11_hi P_AVV have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hid : (x + 1) / 2 - (9 * x + 7) / (x + 15) = (1 - x) ^ 2 / (2 * (x + 15)) := by have h1 : x + 15 ≠ 0 := by positivity field_simp; ring linarith [show 0 < (1 - x) ^ 2 / (2 * (x + 15)) by positivity] lemma P_AVV_lt_one {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_AVV x < 1 := by unfold P_AVV; linarith [hx.2] -- Headline Grötzsch ring bounds for the sharpest upper & lower Padé invariants: /-- **Padé `[3/2]` Lower Bound on `μ(r)`**: `log((193 r'³ + 809 r'² + 523 r' + 11) / (r (5 r' + 11)(23 r' + 1))) < μ(r)` for all `r ∈ (0, 1)`. -/ theorem grotzschMu_gt_pade32_lo {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P_32_lo r < grotzschMu r := by refine lt_grotzschMu_of_landenSub (fun x hx => by unfold P_32_lo; have := hx.1; positivity) ?_ (fun t ht => landenDefect_P_32_lo_neg ht) hr have hcont : ContinuousAt P_32_lo 1 := by unfold P_32_lo refine ContinuousAt.div (by fun_prop) (by fun_prop) (by norm_num) have hval : P_32_lo 1 = 1 := by unfold P_32_lo; norm_num simpa [hval] using hcont.continuousWithinAt.tendsto /-- **Padé `[2/2]` Lower Bound on `μ(r)`**. -/ theorem grotzschMu_gt_pade22_lo {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P_22_lo r < grotzschMu r := by refine lt_grotzschMu_of_landenSub (fun x hx => by unfold P_22_lo; have := hx.1; positivity) ?_ (fun t ht => landenDefect_P_22_lo_neg ht) hr have hcont : ContinuousAt P_22_lo 1 := by unfold P_22_lo; refine ContinuousAt.div (by fun_prop) (by fun_prop) (by norm_num) have hval : P_22_lo 1 = 1 := by unfold P_22_lo; norm_num simpa [hval] using hcont.continuousWithinAt.tendsto /-- **Padé `[2/2]` Upper Bound on `μ(r)`**: `μ(r) < log(4(295 r'² + 482 r' + 119) / (r(11 r'² + 602 r' + 283)))` for all `r ∈ (0, 1)`. -/ theorem grotzschMu_lt_pade22_hi {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu r < profileBound P_22_hi r := by refine grotzschMu_lt_of_landenSuper (fun x hx => by unfold P_22_hi; have := hx.1; positivity) ?_ (fun t ht => landenDefect_P_22_hi_pos ht) hr have hcont : ContinuousAt P_22_hi 1 := by unfold P_22_hi; refine ContinuousAt.div (by fun_prop) (by fun_prop) (by norm_num) have hval : P_22_hi 1 = 1 := by unfold P_22_hi; norm_num simpa [hval] using hcont.continuousWithinAt.tendsto /-- **Padé `[2/1]` Palindromic Upper Bound on `μ(r)`**: `μ(r) < log((7 r'² + 18 r' + 7) / (4 r (r' + 1)))` for all `r ∈ (0, 1)`. -/ theorem grotzschMu_lt_pade21_hi {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu r < profileBound P_21_hi r := by refine grotzschMu_lt_of_landenSuper (fun x hx => by unfold P_21_hi; have := hx.1; positivity) ?_ (fun t ht => landenDefect_P_21_hi_pos ht) hr have hcont : ContinuousAt P_21_hi 1 := by unfold P_21_hi; refine ContinuousAt.div (by fun_prop) (by fun_prop) (by norm_num) have hval : P_21_hi 1 = 1 := by unfold P_21_hi; norm_num simpa [hval] using hcont.continuousWithinAt.tendsto /-- **Classical AVV (1990) Upper Bound** proved in 2 lines from `landenDefect_P_AVV_pos`: `μ(r) < log(2(1 + r') / r)`. -/ theorem grotzschMu_lt_AVV {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu r < profileBound P_AVV r := by refine grotzschMu_lt_of_landenSuper (fun x hx => by unfold P_AVV; linarith [hx.1]) ?_ (fun t ht => landenDefect_P_AVV_pos ht) hr have hcont : ContinuousAt P_AVV 1 := by unfold P_AVV; fun_prop have hval : P_AVV 1 = 1 := by unfold P_AVV; norm_num simpa [hval] using hcont.continuousWithinAt.tendsto /-- **Complete Strict 10-Rung Rational Padé–Landen Ladder for the Grötzsch Ring Modulus `μ(r)`** across all `r ∈ (0, 1)` (strictly nesting Qiu–Vuorinen, Padé `[1/1]`, `[2/1]`, `[2/2]`, `[3/2]`, `μ(r)`, Padé `[2/2]`, `[2/1]`, `[1/1]`, AVV, and `log(4/r)`). -/ theorem grotzschMu_pade_ladder {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : profileBound P_QV r < profileBound P_11_lo r ∧ profileBound P_11_lo r < profileBound P_21_lo r ∧ profileBound P_21_lo r < profileBound P_22_lo r ∧ profileBound P_22_lo r < profileBound P_32_lo r ∧ profileBound P_32_lo r < grotzschMu r ∧ grotzschMu r < profileBound P_22_hi r ∧ profileBound P_22_hi r < profileBound P_21_hi r ∧ profileBound P_21_hi r < profileBound P_11_hi r ∧ profileBound P_11_hi r < profileBound P_AVV r ∧ profileBound P_AVV r < Real.log (4 / r) := by have hrp := compMod_mem_Ioo hr have monoLog : ∀ {a b : ℝ}, 0 < a → a < b → Real.log (4 * a / r) < Real.log (4 * b / r) := fun ha hab => Real.log_lt_log (div_pos (mul_pos (by norm_num) ha) hr.1) (div_lt_div_of_pos_right (mul_lt_mul_of_pos_left hab (by norm_num)) hr.1) have hQV_pos : 0 < P_QV (compMod r) := by unfold P_QV; linarith [hrp.1] have h11l_pos : 0 < P_11_lo (compMod r) := lt_trans hQV_pos (P_QV_lt_P_11_lo hrp) have h21l_pos : 0 < P_21_lo (compMod r) := lt_trans h11l_pos (P_11_lo_lt_P_21_lo hrp) have h22l_pos : 0 < P_22_lo (compMod r) := lt_trans h21l_pos (P_21_lo_lt_P_22_lo hrp) have h22h_pos : 0 < P_22_hi (compMod r) := by unfold P_22_hi; have := hrp.1; positivity have h21h_pos : 0 < P_21_hi (compMod r) := lt_trans h22h_pos (P_22_hi_lt_P_21_hi hrp) have h11h_pos : 0 < P_11_hi (compMod r) := lt_trans h21h_pos (P_21_hi_lt_P_11_hi hrp) have hAVV_pos : 0 < P_AVV (compMod r) := lt_trans h11h_pos (P_11_hi_lt_P_AVV hrp) refine ⟨monoLog hQV_pos (P_QV_lt_P_11_lo hrp), monoLog h11l_pos (P_11_lo_lt_P_21_lo hrp), monoLog h21l_pos (P_21_lo_lt_P_22_lo hrp), monoLog h22l_pos (P_22_lo_lt_P_32_lo hrp), grotzschMu_gt_pade32_lo hr, grotzschMu_lt_pade22_hi hr, monoLog h22h_pos (P_22_hi_lt_P_21_hi hrp), monoLog h21h_pos (P_21_hi_lt_P_11_hi hrp), monoLog h11h_pos (P_11_hi_lt_P_AVV hrp), ?_⟩ unfold profileBound simpa only [mul_one] using monoLog hAVV_pos (P_AVV_lt_one hrp) lemma profileBound_P_32_lo_pos {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : 0 < profileBound P_32_lo r := by have hrp := compMod_mem_Ioo hr have hgt : 1 / 4 < P_32_lo (compMod r) := by have h1 : 1 / 4 < P_QV (compMod r) := by unfold P_QV; linarith [hrp.1] exact lt_trans h1 (lt_trans (P_QV_lt_P_11_lo hrp) (lt_trans (P_11_lo_lt_P_21_lo hrp) (lt_trans (P_21_lo_lt_P_22_lo hrp) (P_22_lo_lt_P_32_lo hrp)))) unfold profileBound refine Real.log_pos ?_ rw [one_lt_div hr.1] linarith [hr.2] /-- **Globally Self-Dual Padé `[3/2]`–`[2/2]` Bracket on `μ(r)`** (relative width `< 4.7 × 10⁻⁶` uniformly across ALL `r ∈ (0, 1)`). -/ theorem grotzschMu_selfDual_pade32_22 {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : max (profileBound P_32_lo r) ((Real.pi ^ 2 / 4) / profileBound P_22_hi (compMod r)) < grotzschMu r ∧ grotzschMu r < min (profileBound P_22_hi r) ((Real.pi ^ 2 / 4) / profileBound P_32_lo (compMod r)) := grotzschMu_selfDual_bracket (fun _ hs => ⟨profileBound_P_32_lo_pos hs, grotzschMu_gt_pade32_lo hs⟩) (fun _ hs => grotzschMu_lt_pade22_hi hs) hr /-- **1-Step Landen Accelerated Self-Dual Padé `[3/2]`–`[2/2]` Bracket on `μ(r)`** (relative width `< 3.5 × 10⁻¹³` uniformly across ALL `r ∈ (0, 1)` — 13-digit accuracy from one descending Landen step!). -/ theorem grotzschMu_landen1_selfDual_pade32_22 {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : max (profileBound P_32_lo (landenL r) / 2) ((Real.pi ^ 2 / 4) / (profileBound P_22_hi (landenL (compMod r)) / 2)) < grotzschMu r ∧ grotzschMu r < min (profileBound P_22_hi (landenL r) / 2) ((Real.pi ^ 2 / 4) / (profileBound P_32_lo (landenL (compMod r)) / 2)) := by have hLr := landenL_mem_Ioo hr have hrp := compMod_mem_Ioo hr have hLrp := landenL_mem_Ioo hrp have hlo_r : profileBound P_32_lo (landenL r) / 2 < grotzschMu r := by have := grotzschMu_gt_pade32_lo hLr rw [grotzschMu_landenL hr] at this linarith have hhi_r : grotzschMu r < profileBound P_22_hi (landenL r) / 2 := by have := grotzschMu_lt_pade22_hi hLr rw [grotzschMu_landenL hr] at this linarith have hlo_p : profileBound P_32_lo (landenL (compMod r)) / 2 < grotzschMu (compMod r) := by have := grotzschMu_gt_pade32_lo hLrp rw [grotzschMu_landenL hrp] at this linarith have hhi_p : grotzschMu (compMod r) < profileBound P_22_hi (landenL (compMod r)) / 2 := by have := grotzschMu_lt_pade22_hi hLrp rw [grotzschMu_landenL hrp] at this linarith have hmul := grotzschMu_mul_comp hr have hmu_r := grotzschMu_pos hr have hmu_p := grotzschMu_pos hrp have hlo_p_pos : 0 < profileBound P_32_lo (landenL (compMod r)) / 2 := div_pos (profileBound_P_32_lo_pos hLrp) two_pos constructor · refine max_lt hlo_r ?_ rw [div_lt_iff₀ (lt_trans hmu_p hhi_p), ← hmul] exact mul_lt_mul_of_pos_left hhi_p hmu_r · refine lt_min hhi_r ?_ rw [lt_div_iff₀ hlo_p_pos, ← hmul] exact mul_lt_mul_of_pos_left hlo_p hmu_r /-! ### Section 6: Hersch–Pfluger Distortion `φ_K(r)`, Group Laws & Sub-Unity Padé Bounds -/ /-- Inverse of the Grötzsch ring modulus `μ⁻¹ : (0, ∞) → (0, 1)`. -/ def grotzschMuInv (y : ℝ) : ℝ := if hy : 0 < y then (exists_unique_grotzschMu_eq hy).exists.choose else 0 lemma grotzschMuInv_mem_Ioo {y : ℝ} (hy : 0 < y) : grotzschMuInv y ∈ Ioo (0 : ℝ) 1 := by unfold grotzschMuInv rw [dif_pos hy] exact (exists_unique_grotzschMu_eq hy).exists.choose_spec.1 lemma grotzschMu_grotzschMuInv {y : ℝ} (hy : 0 < y) : grotzschMu (grotzschMuInv y) = y := by unfold grotzschMuInv rw [dif_pos hy] exact (exists_unique_grotzschMu_eq hy).exists.choose_spec.2 lemma grotzschMuInv_grotzschMu {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMuInv (grotzschMu r) = r := by have hy := grotzschMu_pos hr exact (exists_unique_grotzschMu_eq hy).unique ⟨grotzschMuInv_mem_Ioo hy, grotzschMu_grotzschMuInv hy⟩ ⟨hr, rfl⟩ lemma grotzschMuInv_strictAnti {y₁ y₂ : ℝ} (hy₁ : 0 < y₁) (h : y₁ < y₂) : grotzschMuInv y₂ < grotzschMuInv y₁ := by have hy₂ : 0 < y₂ := lt_trans hy₁ h by_contra hge push Not at hge rcases eq_or_lt_of_le hge with heq | hlt · have := congrArg grotzschMu heq rw [grotzschMu_grotzschMuInv hy₁, grotzschMu_grotzschMuInv hy₂] at this linarith · have := grotzschMu_strictAnti (grotzschMuInv_mem_Ioo hy₁) (grotzschMuInv_mem_Ioo hy₂) hlt rw [grotzschMu_grotzschMuInv hy₁, grotzschMu_grotzschMuInv hy₂] at this linarith /-- The **Hersch–Pfluger distortion function** `φ_K(r) = μ⁻¹(μ(r) / K)` for `K > 0, r ∈ (0, 1)`. -/ def phiK (K r : ℝ) : ℝ := grotzschMuInv (grotzschMu r / K) lemma phiK_mem_Ioo {K r : ℝ} (hK : 0 < K) (hr : r ∈ Ioo (0 : ℝ) 1) : phiK K r ∈ Ioo (0 : ℝ) 1 := grotzschMuInv_mem_Ioo (div_pos (grotzschMu_pos hr) hK) /-- Defining conformal identity: `μ(φ_K(r)) = μ(r) / K`. -/ theorem grotzschMu_phiK {K r : ℝ} (hK : 0 < K) (hr : r ∈ Ioo (0 : ℝ) 1) : grotzschMu (phiK K r) = grotzschMu r / K := grotzschMu_grotzschMuInv (div_pos (grotzschMu_pos hr) hK) /-- Identity element of the Hersch–Pfluger group: `φ_1(r) = r`. -/ theorem phiK_one {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : phiK 1 r = r := by unfold phiK rw [div_one, grotzschMuInv_grotzschMu hr] /-- Exact semigroup / group law: `φ_{K₁}(φ_{K₂}(r)) = φ_{K₁ K₂}(r)`. -/ theorem phiK_comp {K₁ K₂ r : ℝ} (_hK₁ : 0 < K₁) (hK₂ : 0 < K₂) (hr : r ∈ Ioo (0 : ℝ) 1) : phiK K₁ (phiK K₂ r) = phiK (K₁ * K₂) r := by unfold phiK rw [grotzschMu_grotzschMuInv (div_pos (grotzschMu_pos hr) hK₂), div_div, mul_comm K₂ K₁] /-- **Hersch–Pfluger Modularity Identity**: `φ_K(r)² + φ_{1/K}(r')² = 1`. -/ theorem phiK_modularity {K r : ℝ} (hK : 0 < K) (hr : r ∈ Ioo (0 : ℝ) 1) : phiK K r ^ 2 + phiK (1 / K) (compMod r) ^ 2 = 1 := by have hphi := phiK_mem_Ioo hK hr have hrp := compMod_mem_Ioo hr have hcomp_eq : compMod (phiK K r) = phiK (1 / K) (compMod r) := by have hmu1 : grotzschMu (compMod (phiK K r)) = grotzschMu (compMod r) / (1 / K) := by have hm1 := grotzschMu_mul_comp hphi have hm2 := grotzschMu_mul_comp hr rw [grotzschMu_phiK hK hr] at hm1 have hne : grotzschMu r ≠ 0 := ne_of_gt (grotzschMu_pos hr) have hKne : K ≠ 0 := ne_of_gt hK have hprod : grotzschMu r * grotzschMu (compMod (phiK K r)) = grotzschMu r * (grotzschMu (compMod r) * K) := by have h1 : grotzschMu r * grotzschMu (compMod (phiK K r)) = K * (Real.pi ^ 2 / 4) := by field_simp at hm1; linarith rw [h1, ← hm2]; ring have hcancel := mul_left_cancel₀ hne hprod rw [one_div, div_inv_eq_mul] exact hcancel exact (exists_unique_grotzschMu_eq (div_pos (grotzschMu_pos hrp) (one_div_pos.mpr hK))).unique ⟨compMod_mem_Ioo hphi, hmu1⟩ ⟨phiK_mem_Ioo (one_div_pos.mpr hK) hrp, grotzschMu_phiK (one_div_pos.mpr hK) hrp⟩ rw [← hcomp_eq, compMod_sq (le_of_lt hphi.1) (le_of_lt hphi.2)] ring /-- Exact closed form at `K = 2`: `φ_2(r) = 2 √r / (1 + r)`. -/ theorem phiK_two {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : phiK 2 r = 2 * Real.sqrt r / (1 + r) := by have hA := landenA_mem_Ioo hr have hmu := grotzschMu_landenA hr exact (exists_unique_grotzschMu_eq (div_pos (grotzschMu_pos hr) two_pos)).unique ⟨phiK_mem_Ioo two_pos hr, grotzschMu_phiK two_pos hr⟩ ⟨hA, hmu⟩ /-- Exact closed form at `K = 1/2`: `φ_{1/2}(r) = (1 - r') / (1 + r')`. -/ theorem phiK_half {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : phiK (1 / 2) r = (1 - compMod r) / (1 + compMod r) := by have hL := landenL_mem_Ioo hr have hmu : grotzschMu (landenL r) = grotzschMu r / (1 / 2) := by rw [grotzschMu_landenL hr]; ring have hhalf : (0 : ℝ) < 1 / 2 := by norm_num exact (exists_unique_grotzschMu_eq (div_pos (grotzschMu_pos hr) hhalf)).unique ⟨phiK_mem_Ioo hhalf hr, grotzschMu_phiK hhalf hr⟩ ⟨hL, hmu⟩ lemma phiK_strictMono_K {K₁ K₂ r : ℝ} (hK₁ : 0 < K₁) (h : K₁ < K₂) (hr : r ∈ Ioo (0 : ℝ) 1) : phiK K₁ r < phiK K₂ r := by unfold phiK have hK₂ : 0 < K₂ := lt_trans hK₁ h have hmu := grotzschMu_pos hr refine grotzschMuInv_strictAnti (div_pos hmu hK₂) ?_ exact div_lt_div_of_pos_left hmu hK₁ h lemma r_le_phiK {K r : ℝ} (hK : 1 ≤ K) (hr : r ∈ Ioo (0 : ℝ) 1) : r ≤ phiK K r := by rcases eq_or_lt_of_le hK with rfl | hgt · rw [phiK_one hr] · calc r = phiK 1 r := (phiK_one hr).symm _ ≤ phiK K r := le_of_lt (phiK_strictMono_K zero_lt_one hgt hr) /-- The exact Landen profile `P*(x) = (√(1 - x²) / 4) exp(μ(√(1 - x²)))` for `x ∈ (0, 1)`. -/ def Pstar (x : ℝ) : ℝ := (compMod x / 4) * Real.exp (grotzschMu (compMod x)) lemma Pstar_pos {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : 0 < Pstar x := by unfold Pstar exact mul_pos (div_pos (compMod_pos hx.1 hx.2) (by norm_num)) (Real.exp_pos _) lemma Pstar_eq_exp_sub {r : ℝ} (hr : r ∈ Ioo (0 : ℝ) 1) : 4 * Pstar (compMod r) / r = Real.exp (grotzschMu r) := by unfold Pstar rw [compMod_compMod (le_of_lt hr.1) (le_of_lt hr.2)] have hrne : r ≠ 0 := ne_of_gt hr.1 field_simp lemma Pstar_bounds_pade {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_32_lo x < Pstar x ∧ Pstar x < P_22_hi x := by have hr := compMod_mem_Ioo hx have h1 := grotzschMu_gt_pade32_lo hr have h2 := grotzschMu_lt_pade22_hi hr unfold profileBound at h1 h2 rw [compMod_compMod (le_of_lt hx.1) (le_of_lt hx.2)] at h1 h2 have hP32 : 0 < P_32_lo x := by unfold P_32_lo; have := hx.1; positivity have hP22 : 0 < P_22_hi x := by unfold P_22_hi; have := hx.1; positivity have hexp1 : 4 * P_32_lo x / compMod x < Real.exp (grotzschMu (compMod x)) := by rw [← Real.exp_log (div_pos (mul_pos (by norm_num) hP32) hr.1)] exact Real.exp_lt_exp.mpr h1 have hexp2 : Real.exp (grotzschMu (compMod x)) < 4 * P_22_hi x / compMod x := by rw [← Real.exp_log (div_pos (mul_pos (by norm_num) hP22) hr.1)] exact Real.exp_lt_exp.mpr h2 unfold Pstar have hcpos : 0 < compMod x := hr.1 constructor · have hmul := mul_lt_mul_of_pos_left hexp1 (div_pos hcpos (by norm_num : (0 : ℝ) < 4)) have hsimp : compMod x / 4 * (4 * P_32_lo x / compMod x) = P_32_lo x := by have : compMod x ≠ 0 := ne_of_gt hcpos; field_simp linarith · have hmul := mul_lt_mul_of_pos_left hexp2 (div_pos hcpos (by norm_num : (0 : ℝ) < 4)) have hsimp : compMod x / 4 * (4 * P_22_hi x / compMod x) = P_22_hi x := by have : compMod x ≠ 0 := ne_of_gt hcpos; field_simp linarith lemma Pstar_bounds_pade21_22 {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : P_22_lo x < Pstar x ∧ Pstar x < P_21_hi x := ⟨lt_trans (P_22_lo_lt_P_32_lo hx) (Pstar_bounds_pade hx).1, lt_trans (Pstar_bounds_pade hx).2 (P_22_hi_lt_P_21_hi hx)⟩ /-- The Landen refinement operator `T[P](x) = ((1 + x) / 2) √(P(2 √x / (1 + x)))`. -/ def landenOp (P : ℝ → ℝ) (x : ℝ) : ℝ := ((1 + x) / 2) * Real.sqrt (P (landenA x)) lemma landenA_mono {x₁ x₂ : ℝ} (hx₁ : 0 < x₁) (h : x₁ ≤ x₂) (hx₂ : x₂ ≤ 1) : landenA x₁ ≤ landenA x₂ := by unfold landenA have h1 : 0 < 1 + x₁ := by linarith have h2 : 0 < 1 + x₂ := by linarith rw [div_le_div_iff₀ h1 h2] have hs1 : 0 ≤ Real.sqrt x₁ := Real.sqrt_nonneg x₁ have hs2 : 0 ≤ Real.sqrt x₂ := Real.sqrt_nonneg x₂ have hsle : Real.sqrt x₁ ≤ Real.sqrt x₂ := Real.sqrt_le_sqrt h have hprod : Real.sqrt x₁ * Real.sqrt x₂ ≤ 1 := by have : Real.sqrt x₁ * Real.sqrt x₂ ≤ Real.sqrt 1 * Real.sqrt 1 := mul_le_mul (Real.sqrt_le_sqrt (le_trans h hx₂)) (Real.sqrt_le_sqrt hx₂) hs2 (by positivity) simpa [Real.sqrt_one] using this have hsq1 : Real.sqrt x₁ ^ 2 = x₁ := Real.sq_sqrt (le_of_lt hx₁) have hsq2 : Real.sqrt x₂ ^ 2 = x₂ := Real.sq_sqrt (le_of_lt (lt_of_lt_of_le hx₁ h)) nlinarith [mul_nonneg (sub_nonneg.mpr hsle) (sub_nonneg.mpr hprod)] lemma landenOp_preserves_mono {P : ℝ → ℝ} (hP_mono : ∀ x₁ x₂, x₁ ∈ Ioo (0 : ℝ) 1 → x₂ ∈ Ioo (0 : ℝ) 1 → x₁ ≤ x₂ → P x₁ ≤ P x₂) : ∀ x₁ x₂, x₁ ∈ Ioo (0 : ℝ) 1 → x₂ ∈ Ioo (0 : ℝ) 1 → x₁ ≤ x₂ → landenOp P x₁ ≤ landenOp P x₂ := by intro x₁ x₂ hx₁ hx₂ hle unfold landenOp refine mul_le_mul (by linarith) ?_ (Real.sqrt_nonneg _) (by linarith [hx₂.1]) exact Real.sqrt_le_sqrt (hP_mono _ _ (landenA_mem_Ioo hx₁) (landenA_mem_Ioo hx₂) (landenA_mono hx₁.1 hle (le_of_lt hx₂.2))) lemma landenOp_iter_eq_exp_profile {P : ℝ → ℝ} (hP_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P x) : ∀ n (r : ℝ), r ∈ Ioo (0 : ℝ) 1 → (landenOp^[n] P) (compMod r) = (r / 4) * Real.exp (profileBound P (landenL^[n] r) / (2 : ℝ) ^ n) | 0, r, hr => by simp only [Function.iterate_zero, id_eq, pow_zero, div_one, profileBound] rw [Real.exp_log (div_pos (mul_pos (by norm_num) (hP_pos _ (compMod_mem_Ioo hr))) hr.1)] have hrne : r ≠ 0 := ne_of_gt hr.1 field_simp | n + 1, r, hr => by rw [Function.iterate_succ_apply'] change ((1 + compMod r) / 2) * Real.sqrt ((landenOp^[n] P) (landenA (compMod r))) = _ rw [← compMod_landenL hr, landenOp_iter_eq_exp_profile hP_pos n (landenL r) (landenL_mem_Ioo hr), ← Function.iterate_succ_apply landenL n r] set y := profileBound P (landenL^[n + 1] r) rw [landenL_eq_sq_div hr] have h1p : 0 < 1 + compMod r := by linarith [compMod_pos hr.1 hr.2] have hsqrt_arg : r ^ 2 / (1 + compMod r) ^ 2 / 4 * Real.exp (y / (2 : ℝ) ^ n) = ((r / (2 * (1 + compMod r))) * Real.exp (y / (2 : ℝ) ^ (n + 1))) ^ 2 := by rw [mul_pow, ← Real.exp_nat_mul] have hpow : (2 : ℕ) * (y / (2 : ℝ) ^ (n + 1)) = y / (2 : ℝ) ^ n := by push_cast; rw [pow_succ]; ring rw [hpow] have hne : 1 + compMod r ≠ 0 := ne_of_gt h1p field_simp; ring have hr0 : 0 < r := hr.1 rw [hsqrt_arg, Real.sqrt_sq (by positivity)] have hne : 1 + compMod r ≠ 0 := ne_of_gt h1p field_simp; ring /-- **Derivative-Free Monotonicity of `P*(x)`** via the Landen operator `T`! -/ theorem Pstar_mono {x₁ x₂ : ℝ} (hx₁ : x₁ ∈ Ioo (0 : ℝ) 1) (hx₂ : x₂ ∈ Ioo (0 : ℝ) 1) (hle : x₁ ≤ x₂) : Pstar x₁ ≤ Pstar x₂ := by have hP0_pos : ∀ x ∈ Ioo (0 : ℝ) 1, 0 < P_AVV x := fun x hx => by unfold P_AVV; linarith [hx.1] have hP0_mono : ∀ a b, a ∈ Ioo (0 : ℝ) 1 → b ∈ Ioo (0 : ℝ) 1 → a ≤ b → P_AVV a ≤ P_AVV b := fun _ _ _ _ hab => by unfold P_AVV; linarith have hiter_mono : ∀ n, ∀ a b, a ∈ Ioo (0 : ℝ) 1 → b ∈ Ioo (0 : ℝ) 1 → a ≤ b → (landenOp^[n] P_AVV) a ≤ (landenOp^[n] P_AVV) b := by intro n induction n with | zero => simpa using hP0_mono | succ k ih => intro a b ha hb hab simp only [Function.iterate_succ_apply'] exact landenOp_preserves_mono ih a b ha hb hab have hlim : ∀ x ∈ Ioo (0 : ℝ) 1, Tendsto (fun n => (landenOp^[n] P_AVV) x) atTop (nhds (Pstar x)) := by intro x hx have hr := compMod_mem_Ioo hx have hP_lim : Tendsto P_AVV (nhdsWithin 1 (Iio 1)) (nhds 1) := by have hc : ContinuousAt P_AVV 1 := by unfold P_AVV; fun_prop have hv : P_AVV 1 = 1 := by unfold P_AVV; norm_num simpa [hv] using hc.continuousWithinAt.tendsto have ht_exp : Tendsto (fun n => Real.exp (Real.log (4 * P_AVV (compMod (landenL^[n] (compMod x))) / (landenL^[n] (compMod x))) / (2 : ℝ) ^ n)) atTop (nhds (Real.exp (grotzschMu (compMod x)))) := (Real.continuous_exp.tendsto _).comp (tendsto_landen_log_profile hP_lim hr) have ht := ht_exp.const_mul (compMod x / 4) refine ht.congr (fun n => ?_) have heq := landenOp_iter_eq_exp_profile hP0_pos n (compMod x) hr rw [compMod_compMod (le_of_lt hx.1) (le_of_lt hx.2)] at heq exact heq.symm exact le_of_tendsto_of_tendsto (hlim x₁ hx₁) (hlim x₂ hx₂) (Eventually.of_forall (fun n => hiter_mono n x₁ x₂ hx₁ hx₂ hle)) /-- **Exact `P*` Factor Theorem for Hersch–Pfluger Distortion**: `φ_K(r) ≤ (4 P*(r'))^{1 - 1/K} r^{1/K}` for every `K ≥ 1` and `r ∈ (0, 1)`. -/ theorem phiK_le_Pstar_factor {K r : ℝ} (hK : 1 ≤ K) (hr : r ∈ Ioo (0 : ℝ) 1) : phiK K r ≤ (4 * Pstar (compMod r)) ^ (1 - 1 / K) * r ^ (1 / K) := by have hKpos : 0 < K := by linarith have hphi := phiK_mem_Ioo hKpos hr have h1 : Real.exp (grotzschMu (phiK K r)) = (Real.exp (grotzschMu r)) ^ (1 / K) := by rw [grotzschMu_phiK hKpos hr, ← Real.exp_mul, div_eq_mul_inv, one_div] rw [← Pstar_eq_exp_sub hphi, ← Pstar_eq_exp_sub hr] at h1 have hPr : 0 < Pstar (compMod r) := Pstar_pos (compMod_mem_Ioo hr) have hPphi : 0 < Pstar (compMod (phiK K r)) := Pstar_pos (compMod_mem_Ioo hphi) -- Express φ_K(r) = 4 P*(φ_K(r)') / (4 P*(r') / r)^(1/K) have hphi_eq : phiK K r = 4 * Pstar (compMod (phiK K r)) * (4 * Pstar (compMod r)) ^ (-(1 / K)) * r ^ (1 / K) := by have h4Pr : 0 < 4 * Pstar (compMod r) := by positivity rw [Real.div_rpow (le_of_lt h4Pr) (le_of_lt hr.1)] at h1 have hdiv_ne : (4 * Pstar (compMod r)) ^ (1 / K) ≠ 0 := ne_of_gt (Real.rpow_pos_of_pos h4Pr _) have hrK_ne : r ^ (1 / K) ≠ 0 := ne_of_gt (Real.rpow_pos_of_pos hr.1 _) have hphine : phiK K r ≠ 0 := ne_of_gt hphi.1 rw [Real.rpow_neg (le_of_lt h4Pr)] field_simp at h1 ⊢ nlinarith have hcomp_le : compMod (phiK K r) ≤ compMod r := by rcases eq_or_lt_of_le (r_le_phiK hK hr) with heq | hlt · rw [← heq] · exact le_of_lt (compMod_strictAnti (le_of_lt hr.1) hlt (le_of_lt hphi.2)) have hP_le : Pstar (compMod (phiK K r)) ≤ Pstar (compMod r) := Pstar_mono (compMod_mem_Ioo hphi) (compMod_mem_Ioo hr) hcomp_le have hpow_add : (4 * Pstar (compMod r)) * (4 * Pstar (compMod r)) ^ (-(1 / K)) = (4 * Pstar (compMod r)) ^ (1 - 1 / K) := by have h4Pr : 0 < 4 * Pstar (compMod r) := by positivity nth_rw 1 [← Real.rpow_one (4 * Pstar (compMod r))] rw [← Real.rpow_add h4Pr, sub_eq_add_neg] rw [hphi_eq] calc 4 * Pstar (compMod (phiK K r)) * (4 * Pstar (compMod r)) ^ (-(1 / K)) * r ^ (1 / K) ≤ 4 * Pstar (compMod r) * (4 * Pstar (compMod r)) ^ (-(1 / K)) * r ^ (1 / K) := by refine mul_le_mul_of_nonneg_right ?_ (le_of_lt (Real.rpow_pos_of_pos hr.1 _)) refine mul_le_mul_of_nonneg_right (by linarith) (le_of_lt (Real.rpow_pos_of_pos (by positivity) _)) _ = (4 * Pstar (compMod r)) ^ (1 - 1 / K) * r ^ (1 / K) := by rw [hpow_add] /-- **Universal Padé `[2/2]` Hersch–Pfluger Distortion Theorem** (strictly beating Anderson– Vamanamurthy–Vuorinen `4^{1 - 1/K} r^{1/K}` for EVERY `K > 1` and `r ∈ (0, 1)`!): `φ_K(r) < (4 P_22_hi(r'))^{1 - 1/K} r^{1/K} < (4 P_21_hi(r'))^{1 - 1/K} r^{1/K} < 4^{1 - 1/K} r^{1/K}`. -/ theorem phiK_lt_pade22_factor {K r : ℝ} (hK : 1 < K) (hr : r ∈ Ioo (0 : ℝ) 1) : phiK K r < (4 * P_22_hi (compMod r)) ^ (1 - 1 / K) * r ^ (1 / K) ∧ (4 * P_22_hi (compMod r)) ^ (1 - 1 / K) * r ^ (1 / K) < (4 * P_21_hi (compMod r)) ^ (1 - 1 / K) * r ^ (1 / K) ∧ (4 * P_21_hi (compMod r)) ^ (1 - 1 / K) * r ^ (1 / K) < 4 ^ (1 - 1 / K) * r ^ (1 / K) := by have hrp := compMod_mem_Ioo hr have hexp_pos : 0 < 1 - 1 / K := by have : 1 / K < 1 := (div_lt_one (by linarith)).mpr hK linarith have hrK_pos : 0 < r ^ (1 / K) := Real.rpow_pos_of_pos hr.1 _ have hPstar_lt : Pstar (compMod r) < P_22_hi (compMod r) := (Pstar_bounds_pade hrp).2 have h22_lt_21 : P_22_hi (compMod r) < P_21_hi (compMod r) := P_22_hi_lt_P_21_hi hrp have h21_lt_1 : P_21_hi (compMod r) < 1 := lt_trans (P_21_hi_lt_P_11_hi hrp) (lt_trans (P_11_hi_lt_P_AVV hrp) (P_AVV_lt_one hrp)) have hPstar_pos : 0 < Pstar (compMod r) := Pstar_pos hrp have h22_pos : 0 < P_22_hi (compMod r) := lt_trans hPstar_pos hPstar_lt have h21_pos : 0 < P_21_hi (compMod r) := lt_trans h22_pos h22_lt_21 refine ⟨?_, ?_, ?_⟩ · exact lt_of_le_of_lt (phiK_le_Pstar_factor (le_of_lt hK) hr) (mul_lt_mul_of_pos_right (Real.rpow_lt_rpow (by positivity) (by linarith) hexp_pos) hrK_pos) · exact mul_lt_mul_of_pos_right (Real.rpow_lt_rpow (by positivity) (by linarith) hexp_pos) hrK_pos · exact mul_lt_mul_of_pos_right (Real.rpow_lt_rpow (by positivity) (by linarith) hexp_pos) hrK_pos /-- **Closed-Form Sub-Unity Rational Hyperbolic Bound on `φ_K(r)`**: for every `K > 0` and `r ∈ (0, 1)`, writing `E = exp(profileBound P_32_lo r / K)`, if `E > 2` then `φ_K(r) < 4 E / (E² + 4) < 1` (strictly sub-unity everywhere!). -/ theorem phiK_lt_subunity_rational {K r : ℝ} (hK : 0 < K) (hr : r ∈ Ioo (0 : ℝ) 1) (hE : 2 < Real.exp (profileBound P_32_lo r / K)) : phiK K r < 4 * Real.exp (profileBound P_32_lo r / K) / (Real.exp (profileBound P_32_lo r / K) ^ 2 + 4) ∧ 4 * Real.exp (profileBound P_32_lo r / K) / (Real.exp (profileBound P_32_lo r / K) ^ 2 + 4) < 1 := by set E := Real.exp (profileBound P_32_lo r / K) have hphi := phiK_mem_Ioo hK hr have h1 : profileBound P_32_lo r / K < grotzschMu (phiK K r) := by rw [grotzschMu_phiK hK hr] exact div_lt_div_of_pos_right (grotzschMu_gt_pade32_lo hr) hK have h2 : grotzschMu (phiK K r) < profileBound P_AVV (phiK K r) := grotzschMu_lt_AVV hphi have hlt := lt_trans h1 h2 unfold profileBound P_AVV at hlt have harg : 4 * ((compMod (phiK K r) + 1) / 2) / phiK K r = 2 * (1 + compMod (phiK K r)) / phiK K r := by ring rw [harg] at hlt have hexp : E < 2 * (1 + compMod (phiK K r)) / phiK K r := by have hpos : 0 < 2 * (1 + compMod (phiK K r)) / phiK K r := div_pos (by linarith [compMod_pos hphi.1 hphi.2]) hphi.1 rw [← Real.exp_log hpos] exact Real.exp_lt_exp.mpr hlt -- From E * φ < 2 (1 + φ'), note φ' = √(1 - φ²), so E/2 * φ - 1 < √(1 - φ²)! -- Even cleaner: let u = (1 + φ') / φ > E / 2 > 1. Then φ = 2 u / (u² + 1)! set u := (1 + compMod (phiK K r)) / phiK K r have hu_gt : E / 2 < u := by have : E < 2 * u := by simpa only [u, mul_div_assoc] using hexp linarith have hu_gt1 : 1 < u := by linarith have hphi_u : phiK K r = 2 * u / (u ^ 2 + 1) := by simp only [u] have hsq : compMod (phiK K r) ^ 2 = 1 - phiK K r ^ 2 := compMod_sq (le_of_lt hphi.1) (le_of_lt hphi.2) have hne1 : phiK K r ≠ 0 := ne_of_gt hphi.1 have hne2 : ((1 + compMod (phiK K r)) / phiK K r) ^ 2 + 1 ≠ 0 := by positivity field_simp nlinarith constructor · rw [hphi_u] have hd1 : 0 < u ^ 2 + 1 := by positivity have hd2 : 0 < E ^ 2 + 4 := by positivity rw [div_lt_div_iff₀ hd1 hd2] -- 2 u (E² + 4) < 4 E (u² + 1) <=> 2 (2 u - E) (E u - 2) > 0! have hid : 4 * E * (u ^ 2 + 1) - 2 * u * (E ^ 2 + 4) = 2 * (2 * u - E) * (E * u - 2) := by ring have hfac1 : 0 < 2 * u - E := by linarith have hfac2 : 0 < E * u - 2 := by nlinarith linarith [mul_pos (mul_pos two_pos hfac1) hfac2] · rw [div_lt_one (by positivity : 0 < E ^ 2 + 4)] have : 0 < (E - 2) ^ 2 := sq_pos_of_ne_zero (by linarith) nlinarith /-! ### Section 7: Agard–Lehto–Virtanen / Beurling–Ahlfors Linear Distortion `λ(K)` -/ /-- The **Agard–Lehto–Virtanen / Beurling–Ahlfors linear distortion function**: `λ(K) = φ_K(1/√2)² / φ_{1/K}(1/√2)²`, equal to the sharp boundary quasisymmetry constant `M(K)` of a `K`-quasiconformal self-map of the upper half-plane. -/ def lambdaK (K : ℝ) : ℝ := phiK K (1 / Real.sqrt 2) ^ 2 / phiK (1 / K) (1 / Real.sqrt 2) ^ 2 lemma inv_sqrt_two_mem_Ioo : (1 / Real.sqrt 2 : ℝ) ∈ Ioo (0 : ℝ) 1 := by refine ⟨by positivity, ?_⟩ rw [div_lt_one (Real.sqrt_pos.mpr (by norm_num))] rw [Real.lt_sqrt (by norm_num)] norm_num lemma lambdaK_eq_inv_sq_sub_one {K : ℝ} (hK : 0 < K) : lambdaK K = 1 / phiK (1 / K) (1 / Real.sqrt 2) ^ 2 - 1 := by unfold lambdaK have hmod := phiK_modularity hK inv_sqrt_two_mem_Ioo rw [compMod_inv_sqrt_two] at hmod have hpos : 0 < phiK (1 / K) (1 / Real.sqrt 2) ^ 2 := sq_pos_of_pos (phiK_mem_Ioo (one_div_pos.mpr hK) inv_sqrt_two_mem_Ioo).1 have hne : phiK (1 / K) (1 / Real.sqrt 2) ^ 2 ≠ 0 := ne_of_gt hpos have hnum : phiK K (1 / Real.sqrt 2) ^ 2 = 1 - phiK (1 / K) (1 / Real.sqrt 2) ^ 2 := by linarith rw [hnum, sub_div, div_self hne] /-- Exact normalization at `K = 1`: `λ(1) = 1`. -/ theorem lambdaK_one : lambdaK 1 = 1 := by unfold lambdaK rw [div_one, phiK_one inv_sqrt_two_mem_Ioo, div_self (ne_of_gt (sq_pos_of_pos inv_sqrt_two_mem_Ioo.1))] /-- Exact closed form at `K = 2`: `λ(2) = 16 + 12 √2`. -/ theorem lambdaK_two : lambdaK 2 = 16 + 12 * Real.sqrt 2 := by rw [lambdaK_eq_inv_sq_sub_one two_pos, phiK_half inv_sqrt_two_mem_Ioo, compMod_inv_sqrt_two] have hs2 : Real.sqrt 2 ^ 2 = 2 := Real.sq_sqrt (by norm_num) have hs2pos : 0 < Real.sqrt 2 := Real.sqrt_pos.mpr (by norm_num) have h1 : (1 - 1 / Real.sqrt 2) / (1 + 1 / Real.sqrt 2) = 3 - 2 * Real.sqrt 2 := by have hne1 : Real.sqrt 2 ≠ 0 := ne_of_gt hs2pos have hne2 : 1 + 1 / Real.sqrt 2 ≠ 0 := by positivity field_simp nlinarith rw [h1] have hne : (3 - 2 * Real.sqrt 2) ^ 2 ≠ 0 := by apply pow_ne_zero 2 intro h have : 9 = 8 := by nlinarith [hs2] norm_num at this have hinv : (3 - 2 * Real.sqrt 2) ^ 2 * (17 + 12 * Real.sqrt 2) = 1 := by nlinarith [hs2] have hdiv : 1 / (3 - 2 * Real.sqrt 2) ^ 2 = 17 + 12 * Real.sqrt 2 := by rw [div_eq_iff hne]; linarith linarith lemma lambdaK_pos {K : ℝ} (hK : 0 < K) : 0 < lambdaK K := by unfold lambdaK exact div_pos (sq_pos_of_pos (phiK_mem_Ioo hK inv_sqrt_two_mem_Ioo).1) (sq_pos_of_pos (phiK_mem_Ioo (one_div_pos.mpr hK) inv_sqrt_two_mem_Ioo).1) /-- Key bridge relating `λ(K)`, `e^{π K} / 16`, and `P*(r_K')` where `r_K = φ_{1/K}(1/√2)`. -/ lemma exp_pi_mul_div_sixteen_eq_Pstar {K : ℝ} (hK : 0 < K) : Real.exp (Real.pi * K) / 16 = Pstar (compMod (phiK (1 / K) (1 / Real.sqrt 2))) ^ 2 / phiK (1 / K) (1 / Real.sqrt 2) ^ 2 := by set rK := phiK (1 / K) (1 / Real.sqrt 2) have hrK := phiK_mem_Ioo (one_div_pos.mpr hK) inv_sqrt_two_mem_Ioo have hmu : grotzschMu rK = Real.pi * K / 2 := by have h := grotzschMu_phiK (one_div_pos.mpr hK) inv_sqrt_two_mem_Ioo rw [grotzschMu_inv_sqrt_two] at h rw [h, one_div, div_inv_eq_mul]; ring have hP := Pstar_eq_exp_sub hrK rw [hmu] at hP have hsq : (4 * Pstar (compMod rK) / rK) ^ 2 = Real.exp (Real.pi * K / 2) ^ 2 := congrArg (fun z => z ^ 2) hP rw [← Real.exp_nat_mul] at hsq have h2 : (2 : ℕ) * (Real.pi * K / 2) = Real.pi * K := by push_cast; ring rw [h2] at hsq have hrKne : rK ≠ 0 := ne_of_gt hrK.1 rw [← hsq] field_simp ring /-- **Asymptotically Exact Second-Order Lower Bound on `λ(K)`** (ALL `K > 0`, purely algebraic from our palindromic Padé `[2/1]` upper invariant `P_21_hi`!): `λ(K) > (1/16) e^{π K} - 1/2 + 5 / (64 (λ(K) + 1))`. -/ theorem lambdaK_gt_sharp_lower {K : ℝ} (hK : 0 < K) : Real.exp (Real.pi * K) / 16 - 1 / 2 + 5 / (64 * (lambdaK K + 1)) < lambdaK K := by set rK := phiK (1 / K) (1 / Real.sqrt 2) have hrK := phiK_mem_Ioo (one_div_pos.mpr hK) inv_sqrt_two_mem_Ioo set x := compMod rK have hx := compMod_mem_Ioo hrK have hx2 : 1 - x ^ 2 = rK ^ 2 := by have := compMod_sq (le_of_lt hrK.1) (le_of_lt hrK.2) linarith have hlam : lambdaK K = 1 / rK ^ 2 - 1 := lambdaK_eq_inv_sq_sub_one hK have hlam1 : lambdaK K + 1 = 1 / rK ^ 2 := by linarith have hE : Real.exp (Real.pi * K) / 16 = Pstar x ^ 2 / rK ^ 2 := exp_pi_mul_div_sixteen_eq_Pstar hK have hP_lt : Pstar x < P_21_hi x := (Pstar_bounds_pade21_22 hx).2 have hP_pos : 0 < Pstar x := Pstar_pos hx have hP2_lt : Pstar x ^ 2 < P_21_hi x ^ 2 := by nlinarith -- Pure positive-coefficient polynomial identity on (0, 1): -- 1 + x² - 2 P_21_hi(x)² - (5/32)(1 - x²)² = (1 - x)³ (20 x³ + 100 x² + 141 x + 59) / (128 (x + 1)²) > 0! have hpoly : 0 < 1 + x ^ 2 - 2 * P_21_hi x ^ 2 - 5 / 32 * (1 - x ^ 2) ^ 2 := by unfold P_21_hi have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hne : x + 1 ≠ 0 := by positivity have hid : 1 + x ^ 2 - 2 * ((7 * x ^ 2 + 18 * x + 7) / (16 * (x + 1))) ^ 2 - 5 / 32 * (1 - x ^ 2) ^ 2 = (1 - x) ^ 3 * (20 * x ^ 3 + 100 * x ^ 2 + 141 * x + 59) / (128 * (x + 1) ^ 2) := by field_simp; ring rw [hid]; positivity have hstar : 5 / 32 * (rK ^ 2) ^ 2 < 1 + x ^ 2 - 2 * Pstar x ^ 2 := by rw [← hx2]; linarith rw [hE, hlam1, hlam] have hr2pos : 0 < rK ^ 2 := sq_pos_of_pos hrK.1 have hrKne : rK ≠ 0 := ne_of_gt hrK.1 have hterm : 5 / (64 * (1 / rK ^ 2)) = 5 * rK ^ 2 / 64 := by field_simp rw [hterm] have hdiff : (1 / rK ^ 2 - 1) - (Pstar x ^ 2 / rK ^ 2 - 1 / 2 + 5 * rK ^ 2 / 64) = (1 + x ^ 2 - 2 * Pstar x ^ 2 - 5 / 32 * (rK ^ 2) ^ 2) / (2 * rK ^ 2) := by have hsub : 1 - rK ^ 2 / 2 = (1 + x ^ 2) / 2 := by linarith [hx2] field_simp nlinarith [hx2] have hpos : 0 < (1 + x ^ 2 - 2 * Pstar x ^ 2 - 5 / 32 * (rK ^ 2) ^ 2) / (2 * rK ^ 2) := div_pos (by linarith) (by positivity) linarith /-- **Asymptotically Exact Second-Order Upper Bound on `λ(K)`** (ALL `K ≥ 1`, purely algebraic from our Padé `[2/2]` lower invariant `P_22_lo`!): `λ(K) < (1/16) e^{π K} - 1/2 + (5/4) e^{-π K}`, where `5/4` is the EXACT sharp asymptotic constant `lim_{K→∞} e^{πK} (λ(K) - (e^{πK}/16 - 1/2)) = 5/4`. -/ theorem lambdaK_lt_sharp_upper {K : ℝ} (hK : 1 ≤ K) : lambdaK K < Real.exp (Real.pi * K) / 16 - 1 / 2 + 5 / 4 * Real.exp (-(Real.pi * K)) := by have hKpos : 0 < K := by linarith set rK := phiK (1 / K) (1 / Real.sqrt 2) have hrK := phiK_mem_Ioo (one_div_pos.mpr hKpos) inv_sqrt_two_mem_Ioo set x := compMod rK have hx := compMod_mem_Ioo hrK have hx2 : 1 - x ^ 2 = rK ^ 2 := by have := compMod_sq (le_of_lt hrK.1) (le_of_lt hrK.2); linarith -- Since K ≥ 1, 1/K ≤ 1 so rK ≤ 1/√2, hence x = rK' ≥ 1/√2 > 1/2! have hrK_le : rK ≤ 1 / Real.sqrt 2 := by rcases eq_or_lt_of_le hK with rfl | hgt · simp only [rK, div_one, phiK_one inv_sqrt_two_mem_Ioo, le_rfl] · have hinv : 1 / K < 1 := (div_lt_one hKpos).mpr hgt have hlt := phiK_strictMono_K (one_div_pos.mpr hKpos) hinv inv_sqrt_two_mem_Ioo rw [phiK_one inv_sqrt_two_mem_Ioo] at hlt exact le_of_lt hlt have hx_ge : 1 / 2 ≤ x := by have hsq : rK ^ 2 ≤ 1 / 2 := by have h1 : (1 / Real.sqrt 2 : ℝ) ^ 2 = 1 / 2 := by rw [div_pow, one_pow, Real.sq_sqrt (by norm_num)] have h2 : rK ^ 2 ≤ (1 / Real.sqrt 2) ^ 2 := sq_le_sq' (by linarith [hrK.1]) hrK_le linarith have hx_sq : 1 / 2 ≤ x ^ 2 := by linarith nlinarith [hx.1] have hP22_lt : P_22_lo x < Pstar x := (Pstar_bounds_pade21_22 hx).1 have hP22_pos : 0 < P_22_lo x := by unfold P_22_lo; have := hx.1; positivity -- Show (1 + x²) / 4 ≤ P_22_lo(x)² using P_22_lo(x) > P_QV(x) = (3x+1)/4 and x ≥ 1/2! have hquad_lo : (1 + x ^ 2) / 4 ≤ P_22_lo x ^ 2 := by have hQV_lt : P_QV x < P_22_lo x := lt_trans (P_QV_lt_P_11_lo hx) (lt_trans (P_11_lo_lt_P_21_lo hx) (P_21_lo_lt_P_22_lo hx)) have hQV_pos : 0 < P_QV x := by unfold P_QV; linarith [hx.1] have hQV_sq : (1 + x ^ 2) / 4 ≤ P_QV x ^ 2 := by unfold P_QV; nlinarith nlinarith -- Since u ↦ u(1 + x² - 2u) is strictly decreasing for u ≥ (1 + x²)/4, -- P*(x)² (1 + x² - 2 P*(x)²) < P_22_lo(x)² (1 + x² - 2 P_22_lo(x)²) have hdec : Pstar x ^ 2 * (1 + x ^ 2 - 2 * Pstar x ^ 2) < P_22_lo x ^ 2 * (1 + x ^ 2 - 2 * P_22_lo x ^ 2) := by have hdiff_u : 0 < Pstar x ^ 2 - P_22_lo x ^ 2 := by nlinarith have hsum_u : 1 + x ^ 2 < 2 * (Pstar x ^ 2 + P_22_lo x ^ 2) := by nlinarith nlinarith -- Positive-coefficient polynomial identity on (0, 1): -- (5/32)(1 - x²)² - P_22_lo(x)² (1 + x² - 2 P_22_lo(x)²) -- = (1 - x)⁴ (1620 x⁸ + ... + 31213) / (128 (3 x² + 94 x + 7)⁴) > 0! have hpoly : P_22_lo x ^ 2 * (1 + x ^ 2 - 2 * P_22_lo x ^ 2) < 5 / 32 * (1 - x ^ 2) ^ 2 := by unfold P_22_lo have hx0 := hx.1; have h1m : 0 < 1 - x := sub_pos.mpr hx.2 have hne : 3 * x ^ 2 + 94 * x + 7 ≠ 0 := by positivity have hid : 5 / 32 * (1 - x ^ 2) ^ 2 - ((199 * x ^ 2 + 210 * x + 7) / (4 * (3 * x ^ 2 + 94 * x + 7))) ^ 2 * (1 + x ^ 2 - 2 * ((199 * x ^ 2 + 210 * x + 7) / (4 * (3 * x ^ 2 + 94 * x + 7))) ^ 2) = (1 - x) ^ 4 * (1620 * x ^ 8 + 209520 * x ^ 7 + 7531848 * x ^ 6 + 44534640 * x ^ 5 + 93031585 * x ^ 4 + 72099020 * x ^ 3 + 17458014 * x ^ 2 + 1323980 * x + 31213) / (128 * (3 * x ^ 2 + 94 * x + 7) ^ 4) := by field_simp; ring have hpos : 0 < (1 - x) ^ 4 * (1620 * x ^ 8 + 209520 * x ^ 7 + 7531848 * x ^ 6 + 44534640 * x ^ 5 + 93031585 * x ^ 4 + 72099020 * x ^ 3 + 17458014 * x ^ 2 + 1323980 * x + 31213) / (128 * (3 * x ^ 2 + 94 * x + 7) ^ 4) := by positivity linarith have hmain : Pstar x ^ 2 * (1 + x ^ 2 - 2 * Pstar x ^ 2) < 5 / 32 * (rK ^ 2) ^ 2 := by rw [← hx2]; exact lt_trans hdec hpoly -- Translate back to λ(K) and E = exp(π K) / 16 (noting (5/4) e^{-π K} = 5 / (64 E)): have hE : Real.exp (Real.pi * K) / 16 = Pstar x ^ 2 / rK ^ 2 := exp_pi_mul_div_sixteen_eq_Pstar hKpos have hlam : lambdaK K = 1 / rK ^ 2 - 1 := lambdaK_eq_inv_sq_sub_one hKpos have hinvE : 5 / 4 * Real.exp (-(Real.pi * K)) = 5 / 64 * (rK ^ 2 / Pstar x ^ 2) := by rw [Real.exp_neg, show Real.exp (Real.pi * K) = 16 * (Pstar x ^ 2 / rK ^ 2) by linarith] have hPne : Pstar x ≠ 0 := ne_of_gt (Pstar_pos hx) have hrKne : rK ≠ 0 := ne_of_gt hrK.1 field_simp ring rw [hlam, hE, hinvE] have hPpos : 0 < Pstar x ^ 2 := sq_pos_of_pos (Pstar_pos hx) have hr2pos : 0 < rK ^ 2 := sq_pos_of_pos hrK.1 have hPne : Pstar x ≠ 0 := ne_of_gt (Pstar_pos hx) have hrKne : rK ≠ 0 := ne_of_gt hrK.1 have hdiff : (Pstar x ^ 2 / rK ^ 2 - 1 / 2 + 5 / 64 * (rK ^ 2 / Pstar x ^ 2)) - (1 / rK ^ 2 - 1) = (5 / 32 * (rK ^ 2) ^ 2 - Pstar x ^ 2 * (1 + x ^ 2 - 2 * Pstar x ^ 2)) / (2 * rK ^ 2 * Pstar x ^ 2) := by field_simp nlinarith [hx2] have hpos : 0 < (5 / 32 * (rK ^ 2) ^ 2 - Pstar x ^ 2 * (1 + x ^ 2 - 2 * Pstar x ^ 2)) / (2 * rK ^ 2 * Pstar x ^ 2) := div_pos (by linarith) (by positivity) linarith /-- **Explicit Uncoupled Asymptotically Exact Two-Sided Sandwich for `λ(K)`** (ALL `K ≥ 1`): `(1/16) e^{π K} - 1/2 + 5 / (4 (e^{π K} + 16)) < λ(K) < (1/16) e^{π K} - 1/2 + (5/4) e^{-π K}`. -/ theorem lambdaK_two_sided_exact {K : ℝ} (hK : 1 ≤ K) : Real.exp (Real.pi * K) / 16 - 1 / 2 + 5 / (4 * (Real.exp (Real.pi * K) + 16)) < lambdaK K ∧ lambdaK K < Real.exp (Real.pi * K) / 16 - 1 / 2 + 5 / 4 * Real.exp (-(Real.pi * K)) := by have hup := lambdaK_lt_sharp_upper hK have hlo := lambdaK_gt_sharp_lower (by linarith : 0 < K) refine ⟨?_, hup⟩ -- For K ≥ 1, (5/4) e^{-π K} < 1/2 (since e^{π K} ≥ e^π > e^3 > 20 > 5/2), -- so λ(K) + 1 < e^{π K}/16 + 1 = (e^{π K} + 16) / 16! have hexp_ge : 3 < Real.exp (Real.pi * K) := by have hpiK : (3 : ℝ) < Real.pi * K := by nlinarith [Real.pi_gt_three] have h1 := Real.add_one_lt_exp (by linarith : Real.pi * K ≠ 0) linarith have hsmall : 5 / 4 * Real.exp (-(Real.pi * K)) < 1 / 2 := by rw [Real.exp_neg, ← div_eq_mul_inv, div_lt_iff₀ (Real.exp_pos _)] linarith have hlam1_lt : lambdaK K + 1 < (Real.exp (Real.pi * K) + 16) / 16 := by linarith have hfrac : 5 / (4 * (Real.exp (Real.pi * K) + 16)) < 5 / (64 * (lambdaK K + 1)) := by have h1 : 0 < 64 * (lambdaK K + 1) := by linarith [lambdaK_pos (by linarith : 0 < K)] have h2 : 64 * (lambdaK K + 1) < 4 * (Real.exp (Real.pi * K) + 16) := by linarith exact div_lt_div_of_pos_left (by norm_num) h1 h2 linarith end QuasiconformalDistortion /-! ### Axiom Audit of Headline Theorems -/ #print axioms QuasiconformalDistortion.agm_mul_ellipI #print axioms QuasiconformalDistortion.ellipI_symmetry_pinch #print axioms QuasiconformalDistortion.grotzschMu_mul_comp #print axioms QuasiconformalDistortion.grotzschMu_landenL #print axioms QuasiconformalDistortion.grotzschMu_landenA #print axioms QuasiconformalDistortion.grotzschMu_landenL_iter #print axioms QuasiconformalDistortion.exists_unique_grotzschMu_eq #print axioms QuasiconformalDistortion.grotzschMu_le_landen_iter_of_super #print axioms QuasiconformalDistortion.landen_iter_le_grotzschMu_of_sub #print axioms QuasiconformalDistortion.grotzschMu_pade_ladder #print axioms QuasiconformalDistortion.grotzschMu_selfDual_pade32_22 #print axioms QuasiconformalDistortion.grotzschMu_landen1_selfDual_pade32_22 #print axioms QuasiconformalDistortion.phiK_comp #print axioms QuasiconformalDistortion.phiK_modularity #print axioms QuasiconformalDistortion.phiK_two #print axioms QuasiconformalDistortion.phiK_half #print axioms QuasiconformalDistortion.Pstar_mono #print axioms QuasiconformalDistortion.phiK_le_Pstar_factor #print axioms QuasiconformalDistortion.phiK_lt_pade22_factor #print axioms QuasiconformalDistortion.phiK_lt_subunity_rational #print axioms QuasiconformalDistortion.lambdaK_one #print axioms QuasiconformalDistortion.lambdaK_two #print axioms QuasiconformalDistortion.lambdaK_gt_sharp_lower #print axioms QuasiconformalDistortion.lambdaK_lt_sharp_upper #print axioms QuasiconformalDistortion.lambdaK_two_sided_exact