analysis.convex.specific_functions.basicMathlib.Analysis.Convex.SpecificFunctions.Basic

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -140,7 +140,7 @@ We give an elementary proof rather than using the second derivative test, since
 needed early in the analysis library. -/
 theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
   | (n : ℕ) => by
-    simp_rw [zpow_coe_nat]
+    simp_rw [zpow_natCast]
     exact (convexOn_pow n).Subset Ioi_subset_Ici_self (convex_Ioi _)
   | -[n+1] => by
     simp_rw [zpow_negSucc]
Diff
@@ -182,7 +182,7 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
     have hyz' : 0 < z / y := by positivity
     have hyz'' : z / y ≠ 1 := by
       contrapose! h
-      rw [div_eq_one_iff_eq hy.ne'] at h 
+      rw [div_eq_one_iff_eq hy.ne'] at h
       simp [h]
     calc
       log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne']
@@ -193,7 +193,7 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
     have hxy' : 0 < x / y := by positivity
     have hxy'' : x / y ≠ 1 := by
       contrapose! h
-      rw [div_eq_one_iff_eq hy.ne'] at h 
+      rw [div_eq_one_iff_eq hy.ne'] at h
       simp [h]
     calc
       y⁻¹ * (y - x) = 1 - x / y := by field_simp [hy.ne']
@@ -260,7 +260,7 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
   have hy : 0 < y := by linarith
   have hy' : 0 < y ^ p := rpow_pos_of_pos hy _
   have H1 : y ^ (p - 1 + 1) = y ^ (p - 1) * y := rpow_add_one hy.ne' _
-  ring_nf at H1 
+  ring_nf at H1
   trans p * y ^ (p - 1)
   · have hyx' : x - y < 0 := by linarith only [hxy]
     have h3 : 0 < y - x := by linarith only [hxy]
Diff
@@ -140,7 +140,7 @@ We give an elementary proof rather than using the second derivative test, since
 needed early in the analysis library. -/
 theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
   | (n : ℕ) => by
-    simp_rw [zpow_ofNat]
+    simp_rw [zpow_coe_nat]
     exact (convexOn_pow n).Subset Ioi_subset_Ici_self (convex_Ioi _)
   | -[n+1] => by
     simp_rw [zpow_negSucc]
Diff
@@ -96,10 +96,10 @@ theorem convexOn_pow (n : ℕ) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n :=
   have : 0 ≤ (b ^ k - a ^ k) * (b - a) * μ * ν :=
     by
     cases' le_or_lt a b with hab hab
-    · have : a ^ k ≤ b ^ k := pow_le_pow_of_le_left ha hab k
+    · have : a ^ k ≤ b ^ k := pow_le_pow_left ha hab k
       have : 0 ≤ (b ^ k - a ^ k) * (b - a) := by nlinarith
       positivity
-    · have : b ^ k ≤ a ^ k := pow_le_pow_of_le_left hb hab.le k
+    · have : b ^ k ≤ a ^ k := pow_le_pow_left hb hab.le k
       have : 0 ≤ (b ^ k - a ^ k) * (b - a) := by nlinarith
       positivity
   calc
@@ -124,7 +124,7 @@ theorem Even.convexOn_pow {n : ℕ} (hn : Even n) : ConvexOn ℝ Set.univ fun x
   have : 0 ≤ (a - b) ^ 2 * μ * ν := by positivity
   calc
     (μ * a + ν * b) ^ (2 * k) = ((μ * a + ν * b) ^ 2) ^ k := by rw [pow_mul]
-    _ ≤ ((μ + ν) * (μ * a ^ 2 + ν * b ^ 2)) ^ k := (pow_le_pow_of_le_left (by positivity) _ k)
+    _ ≤ ((μ + ν) * (μ * a ^ 2 + ν * b ^ 2)) ^ k := (pow_le_pow_left (by positivity) _ k)
     _ = (μ * a ^ 2 + ν * b ^ 2) ^ k := by rw [h] <;> ring
     _ ≤ μ * (a ^ 2) ^ k + ν * (b ^ 2) ^ k := _
     _ ≤ μ * a ^ (2 * k) + ν * b ^ (2 * k) := by ring
@@ -152,7 +152,7 @@ theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
     rw [div_le_div_iff]
     · calc
         1 * (a ^ (n + 1) * b ^ (n + 1)) = ((μ + ν) ^ 2 * (a * b)) ^ (n + 1) := by rw [h] <;> ring
-        _ ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) := (pow_le_pow_of_le_left _ _ _)
+        _ ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) := (pow_le_pow_left _ _ _)
         _ = (μ * b + ν * a) ^ (n + 1) * (μ * a + ν * b) ^ (n + 1) := by rw [mul_pow]
         _ ≤ (μ * b ^ (n + 1) + ν * a ^ (n + 1)) * (μ * a + ν * b) ^ (n + 1) := _
       · positivity
Diff
@@ -51,22 +51,25 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp :=
   by
   apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ
   rintro x y z - - hxy hyz
-  trans exp y
+  trans NormedSpace.exp y
   · have h1 : 0 < y - x := by linarith
     have h2 : x - y < 0 := by linarith
     rw [div_lt_iff h1]
     calc
-      exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add] <;> ring_nf
-      _ = exp y * (1 - exp (x - y)) := by ring
-      _ < exp y * -(x - y) := (mul_lt_mul_of_pos_left _ y.exp_pos)
-      _ = exp y * (y - x) := by ring
+      NormedSpace.exp y - NormedSpace.exp x =
+          NormedSpace.exp y - NormedSpace.exp y * NormedSpace.exp (x - y) :=
+        by rw [← NormedSpace.exp_add] <;> ring_nf
+      _ = NormedSpace.exp y * (1 - NormedSpace.exp (x - y)) := by ring
+      _ < NormedSpace.exp y * -(x - y) := (mul_lt_mul_of_pos_left _ y.exp_pos)
+      _ = NormedSpace.exp y * (y - x) := by ring
     linarith [add_one_lt_exp_of_nonzero h2.ne]
   · have h1 : 0 < z - y := by linarith
     rw [lt_div_iff h1]
     calc
-      exp y * (z - y) < exp y * (exp (z - y) - 1) := mul_lt_mul_of_pos_left _ y.exp_pos
-      _ = exp (z - y) * exp y - exp y := by ring
-      _ ≤ exp z - exp y := by rw [← exp_add] <;> ring_nf
+      NormedSpace.exp y * (z - y) < NormedSpace.exp y * (NormedSpace.exp (z - y) - 1) :=
+        mul_lt_mul_of_pos_left _ y.exp_pos
+      _ = NormedSpace.exp (z - y) * NormedSpace.exp y - NormedSpace.exp y := by ring
+      _ ≤ NormedSpace.exp z - NormedSpace.exp y := by rw [← NormedSpace.exp_add] <;> ring_nf
     linarith [add_one_lt_exp_of_nonzero h1.ne']
 #align strict_convex_on_exp strictConvexOn_exp
 -/
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2020 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov, Sébastien Gouëzel, Heather Macbeth
 -/
-import Mathbin.Analysis.Convex.Slope
-import Mathbin.Analysis.SpecialFunctions.Pow.Real
-import Mathbin.Tactic.LinearCombination
+import Analysis.Convex.Slope
+import Analysis.SpecialFunctions.Pow.Real
+import Tactic.LinearCombination
 
 #align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"0b7c740e25651db0ba63648fbae9f9d6f941e31b"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2020 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov, Sébastien Gouëzel, Heather Macbeth
-
-! This file was ported from Lean 3 source module analysis.convex.specific_functions.basic
-! leanprover-community/mathlib commit 0b7c740e25651db0ba63648fbae9f9d6f941e31b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Convex.Slope
 import Mathbin.Analysis.SpecialFunctions.Pow.Real
 import Mathbin.Tactic.LinearCombination
 
+#align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"0b7c740e25651db0ba63648fbae9f9d6f941e31b"
+
 /-!
 # Collection of convex functions
 
Diff
@@ -45,6 +45,7 @@ open Real Set
 
 open scoped BigOperators NNReal
 
+#print strictConvexOn_exp /-
 /-- `exp` is strictly convex on the whole real line.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -71,12 +72,16 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp :=
       _ ≤ exp z - exp y := by rw [← exp_add] <;> ring_nf
     linarith [add_one_lt_exp_of_nonzero h1.ne']
 #align strict_convex_on_exp strictConvexOn_exp
+-/
 
+#print convexOn_exp /-
 /-- `exp` is convex on the whole real line. -/
 theorem convexOn_exp : ConvexOn ℝ univ exp :=
   strictConvexOn_exp.ConvexOn
 #align convex_on_exp convexOn_exp
+-/
 
+#print convexOn_pow /-
 /-- `x^n`, `n : ℕ` is convex on `[0, +∞)` for all `n`.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -104,7 +109,9 @@ theorem convexOn_pow (n : ℕ) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n :=
     _ = (μ + ν) * (μ * a ^ k.succ + ν * b ^ k.succ) := by ring
     _ = μ * a ^ k.succ + ν * b ^ k.succ := by rw [h] <;> ring
 #align convex_on_pow convexOn_pow
+-/
 
+#print Even.convexOn_pow /-
 /-- `x^n`, `n : ℕ` is convex on the whole real line whenever `n` is even.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -124,7 +131,9 @@ theorem Even.convexOn_pow {n : ℕ} (hn : Even n) : ConvexOn ℝ Set.univ fun x
   · linarith
   · refine' (convexOn_pow k).2 _ _ hμ hν h <;> dsimp <;> positivity
 #align even.convex_on_pow Even.convexOn_pow
+-/
 
+#print convexOn_zpow /-
 /-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m`.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -155,7 +164,9 @@ theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
       positivity
     · positivity
 #align convex_on_zpow convexOn_zpow
+-/
 
+#print strictConcaveOn_log_Ioi /-
 /- `real.log` is strictly concave on $(0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -190,7 +201,9 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
       _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne']
       _ = log y - log x := by ring
 #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi
+-/
 
+#print one_add_mul_self_lt_rpow_one_add /-
 /-- **Bernoulli's inequality** for real exponents, strict version: for `1 < p` and `-1 ≤ s`, with
 `s ≠ 0`, we have `1 + p * s < (1 + s) ^ p`. -/
 theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) :
@@ -219,7 +232,9 @@ theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠
     · field_simp [log_one]
     · nlinarith
 #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
+-/
 
+#print one_add_mul_self_le_rpow_one_add /-
 /-- **Bernoulli's inequality** for real exponents, non-strict version: for `1 ≤ p` and `-1 ≤ s`
 we have `1 + p * s ≤ (1 + s) ^ p`. -/
 theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) :
@@ -231,7 +246,9 @@ theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp
   · simp [hs']
   exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
 #align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
+-/
 
+#print strictConvexOn_rpow /-
 /- For `p : ℝ` with `1 < p`, `λ x, x ^ p` is strictly convex on $[0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -276,14 +293,18 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
       field_simp [hy.ne', hy'.ne'] at H ⊢
       linear_combination -H
 #align strict_convex_on_rpow strictConvexOn_rpow
+-/
 
+#print convexOn_rpow /-
 theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ p :=
   by
   rcases eq_or_lt_of_le hp with (rfl | hp)
   · simpa using convexOn_id (convex_Ici _)
   exact (strictConvexOn_rpow hp).ConvexOn
 #align convex_on_rpow convexOn_rpow
+-/
 
+#print strictConcaveOn_log_Iio /-
 theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log :=
   by
   refine' ⟨convex_Iio _, _⟩
@@ -297,4 +318,5 @@ theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log :=
     _ = log (-(a • x + b • y)) := by congr 1 <;> simp only [Algebra.id.smul_eq_mul] <;> ring
     _ = _ := by rw [log_neg_eq_log]
 #align strict_concave_on_log_Iio strictConcaveOn_log_Iio
+-/
 
Diff
@@ -62,7 +62,6 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp :=
       _ = exp y * (1 - exp (x - y)) := by ring
       _ < exp y * -(x - y) := (mul_lt_mul_of_pos_left _ y.exp_pos)
       _ = exp y * (y - x) := by ring
-      
     linarith [add_one_lt_exp_of_nonzero h2.ne]
   · have h1 : 0 < z - y := by linarith
     rw [lt_div_iff h1]
@@ -70,7 +69,6 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp :=
       exp y * (z - y) < exp y * (exp (z - y) - 1) := mul_lt_mul_of_pos_left _ y.exp_pos
       _ = exp (z - y) * exp y - exp y := by ring
       _ ≤ exp z - exp y := by rw [← exp_add] <;> ring_nf
-      
     linarith [add_one_lt_exp_of_nonzero h1.ne']
 #align strict_convex_on_exp strictConvexOn_exp
 
@@ -105,7 +103,6 @@ theorem convexOn_pow (n : ℕ) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n :=
     _ ≤ (μ * a + ν * b) * (μ * a ^ k + ν * b ^ k) + (b ^ k - a ^ k) * (b - a) * μ * ν := by linarith
     _ = (μ + ν) * (μ * a ^ k.succ + ν * b ^ k.succ) := by ring
     _ = μ * a ^ k.succ + ν * b ^ k.succ := by rw [h] <;> ring
-    
 #align convex_on_pow convexOn_pow
 
 /-- `x^n`, `n : ℕ` is convex on the whole real line whenever `n` is even.
@@ -124,7 +121,6 @@ theorem Even.convexOn_pow {n : ℕ} (hn : Even n) : ConvexOn ℝ Set.univ fun x
     _ = (μ * a ^ 2 + ν * b ^ 2) ^ k := by rw [h] <;> ring
     _ ≤ μ * (a ^ 2) ^ k + ν * (b ^ 2) ^ k := _
     _ ≤ μ * a ^ (2 * k) + ν * b ^ (2 * k) := by ring
-    
   · linarith
   · refine' (convexOn_pow k).2 _ _ hμ hν h <;> dsimp <;> positivity
 #align even.convex_on_pow Even.convexOn_pow
@@ -150,7 +146,6 @@ theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
         _ ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) := (pow_le_pow_of_le_left _ _ _)
         _ = (μ * b + ν * a) ^ (n + 1) * (μ * a + ν * b) ^ (n + 1) := by rw [mul_pow]
         _ ≤ (μ * b ^ (n + 1) + ν * a ^ (n + 1)) * (μ * a + ν * b) ^ (n + 1) := _
-        
       · positivity
       · have : 0 ≤ μ * ν * (a - b) ^ 2 := by positivity
         linarith
@@ -182,7 +177,6 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
       log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne']
       _ < z / y - 1 := (log_lt_sub_one_of_pos hyz' hyz'')
       _ = y⁻¹ * (z - y) := by field_simp [hy.ne']
-      
   · have h : 0 < y - x := by linarith
     rw [lt_div_iff h]
     have hxy' : 0 < x / y := by positivity
@@ -195,7 +189,6 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
       _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy'']
       _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne']
       _ = log y - log x := by ring
-      
 #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi
 
 /-- **Bernoulli's inequality** for real exponents, strict version: for `1 < p` and `-1 ≤ s`, with
@@ -303,6 +296,5 @@ theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log :=
     _ < log (a • -x + b • -y) := (strictConcaveOn_log_Ioi.2 hx' hy' hxy' ha hb hab)
     _ = log (-(a • x + b • y)) := by congr 1 <;> simp only [Algebra.id.smul_eq_mul] <;> ring
     _ = _ := by rw [log_neg_eq_log]
-    
 #align strict_concave_on_log_Iio strictConcaveOn_log_Iio
 
Diff
@@ -250,7 +250,7 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
   have hy : 0 < y := by linarith
   have hy' : 0 < y ^ p := rpow_pos_of_pos hy _
   have H1 : y ^ (p - 1 + 1) = y ^ (p - 1) * y := rpow_add_one hy.ne' _
-  ring_nf  at H1 
+  ring_nf at H1 
   trans p * y ^ (p - 1)
   · have hyx' : x - y < 0 := by linarith only [hxy]
     have h3 : 0 < y - x := by linarith only [hxy]
@@ -263,8 +263,8 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
     rw [div_lt_iff h3, ← div_lt_div_right hy']
     convert this using 1
     · have H : (x / y) ^ p = x ^ p / y ^ p := div_rpow hx hy.le _
-      ring_nf  at H ⊢
-      field_simp [hy.ne', hy'.ne']  at H ⊢
+      ring_nf at H ⊢
+      field_simp [hy.ne', hy'.ne'] at H ⊢
       linear_combination H
     · field_simp [hy.ne', hy'.ne']
       linear_combination p * (-y + x) * H1
@@ -279,8 +279,8 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
     · field_simp [hy.ne', hy'.ne']
       linear_combination -p * (z - y) * H1
     · have H : (z / y) ^ p = z ^ p / y ^ p := div_rpow hz hy.le _
-      ring_nf  at H ⊢
-      field_simp [hy.ne', hy'.ne']  at H ⊢
+      ring_nf at H ⊢
+      field_simp [hy.ne', hy'.ne'] at H ⊢
       linear_combination -H
 #align strict_convex_on_rpow strictConvexOn_rpow
 
Diff
@@ -176,7 +176,7 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
     have hyz' : 0 < z / y := by positivity
     have hyz'' : z / y ≠ 1 := by
       contrapose! h
-      rw [div_eq_one_iff_eq hy.ne'] at h
+      rw [div_eq_one_iff_eq hy.ne'] at h 
       simp [h]
     calc
       log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne']
@@ -188,7 +188,7 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
     have hxy' : 0 < x / y := by positivity
     have hxy'' : x / y ≠ 1 := by
       contrapose! h
-      rw [div_eq_one_iff_eq hy.ne'] at h
+      rw [div_eq_one_iff_eq hy.ne'] at h 
       simp [h]
     calc
       y⁻¹ * (y - x) = 1 - x / y := by field_simp [hy.ne']
@@ -250,7 +250,7 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
   have hy : 0 < y := by linarith
   have hy' : 0 < y ^ p := rpow_pos_of_pos hy _
   have H1 : y ^ (p - 1 + 1) = y ^ (p - 1) * y := rpow_add_one hy.ne' _
-  ring_nf  at H1
+  ring_nf  at H1 
   trans p * y ^ (p - 1)
   · have hyx' : x - y < 0 := by linarith only [hxy]
     have h3 : 0 < y - x := by linarith only [hxy]
@@ -263,8 +263,8 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
     rw [div_lt_iff h3, ← div_lt_div_right hy']
     convert this using 1
     · have H : (x / y) ^ p = x ^ p / y ^ p := div_rpow hx hy.le _
-      ring_nf  at H⊢
-      field_simp [hy.ne', hy'.ne']  at H⊢
+      ring_nf  at H ⊢
+      field_simp [hy.ne', hy'.ne']  at H ⊢
       linear_combination H
     · field_simp [hy.ne', hy'.ne']
       linear_combination p * (-y + x) * H1
@@ -279,8 +279,8 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
     · field_simp [hy.ne', hy'.ne']
       linear_combination -p * (z - y) * H1
     · have H : (z / y) ^ p = z ^ p / y ^ p := div_rpow hz hy.le _
-      ring_nf  at H⊢
-      field_simp [hy.ne', hy'.ne']  at H⊢
+      ring_nf  at H ⊢
+      field_simp [hy.ne', hy'.ne']  at H ⊢
       linear_combination -H
 #align strict_convex_on_rpow strictConvexOn_rpow
 
Diff
@@ -43,7 +43,7 @@ For `p : ℝ`, prove that `λ x, x ^ p` is concave when `0 ≤ p ≤ 1` and stri
 
 open Real Set
 
-open BigOperators NNReal
+open scoped BigOperators NNReal
 
 /-- `exp` is strictly convex on the whole real line.
 
Diff
@@ -45,12 +45,6 @@ open Real Set
 
 open BigOperators NNReal
 
-/- warning: strict_convex_on_exp -> strictConvexOn_exp is a dubious translation:
-lean 3 declaration is
-  StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.univ.{0} Real) Real.exp
-but is expected to have type
-  StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.univ.{0} Real) Real.exp
-Case conversion may be inaccurate. Consider using '#align strict_convex_on_exp strictConvexOn_expₓ'. -/
 /-- `exp` is strictly convex on the whole real line.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -80,23 +74,11 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp :=
     linarith [add_one_lt_exp_of_nonzero h1.ne']
 #align strict_convex_on_exp strictConvexOn_exp
 
-/- warning: convex_on_exp -> convexOn_exp is a dubious translation:
-lean 3 declaration is
-  ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.univ.{0} Real) Real.exp
-but is expected to have type
-  ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.univ.{0} Real) Real.exp
-Case conversion may be inaccurate. Consider using '#align convex_on_exp convexOn_expₓ'. -/
 /-- `exp` is convex on the whole real line. -/
 theorem convexOn_exp : ConvexOn ℝ univ exp :=
   strictConvexOn_exp.ConvexOn
 #align convex_on_exp convexOn_exp
 
-/- warning: convex_on_pow -> convexOn_pow is a dubious translation:
-lean 3 declaration is
-  forall (n : Nat), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ici.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.monoid)) x n)
-but is expected to have type
-  forall (n : Nat), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ici.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.instMonoidReal)) x n)
-Case conversion may be inaccurate. Consider using '#align convex_on_pow convexOn_powₓ'. -/
 /-- `x^n`, `n : ℕ` is convex on `[0, +∞)` for all `n`.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -126,12 +108,6 @@ theorem convexOn_pow (n : ℕ) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n :=
     
 #align convex_on_pow convexOn_pow
 
-/- warning: even.convex_on_pow -> Even.convexOn_pow is a dubious translation:
-lean 3 declaration is
-  forall {n : Nat}, (Even.{0} Nat Nat.hasAdd n) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.univ.{0} Real) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.monoid)) x n))
-but is expected to have type
-  forall {n : Nat}, (Even.{0} Nat instAddNat n) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.univ.{0} Real) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.instMonoidReal)) x n))
-Case conversion may be inaccurate. Consider using '#align even.convex_on_pow Even.convexOn_powₓ'. -/
 /-- `x^n`, `n : ℕ` is convex on the whole real line whenever `n` is even.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -153,12 +129,6 @@ theorem Even.convexOn_pow {n : ℕ} (hn : Even n) : ConvexOn ℝ Set.univ fun x
   · refine' (convexOn_pow k).2 _ _ hμ hν h <;> dsimp <;> positivity
 #align even.convex_on_pow Even.convexOn_pow
 
-/- warning: convex_on_zpow -> convexOn_zpow is a dubious translation:
-lean 3 declaration is
-  forall (m : Int), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ioi.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Int Real (instHPow.{0, 0} Real Int (DivInvMonoid.Pow.{0} Real (DivisionRing.toDivInvMonoid.{0} Real Real.divisionRing))) x m)
-but is expected to have type
-  forall (m : Int), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ioi.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Int Real (instHPow.{0, 0} Real Int (DivInvMonoid.Pow.{0} Real (DivisionRing.toDivInvMonoid.{0} Real Real.instDivisionRingReal))) x m)
-Case conversion may be inaccurate. Consider using '#align convex_on_zpow convexOn_zpowₓ'. -/
 /-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m`.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -191,12 +161,6 @@ theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
     · positivity
 #align convex_on_zpow convexOn_zpow
 
-/- warning: strict_concave_on_log_Ioi -> strictConcaveOn_log_Ioi is a dubious translation:
-lean 3 declaration is
-  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ioi.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) Real.log
-but is expected to have type
-  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ioi.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) Real.log
-Case conversion may be inaccurate. Consider using '#align strict_concave_on_log_Ioi strictConcaveOn_log_Ioiₓ'. -/
 /- `real.log` is strictly concave on $(0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -234,12 +198,6 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
       
 #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi
 
-/- warning: one_add_mul_self_lt_rpow_one_add -> one_add_mul_self_lt_rpow_one_add is a dubious translation:
-lean 3 declaration is
-  forall {s : Real}, (LE.le.{0} Real Real.hasLe (Neg.neg.{0} Real Real.hasNeg (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))) s) -> (Ne.{1} Real s (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) -> (forall {p : Real}, (LT.lt.{0} Real Real.hasLt (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (LT.lt.{0} Real Real.hasLt (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.hasMul) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) s) p)))
-but is expected to have type
-  forall {s : Real}, (LE.le.{0} Real Real.instLEReal (Neg.neg.{0} Real Real.instNegReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))) s) -> (Ne.{1} Real s (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) -> (forall {p : Real}, (LT.lt.{0} Real Real.instLTReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (LT.lt.{0} Real Real.instLTReal (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.instMulReal) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) s) p)))
-Case conversion may be inaccurate. Consider using '#align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_addₓ'. -/
 /-- **Bernoulli's inequality** for real exponents, strict version: for `1 < p` and `-1 ≤ s`, with
 `s ≠ 0`, we have `1 + p * s < (1 + s) ^ p`. -/
 theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) :
