analysis.calculus.deriv.zpowMathlib.Analysis.Calculus.Deriv.ZPow

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -52,7 +52,7 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     by
     intro m hm
     lift m to ℕ using le_of_lt hm
-    simp only [zpow_natCast, Int.cast_ofNat]
+    simp only [zpow_natCast, Int.cast_natCast]
     convert hasStrictDerivAt_pow _ _ using 2
     rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_natCast]
     norm_cast at hm
@@ -140,7 +140,7 @@ theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
   · simp only [one_mul, Int.ofNat_zero, id, sub_zero, Finset.prod_range_zero, Function.iterate_zero]
   ·
     simp only [Function.iterate_succ_apply', ihk, deriv_const_mul_field', deriv_zpow',
-      Finset.prod_range_succ, Int.ofNat_succ, ← sub_sub, Int.cast_sub, Int.cast_ofNat, mul_assoc]
+      Finset.prod_range_succ, Int.ofNat_succ, ← sub_sub, Int.cast_sub, Int.cast_natCast, mul_assoc]
 #align iter_deriv_zpow' iter_deriv_zpow'
 -/
 
@@ -155,7 +155,7 @@ theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     (deriv^[k]) (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, (n - i)) * x ^ (n - k) :=
   by
-  simp only [← zpow_natCast, iter_deriv_zpow, Int.cast_ofNat]
+  simp only [← zpow_natCast, iter_deriv_zpow, Int.cast_natCast]
   cases' le_or_lt k n with hkn hnk
   · rw [Int.ofNat_sub hkn]
   · have : ∏ i in Finset.range k, (n - i : 𝕜) = 0 :=
Diff
@@ -52,9 +52,9 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     by
     intro m hm
     lift m to ℕ using le_of_lt hm
-    simp only [zpow_coe_nat, Int.cast_ofNat]
+    simp only [zpow_natCast, Int.cast_ofNat]
     convert hasStrictDerivAt_pow _ _ using 2
-    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_coe_nat]
+    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_natCast]
     norm_cast at hm
     exact Nat.succ_le_of_lt hm
   rcases lt_trichotomy m 0 with (hm | hm | hm)
@@ -155,7 +155,7 @@ theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     (deriv^[k]) (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, (n - i)) * x ^ (n - k) :=
   by
-  simp only [← zpow_coe_nat, iter_deriv_zpow, Int.cast_ofNat]
+  simp only [← zpow_natCast, iter_deriv_zpow, Int.cast_ofNat]
   cases' le_or_lt k n with hkn hnk
   · rw [Int.ofNat_sub hkn]
   · have : ∏ i in Finset.range k, (n - i : 𝕜) = 0 :=
Diff
@@ -55,13 +55,13 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     simp only [zpow_coe_nat, Int.cast_ofNat]
     convert hasStrictDerivAt_pow _ _ using 2
     rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_coe_nat]
-    norm_cast at hm 
+    norm_cast at hm
     exact Nat.succ_le_of_lt hm
   rcases lt_trichotomy m 0 with (hm | hm | hm)
   · have hx : x ≠ 0 := h.resolve_right hm.not_le
     have := (hasStrictDerivAt_inv _).scomp _ (this (-m) (neg_pos.2 hm)) <;> [skip;
       exact zpow_ne_zero_of_ne_zero hx _]
-    simp only [(· ∘ ·), zpow_neg, one_div, inv_inv, smul_eq_mul] at this 
+    simp only [(· ∘ ·), zpow_neg, one_div, inv_inv, smul_eq_mul] at this
     convert this using 1
     rw [sq, mul_inv, inv_inv, Int.cast_neg, neg_mul, neg_mul_neg, ← zpow_add₀ hx, mul_assoc, ←
       zpow_add₀ hx]
@@ -112,7 +112,7 @@ theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m
   by_cases H : x ≠ 0 ∨ 0 ≤ m
   · exact (hasDerivAt_zpow m x H).deriv
   · rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_zpow.1 H)]
-    push_neg at H ; rcases H with ⟨rfl, hm⟩
+    push_neg at H; rcases H with ⟨rfl, hm⟩
     rw [zero_zpow _ ((sub_one_lt _).trans hm).Ne, MulZeroClass.mul_zero]
 #align deriv_zpow deriv_zpow
 -/
Diff
@@ -52,9 +52,9 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     by
     intro m hm
     lift m to ℕ using le_of_lt hm
