From 6fef1ce2cb32a7d20118eaec059bb0fdae6b1a2d Mon Sep 17 00:00:00 2001 From: Vilin97 automation Date: Fri, 18 Sep 2026 10:29:08 -0700 Subject: [PATCH] perf: speed up Burkholder majorant proofs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimize the two 10k-line majorant files of the Burkholder project (`MajorantPG2`, `MajorantPL2`) without changing any declaration. - Replace 42 `continuity` calls (aesop, 1.5-3.5 s each inside these crowded contexts) by explicit continuity terms. - Factor 38 private helper lemmas for facts that were re-proved inline dozens of times (`0 < a p`, `y < y / a p`, `a p * y < y`, sector membership of boundary points, denominator clearing, consequences of `2 ≤ p` / `1 < p < 2`, interior of `Icc`, quarter-plane exclusions, sector derivatives) and use them at ~600 sites. - Rewrite the `HasDerivAt` bookkeeping in the derivative lemmas with `hasDerivAt_id'`/`div_const`/`rpow_const` plus `congr_deriv (by ring)` instead of AC-normalising `simpa` calls. - Downgrade 84 `nlinarith` calls to `linarith` where that suffices, and drop `simpa` in favour of direct lemmas (`mul_lt_of_lt_one_left`, ...). Clean `lake build LeanPool.Burkholder`: 243 -> 188 user CPU seconds (-23%), 23.8 s -> 19.4 s wall. Declaration manifest (types, universes, safety, names of all 997 pre-existing declarations) unchanged. Co-Authored-By: Claude Fable 5.1 --- .../Burkholder/Majorants/MajorantPG2.lean | 1537 ++++++---------- .../Burkholder/Majorants/MajorantPL2.lean | 1632 ++++++----------- 2 files changed, 1050 insertions(+), 2119 deletions(-) diff --git a/LeanPool/Burkholder/Majorants/MajorantPG2.lean b/LeanPool/Burkholder/Majorants/MajorantPG2.lean index 0df11e53b2..9bd28cf45c 100644 --- a/LeanPool/Burkholder/Majorants/MajorantPG2.lean +++ b/LeanPool/Burkholder/Majorants/MajorantPG2.lean @@ -79,6 +79,53 @@ private lemma pStar_eq_self_of_two_le (p : ℝ) (hp : 2 ≤ p) : pStar p = p := mul_le_mul_of_nonneg_right hp_le h_inv_nonneg simpa [div_eq_mul_inv, hden_ne, mul_assoc, mul_comm, mul_left_comm] using hmul' +/-- Points of the interior of a closed interval lie in the open interval. -/ +private lemma mem_Ioo_of_mem_interior_Icc {a b t : ℝ} (ht : t ∈ interior (Set.Icc a b)) : + t ∈ Set.Ioo a b := by + rwa [interior_Icc] at ht + +/-! Elementary consequences of `2 ≤ p`, stated once so that the many proofs below can use +them as terms instead of re-running `linarith`. -/ + +private lemma p_pos_of_two_le (p : ℝ) (hp : 2 ≤ p) : 0 < p := by linarith +private lemma p_nonneg_of_two_le (p : ℝ) (hp : 2 ≤ p) : 0 ≤ p := by linarith +private lemma one_lt_of_two_le (p : ℝ) (hp : 2 ≤ p) : 1 < p := by linarith +private lemma one_le_of_two_le (p : ℝ) (hp : 2 ≤ p) : 1 ≤ p := by linarith +private lemma sub_one_pos_of_two_le (p : ℝ) (hp : 2 ≤ p) : 0 < p - 1 := by linarith +private lemma sub_one_nonneg_of_two_le (p : ℝ) (hp : 2 ≤ p) : 0 ≤ p - 1 := by linarith +private lemma one_le_sub_one_of_two_le (p : ℝ) (hp : 2 ≤ p) : 1 ≤ p - 1 := by linarith +private lemma sub_one_ne_zero_of_two_le (p : ℝ) (hp : 2 ≤ p) : p - 1 ≠ 0 := by linarith +private lemma p_ne_zero_of_two_le (p : ℝ) (hp : 2 ≤ p) : p ≠ 0 := by linarith +private lemma half_p_nonneg_of_two_le (p : ℝ) (hp : 2 ≤ p) : 0 ≤ p / 2 := by linarith + +private lemma a_nonneg_of_two_le (p : ℝ) (hp : 2 ≤ p) : 0 ≤ a p := by + have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp + have hp_pos : 0 < p := by linarith + rw [a, hpStar] + field_simp [hp_pos.ne] + linarith + +private lemma a_pos_of_two_lt (p : ℝ) (hp : 2 < p) : 0 < a p := by + have hp' : 2 ≤ p := by linarith + have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp' + have hp_pos : 0 < p := by linarith + rw [a, hpStar] + field_simp [hp_pos.ne'] + linarith + +private lemma a_lt_one_of_two_le (p : ℝ) (hp : 2 ≤ p) : a p < 1 := by + have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp + have hp_pos : 0 < p := by linarith + rw [a, hpStar] + have hdiv : 0 < 2 / p := by positivity + linarith + + +/-- Below the ray `y = a p * x` in the right half-plane, `y` is below `x`. -/ +private lemma lt_of_lt_mul_a (p : ℝ) (hp : 2 ≤ p) {x y : ℝ} (hx : 0 < x) (hay : y < a p * x) : + y < x := + lt_trans hay (mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp)) + @@ -469,7 +516,7 @@ private lemma DxvGeTwo_eq_formula_on_closureA2 · simp [DxvGeTwoFun, DxvGeTwoFormula, DxvGeTwo, hx0] · have h00 := closureA2_x0_y0 p x y ⟨hx, hlow, hup⟩ hx0 rcases h00 with ⟨rfl, rfl⟩ - have hp1 : p - 1 ≠ 0 := by linarith + have hp1 : p - 1 ≠ 0 := sub_one_ne_zero_of_two_le p hp have hzero : Real.rpow (0 : ℝ) (p - 1) = 0 := Real.zero_rpow hp1 simp only [DxvGeTwoFun, DxvGeTwo, gt_iff_lt, lt_self_iff_false, ↓reduceIte, DxvGeTwoFormula, add_zero, zero_div, abs_zero, Real.rpow_eq_pow, sub_self] @@ -485,7 +532,7 @@ private lemma DyvGeTwo_eq_formula_on_closureA2 · simp [DyvGeTwoFun, DyvGeTwoFormula, DyvGeTwo, hx0] · have h00 := closureA2_x0_y0 p x y ⟨hx, hlow, hup⟩ hx0 rcases h00 with ⟨rfl, rfl⟩ - have hp1 : p - 1 ≠ 0 := by linarith + have hp1 : p - 1 ≠ 0 := sub_one_ne_zero_of_two_le p hp have hzero : Real.rpow (0 : ℝ) (p - 1) = 0 := Real.zero_rpow hp1 simp only [DyvGeTwoFun, DyvGeTwo, gt_iff_lt, lt_self_iff_false, ↓reduceIte, DyvGeTwoFormula, add_zero, zero_div, abs_zero, Real.rpow_eq_pow, sub_self] @@ -495,7 +542,7 @@ private lemma DyvGeTwo_eq_formula_on_closureA2 private lemma continuousOn_DxvGeTwo_closureA2 (p : ℝ) (hp : 2 ≤ p) : ContinuousOn (DxvGeTwoFun p) (closureA2Set p) := by - have hp1 : 0 ≤ p - 1 := by linarith + have hp1 : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hcont : Continuous (DxvGeTwoFormula p) := by have hsum : Continuous (fun z : ℝ × ℝ => Real.rpow (|((z.1 + z.2) / 2)|) (p - 1)) := by @@ -515,7 +562,7 @@ private lemma continuousOn_DxvGeTwo_closureA2 private lemma continuousOn_DyvGeTwo_closureA2 (p : ℝ) (hp : 2 ≤ p) : ContinuousOn (DyvGeTwoFun p) (closureA2Set p) := by - have hp1 : 0 ≤ p - 1 := by linarith + have hp1 : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hcont : Continuous (DyvGeTwoFormula p) := by have hsum : Continuous (fun z : ℝ × ℝ => Real.rpow (|((z.1 + z.2) / 2)|) (p - 1)) := by @@ -590,6 +637,18 @@ private def QuarterPlane4 (x y : ℝ) : Prop := y ≤ 0 ∧ y ≤ x ∧ x ≤ -y private def QuarterPlane4Open (x y : ℝ) : Prop := y < 0 ∧ y < x ∧ x < -y +private lemma not_quarterPlane_of_neg {x y : ℝ} (hx : x < 0) : ¬ QuarterPlane x y := + fun hq => not_le_of_gt hx hq.1 + +private lemma not_quarterPlane_of_lt {x y : ℝ} (hxy : x < y) : ¬ QuarterPlane x y := + fun hq => not_le_of_gt hxy hq.2.1 + +private lemma not_quarterPlane2_of_lt {x y : ℝ} (h : -x < y) : ¬ QuarterPlane2 x y := + fun hq => not_le_of_gt h hq.2.1 + +private lemma not_quarterPlane2_of_gt {x y : ℝ} (hyx : y < x) : ¬ QuarterPlane2 x y := + fun hq => not_le_of_gt hyx hq.2.2 + private def uCandidate (p x y : ℝ) : ℝ := @@ -647,7 +706,7 @@ candidate, and later for differentiability/tangent estimates at break points. /-- For x ≥ 0, uA1 equals the smooth expression (using 0^(p-1)=0 when x=0). -/ private lemma uA1_eq_smooth_of_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hx : 0 ≤ x) : uA1 p x y = alpha p * x ^ (p - 1) * (x - pStar p * (x - y) / 2) := by - have hexp_ne : p - 1 ≠ 0 := by linarith + have hexp_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_two_le p hp unfold uA1 rcases hx.lt_or_eq with hxpos | hxeq · exact ite_eq_left hxpos @@ -658,7 +717,7 @@ private lemma uA1_eq_smooth_of_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hx : /-- uA1 is continuous on {(x, y) | 0 ≤ x} when p ≥ 2. -/ private lemma continuousOn_uA1 (p : ℝ) (hp : 2 ≤ p) : ContinuousOn (fun z : ℝ × ℝ => uA1 p z.1 z.2) {z | 0 ≤ z.1} := by - have hexp_pos : 0 < p - 1 := by linarith + have hexp_pos : 0 < p - 1 := sub_one_pos_of_two_le p hp have heq : ∀ z : ℝ × ℝ, z ∈ {z : ℝ × ℝ | 0 ≤ z.1} → uA1 p z.1 z.2 = alpha p * z.1 ^ (p - 1) * (z.1 - pStar p * (z.1 - z.2) / 2) := fun ⟨x, y⟩ hx => uA1_eq_smooth_of_nonneg p hp x y hx @@ -676,7 +735,7 @@ private lemma continuousOn_uA1 (p : ℝ) (hp : 2 ≤ p) : private lemma uA1_eq_zero_on_boundary (p x : ℝ) (hp : 2 ≤ p) (hx : 0 < x) : uA1 p x ((a p) * x) = 0 := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p hp unfold uA1 rw [ite_eq_left hx] have hfactor : x - pStar p * (x - a p * x) / 2 = 0 := by @@ -689,7 +748,7 @@ private lemma uA1_eq_zero_on_boundary (p x : ℝ) (hp : 2 ≤ p) (hx : 0 < x) : private lemma vGeTwo_eq_zero_on_boundary (p x : ℝ) (hp : 2 ≤ p) (hx : 0 < x) : vGeTwo p x ((a p) * x) = 0 := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p hp simp only [vGeTwo, a, hpStar] have h_sum : (x + (1 - 2 / p) * x) / 2 = (p - 1) / p * x := by field_simp [hp_pos.ne']; ring @@ -798,8 +857,8 @@ private lemma auxFunction1_eq_vGeTwo (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (h2 : private lemma alpha_eq_boundary_coeff (p : ℝ) (hp : 2 ≤ p) : alpha p = p * Real.rpow ((p - 1) / p) (p - 1) := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p hp + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp rw [alpha, hpStar] simp_rw [Real.rpow_eq_pow] calc @@ -829,13 +888,13 @@ private lemma one_le_alpha (p : ℝ) (hp : 2 ≤ p) : change 1 ≤ p * ((p - 1) / p) ^ (p - 1) let G : ℝ → ℝ := fun t => Real.log t - (t - 1) * Real.log (t / (t - 1)) - have hp_pos : 0 < p := by linarith - have hp1_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p hp + have hp1_pos : 0 < p - 1 := sub_one_pos_of_two_le p hp have hG_nonneg : 0 ≤ G p := by have hderiv_formula : ∀ x, 2 < x → HasDerivAt G (2 / x - Real.log (x / (x - 1))) x := by intro x hx2 - have hx_pos : 0 < x := by linarith + have hx_pos : 0 < x := by positivity have hx1_pos : 0 < x - 1 := by linarith have hdiv_ne : x - 1 ≠ 0 := by linarith have hquot_pos : 0 < x / (x - 1) := div_pos hx_pos hx1_pos @@ -886,7 +945,7 @@ private lemma one_le_alpha (p : ℝ) (hp : 2 ≤ p) : · intro x hx have hx2 : 2 < x := by simpa [interior_Ici] using hx rw [(hderiv_formula x hx2).deriv] - have hx_pos : 0 < x := by linarith + have hx_pos : 0 < x := by positivity have hx1_pos : 0 < x - 1 := by linarith have hlog : Real.log (x / (x - 1)) ≤ 1 / (x - 1) := by have hpos : 0 < x / (x - 1) := div_pos hx_pos hx1_pos @@ -897,7 +956,7 @@ private lemma one_le_alpha (p : ℝ) (hp : 2 ≤ p) : simpa [hs] using h have hfrac : 1 / (x - 1) ≤ 2 / x := by field_simp [hx_pos.ne', hx1_pos.ne'] - nlinarith + linarith linarith have h2mem : (2 : ℝ) ∈ Set.Ici 2 := by simp have hpmem : p ∈ Set.Ici 2 := hp @@ -964,8 +1023,8 @@ private lemma vGeTwo_le_uA1_on_diag private lemma DxuA1_eq_DxvGeTwo_on_A1A2_boundary (p x : ℝ) (hp : 2 ≤ p) (hx : 0 < x) : DxuA1 p x ((a p) * x) = DxvGeTwo p x ((a p) * x) := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith - have hp1_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p hp + have hp1_pos : 0 < p - 1 := sub_one_pos_of_two_le p hp simp only [DxuA1, gt_iff_lt, hx, ↓reduceIte, Real.rpow_eq_pow, a, hpStar, DxvGeTwo] have h_sum : (x + (1 - 2 / p) * x) / 2 = ((p - 1) / p) * x := by field_simp [hp_pos.ne] @@ -1024,8 +1083,8 @@ private lemma DxuA1_eq_DxvGeTwo_on_A1A2_boundary (p x : ℝ) (hp : 2 ≤ p) (hx private lemma DyuA1_eq_DyvGeTwo_on_A1A2_boundary (p x : ℝ) (hp : 2 ≤ p) (hx : 0 < x) : DyuA1 p x ((a p) * x) = DyvGeTwo p x ((a p) * x) := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith - have hp1_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p hp + have hp1_pos : 0 < p - 1 := sub_one_pos_of_two_le p hp simp only [DyuA1, gt_iff_lt, hx, ↓reduceIte, Real.rpow_eq_pow, hpStar, DyvGeTwo, a] have h_sum : (x + (1 - 2 / p) * x) / 2 = ((p - 1) / p) * x := by field_simp [hp_pos.ne] @@ -1110,11 +1169,11 @@ private lemma auxFunction1_Dy_eq_DyvGeTwo (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) ( private lemma DxauxFunction1_eq_DyauxFunction1_on_diag (p : ℝ) (hp : 2 < p) (x : ℝ) (hx : 0 ≤ x) : DxauxFunction1 p x x = DyauxFunction1 p x x := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp rcases hx.lt_or_eq with hxpos | hxeq · have hlt : a p < 1 := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp' - have hp_pos : 0 < p := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p (le_of_lt hp) rw [a, hpStar] have hdiv : 0 < 2 / p := by positivity linarith @@ -1139,14 +1198,14 @@ private lemma DxauxFunction1_eq_DyauxFunction1_on_diag (p : ℝ) (hp : 2 < p) (x private lemma DxauxFunction1_eq_neg_DyauxFunction1_on_antidiag (p : ℝ) (hp : 2 < p) (x : ℝ) (hx : 0 ≤ x) : DxauxFunction1 p x (-x) = -DyauxFunction1 p x (-x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp rcases hx.lt_or_eq with hxpos | hxeq · have ha_nonneg : 0 ≤ a p := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp' - have hp_pos : 0 < p := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p (le_of_lt hp) rw [a, hpStar] field_simp [hp_pos.ne] - nlinarith + linarith have hcl : closureA2 p x (-x) := by refine ⟨hx, le_rfl, ?_⟩ exact le_trans (neg_nonpos.mpr hx) (mul_nonneg ha_nonneg hx) @@ -1154,7 +1213,7 @@ private lemma DxauxFunction1_eq_neg_DyauxFunction1_on_antidiag (p : ℝ) (hp : 2 DxauxFunction1 p x (-x) = DxvGeTwo p x (-x) := auxFunction1_Dx_eq_DxvGeTwo p hp' x (-x) hcl _ = -DyvGeTwo p x (-x) := by - have hp1_ne : p - 1 ≠ 0 := by linarith + have hp1_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_two_le p (le_of_lt hp) have hdiff : (x - -x) / 2 = x := by ring simp [DxvGeTwo, DyvGeTwo, hxpos, hp1_ne, abs_of_pos hxpos] _ = -DyauxFunction1 p x (-x) := by @@ -1165,7 +1224,7 @@ private lemma DxauxFunction1_eq_neg_DyauxFunction1_on_antidiag (p : ℝ) (hp : 2 private lemma continuousOn_DxauxFunction1 (p : ℝ) (hp : 2 ≤ p) : ContinuousOn (fun z : ℝ × ℝ => DxauxFunction1 p z.1 z.2) {z | QuarterPlane z.1 z.2} := by - have hp1 : 1 < p := by linarith + have hp1 : 1 < p := one_lt_of_two_le p hp let S := {z : ℝ × ℝ | QuarterPlane z.1 z.2} let S1 := {z : ℝ × ℝ | closureA1 p z.1 z.2} let S2 := {z : ℝ × ℝ | closureA2 p z.1 z.2} @@ -1210,7 +1269,7 @@ private lemma continuousOn_DyauxFunction1 (p : ℝ) (hp : 2 < p) : let S := {z : ℝ × ℝ | QuarterPlane z.1 z.2} let S1 := {z : ℝ × ℝ | closureA1 p z.1 z.2} let S2 := {z : ℝ × ℝ | closureA2 p z.1 z.2} - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have hcover : S ⊆ S1 ∪ S2 := by intro ⟨x, y⟩ hz simp only [QuarterPlane, closureA1, closureA2, S, S1, S2, @@ -1250,7 +1309,7 @@ private lemma continuousOn_DyauxFunction1 (p : ℝ) (hp : 2 < p) : private lemma continuousOn_auxFunction1 (p : ℝ) (hp : 2 ≤ p) : ContinuousOn (fun z : ℝ × ℝ => auxFunction1 p z.1 z.2) {z | QuarterPlane z.1 z.2} := by - have hp1 : 1 < p := by linarith + have hp1 : 1 < p := one_lt_of_two_le p hp let S := {z : ℝ × ℝ | QuarterPlane z.1 z.2} let S1 := {z : ℝ × ℝ | closureA1 p z.1 z.2} let S2 := {z : ℝ × ℝ | closureA2 p z.1 z.2} @@ -1344,8 +1403,8 @@ private lemma continuousuCandidate (p : ℝ) (hp : 2 ≤ p) : intro z hz rcases hz with ⟨hx, hy, hxy⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := by - continuity + have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := + continuous_fst.neg.prodMk continuous_snd.neg simpa [Q1, Q2, f2, Function.comp_def] using (continuousOn_auxFunction1 p hp).comp hneg.continuousOn hmap have hcont3 : ContinuousOn f3 Q3 := by @@ -1353,8 +1412,7 @@ private lemma continuousuCandidate (p : ℝ) (hp : 2 ≤ p) : intro z hz rcases hz with ⟨hy, hnyx, hxy⟩ exact ⟨hy, hxy, hnyx⟩ - have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := by - continuity + have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := continuous_snd.prodMk continuous_fst simpa [Q1, Q3, f3, Function.comp_def] using (continuousOn_auxFunction1 p hp).comp hswap.continuousOn hmap have hcont4 : ContinuousOn f4 Q4 := by @@ -1362,8 +1420,8 @@ private lemma continuousuCandidate (p : ℝ) (hp : 2 ≤ p) : intro z hz rcases hz with ⟨hy, hyx, hxn⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := by - continuity + have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := + continuous_snd.neg.prodMk continuous_fst.neg simpa [Q1, Q4, f4, Function.comp_def] using (continuousOn_auxFunction1 p hp).comp hns.continuousOn hmap have hcl1 : IsClosed Q1 := isClosed_setOf_QuarterPlane @@ -1526,7 +1584,7 @@ private lemma continuousuCandidate (p : ℝ) (hp : 2 ≤ p) : private lemma continuousDxuCandidate (p : ℝ) (hp : 2 < p) : ContinuousOn (fun z : ℝ × ℝ => DxuCandidate p z.1 z.2) Set.univ := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let Q1 : Set (ℝ × ℝ) := {z | QuarterPlane z.1 z.2} let Q2 : Set (ℝ × ℝ) := {z | QuarterPlane2 z.1 z.2} let Q3 : Set (ℝ × ℝ) := {z | QuarterPlane3 z.1 z.2} @@ -1542,7 +1600,8 @@ private lemma continuousDxuCandidate (p : ℝ) (hp : 2 < p) : intro z hz rcases hz with ⟨hx, hy, hxy⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := by continuity + have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := + continuous_fst.neg.prodMk continuous_snd.neg have hbase : ContinuousOn (fun z : ℝ × ℝ => DxauxFunction1 p (-z.1) (-z.2)) Q2 := by simpa [Q1, Q2, Function.comp_def] using (continuousOn_DxauxFunction1 p hp').comp hneg.continuousOn hmap @@ -1552,7 +1611,7 @@ private lemma continuousDxuCandidate (p : ℝ) (hp : 2 < p) : intro z hz rcases hz with ⟨hy, hnyx, hxy⟩ exact ⟨hy, hxy, hnyx⟩ - have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := by continuity + have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := continuous_snd.prodMk continuous_fst simpa [Q1, Q3, f3, Function.comp_def] using (continuousOn_DyauxFunction1 p hp).comp hswap.continuousOn hmap have hcont4 : ContinuousOn f4 Q4 := by @@ -1560,7 +1619,8 @@ private lemma continuousDxuCandidate (p : ℝ) (hp : 2 < p) : intro z hz rcases hz with ⟨hy, hyx, hxn⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := by continuity + have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := + continuous_snd.neg.prodMk continuous_fst.neg have hbase : ContinuousOn (fun z : ℝ × ℝ => DyauxFunction1 p (-z.2) (-z.1)) Q4 := by simpa [Q1, Q4, Function.comp_def] using (continuousOn_DyauxFunction1 p hp).comp hns.continuousOn hmap @@ -1710,7 +1770,7 @@ private lemma continuousDxuCandidate (p : ℝ) (hp : 2 < p) : private lemma continuousDyuCandidate (p : ℝ) (hp : 2 < p) : ContinuousOn (fun z : ℝ × ℝ => DyuCandidate p z.1 z.2) Set.univ := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let Q1 : Set (ℝ × ℝ) := {z | QuarterPlane z.1 z.2} let Q2 : Set (ℝ × ℝ) := {z | QuarterPlane2 z.1 z.2} let Q3 : Set (ℝ × ℝ) := {z | QuarterPlane3 z.1 z.2} @@ -1726,7 +1786,8 @@ private lemma continuousDyuCandidate (p : ℝ) (hp : 2 < p) : intro z hz rcases hz with ⟨hx, hy, hxy⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := by continuity + have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := + continuous_fst.neg.prodMk continuous_snd.neg have hbase : ContinuousOn (fun z : ℝ × ℝ => DyauxFunction1 p (-z.1) (-z.2)) Q2 := by simpa [Q1, Q2, Function.comp_def] using (continuousOn_DyauxFunction1 p hp).comp hneg.continuousOn hmap @@ -1736,7 +1797,7 @@ private lemma continuousDyuCandidate (p : ℝ) (hp : 2 < p) : intro z hz rcases hz with ⟨hy, hnyx, hxy⟩ exact ⟨hy, hxy, hnyx⟩ - have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := by continuity + have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := continuous_snd.prodMk continuous_fst simpa [Q1, Q3, f3, Function.comp_def] using (continuousOn_DxauxFunction1 p hp').comp hswap.continuousOn hmap have hcont4 : ContinuousOn f4 Q4 := by @@ -1744,7 +1805,8 @@ private lemma continuousDyuCandidate (p : ℝ) (hp : 2 < p) : intro z hz rcases hz with ⟨hy, hyx, hxn⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := by continuity + have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := + continuous_snd.neg.prodMk continuous_fst.neg have hbase : ContinuousOn (fun z : ℝ × ℝ => DxauxFunction1 p (-z.2) (-z.1)) Q4 := by simpa [Q1, Q4, Function.comp_def] using (continuousOn_DxauxFunction1 p hp').comp hns.continuousOn hmap @@ -2296,26 +2358,19 @@ private lemma deriv_uA1_eq_DxuA1Fun_on_A1 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) ( have hxne1 : x ≠ 0 ∨ 1 ≤ p := Or.inl hxne have hxne2 : x ≠ 0 ∨ 1 ≤ p - 1 := Or.inl hxne have hd1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := by - simpa using - (Real.hasDerivAt_rpow_const hxne1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x) + HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := Real.hasDerivAt_rpow_const hxne1 have hd2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := by - have h := (Real.hasDerivAt_rpow_const hxne2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) - ((p - 1) * x ^ ((p - 1) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := + (Real.hasDerivAt_rpow_const hxne2).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hd : HasDerivAt g (alpha p * ((1 - p / 2) * (p * x ^ (p - 1)) + (p * y / 2) * ((p - 1) * x ^ (p - 2)))) x := by - dsimp [g] - have hsum := - ((hd1.const_mul (1 - p / 2)).add (hd2.const_mul (p * y / 2))).const_mul (alpha p) - simpa [mul_add, mul_assoc, mul_left_comm, mul_comm] using hsum + dsimp only [g] + refine (((hd1.const_mul (1 - p / 2)).add (hd2.const_mul (p * y / 2))).const_mul + (alpha p)).congr_deriv ?_ + ring have hpow : x ^ (p - 1) = x ^ (p - 2) * x := by calc x ^ (p - 1) = x ^ ((p - 2) + (1 : ℝ)) := by ring_nf @@ -2356,26 +2411,19 @@ private lemma hasDerivAt_uA1_x_of_pos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hx : have hxne1 : x ≠ 0 ∨ 1 ≤ p := Or.inl hxne have hxne2 : x ≠ 0 ∨ 1 ≤ p - 1 := Or.inl hxne have hd1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := by - simpa using - (Real.hasDerivAt_rpow_const hxne1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x) + HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := Real.hasDerivAt_rpow_const hxne1 have hd2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := by - have h := (Real.hasDerivAt_rpow_const hxne2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) - ((p - 1) * x ^ ((p - 1) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := + (Real.hasDerivAt_rpow_const hxne2).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hd : HasDerivAt g (alpha p * ((1 - p / 2) * (p * x ^ (p - 1)) + (p * y / 2) * ((p - 1) * x ^ (p - 2)))) x := by - dsimp [g] - have hsum := - ((hd1.const_mul (1 - p / 2)).add (hd2.const_mul (p * y / 2))).const_mul (alpha p) - simpa [mul_add, mul_assoc, mul_left_comm, mul_comm] using hsum + dsimp only [g] + refine (((hd1.const_mul (1 - p / 2)).add (hd2.const_mul (p * y / 2))).const_mul + (alpha p)).congr_deriv ?_ + ring have hpow : x ^ (p - 1) = x ^ (p - 2) * x := by calc x ^ (p - 1) = x ^ ((p - 2) + (1 : ℝ)) := by ring_nf @@ -2440,8 +2488,8 @@ private lemma Dxx_uA1_nonpos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x deriv (deriv (fun t => uA1 p t y)) x = deriv (deriv g) x := by exact hEq.deriv.deriv_eq have hxne : x ≠ 0 := by linarith - have hp_ge1 : 1 ≤ p := by linarith - have hp1_ge1 : 1 ≤ p - 1 := by linarith + have hp_ge1 : 1 ≤ p := one_le_of_two_le p hp + have hp1_ge1 : 1 ≤ p - 1 := one_le_sub_one_of_two_le p hp have hg1_formula : deriv g x = alpha p * @@ -2450,26 +2498,19 @@ private lemma Dxx_uA1_nonpos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x have hxne1 : x ≠ 0 ∨ 1 ≤ p := Or.inl hxne have hxne2 : x ≠ 0 ∨ 1 ≤ p - 1 := Or.inl hxne have hd1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := by - simpa using - (Real.hasDerivAt_rpow_const hxne1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x) + HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := Real.hasDerivAt_rpow_const hxne1 have hd2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := by - have h := (Real.hasDerivAt_rpow_const hxne2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) - ((p - 1) * x ^ ((p - 1) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := + (Real.hasDerivAt_rpow_const hxne2).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hd : HasDerivAt g (alpha p * ((1 - p / 2) * (p * x ^ (p - 1)) + (p * y / 2) * ((p - 1) * x ^ (p - 2)))) x := by - dsimp [g] - have h := - ((hd1.const_mul (1 - p / 2)).add (hd2.const_mul (p * y / 2))).const_mul (alpha p) - simpa [mul_assoc, mul_left_comm, mul_comm] using h + dsimp only [g] + refine (((hd1.const_mul (1 - p / 2)).add (hd2.const_mul (p * y / 2))).const_mul + (alpha p)).congr_deriv ?_ + ring exact hd.deriv have hg2 : deriv (deriv g) x = @@ -2477,19 +2518,11 @@ private lemma Dxx_uA1_nonpos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x have hxne2 : x ≠ 0 ∨ 1 ≤ p - 1 := Or.inl hxne have hxne3 : x ≠ 0 ∨ 1 ≤ p - 2 := Or.inl hxne have hd1 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := by - have h := (Real.hasDerivAt_rpow_const hxne2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) - ((p - 1) * x ^ ((p - 1) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := + (Real.hasDerivAt_rpow_const hxne2).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hd2 : - HasDerivAt (fun t : ℝ => t ^ (p - 2)) ((p - 2) * x ^ (p - 3)) x := by - have h := (Real.hasDerivAt_rpow_const hxne3 : - HasDerivAt (fun t : ℝ => t ^ (p - 2)) - ((p - 2) * x ^ ((p - 2) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -2) = p + -3 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 2)) ((p - 2) * x ^ (p - 3)) x := + (Real.hasDerivAt_rpow_const hxne3).congr_deriv (by rw [show p - 2 - 1 = p - 3 by ring]) have hd : HasDerivAt (fun t => @@ -2523,17 +2556,10 @@ private lemma Dxx_uA1_nonpos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x have hp_t : t ≠ 0 ∨ 1 ≤ p := Or.inr hp_ge1 have hp1_t : t ≠ 0 ∨ 1 ≤ p - 1 := Or.inr hp1_ge1 have hd1t : - HasDerivAt (fun s : ℝ => s ^ p) (p * t ^ (p - 1)) t := by - simpa using - (Real.hasDerivAt_rpow_const hp_t : - HasDerivAt (fun s : ℝ => s ^ p) (p * t ^ (p - 1)) t) + HasDerivAt (fun s : ℝ => s ^ p) (p * t ^ (p - 1)) t := Real.hasDerivAt_rpow_const hp_t have hd2t : - HasDerivAt (fun s : ℝ => s ^ (p - 1)) ((p - 1) * t ^ (p - 2)) t := by - have h := (Real.hasDerivAt_rpow_const hp1_t : - HasDerivAt (fun s : ℝ => s ^ (p - 1)) - ((p - 1) * t ^ ((p - 1) - 1)) t) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun s : ℝ => s ^ (p - 1)) ((p - 1) * t ^ (p - 2)) t := + (Real.hasDerivAt_rpow_const hp1_t).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hdt : HasDerivAt g (alpha p * @@ -2564,8 +2590,8 @@ private lemma Dxx_uA1_nonpos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x · linarith · apply Real.rpow_nonneg apply div_nonneg <;> linarith - have hp0 : 0 ≤ p := by linarith - have hp1 : 0 ≤ p - 1 := by linarith + have hp0 : 0 ≤ p := p_nonneg_of_two_le p hp + have hp1 : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hp2 : 0 ≤ p - 2 := by linarith have hpow : 0 ≤ x ^ (p - 3) := by exact Real.rpow_nonneg hx.le _ @@ -2618,7 +2644,7 @@ private lemma uA1_tangent_x_on_Icc_of_A1 (f₁ := fun t => DxuA1Fun p (t, y)) (f₂ := fun t => deriv (fun s => DxuA1Fun p (s, y)) t) · have hpair : ContinuousOn (fun t : ℝ => (t, y)) (Set.Icc a b) := - (by continuity : Continuous (fun t : ℝ => (t, y))).continuousOn + (continuous_id.prodMk continuous_const : Continuous (fun t : ℝ => (t, y))).continuousOn exact (continuousOn_uA1 p hp).comp hpair (by intro t ht exact hIcc_nonneg t ht) @@ -2644,8 +2670,8 @@ private lemma Dyy_uA1_nonpos (p : ℝ) (_hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x rw [hrepr] have hderiv_lin : deriv (fun t => c + m * t) = fun _ => m := by funext t - have hlin : HasDerivAt (fun s : ℝ => c + m * s) m t := by - simpa [one_mul] using (((hasDerivAt_id t).const_mul m).const_add c) + have hlin : HasDerivAt (fun s : ℝ => c + m * s) m t := + ((((hasDerivAt_id t).const_mul m).const_add c)).congr_deriv (by ring) exact hlin.deriv rw [hderiv_lin] simp @@ -2653,7 +2679,7 @@ private lemma Dyy_uA1_nonpos (p : ℝ) (_hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x private lemma deriv_uA1_eq_DyuA1Fun_on_A1 (p : ℝ) (hp : 2 < p) (x y : ℝ) (hA1 : A1 p x y) : deriv (fun s => uA1 p x s) y = DyuA1Fun p (x, y) := by rcases hA1 with ⟨hx, -, -⟩ - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp' let c : ℝ := alpha p * x ^ (p - 1) * (x - pStar p * x / 2) let m : ℝ := alpha p * x ^ (p - 1) * (pStar p / 2) @@ -2663,8 +2689,8 @@ private lemma deriv_uA1_eq_DyuA1Fun_on_A1 (p : ℝ) (hp : 2 < p) (x y : ℝ) (hA ring have hderiv_lin : deriv (fun s => c + m * s) = fun _ => m := by funext s - have hlin : HasDerivAt (fun z : ℝ => c + m * z) m s := by - simpa [one_mul] using (((hasDerivAt_id s).const_mul m).const_add c) + have hlin : HasDerivAt (fun z : ℝ => c + m * z) m s := + ((((hasDerivAt_id s).const_mul m).const_add c)).congr_deriv (by ring) exact hlin.deriv calc deriv (fun s => uA1 p x s) y = deriv (fun s => c + m * s) y := by rw [hrepr] @@ -2681,8 +2707,8 @@ private lemma hasDerivAt_uA1_y_of_pos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hx : funext s simp [uA1, hx, c, m] ring - have hderiv_lin : HasDerivAt (fun s => c + m * s) m y := by - simpa [one_mul] using (((hasDerivAt_id y).const_mul m).const_add c) + have hderiv_lin : HasDerivAt (fun s => c + m * s) m y := + ((((hasDerivAt_id y).const_mul m).const_add c)).congr_deriv (by ring) rw [hrepr] convert hderiv_lin using 1 simp [DyuA1Fun, DyuA1, m, hx, hpStar] @@ -2722,7 +2748,7 @@ private lemma uA1_tangent_y_on_Icc_of_A1 uA1 p x z ≤ uA1 p x y + f' * (z - y) := by have hcont : ContinuousOn (fun t => uA1 p x t) (Set.Icc lo hi) := by have hpair : ContinuousOn (fun t : ℝ => (x, t)) (Set.Icc lo hi) := - (by continuity : Continuous (fun t : ℝ => (x, t))).continuousOn + (continuous_const.prodMk continuous_id : Continuous (fun t : ℝ => (x, t))).continuousOn exact (continuousOn_uA1 p hp).comp hpair (by intro t _ht exact hx_pos.le) @@ -2758,8 +2784,8 @@ private lemma Dxy_uA1_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x ring have hderiv_lin : deriv (fun s => c + m * s) = fun _ => m := by funext s - have hlin : HasDerivAt (fun z : ℝ => c + m * z) m s := by - simpa [one_mul] using (((hasDerivAt_id s).const_mul m).const_add c) + have hlin : HasDerivAt (fun z : ℝ => c + m * z) m s := + ((((hasDerivAt_id s).const_mul m).const_add c)).congr_deriv (by ring) exact hlin.deriv calc deriv (fun y => uA1 p t y) y = deriv (fun s => c + m * s) y := by rw [hrepr] @@ -2774,12 +2800,8 @@ private lemma Dxy_uA1_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x deriv g x = alpha p * (p / 2) * ((p - 1) * x ^ (p - 2)) := by have hxne1 : x ≠ 0 ∨ 1 ≤ p - 1 := Or.inl hxne have hrpow : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := by - have h := (Real.hasDerivAt_rpow_const hxne1 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) - ((p - 1) * x ^ ((p - 1) - 1)) x) - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := + (Real.hasDerivAt_rpow_const hxne1).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hg' : HasDerivAt g (alpha p * (p / 2) * ((p - 1) * x ^ (p - 2))) x := by simpa [g, mul_assoc, mul_left_comm, mul_comm] using @@ -2792,8 +2814,8 @@ private lemma Dxy_uA1_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x · linarith · apply Real.rpow_nonneg apply div_nonneg <;> linarith - have hp0 : 0 ≤ p / 2 := by linarith - have hp1 : 0 ≤ p - 1 := by linarith + have hp0 : 0 ≤ p / 2 := half_p_nonneg_of_two_le p hp + have hp1 : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hpow : 0 ≤ x ^ (p - 2) := Real.rpow_nonneg hx.le _ exact mul_nonneg (mul_nonneg hα hp0) @@ -2802,16 +2824,8 @@ private lemma Dxy_uA1_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA1 : A1 p x private lemma deriv_vGeTwo_eq_DxvGeTwo_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p x y) : deriv (fun t => vGeTwo p t y) x = DxvGeTwo p x y := by rcases hA2 with ⟨hx, hneg, hay⟩ - have hp1 : 1 ≤ p := by linarith - have hyx : y < x := by - rw [a, pStar_eq_self_of_two_le p hp] at hay - have hp0 : 0 < p := by linarith - have hcoeff : 1 - 2 / p < (1 : ℝ) := by - have hdiv : 0 < 2 / p := by positivity - linarith - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx - linarith + have hp1 : 1 ≤ p := one_le_of_two_le p hp + have hyx : y < x := lt_of_lt_mul_a p hp hx hay have hsum : 0 < (x + y) / 2 := by linarith have hdiff : 0 < (x - y) / 2 := by linarith let g : ℝ → ℝ := fun t => @@ -2828,35 +2842,19 @@ private lemma deriv_vGeTwo_eq_DxvGeTwo_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ have hderiv : deriv (fun t => vGeTwo p t y) x = deriv g x := hEq.deriv_eq have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => ((t + y) / 2) ^ p) - (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun s : ℝ => s ^ p) (p * (((x + y) / 2) ^ (p - 1))) ((x + y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun s : ℝ => s ^ p) (p * ((x + y) / 2) ^ (p - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp x hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) x := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun t : ℝ => ((t - y) / 2) ^ p) - (p * (((x - y) / 2) ^ (p - 1)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun s : ℝ => s ^ p) (p * (((x - y) / 2) ^ (p - 1))) ((x - y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun s : ℝ => s ^ p) (p * ((x - y) / 2) ^ (p - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp x hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x - y) / 2) ^ (p - 1)) * (1 / 2)) x := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv (by ring) have hg : deriv g x = ((x + y) / 2) ^ (p - 1) * (p / 2) - @@ -2895,35 +2893,19 @@ private lemma hasDerivAt_vGeTwo_x_of_pos (p : ℝ) (_hp : 2 ≤ p) (x y : ℝ) filter_upwards [hsum_nhds, hdiff_nhds] with t ht_sum ht_diff simp [vGeTwo, g, abs_of_pos ht_sum, abs_of_pos ht_diff] have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => ((t + y) / 2) ^ p) - (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun s : ℝ => s ^ p) (p * (((x + y) / 2) ^ (p - 1))) ((x + y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun s : ℝ => s ^ p) (p * ((x + y) / 2) ^ (p - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp x hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) x := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun t : ℝ => ((t - y) / 2) ^ p) - (p * (((x - y) / 2) ^ (p - 1)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun s : ℝ => s ^ p) (p * (((x - y) / 2) ^ (p - 1))) ((x - y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun s : ℝ => s ^ p) (p * ((x - y) / 2) ^ (p - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp x hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x - y) / 2) ^ (p - 1)) * (1 / 2)) x := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv (by ring) have hd : HasDerivAt g (((x + y) / 2) ^ (p - 1) * (p / 2) - @@ -2982,16 +2964,8 @@ private lemma differentiableAt_DxvGeTwo_x_of_pos (p x y : ℝ) private lemma deriv_vGeTwo_eq_DyvGeTwo_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p x y) : deriv (fun s => vGeTwo p x s) y = DyvGeTwo p x y := by rcases hA2 with ⟨hx, hneg, hay⟩ - have hp1 : 1 ≤ p := by linarith - have hyx : y < x := by - rw [a, pStar_eq_self_of_two_le p hp] at hay - have hp0 : 0 < p := by linarith - have hcoeff : 1 - 2 / p < (1 : ℝ) := by - have hdiv : 0 < 2 / p := by positivity - linarith - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx - linarith + have hp1 : 1 ≤ p := one_le_of_two_le p hp + have hyx : y < x := lt_of_lt_mul_a p hp hx hay have hsum : 0 < (x + y) / 2 := by linarith have hdiff : 0 < (x - y) / 2 := by linarith let g : ℝ → ℝ := fun s => @@ -3008,35 +2982,19 @@ private lemma deriv_vGeTwo_eq_DyvGeTwo_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ have hderiv : deriv (fun s => vGeTwo p x s) y = deriv g y := hEq.deriv_eq have hbase_sum : - HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun s : ℝ => ((x + s) / 2) ^ p) - (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) y := by - have hrpow : - HasDerivAt (fun t : ℝ => t ^ p) (p * (((x + y) / 2) ^ (p - 1))) ((x + y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun t : ℝ => t ^ p) (p * ((x + y) / 2) ^ (p - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp y hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) y := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun s : ℝ => ((x - s) / 2) ^ p) - (p * (((x - y) / 2) ^ (p - 1)) * (-(1 / 2))) y := by - have hrpow : - HasDerivAt (fun t : ℝ => t ^ p) (p * (((x - y) / 2) ^ (p - 1))) ((x - y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun t : ℝ => t ^ p) (p * ((x - y) / 2) ^ (p - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp y hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x - y) / 2) ^ (p - 1)) * (-(1 / 2))) y := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv (by ring) have hg : deriv g y = ((x + y) / 2) ^ (p - 1) * (p / 2) + @@ -3075,35 +3033,19 @@ private lemma hasDerivAt_vGeTwo_y_of_pos (p : ℝ) (_hp : 2 ≤ p) (x y : ℝ) filter_upwards [hsum_nhds, hdiff_nhds] with s hs_sum hs_diff simp [vGeTwo, g, abs_of_pos hs_sum, abs_of_pos hs_diff] have hbase_sum : - HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun s : ℝ => ((x + s) / 2) ^ p) - (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) y := by - have hrpow : - HasDerivAt (fun t : ℝ => t ^ p) (p * (((x + y) / 2) ^ (p - 1))) ((x + y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun t : ℝ => t ^ p) (p * ((x + y) / 2) ^ (p - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp y hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) y := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun s : ℝ => ((x - s) / 2) ^ p) - (p * (((x - y) / 2) ^ (p - 1)) * (-(1 / 2))) y := by - have hrpow : - HasDerivAt (fun t : ℝ => t ^ p) (p * (((x - y) / 2) ^ (p - 1))) ((x - y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun t : ℝ => t ^ p) (p * ((x - y) / 2) ^ (p - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp y hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x - y) / 2) ^ (p - 1)) * (-(1 / 2))) y := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv (by ring) have hd : HasDerivAt g (((x + y) / 2) ^ (p - 1) * (p / 2) + @@ -3168,15 +3110,13 @@ private lemma hasDerivAt_vGeTwo_x_on_antidiag_pos (p : ℝ) (hp : 2 < p) have hEq : (fun t => vGeTwo p t (-x)) = g := by ext t simp [vGeTwo, g, sub_eq_add_neg] - have hp1 : 1 < p := by linarith + have hp1 : 1 < p := one_lt_of_two_le p (le_of_lt hp) have hbase_sum : - HasDerivAt (fun t : ℝ => (t - x) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const (-x)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - x) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const x).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t + x) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + x) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const x).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => |((t - x) / 2)| ^ p) 0 x := by have h : @@ -3206,15 +3146,12 @@ private lemma hasDerivAt_vGeTwo_x_on_antidiag_pos (p : ℝ) (hp : 2 < p) have hd : HasDerivAt g (-(p - 1) ^ p * (p * x ^ (p - 1) * (1 / 2))) x := by - have htmp : - HasDerivAt g - (0 - (p - 1) ^ p * (p * x ^ (p - 1) * (1 / 2))) x := by - dsimp [g] - exact hpow_sum.sub (hpow_diff.const_mul ((p - 1) ^ p)) - simpa using htmp + dsimp only [g] + refine (hpow_sum.sub (hpow_diff.const_mul ((p - 1) ^ p))).congr_deriv ?_ + ring rw [hEq] refine hd.congr_deriv ?_ - have hp1_ne : p - 1 ≠ 0 := by linarith + have hp1_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_two_le p (le_of_lt hp) simp [DxvGeTwo, hx, hp1_ne, abs_of_pos hx] ring @@ -3226,15 +3163,13 @@ private lemma hasDerivAt_vGeTwo_y_on_antidiag_pos (p : ℝ) (hp : 2 < p) have hEq : (fun s => vGeTwo p x s) = g := by ext s rfl - have hp1 : 1 < p := by linarith + have hp1 : 1 < p := one_lt_of_two_le p (le_of_lt hp) have hbase_sum : - HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) (-x) := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id (-x)).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) (-x) := + ((hasDerivAt_id' (x := (-x))).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) (-x) := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id (-x)).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) (-x) := + (((hasDerivAt_id' (x := (-x))).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun s : ℝ => |((x + s) / 2)| ^ p) 0 (-x) := by have h : @@ -3264,15 +3199,12 @@ private lemma hasDerivAt_vGeTwo_y_on_antidiag_pos (p : ℝ) (hp : 2 < p) have hd : HasDerivAt g (-((p - 1) ^ p * (p * x ^ (p - 1) * (-(1 / 2))))) (-x) := by - have htmp : - HasDerivAt g - (0 - (p - 1) ^ p * (p * x ^ (p - 1) * (-(1 / 2)))) (-x) := by - dsimp [g] - exact hpow_sum.sub (hpow_diff.const_mul ((p - 1) ^ p)) - simpa using htmp + dsimp only [g] + refine (hpow_sum.sub (hpow_diff.const_mul ((p - 1) ^ p))).congr_deriv ?_ + ring rw [hEq] refine hd.congr_deriv ?_ - have hp1_ne : p - 1 ≠ 0 := by linarith + have hp1_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_two_le p (le_of_lt hp) simp [DyvGeTwo, hx, hp1_ne, abs_of_pos hx] ring @@ -3282,9 +3214,9 @@ private lemma vGeTwo_A2_second_bracket_nonpos (p : ℝ) (hp : 2 ≤ p) (p - 1) ^ p * ((x - y) / 2) ^ (p - 2) ≤ 0 := by rcases hA2 with ⟨hx, hneg, hay⟩ have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith - have hp1_nonneg : 0 ≤ p - 1 := by linarith - have hp1_one : 1 ≤ p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_two_le p hp + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp + have hp1_one : 1 ≤ p - 1 := one_le_sub_one_of_two_le p hp have hp2_nonneg : 0 ≤ p - 2 := by linarith have hsum_pos : 0 < (x + y) / 2 := by linarith have hdiff_pos : 0 < (x - y) / 2 := by @@ -3293,8 +3225,7 @@ private lemma vGeTwo_A2_second_bracket_nonpos (p : ℝ) (hp : 2 ≤ p) have hcoeff : 1 - 2 / p < (1 : ℝ) := by have hdiv : 0 < 2 / p := by positivity linarith - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx + have hax_lt_x : (1 - 2 / p) * x < x := mul_lt_of_lt_one_left hx hcoeff linarith linarith have hay' : p * y < (p - 2) * x := by @@ -3303,7 +3234,7 @@ private lemma vGeTwo_A2_second_bracket_nonpos (p : ℝ) (hp : 2 ≤ p) field_simp [hp_pos.ne] at h linarith have hAB : (x + y) / 2 ≤ (p - 1) * ((x - y) / 2) := by - nlinarith [le_of_lt hay'] + linarith [le_of_lt hay'] have hpow_le : ((x + y) / 2) ^ (p - 2) ≤ ((p - 1) * ((x - y) / 2)) ^ (p - 2) := @@ -3327,17 +3258,9 @@ private lemma Dxx_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (((x + y) / 2) ^ (p - 2) - (p - 1) ^ p * ((x - y) / 2) ^ (p - 2)) := by rcases hA2 with ⟨hx, hneg, hay⟩ - have hp_ge1 : 1 ≤ p := by linarith - have hp1_ge1 : 1 ≤ p - 1 := by linarith - have hyx : y < x := by - rw [a, pStar_eq_self_of_two_le p hp] at hay - have hp0 : 0 < p := by linarith - have hcoeff : 1 - 2 / p < (1 : ℝ) := by - have hdiv : 0 < 2 / p := by positivity - linarith - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx - linarith + have hp_ge1 : 1 ≤ p := one_le_of_two_le p hp + have hp1_ge1 : 1 ≤ p - 1 := one_le_sub_one_of_two_le p hp + have hyx : y < x := lt_of_lt_mul_a p hp hx hay have hsum : 0 < (x + y) / 2 := by linarith have hdiff : 0 < (x - y) / 2 := by linarith let g : ℝ → ℝ := fun t => @@ -3361,39 +3284,19 @@ private lemma Dxx_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (p - 1) ^ p * (((t - y) / 2) ^ (p - 1)) * (p / 2) := by funext t have hbase_sum : - HasDerivAt (fun s : ℝ => (s + y) / 2) (1 / 2) t := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id t).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (s + y) / 2) (1 / 2) t := + ((hasDerivAt_id' (x := t)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (s - y) / 2) (1 / 2) t := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id t).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (s - y) / 2) (1 / 2) t := + ((hasDerivAt_id' (x := t)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun s : ℝ => ((s + y) / 2) ^ p) - (p * (((t + y) / 2) ^ (p - 1)) * (1 / 2)) t := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ p) (p * (((t + y) / 2) ^ (p - 1))) - ((t + y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inr hp_ge1) : - HasDerivAt (fun u : ℝ => u ^ p) (p * ((t + y) / 2) ^ (p - 1)) - ((t + y) / 2)) - have hcomp := hrpow.comp t hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((t + y) / 2) ^ (p - 1)) * (1 / 2)) t := + (hbase_sum.rpow_const (Or.inr hp_ge1)).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun s : ℝ => ((s - y) / 2) ^ p) - (p * (((t - y) / 2) ^ (p - 1)) * (1 / 2)) t := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ p) (p * (((t - y) / 2) ^ (p - 1))) - ((t - y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inr hp_ge1) : - HasDerivAt (fun u : ℝ => u ^ p) (p * ((t - y) / 2) ^ (p - 1)) - ((t - y) / 2)) - have hcomp := hrpow.comp t hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((t - y) / 2) ^ (p - 1)) * (1 / 2)) t := + (hbase_diff.rpow_const (Or.inr hp_ge1)).congr_deriv (by ring) have hd : HasDerivAt g (p * (((t + y) / 2) ^ (p - 1)) * (1 / 2) - @@ -3415,41 +3318,21 @@ private lemma Dxx_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (((x + y) / 2) ^ (p - 2) - (p - 1) ^ p * ((x - y) / 2) ^ (p - 2))) x := by have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => ((t + y) / 2) ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2))) ((x + y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inr hp1_ge1) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x + y) / 2) ^ ((p - 1) - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp x hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) x := + (hbase_sum.rpow_const (Or.inr hp1_ge1)).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hpow_diff : HasDerivAt (fun t : ℝ => ((t - y) / 2) ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2))) ((x - y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inr hp1_ge1) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x - y) / 2) ^ ((p - 1) - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp x hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (1 / 2)) x := + (hbase_diff.rpow_const (Or.inr hp1_ge1)).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hd : HasDerivAt (fun t => @@ -3472,7 +3355,7 @@ private lemma Dxx_vGeTwo_nonpos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p have hcoef : 0 ≤ p * (p - 1) / 4 := by exact div_nonneg (mul_nonneg (by linarith) (by linarith)) (by norm_num) have hbr := vGeTwo_A2_second_bracket_nonpos p hp x y hA2 - nlinarith [mul_nonpos_of_nonneg_of_nonpos hcoef hbr] + linarith [mul_nonpos_of_nonneg_of_nonpos hcoef hbr] private lemma deriv_DxvGeTwo_x_nonpos_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p x y) : @@ -3507,7 +3390,7 @@ private lemma vGeTwo_tangent_x_on_Icc_of_A2 vGeTwo p z y ≤ vGeTwo p x y + f' * (z - x) := by have hcont : ContinuousOn (fun t => vGeTwo p t y) (Set.Icc lo hi) := by have hp1 : 1 < p := by linarith - have hpair : Continuous (fun t : ℝ => (t, y)) := by continuity + have hpair : Continuous (fun t : ℝ => (t, y)) := continuous_id.prodMk continuous_const have hcomp := ((continuous_vGeTwo p hp1).comp hpair).continuousOn (s := Set.Icc lo hi) simpa [Function.comp_def] using hcomp @@ -3527,8 +3410,7 @@ private lemma vGeTwo_tangent_x_on_Icc_of_A2 linarith have hay : y < (1 - 2 / p) * t := by simpa [a, pStar_eq_self_of_two_le p hp] using hA2.2.2 - have hax_lt_x : (1 - 2 / p) * t < t := by - simpa using mul_lt_mul_of_pos_right hcoeff hA2.1 + have hax_lt_x : (1 - 2 / p) * t < t := mul_lt_of_lt_one_left hA2.1 hcoeff linarith linarith exact (hasDerivAt_vGeTwo_x_of_pos p hp t y hsum hdiff).hasDerivWithinAt @@ -3543,8 +3425,7 @@ private lemma vGeTwo_tangent_x_on_Icc_of_A2 linarith have hay : y < (1 - 2 / p) * t := by simpa [a, pStar_eq_self_of_two_le p hp] using hA2.2.2 - have hax_lt_x : (1 - 2 / p) * t < t := by - simpa using mul_lt_mul_of_pos_right hcoeff hA2.1 + have hax_lt_x : (1 - 2 / p) * t < t := mul_lt_of_lt_one_left hA2.1 hcoeff linarith linarith exact (differentiableAt_DxvGeTwo_x_of_pos p t y hsum hdiff).hasDerivAt.hasDerivWithinAt @@ -3560,17 +3441,9 @@ private lemma Dyy_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (((x + y) / 2) ^ (p - 2) - (p - 1) ^ p * ((x - y) / 2) ^ (p - 2)) := by rcases hA2 with ⟨hx, hneg, hay⟩ - have hp_ge1 : 1 ≤ p := by linarith - have hp1_ge1 : 1 ≤ p - 1 := by linarith - have hyx : y < x := by - rw [a, pStar_eq_self_of_two_le p hp] at hay - have hp0 : 0 < p := by linarith - have hcoeff : 1 - 2 / p < (1 : ℝ) := by - have hdiv : 0 < 2 / p := by positivity - linarith - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx - linarith + have hp_ge1 : 1 ≤ p := one_le_of_two_le p hp + have hp1_ge1 : 1 ≤ p - 1 := one_le_sub_one_of_two_le p hp + have hyx : y < x := lt_of_lt_mul_a p hp hx hay have hsum : 0 < (x + y) / 2 := by linarith have hdiff : 0 < (x - y) / 2 := by linarith let g : ℝ → ℝ := fun s => @@ -3594,39 +3467,19 @@ private lemma Dyy_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (p - 1) ^ p * (((x - s) / 2) ^ (p - 1)) * (p / 2) := by funext s have hbase_sum : - HasDerivAt (fun u : ℝ => (x + u) / 2) (1 / 2) s := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id s).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun u : ℝ => (x + u) / 2) (1 / 2) s := + ((hasDerivAt_id' (x := s)).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun u : ℝ => (x - u) / 2) (-(1 / 2)) s := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id s).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun u : ℝ => (x - u) / 2) (-(1 / 2)) s := + (((hasDerivAt_id' (x := s)).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun u : ℝ => ((x + u) / 2) ^ p) - (p * (((x + s) / 2) ^ (p - 1)) * (1 / 2)) s := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ p) (p * (((x + s) / 2) ^ (p - 1))) - ((x + s) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inr hp_ge1) : - HasDerivAt (fun u : ℝ => u ^ p) (p * ((x + s) / 2) ^ (p - 1)) - ((x + s) / 2)) - have hcomp := hrpow.comp s hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x + s) / 2) ^ (p - 1)) * (1 / 2)) s := + (hbase_sum.rpow_const (Or.inr hp_ge1)).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun u : ℝ => ((x - u) / 2) ^ p) - (p * (((x - s) / 2) ^ (p - 1)) * (-(1 / 2))) s := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ p) (p * (((x - s) / 2) ^ (p - 1))) - ((x - s) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inr hp_ge1) : - HasDerivAt (fun u : ℝ => u ^ p) (p * ((x - s) / 2) ^ (p - 1)) - ((x - s) / 2)) - have hcomp := hrpow.comp s hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x - s) / 2) ^ (p - 1)) * (-(1 / 2))) s := + (hbase_diff.rpow_const (Or.inr hp_ge1)).congr_deriv (by ring) have hd : HasDerivAt g (p * (((x + s) / 2) ^ (p - 1)) * (1 / 2) - @@ -3648,41 +3501,21 @@ private lemma Dyy_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (((x + y) / 2) ^ (p - 2) - (p - 1) ^ p * ((x - y) / 2) ^ (p - 2))) y := by have hbase_sum : - HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun s : ℝ => ((x + s) / 2) ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) y := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2))) ((x + y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inr hp1_ge1) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x + y) / 2) ^ ((p - 1) - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp y hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) y := + (hbase_sum.rpow_const (Or.inr hp1_ge1)).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hpow_diff : HasDerivAt (fun s : ℝ => ((x - s) / 2) ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (-(1 / 2))) y := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2))) ((x - y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inr hp1_ge1) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x - y) / 2) ^ ((p - 1) - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp y hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (-(1 / 2))) y := + (hbase_diff.rpow_const (Or.inr hp1_ge1)).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hd : HasDerivAt (fun s => @@ -3705,7 +3538,7 @@ private lemma Dyy_vGeTwo_nonpos (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p have hcoef : 0 ≤ p * (p - 1) / 4 := by exact div_nonneg (mul_nonneg (by linarith) (by linarith)) (by norm_num) have hbr := vGeTwo_A2_second_bracket_nonpos p hp x y hA2 - nlinarith [mul_nonpos_of_nonneg_of_nonpos hcoef hbr] + linarith [mul_nonpos_of_nonneg_of_nonpos hcoef hbr] private lemma deriv_DyvGeTwo_y_nonpos_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p x y) : @@ -3730,7 +3563,7 @@ private lemma vGeTwo_tangent_y_on_Icc_of_A2 vGeTwo p x z ≤ vGeTwo p x y + f' * (z - y) := by have hcont : ContinuousOn (fun t => vGeTwo p x t) (Set.Icc lo hi) := by have hp1 : 1 < p := by linarith - have hpair : Continuous (fun t : ℝ => (x, t)) := by continuity + have hpair : Continuous (fun t : ℝ => (x, t)) := continuous_const.prodMk continuous_id have hcomp := ((continuous_vGeTwo p hp1).comp hpair).continuousOn (s := Set.Icc lo hi) simpa [Function.comp_def] using hcomp @@ -3747,8 +3580,7 @@ private lemma vGeTwo_tangent_y_on_Icc_of_A2 linarith have hat : t < (1 - 2 / p) * x := by simpa [a, pStar_eq_self_of_two_le p hp] using hA2.2.2 - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hA2.1 + have hax_lt_x : (1 - 2 / p) * x < x := mul_lt_of_lt_one_left hA2.1 hcoeff linarith have hsum : 0 < (x + t) / 2 := by linarith [hA2.1, hA2.2.1] have hdiff : 0 < (x - t) / 2 := by linarith @@ -3761,8 +3593,7 @@ private lemma vGeTwo_tangent_y_on_Icc_of_A2 linarith have hat : t < (1 - 2 / p) * x := by simpa [a, pStar_eq_self_of_two_le p hp] using hA2.2.2 - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hA2.1 + have hax_lt_x : (1 - 2 / p) * x < x := mul_lt_of_lt_one_left hA2.1 hcoeff linarith have hsum : 0 < (x + t) / 2 := by linarith [hA2.1, hA2.2.1] have hdiff : 0 < (x - t) / 2 := by linarith @@ -3779,16 +3610,8 @@ private lemma Dxy_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (((x + y) / 2) ^ (p - 2) + (p - 1) ^ p * ((x - y) / 2) ^ (p - 2)) := by rcases hA2 with ⟨hx, hneg, hay⟩ - have hp1_ge1 : 1 ≤ p - 1 := by linarith - have hyx : y < x := by - rw [a, pStar_eq_self_of_two_le p hp] at hay - have hp0 : 0 < p := by linarith - have hcoeff : 1 - 2 / p < (1 : ℝ) := by - have hdiv : 0 < 2 / p := by positivity - linarith - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx - linarith + have hp1_ge1 : 1 ≤ p - 1 := one_le_sub_one_of_two_le p hp + have hyx : y < x := lt_of_lt_mul_a p hp hx hay have hsum : 0 < (x + y) / 2 := by linarith have hdiff : 0 < (x - y) / 2 := by linarith let g : ℝ → ℝ := fun t => @@ -3828,41 +3651,21 @@ private lemma Dxy_vGeTwo_formula_on_A2 (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 (((x + y) / 2) ^ (p - 2) + (p - 1) ^ p * ((x - y) / 2) ^ (p - 2))) x := by have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => ((t + y) / 2) ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2))) ((x + y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inr hp1_ge1) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x + y) / 2) ^ ((p - 1) - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp x hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) x := + (hbase_sum.rpow_const (Or.inr hp1_ge1)).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hpow_diff : HasDerivAt (fun t : ℝ => ((t - y) / 2) ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2))) ((x - y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inr hp1_ge1) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x - y) / 2) ^ ((p - 1) - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp x hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (1 / 2)) x := + (hbase_diff.rpow_const (Or.inr hp1_ge1)).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hd' : HasDerivAt g (((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) * (p / 2) + @@ -3892,8 +3695,7 @@ private lemma Dxy_vGeTwo_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p have hdiv : 0 < 2 / p := by positivity linarith have hyx : y < x := by - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx + have hax_lt_x : (1 - 2 / p) * x < x := mul_lt_of_lt_one_left hx hcoeff linarith linarith exact Real.rpow_nonneg hpos.le _ @@ -3905,8 +3707,7 @@ private lemma Dxy_vGeTwo_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p have hdiv : 0 < 2 / p := by positivity linarith have hyx : y < x := by - have hax_lt_x : (1 - 2 / p) * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx + have hax_lt_x : (1 - 2 / p) * x < x := mul_lt_of_lt_one_left hx hcoeff linarith linarith exact Real.rpow_nonneg hpos.le _ @@ -3917,6 +3718,22 @@ private lemma Dxy_vGeTwo_nonneg (p : ℝ) (hp : 2 ≤ p) (x y : ℝ) (hA2 : A2 p add_nonneg hsum (mul_nonneg hpbase hdiff) exact mul_nonneg hpcoef hsumbr +/-- `vGeTwo` is differentiable in `x` on the closed sector `A2`, with derivative given by the +glued first partial `DxauxFunction1`. -/ +private lemma hasDerivAt_vGeTwo_x_DxauxFunction1 (p : ℝ) (hp : 2 ≤ p) {x y : ℝ} + (hsum : 0 < (x + y) / 2) (hdiff : 0 < (x - y) / 2) (hcl : closureA2 p x y) : + HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p x y) x := + (hasDerivAt_vGeTwo_x_of_pos p hp x y hsum hdiff).congr_deriv + (auxFunction1_Dx_eq_DxvGeTwo p hp x y hcl).symm + +/-- `vGeTwo` is differentiable in `y` on the closed sector `A2`, with derivative given by the +glued first partial `DyauxFunction1`. -/ +private lemma hasDerivAt_vGeTwo_y_DyauxFunction1 (p : ℝ) (hp : 2 ≤ p) {x y : ℝ} + (hsum : 0 < (x + y) / 2) (hdiff : 0 < (x - y) / 2) (hcl : closureA2 p x y) : + HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x y) y := + (hasDerivAt_vGeTwo_y_of_pos p hp x y hsum hdiff).congr_deriv + (auxFunction1_Dy_eq_DyvGeTwo p hp x y hcl).symm + /-! ## 8. First-quadrant geometry and `auxFunction1` tangent estimates -/ /- @@ -3926,32 +3743,10 @@ horizontal or vertical segment may cross the internal boundary comparisons there, and glue the local A1/A2 tangent inequalities. -/ -private lemma a_nonneg_of_two_le (p : ℝ) (hp : 2 ≤ p) : 0 ≤ a p := by - have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith - rw [a, hpStar] - field_simp [hp_pos.ne] - nlinarith - -private lemma a_pos_of_two_lt (p : ℝ) (hp : 2 < p) : 0 < a p := by - have hp' : 2 ≤ p := by linarith - have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp' - have hp_pos : 0 < p := by linarith - rw [a, hpStar] - field_simp [hp_pos.ne'] - linarith - -private lemma a_lt_one_of_two_le (p : ℝ) (hp : 2 ≤ p) : a p < 1 := by - have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp - have hp_pos : 0 < p := by linarith - rw [a, hpStar] - have hdiv : 0 < 2 / p := by positivity - linarith - private lemma horizontal_boundary_closureA1_closureA2 (p y : ℝ) (hp : 2 < p) (hy : 0 < y) : closureA1 p (y / a p) y ∧ closureA2 p (y / a p) y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp have ha_lt : a p < 1 := a_lt_one_of_two_le p hp' have hboundary : a p * (y / a p) = y := by @@ -3973,13 +3768,11 @@ private lemma DxauxFunction1_A1_boundary_le (p : ℝ) (hp : 2 < p) {x y : ℝ} (hx : 0 < x) (hax : (a p) * x < y) (hyx : y < x) : DxauxFunction1 p (y / a p) y ≤ DxauxFunction1 p x y := by - have hp' : 2 ≤ p := by linarith - have hp1 : 1 < p := by linarith + have hp' : 2 ≤ p := le_of_lt hp + have hp1 : 1 < p := one_lt_of_two_le p (le_of_lt hp) have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hxc : x < c := by have hmul : a p * x < a p * c := by simpa [hac] using hax nlinarith [hmul, ha_pos] @@ -3992,7 +3785,7 @@ private lemma DxauxFunction1_A1_boundary_le AntitoneOn (fun t : ℝ => DxuA1Fun p (t, y)) (Set.Icc x c) := by have hcont : ContinuousOn (fun t : ℝ => DxuA1Fun p (t, y)) (Set.Icc x c) := by have hpair : ContinuousOn (fun t : ℝ => (t, y)) (Set.Icc x c) := - (by continuity : Continuous (fun t : ℝ => (t, y))).continuousOn + (continuous_id.prodMk continuous_const : Continuous (fun t : ℝ => (t, y))).continuousOn exact (continuousOn_DxuA1_closureA1 p hp1).comp hpair (by intro t ht have htc : t ≤ c := ht.2 @@ -4008,13 +3801,11 @@ private lemma DxauxFunction1_A1_boundary_le (f' := fun t : ℝ => deriv (fun s => DxuA1Fun p (s, y)) t) (convex_Icc x c) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo x c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo x c := mem_Ioo_of_mem_interior_Icc ht exact (differentiableAt_DxuA1Fun_x_of_pos p t y (lt_trans hx htIoo.1)).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo x c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo x c := mem_Ioo_of_mem_interior_Icc ht have hA1 : A1 p t y := by have h_at : a p * t < y := by have hmul : a p * t < a p * c := @@ -4034,12 +3825,10 @@ private lemma DxauxFunction1_A2_le_boundary (p : ℝ) (hp : 2 < p) {x y : ℝ} (hx : 0 < x) (hy_pos : 0 < y) (hay : y < (a p) * x) : DxauxFunction1 p x y ≤ DxauxFunction1 p (y / a p) y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hcx : c < x := by have hmul : a p * c < a p * x := by simpa [hac] using hay nlinarith [hmul, ha_pos] @@ -4049,7 +3838,7 @@ private lemma DxauxFunction1_A2_le_boundary AntitoneOn (fun t : ℝ => DxvGeTwo p t y) (Set.Icc c x) := by have hcont : ContinuousOn (fun t : ℝ => DxvGeTwo p t y) (Set.Icc c x) := by have hpair : ContinuousOn (fun t : ℝ => (t, y)) (Set.Icc c x) := - (by continuity : Continuous (fun t : ℝ => (t, y))).continuousOn + (continuous_id.prodMk continuous_const : Continuous (fun t : ℝ => (t, y))).continuousOn exact (continuousOn_DxvGeTwo_closureA2 p hp').comp hpair (by intro t ht have hc_pos : 0 < c := div_pos hy_pos ha_pos @@ -4065,8 +3854,7 @@ private lemma DxauxFunction1_A2_le_boundary (f' := fun t : ℝ => deriv (fun s => DxvGeTwo p s y) t) (convex_Icc c x) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (t + y) / 2 := by have hc_pos : 0 < c := div_pos hy_pos ha_pos linarith [htIoo.1] @@ -4081,8 +3869,7 @@ private lemma DxauxFunction1_A2_le_boundary linarith [hy_lt_c, htIoo.1] exact (differentiableAt_DxvGeTwo_x_of_pos p t y hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht have hA2 : A2 p t y := by have hc_pos : 0 < c := div_pos hy_pos ha_pos have hyt : y < a p * t := by @@ -4157,10 +3944,10 @@ private lemma hasDerivAt_auxFunction1_x_on_boundary (p x : ℝ) (hp : 2 ≤ p) ( have hlt : a p < 1 := a_lt_one_of_two_le p hp simpa using mul_lt_mul_of_pos_right hlt hx have hsum : 0 < (x + a p * x) / 2 := by - have : 0 < x + a p * x := by nlinarith + have : 0 < x + a p * x := by linarith linarith have hdiff : 0 < (x - a p * x) / 2 := by - have : 0 < x - a p * x := by nlinarith + have : 0 < x - a p * x := by linarith linarith have hleftEq : (fun t => auxFunction1 p t ((a p) * x)) =ᶠ[𝓝[Set.Iic x] x] @@ -4243,7 +4030,7 @@ private lemma deriv_auxFunction1_eq_DyauxFunction1_on_A2 (p : ℝ) (hp : 2 ≤ p private lemma hasDerivAt_auxFunction1_y_on_boundary (p x : ℝ) (hp : 2 < p) (hx : 0 < x) : HasDerivAt (fun s => auxFunction1 p x s) (DyauxFunction1 p x ((a p) * x)) ((a p) * x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' have hy_nonneg : 0 ≤ a p * x := mul_nonneg ha_nonneg hx.le have hneg : -x < a p * x := by linarith @@ -4251,10 +4038,10 @@ private lemma hasDerivAt_auxFunction1_y_on_boundary (p x : ℝ) (hp : 2 < p) (hx have hlt : a p < 1 := a_lt_one_of_two_le p hp' simpa using mul_lt_mul_of_pos_right hlt hx have hsum : 0 < (x + a p * x) / 2 := by - have : 0 < x + a p * x := by nlinarith + have : 0 < x + a p * x := by linarith linarith have hdiff : 0 < (x - a p * x) / 2 := by - have : 0 < x - a p * x := by nlinarith + have : 0 < x - a p * x := by linarith linarith have hleftEq : (fun s => auxFunction1 p x s) =ᶠ[𝓝[Set.Iic (a p * x)] (a p * x)] @@ -4309,7 +4096,7 @@ private lemma DyauxFunction1_A2_boundary_le AntitoneOn (fun t : ℝ => DyvGeTwo p x t) (Set.Icc y ((a p) * x)) := by have hcont : ContinuousOn (fun t : ℝ => DyvGeTwo p x t) (Set.Icc y ((a p) * x)) := by have hpair : ContinuousOn (fun t : ℝ => (x, t)) (Set.Icc y ((a p) * x)) := - (by continuity : Continuous (fun t : ℝ => (x, t))).continuousOn + (continuous_const.prodMk continuous_id : Continuous (fun t : ℝ => (x, t))).continuousOn exact (continuousOn_DyvGeTwo_closureA2 p hp).comp hpair (by intro t ht exact ⟨hx.le, by linarith [ht.1], ht.2⟩) @@ -4319,21 +4106,18 @@ private lemma DyauxFunction1_A2_boundary_le (f' := fun t : ℝ => deriv (fun s => DyvGeTwo p x s) t) (convex_Icc y ((a p) * x)) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo y ((a p) * x) := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y ((a p) * x) := mem_Ioo_of_mem_interior_Icc ht have hA2 : A2 p x t := by exact ⟨hx, by linarith [htIoo.1], htIoo.2⟩ have hyx : t < x := by have hcoeff : a p < 1 := a_lt_one_of_two_le p hp - have hax_lt_x : a p * x < x := by - simpa using mul_lt_mul_of_pos_right hcoeff hx + have hax_lt_x : a p * x < x := mul_lt_of_lt_one_left hx hcoeff exact lt_trans htIoo.2 hax_lt_x have hsum : 0 < (x + t) / 2 := by linarith [hA2.2.1] have hdiff : 0 < (x - t) / 2 := by linarith exact (differentiableAt_DyvGeTwo_y_of_pos p x t hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo y ((a p) * x) := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y ((a p) * x) := mem_Ioo_of_mem_interior_Icc ht have hA2 : A2 p x t := by exact ⟨hx, by linarith [htIoo.1], htIoo.2⟩ exact deriv_DyvGeTwo_y_nonpos_on_A2 p hp x t hA2 @@ -4345,7 +4129,7 @@ private lemma DyauxFunction1_A2_boundary_le have hcl_c : closureA2 p x ((a p) * x) := by have hneg : -x ≤ (a p) * x := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] exact ⟨hx.le, hneg, le_rfl⟩ rwa [auxFunction1_Dy_eq_DyvGeTwo p hp x ((a p) * x) hcl_c, auxFunction1_Dy_eq_DyvGeTwo p hp x y hcl_y] @@ -4357,12 +4141,10 @@ private lemma auxFunction1_tangent_y_forward_cross_A2_A1 auxFunction1 p x z ≤ auxFunction1 p x y + DyauxFunction1 p x y * (z - y) := by let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp) have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] have hcl_y_A2 : closureA2 p x y := ⟨hx.le, le_of_lt hy_lower, hy_boundary⟩ have hcl_c_A2 : closureA2 p x c := by exact ⟨hx.le, le_of_lt hneg_c, by simp [c]⟩ @@ -4370,11 +4152,8 @@ private lemma auxFunction1_tangent_y_forward_cross_A2_A1 exact ⟨hx.le, by simp [c], le_of_lt hc_lt_x⟩ have hcl_z_A1 : closureA1 p x z := ⟨hx.le, hz_boundary, le_of_lt hz_upper⟩ have hderiv_y : - HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x y) y := by - have hsum : 0 < (x + y) / 2 := by linarith - have hdiff : 0 < (x - y) / 2 := by linarith [hy_boundary, hc_lt_x] - refine (hasDerivAt_vGeTwo_y_of_pos p hp x y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dy_eq_DyvGeTwo p hp x y hcl_y_A2).symm + HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x y) y := + hasDerivAt_vGeTwo_y_DyauxFunction1 p hp (by linarith) (by linarith) hcl_y_A2 have hderiv_c : HasDerivAt (fun t => uA1 p x t) (DyauxFunction1 p x c) c := by refine (hasDerivAt_uA1_y_of_pos p hp x c hx).congr_deriv ?_ @@ -4423,12 +4202,10 @@ private lemma auxFunction1_tangent_y_backward_cross_A1_A2 auxFunction1 p x z ≤ auxFunction1 p x y + DyauxFunction1 p x y * (z - y) := by let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp) have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] have hcl_y_A1 : closureA1 p x y := ⟨hx.le, hy_boundary, le_of_lt hy_upper⟩ have hcl_c_A1 : closureA1 p x c := by exact ⟨hx.le, by simp [c], le_of_lt hc_lt_x⟩ @@ -4440,19 +4217,15 @@ private lemma auxFunction1_tangent_y_backward_cross_A1_A2 refine (hasDerivAt_uA1_y_of_pos p hp x y hx).congr_deriv ?_ exact (auxFunction1_Dy_eq_DyuA1 p x y hcl_y_A1).symm have hderiv_c : - HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x c) c := by - have hsum : 0 < (x + c) / 2 := by linarith [hneg_c] - have hdiff : 0 < (x - c) / 2 := by linarith [hc_lt_x] - refine (hasDerivAt_vGeTwo_y_of_pos p hp x c hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dy_eq_DyvGeTwo p hp x c hcl_c_A2).symm + HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x c) c := + hasDerivAt_vGeTwo_y_DyauxFunction1 p hp (by linarith) (by linarith) hcl_c_A2 have h_yc_u : uA1 p x c ≤ uA1 p x y + DyauxFunction1 p x y * (c - y) := by apply uA1_tangent_y_on_Icc_of_A1 (p := p) (hp := hp) (lo := c) (hi := y) (x := x) (y := y) (z := c) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo c y := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c y := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, by linarith [htIoo.2, hy_upper]⟩ · exact ⟨hy_boundary, le_rfl⟩ · exact ⟨le_rfl, hy_boundary⟩ @@ -4462,8 +4235,7 @@ private lemma auxFunction1_tangent_y_backward_cross_A1_A2 apply vGeTwo_tangent_y_on_Icc_of_A2 (p := p) (hp := hp) (lo := z) (hi := c) (x := x) (y := c) (z := z) · intro t ht - have htIoo : t ∈ Set.Ioo z c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo z c := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, by linarith [htIoo.1], htIoo.2⟩ · exact ⟨hz_boundary, le_rfl⟩ · exact ⟨le_rfl, hz_boundary⟩ @@ -4512,8 +4284,7 @@ private lemma auxFunction1_tangent_y_on_A2_segment apply vGeTwo_tangent_y_on_Icc_of_A2 (p := p) (hp := hp) (lo := lo) (hi := hi) (x := x) (y := y) (z := z) · intro t ht - have htIoo : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hlo_lower : -x < lo := by exact lt_min hy_lower hz_lower have hhi_boundary : hi ≤ (a p) * x := by @@ -4545,8 +4316,7 @@ private lemma auxFunction1_tangent_y_on_A1_segment (p := p) (hp := hp) (lo := lo) (hi := hi) (x := x) (y := y) (z := z) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hlo_boundary : (a p) * x ≤ lo := by exact le_min hy_boundary hz_boundary have hhi_upper : hi < x := by @@ -4582,9 +4352,7 @@ private lemma auxFunction1_tangent_y_to_diag_from_QuarterPlaneOpen_segment auxFunction1 p x x ≤ auxFunction1 p x y + DyauxFunction1 p x y * (x - y) := by let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp) have hdiag : closureA1 p x x := by refine ⟨hx.le, ?_, le_rfl⟩ exact (le_of_lt hc_lt_x) @@ -4593,15 +4361,12 @@ private lemma auxFunction1_tangent_y_to_diag_from_QuarterPlaneOpen_segment have hcl_c_A2 : closureA2 p x c := by have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] exact ⟨hx.le, le_of_lt hneg_c, le_rfl⟩ have hcl_c_A1 : closureA1 p x c := ⟨hx.le, le_rfl, le_of_lt hc_lt_x⟩ have hderiv_y : - HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x y) y := by - have hsum : 0 < (x + y) / 2 := by linarith - have hdiff : 0 < (x - y) / 2 := by linarith - refine (hasDerivAt_vGeTwo_y_of_pos p hp x y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dy_eq_DyvGeTwo p hp x y hcl_y_A2).symm + HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x y) y := + hasDerivAt_vGeTwo_y_DyauxFunction1 p hp (by linarith) (by linarith) hcl_y_A2 have hderiv_c : HasDerivAt (fun t => uA1 p x t) (DyauxFunction1 p x c) c := by refine (hasDerivAt_uA1_y_of_pos p hp x c hx).congr_deriv ?_ @@ -4611,8 +4376,7 @@ private lemma auxFunction1_tangent_y_to_diag_from_QuarterPlaneOpen_segment apply vGeTwo_tangent_y_on_Icc_of_A2 (p := p) (hp := hp) (lo := y) (hi := c) (x := x) (y := y) (z := c) · intro t ht - have htIoo : t ∈ Set.Ioo y c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y c := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, by linarith [htIoo.1], htIoo.2⟩ · exact ⟨le_rfl, hyc⟩ · exact ⟨hyc, le_rfl⟩ @@ -4623,8 +4387,7 @@ private lemma auxFunction1_tangent_y_to_diag_from_QuarterPlaneOpen_segment (p := p) (hp := hp) (lo := c) (hi := x) (x := x) (y := c) (z := x) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, htIoo.2⟩ · exact ⟨le_rfl, hc_lt_x.le⟩ · exact ⟨hc_lt_x.le, le_rfl⟩ @@ -4653,8 +4416,7 @@ private lemma auxFunction1_tangent_y_to_diag_from_QuarterPlaneOpen_segment (p := p) (hp := hp) (lo := y) (hi := x) (x := x) (y := y) (z := x) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo y x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y x := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, lt_of_le_of_lt hcy htIoo.1, htIoo.2⟩ · exact ⟨le_rfl, hy_upper.le⟩ · exact ⟨hy_upper.le, le_rfl⟩ @@ -4667,9 +4429,7 @@ private lemma DyauxFunction1_diag_le_of_QuarterPlaneOpen (hx : 0 < x) (hy_lower : -x < y) (hy_upper : y < x) : DyauxFunction1 p x x ≤ DyauxFunction1 p x y := by let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp) have hdiag : closureA1 p x x := ⟨hx.le, le_of_lt hc_lt_x, le_rfl⟩ rcases le_total y c with hyc | hcy · have hcl_c_A1 : closureA1 p x c := ⟨hx.le, le_rfl, le_of_lt hc_lt_x⟩ @@ -4710,8 +4470,7 @@ private lemma auxFunction1_tangent_x_on_A1_segment have hlo_pos : 0 < lo := lt_min hx_pos hz_pos exact le_of_lt (lt_of_lt_of_le hlo_pos ht.1) · intro t ht - have htIoo : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hhi_boundary : (a p) * hi < y := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp rcases le_total x z with hxz | hzx @@ -4757,8 +4516,7 @@ private lemma auxFunction1_tangent_x_on_A2_segment apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp) (lo := lo) (hi := hi) (x := x) (z := z) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hlo_pos : 0 < lo := lt_min hx_pos hz_pos have hlo_neg : -lo < y := by rcases le_total x z with hxz | hzx @@ -4791,12 +4549,10 @@ private lemma auxFunction1_tangent_x_forward_cross_A1_A2 (hz_boundary : y < (a p) * z) : auxFunction1 p z y ≤ auxFunction1 p x y + DxauxFunction1 p x y * (z - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hxc : x < c := by have hmul : a p * x < a p * c := by simpa [hac] using hax nlinarith [hmul, ha_pos] @@ -4816,19 +4572,8 @@ private lemma auxFunction1_tangent_x_forward_cross_A1_A2 refine (hasDerivAt_uA1_x_of_pos p hp' x y hx).congr_deriv ?_ exact (auxFunction1_Dx_eq_DxuA1 p x y hcl_x_A1).symm have hderiv_c : - HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p c y) c := by - have hc_pos : 0 < c := div_pos hy_pos ha_pos - have hyc : y < c := by - have ha_lt : a p < 1 := a_lt_one_of_two_le p hp' - have hlt_inv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - have hmul := mul_lt_mul_of_pos_left hlt_inv hy_pos - simpa [c, div_eq_mul_inv] using hmul - have hsum : 0 < (c + y) / 2 := by linarith - have hdiff : 0 < (c - y) / 2 := by linarith - refine (hasDerivAt_vGeTwo_x_of_pos p hp' c y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dx_eq_DxvGeTwo p hp' c y hboundary.2).symm + HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p c y) c := + hasDerivAt_vGeTwo_x_DxauxFunction1 p hp' (by linarith) (by linarith) hboundary.2 have h_xc_u : uA1 p c y ≤ uA1 p x y + DxauxFunction1 p x y * (c - x) := by apply uA1_tangent_x_on_Icc_of_A1 @@ -4836,8 +4581,7 @@ private lemma auxFunction1_tangent_x_forward_cross_A1_A2 · intro t ht exact le_trans hx.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo x c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo x c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos @@ -4851,8 +4595,7 @@ private lemma auxFunction1_tangent_x_forward_cross_A1_A2 apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp') (lo := c) (hi := z) (x := c) (z := z) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo c z := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c z := mem_Ioo_of_mem_interior_Icc ht have hc_pos : 0 < c := div_pos hy_pos ha_pos have hyt : y < a p * t := by have hmul : a p * c < a p * t := @@ -4883,12 +4626,10 @@ private lemma auxFunction1_tangent_x_backward_cross_A2_A1 (hz_boundary : (a p) * z < y) (hyz : y < z) : auxFunction1 p z y ≤ auxFunction1 p x y + DxauxFunction1 p x y * (z - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hcx : c < x := by have hmul : a p * c < a p * x := by simpa [hac] using hay nlinarith [hmul, ha_pos] @@ -4901,15 +4642,8 @@ private lemma auxFunction1_tangent_x_backward_cross_A2_A1 have hz_pos : 0 < z := lt_trans hy_pos hyz have hcl_z_A1 : closureA1 p z y := ⟨hz_pos.le, le_of_lt hz_boundary, le_of_lt hyz⟩ have hderiv_x : - HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p x y) x := by - have hsum : 0 < (x + y) / 2 := by linarith - have hdiff : 0 < (x - y) / 2 := by - have hlt_one : a p < 1 := a_lt_one_of_two_le p hp' - have hax_lt_x : a p * x < x := by - simpa using mul_lt_mul_of_pos_right hlt_one hx - linarith - refine (hasDerivAt_vGeTwo_x_of_pos p hp' x y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dx_eq_DxvGeTwo p hp' x y hcl_x_A2).symm + HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p x y) x := + hasDerivAt_vGeTwo_x_DxauxFunction1 p hp' (by linarith) (by linarith) hcl_x_A2 have hderiv_c : HasDerivAt (fun t => uA1 p t y) (DxauxFunction1 p c y) c := by have hc_pos : 0 < c := div_pos hy_pos ha_pos @@ -4920,8 +4654,7 @@ private lemma auxFunction1_tangent_x_backward_cross_A2_A1 apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp') (lo := c) (hi := x) (x := x) (z := c) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht have hc_pos : 0 < c := div_pos hy_pos ha_pos have hyt : y < a p * t := by have hmul : a p * c < a p * t := @@ -4939,8 +4672,7 @@ private lemma auxFunction1_tangent_x_backward_cross_A2_A1 · intro t ht exact le_trans hz_pos.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo z c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo z c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos @@ -4968,12 +4700,10 @@ private lemma auxFunction1_tangent_x_A1_to_boundary (hx : 0 < x) (hax : (a p) * x < y) (hyx : y < x) : auxFunction1 p (y / a p) y ≤ auxFunction1 p x y + DxauxFunction1 p x y * (y / a p - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hxc : x < c := by have hmul : a p * x < a p * c := by simpa [hac] using hax nlinarith [hmul, ha_pos] @@ -4993,8 +4723,7 @@ private lemma auxFunction1_tangent_x_A1_to_boundary · intro t ht exact le_trans hx.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo x c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo x c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos @@ -5011,12 +4740,10 @@ private lemma auxFunction1_tangent_x_A2_to_boundary (hx : 0 < x) (hy_pos : 0 < y) (hay : y < (a p) * x) : auxFunction1 p (y / a p) y ≤ auxFunction1 p x y + DxauxFunction1 p x y * (y / a p - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hcx : c < x := by have hmul : a p * c < a p * x := by simpa [hac] using hay nlinarith [hmul, ha_pos] @@ -5027,8 +4754,7 @@ private lemma auxFunction1_tangent_x_A2_to_boundary have hsum : 0 < (x + y) / 2 := by linarith have hdiff : 0 < (x - y) / 2 := by have hlt_one : a p < 1 := a_lt_one_of_two_le p hp' - have hax_lt_x : a p * x < x := by - simpa using mul_lt_mul_of_pos_right hlt_one hx + have hax_lt_x : a p * x < x := mul_lt_of_lt_one_left hx hlt_one linarith refine (hasDerivAt_vGeTwo_x_of_pos p hp' x y hsum hdiff).congr_deriv ?_ exact (auxFunction1_Dx_eq_DxvGeTwo p hp' x y hcl_x).symm @@ -5037,8 +4763,7 @@ private lemma auxFunction1_tangent_x_A2_to_boundary apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp') (lo := c) (hi := x) (x := x) (z := c) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht have hc_pos : 0 < c := div_pos hy_pos ha_pos have hyt : y < a p * t := by have hmul : a p * c < a p * t := @@ -5058,12 +4783,10 @@ private lemma auxFunction1_tangent_x_boundary_to_A1 auxFunction1 p z y ≤ auxFunction1 p (y / a p) y + DxauxFunction1 p (y / a p) y * (z - y / a p) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hzc : z < c := by have hmul : a p * z < a p * c := by simpa [hac] using hz_boundary nlinarith [hmul, ha_pos] @@ -5082,8 +4805,7 @@ private lemma auxFunction1_tangent_x_boundary_to_A1 · intro t ht exact le_trans hz_pos.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo z c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo z c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos @@ -5101,12 +4823,10 @@ private lemma auxFunction1_tangent_x_boundary_to_A2 auxFunction1 p z y ≤ auxFunction1 p (y / a p) y + DxauxFunction1 p (y / a p) y * (z - y / a p) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hcz : c < z := by have hmul : a p * c < a p * z := by simpa [hac] using hz_boundary nlinarith [hmul, ha_pos] @@ -5132,8 +4852,7 @@ private lemma auxFunction1_tangent_x_boundary_to_A2 apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp') (lo := c) (hi := z) (x := c) (z := z) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo c z := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c z := mem_Ioo_of_mem_interior_Icc ht have hyt : y < a p * t := by have hmul : a p * c < a p * t := mul_lt_mul_of_pos_left htIoo.1 ha_pos @@ -5152,7 +4871,7 @@ private lemma auxFunction1_tangent_x_on_QuarterPlaneOpen_segment (hz_pos : 0 < z) (hyz : y < z) (hneg_z : -z < y) : auxFunction1 p z y ≤ auxFunction1 p x y + DxauxFunction1 p x y * (z - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp by_cases hxA1 : (a p) * x < y · by_cases hzA1 : (a p) * z < y @@ -5225,14 +4944,12 @@ The most important pattern is: private lemma DxauxFunction1_internal_boundary_le_diag (p : ℝ) (hp : 2 < p) {y : ℝ} (hy : 0 < y) : DxauxFunction1 p (y / a p) y ≤ DxauxFunction1 p y y := by - have hp' : 2 ≤ p := by linarith - have hp1 : 1 < p := by linarith + have hp' : 2 ≤ p := le_of_lt hp + have hp1 : 1 < p := one_lt_of_two_le p (le_of_lt hp) have ha_pos : 0 < a p := a_pos_of_two_lt p hp have ha_lt : a p < 1 := a_lt_one_of_two_le p hp' let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hyc : y < c := by have hlt_inv : 1 < (a p)⁻¹ := by rw [one_lt_inv₀ ha_pos] @@ -5248,7 +4965,7 @@ private lemma DxauxFunction1_internal_boundary_le_diag AntitoneOn (fun t : ℝ => DxuA1Fun p (t, y)) (Set.Icc y c) := by have hcont : ContinuousOn (fun t : ℝ => DxuA1Fun p (t, y)) (Set.Icc y c) := by have hpair : ContinuousOn (fun t : ℝ => (t, y)) (Set.Icc y c) := - (by continuity : Continuous (fun t : ℝ => (t, y))).continuousOn + (continuous_id.prodMk continuous_const : Continuous (fun t : ℝ => (t, y))).continuousOn exact (continuousOn_DxuA1_closureA1 p hp1).comp hpair (by intro t ht have htc : t ≤ c := ht.2 @@ -5264,13 +4981,11 @@ private lemma DxauxFunction1_internal_boundary_le_diag (f' := fun t : ℝ => deriv (fun s => DxuA1Fun p (s, y)) t) (convex_Icc y c) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo y c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y c := mem_Ioo_of_mem_interior_Icc ht exact (differentiableAt_DxuA1Fun_x_of_pos p t y (lt_trans hy htIoo.1)).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo y c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos @@ -5289,13 +5004,11 @@ private lemma auxFunction1_tangent_x_diag_to_QuarterPlaneOpen_segment (hy : 0 < y) (hyz : y < z) : auxFunction1 p z y ≤ auxFunction1 p y y + DxauxFunction1 p y y * (z - y) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp have ha_lt : a p < 1 := a_lt_one_of_two_le p hp' let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hyc : y < c := by have hlt_inv : 1 < (a p)⁻¹ := by rw [one_lt_inv₀ ha_pos] @@ -5324,8 +5037,7 @@ private lemma auxFunction1_tangent_x_diag_to_QuarterPlaneOpen_segment · intro t ht exact le_trans hy.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo y z := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y z := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have htc : t < c := lt_of_lt_of_le htIoo.2 hzc have hmul : a p * t < a p * c := @@ -5345,13 +5057,8 @@ private lemma auxFunction1_tangent_x_diag_to_QuarterPlaneOpen_segment mul_lt_mul_of_pos_left hcz ha_pos exact le_of_lt (by simpa [hac] using hmul)⟩ have hderiv_c : - HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p c y) c := by - have hsum : 0 < (c + y) / 2 := by - have hc_pos : 0 < c := div_pos hy ha_pos - linarith - have hdiff : 0 < (c - y) / 2 := by linarith - refine (hasDerivAt_vGeTwo_x_of_pos p hp' c y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dx_eq_DxvGeTwo p hp' c y hboundary.2).symm + HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p c y) c := + hasDerivAt_vGeTwo_x_DxauxFunction1 p hp' (by linarith) (by linarith) hboundary.2 have h_yc_u : uA1 p c y ≤ uA1 p y y + DxauxFunction1 p y y * (c - y) := by apply uA1_tangent_x_on_Icc_of_A1 @@ -5359,8 +5066,7 @@ private lemma auxFunction1_tangent_x_diag_to_QuarterPlaneOpen_segment · intro t ht exact le_trans hy.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo y c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos @@ -5374,8 +5080,7 @@ private lemma auxFunction1_tangent_x_diag_to_QuarterPlaneOpen_segment apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp') (lo := c) (hi := z) (x := c) (z := z) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo c z := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c z := mem_Ioo_of_mem_interior_Icc ht have hc_pos : 0 < c := div_pos hy ha_pos have hyt : y < a p * t := by have hmul : a p * c < a p * t := @@ -5428,13 +5133,11 @@ private lemma auxFunction1_tangent_x_QuarterPlaneOpen_to_diag_segment (hy : 0 < y) (hyx : y < x) : auxFunction1 p y y ≤ auxFunction1 p x y + DxauxFunction1 p x y * (y - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp have ha_lt : a p < 1 := a_lt_one_of_two_le p hp' let c : ℝ := y / a p - have hac : a p * c = y := by - dsimp [c] - field_simp [ha_pos.ne'] + have hac : a p * c = y := mul_div_cancel₀ y ha_pos.ne' have hyc : y < c := by have hlt_inv : 1 < (a p)⁻¹ := by rw [one_lt_inv₀ ha_pos] @@ -5463,8 +5166,7 @@ private lemma auxFunction1_tangent_x_QuarterPlaneOpen_to_diag_segment · intro t ht exact le_trans hy.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo y x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y x := mem_Ioo_of_mem_interior_Icc ht have htc : t < c := lt_of_lt_of_le htIoo.2 hxc have h_at : a p * t < y := by have hmul : a p * t < a p * c := @@ -5484,11 +5186,8 @@ private lemma auxFunction1_tangent_x_QuarterPlaneOpen_to_diag_segment mul_lt_mul_of_pos_left hcx ha_pos exact le_of_lt (by simpa [hac] using hmul)⟩ have hderiv_x : - HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p x y) x := by - have hsum : 0 < (x + y) / 2 := by linarith - have hdiff : 0 < (x - y) / 2 := by linarith - refine (hasDerivAt_vGeTwo_x_of_pos p hp' x y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dx_eq_DxvGeTwo p hp' x y hcl_x).symm + HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p x y) x := + hasDerivAt_vGeTwo_x_DxauxFunction1 p hp' (by linarith) (by linarith) hcl_x have hderiv_c : HasDerivAt (fun t => uA1 p t y) (DxauxFunction1 p c y) c := by have hc_pos : 0 < c := div_pos hy ha_pos @@ -5499,8 +5198,7 @@ private lemma auxFunction1_tangent_x_QuarterPlaneOpen_to_diag_segment apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp') (lo := c) (hi := x) (x := x) (z := c) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht have hc_pos : 0 < c := div_pos hy ha_pos have hyt : y < a p * t := by have hmul : a p * c < a p * t := @@ -5518,8 +5216,7 @@ private lemma auxFunction1_tangent_x_QuarterPlaneOpen_to_diag_segment · intro t ht exact le_trans hy.le ht.1 · intro t ht - have htIoo : t ∈ Set.Ioo y c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos @@ -5577,12 +5274,8 @@ private lemma uCandidate_tangent_x_on_QuarterPlane2Open_segment uCandidate p x y + DxuCandidate p x y * (z - x) := by have hQx : QuarterPlane2 x y := ⟨le_of_lt hx_neg, le_of_lt hynegx, le_of_lt hxy⟩ have hQz : QuarterPlane2 z y := ⟨le_of_lt hz_neg, le_of_lt hynegz, le_of_lt hzy⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hx_neg hq.1 - have hnotQz : ¬ QuarterPlane z y := by - intro hq - exact not_le_of_gt hz_neg hq.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_neg hx_neg + have hnotQz : ¬ QuarterPlane z y := not_quarterPlane_of_neg hz_neg have haux := auxFunction1_tangent_x_on_QuarterPlaneOpen_segment p hp (by linarith : 0 < -x) @@ -5612,12 +5305,8 @@ private lemma uCandidate_tangent_y_on_QuarterPlane2Open_segment uCandidate p x y + DyuCandidate p x y * (z - y) := by have hQy : QuarterPlane2 x y := ⟨le_of_lt hx_neg, le_of_lt hynegx, le_of_lt hxy⟩ have hQz : QuarterPlane2 x z := ⟨le_of_lt hx_neg, le_of_lt hznegx, le_of_lt hxz⟩ - have hnotQy : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hx_neg hq.1 - have hnotQz : ¬ QuarterPlane x z := by - intro hq - exact not_le_of_gt hx_neg hq.1 + have hnotQy : ¬ QuarterPlane x y := not_quarterPlane_of_neg hx_neg + have hnotQz : ¬ QuarterPlane x z := not_quarterPlane_of_neg hx_neg have haux := auxFunction1_tangent_y_on_QuarterPlaneOpen_segment p (by linarith : 2 ≤ p) (by linarith : 0 < -x) @@ -5643,20 +5332,10 @@ private lemma uCandidate_tangent_x_on_QuarterPlane3Open_segment uCandidate p x y + DxuCandidate p x y * (z - x) := by have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hneg_x, le_of_lt hxy⟩ have hQz : QuarterPlane3 z y := ⟨hy_pos.le, le_of_lt hneg_z, le_of_lt hzy⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hnotQ2x : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 - have hnotQz : ¬ QuarterPlane z y := by - intro hq - exact not_le_of_gt hzy hq.2.1 - have hnotQ2z : ¬ QuarterPlane2 z y := by - intro hq - have hlt : -z < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hnotQ2x : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) + have hnotQz : ¬ QuarterPlane z y := not_quarterPlane_of_lt hzy + have hnotQ2z : ¬ QuarterPlane2 z y := not_quarterPlane2_of_lt (by linarith) have haux := auxFunction1_tangent_y_on_QuarterPlaneOpen_segment p (by linarith : 2 ≤ p) hy_pos hneg_x hxy hneg_z hzy @@ -5676,13 +5355,8 @@ private lemma uCandidate_tangent_x_QuarterPlane3Open_to_diag_segment uCandidate p x y + DxuCandidate p x y * (y - x) := by have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hneg_x, le_of_lt hxy⟩ have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hnotQ2x : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hnotQ2x : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) have haux := auxFunction1_tangent_y_to_diag_from_QuarterPlaneOpen_segment p (by linarith : 2 ≤ p) hy_pos hneg_x hxy have hdx : DxuCandidate p x y = DyauxFunction1 p y x := by @@ -5699,14 +5373,12 @@ private lemma auxFunction1_tangent_y_diag_to_QuarterPlaneOpen_segment (hx : 0 < x) (hz_lower : -x ≤ z) (hz_upper : z < x) : auxFunction1 p x z ≤ auxFunction1 p x x + DyauxFunction1 p x x * (z - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp' - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp') have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] have hdiag : closureA1 p x x := ⟨hx.le, le_of_lt hc_lt_x, le_rfl⟩ have hcl_c_A1 : closureA1 p x c := ⟨hx.le, le_rfl, le_of_lt hc_lt_x⟩ have hcl_c_A2 : closureA2 p x c := ⟨hx.le, le_of_lt hneg_c, le_rfl⟩ @@ -5722,8 +5394,7 @@ private lemma auxFunction1_tangent_y_diag_to_QuarterPlaneOpen_segment (p := p) (hp := hp') (lo := z) (hi := x) (x := x) (y := x) (z := z) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo z x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo z x := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, lt_of_le_of_lt hcz htIoo.1, htIoo.2⟩ · exact ⟨hz_upper.le, le_rfl⟩ · exact ⟨le_rfl, hz_upper.le⟩ @@ -5733,19 +5404,15 @@ private lemma auxFunction1_tangent_y_diag_to_QuarterPlaneOpen_segment · have hzc : z < c := lt_of_not_ge hcz have hcl_z : closureA2 p x z := ⟨hx.le, hz_lower, le_of_lt hzc⟩ have hderiv_c : - HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x c) c := by - have hsum : 0 < (x + c) / 2 := by linarith [hneg_c] - have hdiff : 0 < (x - c) / 2 := by linarith [hc_lt_x] - refine (hasDerivAt_vGeTwo_y_of_pos p hp' x c hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dy_eq_DyvGeTwo p hp' x c hcl_c_A2).symm + HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x c) c := + hasDerivAt_vGeTwo_y_DyauxFunction1 p hp' (by linarith) (by linarith) hcl_c_A2 have h_xc_u : uA1 p x c ≤ uA1 p x x + DyauxFunction1 p x x * (c - x) := by apply uA1_tangent_y_on_Icc_of_A1 (p := p) (hp := hp') (lo := c) (hi := x) (x := x) (y := x) (z := c) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, htIoo.2⟩ · exact ⟨hc_lt_x.le, le_rfl⟩ · exact ⟨le_rfl, hc_lt_x.le⟩ @@ -5755,8 +5422,7 @@ private lemma auxFunction1_tangent_y_diag_to_QuarterPlaneOpen_segment apply vGeTwo_tangent_y_on_Icc_of_A2 (p := p) (hp := hp') (lo := z) (hi := c) (x := x) (y := c) (z := z) · intro t ht - have htIoo : t ∈ Set.Ioo z c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo z c := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, by linarith [htIoo.1], htIoo.2⟩ · exact ⟨le_of_lt hzc, le_rfl⟩ · exact ⟨le_rfl, le_of_lt hzc⟩ @@ -5784,13 +5450,8 @@ private lemma uCandidate_tangent_x_diag_to_QuarterPlane3Open_segment uCandidate p y y + DxuCandidate p y y * (z - y) := by have hQd : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ have hQz : QuarterPlane3 z y := ⟨hy_pos.le, le_of_lt hz_lower, le_of_lt hz_upper⟩ - have hnotQz : ¬ QuarterPlane z y := by - intro hq - exact not_le_of_gt hz_upper hq.2.1 - have hnotQ2z : ¬ QuarterPlane2 z y := by - intro hq - have hlt : -z < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hnotQz : ¬ QuarterPlane z y := not_quarterPlane_of_lt hz_upper + have hnotQ2z : ¬ QuarterPlane2 z y := not_quarterPlane2_of_lt (by linarith) have haux := auxFunction1_tangent_y_diag_to_QuarterPlaneOpen_segment p hp hy_pos hz_lower.le hz_upper have hdx : DxuCandidate p y y = DyauxFunction1 p y y := by @@ -5848,7 +5509,7 @@ private lemma DxuCandidate_QuarterPlaneOpen_le_diag AntitoneOn (fun t : ℝ => DxuA1Fun p (t, y)) (Set.Icc y x) := by have hcont : ContinuousOn (fun t : ℝ => DxuA1Fun p (t, y)) (Set.Icc y x) := by have hpair : ContinuousOn (fun t : ℝ => (t, y)) (Set.Icc y x) := - (by continuity : Continuous (fun t : ℝ => (t, y))).continuousOn + (continuous_id.prodMk continuous_const : Continuous (fun t : ℝ => (t, y))).continuousOn exact (continuousOn_DxuA1_closureA1 p (by linarith : 1 < p)).comp hpair (by intro t ht have htc : t ≤ c := le_trans ht.2 hxc @@ -5863,13 +5524,11 @@ private lemma DxuCandidate_QuarterPlaneOpen_le_diag (f' := fun t : ℝ => deriv (fun s => DxuA1Fun p (s, y)) t) (convex_Icc y x) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo y x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y x := mem_Ioo_of_mem_interior_Icc ht exact (differentiableAt_DxuA1Fun_x_of_pos p t y (lt_trans hy_pos htIoo.1)).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo y x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo y x := mem_Ioo_of_mem_interior_Icc ht have htc : t < c := lt_of_lt_of_le htIoo.2 hxc have h_at : a p * t < y := by have hmul : a p * t < a p * c := @@ -5918,13 +5577,8 @@ private lemma DxuCandidate_diag_le_QuarterPlane3Open DxuCandidate p y y ≤ DxuCandidate p x y := by have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hneg_x, le_of_lt hxy⟩ have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hnotQ2x : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hnotQ2x : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) have hdiag : DxuCandidate p y y = DyauxFunction1 p y y := by have h := DxauxFunction1_eq_DyauxFunction1_on_diag p hp y hy_pos.le @@ -5970,18 +5624,14 @@ private lemma auxFunction1_tangent_x_to_antidiag_from_QuarterPlaneOpen_segment have hnonneg : 0 ≤ a p * (-y) := mul_nonneg ha_nonneg (neg_nonneg.mpr hy_neg.le) linarith have hderiv_x : - HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p x y) x := by - have hsum : 0 < (x + y) / 2 := by linarith - have hdiff : 0 < (x - y) / 2 := by linarith - refine (hasDerivAt_vGeTwo_x_of_pos p hp x y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dx_eq_DxvGeTwo p hp x y hcl_x).symm + HasDerivAt (fun t => vGeTwo p t y) (DxauxFunction1 p x y) x := + hasDerivAt_vGeTwo_x_DxauxFunction1 p hp (by linarith) (by linarith) hcl_x have h_v : vGeTwo p (-y) y ≤ vGeTwo p x y + DxauxFunction1 p x y * ((-y) - x) := by apply vGeTwo_tangent_x_on_Icc_of_A2 (p := p) (hp := hp) (lo := -y) (hi := x) (x := x) (z := -y) (y := y) · intro t ht - have htIoo : t ∈ Set.Ioo (-y) x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-y) x := mem_Ioo_of_mem_interior_Icc ht have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp have ht_pos : 0 < t := lt_trans (neg_pos.mpr hy_neg) htIoo.1 exact ⟨ht_pos, by linarith [htIoo.1], lt_of_lt_of_le hy_neg @@ -6009,7 +5659,7 @@ private lemma DxauxFunction1_QuarterPlaneOpen_le_antidiag AntitoneOn (fun t : ℝ => DxvGeTwo p t y) (Set.Icc (-y) x) := by have hcont : ContinuousOn (fun t : ℝ => DxvGeTwo p t y) (Set.Icc (-y) x) := by have hpair : ContinuousOn (fun t : ℝ => (t, y)) (Set.Icc (-y) x) := - (by continuity : Continuous (fun t : ℝ => (t, y))).continuousOn + (continuous_id.prodMk continuous_const : Continuous (fun t : ℝ => (t, y))).continuousOn exact (continuousOn_DxvGeTwo_closureA2 p hp).comp hpair (by intro t ht have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp @@ -6022,14 +5672,12 @@ private lemma DxauxFunction1_QuarterPlaneOpen_le_antidiag (f' := fun t : ℝ => deriv (fun s => DxvGeTwo p s y) t) (convex_Icc (-y) x) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo (-y) x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-y) x := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (t + y) / 2 := by linarith [htIoo.1] have hdiff : 0 < (t - y) / 2 := by linarith [hy_neg, htIoo.1] exact (differentiableAt_DxvGeTwo_x_of_pos p t y hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo (-y) x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-y) x := mem_Ioo_of_mem_interior_Icc ht have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp have ht_pos : 0 < t := lt_trans (neg_pos.mpr hy_neg) htIoo.1 exact deriv_DxvGeTwo_x_nonpos_on_A2 p hp t y @@ -6051,12 +5699,8 @@ private lemma uCandidate_tangent_x_QuarterPlane2Open_to_antidiag_segment have hQx : QuarterPlane2 x y := ⟨le_of_lt hx_neg, le_of_lt (by linarith : y < -x), le_of_lt (by linarith : x < y)⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hx_neg hq.1 - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_neg hx_neg + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) have haux := auxFunction1_tangent_x_to_antidiag_from_QuarterPlaneOpen_segment p (by linarith : 2 ≤ p) (by linarith : 0 < -x) @@ -6077,14 +5721,12 @@ private lemma uCandidate_tangent_x_QuarterPlane2Open_to_antidiag_segment private lemma DyauxFunction1_internal_boundary_le_antidiag (p : ℝ) (hp : 2 < p) {x : ℝ} (hx : 0 < x) : DyauxFunction1 p x ((a p) * x) ≤ DyauxFunction1 p x (-x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp' - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp') have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] have hcl_a : closureA2 p x (-x) := by refine ⟨hx.le, le_rfl, ?_⟩ have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' @@ -6094,7 +5736,7 @@ private lemma DyauxFunction1_internal_boundary_le_antidiag AntitoneOn (fun t : ℝ => DyvGeTwo p x t) (Set.Icc (-x) c) := by have hcont : ContinuousOn (fun t : ℝ => DyvGeTwo p x t) (Set.Icc (-x) c) := by have hpair : ContinuousOn (fun t : ℝ => (x, t)) (Set.Icc (-x) c) := - (by continuity : Continuous (fun t : ℝ => (x, t))).continuousOn + (continuous_const.prodMk continuous_id : Continuous (fun t : ℝ => (x, t))).continuousOn exact (continuousOn_DyvGeTwo_closureA2 p hp').comp hpair (by intro t ht exact ⟨hx.le, ht.1, ht.2⟩) @@ -6104,14 +5746,12 @@ private lemma DyauxFunction1_internal_boundary_le_antidiag (f' := fun t : ℝ => deriv (fun s => DyvGeTwo p x s) t) (convex_Icc (-x) c) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo (-x) c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) c := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (x + t) / 2 := by linarith [htIoo.1] have hdiff : 0 < (x - t) / 2 := by linarith [htIoo.2, hc_lt_x] exact (differentiableAt_DyvGeTwo_y_of_pos p x t hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo (-x) c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) c := mem_Ioo_of_mem_interior_Icc ht exact deriv_DyvGeTwo_y_nonpos_on_A2 p hp' x t ⟨hx, htIoo.1, htIoo.2⟩ have ha_mem : (-x) ∈ Set.Icc (-x) c := ⟨le_rfl, le_of_lt hneg_c⟩ have hc_mem : c ∈ Set.Icc (-x) c := ⟨le_of_lt hneg_c, le_rfl⟩ @@ -6125,14 +5765,12 @@ private lemma auxFunction1_tangent_y_antidiag_to_QuarterPlaneOpen_segment (hx : 0 < x) (hz_lower : -x < z) (hz_upper : z ≤ x) : auxFunction1 p x z ≤ auxFunction1 p x (-x) + DyauxFunction1 p x (-x) * (z - (-x)) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp' - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp') have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] have hcl_a_A2 : closureA2 p x (-x) := by refine ⟨hx.le, le_rfl, ?_⟩ have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' @@ -6150,8 +5788,7 @@ private lemma auxFunction1_tangent_y_antidiag_to_QuarterPlaneOpen_segment apply vGeTwo_tangent_y_on_Icc_of_A2 (p := p) (hp := hp') (lo := -x) (hi := z) (x := x) (y := -x) (z := z) · intro t ht - have htIoo : t ∈ Set.Ioo (-x) z := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) z := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, lt_of_lt_of_le htIoo.2 hzc⟩ · exact ⟨le_rfl, hz_lower.le⟩ · exact ⟨hz_lower.le, le_rfl⟩ @@ -6169,8 +5806,7 @@ private lemma auxFunction1_tangent_y_antidiag_to_QuarterPlaneOpen_segment apply vGeTwo_tangent_y_on_Icc_of_A2 (p := p) (hp := hp') (lo := -x) (hi := c) (x := x) (y := -x) (z := c) · intro t ht - have htIoo : t ∈ Set.Ioo (-x) c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) c := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, htIoo.2⟩ · exact ⟨le_rfl, le_of_lt hneg_c⟩ · exact ⟨le_of_lt hneg_c, le_rfl⟩ @@ -6181,8 +5817,7 @@ private lemma auxFunction1_tangent_y_antidiag_to_QuarterPlaneOpen_segment (p := p) (hp := hp') (lo := c) (hi := z) (x := x) (y := c) (z := z) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo c z := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c z := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, lt_of_lt_of_le htIoo.2 hz_upper⟩ · exact ⟨le_rfl, hcz.le⟩ · exact ⟨hcz.le, le_rfl⟩ @@ -6215,14 +5850,12 @@ private lemma auxFunction1_tangent_y_QuarterPlaneOpen_to_antidiag_segment (hx : 0 < x) (hy_lower : -x < y) (hy_upper : y < x) : auxFunction1 p x (-x) ≤ auxFunction1 p x y + DyauxFunction1 p x y * ((-x) - y) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp' - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp') have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] have hcl_a_A2 : closureA2 p x (-x) := by refine ⟨hx.le, le_rfl, ?_⟩ have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' @@ -6232,11 +5865,8 @@ private lemma auxFunction1_tangent_y_QuarterPlaneOpen_to_antidiag_segment by_cases hyc : y ≤ c · have hcl_y : closureA2 p x y := ⟨hx.le, le_of_lt hy_lower, hyc⟩ have hderiv_y : - HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x y) y := by - have hsum : 0 < (x + y) / 2 := by linarith - have hdiff : 0 < (x - y) / 2 := by linarith - refine (hasDerivAt_vGeTwo_y_of_pos p hp' x y hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dy_eq_DyvGeTwo p hp' x y hcl_y).symm + HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x y) y := + hasDerivAt_vGeTwo_y_DyauxFunction1 p hp' (by linarith) (by linarith) hcl_y have h_v : vGeTwo p x (-x) ≤ vGeTwo p x y + DyauxFunction1 p x y * ((-x) - y) := by @@ -6244,8 +5874,7 @@ private lemma auxFunction1_tangent_y_QuarterPlaneOpen_to_antidiag_segment (p := p) (hp := hp') (lo := -x) (hi := y) (x := x) (y := y) (z := -x) · intro t ht - have htIoo : t ∈ Set.Ioo (-x) y := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) y := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, lt_of_lt_of_le htIoo.2 hyc⟩ · exact ⟨hy_lower.le, le_rfl⟩ · exact ⟨le_rfl, hy_lower.le⟩ @@ -6259,11 +5888,8 @@ private lemma auxFunction1_tangent_y_QuarterPlaneOpen_to_antidiag_segment refine (hasDerivAt_uA1_y_of_pos p hp' x y hx).congr_deriv ?_ exact (auxFunction1_Dy_eq_DyuA1 p x y hcl_y).symm have hderiv_c : - HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x c) c := by - have hsum : 0 < (x + c) / 2 := by linarith [hneg_c] - have hdiff : 0 < (x - c) / 2 := by linarith [hc_lt_x] - refine (hasDerivAt_vGeTwo_y_of_pos p hp' x c hsum hdiff).congr_deriv ?_ - exact (auxFunction1_Dy_eq_DyvGeTwo p hp' x c hcl_c_A2).symm + HasDerivAt (fun t => vGeTwo p x t) (DyauxFunction1 p x c) c := + hasDerivAt_vGeTwo_y_DyauxFunction1 p hp' (by linarith) (by linarith) hcl_c_A2 have h_yc_u : uA1 p x c ≤ uA1 p x y + DyauxFunction1 p x y * (c - y) := by apply uA1_tangent_y_on_Icc_of_A1 @@ -6271,8 +5897,7 @@ private lemma auxFunction1_tangent_y_QuarterPlaneOpen_to_antidiag_segment (x := x) (y := y) (z := c) · exact hx · intro t ht - have htIoo : t ∈ Set.Ioo c y := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c y := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, lt_trans htIoo.2 hy_upper⟩ · exact ⟨hcy.le, le_rfl⟩ · exact ⟨le_rfl, hcy.le⟩ @@ -6284,8 +5909,7 @@ private lemma auxFunction1_tangent_y_QuarterPlaneOpen_to_antidiag_segment (p := p) (hp := hp') (lo := -x) (hi := c) (x := x) (y := c) (z := -x) · intro t ht - have htIoo : t ∈ Set.Ioo (-x) c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) c := mem_Ioo_of_mem_interior_Icc ht exact ⟨hx, htIoo.1, htIoo.2⟩ · exact ⟨le_of_lt hneg_c, le_rfl⟩ · exact ⟨le_rfl, le_of_lt hneg_c⟩ @@ -6315,16 +5939,9 @@ private lemma uCandidate_tangent_x_antidiag_to_QuarterPlane3Open_segment uCandidate p (-y) y + DxuCandidate p (-y) y * (z - (-y)) := by have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ have hQz : QuarterPlane3 z y := ⟨hy_pos.le, le_of_lt hz_lower, le_of_lt hz_upper⟩ - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 - have hnotQz : ¬ QuarterPlane z y := by - intro hq - exact not_le_of_gt hz_upper hq.2.1 - have hnotQ2z : ¬ QuarterPlane2 z y := by - intro hq - have hlt : -z < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) + have hnotQz : ¬ QuarterPlane z y := not_quarterPlane_of_lt hz_upper + have hnotQ2z : ¬ QuarterPlane2 z y := not_quarterPlane2_of_lt (by linarith) have haux := auxFunction1_tangent_y_antidiag_to_QuarterPlaneOpen_segment p hp hy_pos hz_lower hz_upper.le have hdx : DxuCandidate p (-y) y = DyauxFunction1 p y (-y) := by @@ -6350,16 +5967,9 @@ private lemma uCandidate_tangent_x_QuarterPlane3Open_to_antidiag_segment uCandidate p x y + DxuCandidate p x y * ((-y) - x) := by have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hneg_x, le_of_lt hxy⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hnotQ2x : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hnotQ2x : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) have haux := auxFunction1_tangent_y_QuarterPlaneOpen_to_antidiag_segment p hp hy_pos hneg_x hxy have hdx : DxuCandidate p x y = DyauxFunction1 p y x := by @@ -6383,7 +5993,7 @@ private lemma auxFunction1_tangent_x_antidiag_to_right_segment (hx : 0 < x) (hxz : x < z) : auxFunction1 p z (-x) ≤ auxFunction1 p x (-x) + DxauxFunction1 p x (-x) * (z - x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' have hcl_x : closureA2 p x (-x) := by refine ⟨hx.le, le_rfl, ?_⟩ @@ -6404,8 +6014,7 @@ private lemma auxFunction1_tangent_x_antidiag_to_right_segment (p := p) (hp := hp') (lo := x) (hi := z) (x := x) (z := z) (y := -x) · intro t ht - have htIoo : t ∈ Set.Ioo x z := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo x z := mem_Ioo_of_mem_interior_Icc ht have ht_pos : 0 < t := lt_trans hx htIoo.1 refine ⟨ht_pos, by linarith [htIoo.1], ?_⟩ exact lt_of_lt_of_le (by linarith : -x < 0) @@ -6432,12 +6041,8 @@ private lemma uCandidate_tangent_x_antidiag_to_QuarterPlane2Open_segment have hQz : QuarterPlane2 z y := ⟨le_of_lt hz_neg, le_of_lt (by linarith : y < -z), le_of_lt (by linarith : z < y)⟩ - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 - have hnotQz : ¬ QuarterPlane z y := by - intro hq - exact not_le_of_gt hz_neg hq.1 + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) + have hnotQz : ¬ QuarterPlane z y := not_quarterPlane_of_neg hz_neg have haux := auxFunction1_tangent_x_antidiag_to_right_segment p hp hy_pos (by linarith : y < -z) have hdx : DxuCandidate p (-y) y = -DxauxFunction1 p y (-y) := by @@ -6461,14 +6066,12 @@ private lemma DyauxFunction1_QuarterPlaneOpen_le_antidiag (p : ℝ) (hp : 2 < p) {x y : ℝ} (hx : 0 < x) (hy_lower : -x < y) (hy_upper : y < x) : DyauxFunction1 p x y ≤ DyauxFunction1 p x (-x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let c : ℝ := (a p) * x - have hc_lt_x : c < x := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp' - simpa [c] using mul_lt_mul_of_pos_right hlt hx + have hc_lt_x : c < x := mul_lt_of_lt_one_left hx (a_lt_one_of_two_le p hp') have hneg_c : -x < c := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' - nlinarith [mul_nonneg ha_nonneg hx.le] + linarith [mul_nonneg ha_nonneg hx.le] by_cases hyc : y ≤ c · have hcl_y : closureA2 p x y := ⟨hx.le, le_of_lt hy_lower, hyc⟩ have hcl_a : closureA2 p x (-x) := by @@ -6479,7 +6082,7 @@ private lemma DyauxFunction1_QuarterPlaneOpen_le_antidiag AntitoneOn (fun t : ℝ => DyvGeTwo p x t) (Set.Icc (-x) y) := by have hcont : ContinuousOn (fun t : ℝ => DyvGeTwo p x t) (Set.Icc (-x) y) := by have hpair : ContinuousOn (fun t : ℝ => (x, t)) (Set.Icc (-x) y) := - (by continuity : Continuous (fun t : ℝ => (x, t))).continuousOn + (continuous_const.prodMk continuous_id : Continuous (fun t : ℝ => (x, t))).continuousOn exact (continuousOn_DyvGeTwo_closureA2 p hp').comp hpair (by intro t ht exact ⟨hx.le, ht.1, le_trans ht.2 hyc⟩) @@ -6489,14 +6092,12 @@ private lemma DyauxFunction1_QuarterPlaneOpen_le_antidiag (f' := fun t : ℝ => deriv (fun s => DyvGeTwo p x s) t) (convex_Icc (-x) y) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo (-x) y := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) y := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (x + t) / 2 := by linarith [htIoo.1] have hdiff : 0 < (x - t) / 2 := by linarith [htIoo.2, hy_upper] exact (differentiableAt_DyvGeTwo_y_of_pos p x t hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo (-x) y := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo (-x) y := mem_Ioo_of_mem_interior_Icc ht exact deriv_DyvGeTwo_y_nonpos_on_A2 p hp' x t ⟨hx, htIoo.1, lt_of_lt_of_le htIoo.2 hyc⟩ have ha_mem : (-x) ∈ Set.Icc (-x) y := ⟨le_rfl, hy_lower.le⟩ @@ -6523,16 +6124,9 @@ private lemma DxuCandidate_QuarterPlane3Open_le_antidiag DxuCandidate p x y ≤ DxuCandidate p (-y) y := by have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hneg_x, le_of_lt hxy⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hnotQ2x : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hnotQ2x : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) have hstart : DxuCandidate p x y = DyauxFunction1 p y x := by simp [DxuCandidate, hnotQx, hnotQ2x, hQx] have hbreak : DxuCandidate p (-y) y = DyauxFunction1 p y (-y) := by @@ -6564,9 +6158,7 @@ private lemma uCandidate_tangent_x_antidiag_to_diag_segment uCandidate p (-y) y + DxuCandidate p (-y) y * (y - (-y)) := by have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ have hQd : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) have haux := auxFunction1_tangent_y_antidiag_to_QuarterPlaneOpen_segment p hp hy_pos (by linarith : -y < y) le_rfl have hdx : DxuCandidate p (-y) y = DyauxFunction1 p y (-y) := by @@ -6582,18 +6174,14 @@ private lemma uCandidate_tangent_x_antidiag_to_diag_segment private lemma DxuCandidate_diag_le_antidiag_pos (p : ℝ) (hp : 2 < p) {y : ℝ} (hy_pos : 0 < y) : DxuCandidate p y y ≤ DxuCandidate p (-y) y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp let c : ℝ := (a p) * y - have hc_lt_y : c < y := by - have hlt : a p < 1 := a_lt_one_of_two_le p hp' - simpa [c] using mul_lt_mul_of_pos_right hlt hy_pos + have hc_lt_y : c < y := mul_lt_of_lt_one_left hy_pos (a_lt_one_of_two_le p hp') have hdiag : closureA1 p y y := ⟨hy_pos.le, le_of_lt hc_lt_y, le_rfl⟩ have hcl_c_A1 : closureA1 p y c := ⟨hy_pos.le, le_rfl, le_of_lt hc_lt_y⟩ have hQd : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) have hdiag_eq : DxuCandidate p y y = DyauxFunction1 p y y := by have h := DxauxFunction1_eq_DyauxFunction1_on_diag p hp y hy_pos.le simp [DxuCandidate, hQd, h] @@ -6624,9 +6212,7 @@ private lemma uCandidate_tangent_x_diag_to_antidiag_segment uCandidate p y y + DxuCandidate p y y * ((-y) - y) := by have hQd : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) have haux := auxFunction1_tangent_y_diag_to_QuarterPlaneOpen_segment p hp hy_pos le_rfl (by linarith : -y < y) have hdx : DxuCandidate p y y = DyauxFunction1 p y y := by @@ -6726,12 +6312,8 @@ private lemma DxuCandidate_antidiag_le_QuarterPlane2Open have hQx : QuarterPlane2 x y := ⟨le_of_lt hx_neg, le_of_lt (by linarith : y < -x), le_of_lt (by linarith : x < y)⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hnotQx : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hx_neg hq.1 - have hnotQa : ¬ QuarterPlane (-y) y := by - intro hq - exact not_le_of_gt (by linarith : -y < 0) hq.1 + have hnotQx : ¬ QuarterPlane x y := not_quarterPlane_of_neg hx_neg + have hnotQa : ¬ QuarterPlane (-y) y := not_quarterPlane_of_neg (by linarith : -y < 0) have hle : DxauxFunction1 p (-x) (-y) ≤ DxauxFunction1 p y (-y) := by simpa using DxauxFunction1_QuarterPlaneOpen_le_antidiag @@ -7208,7 +6790,7 @@ private lemma uCandidate_tangent_x_increment_of_y_zero (p : ℝ) (hp : 2 < p) {x h : ℝ} : uCandidate p (x + h) 0 ≤ uCandidate p x 0 + DxuCandidate p x 0 * h := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have hcontU : Continuous (fun z : ℝ × ℝ => uCandidate p z.1 z.2) := continuousOn_univ.mp (continuousuCandidate p hp') have hcontDx : Continuous (fun z : ℝ × ℝ => DxuCandidate p z.1 z.2) := @@ -7216,7 +6798,7 @@ private lemma uCandidate_tangent_x_increment_of_y_zero have htend_lhs : Filter.Tendsto (fun yy : ℝ => uCandidate p (x + h) yy) (nhdsWithin 0 (Set.Ioi 0)) (nhds (uCandidate p (x + h) 0)) := by - have hline : Continuous (fun yy : ℝ => ((x + h), yy)) := by continuity + have hline : Continuous (fun yy : ℝ => ((x + h), yy)) := continuous_const.prodMk continuous_id have hcomp : Continuous (fun yy : ℝ => uCandidate p (x + h) yy) := by simpa [Function.comp_def] using hcontU.comp hline exact (hcomp.tendsto 0).mono_left nhdsWithin_le_nhds @@ -7225,7 +6807,7 @@ private lemma uCandidate_tangent_x_increment_of_y_zero (fun yy : ℝ => uCandidate p x yy + DxuCandidate p x yy * h) (nhdsWithin 0 (Set.Ioi 0)) (nhds (uCandidate p x 0 + DxuCandidate p x 0 * h)) := by - have hline : Continuous (fun yy : ℝ => (x, yy)) := by continuity + have hline : Continuous (fun yy : ℝ => (x, yy)) := continuous_const.prodMk continuous_id have hUx : Continuous (fun yy : ℝ => uCandidate p x yy) := by simpa [Function.comp_def] using hcontU.comp hline have hDxx : Continuous (fun yy : ℝ => DxuCandidate p x yy) := by @@ -7760,7 +7342,7 @@ private lemma abs_vGeTwo_le_growth_on_closureA2 _ ≤ (x + x) / 2 := by gcongr _ = x := by ring - have hp_nonneg : 0 ≤ p := by linarith + have hp_nonneg : 0 ≤ p := p_nonneg_of_two_le p hp have hsum_pow : Real.rpow |(x + y) / 2| p ≤ Real.rpow x p := Real.rpow_le_rpow (abs_nonneg _) hsum hp_nonneg @@ -8042,7 +7624,7 @@ private lemma abs_DxvGeTwo_le_growth_on_closureA2 closureA2_abs_add_div_two_le_x p hp ⟨hx, hlow, hup⟩ have hdiff : |(x - y) / 2| ≤ x := closureA2_abs_sub_div_two_le_x p hp ⟨hx, hlow, hup⟩ - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hsum_pow : Real.rpow |(x + y) / 2| (p - 1) ≤ Real.rpow x (p - 1) := Real.rpow_le_rpow (abs_nonneg _) hsum hp1_nonneg @@ -8129,7 +7711,7 @@ private lemma abs_DyvGeTwo_le_growth_on_closureA2 closureA2_abs_add_div_two_le_x p hp ⟨hx, hlow, hup⟩ have hdiff : |(x - y) / 2| ≤ x := closureA2_abs_sub_div_two_le_x p hp ⟨hx, hlow, hup⟩ - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hsum_pow : Real.rpow |(x + y) / 2| (p - 1) ≤ Real.rpow x (p - 1) := Real.rpow_le_rpow (abs_nonneg _) hsum hp1_nonneg @@ -8448,20 +8030,10 @@ private lemma uCandidate_tangent_y_on_QuarterPlane3Open_segment uCandidate p x y + DyuCandidate p x y * (z - y) := by have hQy : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hneg_x, le_of_lt hxy⟩ have hQz : QuarterPlane3 x z := ⟨hz_pos.le, le_of_lt hneg_z, le_of_lt hxz⟩ - have hnotQy : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hnotQ2y : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 - have hnotQz : ¬ QuarterPlane x z := by - intro hq - exact not_le_of_gt hxz hq.2.1 - have hnotQ2z : ¬ QuarterPlane2 x z := by - intro hq - have hlt : -x < z := by linarith - exact not_le_of_gt hlt hq.2.1 + have hnotQy : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hnotQ2y : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) + have hnotQz : ¬ QuarterPlane x z := not_quarterPlane_of_lt hxz + have hnotQ2z : ¬ QuarterPlane2 x z := not_quarterPlane2_of_lt (by linarith) have haux := auxFunction1_tangent_x_on_QuarterPlaneOpen_segment p hp hy_pos hxy hneg_x @@ -8627,7 +8199,7 @@ private lemma deriv_auxFunction1_eq_DyauxFunction1_on_QuarterPlaneOpen (p : ℝ) (x y : ℝ) (hQ : QuarterPlaneOpen x y) : deriv (fun s => auxFunction1 p x s) y = DyauxFunction1 p x y := by rcases hQ with ⟨hx, hyx, hneg⟩ - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp by_cases h1 : a p * x < y · exact deriv_auxFunction1_eq_DyauxFunction1_on_A1 p hp x y ⟨hx, h1, hyx⟩ · by_cases h2 : y < a p * x @@ -8640,7 +8212,7 @@ private lemma hasDerivAt_auxFunction1_y_on_QuarterPlaneOpen (p : ℝ) (hp : 2 < (x y : ℝ) (hQ : QuarterPlaneOpen x y) : HasDerivAt (fun s => auxFunction1 p x s) (DyauxFunction1 p x y) y := by rcases hQ with ⟨hx, hyx, hneg⟩ - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp by_cases h1 : a p * x < y · have hEq : (fun s => auxFunction1 p x s) =ᶠ[nhds y] fun s => uA1 p x s := by have hA : {s : ℝ | a p * x < s} ∈ nhds y := Ioi_mem_nhds h1 @@ -8721,9 +8293,7 @@ private lemma hasDerivAt_uCandidate_x_on_QuarterPlane2Open (p : ℝ) (hp : 2 ≤ simpa [Set.preimage, sub_pos] using hcont.preimage_mem_nhds (Ioi_mem_nhds hpos) have hXY : {t : ℝ | t < y} ∈ nhds x := Iio_mem_nhds hxy filter_upwards [hX, hY, hXY] with t htX htY htXY - have hq1 : ¬ QuarterPlane t y := by - intro hq - exact not_le_of_gt htX hq.1 + have hq1 : ¬ QuarterPlane t y := not_quarterPlane_of_neg htX have hq2 : QuarterPlane2 t y := ⟨le_of_lt htX, le_of_lt htY, le_of_lt htXY⟩ simp [uCandidate, hq1, hq2] have haux : @@ -8751,26 +8321,16 @@ private lemma hasDerivAt_uCandidate_x_on_QuarterPlane3Open (p : ℝ) (hp : 2 < p have hN : {t : ℝ | -y < t} ∈ nhds x := Ioi_mem_nhds hneg have hY : {t : ℝ | t < y} ∈ nhds x := Iio_mem_nhds hxy filter_upwards [hN, hY] with t htN htY - have hq1 : ¬ QuarterPlane t y := by - intro hq - exact not_le_of_gt htY hq.2.1 - have hq2 : ¬ QuarterPlane2 t y := by - intro hq - have hlt : -t < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hq1 : ¬ QuarterPlane t y := not_quarterPlane_of_lt htY + have hq2 : ¬ QuarterPlane2 t y := not_quarterPlane2_of_lt (by linarith) have hq3 : QuarterPlane3 t y := ⟨hy.le, le_of_lt htN, le_of_lt htY⟩ simp [uCandidate, hq1, hq2, hq3] have hbase : HasDerivAt (fun t => auxFunction1 p y t) (DyauxFunction1 p y x) x := hasDerivAt_auxFunction1_y_on_QuarterPlaneOpen p hp y x hQaux refine (hbase.congr_of_eventuallyEq hEq).congr_deriv ?_ - have hq1 : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hq2 : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hq1 : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hq2 : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) have hq3 : QuarterPlane3 x y := ⟨hy.le, hneg.le, hxy.le⟩ simp [DxuCandidate, hq1, hq2, hq3] @@ -8789,9 +8349,7 @@ private lemma hasDerivAt_uCandidate_x_on_QuarterPlane4Open (p : ℝ) (hp : 2 < p intro hq have hlt : y < -t := by linarith exact not_le_of_gt hlt hq.2.2 - have hq2 : ¬ QuarterPlane2 t y := by - intro hq - exact not_le_of_gt htY hq.2.2 + have hq2 : ¬ QuarterPlane2 t y := not_quarterPlane2_of_gt htY have hq3 : ¬ QuarterPlane3 t y := by intro hq exact not_le_of_gt hy hq.1 @@ -8813,9 +8371,7 @@ private lemma hasDerivAt_uCandidate_x_on_QuarterPlane4Open (p : ℝ) (hp : 2 < p intro hq have hlt : y < -x := by linarith exact not_le_of_gt hlt hq.2.2 - have hq2 : ¬ QuarterPlane2 x y := by - intro hq - exact not_le_of_gt hyx hq.2.2 + have hq2 : ¬ QuarterPlane2 x y := not_quarterPlane2_of_gt hyx have hq3 : ¬ QuarterPlane3 x y := by intro hq exact not_le_of_gt hy hq.1 @@ -8833,9 +8389,7 @@ private lemma hasDerivAt_uCandidate_y_on_QuarterPlane2Open (p : ℝ) (hp : 2 < p have hY : {s : ℝ | s < -x} ∈ nhds y := Iio_mem_nhds hynegx have hX : {s : ℝ | x < s} ∈ nhds y := Ioi_mem_nhds hxy filter_upwards [hY, hX] with s hsY hsX - have hq1 : ¬ QuarterPlane x s := by - intro hq - exact not_le_of_gt hx hq.1 + have hq1 : ¬ QuarterPlane x s := not_quarterPlane_of_neg hx have hq2 : QuarterPlane2 x s := ⟨le_of_lt hx, le_of_lt hsY, le_of_lt hsX⟩ simp [uCandidate, hq1, hq2] have haux : @@ -8850,9 +8404,7 @@ private lemma hasDerivAt_uCandidate_y_on_QuarterPlane2Open (p : ℝ) (hp : 2 < p refine hcomp.congr_deriv ?_ ring refine (hbase.congr_of_eventuallyEq hEq).congr_deriv ?_ - have hq1 : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hx hq.1 + have hq1 : ¬ QuarterPlane x y := not_quarterPlane_of_neg hx have hq2 : QuarterPlane2 x y := ⟨hx.le, hynegx.le, hxy.le⟩ simp [DyuCandidate, hq1, hq2] @@ -8871,13 +8423,8 @@ private lemma hasDerivAt_uCandidate_y_on_QuarterPlane3Open (p : ℝ) (hp : 2 ≤ simpa [Set.preimage] using hcont.preimage_mem_nhds (Ioi_mem_nhds hpos) have hX : {s : ℝ | x < s} ∈ nhds y := Ioi_mem_nhds hxy filter_upwards [hY, hN, hX] with s hsY hsN hsX - have hq1 : ¬ QuarterPlane x s := by - intro hq - exact not_le_of_gt hsX hq.2.1 - have hq2 : ¬ QuarterPlane2 x s := by - intro hq - have hlt : -x < s := by linarith - exact not_le_of_gt hlt hq.2.1 + have hq1 : ¬ QuarterPlane x s := not_quarterPlane_of_lt hsX + have hq2 : ¬ QuarterPlane2 x s := not_quarterPlane2_of_lt (by linarith) have hsN' : -s < x := by linarith have hq3 : QuarterPlane3 x s := ⟨le_of_lt hsY, le_of_lt hsN', le_of_lt hsX⟩ simp [uCandidate, hq1, hq2, hq3] @@ -8885,13 +8432,8 @@ private lemma hasDerivAt_uCandidate_y_on_QuarterPlane3Open (p : ℝ) (hp : 2 ≤ HasDerivAt (fun s => auxFunction1 p s x) (DxauxFunction1 p y x) y := hasDerivAt_auxFunction1_x_on_QuarterPlaneOpen p hp y x hQaux refine (hbase.congr_of_eventuallyEq hEq).congr_deriv ?_ - have hq1 : ¬ QuarterPlane x y := by - intro hq - exact not_le_of_gt hxy hq.2.1 - have hq2 : ¬ QuarterPlane2 x y := by - intro hq - have hlt : -x < y := by linarith - exact not_le_of_gt hlt hq.2.1 + have hq1 : ¬ QuarterPlane x y := not_quarterPlane_of_lt hxy + have hq2 : ¬ QuarterPlane2 x y := not_quarterPlane2_of_lt (by linarith) have hq3 : QuarterPlane3 x y := ⟨hy.le, hneg.le, hxy.le⟩ simp [DyuCandidate, hq1, hq2, hq3] @@ -8915,9 +8457,7 @@ private lemma hasDerivAt_uCandidate_y_on_QuarterPlane4Open (p : ℝ) (hp : 2 ≤ intro hq have hlt : s < -x := by linarith exact not_le_of_gt hlt hq.2.2 - have hq2 : ¬ QuarterPlane2 x s := by - intro hq - exact not_le_of_gt hsYX hq.2.2 + have hq2 : ¬ QuarterPlane2 x s := not_quarterPlane2_of_gt hsYX have hq3 : ¬ QuarterPlane3 x s := by intro hq exact not_le_of_gt hsY hq.1 @@ -8939,9 +8479,7 @@ private lemma hasDerivAt_uCandidate_y_on_QuarterPlane4Open (p : ℝ) (hp : 2 ≤ intro hq have hlt : y < -x := by linarith exact not_le_of_gt hlt hq.2.2 - have hq2 : ¬ QuarterPlane2 x y := by - intro hq - exact not_le_of_gt hyx hq.2.2 + have hq2 : ¬ QuarterPlane2 x y := not_quarterPlane2_of_gt hyx have hq3 : ¬ QuarterPlane3 x y := by intro hq exact not_le_of_gt hy hq.1 @@ -8951,7 +8489,7 @@ private lemma hasDerivAt_uCandidate_y_on_QuarterPlane4Open (p : ℝ) (hp : 2 ≤ private lemma hasDerivAt_uCandidate_x_on_diag_pos (p : ℝ) (hp : 2 < p) (x : ℝ) (hx : 0 < x) : HasDerivAt (fun t => uCandidate p t x) (DxuCandidate p x x) x := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have hleftEq : (fun t => uCandidate p t x) =ᶠ[𝓝[Set.Iic x] x] fun t => auxFunction1 p x t := by @@ -8966,13 +8504,8 @@ private lemma hasDerivAt_uCandidate_x_on_diag_pos (p : ℝ) (hp : 2 < p) have hq : QuarterPlane x x := ⟨hx.le, le_rfl, by linarith⟩ simp [uCandidate, hq] · have htx_lt : t < x := lt_of_le_of_ne htx ht_eq - have hq1' : ¬ QuarterPlane t x := by - intro hq - exact not_le_of_gt htx_lt hq.2.1 - have hq2 : ¬ QuarterPlane2 t x := by - intro hq - have hlt : -t < x := by linarith - exact not_le_of_gt hlt hq.2.1 + have hq1' : ¬ QuarterPlane t x := not_quarterPlane_of_lt htx_lt + have hq2 : ¬ QuarterPlane2 t x := not_quarterPlane2_of_lt (by linarith) have hq3 : QuarterPlane3 t x := ⟨hx.le, le_of_lt hneg, htx⟩ simp [uCandidate, hq1', hq2, hq3] have hrightEq : @@ -9031,7 +8564,7 @@ private lemma hasDerivAt_uCandidate_x_on_diag_pos (p : ℝ) (hp : 2 < p) have hp_pos : 0 < p := by linarith rw [a, hpStar] field_simp [hp_pos.ne] - nlinarith + linarith have hx_lt_div : x < x / a p := by rw [div_eq_mul_inv] have ha_lt : a p < 1 := a_lt_one_of_two_le p hp' @@ -9065,7 +8598,7 @@ private lemma hasDerivAt_uCandidate_x_on_diag_pos (p : ℝ) (hp : 2 < p) private lemma hasDerivAt_uCandidate_y_on_diag_pos (p : ℝ) (hp : 2 < p) (x : ℝ) (hx : 0 < x) : HasDerivAt (fun s => uCandidate p x s) (DyuCandidate p x x) x := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have hleftEq : (fun s => uCandidate p x s) =ᶠ[𝓝[Set.Iic x] x] fun s => auxFunction1 p x s := by @@ -9086,9 +8619,7 @@ private lemma hasDerivAt_uCandidate_y_on_diag_pos (p : ℝ) (hp : 2 < p) have hq : QuarterPlane x x := ⟨hx.le, le_rfl, by linarith⟩ simp [uCandidate, hq] · have hxs_lt : x < s := lt_of_le_of_ne hs (Ne.symm hs_eq) - have hq1 : ¬ QuarterPlane x s := by - intro hq - exact not_le_of_gt hxs_lt hq.2.1 + have hq1 : ¬ QuarterPlane x s := not_quarterPlane_of_lt hxs_lt have hq2 : ¬ QuarterPlane2 x s := by intro hq exact not_le_of_gt hx hq.1 @@ -9140,7 +8671,7 @@ private lemma hasDerivAt_uCandidate_y_on_diag_pos (p : ℝ) (hp : 2 < p) have hp_pos : 0 < p := by linarith rw [a, hpStar] field_simp [hp_pos.ne] - nlinarith + linarith have hx_lt_div : x < x / a p := by rw [div_eq_mul_inv] have ha_lt_one : a p < 1 := a_lt_one_of_two_le p hp' @@ -9177,13 +8708,13 @@ private lemma hasDerivAt_uCandidate_y_on_diag_pos (p : ℝ) (hp : 2 < p) private lemma hasDerivAt_uCandidate_x_on_antidiag_pos (p : ℝ) (hp : 2 < p) (x : ℝ) (hx : 0 < x) : HasDerivAt (fun t => uCandidate p t (-x)) (DxuCandidate p x (-x)) x := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_nonneg : 0 ≤ a p := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp' have hp_pos : 0 < p := by linarith rw [a, hpStar] field_simp [hp_pos.ne] - nlinarith + linarith have hleftEq : (fun t => uCandidate p t (-x)) =ᶠ[𝓝[Set.Iic x] x] fun t => auxFunction1 p x (-t) := by @@ -9292,13 +8823,13 @@ private lemma hasDerivAt_uCandidate_x_on_antidiag_pos (p : ℝ) (hp : 2 < p) private lemma hasDerivAt_uCandidate_y_on_antidiag_pos (p : ℝ) (hp : 2 < p) (x : ℝ) (hx : 0 < x) : HasDerivAt (fun s => uCandidate p x s) (DyuCandidate p x (-x)) (-x) := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_nonneg : 0 ≤ a p := by have hpStar : pStar p = p := pStar_eq_self_of_two_le p hp' have hp_pos : 0 < p := by linarith rw [a, hpStar] field_simp [hp_pos.ne] - nlinarith + linarith have hleftEq : (fun s => uCandidate p x s) =ᶠ[𝓝[Set.Iic (-x)] (-x)] fun s => auxFunction1 p (-s) (-x) := by @@ -9449,10 +8980,10 @@ private lemma burkholder_scalar_deriv_nonpos (1 - t) ^ (p - 1) + (p - 1) ^ p * t ^ (p - 1) ≤ alpha p := by let lam : ℝ := 1 - p * t let mu : ℝ := p * t - have hp_ge : 2 ≤ p := by linarith - have hp_pos : 0 < p := by linarith - have hp1_ge_one : 1 ≤ p - 1 := by linarith - have hp1_pos : 0 < p - 1 := by linarith + have hp_ge : 2 ≤ p := le_of_lt hp + have hp_pos : 0 < p := p_pos_of_two_le p hp_ge + have hp1_ge_one : 1 ≤ p - 1 := one_le_sub_one_of_two_le p hp_ge + have hp1_pos : 0 < p - 1 := sub_one_pos_of_two_le p hp_ge have hbase_nonneg : 0 ≤ (p - 1) / p := by positivity have hbase_le_one : (p - 1) / p ≤ 1 := by field_simp [hp_pos.ne'] @@ -9560,9 +9091,9 @@ private lemma burkholder_scalar_A1 (1 - t) ^ p - (p - 1) ^ p * t ^ p ≤ alpha p * (1 - p * t) := by let H : ℝ → ℝ := fun s => (1 - s) ^ p - (p - 1) ^ p * s ^ p - alpha p * (1 - p * s) - have hp_ge : 2 ≤ p := by linarith - have hp_pos : 0 < p := by linarith - have hp1_ge_one : 1 ≤ p - 1 := by linarith + have hp_ge : 2 ≤ p := le_of_lt hp + have hp_pos : 0 < p := p_pos_of_two_le p hp_ge + have hp1_ge_one : 1 ≤ p - 1 := one_le_sub_one_of_two_le p hp_ge have hcont : ContinuousOn H (Set.Icc 0 (1 / p)) := by unfold H apply ContinuousOn.sub @@ -9673,9 +9204,9 @@ private lemma vGeTwo_le_uA1_on_closureA1 subst hy0 simp [vGeTwo, uA1, Real.zero_rpow (by linarith : p ≠ 0)] · have hx_nonneg' : 0 ≤ x := le_of_lt hxpos - have hp_nonneg : 0 ≤ p := by linarith - have hp_pos : 0 < p := by linarith - have hp_ne : p ≠ 0 := by linarith + have hp_nonneg : 0 ≤ p := p_nonneg_of_two_le p (le_of_lt hp) + have hp_pos : 0 < p := p_pos_of_two_le p (le_of_lt hp) + have hp_ne : p ≠ 0 := p_ne_zero_of_two_le p (le_of_lt hp) have hpStar : pStar p = p := pStar_eq_self_of_two_le p (by linarith) have ha_eq : a p = 1 - 2 / p := by simp [a, hpStar] have ha_nonneg : 0 ≤ a p := by @@ -9697,7 +9228,7 @@ private lemma vGeTwo_le_uA1_on_closureA1 have htmp : x - (1 - 2 / p) * x = 2 * x / p := by field_simp [hp_pos.ne'] ring - nlinarith + linarith have hden_pos : 0 < 2 * x := mul_pos (by norm_num) hxpos have h := div_le_div_of_nonneg_right hxy hden_pos.le calc @@ -9937,11 +9468,11 @@ private lemma uCandidate_le_zero_of_xy_zero private lemma vGeTwo_le_zero_of_mul_nonpos (p x y : ℝ) (hp : 2 ≤ p) (hxy : x * y ≤ 0) : vGeTwo p x y ≤ 0 := by - have hp_nonneg : 0 ≤ p := by linarith - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp_nonneg : 0 ≤ p := p_nonneg_of_two_le p hp + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hp1_one : (1 : ℝ) ≤ p - 1 := by linarith have hsq : ((x + y) / 2) ^ 2 ≤ ((x - y) / 2) ^ 2 := by - nlinarith + linarith have habs : |(x + y) / 2| ≤ |(x - y) / 2| := sq_le_sq.mp hsq have hpow : Real.rpow (|(x + y) / 2|) p ≤ Real.rpow (|(x - y) / 2|) p := @@ -9982,17 +9513,17 @@ private lemma uCandidate_le_zero_of_mul_nonpos rcases hrest with hQ2 | hrest · have hQ : QuarterPlane (-x) (-y) := ⟨by linarith [hQ2.1], by linarith [hQ2.2.2], by linarith [hQ2.2.1]⟩ - have hxy' : (-x) * (-y) ≤ 0 := by nlinarith + have hxy' : (-x) * (-y) ≤ 0 := by linarith rw [uCandidate_eq_Q2 p hQ2] exact auxFunction1_le_zero_of_QuarterPlane_mul_nonpos p (-x) (-y) hp hQ hxy' rcases hrest with hQ3 | hQ4 · have hQ : QuarterPlane y x := ⟨hQ3.1, hQ3.2.2, hQ3.2.1⟩ - have hxy' : y * x ≤ 0 := by nlinarith + have hxy' : y * x ≤ 0 := by linarith rw [uCandidate_eq_Q3 p hQ3] exact auxFunction1_le_zero_of_QuarterPlane_mul_nonpos p y x hp hQ hxy' · have hQ : QuarterPlane (-y) (-x) := ⟨by linarith [hQ4.1], by linarith [hQ4.2.1], by linarith [hQ4.2.2]⟩ - have hxy' : (-y) * (-x) ≤ 0 := by nlinarith + have hxy' : (-y) * (-x) ≤ 0 := by linarith rw [uCandidate_eq_Q4 p hQ4] exact auxFunction1_le_zero_of_QuarterPlane_mul_nonpos p (-y) (-x) hp hQ hxy' @@ -10000,7 +9531,7 @@ private lemma uCandidate_le_zero_of_mul_nonpos private lemma uCandidate_le_zero_of_mul_neg (p x y : ℝ) (hp : 2 < p) (hxy : x * y = 0) (hnzero : (x, y) ≠ (0, 0)) : uCandidate p x y < 0 := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have hv_axis : ∀ t : ℝ, t ≠ 0 → vGeTwo p t 0 < 0 := by intro t htne have hp_pos : 0 < p := by linarith @@ -10010,7 +9541,7 @@ private lemma uCandidate_le_zero_of_mul_neg exact abs_pos.mpr (by intro hdiv apply htne - nlinarith) + linarith) have hA_pos : 0 < Real.rpow (|t / 2|) p := Real.rpow_pos_of_pos hbase_pos p have hlt : @@ -10146,7 +9677,7 @@ private lemma DyvGeTwo_mono_x_of_pos (hsum_x : 0 ≤ (x + y) / 2) (hdiff_x : 0 ≤ (x - y) / 2) (hxz : x ≤ z) : DyvGeTwo p x y ≤ DyvGeTwo p z y := by - have hp_exp : 0 ≤ p - 1 := by linarith + have hp_exp : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hsum_le : (x + y) / 2 ≤ (z + y) / 2 := by linarith have hdiff_le : (x - y) / 2 ≤ (z - y) / 2 := by linarith have hsum_z : 0 ≤ (z + y) / 2 := le_trans hsum_x hsum_le @@ -10154,11 +9685,11 @@ private lemma DyvGeTwo_mono_x_of_pos have hA := Real.rpow_le_rpow hsum_x hsum_le hp_exp have hB := Real.rpow_le_rpow hdiff_x hdiff_le hp_exp have hcoef : 0 ≤ (p - 1) ^ p := Real.rpow_nonneg (by linarith : 0 ≤ p - 1) _ - have hhalf : 0 ≤ p / 2 := by linarith + have hhalf : 0 ≤ p / 2 := half_p_nonneg_of_two_le p hp have hzpos : 0 < z := lt_of_lt_of_le hxpos hxz simp [DyvGeTwo, hxpos, hzpos, abs_of_nonneg hsum_x, abs_of_nonneg hsum_z, abs_of_nonneg hdiff_x, abs_of_nonneg hdiff_z] - nlinarith [mul_le_mul_of_nonneg_right hA hhalf, + linarith [mul_le_mul_of_nonneg_right hA hhalf, mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hB hcoef) hhalf] private lemma DxvGeTwo_mono_y_of_pos @@ -10167,7 +9698,7 @@ private lemma DxvGeTwo_mono_y_of_pos (hsum_y : 0 ≤ (x + y) / 2) (hdiff_z : 0 ≤ (x - z) / 2) (hyz : y ≤ z) : DxvGeTwo p x y ≤ DxvGeTwo p x z := by - have hp_exp : 0 ≤ p - 1 := by linarith + have hp_exp : 0 ≤ p - 1 := sub_one_nonneg_of_two_le p hp have hsum_le : (x + y) / 2 ≤ (x + z) / 2 := by linarith have hdiff_le : (x - z) / 2 ≤ (x - y) / 2 := by linarith have hsum_z : 0 ≤ (x + z) / 2 := le_trans hsum_y hsum_le @@ -10175,17 +9706,17 @@ private lemma DxvGeTwo_mono_y_of_pos have hA := Real.rpow_le_rpow hsum_y hsum_le hp_exp have hB := Real.rpow_le_rpow hdiff_z hdiff_le hp_exp have hcoef : 0 ≤ (p - 1) ^ p := Real.rpow_nonneg (by linarith : 0 ≤ p - 1) _ - have hhalf : 0 ≤ p / 2 := by linarith + have hhalf : 0 ≤ p / 2 := half_p_nonneg_of_two_le p hp simp [DxvGeTwo, hxpos, abs_of_nonneg hsum_y, abs_of_nonneg hsum_z, abs_of_nonneg hdiff_y, abs_of_nonneg hdiff_z] - nlinarith [mul_le_mul_of_nonneg_right hA hhalf, + linarith [mul_le_mul_of_nonneg_right hA hhalf, mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hB hcoef) hhalf] private lemma DyuCandidate_mono_x_on_Q2 (p : ℝ) (hp : 2 < p) {x z y : ℝ} (hy_pos : 0 < y) (hz_upper : z ≤ -y) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have hQx : QuarterPlane2 x y := ⟨by linarith, by linarith, by linarith⟩ have hQz : QuarterPlane2 z y := ⟨by linarith, by linarith, by linarith⟩ have hclx : closureA2 p (-x) (-y) := by @@ -10214,7 +9745,7 @@ private lemma DyuCandidate_mono_x_on_Q3_A2 (hy_pos : 0 < y) (hx_lower : -y ≤ x) (hz_upper : z ≤ a p * y) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' have ha_le_y : a p * y ≤ y := (mul_le_mul_of_nonneg_right (a_lt_one_of_two_le p hp').le hy_pos.le).trans_eq @@ -10246,7 +9777,7 @@ private lemma DyuCandidate_mono_x_on_Q3_A1 (hy_pos : 0 < y) (hx_lower : a p * y ≤ x) (hz_upper : z ≤ y) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' have hQx : QuarterPlane3 x y := ⟨hy_pos.le, by have haxy_nonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le @@ -10270,7 +9801,7 @@ private lemma DyuCandidate_mono_x_on_Q1_A1 (hy_pos : 0 < y) (hyx : y ≤ x) (hz_upper : z ≤ y / a p) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp have hQx : QuarterPlane x y := ⟨(lt_of_lt_of_le hy_pos hyx).le, hyx, by linarith⟩ have hQz : QuarterPlane z y := ⟨(lt_of_lt_of_le hy_pos (le_trans hyx hxz)).le, @@ -10298,7 +9829,7 @@ private lemma DyuCandidate_mono_x_on_Q1_A2 (p : ℝ) (hp : 2 < p) {x z y : ℝ} (hy_pos : 0 < y) (hx_lower : y / a p ≤ x) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_pos : 0 < a p := a_pos_of_two_lt p hp have hx_pos : 0 < x := by exact lt_of_lt_of_le (div_pos hy_pos ha_pos) hx_lower @@ -10344,7 +9875,7 @@ private lemma DyuCandidate_mono_x_of_y_pos (p : ℝ) (hp : 2 < p) {x z y : ℝ} (hy_pos : 0 < y) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp have ha_nonneg : 0 ≤ a p := a_nonneg_of_two_le p hp' have ha_lt : a p < 1 := a_lt_one_of_two_le p hp' have ha_pos : 0 < a p := a_pos_of_two_lt p hp @@ -10421,16 +9952,16 @@ private lemma DyvGeTwo_axis_nonneg have hdiff : 0 ≤ (x - 0) / 2 := by linarith have hbase : 0 ≤ |x / 2| ^ (p - 1) := Real.rpow_nonneg (abs_nonneg _) _ have hcoef : 0 ≤ (p - 1) ^ p := Real.rpow_nonneg (by linarith : 0 ≤ p - 1) _ - have hhalf : 0 ≤ p / 2 := by linarith + have hhalf : 0 ≤ p / 2 := half_p_nonneg_of_two_le p hp simp [DyvGeTwo, hx_pos] - nlinarith [mul_nonneg hbase hhalf, + linarith [mul_nonneg hbase hhalf, mul_nonneg (mul_nonneg hcoef hbase) hhalf] private lemma DyuCandidate_axis_mono_x (p : ℝ) (hp : 2 < p) {x z : ℝ} (hxz : x ≤ z) : DyuCandidate p x 0 ≤ DyuCandidate p z 0 := by - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp by_cases hz_nonpos : z ≤ 0 · have hx_nonpos : x ≤ 0 := le_trans hxz hz_nonpos have hx_eq : DyuCandidate p x 0 = -DyvGeTwo p (-x) 0 := by @@ -10666,7 +10197,7 @@ theorem exists_majorant_geTwo (p : ℝ) (hp : 2 < p) : · -- pointwise majorization intros x y have hv := MajorantPG2.vGeTwo_le_uCandidate p hp x y - have hp' : 2 ≤ p := by linarith + have hp' : 2 ≤ p := le_of_lt hp simpa [v, MajorantPG2.vGeTwo, MajorantPG2.pStar_eq_self_of_two_le p hp', abs_of_nonneg (by linarith : 0 ≤ p - 1)] using hv · -- negativity on x*y ≤ 0 diff --git a/LeanPool/Burkholder/Majorants/MajorantPL2.lean b/LeanPool/Burkholder/Majorants/MajorantPL2.lean index d0f29baa47..0ef974e85e 100644 --- a/LeanPool/Burkholder/Majorants/MajorantPL2.lean +++ b/LeanPool/Burkholder/Majorants/MajorantPL2.lean @@ -87,10 +87,24 @@ private lemma pStar_eq_self_of_two_le (p : ℝ) (hp : 2 ≤ p) : pStar p = p := rw [div_le_iff₀ hden_pos] nlinarith - - - - +/-- Points of the interior of a closed interval lie in the open interval. -/ +private lemma mem_Ioo_of_mem_interior_Icc {a b t : ℝ} (ht : t ∈ interior (Set.Icc a b)) : + t ∈ Set.Ioo a b := by + rwa [interior_Icc] at ht + +/-! Elementary consequences of `1 < p < 2`, stated once so that the many proofs below can use +them as terms instead of re-running `linarith`. -/ + +private lemma p_pos_of_one_lt (p : ℝ) (hp1 : 1 < p) : 0 < p := by linarith +private lemma p_nonneg_of_one_lt (p : ℝ) (hp1 : 1 < p) : 0 ≤ p := by linarith +private lemma sub_one_pos_of_one_lt (p : ℝ) (hp1 : 1 < p) : 0 < p - 1 := by linarith +private lemma sub_one_nonneg_of_one_lt (p : ℝ) (hp1 : 1 < p) : 0 ≤ p - 1 := by linarith +private lemma sub_one_ne_zero_of_one_lt (p : ℝ) (hp1 : 1 < p) : p - 1 ≠ 0 := by linarith +private lemma p_ne_zero_of_one_lt (p : ℝ) (hp1 : 1 < p) : p ≠ 0 := by linarith +private lemma p_ne_one_of_one_lt (p : ℝ) (hp1 : 1 < p) : p ≠ 1 := by linarith +private lemma half_p_nonneg_of_one_lt (p : ℝ) (hp1 : 1 < p) : 0 ≤ p / 2 := by linarith +private lemma sub_one_le_one_of_lt_two (p : ℝ) (hp2 : p < 2) : p - 1 ≤ 1 := by linarith +private lemma sub_two_neg_of_lt_two (p : ℝ) (hp2 : p < 2) : p - 2 < 0 := by linarith /-- The same expression specialized to the `1< p < 2` regime. -/ private def coeffLeTwo (p : ℝ) : ℝ := @@ -315,8 +329,8 @@ inequality, pointwise majorization, and negativity on the opposing-sign region. private lemma v_eq_vLeTwo_of_one_lt_of_lt_two (p x y : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : v p x y = vLeTwo p x y := by - have hp_ne_one : p ≠ 1 := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 have hq : q p = p / (p - 1) := by @@ -333,7 +347,7 @@ private lemma v_eq_vLeTwo_of_one_lt_of_lt_two private lemma one_le_coeffLeTwo_of_one_lt_of_lt_two (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : 1 ≤ coeffLeTwo p := by - have hp_nonneg : 0 ≤ p := by linarith + have hp_nonneg : 0 ≤ p := p_nonneg_of_one_lt p hp1 have hbase : 1 ≤ (p - 1)⁻¹ := by have hp1_pos : 0 < p - 1 := by linarith rw [show (p - 1)⁻¹ = 1 / (p - 1) by rw [one_div]] @@ -353,9 +367,9 @@ private lemma pStar_pos_of_one_lt_of_lt_two 0 < pStar p := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 rw [hpStar] simp only [q, hp_ne_one, ↓reduceIte, gt_iff_lt] exact div_pos hp_pos hpden_pos @@ -365,8 +379,8 @@ private lemma a_nonneg_of_one_lt_of_lt_two 0 ≤ a p := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 rw [a, hpStar] simp [q, hp_ne_one] field_simp [hpden_pos.ne'] @@ -377,8 +391,8 @@ private lemma one_le_half_pStar_of_one_lt_of_lt_two 1 ≤ pStar p / 2 := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 rw [hpStar] simp only [q, hp_ne_one, ↓reduceIte, ge_iff_le] rw [le_div_iff₀ (by norm_num : (0 : ℝ) < 2)] @@ -391,9 +405,9 @@ private lemma alpha_nonneg_of_one_lt_of_lt_two 0 ≤ alpha p := by have hpStar_eq : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 have hps_pos : 0 < pStar p := by rw [hpStar_eq] simp only [q, hp_ne_one, ↓reduceIte] @@ -402,16 +416,16 @@ private lemma alpha_nonneg_of_one_lt_of_lt_two rw [hpStar_eq] simp [q, hp_ne_one] field_simp [hpden_pos.ne'] - nlinarith + linarith unfold alpha exact mul_nonneg hp_pos.le (Real.rpow_nonneg (div_nonneg hps_pos.le hpsm_pos.le) _) private lemma vLeTwo_le_zero_of_mul_nonpos_leTwo (p x y : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (hxy : x * y ≤ 0) : vLeTwo p x y ≤ 0 := by - have hp_nonneg : 0 ≤ p := by linarith + have hp_nonneg : 0 ≤ p := p_nonneg_of_one_lt p hp1 have hsq : ((x + y) / 2) ^ 2 ≤ ((x - y) / 2) ^ 2 := by - nlinarith + linarith have habs : |(x + y) / 2| ≤ |(x - y) / 2| := sq_le_sq.mp hsq have hpow : Real.rpow (|(x + y) / 2|) p ≤ Real.rpow (|(x - y) / 2|) p := @@ -649,17 +663,17 @@ private lemma uCandidate_le_zero_of_mul_nonpos_leTwo rcases hrest with hQ2 | hrest · have hQ : QuarterPlane (-x) (-y) := ⟨by linarith [hQ2.1], by linarith [hQ2.2.2], by linarith [hQ2.2.1]⟩ - have hxy' : (-x) * (-y) ≤ 0 := by nlinarith + have hxy' : (-x) * (-y) ≤ 0 := by linarith rw [uCandidate_eq_Q2_leTwo p hQ2] exact auxFunction1_le_zero_of_QuarterPlane_mul_nonpos_leTwo p (-x) (-y) hp1 hp2 hQ hxy' rcases hrest with hQ3 | hQ4 · have hQ : QuarterPlane y x := ⟨hQ3.1, hQ3.2.2, hQ3.2.1⟩ - have hxy' : y * x ≤ 0 := by nlinarith + have hxy' : y * x ≤ 0 := by linarith rw [uCandidate_eq_Q3_leTwo p hQ3] exact auxFunction1_le_zero_of_QuarterPlane_mul_nonpos_leTwo p y x hp1 hp2 hQ hxy' · have hQ : QuarterPlane (-y) (-x) := ⟨by linarith [hQ4.1], by linarith [hQ4.2.1], by linarith [hQ4.2.2]⟩ - have hxy' : (-y) * (-x) ≤ 0 := by nlinarith + have hxy' : (-y) * (-x) ≤ 0 := by linarith rw [uCandidate_eq_Q4_leTwo p hQ4] exact auxFunction1_le_zero_of_QuarterPlane_mul_nonpos_leTwo p (-y) (-x) hp1 hp2 hQ hxy' @@ -672,9 +686,9 @@ private lemma a_eq_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : a p = (2 - p) / p := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 rw [a, hpStar] simp [q, hp_ne_one] field_simp [hp_pos.ne', hpden_pos.ne'] @@ -684,9 +698,9 @@ private lemma alpha_eq_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : alpha p = p * p ^ (1 - p) := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 rw [alpha, hpStar] simp [q, hp_ne_one] have hbase : (p / (p - 1)) / (p / (p - 1) - 1) = p := by @@ -698,10 +712,67 @@ private lemma a_lt_one_of_one_lt_of_lt_two (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : a p < 1 := by rw [a_eq_leTwo p hp1 hp2] - have hp_pos : 0 < p := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 rw [div_lt_iff₀ hp_pos] linarith +/-- `a p` is positive in the regime `1 < p < 2`. -/ +private lemma a_pos_of_one_lt_of_lt_two (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : 0 < a p := by + rw [a_eq_leTwo p hp1 hp2] + exact div_pos (by linarith) (by linarith) + +/-- Dividing a positive number by `a p < 1` increases it. -/ +private lemma lt_self_div_a_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} (hy : 0 < y) : + y < y / a p := by + rw [lt_div_iff₀ (a_pos_of_one_lt_of_lt_two p hp1 hp2)] + exact mul_lt_of_lt_one_right hy (a_lt_one_of_one_lt_of_lt_two p hp1 hp2) + +/-- Clearing the denominator in `x < y / a p`. -/ +private lemma mul_a_lt_of_lt_div_a {p x y : ℝ} (ha : 0 < a p) (h : x < y / a p) : + a p * x < y := by + rw [mul_comm] + exact (lt_div_iff₀ ha).1 h + +/-- Clearing the denominator in `y / a p < x`. -/ +private lemma lt_mul_a_of_div_a_lt {p x y : ℝ} (ha : 0 < a p) (h : y / a p < x) : + y < a p * x := by + rw [mul_comm] + exact (div_lt_iff₀ ha).1 h + +/-- Clearing the denominator in `x ≤ y / a p`. -/ +private lemma mul_a_le_of_le_div_a {p x y : ℝ} (ha : 0 < a p) (h : x ≤ y / a p) : + a p * x ≤ y := by + rw [mul_comm] + exact (le_div_iff₀ ha).1 h + +/-- The diagonal point `(y, y)` with `y > 0` lies in the closed upper sector. -/ +private lemma closureA2_diag_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} (hy : 0 < y) : + closureA2 p y y := + ⟨hy.le, mul_le_of_le_one_left hy.le (a_lt_one_of_one_lt_of_lt_two p hp1 hp2).le, le_rfl⟩ + +/-- The point `(y, y)` with `y > 0` lies in the first quarter plane. -/ +private lemma quarterPlane_diag_of_pos {y : ℝ} (hy : 0 < y) : QuarterPlane y y := + ⟨hy.le, le_rfl, (neg_nonpos.2 hy.le).trans hy.le⟩ + +/-- The boundary point `(y / a p, y)` lies in the first quarter plane. -/ +private lemma quarterPlane_div_a_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} + (hy : 0 < y) : QuarterPlane (y / a p) y := + have hb : 0 < y / a p := div_pos hy (a_pos_of_one_lt_of_lt_two p hp1 hp2) + ⟨hb.le, (lt_self_div_a_leTwo p hp1 hp2 hy).le, (neg_nonpos.2 hb.le).trans hy.le⟩ + +/-- The boundary point `(a p * y, y)` lies in the third quarter plane. -/ +private lemma quarterPlane3_mul_a_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} + (hy : 0 < y) : QuarterPlane3 (a p * y) y := + have hc : 0 ≤ a p * y := mul_nonneg (a_nonneg_of_one_lt_of_lt_two p hp1 hp2) hy.le + ⟨hy.le, (neg_nonpos.2 hy.le).trans hc, (mul_lt_of_lt_one_left hy + (a_lt_one_of_one_lt_of_lt_two p hp1 hp2)).le⟩ + +/-- The boundary point `(y, a p * y)` lies in the closed lower sector. -/ +private lemma closureA1_mul_a_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} + (hy : 0 < y) : closureA1 p y (a p * y) := + have hc : 0 ≤ a p * y := mul_nonneg (a_nonneg_of_one_lt_of_lt_two p hp1 hp2) hy.le + ⟨hy.le, (neg_nonpos.2 hy.le).trans hc, le_rfl⟩ + private lemma DxauxFunction1_eq_DyauxFunction1_on_diag_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (x : ℝ) (hx : 0 ≤ x) : @@ -713,10 +784,9 @@ private lemma DxauxFunction1_eq_DyauxFunction1_on_diag_leTwo have hcl2 : closureA2 p x x := ⟨hx, hax, le_rfl⟩ have hnot1 : ¬ closureA1 p x x := by intro h - have hax_lt : a p * x < x := by - simpa using mul_lt_mul_of_pos_right hlt hxpos + have hax_lt : a p * x < x := mul_lt_of_lt_one_left hxpos hlt exact not_le_of_gt hax_lt h.2.2 - have hp1_ne : p - 1 ≠ 0 := by linarith + have hp1_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 simp [DxauxFunction1, DyauxFunction1, hnot1, hcl2, DxvLeTwo, DyvLeTwo, hxpos, Real.zero_rpow hp1_ne] · subst x @@ -733,8 +803,8 @@ private lemma DxauxFunction1_eq_neg_DyauxFunction1_on_antidiag_leTwo exact le_trans (neg_nonpos.mpr hx) (mul_nonneg ha_nonneg hx) have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hpden_ne : p - 1 ≠ 0 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hpden_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 have hpow : x ^ (p - 1) = x ^ (p - 2) * x := by calc x ^ (p - 1) = x ^ ((p - 2) + (1 : ℝ)) := by ring_nf @@ -911,9 +981,9 @@ private lemma uA1_eq_zero_on_boundary_leTwo uA1 p x ((a p) * x) = 0 := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 unfold uA1 rw [ite_eq_left hx] have hfactor : x - pStar p * (x - a p * x) / 2 = 0 := by @@ -926,8 +996,8 @@ private lemma uA1_eq_zero_on_boundary_leTwo private lemma vLeTwo_eq_zero_on_boundary_leTwo (p x : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (hx : 0 < x) : vLeTwo p x ((a p) * x) = 0 := by - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 have hpden_nonneg : 0 ≤ p - 1 := le_of_lt hpden_pos have hx_nonneg : 0 ≤ x := le_of_lt hx rw [a_eq_leTwo p hp1 hp2] @@ -996,8 +1066,8 @@ private lemma auxFunction1_eq_vLeTwo_leTwo private lemma DxuA1_eq_DxvLeTwo_on_A1A2_boundary_leTwo (p x : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (hx : 0 < x) : DxuA1 p x ((a p) * x) = DxvLeTwo p x ((a p) * x) := by - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 have hpden_nonneg : 0 ≤ p - 1 := hpden_pos.le have hx_nonneg : 0 ≤ x := hx.le simp only [DxuA1, gt_iff_lt, hx, ↓reduceIte, alpha_eq_leTwo p hp1 hp2, Real.rpow_eq_pow, @@ -1097,12 +1167,12 @@ private lemma DxuA1_eq_DxvLeTwo_on_A1A2_boundary_leTwo private lemma DyuA1_eq_DyvLeTwo_on_A1A2_boundary_leTwo (p x : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (hx : 0 < x) : DyuA1 p x ((a p) * x) = DyvLeTwo p x ((a p) * x) := by - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 have hpden_nonneg : 0 ≤ p - 1 := hpden_pos.le have hx_nonneg : 0 ≤ x := hx.le have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 simp only [DyuA1, gt_iff_lt, hx, ↓reduceIte, alpha_eq_leTwo p hp1 hp2, Real.rpow_eq_pow, hpStar, q, hp_ne_one, DyvLeTwo, a_eq_leTwo p hp1 hp2] have hsum : (x + (2 - p) / p * x) / 2 = x / p := by @@ -1226,19 +1296,12 @@ private lemma auxFunction1_Dy_eq_DyvLeTwo_leTwo private lemma horizontal_boundary_closureA1_closureA2_leTwo (p y : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (hy : 0 < y) : closureA1 p (y / a p) y ∧ closureA2 p (y / a p) y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hboundary : a p * (y / a p) = y := by field_simp [ha_pos.ne'] have hx_pos : 0 < y / a p := div_pos hy ha_pos - have hyx : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hyx : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy have hneg : -(y / a p) < y := by linarith [hx_pos, hy] constructor @@ -1303,14 +1366,14 @@ private lemma scalar_deriv_sum_lower_leTwo (1 - t) ^ (p - 1) + coeffLeTwo p * t ^ (p - 1) := by let lam : ℝ := p * (1 - t) let mu : ℝ := p * t - (p - 1) - have hp_pos : 0 < p := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 have hp_nonneg : 0 ≤ p := le_of_lt hp_pos - have hpden_pos : 0 < p - 1 := by linarith - have hp_ne : p ≠ 0 := by linarith + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 + have hp_ne : p ≠ 0 := p_ne_zero_of_one_lt p hp1 have hpden_nonneg : 0 ≤ p - 1 := le_of_lt hpden_pos - have hp_ne_one : p ≠ 1 := by linarith - have hr_nonneg : 0 ≤ p - 1 := by linarith - have hr_le_one : p - 1 ≤ 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hr_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 + have hr_le_one : p - 1 ≤ 1 := sub_one_le_one_of_lt_two p hp2 have hlam_nonneg : 0 ≤ lam := by dsimp [lam] exact mul_nonneg hp_nonneg (sub_nonneg.mpr ht_upper) @@ -1510,10 +1573,10 @@ private lemma burkholder_scalar_gap_antitone_leTwo let F' : ℝ → ℝ := fun t => p * (alpha p * pStar p / p - ((1 - t) ^ (p - 1) + coeffLeTwo p * t ^ (p - 1))) - have hp_pos : 0 < p := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 have hp_nonneg : 0 ≤ p := le_of_lt hp_pos - have hpden_pos : 0 < p - 1 := by linarith - have hp_ne : p ≠ 0 := by linarith + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 + have hp_ne : p ≠ 0 := p_ne_zero_of_one_lt p hp1 have hcont : ContinuousOn F (Set.Icc ((p - 1) / p) 1) := by dsimp [F] apply ContinuousOn.sub @@ -1529,8 +1592,7 @@ private lemma burkholder_scalar_gap_antitone_leTwo ∀ t ∈ interior (Set.Icc ((p - 1) / p) 1), HasDerivWithinAt F (F' t) (interior (Set.Icc ((p - 1) / p) 1)) t := by intro t ht - have htI : t ∈ Set.Ioo ((p - 1) / p) 1 := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo ((p - 1) / p) 1 := mem_Ioo_of_mem_interior_Icc ht have ht_pos : 0 < t := by have hbase : 0 < (p - 1) / p := div_pos hpden_pos hp_pos exact lt_trans hbase htI.1 @@ -1571,8 +1633,7 @@ private lemma burkholder_scalar_gap_antitone_leTwo have hderiv_nonpos : ∀ t ∈ interior (Set.Icc ((p - 1) / p) 1), F' t ≤ 0 := by intro t ht - have htI : t ∈ Set.Ioo ((p - 1) / p) 1 := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo ((p - 1) / p) 1 := mem_Ioo_of_mem_interior_Icc ht have hsum := scalar_deriv_sum_lower_leTwo p t hp1 hp2 (le_of_lt htI.1) (le_of_lt htI.2) dsimp [F'] @@ -1651,11 +1712,11 @@ private lemma vLeTwo_le_uA1_on_closureA1_leTwo subst y simp [vLeTwo, uA1, Real.zero_rpow (by linarith : p ≠ 0)] · have hx_nonneg' : 0 ≤ x := le_of_lt hxpos - have hp_pos : 0 < p := by linarith - have hp_ne : p ≠ 0 := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hp_ne : p ≠ 0 := p_ne_zero_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 have ha_eq : a p = (2 - p) / p := a_eq_leTwo p hp1 hp2 let t : ℝ := (x - y) / (2 * x) have ht_upper : t ≤ 1 := by @@ -1896,8 +1957,8 @@ private lemma hasDerivAt_uA1_x_of_pos_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (x y : ℝ) (hx : 0 < x) : HasDerivAt (fun t => uA1 p t y) (DxuA1 p x y) x := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hpden_ne : p - 1 ≠ 0 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hpden_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 let g : ℝ → ℝ := fun t => alpha p * ((1 - pStar p / 2) * t ^ p + (pStar p * y / 2) * t ^ (p - 1)) have hEq : (fun t => uA1 p t y) =ᶠ[nhds x] g := by @@ -1915,27 +1976,19 @@ private lemma hasDerivAt_uA1_x_of_pos_leTwo have hxne1 : x ≠ 0 ∨ 1 ≤ p := Or.inl hxne have hxne2 : x ≠ 0 ∨ 1 ≤ p - 1 := Or.inl hxne have hd1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := by - simpa using - (Real.hasDerivAt_rpow_const hxne1 : - HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x) + HasDerivAt (fun t : ℝ => t ^ p) (p * x ^ (p - 1)) x := Real.hasDerivAt_rpow_const hxne1 have hd2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := by - have h := (Real.hasDerivAt_rpow_const hxne2 : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) - ((p - 1) * x ^ ((p - 1) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := + (Real.hasDerivAt_rpow_const hxne2).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hd : HasDerivAt g (alpha p * ((1 - pStar p / 2) * (p * x ^ (p - 1)) + (pStar p * y / 2) * ((p - 1) * x ^ (p - 2)))) x := by - dsimp [g] - have hsum := - ((hd1.const_mul (1 - pStar p / 2)).add - (hd2.const_mul (pStar p * y / 2))).const_mul (alpha p) - simpa [mul_add, mul_assoc, mul_left_comm, mul_comm] using hsum + dsimp only [g] + refine (((hd1.const_mul (1 - pStar p / 2)).add (hd2.const_mul + (pStar p * y / 2))).const_mul (alpha p)).congr_deriv ?_ + ring have hpow : x ^ (p - 1) = x ^ (p - 2) * x := by calc x ^ (p - 1) = x ^ ((p - 2) + (1 : ℝ)) := by ring_nf @@ -1957,7 +2010,7 @@ private lemma deriv_DxuA1Fun_x_nonpos_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) (x y : ℝ) (hx : 0 < x) (hxy : 0 ≤ x + y) : deriv (fun t => DxuA1Fun p (t, y)) x ≤ 0 := by - have hpden_ne : p - 1 ≠ 0 := by linarith + have hpden_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 have hEq : (fun t => DxuA1Fun p (t, y)) =ᶠ[nhds x] fun t => alpha p * (p / 2) * t ^ (p - 2) * @@ -1968,17 +2021,13 @@ private lemma deriv_DxuA1Fun_x_nonpos_leTwo have hxne : x ≠ 0 := by linarith have hxne_pow : x ≠ 0 ∨ 1 ≤ p - 2 := Or.inl hxne have hpow : - HasDerivAt (fun t : ℝ => t ^ (p - 2)) ((p - 2) * x ^ (p - 3)) x := by - have h := (Real.hasDerivAt_rpow_const hxne_pow : - HasDerivAt (fun t : ℝ => t ^ (p - 2)) - ((p - 2) * x ^ ((p - 2) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -2) = p + -3 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 2)) ((p - 2) * x ^ (p - 3)) x := + (Real.hasDerivAt_rpow_const hxne_pow).congr_deriv (by rw [show p - 2 - 1 = p - 3 by ring]) have hlin : HasDerivAt (fun t : ℝ => ((p - 2) / (p - 1)) * t + y) - ((p - 2) / (p - 1)) x := by - simpa using - ((hasDerivAt_id x).const_mul ((p - 2) / (p - 1))).const_add y + ((p - 2) / (p - 1)) x := + (((hasDerivAt_id' (x := x)).const_mul ((p - 2) / (p - 1))).add_const y).congr_deriv + (mul_one _) have hd : HasDerivAt (fun t : ℝ => alpha p * (p / 2) * t ^ (p - 2) * @@ -2006,7 +2055,7 @@ private lemma deriv_DxuA1Fun_x_nonpos_leTwo ring rw [hEq.deriv_eq, hderiv] have ha : 0 ≤ alpha p := alpha_nonneg_of_one_lt_of_lt_two p hp1 hp2 - have hp_nonneg : 0 ≤ p / 2 := by linarith + have hp_nonneg : 0 ≤ p / 2 := half_p_nonneg_of_one_lt p hp1 have hp2_nonpos : p - 2 ≤ 0 := by linarith have hpow_nonneg : 0 ≤ x ^ (p - 3) := Real.rpow_nonneg hx.le _ have hmain : @@ -2094,29 +2143,25 @@ private lemma vLeTwo_A2_second_bracket_nonpos_leTwo ((x + y) / 2) ^ (p - 2) - coeffLeTwo p * ((x - y) / 2) ^ (p - 2) ≤ 0 := by rcases hA2 with ⟨hx, hay, hyx⟩ - have hp_pos : 0 < p := by linarith - have hpden_pos : 0 < p - 1 := by linarith + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have hpden_pos : 0 < p - 1 := sub_one_pos_of_one_lt p hp1 have hpden_nonneg : 0 ≤ p - 1 := le_of_lt hpden_pos - have hpden_le_one : p - 1 ≤ 1 := by linarith - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) hp_pos + have hpden_le_one : p - 1 ≤ 1 := sub_one_le_one_of_lt_two p hp2 + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hy_pos : 0 < y := lt_trans (mul_pos ha_pos hx) hay - have hsum_pos : 0 < (x + y) / 2 := by linarith + have hsum_pos : 0 < (x + y) / 2 := by positivity have hdiff_pos : 0 < (x - y) / 2 := by linarith have ha_eq : a p = (2 - p) / p := a_eq_leTwo p hp1 hp2 have hC_le : ((x - y) / 2) / (p - 1) ≤ (x + y) / 2 := by have hmain : (2 - p) * x ≤ p * y := by have hmul := mul_le_mul_of_nonneg_left (le_of_lt hay) hp_pos.le - rw [ha_eq] at hmul - field_simp [hp_pos.ne'] at hmul - linarith + rwa [ha_eq, ← mul_assoc, mul_div_cancel₀ (2 - p) hp_pos.ne'] at hmul rw [div_le_iff₀ hpden_pos] - nlinarith + linarith have hC_pos : 0 < ((x - y) / 2) / (p - 1) := div_pos hdiff_pos hpden_pos - have hexp_neg : p - 2 < 0 := by linarith + have hexp_neg : p - 2 < 0 := sub_two_neg_of_lt_two p hp2 have hpow_le : ((x + y) / 2) ^ (p - 2) ≤ (((x - y) / 2) / (p - 1)) ^ (p - 2) := by @@ -2138,14 +2183,13 @@ private lemma vLeTwo_A2_second_bracket_nonpos_leTwo have hcoeff : coeffLeTwo p = (p - 1) ^ (-p) := by rw [coeffLeTwo] exact (Real.rpow_neg_eq_inv_rpow (p - 1) p).symm - simpa [hcoeff] using hpow + rw [hcoeff] + exact hpow have hright : (((x - y) / 2) / (p - 1)) ^ (p - 2) ≤ coeffLeTwo p * ((x - y) / 2) ^ (p - 2) := by - rw [hsplit] - have hB_nonneg : 0 ≤ ((x - y) / 2) ^ (p - 2) := - Real.rpow_nonneg hdiff_pos.le _ - nlinarith [mul_le_mul_of_nonneg_left hcoeff_pow hB_nonneg] + rw [hsplit, mul_comm] + exact mul_le_mul_of_nonneg_right hcoeff_pow (Real.rpow_nonneg hdiff_pos.le _) linarith private lemma deriv_DxvLeTwo_x_nonpos_leTwo @@ -2153,12 +2197,10 @@ private lemma deriv_DxvLeTwo_x_nonpos_leTwo (hA2 : A2 p x y) : deriv (fun t => DxvLeTwo p t y) x ≤ 0 := by rcases hA2 with ⟨hx, hay, hyx⟩ - have hp_pos : 0 < p := by linarith - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) hp_pos + have hp_pos : 0 < p := p_pos_of_one_lt p hp1 + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hy_pos : 0 < y := lt_trans (mul_pos ha_pos hx) hay - have hsum : 0 < (x + y) / 2 := by linarith + have hsum : 0 < (x + y) / 2 := by positivity have hdiff : 0 < (x - y) / 2 := by linarith have hEq : (fun t => DxvLeTwo p t y) =ᶠ[nhds x] @@ -2175,41 +2217,21 @@ private lemma deriv_DxvLeTwo_x_nonpos_leTwo have htpos : 0 < t := by simpa using ht simp [DxvLeTwo, htpos, abs_of_pos htsum, abs_of_pos htdiff] have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => ((t + y) / 2) ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2))) ((x + y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x + y) / 2) ^ ((p - 1) - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp x hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) x := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hpow_diff : HasDerivAt (fun t : ℝ => ((t - y) / 2) ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2))) ((x - y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x - y) / 2) ^ ((p - 1) - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp x hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (1 / 2)) x := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hd : HasDerivAt (fun t : ℝ => @@ -2252,35 +2274,19 @@ private lemma hasDerivAt_vLeTwo_x_of_pos_leTwo (p : ℝ) (x y : ℝ) filter_upwards [hsum_nhds, hdiff_nhds] with t ht_sum ht_diff simp [vLeTwo, g, abs_of_pos ht_sum, abs_of_pos ht_diff] have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => ((t + y) / 2) ^ p) - (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun s : ℝ => s ^ p) (p * (((x + y) / 2) ^ (p - 1))) ((x + y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun s : ℝ => s ^ p) (p * ((x + y) / 2) ^ (p - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp x hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) x := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun t : ℝ => ((t - y) / 2) ^ p) - (p * (((x - y) / 2) ^ (p - 1)) * (1 / 2)) x := by - have hrpow : - HasDerivAt (fun s : ℝ => s ^ p) (p * (((x - y) / 2) ^ (p - 1))) ((x - y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun s : ℝ => s ^ p) (p * ((x - y) / 2) ^ (p - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp x hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x - y) / 2) ^ (p - 1)) * (1 / 2)) x := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv (by ring) have hd : HasDerivAt g (((x + y) / 2) ^ (p - 1) * (p / 2) - @@ -2354,7 +2360,7 @@ private lemma vLeTwo_tangent_x_on_Icc_of_A2_leTwo (hderiv : HasDerivAt (fun t => vLeTwo p t y) (DxvLeTwo p x y) x) : vLeTwo p z y ≤ vLeTwo p x y + DxvLeTwo p x y * (z - x) := by have hcont : ContinuousOn (fun t => vLeTwo p t y) (Set.Icc lo hi) := by - have hpair : Continuous (fun t : ℝ => (t, y)) := by continuity + have hpair : Continuous (fun t : ℝ => (t, y)) := continuous_id.prodMk continuous_const have hcomp := ((continuous_vLeTwo_leTwo p hp1).comp hpair).continuousOn (s := Set.Icc lo hi) simpa [Function.comp_def] using hcomp @@ -2367,21 +2373,17 @@ private lemma vLeTwo_tangent_x_on_Icc_of_A2_leTwo · intro t ht have hA2 := hA2_int t ht rcases hA2 with ⟨htpos, hlo, hup⟩ - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hy_pos : 0 < y := lt_trans (mul_pos ha_pos htpos) hlo - have hsum : 0 < (t + y) / 2 := by linarith + have hsum : 0 < (t + y) / 2 := by positivity have hdiff : 0 < (t - y) / 2 := by linarith exact (hasDerivAt_vLeTwo_x_of_pos_leTwo p t y hsum hdiff).hasDerivWithinAt · intro t ht have hA2 := hA2_int t ht rcases hA2 with ⟨htpos, hlo, hup⟩ - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hy_pos : 0 < y := lt_trans (mul_pos ha_pos htpos) hlo - have hsum : 0 < (t + y) / 2 := by linarith + have hsum : 0 < (t + y) / 2 := by positivity have hdiff : 0 < (t - y) / 2 := by linarith exact (differentiableAt_DxvLeTwo_x_of_pos_leTwo p t y hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht @@ -2394,9 +2396,7 @@ private lemma DxauxFunction1_A2_boundary_le_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {x y : ℝ} (hy_pos : 0 < y) (hyx : y < x) (hax : a p * x < y) : DxauxFunction1 p (y / a p) y ≤ DxauxFunction1 p x y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 let c : ℝ := y / a p have hac : a p * c = y := by dsimp [c] @@ -2439,14 +2439,12 @@ private lemma DxauxFunction1_A2_boundary_le_leTwo (f' := fun t : ℝ => deriv (fun s => DxvLeTwo p s y) t) (convex_Icc x c) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo x c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo x c := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (t + y) / 2 := by linarith [hx_pos, htIoo.1, hy_pos] have hdiff : 0 < (t - y) / 2 := by linarith [hyx, htIoo.1] exact (differentiableAt_DxvLeTwo_x_of_pos_leTwo p t y hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo x c := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo x c := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * c := mul_lt_mul_of_pos_left htIoo.2 ha_pos simpa [hac] using hmul @@ -2463,9 +2461,7 @@ private lemma DxauxFunction1_A1_le_boundary_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {x y : ℝ} (hy_pos : 0 < y) (hyx : y < x) (hay : y < a p * x) : DxauxFunction1 p x y ≤ DxauxFunction1 p (y / a p) y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 let c : ℝ := y / a p have hac : a p * c = y := by dsimp [c] @@ -2499,13 +2495,11 @@ private lemma DxauxFunction1_A1_le_boundary_leTwo (f' := fun t : ℝ => deriv (fun s => DxuA1Fun p (s, y)) t) (convex_Icc c x) hcont ?_ ?_ · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht exact (differentiableAt_DxuA1Fun_x_of_pos_leTwo p t y (lt_trans hc_pos htIoo.1)).hasDerivAt.hasDerivWithinAt · intro t ht - have htIoo : t ∈ Set.Ioo c x := by - simpa [interior_Icc] using ht + have htIoo : t ∈ Set.Ioo c x := mem_Ioo_of_mem_interior_Icc ht exact deriv_DxuA1Fun_x_nonpos_leTwo p hp1 hp2 t y (lt_trans hc_pos htIoo.1) (by linarith [hy_pos, lt_trans hc_pos htIoo.1]) have hc_mem : c ∈ Set.Icc c x := ⟨le_rfl, hcx.le⟩ @@ -2529,35 +2523,19 @@ private lemma hasDerivAt_vLeTwo_y_of_pos_leTwo (p : ℝ) (x y : ℝ) filter_upwards [hsum_nhds, hdiff_nhds] with s hs_sum hs_diff simp [vLeTwo, g, abs_of_pos hs_sum, abs_of_pos hs_diff] have hbase_sum : - HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun s : ℝ => ((x + s) / 2) ^ p) - (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) y := by - have hrpow : - HasDerivAt (fun t : ℝ => t ^ p) (p * (((x + y) / 2) ^ (p - 1))) ((x + y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun t : ℝ => t ^ p) (p * ((x + y) / 2) ^ (p - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp y hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x + y) / 2) ^ (p - 1)) * (1 / 2)) y := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv (by ring) have hpow_diff : HasDerivAt (fun s : ℝ => ((x - s) / 2) ^ p) - (p * (((x - y) / 2) ^ (p - 1)) * (-(1 / 2))) y := by - have hrpow : - HasDerivAt (fun t : ℝ => t ^ p) (p * (((x - y) / 2) ^ (p - 1))) ((x - y) / 2) := by - simpa using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun t : ℝ => t ^ p) (p * ((x - y) / 2) ^ (p - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp y hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + (p * (((x - y) / 2) ^ (p - 1)) * (-(1 / 2))) y := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv (by ring) have hd : HasDerivAt g (((x + y) / 2) ^ (p - 1) * (p / 2) + @@ -2618,9 +2596,7 @@ private lemma deriv_DyvLeTwo_y_nonpos_leTwo deriv (fun s => DyvLeTwo p x s) y ≤ 0 := by rcases hA2 with ⟨hx, hay, hyx⟩ have hsum : 0 < (x + y) / 2 := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hy_pos : 0 < y := lt_trans (mul_pos ha_pos hx) hay linarith have hdiff : 0 < (x - y) / 2 := by linarith @@ -2638,41 +2614,21 @@ private lemma deriv_DyvLeTwo_y_nonpos_leTwo filter_upwards [hsum_nhds, hdiff_nhds] with s hssum hsdiff simp [DyvLeTwo, hx, abs_of_pos hssum, abs_of_pos hsdiff] have hbase_sum : - HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun s : ℝ => ((x + s) / 2) ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) y := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x + y) / 2) ^ (p - 2))) ((x + y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hsum)) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x + y) / 2) ^ ((p - 1) - 1)) ((x + y) / 2)) - have hcomp := hrpow.comp y hbase_sum - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x + y) / 2) ^ (p - 2)) * (1 / 2)) y := + (hbase_sum.rpow_const (Or.inl (ne_of_gt hsum))).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hpow_diff : HasDerivAt (fun s : ℝ => ((x - s) / 2) ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (-(1 / 2))) y := by - have hrpow : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * (((x - y) / 2) ^ (p - 2))) ((x - y) / 2) := by - simpa [sub_eq_add_neg, add_assoc, add_left_comm, add_comm, - show p + (-1 + -1) = p + -2 by ring] using - (Real.hasDerivAt_rpow_const (Or.inl (ne_of_gt hdiff)) : - HasDerivAt (fun u : ℝ => u ^ (p - 1)) - ((p - 1) * ((x - y) / 2) ^ ((p - 1) - 1)) ((x - y) / 2)) - have hcomp := hrpow.comp y hbase_diff - simp only [Function.comp_def] at hcomp - convert hcomp using 2 + ((p - 1) * (((x - y) / 2) ^ (p - 2)) * (-(1 / 2))) y := + (hbase_diff.rpow_const (Or.inl (ne_of_gt hdiff))).congr_deriv + (by rw [show p - 1 - 1 = p - 2 by ring]; ring) have hd : HasDerivAt (fun s : ℝ => @@ -2707,7 +2663,7 @@ private lemma vLeTwo_tangent_y_on_Icc_of_A2_leTwo (hderiv : HasDerivAt (fun t => vLeTwo p x t) (DyvLeTwo p x y) y) : vLeTwo p x z ≤ vLeTwo p x y + DyvLeTwo p x y * (z - y) := by have hcont : ContinuousOn (fun t => vLeTwo p x t) (Set.Icc lo hi) := by - have hpair : Continuous (fun t : ℝ => (x, t)) := by continuity + have hpair : Continuous (fun t : ℝ => (x, t)) := continuous_const.prodMk continuous_id have hcomp := ((continuous_vLeTwo_leTwo p hp1).comp hpair).continuousOn (s := Set.Icc lo hi) simpa [Function.comp_def] using hcomp @@ -2719,20 +2675,16 @@ private lemma vLeTwo_tangent_y_on_Icc_of_A2_leTwo · exact hcont · intro t ht rcases hA2_int t ht with ⟨hx, hat, htx⟩ - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ht_pos : 0 < t := lt_trans (mul_pos ha_pos hx) hat - have hsum : 0 < (x + t) / 2 := by linarith + have hsum : 0 < (x + t) / 2 := by positivity have hdiff : 0 < (x - t) / 2 := by linarith exact (hasDerivAt_vLeTwo_y_of_pos_leTwo p x t hsum hdiff).hasDerivWithinAt · intro t ht rcases hA2_int t ht with ⟨hx, hat, htx⟩ - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ht_pos : 0 < t := lt_trans (mul_pos ha_pos hx) hat - have hsum : 0 < (x + t) / 2 := by linarith + have hsum : 0 < (x + t) / 2 := by positivity have hdiff : 0 < (x - t) / 2 := by linarith exact (differentiableAt_DyvLeTwo_y_of_pos_leTwo p x t hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht @@ -2755,13 +2707,11 @@ private lemma uCandidate_tangent_x_on_Q3_A1_segment_leTwo uCandidate p x y + DxuCandidate p x y * (z - x) := by have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hx_lower, by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hax_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hax_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hx_upper hax_lt_y)⟩ have hQz : QuarterPlane3 z y := ⟨hy_pos.le, le_of_lt hz_lower, by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hax_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hax_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hz_upper hax_lt_y)⟩ have hclx : closureA1 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ have hclz : closureA1 p y z := ⟨hy_pos.le, le_of_lt hz_lower, le_of_lt hz_upper⟩ @@ -2876,19 +2826,11 @@ private lemma uCandidate_tangent_x_Q3_A1_to_A2_boundary_leTwo have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hx_lower, by - have haxy_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have haxy_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hx_upper haxy_lt_y)⟩ - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, by - have haxy_le_y : a p * y ≤ y := by - simpa using mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - exact haxy_le_y⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hclx : closureA1 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ - have hclc : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hclc : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hux : uCandidate p x y = uA1 p y x := by rw [uCandidate_eq_Q3_leTwo p hQx] simp [auxFunction1, hclx] @@ -2912,17 +2854,14 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_A2_leTwo uCandidate p z y ≤ uCandidate p (a p * y) y + DxuCandidate p (a p * y) y * (z - a p * y) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_nonneg : 0 ≤ a p := ha_pos.le have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hc_pos : 0 < a p * y := mul_pos ha_pos hy_pos - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by linarith, le_of_lt hc_lt_y⟩ + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hQz : QuarterPlane3 z y := ⟨hy_pos.le, by linarith [hc_pos, hz_lower], le_of_lt hz_upper⟩ - have hclc1 : closureA1 p y (a p * y) := ⟨hy_pos.le, by linarith [hc_pos], le_rfl⟩ + have hclc1 : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hclc2 : closureA2 p y (a p * y) := ⟨hy_pos.le, le_rfl, le_of_lt hc_lt_y⟩ have hclz : closureA2 p y z := ⟨hy_pos.le, le_of_lt hz_lower, le_of_lt hz_upper⟩ have huc : uCandidate p (a p * y) y = vLeTwo p y (a p * y) := by @@ -2949,8 +2888,7 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_A2_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := a p * y) (hi := z) (x := y) (y := a p * y) (z := z) · intro t ht - have htI : t ∈ Set.Ioo (a p * y) z := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (a p * y) z := mem_Ioo_of_mem_interior_Icc ht exact ⟨hy_pos, htI.1, lt_trans htI.2 hz_upper⟩ · exact ⟨le_rfl, le_of_lt hz_lower⟩ · exact ⟨le_of_lt hz_lower, le_rfl⟩ @@ -2978,8 +2916,7 @@ private lemma uCandidate_tangent_x_cross_Q3_A1_to_A2_leTwo have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hx_lower, by - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hx_upper hc_lt_y)⟩ have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le @@ -3009,19 +2946,11 @@ private lemma uCandidate_tangent_x_on_Q1_A2_segment_leTwo (hz_lower : y < z) (hz_upper : z < y / a p) : uCandidate p z y ≤ uCandidate p x y + DxuCandidate p x y * (z - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane x y := ⟨by linarith, le_of_lt hx_lower, by linarith⟩ have hQz : QuarterPlane z y := ⟨by linarith, le_of_lt hz_lower, by linarith⟩ - have hax : a p * x < y := by - have hmul := mul_lt_mul_of_pos_left hx_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul - have haz : a p * z < y := by - have hmul := mul_lt_mul_of_pos_left hz_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hax : a p * x < y := mul_a_lt_of_lt_div_a ha_pos hx_upper + have haz : a p * z < y := mul_a_lt_of_lt_div_a ha_pos hz_upper have hclx : closureA2 p x y := ⟨by linarith, by linarith, le_of_lt hx_lower⟩ have hclz : closureA2 p z y := ⟨by linarith, by linarith, le_of_lt hz_lower⟩ have hnotx : ¬ closureA1 p x y := by @@ -3114,14 +3043,12 @@ private lemma DyvLeTwo_diag_le_DyvLeTwo_Q3_A2_leTwo (f' := fun t : ℝ => deriv (fun s => DyvLeTwo p y s) t) (convex_Icc x y) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo x y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo x y := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (y + t) / 2 := by linarith [hy_pos, hx_pos, htI.1] have hdiff : 0 < (y - t) / 2 := by linarith [htI.2] exact (differentiableAt_DyvLeTwo_y_of_pos_leTwo p y t hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo x y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo x y := mem_Ioo_of_mem_interior_Icc ht exact deriv_DyvLeTwo_y_nonpos_leTwo p hp1 hp2 y t ⟨hy_pos, lt_trans hx_lower htI.1, htI.2⟩ exact hanti ⟨le_rfl, hx_upper.le⟩ ⟨hx_upper.le, le_rfl⟩ hx_upper.le @@ -3130,9 +3057,7 @@ private lemma DyvLeTwo_diag_le_DyvLeTwo_Q3_A2_closed_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {x y : ℝ} (hy_pos : 0 < y) (hx_lower : a p * y ≤ x) (hx_upper : x < y) : DyvLeTwo p y y ≤ DyvLeTwo p y x := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hx_pos : 0 < x := lt_of_lt_of_le (mul_pos ha_pos hy_pos) hx_lower have hanti : AntitoneOn (fun t : ℝ => DyvLeTwo p y t) (Set.Icc x y) := by @@ -3167,14 +3092,12 @@ private lemma DyvLeTwo_diag_le_DyvLeTwo_Q3_A2_closed_leTwo (f' := fun t : ℝ => deriv (fun s => DyvLeTwo p y s) t) (convex_Icc x y) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo x y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo x y := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (y + t) / 2 := by linarith [hy_pos, hx_pos, htI.1] have hdiff : 0 < (y - t) / 2 := by linarith [htI.2] exact (differentiableAt_DyvLeTwo_y_of_pos_leTwo p y t hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo x y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo x y := mem_Ioo_of_mem_interior_Icc ht exact deriv_DyvLeTwo_y_nonpos_leTwo p hp1 hp2 y t ⟨hy_pos, lt_of_le_of_lt hx_lower htI.1, htI.2⟩ exact hanti ⟨le_rfl, hx_upper.le⟩ ⟨hx_upper.le, le_rfl⟩ hx_upper.le @@ -3190,9 +3113,7 @@ private lemma uCandidate_tangent_x_Q3_A2_to_diag_leTwo linarith, le_of_lt hx_upper⟩ have hQy : QuarterPlane3 y y := ⟨hy_pos.le, by linarith, le_rfl⟩ have hclx : closureA2 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, (mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le).trans_eq (one_mul y), le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hux : uCandidate p x y = vLeTwo p y x := by rw [uCandidate_eq_Q3_leTwo p hQx, auxFunction1_eq_vLeTwo_leTwo p hp1 hp2 y x hclx] have huy : uCandidate p y y = vLeTwo p y y := by @@ -3216,8 +3137,7 @@ private lemma uCandidate_tangent_x_Q3_A2_to_diag_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := x) (hi := y) (x := y) (y := x) (z := y) · intro t ht - have htI : t ∈ Set.Ioo x y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo x y := mem_Ioo_of_mem_interior_Icc ht exact ⟨hy_pos, lt_trans hx_lower htI.1, htI.2⟩ · exact ⟨le_rfl, le_of_lt hx_upper⟩ · exact ⟨le_of_lt hx_upper, le_rfl⟩ @@ -3234,21 +3154,15 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_diag_leTwo uCandidate p y y ≤ uCandidate p (a p * y) y + DxuCandidate p (a p * y) y * (y - a p * y) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hc_pos : 0 < a p * y := mul_pos ha_pos hy_pos - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by linarith, le_of_lt hc_lt_y⟩ + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hQy : QuarterPlane3 y y := ⟨hy_pos.le, by linarith, le_rfl⟩ - have hclc1 : closureA1 p y (a p * y) := ⟨hy_pos.le, by linarith [hc_pos], le_rfl⟩ + have hclc1 : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hclc2 : closureA2 p y (a p * y) := ⟨hy_pos.le, le_rfl, le_of_lt hc_lt_y⟩ - have hcly : closureA2 p y y := by - exact ⟨hy_pos.le, by - have h := mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - simpa using h, le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have huc : uCandidate p (a p * y) y = vLeTwo p y (a p * y) := by rw [uCandidate_eq_Q3_leTwo p hQc] rw [auxFunction1_eq_vLeTwo_leTwo p hp1 hp2 y (a p * y) hclc2] @@ -3272,8 +3186,7 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_diag_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := a p * y) (hi := y) (x := y) (y := a p * y) (z := y) · intro t ht - have htI : t ∈ Set.Ioo (a p * y) y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (a p * y) y := mem_Ioo_of_mem_interior_Icc ht exact ⟨hy_pos, htI.1, htI.2⟩ · exact ⟨le_rfl, le_of_lt hc_lt_y⟩ · exact ⟨le_of_lt hc_lt_y, le_rfl⟩ @@ -3294,13 +3207,11 @@ private lemma hasDerivAt_vLeTwo_x_on_diag_pos_leTwo (p : ℝ) (hp1 : 1 < p) ext t simp [vLeTwo, g] have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).add_const (-y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => |((t + y) / 2)| ^ p) (p * (y ^ (p - 2) * y) * (1 / 2)) y := by @@ -3344,28 +3255,16 @@ private lemma uCandidate_tangent_x_diag_to_Q1_A2_leTwo (hy_pos : 0 < y) (hz_lower : y < z) (hz_upper : z < y / a p) : uCandidate p z y ≤ uCandidate p y y + DxuCandidate p y y * (z - y) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos have hQz : QuarterPlane z y := ⟨by linarith, le_of_lt hz_lower, by linarith⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, by - have h := mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - simpa using h, le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hclz : closureA2 p z y := by - have haz : a p * z < y := by - have hmul := mul_lt_mul_of_pos_left hz_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have haz : a p * z < y := mul_a_lt_of_lt_div_a ha_pos hz_upper exact ⟨by linarith, le_of_lt haz, le_of_lt hz_lower⟩ have hnotz : ¬ closureA1 p z y := by intro h - have haz : a p * z < y := by - have hmul := mul_lt_mul_of_pos_left hz_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have haz : a p * z < y := mul_a_lt_of_lt_div_a ha_pos hz_upper exact not_le_of_gt haz h.2.2 have huy : uCandidate p y y = vLeTwo p y y := by rw [uCandidate_eq_Q1_leTwo p hQy, auxFunction1_eq_vLeTwo_leTwo p hp1 hp2 y y hcly] @@ -3383,8 +3282,7 @@ private lemma uCandidate_tangent_x_diag_to_Q1_A2_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := y) (hi := z) (y := y) (x := y) (z := z) · intro t ht - have htI : t ∈ Set.Ioo y z := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y z := mem_Ioo_of_mem_interior_Icc ht have ht_pos : 0 < t := by linarith [hy_pos, htI.1] have hat : a p * t < y := by have hmul : a p * t < a p * (y / a p) := by @@ -3452,35 +3350,17 @@ private lemma uCandidate_tangent_x_on_Q1_A1_segment_leTwo (hz_lower : y / a p < z) : uCandidate p z y ≤ uCandidate p x y + DxuCandidate p x y * (z - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hy_div_pos : 0 < y / a p := div_pos hy_pos ha_pos have hQx : QuarterPlane x y := ⟨by linarith, by - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt (lt_trans hlt hx_lower), by linarith⟩ have hQz : QuarterPlane z y := ⟨by linarith, by - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt (lt_trans hlt hz_lower), by linarith⟩ - have hayx : y < a p * x := by - have hmul := mul_lt_mul_of_pos_left hx_lower ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul - have hayz : y < a p * z := by - have hmul := mul_lt_mul_of_pos_left hz_lower ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hayx : y < a p * x := lt_mul_a_of_div_a_lt ha_pos hx_lower + have hayz : y < a p * z := lt_mul_a_of_div_a_lt ha_pos hz_lower have hclx : closureA1 p x y := ⟨hQx.1, hQx.2.2, le_of_lt hayx⟩ have hclz : closureA1 p z y := ⟨hQz.1, hQz.2.2, le_of_lt hayz⟩ have hux : uCandidate p x y = uA1 p x y := by @@ -3536,32 +3416,16 @@ private lemma uCandidate_tangent_x_Q1_A2_to_boundary_leTwo (hy_pos : 0 < y) (hx_lower : y < x) (hx_upper : x < y / a p) : uCandidate p (y / a p) y ≤ uCandidate p x y + DxuCandidate p x y * (y / a p - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane x y := ⟨by linarith, le_of_lt hx_lower, by linarith⟩ - have hQb : QuarterPlane (y / a p) y := by - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith - exact ⟨(div_pos hy_pos ha_pos).le, le_of_lt hlt, by linarith⟩ + have hQb : QuarterPlane (y / a p) y := quarterPlane_div_a_leTwo p hp1 hp2 hy_pos have hclx : closureA2 p x y := by - have hax : a p * x < y := by - have hmul := mul_lt_mul_of_pos_left hx_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hax : a p * x < y := mul_a_lt_of_lt_div_a ha_pos hx_upper exact ⟨by linarith, le_of_lt hax, le_of_lt hx_lower⟩ have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos have hnotx : ¬ closureA1 p x y := by intro h - have hax : a p * x < y := by - have hmul := mul_lt_mul_of_pos_left hx_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hax : a p * x < y := mul_a_lt_of_lt_div_a ha_pos hx_upper exact not_le_of_gt hax h.2.2 have hux : uCandidate p x y = vLeTwo p x y := by rw [uCandidate_eq_Q1_leTwo p hQx] @@ -3582,8 +3446,7 @@ private lemma uCandidate_tangent_x_Q1_A2_to_boundary_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := x) (hi := y / a p) (x := x) (z := y / a p) (y := y) · intro t ht - have htI : t ∈ Set.Ioo x (y / a p) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo x (y / a p) := mem_Ioo_of_mem_interior_Icc ht have ht_pos : 0 < t := by linarith [hy_pos, hx_lower, htI.1] have hat : a p * t < y := by have hmul : a p * t < a p * (y / a p) := @@ -3606,27 +3469,16 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_A1_leTwo uCandidate p z y ≤ uCandidate p (y / a p) y + DxuCandidate p (y / a p) y * (z - y / a p) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hb_pos : 0 < y / a p := div_pos hy_pos ha_pos - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith - have hQb : QuarterPlane (y / a p) y := - ⟨hb_pos.le, le_of_lt hy_lt_b, by linarith⟩ + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos + have hQb : QuarterPlane (y / a p) y := quarterPlane_div_a_leTwo p hp1 hp2 hy_pos have hQz : QuarterPlane z y := ⟨by linarith, le_of_lt (lt_trans hy_lt_b hz_lower), by linarith⟩ have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos have hclz : closureA1 p z y := by - have hayz : y < a p * z := by - have hmul := mul_lt_mul_of_pos_left hz_lower ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hayz : y < a p * z := lt_mul_a_of_div_a_lt ha_pos hz_lower exact ⟨hQz.1, hQz.2.2, le_of_lt hayz⟩ have hub : uCandidate p (y / a p) y = uA1 p (y / a p) y := by rw [uCandidate_eq_Q1_leTwo p hQb] @@ -3646,8 +3498,7 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_A1_leTwo · intro t ht exact lt_of_lt_of_le hb_pos ht.1 · intro t ht - have htI : t ∈ Set.Ioo (y / a p) z := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (y / a p) z := mem_Ioo_of_mem_interior_Icc ht linarith [hy_pos, hb_pos, htI.1] · exact ⟨le_rfl, le_of_lt hz_lower⟩ · exact ⟨le_of_lt hz_lower, le_rfl⟩ @@ -3671,23 +3522,13 @@ private lemma uCandidate_tangent_x_cross_Q1_A2_to_A1_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (z := z) (y := y) hy_pos hz_lower have hd : DxuCandidate p (y / a p) y ≤ DxuCandidate p x y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane x y := ⟨by linarith, le_of_lt hx_lower, by linarith⟩ have hQb : QuarterPlane (y / a p) y := by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact ⟨(div_pos hy_pos ha_pos).le, le_of_lt hy_lt_b, by linarith⟩ - have hax : a p * x < y := by - have hmul := mul_lt_mul_of_pos_left hx_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hax : a p * x < y := mul_a_lt_of_lt_div_a ha_pos hx_upper have hdx := DxauxFunction1_A2_boundary_le_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (x := x) (y := y) hy_pos hx_lower hax @@ -3705,9 +3546,7 @@ private lemma uCandidate_tangent_x_forward_on_Q1_leTwo (hy_pos : 0 < y) (hyx : y < x) (hxz : x ≤ z) : uCandidate p z y ≤ uCandidate p x y + DxuCandidate p x y * (z - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 let b : ℝ := y / a p by_cases hxb : x < b · rcases lt_trichotomy z b with hzb | hzb | hbz @@ -3818,8 +3657,7 @@ private lemma uCandidate_tangent_x_Q2_to_antidiag_leTwo · intro t ht exact lt_of_lt_of_le hy_pos ht.1 · intro t ht - have htI : t ∈ Set.Ioo y (-x) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y (-x) := mem_Ioo_of_mem_interior_Icc ht linarith [htI.1] · exact ⟨le_of_lt (by linarith), le_rfl⟩ · exact ⟨le_rfl, le_of_lt (by linarith)⟩ @@ -3839,8 +3677,7 @@ private lemma uCandidate_tangent_x_antidiag_to_Q3_A1_leTwo have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ have hQz : QuarterPlane3 z y := ⟨hy_pos.le, le_of_lt hz_lower, by - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hz_upper hc_lt_y)⟩ have hcla : closureA1 p y (-y) := by refine ⟨hy_pos.le, le_rfl, ?_⟩ @@ -3878,19 +3715,12 @@ private lemma uCandidate_tangent_x_antidiag_to_Q3_A1_boundary_leTwo have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, by - have hc_le_y : a p * y ≤ y := by - simpa using mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - exact hc_le_y⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hcla : closureA1 p y (-y) := by refine ⟨hy_pos.le, le_rfl, ?_⟩ have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith - have hclc : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hclc : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hua : uCandidate p (-y) y = uA1 p y (-y) := by rw [uCandidate_eq_Q2_leTwo p hQa] simp [auxFunction1, hcla] @@ -3958,13 +3788,11 @@ private lemma DxuCandidate_antidiag_le_Q2_leTwo (f' := fun t : ℝ => deriv (fun s => DxuA1Fun p (s, -y)) t) (convex_Icc y (-x)) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo y (-x) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y (-x) := mem_Ioo_of_mem_interior_Icc ht exact (differentiableAt_DxuA1Fun_x_of_pos_leTwo p t (-y) (lt_trans hy_pos htI.1)).hasDerivAt.hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo y (-x) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y (-x) := mem_Ioo_of_mem_interior_Icc ht exact deriv_DxuA1Fun_x_nonpos_leTwo p hp1 hp2 t (-y) (lt_trans hy_pos htI.1) (by linarith [htI.1]) have hy_mem : y ∈ Set.Icc y (-x) := ⟨le_rfl, le_of_lt (by linarith)⟩ @@ -4019,15 +3847,8 @@ private lemma DxuCandidate_Q3_A1_boundary_le_Q2_leTwo DxuCandidate p (a p * y) y ≤ DxuCandidate p x y := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, by - have hc_le_y : a p * y ≤ y := by - simpa using mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - exact hc_le_y⟩ - have hclc : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos + have hclc : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hdc : DxuCandidate p (a p * y) y = DyuA1 p y (a p * y) := by rw [DxuCandidate_eq_Q3_leTwo p hp1 hp2 hQc] simp [DyauxFunction1, hclc] @@ -4059,15 +3880,8 @@ private lemma DxuCandidate_Q3_A1_boundary_eq_antidiag_leTwo DxuCandidate p (a p * y) y = DxuCandidate p (-y) y := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, by - have hc_le_y : a p * y ≤ y := by - simpa using mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - exact hc_le_y⟩ - have hclc : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos + have hclc : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hdc : DxuCandidate p (a p * y) y = DyuA1 p y (a p * y) := by rw [DxuCandidate_eq_Q3_leTwo p hp1 hp2 hQc] simp [DyauxFunction1, hclc] @@ -4132,8 +3946,7 @@ private lemma uCandidate_tangent_x_antidiag_to_diag_leTwo have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) hac hcy hd private lemma uCandidate_tangent_x_cross_Q2_to_Q3_A2_leTwo @@ -4178,8 +3991,7 @@ private lemma uCandidate_tangent_x_Q2_to_diag_leTwo have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) hxc hcy hd private lemma DxuCandidate_diag_le_Q2_leTwo @@ -4188,8 +4000,7 @@ private lemma DxuCandidate_diag_le_Q2_leTwo DxuCandidate p y y ≤ DxuCandidate p x y := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt have hdiag_a2 : DxuCandidate p y y ≤ DxuCandidate p (a p * y) y := by have hQd : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ @@ -4260,9 +4071,7 @@ private lemma DxuCandidate_Q1_boundary_le_diag_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} (hy_pos : 0 < y) : DxuCandidate p (y / a p) y ≤ DxuCandidate p y y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 let b : ℝ := y / a p have hb_pos : 0 < b := by @@ -4278,17 +4087,12 @@ private lemma DxuCandidate_Q1_boundary_le_diag_leTwo rw [one_lt_inv₀ ha_pos] exact ha_lt nlinarith - have hQd : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ + have hQd : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos have hQb : QuarterPlane b y := ⟨hb_pos.le, le_of_lt hy_lt_b, by linarith⟩ - have hcld : closureA2 p y y := by - refine ⟨hy_pos.le, ?_, le_rfl⟩ - have hle : a p * y ≤ y := by - exact (mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le).trans_eq (one_mul y) - exact hle + have hcld : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hnotd : ¬ closureA1 p y y := by intro h - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact not_le_of_gt hlt h.2.2 have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos have hdd : DxuCandidate p y y = DxvLeTwo p y y := by @@ -4338,14 +4142,12 @@ private lemma DxuCandidate_Q1_boundary_le_diag_leTwo (f' := fun t : ℝ => deriv (fun s => DxvLeTwo p s y) t) (convex_Icc y b) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo y b := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y b := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (t + y) / 2 := by linarith [hy_pos, htI.1] have hdiff : 0 < (t - y) / 2 := by linarith [htI.1] exact (differentiableAt_DxvLeTwo_x_of_pos_leTwo p t y hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo y b := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y b := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have hmul : a p * t < a p * b := mul_lt_mul_of_pos_left htI.2 ha_pos simpa [hab] using hmul @@ -4376,26 +4178,15 @@ private lemma uCandidate_tangent_x_diag_to_Q1_boundary_leTwo (hy_pos : 0 < y) : uCandidate p (y / a p) y ≤ uCandidate p y y + DxuCandidate p y y * (y / a p - y) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hQb : QuarterPlane (y / a p) y := - ⟨(div_pos hy_pos ha_pos).le, le_of_lt hy_lt_b, by linarith⟩ - have hcl_y : closureA2 p y y := by - refine ⟨hy_pos.le, ?_, le_rfl⟩ - exact (mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le).trans_eq (one_mul y) + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos + have hQb : QuarterPlane (y / a p) y := quarterPlane_div_a_leTwo p hp1 hp2 hy_pos + have hcl_y : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hnot_y : ¬ closureA1 p y y := by intro h - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact not_le_of_gt hlt h.2.2 have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos have huy : uCandidate p y y = vLeTwo p y y := by @@ -4415,8 +4206,7 @@ private lemma uCandidate_tangent_x_diag_to_Q1_boundary_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := y) (hi := y / a p) (x := y) (z := y / a p) (y := y) · intro t ht - have htI : t ∈ Set.Ioo y (y / a p) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y (y / a p) := mem_Ioo_of_mem_interior_Icc ht have hat : a p * t < y := by have hmul : a p * t < a p * (y / a p) := mul_lt_mul_of_pos_left htI.2 ha_pos @@ -4437,16 +4227,9 @@ private lemma uCandidate_tangent_x_Q2_to_Q1_boundary_leTwo (hy_pos : 0 < y) (hx_left : x < -y) : uCandidate p (y / a p) y ≤ uCandidate p x y + DxuCandidate p x y * (y / a p - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos have hxy := uCandidate_tangent_x_Q2_to_diag_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (x := x) (y := y) hy_pos hx_left @@ -4477,16 +4260,9 @@ private lemma uCandidate_tangent_x_cross_Q2_to_Q1_A1_leTwo exact tangent_glue_two_forward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos linarith) (le_of_lt hz_lower) hxb hbz hd @@ -4497,19 +4273,11 @@ private lemma DxuCandidate_Q3_A1_boundary_le_Q3_A1_leTwo have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hx_lower, by - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hx_upper hc_lt_y)⟩ - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, by - have hle : a p * y ≤ y := by - simpa using mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - exact hle⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hclx : closureA1 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ - have hclc : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hclc : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hdx : DxuCandidate p x y = DyuA1 p y x := by rw [DxuCandidate_eq_Q3_leTwo p hp1 hp2 hQx] simp [DyauxFunction1, hclx] @@ -4525,19 +4293,14 @@ private lemma DxuCandidate_diag_le_Q3_A1_boundary_leTwo DxuCandidate p y y ≤ DxuCandidate p (a p * y) y := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hQd : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_of_lt hc_lt_y⟩ - have hcld : closureA2 p y y := ⟨hy_pos.le, le_of_lt hc_lt_y, le_rfl⟩ + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hQd : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos + have hcld : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hnotd : ¬ closureA1 p y y := by intro h exact not_le_of_gt hc_lt_y h.2.2 - have hclc1 : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hclc1 : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hdd : DxuCandidate p y y = DxvLeTwo p y y := by rw [DxuCandidate_eq_Q1_leTwo p hQd] simp [DxauxFunction1, hnotd, hcld] @@ -4616,12 +4379,8 @@ private lemma DxuCandidate_diag_le_Q3_A2_leTwo have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have haxy_nonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith, le_of_lt hx_upper⟩ - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, by - have h := mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - simpa using h, le_rfl⟩ + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hclx : closureA2 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ have hdx : DxuCandidate p x y = DyvLeTwo p y x := by rw [DxuCandidate_eq_Q3_leTwo p hp1 hp2 hQx] @@ -4682,16 +4441,9 @@ private lemma uCandidate_tangent_x_antidiag_to_Q1_boundary_leTwo exact tangent_glue_two_forward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by linarith) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt hlt) hxy hyb hd private lemma uCandidate_tangent_x_antidiag_to_Q1_A1_leTwo @@ -4709,16 +4461,9 @@ private lemma uCandidate_tangent_x_antidiag_to_Q1_A1_leTwo exact tangent_glue_two_forward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos linarith) (le_of_lt hz_lower) hxb hbz hd @@ -4739,8 +4484,7 @@ private lemma uCandidate_tangent_x_Q3_A1_to_diag_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hx_upper) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) hxc hcy hd private lemma uCandidate_tangent_x_Q3_A1_to_Q1_A2_leTwo @@ -4762,8 +4506,7 @@ private lemma uCandidate_tangent_x_Q3_A1_to_Q1_A2_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt linarith) (le_of_lt hz_lower) hxy hyz hd private lemma uCandidate_tangent_x_Q3_A1_to_Q1_boundary_leTwo @@ -4783,19 +4526,11 @@ private lemma uCandidate_tangent_x_Q3_A1_to_Q1_boundary_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt linarith) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt hlt) hxy hyb hd private lemma uCandidate_tangent_x_Q3_A1_to_Q1_A1_leTwo @@ -4816,19 +4551,11 @@ private lemma uCandidate_tangent_x_Q3_A1_to_Q1_A1_leTwo exact tangent_glue_two_forward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hlt : a p * y < y / a p := by - have hay : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hyb : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hay : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hyb : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos linarith linarith) (le_of_lt hz_lower) hxb hbz hd @@ -4849,16 +4576,9 @@ private lemma uCandidate_tangent_x_Q3_A2_to_Q1_boundary_leTwo exact tangent_glue_two_forward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hx_upper) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt hlt) hxy hyb hd private lemma uCandidate_tangent_x_Q3_A2_to_Q1_A1_leTwo @@ -4879,16 +4599,9 @@ private lemma uCandidate_tangent_x_Q3_A2_to_Q1_A1_leTwo exact tangent_glue_two_forward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos linarith) (le_of_lt hz_lower) hxb hbz hd @@ -4909,8 +4622,7 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_Q1_A2_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) (le_of_lt hz_lower) hcy hyz hd @@ -4930,20 +4642,12 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_Q1_boundary_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt hlt) hcy hyb hd private lemma uCandidate_tangent_x_Q3_A2_boundary_to_Q1_A1_leTwo @@ -4966,18 +4670,10 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_Q1_A1_leTwo exact tangent_glue_two_forward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt1 : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hlt2 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt1 : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hlt2 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos linarith) (le_of_lt hz_lower) hcb hbz hd @@ -4986,16 +4682,9 @@ private lemma uCandidate_tangent_x_forward_of_y_pos_right_leTwo (hy_pos : 0 < y) (hxz : x < z) (hx_left : ¬ x < -y) : uCandidate p z y ≤ uCandidate p x y + DxuCandidate p x y * (z - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos have hxa_le : -y ≤ x := le_of_not_gt hx_left rcases hxa_le.lt_or_eq with hxa | hxa_eq · by_cases hx_c : x < a p * y @@ -5206,27 +4895,16 @@ private lemma uCandidate_tangent_x_Q1_A1_to_boundary_leTwo (hy_pos : 0 < y) (hx_lower : y / a p < x) : uCandidate p (y / a p) y ≤ uCandidate p x y + DxuCandidate p x y * (y / a p - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hb_pos : 0 < y / a p := div_pos hy_pos ha_pos - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos have hQx : QuarterPlane x y := ⟨by linarith, le_of_lt (lt_trans hy_lt_b hx_lower), by linarith⟩ - have hQb : QuarterPlane (y / a p) y := - ⟨hb_pos.le, le_of_lt hy_lt_b, by linarith⟩ + have hQb : QuarterPlane (y / a p) y := quarterPlane_div_a_leTwo p hp1 hp2 hy_pos have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos have hclx : closureA1 p x y := by - have hay : y < a p * x := by - have hmul := mul_lt_mul_of_pos_left hx_lower ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hay : y < a p * x := lt_mul_a_of_div_a_lt ha_pos hx_lower exact ⟨by linarith, by linarith, le_of_lt hay⟩ have hux : uCandidate p x y = uA1 p x y := by rw [uCandidate_eq_Q1_leTwo p hQx] @@ -5246,8 +4924,7 @@ private lemma uCandidate_tangent_x_Q1_A1_to_boundary_leTwo · intro t ht exact lt_of_lt_of_le hb_pos ht.1 · intro t ht - have htI : t ∈ Set.Ioo (y / a p) x := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (y / a p) x := mem_Ioo_of_mem_interior_Icc ht linarith [hy_pos, hb_pos, htI.1] · exact ⟨le_of_lt hx_lower, le_rfl⟩ · exact ⟨le_rfl, le_of_lt hx_lower⟩ @@ -5262,21 +4939,12 @@ private lemma uCandidate_tangent_x_Q1_A2_to_diag_leTwo (hy_pos : 0 < y) (hx_lower : y < x) (hx_upper : x < y / a p) : uCandidate p y y ≤ uCandidate p x y + DxuCandidate p x y * (y - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane x y := ⟨by linarith, le_of_lt hx_lower, by linarith⟩ - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hax : a p * x < y := by - have hmul := mul_lt_mul_of_pos_left hx_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos + have hax : a p * x < y := mul_a_lt_of_lt_div_a ha_pos hx_upper have hclx : closureA2 p x y := ⟨by linarith, le_of_lt hax, le_of_lt hx_lower⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, by - have h := mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - simpa using h, le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hnotx : ¬ closureA1 p x y := by intro h exact not_le_of_gt hax h.2.2 @@ -5298,8 +4966,7 @@ private lemma uCandidate_tangent_x_Q1_A2_to_diag_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := y) (hi := x) (x := x) (z := y) (y := y) · intro t ht - have htI : t ∈ Set.Ioo y x := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y x := mem_Ioo_of_mem_interior_Icc ht have ht_pos : 0 < t := by linarith [hy_pos, htI.1] have hat : a p * t < y := by have ht_div : t < y / a p := lt_trans htI.2 hx_upper @@ -5322,33 +4989,19 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_A2_leTwo uCandidate p z y ≤ uCandidate p (y / a p) y + DxuCandidate p (y / a p) y * (z - y / a p) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hb_pos : 0 < y / a p := div_pos hy_pos ha_pos - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith - have hQb : QuarterPlane (y / a p) y := - ⟨hb_pos.le, le_of_lt hy_lt_b, by linarith⟩ + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos + have hQb : QuarterPlane (y / a p) y := quarterPlane_div_a_leTwo p hp1 hp2 hy_pos have hQz : QuarterPlane z y := ⟨by linarith, le_of_lt hz_lower, by linarith⟩ have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos have hclz : closureA2 p z y := by - have haz : a p * z < y := by - have hmul := mul_lt_mul_of_pos_left hz_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have haz : a p * z < y := mul_a_lt_of_lt_div_a ha_pos hz_upper exact ⟨by linarith, le_of_lt haz, le_of_lt hz_lower⟩ have hnotz : ¬ closureA1 p z y := by intro h - have haz : a p * z < y := by - have hmul := mul_lt_mul_of_pos_left hz_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have haz : a p * z < y := mul_a_lt_of_lt_div_a ha_pos hz_upper exact not_le_of_gt haz h.2.2 have hub : uCandidate p (y / a p) y = vLeTwo p (y / a p) y := by rw [uCandidate_eq_Q1_leTwo p hQb, @@ -5371,8 +5024,7 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_A2_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := z) (hi := y / a p) (x := y / a p) (z := z) (y := y) · intro t ht - have htI : t ∈ Set.Ioo z (y / a p) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo z (y / a p) := mem_Ioo_of_mem_interior_Icc ht have ht_pos : 0 < t := by linarith [hy_pos, hz_lower, htI.1] have hat : a p * t < y := by have hmul : a p * t < a p * (y / a p) := @@ -5403,23 +5055,13 @@ private lemma uCandidate_tangent_x_Q1_A1_to_A2_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (z := z) (y := y) hy_pos hz_lower hz_upper have hd : DxuCandidate p x y ≤ DxuCandidate p (y / a p) y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane x y := by - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact ⟨by linarith, le_of_lt (lt_trans hy_lt_b hx_lower), by linarith⟩ have hclx : closureA1 p x y := by - have hay : y < a p * x := by - have hmul := mul_lt_mul_of_pos_left hx_lower ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hay : y < a p * x := lt_mul_a_of_div_a_lt ha_pos hx_lower exact ⟨by linarith, by linarith, le_of_lt hay⟩ have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos have hdx : DxuCandidate p x y = DxauxFunction1 p x y := by @@ -5427,23 +5069,13 @@ private lemma uCandidate_tangent_x_Q1_A1_to_A2_leTwo have hdb : DxuCandidate p (y / a p) y = DxauxFunction1 p (y / a p) y := by have hQb : QuarterPlane (y / a p) y := by have hb_pos : 0 < y / a p := div_pos hy_pos ha_pos - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact ⟨hb_pos.le, le_of_lt hy_lt_b, by linarith⟩ rw [DxuCandidate_eq_Q1_leTwo p hQb] have hle := DxauxFunction1_A1_le_boundary_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (x := x) (y := y) hy_pos (by - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos linarith) (by have hmul := mul_lt_mul_of_pos_left hx_lower ha_pos field_simp [ha_pos.ne'] at hmul @@ -5459,25 +5091,14 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_diag_leTwo uCandidate p y y ≤ uCandidate p (y / a p) y + DxuCandidate p (y / a p) y * (y - y / a p) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hb_pos : 0 < y / a p := div_pos hy_pos ha_pos - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith - have hQb : QuarterPlane (y / a p) y := - ⟨hb_pos.le, le_of_lt hy_lt_b, by linarith⟩ - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos + have hQb : QuarterPlane (y / a p) y := quarterPlane_div_a_leTwo p hp1 hp2 hy_pos + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos have hboundary := horizontal_boundary_closureA1_closureA2_leTwo p y hp1 hp2 hy_pos - have hcly : closureA2 p y y := by - exact ⟨hy_pos.le, by - have h := mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - simpa using h, le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hub : uCandidate p (y / a p) y = vLeTwo p (y / a p) y := by rw [uCandidate_eq_Q1_leTwo p hQb, auxFunction1_eq_vLeTwo_leTwo p hp1 hp2 (y / a p) y hboundary.2] @@ -5498,8 +5119,7 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_diag_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := y) (hi := y / a p) (x := y / a p) (z := y) (y := y) · intro t ht - have htI : t ∈ Set.Ioo y (y / a p) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y (y / a p) := mem_Ioo_of_mem_interior_Icc ht have ht_pos : 0 < t := by linarith [hy_pos, htI.1] have hat : a p * t < y := by have hmul : a p * t < a p * (y / a p) := @@ -5528,26 +5148,14 @@ private lemma uCandidate_tangent_x_Q1_A1_to_diag_leTwo have hby := uCandidate_tangent_x_Q1_boundary_to_diag_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (y := y) hy_pos have hd : DxuCandidate p x y ≤ DxuCandidate p (y / a p) y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane x y := by - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact ⟨by linarith, le_of_lt (lt_trans hy_lt_b hx_lower), by linarith⟩ have hQb : QuarterPlane (y / a p) y := by have hb_pos : 0 < y / a p := div_pos hy_pos ha_pos - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact ⟨hb_pos.le, le_of_lt hy_lt_b, by linarith⟩ have hdx : DxuCandidate p x y = DxauxFunction1 p x y := by rw [DxuCandidate_eq_Q1_leTwo p hQx] @@ -5556,12 +5164,7 @@ private lemma uCandidate_tangent_x_Q1_A1_to_diag_leTwo have hle := DxauxFunction1_A1_le_boundary_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (x := x) (y := y) hy_pos (by - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos linarith) (by have hmul := mul_lt_mul_of_pos_left hx_lower ha_pos field_simp [ha_pos.ne'] at hmul @@ -5570,16 +5173,9 @@ private lemma uCandidate_tangent_x_Q1_A1_to_diag_leTwo exact tangent_glue_two_backward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt hlt) (le_of_lt hx_lower) hxb hby hd @@ -5596,13 +5192,9 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A2_leTwo have hQz : QuarterPlane3 z y := ⟨hy_pos.le, by have haxy_nonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith, le_of_lt hz_upper⟩ - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos have hclz : closureA2 p y z := ⟨hy_pos.le, le_of_lt hz_lower, le_of_lt hz_upper⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, by - have h := mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - simpa using h, le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have huz : uCandidate p z y = vLeTwo p y z := by rw [uCandidate_eq_Q3_leTwo p hQz, auxFunction1_eq_vLeTwo_leTwo p hp1 hp2 y z hclz] have huy : uCandidate p y y = vLeTwo p y y := by @@ -5614,7 +5206,7 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A2_leTwo have hzero : (0 : ℝ) ^ (p - 1) = 0 := Real.zero_rpow (by linarith) simp [DxvLeTwo, DyvLeTwo, hy_pos, abs_of_pos hy_pos, hzero] have hderiv : HasDerivAt (fun t => vLeTwo p y t) (DyvLeTwo p y y) y := by - have hsum : 0 < (y + y) / 2 := by linarith + have hsum : 0 < (y + y) / 2 := by positivity have hdiff_nonneg : 0 ≤ (y - y) / 2 := by norm_num -- use the x-derivative diagonal private lemma and symmetry of formulas at the diagonal have hxder := hasDerivAt_vLeTwo_x_on_diag_pos_leTwo p hp1 y hy_pos @@ -5626,13 +5218,11 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A2_leTwo ext t simp [vLeTwo, g] have hbase_sum : - HasDerivAt (fun t : ℝ => (y + t) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (y + t) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (y - t) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (y - t) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub y).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun t : ℝ => |((y + t) / 2)| ^ p) (p * (y ^ (p - 2) * y) * (1 / 2)) y := by @@ -5677,8 +5267,7 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A2_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := z) (hi := y) (x := y) (y := y) (z := z) · intro t ht - have htI : t ∈ Set.Ioo z y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo z y := mem_Ioo_of_mem_interior_Icc ht exact ⟨hy_pos, lt_trans hz_lower htI.1, htI.2⟩ · exact ⟨le_of_lt hz_upper, le_rfl⟩ · exact ⟨le_rfl, le_of_lt hz_upper⟩ @@ -5696,8 +5285,7 @@ private lemma uCandidate_tangent_x_Q3_A1_to_antidiag_leTwo uCandidate p x y + DxuCandidate p x y * ((-y) - x) := by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hx_lower, by - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hx_upper hc_lt_y)⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ have hclx : closureA1 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ @@ -5757,8 +5345,7 @@ private lemma uCandidate_tangent_x_antidiag_to_Q2_leTwo · intro t ht exact lt_of_lt_of_le hy_pos ht.1 · intro t ht - have htI : t ∈ Set.Ioo y (-z) := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y (-z) := mem_Ioo_of_mem_interior_Icc ht linarith [hy_pos, htI.1] · exact ⟨le_rfl, le_of_lt (by linarith)⟩ · exact ⟨le_of_lt (by linarith), le_rfl⟩ @@ -5773,21 +5360,12 @@ private lemma DxuCandidate_Q1_A2_le_diag_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {x y : ℝ} (hy_pos : 0 < y) (hx_lower : y < x) (hx_upper : x < y / a p) : DxuCandidate p x y ≤ DxuCandidate p y y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane x y := ⟨by linarith, le_of_lt hx_lower, by linarith⟩ - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ - have hax : a p * x < y := by - have hmul := mul_lt_mul_of_pos_left hx_upper ha_pos - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos + have hax : a p * x < y := mul_a_lt_of_lt_div_a ha_pos hx_upper have hclx : closureA2 p x y := ⟨by linarith, le_of_lt hax, le_of_lt hx_lower⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, by - have h := mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le - simpa using h, le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hnotx : ¬ closureA1 p x y := by intro h exact not_le_of_gt hax h.2.2 @@ -5832,14 +5410,12 @@ private lemma DxuCandidate_Q1_A2_le_diag_leTwo (f' := fun t : ℝ => deriv (fun s => DxvLeTwo p s y) t) (convex_Icc y x) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo y x := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y x := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (t + y) / 2 := by linarith [hy_pos, htI.1] have hdiff : 0 < (t - y) / 2 := by linarith [htI.1] exact (differentiableAt_DxvLeTwo_x_of_pos_leTwo p t y hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo y x := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo y x := mem_Ioo_of_mem_interior_Icc ht have h_at : a p * t < y := by have ht_div : t < y / a p := lt_trans htI.2 hx_upper have hmul := mul_lt_mul_of_pos_left ht_div ha_pos @@ -5862,22 +5438,14 @@ private lemma DxuCandidate_Q3_A2_le_boundary_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (y := y) hy_pos -- On the A2 strip the derivative is antitone, so the right endpoint has -- smaller derivative than the left boundary. - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane3 x y := ⟨hy_pos.le, by have ha_nonneg : 0 ≤ a p := ha_pos.le have haxy_nonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith, le_of_lt hx_upper⟩ - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_pos.le hy_pos.le - linarith, by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact (mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le).trans_eq (one_mul y)⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hclx : closureA2 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ - have hclc1 : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_pos.le hy_pos.le - linarith, le_rfl⟩ + have hclc1 : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hdx : DxuCandidate p x y = DyvLeTwo p y x := by rw [DxuCandidate_eq_Q3_leTwo p hp1 hp2 hQx] have hnot : ¬ closureA1 p y x := by @@ -5931,8 +5499,7 @@ private lemma DxuCandidate_Q3_A2_le_boundary_leTwo (f' := fun t : ℝ => deriv (fun s => DyvLeTwo p y s) t) (convex_Icc (a p * y) x) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo (a p * y) x := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (a p * y) x := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (y + t) / 2 := by have hnonneg : 0 ≤ a p * y := mul_nonneg ha_pos.le hy_pos.le linarith [hy_pos, hnonneg, htI.1] @@ -5940,8 +5507,7 @@ private lemma DxuCandidate_Q3_A2_le_boundary_leTwo exact (differentiableAt_DyvLeTwo_y_of_pos_leTwo p y t hsum hdiff).hasDerivAt.hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo (a p * y) x := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (a p * y) x := mem_Ioo_of_mem_interior_Icc ht exact deriv_DyvLeTwo_y_nonpos_leTwo p hp1 hp2 y t ⟨hy_pos, htI.1, lt_trans htI.2 hx_upper⟩ exact hantiOn ⟨le_rfl, le_of_lt hx_lower⟩ ⟨le_of_lt hx_lower, le_rfl⟩ @@ -5956,8 +5522,7 @@ private lemma DxuCandidate_Q3_A1_eq_antidiag_leTwo have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hQx : QuarterPlane3 x y := ⟨hy_pos.le, le_of_lt hx_lower, by - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt (lt_trans hx_upper hc_lt_y)⟩ have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ have hclx : closureA1 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ @@ -5985,17 +5550,14 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A2_boundary_leTwo (hy_pos : 0 < y) : uCandidate p (a p * y) y ≤ uCandidate p y y + DxuCandidate p y y * (a p * y - y) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt have hc_pos : 0 < a p * y := mul_pos ha_pos hy_pos - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by linarith, le_of_lt hc_lt_y⟩ - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos have hclc : closureA2 p y (a p * y) := ⟨hy_pos.le, le_rfl, le_of_lt hc_lt_y⟩ - have hcly : closureA2 p y y := ⟨hy_pos.le, le_of_lt hc_lt_y, le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have huc : uCandidate p (a p * y) y = vLeTwo p y (a p * y) := by rw [uCandidate_eq_Q3_leTwo p hQc, auxFunction1_eq_vLeTwo_leTwo p hp1 hp2 y (a p * y) hclc] @@ -6016,13 +5578,11 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A2_boundary_leTwo ext t simp [vLeTwo, g] have hbase_sum : - HasDerivAt (fun t : ℝ => (y + t) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (y + t) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (y - t) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (y - t) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub y).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun t : ℝ => |((y + t) / 2)| ^ p) (p * (y ^ (p - 2) * y) * (1 / 2)) y := by @@ -6068,8 +5628,7 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A2_boundary_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := a p * y) (hi := y) (x := y) (y := y) (z := a p * y) · intro t ht - have htI : t ∈ Set.Ioo (a p * y) y := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (a p * y) y := mem_Ioo_of_mem_interior_Icc ht exact ⟨hy_pos, htI.1, htI.2⟩ · exact ⟨le_of_lt hc_lt_y, le_rfl⟩ · exact ⟨le_rfl, le_of_lt hc_lt_y⟩ @@ -6116,8 +5675,7 @@ private lemma uCandidate_tangent_x_Q1_A2_to_Q3_A2_boundary_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) (le_of_lt hx_lower) hxy hyc hd @@ -6126,15 +5684,12 @@ private lemma uCandidate_tangent_x_Q3_A2_to_boundary_leTwo (hy_pos : 0 < y) (hx_lower : a p * y < x) (hx_upper : x < y) : uCandidate p (a p * y) y ≤ uCandidate p x y + DxuCandidate p x y * (a p * y - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt have hc_pos : 0 < a p * y := mul_pos ha_pos hy_pos have hQx : QuarterPlane3 x y := ⟨hy_pos.le, by linarith [hc_pos, hx_lower], le_of_lt hx_upper⟩ - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by linarith, le_of_lt hc_lt_y⟩ + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hclx : closureA2 p y x := ⟨hy_pos.le, le_of_lt hx_lower, le_of_lt hx_upper⟩ have hclc : closureA2 p y (a p * y) := ⟨hy_pos.le, le_rfl, le_of_lt hc_lt_y⟩ have hux : uCandidate p x y = vLeTwo p y x := by @@ -6158,8 +5713,7 @@ private lemma uCandidate_tangent_x_Q3_A2_to_boundary_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (lo := a p * y) (hi := x) (x := y) (y := x) (z := a p * y) · intro t ht - have htI : t ∈ Set.Ioo (a p * y) x := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo (a p * y) x := mem_Ioo_of_mem_interior_Icc ht exact ⟨hy_pos, htI.1, lt_trans htI.2 hx_upper⟩ · exact ⟨le_of_lt hx_lower, le_rfl⟩ · exact ⟨le_rfl, le_of_lt hx_lower⟩ @@ -6178,16 +5732,11 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_Q3_A1_leTwo DxuCandidate p (a p * y) y * (z - a p * y) := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_of_lt hc_lt_y⟩ + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hQz : QuarterPlane3 z y := ⟨hy_pos.le, le_of_lt hz_lower, le_of_lt (lt_trans hz_upper hc_lt_y)⟩ - have hclc : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hclc : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hclz : closureA1 p y z := ⟨hy_pos.le, le_of_lt hz_lower, le_of_lt hz_upper⟩ have huc : uCandidate p (a p * y) y = uA1 p y (a p * y) := by rw [uCandidate_eq_Q3_leTwo p hQc] @@ -6215,15 +5764,10 @@ private lemma uCandidate_tangent_x_Q3_A2_boundary_to_antidiag_leTwo DxuCandidate p (a p * y) y * ((-y) - a p * y) := by have ha_nonneg : 0 ≤ a p := a_nonneg_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hQc : QuarterPlane3 (a p * y) y := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_of_lt hc_lt_y⟩ + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hQc : QuarterPlane3 (a p * y) y := quarterPlane3_mul_a_leTwo p hp1 hp2 hy_pos have hQa : QuarterPlane2 (-y) y := ⟨by linarith, by linarith, by linarith⟩ - have hclc : closureA1 p y (a p * y) := ⟨hy_pos.le, by - have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le - linarith, le_rfl⟩ + have hclc : closureA1 p y (a p * y) := closureA1_mul_a_leTwo p hp1 hp2 hy_pos have hcla : closureA1 p y (-y) := by refine ⟨hy_pos.le, le_rfl, ?_⟩ have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le @@ -6366,8 +5910,7 @@ private lemma uCandidate_tangent_x_diag_to_Q3_A1_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hz_upper) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) hyc hcz hd @@ -6390,8 +5933,7 @@ private lemma uCandidate_tangent_x_diag_to_antidiag_leTwo linarith) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) hyc hca hd @@ -6415,8 +5957,7 @@ private lemma uCandidate_tangent_x_diag_to_Q2_leTwo linarith) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) hyc hcz hd @@ -6435,20 +5976,12 @@ private lemma DxuCandidate_Q1_A1_le_diag_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {x y : ℝ} (hy_pos : 0 < y) (hx_lower : y / a p < x) : DxuCandidate p x y ≤ DxuCandidate p y y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos have hQx : QuarterPlane x y := ⟨by linarith, le_of_lt (lt_trans hy_lt_b hx_lower), by linarith⟩ - have hQb : QuarterPlane (y / a p) y := - ⟨(div_pos hy_pos ha_pos).le, le_of_lt hy_lt_b, by linarith⟩ + have hQb : QuarterPlane (y / a p) y := quarterPlane_div_a_leTwo p hp1 hp2 hy_pos have hdx : DxuCandidate p x y = DxauxFunction1 p x y := by rw [DxuCandidate_eq_Q1_leTwo p hQx] have hdb : DxuCandidate p (y / a p) y = DxauxFunction1 p (y / a p) y := by @@ -6495,8 +6028,7 @@ private lemma uCandidate_tangent_x_Q1_A2_to_Q3_A1_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hz_upper) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_trans (le_of_lt hlt) (le_of_lt hx_lower)) hxc hcz hd @@ -6521,8 +6053,7 @@ private lemma uCandidate_tangent_x_Q1_A2_to_antidiag_leTwo linarith) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_trans (le_of_lt hlt) (le_of_lt hx_lower)) hxc hca hd @@ -6549,8 +6080,7 @@ private lemma uCandidate_tangent_x_Q1_A2_to_Q2_leTwo linarith) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_trans (le_of_lt hlt) (le_of_lt hx_lower)) hxc hcz hd @@ -6570,16 +6100,9 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_Q3_A2_leTwo exact tangent_glue_two_backward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hz_upper) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt hlt) hbd hdz hd @@ -6599,20 +6122,12 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_Q3_A2_boundary_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_of_lt hlt) hbd hdc hd @@ -6636,18 +6151,10 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_Q3_A1_leTwo exact tangent_glue_two_backward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hz_upper) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt1 : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hlt2 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt1 : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hlt2 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt1) (le_of_lt hlt2)) hbc hcz hd @@ -6675,18 +6182,10 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_Q2_leTwo have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt1 : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hlt2 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt1 : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hlt2 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt1) (le_of_lt hlt2)) hbc hcz hd @@ -6713,18 +6212,10 @@ private lemma uCandidate_tangent_x_Q1_boundary_to_antidiag_leTwo have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt1 : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hlt2 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt1 : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hlt2 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt1) (le_of_lt hlt2)) hbc hca hd @@ -6746,16 +6237,9 @@ private lemma uCandidate_tangent_x_Q1_A1_to_Q3_A2_leTwo exact tangent_glue_two_backward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hz_upper) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt) (le_of_lt hx_lower)) hxd hdz hd @@ -6776,20 +6260,12 @@ private lemma uCandidate_tangent_x_Q1_A1_to_Q3_A2_boundary_leTwo (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (by have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos + have hlt : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt exact le_of_lt hlt) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt) (le_of_lt hx_lower)) hxd hdc hd @@ -6811,18 +6287,10 @@ private lemma uCandidate_tangent_x_Q1_A1_to_Q3_A1_leTwo exact tangent_glue_two_backward_leTwo_local (fun t => uCandidate p t y) (fun t => DxuCandidate p t y) (le_of_lt hz_upper) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt1 : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hlt2 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt1 : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hlt2 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt1) (le_trans (le_of_lt hlt2) (le_of_lt hx_lower))) hxc hcz hd @@ -6847,18 +6315,10 @@ private lemma uCandidate_tangent_x_Q1_A1_to_Q2_leTwo have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt1 : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hlt2 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt1 : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hlt2 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt1) (le_trans (le_of_lt hlt2) (le_of_lt hx_lower))) hxc hcz hd @@ -6882,18 +6342,10 @@ private lemma uCandidate_tangent_x_Q1_A1_to_antidiag_leTwo have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith) (by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hlt1 : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hlt2 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hlt1 : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hlt2 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact le_trans (le_of_lt hlt1) (le_trans (le_of_lt hlt2) (le_of_lt hx_lower))) hxc hca hd @@ -7062,22 +6514,14 @@ private lemma uCandidate_tangent_x_backward_of_y_pos_leTwo (hy_pos : 0 < y) (hzx : z < x) : uCandidate p z y ≤ uCandidate p x y + DxuCandidate p x y * (z - x) := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_nonneg : 0 ≤ a p := ha_pos.le have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hneg_lt_c : -y < a p * y := by have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith - have hc_lt_y : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hy_lt_b : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hc_lt_y : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hy_lt_b : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos by_cases hx_b : y / a p < x · by_cases hz_b : y / a p < z · exact uCandidate_tangent_x_on_Q1_A1_segment_leTwo @@ -7349,8 +6793,8 @@ private lemma DxuCandidate_axis_eq_abs_deriv_leTwo let C : ℝ := alpha p * (1 - pStar p / 2) have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 - have hp_ne_one : p ≠ 1 := by linarith - have hpden_ne : p - 1 ≠ 0 := by linarith + have hp_ne_one : p ≠ 1 := p_ne_one_of_one_lt p hp1 + have hpden_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 rcases lt_trichotomy x 0 with hxneg | hx0 | hxpos · have hQ2 : QuarterPlane2 x 0 := ⟨le_of_lt hxneg, by linarith, by linarith⟩ have hxpos' : 0 < -x := by linarith @@ -7511,7 +6955,7 @@ private lemma uCandidate_le_zero_of_mul_neg_LeTwo linarith have hmain : t < pStar p * t / 2 := by have hmul := mul_lt_mul_of_pos_right hpStar_half_gt_one htpos - nlinarith + linarith have hbracket : t - pStar p * t / 2 < 0 := by linarith simp only [uA1, gt_iff_lt, htpos, ↓reduceIte, Real.rpow_eq_pow, sub_zero] @@ -7595,17 +7039,12 @@ private lemma hasDerivAt_DyuA1_x_of_pos_leTwo have hxne : x ≠ 0 := by linarith have hxne_pow : x ≠ 0 ∨ 1 ≤ p - 1 := Or.inl hxne have hpow : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := by - have h := (Real.hasDerivAt_rpow_const hxne_pow : - HasDerivAt (fun t : ℝ => t ^ (p - 1)) - ((p - 1) * x ^ ((p - 1) - 1)) x) - simpa [sub_eq_add_neg, add_comm, add_left_comm, add_assoc, - show p + (-1 + -1) = p + -2 by ring] using h + HasDerivAt (fun t : ℝ => t ^ (p - 1)) ((p - 1) * x ^ (p - 2)) x := + (Real.hasDerivAt_rpow_const hxne_pow).congr_deriv (by rw [show p - 1 - 1 = p - 2 by ring]) have hderiv : HasDerivAt (fun t => alpha p * t ^ (p - 1) * (pStar p / 2)) - (alpha p * ((p - 1) * x ^ (p - 2)) * (pStar p / 2)) x := by - simpa [mul_assoc, mul_left_comm, mul_comm] using - ((hpow.const_mul (alpha p)).mul_const (pStar p / 2)) + (alpha p * ((p - 1) * x ^ (p - 2)) * (pStar p / 2)) x := + (((hpow.const_mul (alpha p)).mul_const (pStar p / 2))).congr_deriv (by ring) exact hderiv.congr_of_eventuallyEq hEq private lemma deriv_DyuA1_x_nonneg_leTwo @@ -7614,7 +7053,7 @@ private lemma deriv_DyuA1_x_nonneg_leTwo have hderiv := hasDerivAt_DyuA1_x_of_pos_leTwo p hp1 hp2 x y hx rw [hderiv.deriv] have ha : 0 ≤ alpha p := alpha_nonneg_of_one_lt_of_lt_two p hp1 hp2 - have hp_sub : 0 ≤ p - 1 := by linarith + have hp_sub : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 have hpow : 0 ≤ x ^ (p - 2) := Real.rpow_nonneg hx.le _ have hpStar_nonneg : 0 ≤ pStar p / 2 := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 @@ -7648,13 +7087,11 @@ private lemma hasDerivAt_DyvLeTwo_x_of_pos_leTwo have htpos : 0 < t := by linarith simp [DyvLeTwo, htpos, abs_of_pos htsum, abs_of_pos htdiff] have hbase_sum : - HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).add_const y).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t + y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).add_const y).div_const 2 have hbase_diff : - HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id x).sub (hasDerivAt_const x y)).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun t : ℝ => (t - y) / 2) (1 / 2) x := + ((hasDerivAt_id' (x := x)).sub_const y).div_const 2 have hpow_sum : HasDerivAt (fun t : ℝ => ((t + y) / 2) ^ (p - 1)) ((p - 1) * ((x + y) / 2) ^ (p - 2) * (1 / 2)) x := by @@ -7750,14 +7187,12 @@ private lemma DyvLeTwo_mono_x_on_Icc_of_pos_leTwo coeffLeTwo p * ((t - y) / 2) ^ (p - 2))) (convex_Icc lo hi) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (t + y) / 2 := by linarith [hlo_sum, htI.1] have hdiff : 0 < (t - y) / 2 := by linarith [hlo_diff, htI.1] exact (hasDerivAt_DyvLeTwo_x_of_pos_leTwo p t y hsum hdiff).hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (t + y) / 2 := by linarith [hlo_sum, htI.1] have hdiff : 0 < (t - y) / 2 := by linarith [hlo_diff, htI.1] have hpcoef : 0 ≤ p * (p - 1) / 4 := by @@ -7792,16 +7227,14 @@ private lemma DyuA1_mono_x_on_Icc_pos_leTwo (f' := fun t : ℝ => alpha p * ((p - 1) * t ^ (p - 2)) * (pStar p / 2)) (convex_Icc lo hi) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht exact (hasDerivAt_DyuA1_x_of_pos_leTwo p hp1 hp2 t y (lt_trans hlo htI.1)).hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have htpos : 0 < t := lt_trans hlo htI.1 have ha : 0 ≤ alpha p := alpha_nonneg_of_one_lt_of_lt_two p hp1 hp2 - have hp_sub : 0 ≤ p - 1 := by linarith + have hp_sub : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 have hpow : 0 ≤ t ^ (p - 2) := Real.rpow_nonneg htpos.le _ have hpStar_nonneg : 0 ≤ pStar p / 2 := by have hpStar : pStar p = q p := pStar_eq_q_of_one_lt_of_lt_two p hp1 hp2 @@ -7858,13 +7291,11 @@ private lemma hasDerivAt_DxvLeTwo_y_of_pos_leTwo filter_upwards [hsum_nhds, hdiff_nhds] with s hssum hsdiff simp [DxvLeTwo, hx, abs_of_pos hssum, abs_of_pos hsdiff] have hbase_sum : - HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := by - simpa [div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - (((hasDerivAt_id y).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x + s) / 2) (1 / 2) y := + ((hasDerivAt_id' (x := y)).const_add x).div_const 2 have hbase_diff : - HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := by - simpa [sub_eq_add_neg, div_eq_mul_inv, mul_comm, mul_left_comm, mul_assoc] using - ((((hasDerivAt_id y).neg).const_add x).const_mul (1 / 2 : ℝ)) + HasDerivAt (fun s : ℝ => (x - s) / 2) (-(1 / 2)) y := + (((hasDerivAt_id' (x := y)).const_sub x).div_const 2).congr_deriv (neg_div 2 1) have hpow_sum : HasDerivAt (fun s : ℝ => ((x + s) / 2) ^ (p - 1)) ((p - 1) * ((x + y) / 2) ^ (p - 2) * (1 / 2)) y := by @@ -7957,14 +7388,12 @@ private lemma DxvLeTwo_mono_y_on_Icc_of_pos_leTwo coeffLeTwo p * ((x - t) / 2) ^ (p - 2))) (convex_Icc lo hi) hcont ?_ ?_ · intro t ht - have htI : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (x + t) / 2 := by linarith [hlo_sum, htI.1] have hdiff : 0 < (x - t) / 2 := by linarith [hhi_diff, htI.2] exact (hasDerivAt_DxvLeTwo_y_of_pos_leTwo p x t hsum hdiff).hasDerivWithinAt · intro t ht - have htI : t ∈ Set.Ioo lo hi := by - simpa [interior_Icc] using ht + have htI : t ∈ Set.Ioo lo hi := mem_Ioo_of_mem_interior_Icc ht have hsum : 0 < (x + t) / 2 := by linarith [hlo_sum, htI.1] have hdiff : 0 < (x - t) / 2 := by linarith [hhi_diff, htI.2] have hpcoef : 0 ≤ p * (p - 1) / 4 := by @@ -7981,9 +7410,7 @@ private lemma DyuCandidate_mono_x_on_Q1_A1_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {x z y : ℝ} (hy_pos : 0 < y) (hx_lower : y / a p ≤ x) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hx_pos : 0 < x := by have hy_div_pos : 0 < y / a p := div_pos hy_pos ha_pos exact lt_of_lt_of_le hy_div_pos hx_lower @@ -8083,9 +7510,7 @@ private lemma DyuCandidate_mono_x_on_Q1_A2_leTwo (hy_pos : 0 < y) (hyx : y < x) (hz_upper : z ≤ y / a p) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hx_pos : 0 < x := lt_of_lt_of_le hy_pos hyx.le have hz_pos : 0 < z := lt_of_lt_of_le hx_pos hxz have hQx : QuarterPlane x y := ⟨hx_pos.le, hyx.le, by linarith⟩ @@ -8094,10 +7519,7 @@ private lemma DyuCandidate_mono_x_on_Q1_A2_leTwo have hmul := mul_le_mul_of_nonneg_left (le_trans hxz hz_upper) ha_pos.le field_simp [ha_pos.ne'] at hmul simpa [mul_comm, mul_left_comm, mul_assoc] using hmul - have haz : a p * z ≤ y := by - have hmul := mul_le_mul_of_nonneg_left hz_upper ha_pos.le - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have haz : a p * z ≤ y := mul_a_le_of_le_div_a ha_pos hz_upper have hclx : closureA2 p x y := ⟨hx_pos.le, hax, hyx.le⟩ have hclz : closureA2 p z y := ⟨hz_pos.le, haz, le_trans hyx.le hxz⟩ have hdx : DyuCandidate p x y = DyvLeTwo p x y := by @@ -8154,12 +7576,9 @@ private lemma DyuCandidate_mono_x_Q3_A2_to_diag_leTwo refine ⟨hy_pos.le, ?_, hx_upper.le⟩ have haxy_nonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos have hclx : closureA2 p y x := ⟨hy_pos.le, hx_lower, hx_upper.le⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, - (mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le).trans_eq (one_mul y), le_rfl⟩ + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos have hdx : DyuCandidate p x y = DxvLeTwo p y x := by rw [DyuCandidate_eq_Q3_leTwo p hp1 hp2 hQx] exact auxFunction1_Dx_eq_DxvLeTwo_leTwo p hp1 hp2 y x hclx @@ -8177,13 +7596,13 @@ private lemma DyuCandidate_mono_x_Q3_A2_to_diag_leTwo exact Real.rpow_nonneg (by linarith [hx_upper.le]) _ have hcoeff_nonneg : 0 ≤ coeffLeTwo p := by exact Real.rpow_nonneg (inv_nonneg.mpr (by linarith)) _ - have hp_half_nonneg : 0 ≤ p / 2 := by linarith + have hp_half_nonneg : 0 ≤ p / 2 := half_p_nonneg_of_one_lt p hp1 rw [hdx, hdy] have hzero : (0 : ℝ) ^ (p - 1) = 0 := Real.zero_rpow (by linarith) have hx_nonneg : 0 ≤ x := by have haxy_nonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le exact le_trans haxy_nonneg hx_lower - have hsum_pos : 0 < (y + x) / 2 := by linarith + have hsum_pos : 0 < (y + x) / 2 := by positivity have hdiff_pos : 0 < (y - x) / 2 := by linarith simp only [DxvLeTwo, gt_iff_lt, hy_pos, ↓reduceIte, abs_of_pos hsum_pos, Real.rpow_eq_pow, abs_of_pos hdiff_pos, DyvLeTwo, add_self_div_two, abs_of_pos hy_pos, sub_self, zero_div, @@ -8191,26 +7610,18 @@ private lemma DyuCandidate_mono_x_Q3_A2_to_diag_leTwo have hA := mul_le_mul_of_nonneg_right hsum_le hp_half_nonneg have hB : 0 ≤ coeffLeTwo p * ((y - x) / 2) ^ (p - 1) * (p / 2) := by positivity - nlinarith + linarith private lemma DyuCandidate_mono_x_diag_to_Q1_A2_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {z y : ℝ} (hy_pos : 0 < y) (hyz : y < z) (hz_upper : z ≤ y / a p) : DyuCandidate p y y ≤ DyuCandidate p z y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have hz_pos : 0 < z := lt_trans hy_pos hyz - have hQy : QuarterPlane y y := ⟨hy_pos.le, le_rfl, by linarith⟩ + have hQy : QuarterPlane y y := quarterPlane_diag_of_pos hy_pos have hQz : QuarterPlane z y := ⟨hz_pos.le, hyz.le, by linarith⟩ - have hcly : closureA2 p y y := by - have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - exact ⟨hy_pos.le, - (mul_le_mul_of_nonneg_right ha_lt.le hy_pos.le).trans_eq (one_mul y), le_rfl⟩ - have haz : a p * z ≤ y := by - have hmul := mul_le_mul_of_nonneg_left hz_upper ha_pos.le - field_simp [ha_pos.ne'] at hmul - simpa [mul_comm, mul_left_comm, mul_assoc] using hmul + have hcly : closureA2 p y y := closureA2_diag_leTwo p hp1 hp2 hy_pos + have haz : a p * z ≤ y := mul_a_le_of_le_div_a ha_pos hz_upper have hclz : closureA2 p z y := ⟨hz_pos.le, haz, hyz.le⟩ have hdy : DyuCandidate p y y = DyvLeTwo p y y := by rw [DyuCandidate_eq_Q1_leTwo p hQy] @@ -8226,10 +7637,10 @@ private lemma DyuCandidate_mono_x_diag_to_Q1_A2_leTwo exact Real.rpow_nonneg (by linarith [hyz.le]) _ have hcoeff_nonneg : 0 ≤ coeffLeTwo p := by exact Real.rpow_nonneg (inv_nonneg.mpr (by linarith)) _ - have hp_half_nonneg : 0 ≤ p / 2 := by linarith + have hp_half_nonneg : 0 ≤ p / 2 := half_p_nonneg_of_one_lt p hp1 rw [hdy, hdz] have hzero : (0 : ℝ) ^ (p - 1) = 0 := Real.zero_rpow (by linarith) - have hsum_pos : 0 < (z + y) / 2 := by linarith + have hsum_pos : 0 < (z + y) / 2 := by positivity have hdiff_pos : 0 < (z - y) / 2 := by linarith simp only [DyvLeTwo, gt_iff_lt, hy_pos, ↓reduceIte, add_self_div_two, abs_of_pos hy_pos, Real.rpow_eq_pow, sub_self, zero_div, abs_zero, hzero, mul_zero, zero_mul, add_zero, hz_pos, @@ -8237,7 +7648,7 @@ private lemma DyuCandidate_mono_x_diag_to_Q1_A2_leTwo have hA := mul_le_mul_of_nonneg_right hsum_le hp_half_nonneg have hB : 0 ≤ coeffLeTwo p * ((z - y) / 2) ^ (p - 1) * (p / 2) := by positivity - nlinarith + linarith private lemma DyuCandidate_antidiag_le_Q3_boundary_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} @@ -8264,16 +7675,9 @@ private lemma DyuCandidate_diag_le_Q1_boundary_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {y : ℝ} (hy_pos : 0 < y) : DyuCandidate p y y ≤ DyuCandidate p (y / a p) y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 - have hy_lt_div : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hy_lt_div : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos exact DyuCandidate_mono_x_diag_to_Q1_A2_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (z := y / a p) (y := y) hy_pos hy_lt_div le_rfl @@ -8282,22 +7686,14 @@ private lemma DyuCandidate_mono_x_of_y_pos_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) {x z y : ℝ} (hy_pos : 0 < y) (hxz : x ≤ z) : DyuCandidate p x y ≤ DyuCandidate p z y := by - have ha_pos : 0 < a p := by - rw [a_eq_leTwo p hp1 hp2] - exact div_pos (by linarith) (by linarith) + have ha_pos : 0 < a p := a_pos_of_one_lt_of_lt_two p hp1 hp2 have ha_nonneg : 0 ≤ a p := ha_pos.le have ha_lt : a p < 1 := a_lt_one_of_one_lt_of_lt_two p hp1 hp2 have hneg_le_boundary : -y ≤ a p * y := by have hnonneg : 0 ≤ a p * y := mul_nonneg ha_nonneg hy_pos.le linarith - have hboundary_lt_diag : a p * y < y := by - simpa using mul_lt_mul_of_pos_right ha_lt hy_pos - have hdiag_lt_q1 : y < y / a p := by - rw [div_eq_mul_inv] - have hinv : 1 < (a p)⁻¹ := by - rw [one_lt_inv₀ ha_pos] - exact ha_lt - nlinarith + have hboundary_lt_diag : a p * y < y := mul_lt_of_lt_one_left hy_pos ha_lt + have hdiag_lt_q1 : y < y / a p := lt_self_div_a_leTwo p hp1 hp2 hy_pos by_cases hz_q2 : z ≤ -y · exact DyuCandidate_mono_x_on_Q2_leTwo (p := p) (hp1 := hp1) (hp2 := hp2) (x := x) (z := z) (y := y) @@ -8813,7 +8209,7 @@ private lemma abs_vLeTwo_le_growth_on_closureA2 closureA2_abs_add_div_two_le_x p hp1 hp2 ⟨hx, hlow, hup⟩ have hdiff : |(x - y) / 2| ≤ x := closureA2_abs_sub_div_two_le_x p hp1 hp2 ⟨hx, hlow, hup⟩ - have hp_nonneg : 0 ≤ p := by linarith + have hp_nonneg : 0 ≤ p := p_nonneg_of_one_lt p hp1 have hsum_pow : Real.rpow |(x + y) / 2| p ≤ Real.rpow x p := Real.rpow_le_rpow (abs_nonneg _) hsum hp_nonneg @@ -9083,7 +8479,7 @@ private lemma abs_DxvLeTwo_le_growth_on_closureA2 closureA2_abs_add_div_two_le_x p hp1 hp2 ⟨hx, hlow, hup⟩ have hdiff : |(x - y) / 2| ≤ x := closureA2_abs_sub_div_two_le_x p hp1 hp2 ⟨hx, hlow, hup⟩ - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 have hsum_pow : Real.rpow |(x + y) / 2| (p - 1) ≤ Real.rpow x (p - 1) := Real.rpow_le_rpow (abs_nonneg _) hsum hp1_nonneg @@ -9158,7 +8554,7 @@ private lemma abs_DyvLeTwo_le_growth_on_closureA2 closureA2_abs_add_div_two_le_x p hp1 hp2 ⟨hx, hlow, hup⟩ have hdiff : |(x - y) / 2| ≤ x := closureA2_abs_sub_div_two_le_x p hp1 hp2 ⟨hx, hlow, hup⟩ - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 have hsum_pow : Real.rpow |(x + y) / 2| (p - 1) ≤ Real.rpow x (p - 1) := Real.rpow_le_rpow (abs_nonneg _) hsum hp1_nonneg @@ -9405,7 +8801,7 @@ private lemma uA1_eq_smooth_of_nonneg_leTwo (p : ℝ) (hp1 : 1 < p) (x y : ℝ) (hx : 0 ≤ x) : uA1 p x y = alpha p * Real.rpow x (p - 1) * (x - pStar p * (x - y) / 2) := by - have hexp_ne : p - 1 ≠ 0 := by linarith + have hexp_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 unfold uA1 rcases hx.lt_or_eq with hxpos | hxeq · exact ite_eq_left hxpos @@ -9414,7 +8810,7 @@ private lemma uA1_eq_smooth_of_nonneg_leTwo private lemma continuousOn_uA1_leTwo (p : ℝ) (hp1 : 1 < p) : ContinuousOn (fun z : ℝ × ℝ => uA1 p z.1 z.2) {z | 0 ≤ z.1} := by - have hexp_nonneg : 0 ≤ p - 1 := by linarith + have hexp_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 have heq : ∀ z : ℝ × ℝ, z ∈ {z : ℝ × ℝ | 0 ≤ z.1} → uA1 p z.1 z.2 = alpha p * Real.rpow z.1 (p - 1) * (z.1 - pStar p * (z.1 - z.2) / 2) := @@ -9573,7 +8969,7 @@ private lemma DxvLeTwo_eq_formula_on_closureA2_leTwo · simp [DxvLeTwoFun, DxvLeTwoFormula, DxvLeTwo, hx0] · have h00 := closureA2_x0_y0 p x y ⟨hx, hlow, hup⟩ hx0 rcases h00 with ⟨rfl, rfl⟩ - have hp1_ne : p - 1 ≠ 0 := by linarith + have hp1_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 have hzero : Real.rpow (0 : ℝ) (p - 1) = 0 := Real.zero_rpow hp1_ne simp [DxvLeTwoFun, DxvLeTwoFormula, DxvLeTwo, Real.zero_rpow hp1_ne] @@ -9586,14 +8982,14 @@ private lemma DyvLeTwo_eq_formula_on_closureA2_leTwo · simp [DyvLeTwoFun, DyvLeTwoFormula, DyvLeTwo, hx0] · have h00 := closureA2_x0_y0 p x y ⟨hx, hlow, hup⟩ hx0 rcases h00 with ⟨rfl, rfl⟩ - have hp1_ne : p - 1 ≠ 0 := by linarith + have hp1_ne : p - 1 ≠ 0 := sub_one_ne_zero_of_one_lt p hp1 have hzero : Real.rpow (0 : ℝ) (p - 1) = 0 := Real.zero_rpow hp1_ne simp [DyvLeTwoFun, DyvLeTwoFormula, DyvLeTwo, Real.zero_rpow hp1_ne] private lemma continuousOn_DxvLeTwo_closureA2_leTwo (p : ℝ) (hp1 : 1 < p) : ContinuousOn (DxvLeTwoFun p) (closureA2Set p) := by - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 have hcont : Continuous (DxvLeTwoFormula p) := by have hsum : Continuous (fun z : ℝ × ℝ => Real.rpow (|((z.1 + z.2) / 2)|) (p - 1)) := by @@ -9619,7 +9015,7 @@ private lemma continuousOn_DxvLeTwo_closureA2_leTwo private lemma continuousOn_DyvLeTwo_closureA2_leTwo (p : ℝ) (hp1 : 1 < p) : ContinuousOn (DyvLeTwoFun p) (closureA2Set p) := by - have hp1_nonneg : 0 ≤ p - 1 := by linarith + have hp1_nonneg : 0 ≤ p - 1 := sub_one_nonneg_of_one_lt p hp1 have hcont : Continuous (DyvLeTwoFormula p) := by have hsum : Continuous (fun z : ℝ × ℝ => Real.rpow (|((z.1 + z.2) / 2)|) (p - 1)) := by @@ -9818,7 +9214,8 @@ private lemma continuousuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : intro z hz rcases hz with ⟨hx, hy, hxy⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := by continuity + have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := + continuous_fst.neg.prodMk continuous_snd.neg simpa [Q1, Q2, Function.comp_def] using (continuousOn_auxFunction1_leTwo p hp1 hp2).comp hneg.continuousOn hmap have hcont3 : ContinuousOn (fun z : ℝ × ℝ => auxFunction1 p z.2 z.1) Q3 := by @@ -9826,7 +9223,7 @@ private lemma continuousuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : intro z hz rcases hz with ⟨hy, hnyx, hxy⟩ exact ⟨hy, hxy, hnyx⟩ - have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := by continuity + have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := continuous_snd.prodMk continuous_fst simpa [Q1, Q3, Function.comp_def] using (continuousOn_auxFunction1_leTwo p hp1 hp2).comp hswap.continuousOn hmap have hcont4 : ContinuousOn (fun z : ℝ × ℝ => auxFunction1 p (-z.2) (-z.1)) Q4 := by @@ -9834,7 +9231,8 @@ private lemma continuousuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : intro z hz rcases hz with ⟨hy, hyx, hxn⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := by continuity + have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := + continuous_snd.neg.prodMk continuous_fst.neg simpa [Q1, Q4, Function.comp_def] using (continuousOn_auxFunction1_leTwo p hp1 hp2).comp hns.continuousOn hmap have hc1 : ContinuousOn (fun z : ℝ × ℝ => uCandidate p z.1 z.2) Q1 := by @@ -9878,7 +9276,8 @@ private lemma continuousDxuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) intro z hz rcases hz with ⟨hx, hy, hxy⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := by continuity + have hneg : Continuous (fun z : ℝ × ℝ => (-z.1, -z.2)) := + continuous_fst.neg.prodMk continuous_snd.neg have hbase : ContinuousOn (fun z : ℝ × ℝ => DxauxFunction1 p (-z.1) (-z.2)) Q2 := by simpa [Q1, Q2, Function.comp_def] using (continuousOn_DxauxFunction1_leTwo p hp1 hp2).comp hneg.continuousOn hmap @@ -9888,7 +9287,7 @@ private lemma continuousDxuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) intro z hz rcases hz with ⟨hy, hnyx, hxy⟩ exact ⟨hy, hxy, hnyx⟩ - have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := by continuity + have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := continuous_snd.prodMk continuous_fst simpa [Q1, Q3, Function.comp_def] using (continuousOn_DyauxFunction1_leTwo p hp1 hp2).comp hswap.continuousOn hmap have hcont4 : ContinuousOn (fun z : ℝ × ℝ => -DyauxFunction1 p (-z.2) (-z.1)) Q4 := by @@ -9896,7 +9295,8 @@ private lemma continuousDxuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) intro z hz rcases hz with ⟨hy, hyx, hxn⟩ exact ⟨by linarith, by linarith, by linarith⟩ - have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := by continuity + have hns : Continuous (fun z : ℝ × ℝ => (-z.2, -z.1)) := + continuous_snd.neg.prodMk continuous_fst.neg have hbase : ContinuousOn (fun z : ℝ × ℝ => DyauxFunction1 p (-z.2) (-z.1)) Q4 := by simpa [Q1, Q4, Function.comp_def] using (continuousOn_DyauxFunction1_leTwo p hp1 hp2).comp hns.continuousOn hmap @@ -9932,7 +9332,7 @@ private lemma continuousDxuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) private lemma continuousDyuCandidate_leTwo (p : ℝ) (hp1 : 1 < p) (hp2 : p < 2) : ContinuousOn (fun z : ℝ × ℝ => DyuCandidate p z.1 z.2) Set.univ := by have hdx := continuousDxuCandidate_leTwo p hp1 hp2 - have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := by continuity + have hswap : Continuous (fun z : ℝ × ℝ => (z.2, z.1)) := continuous_snd.prodMk continuous_fst have hcomp : ContinuousOn (fun z : ℝ × ℝ => DxuCandidate p z.2 z.1) Set.univ := by exact hdx.comp hswap.continuousOn (by intro z hz; trivial)