@@ -269,12 +227,6 @@ theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠
     · nlinarith
 #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
 
-/- warning: one_add_mul_self_le_rpow_one_add -> one_add_mul_self_le_rpow_one_add is a dubious translation:
-lean 3 declaration is
-  forall {s : Real}, (LE.le.{0} Real Real.hasLe (Neg.neg.{0} Real Real.hasNeg (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))) s) -> (forall {p : Real}, (LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (LE.le.{0} Real Real.hasLe (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.hasMul) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) s) p)))
-but is expected to have type
-  forall {s : Real}, (LE.le.{0} Real Real.instLEReal (Neg.neg.{0} Real Real.instNegReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))) s) -> (forall {p : Real}, (LE.le.{0} Real Real.instLEReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (LE.le.{0} Real Real.instLEReal (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.instMulReal) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) s) p)))
-Case conversion may be inaccurate. Consider using '#align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_addₓ'. -/
 /-- **Bernoulli's inequality** for real exponents, non-strict version: for `1 ≤ p` and `-1 ≤ s`
 we have `1 + p * s ≤ (1 + s) ^ p`. -/
 theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) :
@@ -287,12 +239,6 @@ theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp
   exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
 #align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
 
-/- warning: strict_convex_on_rpow -> strictConvexOn_rpow is a dubious translation:
-lean 3 declaration is
-  forall {p : Real}, (LT.lt.{0} Real Real.hasLt (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ici.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) x p))
-but is expected to have type
-  forall {p : Real}, (LT.lt.{0} Real Real.instLTReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ici.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) x p))
-Case conversion may be inaccurate. Consider using '#align strict_convex_on_rpow strictConvexOn_rpowₓ'. -/
 /- For `p : ℝ` with `1 < p`, `λ x, x ^ p` is strictly convex on $[0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -338,12 +284,6 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
       linear_combination -H
 #align strict_convex_on_rpow strictConvexOn_rpow
 
-/- warning: convex_on_rpow -> convexOn_rpow is a dubious translation:
-lean 3 declaration is
-  forall {p : Real}, (LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ici.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) x p))
-but is expected to have type
-  forall {p : Real}, (LE.le.{0} Real Real.instLEReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ici.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) x p))
-Case conversion may be inaccurate. Consider using '#align convex_on_rpow convexOn_rpowₓ'. -/
 theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ p :=
   by
   rcases eq_or_lt_of_le hp with (rfl | hp)