-    simp only [zpow_ofNat, Int.cast_ofNat]
+    simp only [zpow_coe_nat, Int.cast_ofNat]
     convert hasStrictDerivAt_pow _ _ using 2
-    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_ofNat]
+    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_coe_nat]
     norm_cast at hm 
     exact Nat.succ_le_of_lt hm
   rcases lt_trichotomy m 0 with (hm | hm | hm)
@@ -155,7 +155,7 @@ theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     (deriv^[k]) (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, (n - i)) * x ^ (n - k) :=
   by
-  simp only [← zpow_ofNat, iter_deriv_zpow, Int.cast_ofNat]
+  simp only [← zpow_coe_nat, iter_deriv_zpow, Int.cast_ofNat]
   cases' le_or_lt k n with hkn hnk
   · rw [Int.ofNat_sub hkn]
   · have : ∏ i in Finset.range k, (n - i : 𝕜) = 0 :=
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel, Yury Kudryashov
 -/
-import Mathbin.Analysis.Calculus.Deriv.Pow
-import Mathbin.Analysis.Calculus.Deriv.Inv
+import Analysis.Calculus.Deriv.Pow
+import Analysis.Calculus.Deriv.Inv
 
 #align_import analysis.calculus.deriv.zpow from "leanprover-community/mathlib"@"599fffe78f0e11eb6a034e834ec51882167b9688"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel, Yury Kudryashov
-
-! This file was ported from Lean 3 source module analysis.calculus.deriv.zpow
-! leanprover-community/mathlib commit 599fffe78f0e11eb6a034e834ec51882167b9688
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Calculus.Deriv.Pow
 import Mathbin.Analysis.Calculus.Deriv.Inv
 
+#align_import analysis.calculus.deriv.zpow from "leanprover-community/mathlib"@"599fffe78f0e11eb6a034e834ec51882167b9688"
+
 /-!
 # Derivatives of `x ^ m`, `m : ℤ`
 
Diff
@@ -47,6 +47,7 @@ variable {m : ℤ}
 /-! ### Derivative of `x ↦ x^m` for `m : ℤ` -/
 
 
+#print hasStrictDerivAt_zpow /-
 theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     HasStrictDerivAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) x :=
   by
@@ -71,32 +72,44 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
   · simp only [hm, zpow_zero, Int.cast_zero, MulZeroClass.zero_mul, hasStrictDerivAt_const]
   · exact this m hm
 #align has_strict_deriv_at_zpow hasStrictDerivAt_zpow
+-/
 
+#print hasDerivAt_zpow /-
 theorem hasDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     HasDerivAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) x :=
   (hasStrictDerivAt_zpow m x h).HasDerivAt
 #align has_deriv_at_zpow hasDerivAt_zpow
+-/
 
+#print hasDerivWithinAt_zpow /-
 theorem hasDerivWithinAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) (s : Set 𝕜) :
     HasDerivWithinAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) s x :=
   (hasDerivAt_zpow m x h).HasDerivWithinAt
 #align has_deriv_within_at_zpow hasDerivWithinAt_zpow
+-/
 
+#print differentiableAt_zpow /-
 theorem differentiableAt_zpow : DifferentiableAt 𝕜 (fun x => x ^ m) x ↔ x ≠ 0 ∨ 0 ≤ m :=
   ⟨fun H => NormedField.continuousAt_zpow.1 H.ContinuousAt, fun H =>
     (hasDerivAt_zpow m x H).DifferentiableAt⟩
 #align differentiable_at_zpow differentiableAt_zpow
+-/
 
+#print differentiableWithinAt_zpow /-
 theorem differentiableWithinAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     DifferentiableWithinAt 𝕜 (fun x => x ^ m) s x :=
   (differentiableAt_zpow.mpr h).DifferentiableWithinAt
 #align differentiable_within_at_zpow differentiableWithinAt_zpow
+-/
 
+#print differentiableOn_zpow /-
 theorem differentiableOn_zpow (m : ℤ) (s : Set 𝕜) (h : (0 : 𝕜) ∉ s ∨ 0 ≤ m) :
     DifferentiableOn 𝕜 (fun x => x ^ m) s := fun x hxs =>
   differentiableWithinAt_zpow m x <| h.imp_left <| ne_of_mem_of_not_mem hxs
 #align differentiable_on_zpow differentiableOn_zpow
+-/
 
+#print deriv_zpow /-
 theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m - 1) :=
   by
   by_cases H : x ≠ 0 ∨ 0 ≤ m
@@ -105,17 +118,23 @@ theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m
     push_neg at H ; rcases H with ⟨rfl, hm⟩
     rw [zero_zpow _ ((sub_one_lt _).trans hm).Ne, MulZeroClass.mul_zero]
 #align deriv_zpow deriv_zpow
+-/
 
+#print deriv_zpow' /-
 @[simp]
 theorem deriv_zpow' (m : ℤ) : (deriv fun x : 𝕜 => x ^ m) = fun x => m * x ^ (m - 1) :=
   funext <| deriv_zpow m
 #align deriv_zpow' deriv_zpow'
+-/
 
+#print derivWithin_zpow /-
 theorem derivWithin_zpow (hxs : UniqueDiffWithinAt 𝕜 s x) (h : x ≠ 0 ∨ 0 ≤ m) :
     derivWithin (fun x => x ^ m) s x = (m : 𝕜) * x ^ (m - 1) :=
   (hasDerivWithinAt_zpow m x h s).derivWithin hxs
 #align deriv_within_zpow derivWithin_zpow
+-/
 
+#print iter_deriv_zpow' /-
 @[simp]
 theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
     ((deriv^[k]) fun x : 𝕜 => x ^ m) = fun x => (∏ i in Finset.range k, (m - i)) * x ^ (m - k) :=
@@ -126,12 +145,16 @@ theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
     simp only [Function.iterate_succ_apply', ihk, deriv_const_mul_field', deriv_zpow',
       Finset.prod_range_succ, Int.ofNat_succ, ← sub_sub, Int.cast_sub, Int.cast_ofNat, mul_assoc]
 #align iter_deriv_zpow' iter_deriv_zpow'
+-/
 