@@ -351,12 +291,6 @@ theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : 
   exact (strictConvexOn_rpow hp).ConvexOn
 #align convex_on_rpow convexOn_rpow
 
-/- warning: strict_concave_on_log_Iio -> strictConcaveOn_log_Iio is a dubious translation:
-lean 3 declaration is
-  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Iio.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) Real.log
-but is expected to have type
-  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Iio.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) Real.log
-Case conversion may be inaccurate. Consider using '#align strict_concave_on_log_Iio strictConcaveOn_log_Iioₓ'. -/
 theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log :=
   by
   refine' ⟨convex_Iio _, _⟩
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov, Sébastien Gouëzel, Heather Macbeth
 
 ! This file was ported from Lean 3 source module analysis.convex.specific_functions.basic
-! leanprover-community/mathlib commit 8f9fea08977f7e450770933ee6abb20733b47c92
+! leanprover-community/mathlib commit 0b7c740e25651db0ba63648fbae9f9d6f941e31b
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.Tactic.LinearCombination
 /-!
 # Collection of convex functions
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we prove that the following functions are convex or strictly convex:
 
 * `strict_convex_on_exp` : The exponential function is strictly convex.
Diff
@@ -42,6 +42,12 @@ open Real Set
 
 open BigOperators NNReal
 
+/- warning: strict_convex_on_exp -> strictConvexOn_exp is a dubious translation:
+lean 3 declaration is
+  StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.univ.{0} Real) Real.exp
+but is expected to have type
+  StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.univ.{0} Real) Real.exp
+Case conversion may be inaccurate. Consider using '#align strict_convex_on_exp strictConvexOn_expₓ'. -/
 /-- `exp` is strictly convex on the whole real line.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -71,11 +77,23 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp :=
     linarith [add_one_lt_exp_of_nonzero h1.ne']
 #align strict_convex_on_exp strictConvexOn_exp
 
+/- warning: convex_on_exp -> convexOn_exp is a dubious translation:
+lean 3 declaration is
+  ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.univ.{0} Real) Real.exp
+but is expected to have type
+  ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.univ.{0} Real) Real.exp
+Case conversion may be inaccurate. Consider using '#align convex_on_exp convexOn_expₓ'. -/
 /-- `exp` is convex on the whole real line. -/
 theorem convexOn_exp : ConvexOn ℝ univ exp :=
   strictConvexOn_exp.ConvexOn
 #align convex_on_exp convexOn_exp
 
+/- warning: convex_on_pow -> convexOn_pow is a dubious translation:
+lean 3 declaration is
+  forall (n : Nat), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ici.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.monoid)) x n)
+but is expected to have type
+  forall (n : Nat), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ici.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.instMonoidReal)) x n)
+Case conversion may be inaccurate. Consider using '#align convex_on_pow convexOn_powₓ'. -/
 /-- `x^n`, `n : ℕ` is convex on `[0, +∞)` for all `n`.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -105,6 +123,12 @@ theorem convexOn_pow (n : ℕ) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n :=
     
 #align convex_on_pow convexOn_pow
 
+/- warning: even.convex_on_pow -> Even.convexOn_pow is a dubious translation:
+lean 3 declaration is
+  forall {n : Nat}, (Even.{0} Nat Nat.hasAdd n) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.univ.{0} Real) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.monoid)) x n))
+but is expected to have type
+  forall {n : Nat}, (Even.{0} Nat instAddNat n) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.univ.{0} Real) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Nat Real (instHPow.{0, 0} Real Nat (Monoid.Pow.{0} Real Real.instMonoidReal)) x n))
+Case conversion may be inaccurate. Consider using '#align even.convex_on_pow Even.convexOn_powₓ'. -/
 /-- `x^n`, `n : ℕ` is convex on the whole real line whenever `n` is even.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -126,6 +150,12 @@ theorem Even.convexOn_pow {n : ℕ} (hn : Even n) : ConvexOn ℝ Set.univ fun x
   · refine' (convexOn_pow k).2 _ _ hμ hν h <;> dsimp <;> positivity
 #align even.convex_on_pow Even.convexOn_pow
 