+#print iter_deriv_zpow /-
 theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
     (deriv^[k]) (fun y => y ^ m) x = (∏ i in Finset.range k, (m - i)) * x ^ (m - k) :=
   congr_fun (iter_deriv_zpow' m k) x
 #align iter_deriv_zpow iter_deriv_zpow
+-/
 
+#print iter_deriv_pow /-
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     (deriv^[k]) (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, (n - i)) * x ^ (n - k) :=
   by
@@ -142,42 +165,57 @@ theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
       Finset.prod_eq_zero (Finset.mem_range.2 hnk) (sub_self _)
     simp only [this, MulZeroClass.zero_mul]
 #align iter_deriv_pow iter_deriv_pow
+-/
 
+#print iter_deriv_pow' /-
 @[simp]
 theorem iter_deriv_pow' (n k : ℕ) :
     ((deriv^[k]) fun x : 𝕜 => x ^ n) = fun x => (∏ i in Finset.range k, (n - i)) * x ^ (n - k) :=
   funext fun x => iter_deriv_pow n x k
 #align iter_deriv_pow' iter_deriv_pow'
+-/
 
+#print iter_deriv_inv /-
 theorem iter_deriv_inv (k : ℕ) (x : 𝕜) :
     (deriv^[k]) Inv.inv x = (∏ i in Finset.range k, (-1 - i)) * x ^ (-1 - k : ℤ) := by
   simpa only [zpow_neg_one, Int.cast_neg, Int.cast_one] using iter_deriv_zpow (-1) x k
 #align iter_deriv_inv iter_deriv_inv
+-/
 
+#print iter_deriv_inv' /-
 @[simp]
 theorem iter_deriv_inv' (k : ℕ) :
     (deriv^[k]) Inv.inv = fun x : 𝕜 => (∏ i in Finset.range k, (-1 - i)) * x ^ (-1 - k : ℤ) :=
   funext (iter_deriv_inv k)
 #align iter_deriv_inv' iter_deriv_inv'
+-/
 
 variable {f : E → 𝕜} {t : Set E} {a : E}
 
+#print DifferentiableWithinAt.zpow /-
 theorem DifferentiableWithinAt.zpow (hf : DifferentiableWithinAt 𝕜 f t a) (h : f a ≠ 0 ∨ 0 ≤ m) :
     DifferentiableWithinAt 𝕜 (fun x => f x ^ m) t a :=
   (differentiableAt_zpow.2 h).comp_differentiableWithinAt a hf
 #align differentiable_within_at.zpow DifferentiableWithinAt.zpow
+-/
 
+#print DifferentiableAt.zpow /-
 theorem DifferentiableAt.zpow (hf : DifferentiableAt 𝕜 f a) (h : f a ≠ 0 ∨ 0 ≤ m) :
     DifferentiableAt 𝕜 (fun x => f x ^ m) a :=
   (differentiableAt_zpow.2 h).comp a hf
 #align differentiable_at.zpow DifferentiableAt.zpow
+-/
 
+#print DifferentiableOn.zpow /-
 theorem DifferentiableOn.zpow (hf : DifferentiableOn 𝕜 f t) (h : (∀ x ∈ t, f x ≠ 0) ∨ 0 ≤ m) :
     DifferentiableOn 𝕜 (fun x => f x ^ m) t := fun x hx =>
   (hf x hx).zpow <| h.imp_left fun h => h x hx
 #align differentiable_on.zpow DifferentiableOn.zpow
+-/
 
+#print Differentiable.zpow /-
 theorem Differentiable.zpow (hf : Differentiable 𝕜 f) (h : (∀ x, f x ≠ 0) ∨ 0 ≤ m) :
     Differentiable 𝕜 fun x => f x ^ m := fun x => (hf x).zpow <| h.imp_left fun h => h x
 #align differentiable.zpow Differentiable.zpow
+-/
 
Diff
@@ -118,7 +118,7 @@ theorem derivWithin_zpow (hxs : UniqueDiffWithinAt 𝕜 s x) (h : x ≠ 0 ∨ 0
 
 @[simp]
 theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
-    ((deriv^[k]) fun x : 𝕜 => x ^ m) = fun x => (∏ i in Finset.range k, m - i) * x ^ (m - k) :=
+    ((deriv^[k]) fun x : 𝕜 => x ^ m) = fun x => (∏ i in Finset.range k, (m - i)) * x ^ (m - k) :=
   by
   induction' k with k ihk
   · simp only [one_mul, Int.ofNat_zero, id, sub_zero, Finset.prod_range_zero, Function.iterate_zero]
@@ -128,35 +128,35 @@ theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
 #align iter_deriv_zpow' iter_deriv_zpow'
 
 theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
-    (deriv^[k]) (fun y => y ^ m) x = (∏ i in Finset.range k, m - i) * x ^ (m - k) :=
+    (deriv^[k]) (fun y => y ^ m) x = (∏ i in Finset.range k, (m - i)) * x ^ (m - k) :=
   congr_fun (iter_deriv_zpow' m k) x
 #align iter_deriv_zpow iter_deriv_zpow
 
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
-    (deriv^[k]) (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, n - i) * x ^ (n - k) :=
+    (deriv^[k]) (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, (n - i)) * x ^ (n - k) :=
   by
   simp only [← zpow_ofNat, iter_deriv_zpow, Int.cast_ofNat]
   cases' le_or_lt k n with hkn hnk
   · rw [Int.ofNat_sub hkn]
-  · have : (∏ i in Finset.range k, (n - i : 𝕜)) = 0 :=
+  · have : ∏ i in Finset.range k, (n - i : 𝕜) = 0 :=
       Finset.prod_eq_zero (Finset.mem_range.2 hnk) (sub_self _)
     simp only [this, MulZeroClass.zero_mul]
 #align iter_deriv_pow iter_deriv_pow
 
 @[simp]
 theorem iter_deriv_pow' (n k : ℕ) :
-    ((deriv^[k]) fun x : 𝕜 => x ^ n) = fun x => (∏ i in Finset.range k, n - i) * x ^ (n - k) :=
+    ((deriv^[k]) fun x : 𝕜 => x ^ n) = fun x => (∏ i in Finset.range k, (n - i)) * x ^ (n - k) :=
   funext fun x => iter_deriv_pow n x k
 #align iter_deriv_pow' iter_deriv_pow'
 
 theorem iter_deriv_inv (k : ℕ) (x : 𝕜) :
-    (deriv^[k]) Inv.inv x = (∏ i in Finset.range k, -1 - i) * x ^ (-1 - k : ℤ) := by
+    (deriv^[k]) Inv.inv x = (∏ i in Finset.range k, (-1 - i)) * x ^ (-1 - k : ℤ) := by
   simpa only [zpow_neg_one, Int.cast_neg, Int.cast_one] using iter_deriv_zpow (-1) x k
 #align iter_deriv_inv iter_deriv_inv
 
 @[simp]
 theorem iter_deriv_inv' (k : ℕ) :
-    (deriv^[k]) Inv.inv = fun x : 𝕜 => (∏ i in Finset.range k, -1 - i) * x ^ (-1 - k : ℤ) :=
+    (deriv^[k]) Inv.inv = fun x : 𝕜 => (∏ i in Finset.range k, (-1 - i)) * x ^ (-1 - k : ℤ) :=
   funext (iter_deriv_inv k)
 #align iter_deriv_inv' iter_deriv_inv'
 
Diff
@@ -57,7 +57,7 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     simp only [zpow_ofNat, Int.cast_ofNat]
     convert hasStrictDerivAt_pow _ _ using 2
     rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_ofNat]
-    norm_cast  at hm 
+    norm_cast at hm 
     exact Nat.succ_le_of_lt hm
   rcases lt_trichotomy m 0 with (hm | hm | hm)
   · have hx : x ≠ 0 := h.resolve_right hm.not_le
@@ -102,7 +102,7 @@ theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m
   by_cases H : x ≠ 0 ∨ 0 ≤ m
   · exact (hasDerivAt_zpow m x H).deriv
   · rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_zpow.1 H)]