+/- warning: convex_on_zpow -> convexOn_zpow is a dubious translation:
+lean 3 declaration is
+  forall (m : Int), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ioi.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Int Real (instHPow.{0, 0} Real Int (DivInvMonoid.Pow.{0} Real (DivisionRing.toDivInvMonoid.{0} Real Real.divisionRing))) x m)
+but is expected to have type
+  forall (m : Int), ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ioi.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Int Real (instHPow.{0, 0} Real Int (DivInvMonoid.Pow.{0} Real (DivisionRing.toDivInvMonoid.{0} Real Real.instDivisionRingReal))) x m)
+Case conversion may be inaccurate. Consider using '#align convex_on_zpow convexOn_zpowₓ'. -/
 /-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m`.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -158,6 +188,12 @@ theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
     · positivity
 #align convex_on_zpow convexOn_zpow
 
+/- warning: strict_concave_on_log_Ioi -> strictConcaveOn_log_Ioi is a dubious translation:
+lean 3 declaration is
+  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ioi.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) Real.log
+but is expected to have type
+  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ioi.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) Real.log
+Case conversion may be inaccurate. Consider using '#align strict_concave_on_log_Ioi strictConcaveOn_log_Ioiₓ'. -/
 /- `real.log` is strictly concave on $(0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -195,6 +231,12 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log :=
       
 #align strict_concave_on_log_Ioi strictConcaveOn_log_Ioi
 
+/- warning: one_add_mul_self_lt_rpow_one_add -> one_add_mul_self_lt_rpow_one_add is a dubious translation:
+lean 3 declaration is
+  forall {s : Real}, (LE.le.{0} Real Real.hasLe (Neg.neg.{0} Real Real.hasNeg (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))) s) -> (Ne.{1} Real s (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) -> (forall {p : Real}, (LT.lt.{0} Real Real.hasLt (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (LT.lt.{0} Real Real.hasLt (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.hasMul) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) s) p)))
+but is expected to have type
+  forall {s : Real}, (LE.le.{0} Real Real.instLEReal (Neg.neg.{0} Real Real.instNegReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))) s) -> (Ne.{1} Real s (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) -> (forall {p : Real}, (LT.lt.{0} Real Real.instLTReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (LT.lt.{0} Real Real.instLTReal (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.instMulReal) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) s) p)))
+Case conversion may be inaccurate. Consider using '#align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_addₓ'. -/
 /-- **Bernoulli's inequality** for real exponents, strict version: for `1 < p` and `-1 ≤ s`, with
 `s ≠ 0`, we have `1 + p * s < (1 + s) ^ p`. -/
 theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) :
@@ -224,6 +266,12 @@ theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠
     · nlinarith
 #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
 
+/- warning: one_add_mul_self_le_rpow_one_add -> one_add_mul_self_le_rpow_one_add is a dubious translation:
+lean 3 declaration is
+  forall {s : Real}, (LE.le.{0} Real Real.hasLe (Neg.neg.{0} Real Real.hasNeg (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne)))) s) -> (forall {p : Real}, (LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (LE.le.{0} Real Real.hasLe (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.hasMul) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.hasAdd) (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) s) p)))
+but is expected to have type
+  forall {s : Real}, (LE.le.{0} Real Real.instLEReal (Neg.neg.{0} Real Real.instNegReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal))) s) -> (forall {p : Real}, (LE.le.{0} Real Real.instLEReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (LE.le.{0} Real Real.instLEReal (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) (HMul.hMul.{0, 0, 0} Real Real Real (instHMul.{0} Real Real.instMulReal) p s)) (HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) (HAdd.hAdd.{0, 0, 0} Real Real Real (instHAdd.{0} Real Real.instAddReal) (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) s) p)))
+Case conversion may be inaccurate. Consider using '#align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_addₓ'. -/
 /-- **Bernoulli's inequality** for real exponents, non-strict version: for `1 ≤ p` and `-1 ≤ s`
 we have `1 + p * s ≤ (1 + s) ^ p`. -/
 theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp : 1 ≤ p) :
@@ -236,6 +284,12 @@ theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp
   exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
 #align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
 
+/- warning: strict_convex_on_rpow -> strictConvexOn_rpow is a dubious translation:
+lean 3 declaration is
+  forall {p : Real}, (LT.lt.{0} Real Real.hasLt (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ici.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) x p))
+but is expected to have type
+  forall {p : Real}, (LT.lt.{0} Real Real.instLTReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (StrictConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ici.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) x p))
+Case conversion may be inaccurate. Consider using '#align strict_convex_on_rpow strictConvexOn_rpowₓ'. -/
 /- For `p : ℝ` with `1 < p`, `λ x, x ^ p` is strictly convex on $[0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
@@ -281,6 +335,12 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
       linear_combination -H
 #align strict_convex_on_rpow strictConvexOn_rpow
 
+/- warning: convex_on_rpow -> convexOn_rpow is a dubious translation:
+lean 3 declaration is
+  forall {p : Real}, (LE.le.{0} Real Real.hasLe (OfNat.ofNat.{0} Real 1 (OfNat.mk.{0} Real 1 (One.one.{0} Real Real.hasOne))) p) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Ici.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.hasPow) x p))
+but is expected to have type
+  forall {p : Real}, (LE.le.{0} Real Real.instLEReal (OfNat.ofNat.{0} Real 1 (One.toOfNat1.{0} Real Real.instOneReal)) p) -> (ConvexOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Ici.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) (fun (x : Real) => HPow.hPow.{0, 0, 0} Real Real Real (instHPow.{0, 0} Real Real Real.instPowReal) x p))
+Case conversion may be inaccurate. Consider using '#align convex_on_rpow convexOn_rpowₓ'. -/
 theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ p :=
   by
   rcases eq_or_lt_of_le hp with (rfl | hp)
@@ -288,6 +348,12 @@ theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : 
   exact (strictConvexOn_rpow hp).ConvexOn
 #align convex_on_rpow convexOn_rpow
 
+/- warning: strict_concave_on_log_Iio -> strictConcaveOn_log_Iio is a dubious translation:
+lean 3 declaration is
+  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.addCommMonoid Real.orderedAddCommMonoid (Mul.toSMul.{0} Real Real.hasMul) (Mul.toSMul.{0} Real Real.hasMul) (Set.Iio.{0} Real Real.preorder (OfNat.ofNat.{0} Real 0 (OfNat.mk.{0} Real 0 (Zero.zero.{0} Real Real.hasZero)))) Real.log
+but is expected to have type
+  StrictConcaveOn.{0, 0, 0} Real Real Real Real.orderedSemiring Real.instAddCommMonoidReal Real.orderedAddCommMonoid (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Algebra.toSMul.{0, 0} Real Real Real.instCommSemiringReal Real.semiring (NormedAlgebra.toAlgebra.{0, 0} Real Real Real.normedField (SeminormedCommRing.toSeminormedRing.{0} Real (NormedCommRing.toSeminormedCommRing.{0} Real Real.normedCommRing)) (IsROrC.toNormedAlgebra.{0} Real Real.isROrC))) (Set.Iio.{0} Real Real.instPreorderReal (OfNat.ofNat.{0} Real 0 (Zero.toOfNat0.{0} Real Real.instZeroReal))) Real.log
+Case conversion may be inaccurate. Consider using '#align strict_concave_on_log_Iio strictConcaveOn_log_Iioₓ'. -/
 theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log :=
   by
   refine' ⟨convex_Iio _, _⟩

Changes in mathlib4

mathlib3
mathlib4
chore: superfluous parentheses part 2 (#12131)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -78,7 +78,7 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
       simp [h]
     calc
       log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne']
-      _ < z / y - 1 := (log_lt_sub_one_of_pos hyz' hyz'')
+      _ < z / y - 1 := log_lt_sub_one_of_pos hyz' hyz''
       _ = y⁻¹ * (z - y) := by field_simp
   · have h : 0 < y - x := by linarith
     rw [lt_div_iff h]
@@ -217,7 +217,7 @@ theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log := by
   have hxy' : -x ≠ -y := by contrapose! hxy; linarith
   calc
     a • log x + b • log y = a • log (-x) + b • log (-y) := by simp_rw [log_neg_eq_log]
-    _ < log (a • -x + b • -y) := (strictConcaveOn_log_Ioi.2 hx' hy' hxy' ha hb hab)
+    _ < log (a • -x + b • -y) := strictConcaveOn_log_Ioi.2 hx' hy' hxy' ha hb hab
     _ = log (-(a • x + b • y)) := by congr 1; simp only [Algebra.id.smul_eq_mul]; ring
     _ = _ := by rw [log_neg_eq_log]
 #align strict_concave_on_log_Iio strictConcaveOn_log_Iio
doc: convert many comments into doc comments (#11940)

All of these changes appear to be oversights to me.

Diff
@@ -63,7 +63,7 @@ theorem convexOn_exp : ConvexOn ℝ univ exp :=
   strictConvexOn_exp.convexOn
 #align convex_on_exp convexOn_exp
 
-/- `Real.log` is strictly concave on $(0, +∞)$. -/
+/-- `Real.log` is strictly concave on `(0, +∞)`. -/
 theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
   apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ))
   intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz
feat: Bernoulli's inequality for 0 < p < 1 (#10982)

Also substantially speed up some existing proofs in the p < 1 case.

Diff
@@ -21,26 +21,21 @@ In this file we prove that the following functions are convex or strictly convex
   `1 ≤ p` and strictly convex when `1 < p`.
 
 The proofs in this file are deliberately elementary, *not* by appealing to the sign of the second
-derivative.  This is in order to keep this file early in the import hierarchy, since it is on the
+derivative. This is in order to keep this file early in the import hierarchy, since it is on the
 path to Hölder's and Minkowski's inequalities and after that to Lp spaces and most of measure
 theory.
 
-## TODO
-
-For `p : ℝ`, prove that `fun x ↦ x ^ p` is concave when `0 ≤ p ≤ 1` and strictly concave when
-`0 < p < 1`.
+(Strict) concavity of `fun x ↦ x ^ p` for `0 < p < 1` (`0 ≤ p ≤ 1`) can be found in
+`Analysis.Convex.SpecificFunctions.Pow`.
 
 ## See also
 
-`Analysis.Convex.Mul` for convexity of `x ↦ x ^ n``
+`Analysis.Convex.Mul` for convexity of `x ↦ x ^ n`
 -/
 
 open Real Set BigOperators NNReal
 
-/-- `Real.exp` is strictly convex on the whole real line.
-
-We give an elementary proof rather than using the second derivative test, since this lemma is
-needed early in the analysis library. -/
+/-- `Real.exp` is strictly convex on the whole real line. -/
 theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by
   apply strictConvexOn_of_slope_strict_mono_adjacent convex_univ
   rintro x y z - - hxy hyz
@@ -68,13 +63,10 @@ theorem convexOn_exp : ConvexOn ℝ univ exp :=
   strictConvexOn_exp.convexOn
 #align convex_on_exp convexOn_exp
 
-/- `Real.log` is strictly concave on $(0, +∞)$.
-
-We give an elementary proof rather than using the second derivative test, since this lemma is
-needed early in the analysis library. -/
+/- `Real.log` is strictly concave on $(0, +∞)$. -/
 theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
   apply strictConcaveOn_of_slope_strict_anti_adjacent (convex_Ioi (0 : ℝ))
-  rintro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz
+  intro x y z (hx : 0 < x) (hz : 0 < z) hxy hyz
   have hy : 0 < y := hx.trans hxy
   trans y⁻¹
   · have h : 0 < z - y := by linarith
@@ -106,34 +98,28 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
 `s ≠ 0`, we have `1 + p * s < (1 + s) ^ p`. -/
 theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp : 1 < p) :
     1 + p * s < (1 + s) ^ p := by
-  rcases eq_or_lt_of_le hs with (rfl | hs)
-  · have : p ≠ 0 := by positivity
-    simpa [zero_rpow this]
-  have hs1 : 0 < 1 + s := by linarith
+  have hp' : 0 < p := zero_lt_one.trans hp
+  rcases eq_or_lt_of_le hs with rfl | hs
+  · rwa [add_right_neg, zero_rpow hp'.ne', mul_neg_one, add_neg_lt_iff_lt_add, zero_add]
+  have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs
   rcases le_or_lt (1 + p * s) 0 with hs2 | hs2
   · exact hs2.trans_lt (rpow_pos_of_pos hs1 _)
+  have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp
+  have hs4 : 1 + p * s ≠ 1 := by
+    contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp'.ne', false_or] at hs'
   rw [rpow_def_of_pos hs1, ← exp_log hs2]
   apply exp_strictMono
-  have hp : 0 < p := by positivity
-  have hs3 : 1 + s ≠ 1 := by contrapose! hs'; linarith
-  have hs4 : 1 + p * s ≠ 1 := by contrapose! hs'; nlinarith
   cases' lt_or_gt_of_ne hs' with hs' hs'