-    push_neg  at H ; rcases H with ⟨rfl, hm⟩
+    push_neg at H ; rcases H with ⟨rfl, hm⟩
     rw [zero_zpow _ ((sub_one_lt _).trans hm).Ne, MulZeroClass.mul_zero]
 #align deriv_zpow deriv_zpow
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel, Yury Kudryashov
 
 ! This file was ported from Lean 3 source module analysis.calculus.deriv.zpow
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
+! leanprover-community/mathlib commit 599fffe78f0e11eb6a034e834ec51882167b9688
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.Analysis.Calculus.Deriv.Inv
 /-!
 # Derivatives of `x ^ m`, `m : ℤ`
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we prove theorems about (iterated) derivatives of `x ^ m`, `m : ℤ`.
 
 For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
Diff
@@ -54,17 +54,17 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     simp only [zpow_ofNat, Int.cast_ofNat]
     convert hasStrictDerivAt_pow _ _ using 2
     rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_ofNat]
-    norm_cast  at hm
+    norm_cast  at hm 
     exact Nat.succ_le_of_lt hm
   rcases lt_trichotomy m 0 with (hm | hm | hm)
   · have hx : x ≠ 0 := h.resolve_right hm.not_le
-    have := (hasStrictDerivAt_inv _).scomp _ (this (-m) (neg_pos.2 hm)) <;>
-      [skip;exact zpow_ne_zero_of_ne_zero hx _]
-    simp only [(· ∘ ·), zpow_neg, one_div, inv_inv, smul_eq_mul] at this
+    have := (hasStrictDerivAt_inv _).scomp _ (this (-m) (neg_pos.2 hm)) <;> [skip;
+      exact zpow_ne_zero_of_ne_zero hx _]
+    simp only [(· ∘ ·), zpow_neg, one_div, inv_inv, smul_eq_mul] at this 
     convert this using 1
     rw [sq, mul_inv, inv_inv, Int.cast_neg, neg_mul, neg_mul_neg, ← zpow_add₀ hx, mul_assoc, ←
       zpow_add₀ hx]
-    congr ; abel
+    congr; abel
   · simp only [hm, zpow_zero, Int.cast_zero, MulZeroClass.zero_mul, hasStrictDerivAt_const]
   · exact this m hm
 #align has_strict_deriv_at_zpow hasStrictDerivAt_zpow
@@ -99,7 +99,7 @@ theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m
   by_cases H : x ≠ 0 ∨ 0 ≤ m
   · exact (hasDerivAt_zpow m x H).deriv
   · rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_zpow.1 H)]
-    push_neg  at H; rcases H with ⟨rfl, hm⟩
+    push_neg  at H ; rcases H with ⟨rfl, hm⟩
     rw [zero_zpow _ ((sub_one_lt _).trans hm).Ne, MulZeroClass.mul_zero]
 #align deriv_zpow deriv_zpow
 
Diff
@@ -27,7 +27,7 @@ derivative, power
 
 universe u v w
 
-open Classical Topology BigOperators Filter
+open scoped Classical Topology BigOperators Filter
 
 open Filter Asymptotics Set
 
Diff
@@ -64,8 +64,7 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     convert this using 1
     rw [sq, mul_inv, inv_inv, Int.cast_neg, neg_mul, neg_mul_neg, ← zpow_add₀ hx, mul_assoc, ←
       zpow_add₀ hx]
-    congr
-    abel
+    congr ; abel
   · simp only [hm, zpow_zero, Int.cast_zero, MulZeroClass.zero_mul, hasStrictDerivAt_const]
   · exact this m hm
 #align has_strict_deriv_at_zpow hasStrictDerivAt_zpow
@@ -100,8 +99,7 @@ theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m
   by_cases H : x ≠ 0 ∨ 0 ≤ m
   · exact (hasDerivAt_zpow m x H).deriv
   · rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_zpow.1 H)]
-    push_neg  at H
-    rcases H with ⟨rfl, hm⟩
+    push_neg  at H; rcases H with ⟨rfl, hm⟩
     rw [zero_zpow _ ((sub_one_lt _).trans hm).Ne, MulZeroClass.mul_zero]
 #align deriv_zpow deriv_zpow
 

Changes in mathlib4

mathlib3
mathlib4
chore(Data/Int/Cast): fix confusion between OfNat and Nat.cast lemmas (#11861)

This renames

  • Int.cast_ofNat to Int.cast_natCast
  • Int.int_cast_ofNat to Int.cast_ofNat

I think the history here is that this lemma was previously about Int.ofNat, before we globally fixed the simp-normal form to be Nat.cast.

Since the Int.cast_ofNat name is repurposed, it can't be deprecated. Int.int_cast_ofNat is such a wonky name that it was probably never used.

Diff
@@ -40,7 +40,7 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     HasStrictDerivAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) x := by
   have : ∀ m : ℤ, 0 < m → HasStrictDerivAt (· ^ m) ((m : 𝕜) * x ^ (m - 1)) x := fun m hm ↦ by
     lift m to ℕ using hm.le
-    simp only [zpow_natCast, Int.cast_ofNat]
+    simp only [zpow_natCast, Int.cast_natCast]
     convert hasStrictDerivAt_pow m x using 2
     rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_natCast]
     norm_cast at hm
@@ -110,7 +110,7 @@ theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
   · simp only [Nat.zero_eq, one_mul, Int.ofNat_zero, id, sub_zero, Finset.prod_range_zero,
       Function.iterate_zero]
   · simp only [Function.iterate_succ_apply', ihk, deriv_const_mul_field', deriv_zpow',
-      Finset.prod_range_succ, Int.ofNat_succ, ← sub_sub, Int.cast_sub, Int.cast_ofNat, mul_assoc]
+      Finset.prod_range_succ, Int.ofNat_succ, ← sub_sub, Int.cast_sub, Int.cast_natCast, mul_assoc]
 #align iter_deriv_zpow' iter_deriv_zpow'
 
 theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
@@ -120,7 +120,7 @@ theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
 
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     deriv^[k] (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) := by
-  simp only [← zpow_natCast, iter_deriv_zpow, Int.cast_ofNat]
+  simp only [← zpow_natCast, iter_deriv_zpow, Int.cast_natCast]
   rcases le_or_lt k n with hkn | hnk
   · rw [Int.ofNat_sub hkn]
   · have : (∏ i in Finset.range k, (n - i : 𝕜)) = 0 :=
chore: Rename zpow_coe_nat to zpow_natCast (#11528)

... and add a deprecated alias for the old name. This is mostly just me discovering the power of F2

Diff
@@ -40,9 +40,9 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     HasStrictDerivAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) x := by
   have : ∀ m : ℤ, 0 < m → HasStrictDerivAt (· ^ m) ((m : 𝕜) * x ^ (m - 1)) x := fun m hm ↦ by
     lift m to ℕ using hm.le
-    simp only [zpow_coe_nat, Int.cast_ofNat]
+    simp only [zpow_natCast, Int.cast_ofNat]
     convert hasStrictDerivAt_pow m x using 2
-    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_coe_nat]
+    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_natCast]
     norm_cast at hm
   rcases lt_trichotomy m 0 with (hm | hm | hm)
   · have hx : x ≠ 0 := h.resolve_right hm.not_le