-  · rw [← div_lt_iff hp, ← div_lt_div_right_of_neg hs']
-    -- Porting note: previously we could write `zero_lt_one` inline,
-    -- but now Lean doesn't guess we are talking about `1` fast enough.
-    haveI : (1 : ℝ) ∈ Ioi 0 := zero_lt_one
-    convert strictConcaveOn_log_Ioi.secant_strict_mono this hs2 hs1 hs4 hs3 _ using 1
-    · field_simp
-    · field_simp
-    · nlinarith
-  · rw [← div_lt_iff hp, ← div_lt_div_right hs']
-    -- Porting note: previously we could write `zero_lt_one` inline,
-    -- but now Lean doesn't guess we are talking about `1` fast enough.
-    haveI : (1 : ℝ) ∈ Ioi 0 := zero_lt_one
-    convert strictConcaveOn_log_Ioi.secant_strict_mono this hs1 hs2 hs3 hs4 _ using 1
-    · field_simp
-    · field_simp
-    · nlinarith
+  · rw [← div_lt_iff hp', ← div_lt_div_right_of_neg hs']
+    convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1
+    · rw [add_sub_cancel_left, log_one, sub_zero]
+    · rw [add_sub_cancel_left, div_div, log_one, sub_zero]
+    · apply add_lt_add_left (mul_lt_of_one_lt_left hs' hp)
+  · rw [← div_lt_iff hp', ← div_lt_div_right hs']
+    convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1
+    · rw [add_sub_cancel_left, div_div, log_one, sub_zero]
+    · rw [add_sub_cancel_left, log_one, sub_zero]
+    · apply add_lt_add_left (lt_mul_of_one_lt_left hs' hp)
 #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
 
 /-- **Bernoulli's inequality** for real exponents, non-strict version: for `1 ≤ p` and `-1 ≤ s`
@@ -147,52 +133,77 @@ theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp
   exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
 #align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
 
-/- For `p : ℝ` with `1 < p`, `fun x ↦ x ^ p` is strictly convex on $[0, +∞)$.
+/-- **Bernoulli's inequality** for real exponents, strict version: for `0 < p < 1` and `-1 ≤ s`,
+with `s ≠ 0`, we have `(1 + s) ^ p < 1 + p * s`. -/
+theorem rpow_one_add_lt_one_add_mul_self {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠ 0) {p : ℝ} (hp1 : 0 < p)
+    (hp2 : p < 1) : (1 + s) ^ p < 1 + p * s := by
+  rcases eq_or_lt_of_le hs with rfl | hs
+  · rwa [add_right_neg, zero_rpow hp1.ne', mul_neg_one, lt_add_neg_iff_add_lt, zero_add]
+  have hs1 : 0 < 1 + s := neg_lt_iff_pos_add'.mp hs
+  have hs2 : 0 < 1 + p * s := by
+    rw [← neg_lt_iff_pos_add']
+    rcases lt_or_gt_of_ne hs' with h | h
+    · exact hs.trans (lt_mul_of_lt_one_left h hp2)
+    · exact neg_one_lt_zero.trans (mul_pos hp1 h)
+  have hs3 : 1 + s ≠ 1 := hs' ∘ add_right_eq_self.mp
+  have hs4 : 1 + p * s ≠ 1 := by
+    contrapose! hs'; rwa [add_right_eq_self, mul_eq_zero, eq_false_intro hp1.ne', false_or] at hs'
+  rw [rpow_def_of_pos hs1, ← exp_log hs2]
+  apply exp_strictMono
+  cases' lt_or_gt_of_ne hs' with hs' hs'
+  · rw [← lt_div_iff hp1, ← div_lt_div_right_of_neg hs']
+    convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs1 hs2 hs3 hs4 _ using 1
+    · rw [add_sub_cancel_left, div_div, log_one, sub_zero]
+    · rw [add_sub_cancel_left, log_one, sub_zero]
+    · apply add_lt_add_left (lt_mul_of_lt_one_left hs' hp2)
+  · rw [← lt_div_iff hp1, ← div_lt_div_right hs']
+    convert strictConcaveOn_log_Ioi.secant_strict_mono (zero_lt_one' ℝ) hs2 hs1 hs4 hs3 _ using 1
+    · rw [add_sub_cancel_left, log_one, sub_zero]
+    · rw [add_sub_cancel_left, div_div, log_one, sub_zero]
+    · apply add_lt_add_left (mul_lt_of_lt_one_left hs' hp2)
+
+/-- **Bernoulli's inequality** for real exponents, non-strict version: for `0 ≤ p ≤ 1` and `-1 ≤ s`
+we have `(1 + s) ^ p ≤ 1 + p * s`. -/
+theorem rpow_one_add_le_one_add_mul_self {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp1 : 0 ≤ p) (hp2 : p ≤ 1) :
+    (1 + s) ^ p ≤ 1 + p * s := by
+  rcases eq_or_lt_of_le hp1 with (rfl | hp1)
+  · simp
+  rcases eq_or_lt_of_le hp2 with (rfl | hp2)
+  · simp
+  by_cases hs' : s = 0
+  · simp [hs']
+  exact (rpow_one_add_lt_one_add_mul_self hs hs' hp1 hp2).le
 
-We give an elementary proof rather than using the second derivative test, since this lemma is
-needed early in the analysis library. -/
-theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0) fun x : ℝ => x ^ p := by
+/-- For `p : ℝ` with `1 < p`, `fun x ↦ x ^ p` is strictly convex on $[0, +∞)$. -/
+theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0) fun x : ℝ ↦ x ^ p := by
   apply strictConvexOn_of_slope_strict_mono_adjacent (convex_Ici (0 : ℝ))
-  rintro x y z (hx : 0 ≤ x) (hz : 0 ≤ z) hxy hyz
-  have hy : 0 < y := by linarith
+  intro x y z (hx : 0 ≤ x) (hz : 0 ≤ z) hxy hyz
+  have hy : 0 < y := hx.trans_lt hxy
   have hy' : 0 < y ^ p := rpow_pos_of_pos hy _
-  have H1 : y ^ (p - 1 + 1) = y ^ (p - 1) * y := rpow_add_one hy.ne' _
-  ring_nf at H1
   trans p * y ^ (p - 1)
-  · have h3 : 0 < y - x := by linarith only [hxy]
-    have hyx'' : x / y < 1 := by rwa [div_lt_one hy]
-    have hyx''' : x / y - 1 < 0 := by linarith only [hyx'']
-    have hyx'''' : 0 ≤ x / y := by positivity
-    have hyx''''' : -1 ≤ x / y - 1 := by linarith only [hyx'''']
-    have : 1 - (1 + (x / y - 1)) ^ p < -p * (x / y - 1) := by
-      linarith [one_add_mul_self_lt_rpow_one_add hyx''''' hyx'''.ne hp]
-    rw [div_lt_iff h3, ← div_lt_div_right hy']
-    convert this using 1
-    · have H : (x / y) ^ p = x ^ p / y ^ p := div_rpow hx hy.le _
-      ring_nf at H ⊢
-      field_simp at H ⊢
-      linear_combination H
-    · ring_nf at H1 ⊢
-      field_simp
-      linear_combination p * (-y + x) * H1
-  · have hyz' : 0 < z - y := by linarith only [hyz]
-    have hyz'' : 1 < z / y := by rwa [one_lt_div hy]
-    have hyz''' : 0 < z / y - 1 := by linarith only [hyz'']
-    have hyz'''' : -1 ≤ z / y - 1 := by linarith only [hyz'']
-    have : p * (z / y - 1) < (1 + (z / y - 1)) ^ p - 1 := by
-      linarith [one_add_mul_self_lt_rpow_one_add hyz'''' hyz'''.ne' hp]
-    rw [lt_div_iff hyz', ← div_lt_div_right hy']
-    convert this using 1
-    · ring_nf at H1 ⊢
-      field_simp at H1 ⊢
-      linear_combination p * (y - z) * y ^ p * H1
-    · have H : (z / y) ^ p = z ^ p / y ^ p := div_rpow hz hy.le _
-      ring_nf at H ⊢
-      field_simp at H ⊢
-      linear_combination -H
+  · have q : 0 < y - x := by rwa [sub_pos]
+    rw [div_lt_iff q, ← div_lt_div_right hy', _root_.sub_div, div_self hy'.ne', ← div_rpow hx hy.le,
+      sub_lt_comm, ← add_sub_cancel_right (x / y) 1, add_comm, add_sub_assoc, ← div_mul_eq_mul_div,
+      mul_div_assoc, ← rpow_sub hy, sub_sub_cancel_left, rpow_neg_one, mul_assoc, ← div_eq_inv_mul,
+      sub_eq_add_neg, ← mul_neg, ← neg_div, neg_sub, _root_.sub_div, div_self hy.ne']
+    apply one_add_mul_self_lt_rpow_one_add _ _ hp
+    · rw [le_sub_iff_add_le, add_left_neg, div_nonneg_iff]
+      exact Or.inl ⟨hx, hy.le⟩
+    · rw [sub_ne_zero]
+      exact ((div_lt_one hy).mpr hxy).ne
+  · have q : 0 < z - y := by rwa [sub_pos]
+    rw [lt_div_iff q, ← div_lt_div_right hy', _root_.sub_div, div_self hy'.ne', ← div_rpow hz hy.le,
+      lt_sub_iff_add_lt', ← add_sub_cancel_right (z / y) 1, add_comm _ 1, add_sub_assoc,
+      ← div_mul_eq_mul_div, mul_div_assoc, ← rpow_sub hy, sub_sub_cancel_left, rpow_neg_one,
+      mul_assoc, ← div_eq_inv_mul, _root_.sub_div, div_self hy.ne']
+    apply one_add_mul_self_lt_rpow_one_add _ _ hp
+    · rw [le_sub_iff_add_le, add_left_neg, div_nonneg_iff]
+      exact Or.inl ⟨hz, hy.le⟩
+    · rw [sub_ne_zero]
+      exact ((one_lt_div hy).mpr hyz).ne'
 #align strict_convex_on_rpow strictConvexOn_rpow
 
-theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ p := by
+theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : ℝ ↦ x ^ p := by
   rcases eq_or_lt_of_le hp with (rfl | hp)
   · simpa using convexOn_id (convex_Ici _)
   exact (strictConvexOn_rpow hp).convexOn
@@ -200,7 +211,7 @@ theorem convexOn_rpow {p : ℝ} (hp : 1 ≤ p) : ConvexOn ℝ (Ici 0) fun x : 
 
 theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log := by
   refine' ⟨convex_Iio _, _⟩
-  rintro x (hx : x < 0) y (hy : y < 0) hxy a b ha hb hab
+  intro x (hx : x < 0) y (hy : y < 0) hxy a b ha hb hab
   have hx' : 0 < -x := by linarith
   have hy' : 0 < -y := by linarith
   have hxy' : -x ≠ -y := by contrapose! hxy; linarith
@@ -209,7 +220,6 @@ theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log := by
     _ < log (a • -x + b • -y) := (strictConcaveOn_log_Ioi.2 hx' hy' hxy' ha hb hab)
     _ = log (-(a • x + b • y)) := by congr 1; simp only [Algebra.id.smul_eq_mul]; ring
     _ = _ := by rw [log_neg_eq_log]
-
 #align strict_concave_on_log_Iio strictConcaveOn_log_Iio
 
 namespace Real
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -3,7 +3,6 @@ Copyright (c) 2020 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov, Sébastien Gouëzel, Heather Macbeth
 -/
-import Mathlib.Analysis.Convex.Mul
 import Mathlib.Analysis.Convex.Slope
 import Mathlib.Analysis.SpecialFunctions.Pow.Real
 import Mathlib.Tactic.LinearCombination
@@ -69,10 +68,6 @@ theorem convexOn_exp : ConvexOn ℝ univ exp :=
   strictConvexOn_exp.convexOn
 #align convex_on_exp convexOn_exp
 
-#align convex_on_pow convexOn_pow
-#align even.convex_on_pow Even.convexOn_pow
-#align convex_on_zpow convexOn_zpow
-
 /- `Real.log` is strictly concave on $(0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
chore(*): replace $ with <| (#9319)

See Zulip thread for the discussion.

Diff
@@ -225,7 +225,7 @@ lemma exp_mul_le_cosh_add_mul_sinh {t : ℝ} (ht : |t| ≤ 1) (x : ℝ) :
   calc
     _ = exp ((1 + t) / 2 * x + (1 - t) / 2 * (-x)) := by ring_nf
     _ ≤ (1 + t) / 2 * exp x + (1 - t) / 2 * exp (-x) :=
-        convexOn_exp.2 (Set.mem_univ _) (Set.mem_univ _) (by linarith) (by linarith) $ by ring
+        convexOn_exp.2 (Set.mem_univ _) (Set.mem_univ _) (by linarith) (by linarith) <| by ring
     _ = _ := by rw [cosh_eq, sinh_eq]; ring
 
 end Real
chore: remove uses of cases' (#9171)

I literally went through and regex'd some uses of cases', replacing them with rcases; this is meant to be a low effort PR as I hope that tools can do this in the future.

rcases is an easier replacement than cases, though with better tools we could in future do a second pass converting simple rcases added here (and existing ones) to cases.

Diff
@@ -115,7 +115,7 @@ theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠
   · have : p ≠ 0 := by positivity
     simpa [zero_rpow this]
   have hs1 : 0 < 1 + s := by linarith
-  cases' le_or_lt (1 + p * s) 0 with hs2 hs2
+  rcases le_or_lt (1 + p * s) 0 with hs2 | hs2
   · exact hs2.trans_lt (rpow_pos_of_pos hs1 _)
   rw [rpow_def_of_pos hs1, ← exp_log hs2]
   apply exp_strictMono
feat: exp (t * x) ≤ cosh x + t * sinh x (#9097)

From LeanAPAP

Diff
@@ -216,3 +216,16 @@ theorem strictConcaveOn_log_Iio : StrictConcaveOn ℝ (Iio 0) log := by
     _ = _ := by rw [log_neg_eq_log]
 
 #align strict_concave_on_log_Iio strictConcaveOn_log_Iio
+
+namespace Real
+
+lemma exp_mul_le_cosh_add_mul_sinh {t : ℝ} (ht : |t| ≤ 1) (x : ℝ) :
+    exp (t * x) ≤ cosh x + t * sinh x := by
+  rw [abs_le] at ht
+  calc
+    _ = exp ((1 + t) / 2 * x + (1 - t) / 2 * (-x)) := by ring_nf
+    _ ≤ (1 + t) / 2 * exp x + (1 - t) / 2 * exp (-x) :=
+        convexOn_exp.2 (Set.mem_univ _) (Set.mem_univ _) (by linarith) (by linarith) $ by ring
+    _ = _ := by rw [cosh_eq, sinh_eq]; ring
+
+end Real
feat: x ^ n / n ! ≤ exp x (#9099)

Also make private/delete the intermediate lemmas of the form x + 1 ≤ Real.exp x so that people use the more general final results instead.

Diff
@@ -52,14 +52,14 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by
     calc
       exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf
       _ = exp y * (1 - exp (x - y)) := by ring
-      _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp_of_nonzero h2.ne]
+      _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp h2.ne]
       _ = exp y * (y - x) := by ring
   · have h1 : 0 < z - y := by linarith
     rw [lt_div_iff h1]
     calc
       exp y * (z - y) < exp y * (exp (z - y) - 1) := by
         gcongr _ * ?_
-        linarith [add_one_lt_exp_of_nonzero h1.ne']
+        linarith [add_one_lt_exp h1.ne']
       _ = exp (z - y) * exp y - exp y := by ring
       _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl
 #align strict_convex_on_exp strictConvexOn_exp
feat: Multiplication of convex function (#7650)

We prove that the product of nonnegative monovarying convex functions is convex. We take the opportunity to golf the various proofs of the convexity of x ↦ x ^ n.

Diff
@@ -3,6 +3,7 @@ Copyright (c) 2020 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov, Sébastien Gouëzel, Heather Macbeth
 -/
+import Mathlib.Analysis.Convex.Mul
 import Mathlib.Analysis.Convex.Slope
 import Mathlib.Analysis.SpecialFunctions.Pow.Real
 import Mathlib.Tactic.LinearCombination
@@ -15,9 +16,6 @@ import Mathlib.Tactic.LinearCombination
 In this file we prove that the following functions are convex or strictly convex:
 
 * `strictConvexOn_exp` : The exponential function is strictly convex.
-* `Even.convexOn_pow`: For an even `n : ℕ`, `fun x ↦ x ^ n` is convex.
-* `convexOn_pow`: For `n : ℕ`, `fun x ↦ x ^ n` is convex on $[0, +∞)$.
-* `convexOn_zpow`: For `m : ℤ`, `fun x ↦ x ^ m` is convex on $[0, +∞)$.
 * `strictConcaveOn_log_Ioi`, `strictConcaveOn_log_Iio`: `Real.log` is strictly concave on
   $(0, +∞)$ and $(-∞, 0)$ respectively.
 * `convexOn_rpow`, `strictConvexOn_rpow` : For `p : ℝ`, `fun x ↦ x ^ p` is convex on $[0, +∞)$ when
@@ -32,6 +30,10 @@ theory.
 
 For `p : ℝ`, prove that `fun x ↦ x ^ p` is concave when `0 ≤ p ≤ 1` and strictly concave when
 `0 < p < 1`.
+
+## See also
+
+`Analysis.Convex.Mul` for convexity of `x ↦ x ^ n``
 -/
 
 open Real Set BigOperators NNReal
@@ -67,83 +69,8 @@ theorem convexOn_exp : ConvexOn ℝ univ exp :=
   strictConvexOn_exp.convexOn
 #align convex_on_exp convexOn_exp
 
-/-- `x^n`, `n : ℕ` is convex on `[0, +∞)` for all `n`.
-
-We give an elementary proof rather than using the second derivative test, since this lemma is
-needed early in the analysis library. -/
-theorem convexOn_pow (n : ℕ) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
-  induction' n with k IH
-  · exact convexOn_const (1 : ℝ) (convex_Ici _)
-  refine' ⟨convex_Ici _, _⟩
-  rintro a (ha : 0 ≤ a) b (hb : 0 ≤ b) μ ν hμ hν h
-  have H := IH.2 ha hb hμ hν h
-  have : 0 ≤ (b ^ k - a ^ k) * (b - a) * μ * ν := by
-    cases' le_or_lt a b with hab hab
-    · have : a ^ k ≤ b ^ k := by gcongr
-      have : 0 ≤ (b ^ k - a ^ k) * (b - a) := by nlinarith
-      positivity
-    · have : b ^ k ≤ a ^ k := by gcongr
-      have : 0 ≤ (b ^ k - a ^ k) * (b - a) := by nlinarith
-      positivity
-  calc
-    (μ * a + ν * b) ^ k.succ = (μ * a + ν * b) * (μ * a + ν * b) ^ k := pow_succ _ _
-    _ ≤ (μ * a + ν * b) * (μ * a ^ k + ν * b ^ k) := by gcongr; exact H
-    _ ≤ (μ * a + ν * b) * (μ * a ^ k + ν * b ^ k) + (b ^ k - a ^ k) * (b - a) * μ * ν := by linarith
-    _ = (μ + ν) * (μ * a ^ k.succ + ν * b ^ k.succ) := by rw [Nat.succ_eq_add_one]; ring
-    _ = μ * a ^ k.succ + ν * b ^ k.succ := by rw [h]; ring
 #align convex_on_pow convexOn_pow
-
-/-- `x^n`, `n : ℕ` is convex on the whole real line whenever `n` is even.
-
-We give an elementary proof rather than using the second derivative test, since this lemma is
-needed early in the analysis library. -/
-nonrec theorem Even.convexOn_pow {n : ℕ} (hn : Even n) :
-    ConvexOn ℝ Set.univ fun x : ℝ => x ^ n := by
-  refine' ⟨convex_univ, _⟩
-  rintro a - b - μ ν hμ hν h
-  obtain ⟨k, rfl⟩ := hn.exists_two_nsmul _
-  -- Porting note: added type ascription to LHS
-  have : (0 : ℝ) ≤ (a - b) ^ 2 * μ * ν := by positivity
-  calc
-    (μ * a + ν * b) ^ (2 * k) = ((μ * a + ν * b) ^ 2) ^ k := by rw [pow_mul]
-    _ ≤ ((μ + ν) * (μ * a ^ 2 + ν * b ^ 2)) ^ k := by gcongr; linarith
-    _ = (μ * a ^ 2 + ν * b ^ 2) ^ k := by rw [h]; ring
-    _ ≤ μ * (a ^ 2) ^ k + ν * (b ^ 2) ^ k := ?_
-    _ ≤ μ * a ^ (2 * k) + ν * b ^ (2 * k) := by ring_nf; rfl
-  -- Porting note: `rw [mem_Ici]` was `dsimp`
-  refine' (convexOn_pow k).2 _ _ hμ hν h <;> rw [mem_Ici] <;> positivity
 #align even.convex_on_pow Even.convexOn_pow
-
-open Int in
-/-- `x^m`, `m : ℤ` is convex on `(0, +∞)` for all `m`.
-
-We give an elementary proof rather than using the second derivative test, since this lemma is
-needed early in the analysis library. -/
-theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
-  | (n : ℕ) => by
-    simp_rw [zpow_ofNat]
-    exact (convexOn_pow n).subset Ioi_subset_Ici_self (convex_Ioi _)
-  | -[n+1] => by
-    simp_rw [zpow_negSucc]
-    refine' ⟨convex_Ioi _, _⟩
-    rintro a (ha : 0 < a) b (hb : 0 < b) μ ν hμ hν h
-    field_simp
-    rw [div_le_div_iff]
-    · -- Porting note: added type ascription to LHS
-      calc
-        (1 : ℝ) * (a ^ (n + 1) * b ^ (n + 1)) = ((μ + ν) ^ 2 * (a * b)) ^ (n + 1) := by rw [h]; ring
-        _ ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) := ?_
-        _ = (μ * b + ν * a) ^ (n + 1) * (μ * a + ν * b) ^ (n + 1) := by rw [mul_pow]
-        _ ≤ (μ * b ^ (n + 1) + ν * a ^ (n + 1)) * (μ * a + ν * b) ^ (n + 1) := ?_
-      · -- Porting note: added type ascription to LHS
-        gcongr (?_ : ℝ) ^ _
-        have : (0 : ℝ) ≤ μ * ν * (a - b) ^ 2 := by positivity
-        linarith
-      · gcongr
-        apply (convexOn_pow (n + 1)).2 hb.le ha.le hμ hν h
-    · have : 0 < μ * a + ν * b := by cases le_or_lt a b <;> nlinarith
-      positivity
-    · positivity
 #align convex_on_zpow convexOn_zpow
 
 /- `Real.log` is strictly concave on $(0, +∞)$.
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -34,9 +34,6 @@ For `p : ℝ`, prove that `fun x ↦ x ^ p` is concave when `0 ≤ p ≤ 1` and
 `0 < p < 1`.
 -/
 
-
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 open Real Set BigOperators NNReal
 
 /-- `Real.exp` is strictly convex on the whole real line.
field_simp: Use positivity as a discharger (#6312)

The main reasons is that having h : 0 < denom in the context should suffice for field_simp to do its job, without the need to manually pass h.ne or similar.

Quite a few have := … ≠ 0 could be dropped, and some field_simp calls no longer need explicit arguments; this is promising.

This does break some proofs where field_simp was not used as a closing tactic, and it now shuffles terms around a bit different. These were fixed. Using field_simp in the middle of a proof seems rather fragile anyways.

As a drive-by contribution, positivity now knows about π > 0.

fixes: #4835

Co-authored-by: Matthew Ballard <matt@mrb.email>

Diff
@@ -130,7 +130,7 @@ theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
     simp_rw [zpow_negSucc]
     refine' ⟨convex_Ioi _, _⟩
     rintro a (ha : 0 < a) b (hb : 0 < b) μ ν hμ hν h
-    field_simp [ha.ne', hb.ne']
+    field_simp
     rw [div_le_div_iff]
     · -- Porting note: added type ascription to LHS
       calc
@@ -168,7 +168,7 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
     calc
       log z - log y = log (z / y) := by rw [← log_div hz.ne' hy.ne']
       _ < z / y - 1 := (log_lt_sub_one_of_pos hyz' hyz'')
-      _ = y⁻¹ * (z - y) := by field_simp [hy.ne']
+      _ = y⁻¹ * (z - y) := by field_simp
   · have h : 0 < y - x := by linarith
     rw [lt_div_iff h]
     have hxy' : 0 < x / y := by positivity
@@ -177,7 +177,7 @@ theorem strictConcaveOn_log_Ioi : StrictConcaveOn ℝ (Ioi 0) log := by
       rw [div_eq_one_iff_eq hy.ne'] at h
       simp [h]
     calc
-      y⁻¹ * (y - x) = 1 - x / y := by field_simp [hy.ne']
+      y⁻¹ * (y - x) = 1 - x / y := by field_simp
       _ < -log (x / y) := by linarith [log_lt_sub_one_of_pos hxy' hxy'']
       _ = -(log x - log y) := by rw [log_div hx.ne' hy.ne']
       _ = log y - log x := by ring
@@ -204,16 +204,16 @@ theorem one_add_mul_self_lt_rpow_one_add {s : ℝ} (hs : -1 ≤ s) (hs' : s ≠
     -- but now Lean doesn't guess we are talking about `1` fast enough.
     haveI : (1 : ℝ) ∈ Ioi 0 := zero_lt_one
     convert strictConcaveOn_log_Ioi.secant_strict_mono this hs2 hs1 hs4 hs3 _ using 1
-    · field_simp [log_one]
-    · field_simp [log_one]
+    · field_simp
+    · field_simp
     · nlinarith
   · rw [← div_lt_iff hp, ← div_lt_div_right hs']
     -- Porting note: previously we could write `zero_lt_one` inline,
     -- but now Lean doesn't guess we are talking about `1` fast enough.
     haveI : (1 : ℝ) ∈ Ioi 0 := zero_lt_one
     convert strictConcaveOn_log_Ioi.secant_strict_mono this hs1 hs2 hs3 hs4 _ using 1
-    · field_simp [log_one, hp.ne']
-    · field_simp [log_one]
+    · field_simp
+    · field_simp
     · nlinarith
 #align one_add_mul_self_lt_rpow_one_add one_add_mul_self_lt_rpow_one_add
 
@@ -251,10 +251,10 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
     convert this using 1
     · have H : (x / y) ^ p = x ^ p / y ^ p := div_rpow hx hy.le _
       ring_nf at H ⊢
-      field_simp [hy.ne', hy'.ne'] at H ⊢
+      field_simp at H ⊢
       linear_combination H
     · ring_nf at H1 ⊢
-      field_simp [hy.ne', hy'.ne']
+      field_simp
       linear_combination p * (-y + x) * H1
   · have hyz' : 0 < z - y := by linarith only [hyz]
     have hyz'' : 1 < z / y := by rwa [one_lt_div hy]
@@ -265,11 +265,11 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
     rw [lt_div_iff hyz', ← div_lt_div_right hy']
     convert this using 1
     · ring_nf at H1 ⊢
-      field_simp [hy.ne', hy'.ne'] at H1 ⊢
+      field_simp at H1 ⊢
       linear_combination p * (y - z) * y ^ p * H1
     · have H : (z / y) ^ p = z ^ p / y ^ p := div_rpow hz hy.le _
       ring_nf at H ⊢
-      field_simp [hy.ne', hy'.ne'] at H ⊢
+      field_simp at H ⊢
       linear_combination -H
 #align strict_convex_on_rpow strictConvexOn_rpow
 
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -35,7 +35,7 @@ For `p : ℝ`, prove that `fun x ↦ x ^ p` is concave when `0 ≤ p ≤ 1` and
 -/
 
 
-local macro_rules | `($x ^ $y)   => `(HPow.hPow $x $y)
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 open Real Set BigOperators NNReal
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2020 Yury Kudryashov. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yury Kudryashov, Sébastien Gouëzel, Heather Macbeth
-
-! This file was ported from Lean 3 source module analysis.convex.specific_functions.basic
-! leanprover-community/mathlib commit 8f9fea08977f7e450770933ee6abb20733b47c92
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Convex.Slope
 import Mathlib.Analysis.SpecialFunctions.Pow.Real
 import Mathlib.Tactic.LinearCombination
 
+#align_import analysis.convex.specific_functions.basic from "leanprover-community/mathlib"@"8f9fea08977f7e450770933ee6abb20733b47c92"
+
 /-!
 # Collection of convex functions
 
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -241,7 +241,7 @@ theorem strictConvexOn_rpow {p : ℝ} (hp : 1 < p) : StrictConvexOn ℝ (Ici 0)
   have hy : 0 < y := by linarith
   have hy' : 0 < y ^ p := rpow_pos_of_pos hy _
   have H1 : y ^ (p - 1 + 1) = y ^ (p - 1) * y := rpow_add_one hy.ne' _
-  ring_nf  at H1
+  ring_nf at H1
   trans p * y ^ (p - 1)
   · have h3 : 0 < y - x := by linarith only [hxy]
     have hyx'' : x / y < 1 := by rwa [div_lt_one hy]
chore: convert lambda in docs to fun (#5045)

Found with git grep -n "λ [a-zA-Z_ ]*,"

Diff
@@ -18,12 +18,12 @@ import Mathlib.Tactic.LinearCombination
 In this file we prove that the following functions are convex or strictly convex:
 
 * `strictConvexOn_exp` : The exponential function is strictly convex.
-* `Even.convexOn_pow`: For an even `n : ℕ`, `λ x, x ^ n` is convex.
-* `convexOn_pow`: For `n : ℕ`, `λ x, x ^ n` is convex on $[0, +∞)$.
-* `convexOn_zpow`: For `m : ℤ`, `λ x, x ^ m` is convex on $[0, +∞)$.
+* `Even.convexOn_pow`: For an even `n : ℕ`, `fun x ↦ x ^ n` is convex.
+* `convexOn_pow`: For `n : ℕ`, `fun x ↦ x ^ n` is convex on $[0, +∞)$.
+* `convexOn_zpow`: For `m : ℤ`, `fun x ↦ x ^ m` is convex on $[0, +∞)$.
 * `strictConcaveOn_log_Ioi`, `strictConcaveOn_log_Iio`: `Real.log` is strictly concave on
   $(0, +∞)$ and $(-∞, 0)$ respectively.
-* `convexOn_rpow`, `strictConvexOn_rpow` : For `p : ℝ`, `λ x, x ^ p` is convex on $[0, +∞)$ when
+* `convexOn_rpow`, `strictConvexOn_rpow` : For `p : ℝ`, `fun x ↦ x ^ p` is convex on $[0, +∞)$ when
   `1 ≤ p` and strictly convex when `1 < p`.
 
 The proofs in this file are deliberately elementary, *not* by appealing to the sign of the second
@@ -33,7 +33,7 @@ theory.
 
 ## TODO
 
-For `p : ℝ`, prove that `λ x, x ^ p` is concave when `0 ≤ p ≤ 1` and strictly concave when
+For `p : ℝ`, prove that `fun x ↦ x ^ p` is concave when `0 ≤ p ≤ 1` and strictly concave when
 `0 < p < 1`.
 -/
 
@@ -231,7 +231,7 @@ theorem one_add_mul_self_le_rpow_one_add {s : ℝ} (hs : -1 ≤ s) {p : ℝ} (hp
   exact (one_add_mul_self_lt_rpow_one_add hs hs' hp).le
 #align one_add_mul_self_le_rpow_one_add one_add_mul_self_le_rpow_one_add
 
-/- For `p : ℝ` with `1 < p`, `λ x, x ^ p` is strictly convex on $[0, +∞)$.
+/- For `p : ℝ` with `1 < p`, `fun x ↦ x ^ p` is strictly convex on $[0, +∞)$.
 
 We give an elementary proof rather than using the second derivative test, since this lemma is
 needed early in the analysis library. -/
feat: golf using gcongr throughout the library (#4784)

Following on from #4702, another hundred sample uses of the gcongr tactic.

Diff
@@ -56,16 +56,16 @@ theorem strictConvexOn_exp : StrictConvexOn ℝ univ exp := by
     calc
       exp y - exp x = exp y - exp y * exp (x - y) := by rw [← exp_add]; ring_nf
       _ = exp y * (1 - exp (x - y)) := by ring
-      _ < exp y * -(x - y) := (mul_lt_mul_of_pos_left ?_ y.exp_pos)
+      _ < exp y * -(x - y) := by gcongr; linarith [add_one_lt_exp_of_nonzero h2.ne]
       _ = exp y * (y - x) := by ring
-    linarith [add_one_lt_exp_of_nonzero h2.ne]
   · have h1 : 0 < z - y := by linarith
     rw [lt_div_iff h1]
     calc
-      exp y * (z - y) < exp y * (exp (z - y) - 1) := mul_lt_mul_of_pos_left ?_ y.exp_pos
+      exp y * (z - y) < exp y * (exp (z - y) - 1) := by
+        gcongr _ * ?_
+        linarith [add_one_lt_exp_of_nonzero h1.ne']
       _ = exp (z - y) * exp y - exp y := by ring
       _ ≤ exp z - exp y := by rw [← exp_add]; ring_nf; rfl
-    linarith [add_one_lt_exp_of_nonzero h1.ne']
 #align strict_convex_on_exp strictConvexOn_exp
 
 /-- `Real.exp` is convex on the whole real line. -/
@@ -85,15 +85,15 @@ theorem convexOn_pow (n : ℕ) : ConvexOn ℝ (Ici 0) fun x : ℝ => x ^ n := by
   have H := IH.2 ha hb hμ hν h
   have : 0 ≤ (b ^ k - a ^ k) * (b - a) * μ * ν := by
     cases' le_or_lt a b with hab hab
-    · have : a ^ k ≤ b ^ k := pow_le_pow_of_le_left ha hab k
+    · have : a ^ k ≤ b ^ k := by gcongr
       have : 0 ≤ (b ^ k - a ^ k) * (b - a) := by nlinarith
       positivity
-    · have : b ^ k ≤ a ^ k := pow_le_pow_of_le_left hb hab.le k
+    · have : b ^ k ≤ a ^ k := by gcongr
       have : 0 ≤ (b ^ k - a ^ k) * (b - a) := by nlinarith
       positivity
   calc
     (μ * a + ν * b) ^ k.succ = (μ * a + ν * b) * (μ * a + ν * b) ^ k := pow_succ _ _
-    _ ≤ (μ * a + ν * b) * (μ * a ^ k + ν * b ^ k) := (mul_le_mul_of_nonneg_left H (by positivity))
+    _ ≤ (μ * a + ν * b) * (μ * a ^ k + ν * b ^ k) := by gcongr; exact H
     _ ≤ (μ * a + ν * b) * (μ * a ^ k + ν * b ^ k) + (b ^ k - a ^ k) * (b - a) * μ * ν := by linarith
     _ = (μ + ν) * (μ * a ^ k.succ + ν * b ^ k.succ) := by rw [Nat.succ_eq_add_one]; ring
     _ = μ * a ^ k.succ + ν * b ^ k.succ := by rw [h]; ring
@@ -112,13 +112,12 @@ nonrec theorem Even.convexOn_pow {n : ℕ} (hn : Even n) :
   have : (0 : ℝ) ≤ (a - b) ^ 2 * μ * ν := by positivity
   calc
     (μ * a + ν * b) ^ (2 * k) = ((μ * a + ν * b) ^ 2) ^ k := by rw [pow_mul]
-    _ ≤ ((μ + ν) * (μ * a ^ 2 + ν * b ^ 2)) ^ k := (pow_le_pow_of_le_left (by positivity) ?_ k)
+    _ ≤ ((μ + ν) * (μ * a ^ 2 + ν * b ^ 2)) ^ k := by gcongr; linarith
     _ = (μ * a ^ 2 + ν * b ^ 2) ^ k := by rw [h]; ring
     _ ≤ μ * (a ^ 2) ^ k + ν * (b ^ 2) ^ k := ?_
     _ ≤ μ * a ^ (2 * k) + ν * b ^ (2 * k) := by ring_nf; rfl
-  · linarith
-  · -- Porting note: `rw [mem_Ici]` was `dsimp`
-    refine' (convexOn_pow k).2 _ _ hμ hν h <;> rw [mem_Ici] <;> positivity
+  -- Porting note: `rw [mem_Ici]` was `dsimp`
+  refine' (convexOn_pow k).2 _ _ hμ hν h <;> rw [mem_Ici] <;> positivity
 #align even.convex_on_pow Even.convexOn_pow
 
 open Int in
@@ -139,15 +138,15 @@ theorem convexOn_zpow : ∀ m : ℤ, ConvexOn ℝ (Ioi 0) fun x : ℝ => x ^ m
     · -- Porting note: added type ascription to LHS
       calc
         (1 : ℝ) * (a ^ (n + 1) * b ^ (n + 1)) = ((μ + ν) ^ 2 * (a * b)) ^ (n + 1) := by rw [h]; ring
-        _ ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) := (pow_le_pow_of_le_left ?_ ?_ _)
+        _ ≤ ((μ * b + ν * a) * (μ * a + ν * b)) ^ (n + 1) := ?_
         _ = (μ * b + ν * a) ^ (n + 1) * (μ * a + ν * b) ^ (n + 1) := by rw [mul_pow]
         _ ≤ (μ * b ^ (n + 1) + ν * a ^ (n + 1)) * (μ * a + ν * b) ^ (n + 1) := ?_
-      · positivity
       · -- Porting note: added type ascription to LHS
+        gcongr (?_ : ℝ) ^ _
         have : (0 : ℝ) ≤ μ * ν * (a - b) ^ 2 := by positivity
         linarith
-      · apply mul_le_mul_of_nonneg_right ((convexOn_pow (n + 1)).2 hb.le ha.le hμ hν h)
-        positivity
+      · gcongr
+        apply (convexOn_pow (n + 1)).2 hb.le ha.le hμ hν h
     · have : 0 < μ * a + ν * b := by cases le_or_lt a b <;> nlinarith
       positivity
     · positivity
feat: port Analysis.Convex.SpecificFunctions.Basic (#4142)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Dependencies 12 + 760

761 files ported (98.4%)
334643 lines ported (98.3%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file