@@ -120,7 +120,7 @@ theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
 
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     deriv^[k] (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) := by
-  simp only [← zpow_coe_nat, iter_deriv_zpow, Int.cast_ofNat]
+  simp only [← zpow_natCast, iter_deriv_zpow, Int.cast_ofNat]
   rcases le_or_lt k n with hkn | hnk
   · rw [Int.ofNat_sub hkn]
   · have : (∏ i in Finset.range k, (n - i : 𝕜)) = 0 :=
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -29,13 +29,9 @@ open Topology BigOperators Filter
 open Filter Asymptotics Set
 
 variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
-
 variable {E : Type v} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
-
 variable {x : 𝕜}
-
 variable {s : Set 𝕜}
-
 variable {m : ℤ}
 
 /-! ### Derivative of `x ↦ x^m` for `m : ℤ` -/
chore: scope open Classical (#11199)

We remove all but one open Classicals, instead preferring to use open scoped Classical. The only real side-effect this led to is moving a couple declarations to use Exists.choose instead of Classical.choose.

The first few commits are explicitly labelled regex replaces for ease of review.

Diff
@@ -23,7 +23,8 @@ derivative, power
 
 universe u v w
 
-open Classical Topology BigOperators Filter
+open scoped Classical
+open Topology BigOperators Filter
 
 open Filter Asymptotics Set
 
fix: correct statement of zpow_ofNat and ofNat_zsmul (#10969)

Previously these were syntactically identical to the corresponding zpow_coe_nat and coe_nat_zsmul lemmas, now they are about OfNat.ofNat.

Unfortunately, almost every call site uses the ofNat name to refer to Nat.cast, so the downstream proofs had to be adjusted too.

Diff
@@ -43,9 +43,9 @@ theorem hasStrictDerivAt_zpow (m : ℤ) (x : 𝕜) (h : x ≠ 0 ∨ 0 ≤ m) :
     HasStrictDerivAt (fun x => x ^ m) ((m : 𝕜) * x ^ (m - 1)) x := by
   have : ∀ m : ℤ, 0 < m → HasStrictDerivAt (· ^ m) ((m : 𝕜) * x ^ (m - 1)) x := fun m hm ↦ by
     lift m to ℕ using hm.le
-    simp only [zpow_ofNat, Int.cast_ofNat]
+    simp only [zpow_coe_nat, Int.cast_ofNat]
     convert hasStrictDerivAt_pow m x using 2
-    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_ofNat]
+    rw [← Int.ofNat_one, ← Int.ofNat_sub, zpow_coe_nat]
     norm_cast at hm
   rcases lt_trichotomy m 0 with (hm | hm | hm)
   · have hx : x ≠ 0 := h.resolve_right hm.not_le
@@ -123,7 +123,7 @@ theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
 
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     deriv^[k] (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) := by
-  simp only [← zpow_ofNat, iter_deriv_zpow, Int.cast_ofNat]
+  simp only [← zpow_coe_nat, iter_deriv_zpow, Int.cast_ofNat]
   rcases le_or_lt k n with hkn | hnk
   · rw [Int.ofNat_sub hkn]
   · have : (∏ i in Finset.range k, (n - i : 𝕜)) = 0 :=
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
@@ -124,7 +124,7 @@ theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
     deriv^[k] (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) := by
   simp only [← zpow_ofNat, iter_deriv_zpow, Int.cast_ofNat]
-  cases' le_or_lt k n with hkn hnk
+  rcases le_or_lt k n with hkn | hnk
   · rw [Int.ofNat_sub hkn]
   · have : (∏ i in Finset.range k, (n - i : 𝕜)) = 0 :=
       Finset.prod_eq_zero (Finset.mem_range.2 hnk) (sub_self _)
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -92,7 +92,7 @@ theorem deriv_zpow (m : ℤ) (x : 𝕜) : deriv (fun x => x ^ m) x = m * x ^ (m
   · rw [deriv_zero_of_not_differentiableAt (mt differentiableAt_zpow.1 H)]
     push_neg at H
     rcases H with ⟨rfl, hm⟩
-    rw [zero_zpow _ ((sub_one_lt _).trans hm).ne, MulZeroClass.mul_zero]
+    rw [zero_zpow _ ((sub_one_lt _).trans hm).ne, mul_zero]
 #align deriv_zpow deriv_zpow
 
 @[simp]
@@ -128,7 +128,7 @@ theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
   · rw [Int.ofNat_sub hkn]
   · have : (∏ i in Finset.range k, (n - i : 𝕜)) = 0 :=
       Finset.prod_eq_zero (Finset.mem_range.2 hnk) (sub_self _)
-    simp only [this, MulZeroClass.zero_mul]
+    simp only [this, zero_mul]
 #align iter_deriv_pow iter_deriv_pow
 
 @[simp]
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,15 +2,12 @@
 Copyright (c) 2020 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel, Yury Kudryashov
-
-! This file was ported from Lean 3 source module analysis.calculus.deriv.zpow
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Analysis.Calculus.Deriv.Pow
 import Mathlib.Analysis.Calculus.Deriv.Inv
 
+#align_import analysis.calculus.deriv.zpow from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
+
 /-!
 # Derivatives of `x ^ m`, `m : ℤ`
 
fix precedence of Nat.iterate (#5589)
Diff
@@ -110,7 +110,7 @@ theorem derivWithin_zpow (hxs : UniqueDiffWithinAt 𝕜 s x) (h : x ≠ 0 ∨ 0
 
 @[simp]
 theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
-    ((deriv^[k]) fun x : 𝕜 => x ^ m) =
+    (deriv^[k] fun x : 𝕜 => x ^ m) =
       fun x => (∏ i in Finset.range k, ((m : 𝕜) - i)) * x ^ (m - k) := by
   induction' k with k ihk
   · simp only [Nat.zero_eq, one_mul, Int.ofNat_zero, id, sub_zero, Finset.prod_range_zero,
@@ -120,12 +120,12 @@ theorem iter_deriv_zpow' (m : ℤ) (k : ℕ) :
 #align iter_deriv_zpow' iter_deriv_zpow'
 
 theorem iter_deriv_zpow (m : ℤ) (x : 𝕜) (k : ℕ) :
-    (deriv^[k]) (fun y => y ^ m) x = (∏ i in Finset.range k, ((m : 𝕜) - i)) * x ^ (m - k) :=
+    deriv^[k] (fun y => y ^ m) x = (∏ i in Finset.range k, ((m : 𝕜) - i)) * x ^ (m - k) :=
   congr_fun (iter_deriv_zpow' m k) x
 #align iter_deriv_zpow iter_deriv_zpow
 
 theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
-    (deriv^[k]) (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) := by
+    deriv^[k] (fun x : 𝕜 => x ^ n) x = (∏ i in Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) := by
   simp only [← zpow_ofNat, iter_deriv_zpow, Int.cast_ofNat]
   cases' le_or_lt k n with hkn hnk
   · rw [Int.ofNat_sub hkn]
@@ -136,19 +136,19 @@ theorem iter_deriv_pow (n : ℕ) (x : 𝕜) (k : ℕ) :
 
 @[simp]
 theorem iter_deriv_pow' (n k : ℕ) :
-    ((deriv^[k]) fun x : 𝕜 => x ^ n) =
+    (deriv^[k] fun x : 𝕜 => x ^ n) =
       fun x => (∏ i in Finset.range k, ((n : 𝕜) - i)) * x ^ (n - k) :=
   funext fun x => iter_deriv_pow n x k
 #align iter_deriv_pow' iter_deriv_pow'
 
 theorem iter_deriv_inv (k : ℕ) (x : 𝕜) :
-    (deriv^[k]) Inv.inv x = (∏ i in Finset.range k, (-1 - i : 𝕜)) * x ^ (-1 - k : ℤ) := by
+    deriv^[k] Inv.inv x = (∏ i in Finset.range k, (-1 - i : 𝕜)) * x ^ (-1 - k : ℤ) := by
   simpa only [zpow_neg_one, Int.cast_neg, Int.cast_one] using iter_deriv_zpow (-1) x k
 #align iter_deriv_inv iter_deriv_inv
 
 @[simp]
 theorem iter_deriv_inv' (k : ℕ) :
-    (deriv^[k]) Inv.inv = fun x : 𝕜 => (∏ i in Finset.range k, (-1 - i : 𝕜)) * x ^ (-1 - k : ℤ) :=
+    deriv^[k] Inv.inv = fun x : 𝕜 => (∏ i in Finset.range k, (-1 - i : 𝕜)) * x ^ (-1 - k : ℤ) :=
   funext (iter_deriv_inv k)
 #align iter_deriv_inv' iter_deriv_inv'
 
feat: port Analysis.Calculus.Deriv.ZPow (#4447)

Dependencies 10 + 685

686 files ported (98.6%)
303785 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