analysis.calculus.deriv.powMathlib.Analysis.Calculus.Deriv.Pow

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
@@ -60,7 +60,7 @@ theorem hasStrictDerivAt_pow :
   | 0, x => by simp [hasStrictDerivAt_const]
   | 1, x => by simpa using hasStrictDerivAt_id x
   | n + 1 + 1, x => by
-    simpa [pow_succ', add_mul, mul_assoc] using
+    simpa [pow_succ, add_mul, mul_assoc] using
       (hasStrictDerivAt_pow (n + 1) x).mul (hasStrictDerivAt_id x)
 #align has_strict_deriv_at_pow hasStrictDerivAt_pow
 -/
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 -/
-import Mathbin.Analysis.Calculus.Deriv.Mul
-import Mathbin.Analysis.Calculus.Deriv.Comp
+import Analysis.Calculus.Deriv.Mul
+import Analysis.Calculus.Deriv.Comp
 
 #align_import analysis.calculus.deriv.pow from "leanprover-community/mathlib"@"f60c6087a7275b72d5db3c5a1d0e19e35a429c0a"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.calculus.deriv.pow
-! leanprover-community/mathlib commit f60c6087a7275b72d5db3c5a1d0e19e35a429c0a
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Calculus.Deriv.Mul
 import Mathbin.Analysis.Calculus.Deriv.Comp
 
+#align_import analysis.calculus.deriv.pow from "leanprover-community/mathlib"@"f60c6087a7275b72d5db3c5a1d0e19e35a429c0a"
+
 /-!
 # Derivative of `(f x) ^ n`, `n : ℕ`
 
Diff
@@ -57,6 +57,7 @@ variable {c : 𝕜 → 𝕜} {c' : 𝕜}
 
 variable (n : ℕ)
 
+#print hasStrictDerivAt_pow /-
 theorem hasStrictDerivAt_pow :
     ∀ (n : ℕ) (x : 𝕜), HasStrictDerivAt (fun x => x ^ n) ((n : 𝕜) * x ^ (n - 1)) x
   | 0, x => by simp [hasStrictDerivAt_const]
@@ -65,63 +66,90 @@ theorem hasStrictDerivAt_pow :
     simpa [pow_succ', add_mul, mul_assoc] using
       (hasStrictDerivAt_pow (n + 1) x).mul (hasStrictDerivAt_id x)
 #align has_strict_deriv_at_pow hasStrictDerivAt_pow
+-/
 
+#print hasDerivAt_pow /-
 theorem hasDerivAt_pow (n : ℕ) (x : 𝕜) : HasDerivAt (fun x => x ^ n) ((n : 𝕜) * x ^ (n - 1)) x :=
   (hasStrictDerivAt_pow n x).HasDerivAt
 #align has_deriv_at_pow hasDerivAt_pow
+-/
 
+#print hasDerivWithinAt_pow /-
 theorem hasDerivWithinAt_pow (n : ℕ) (x : 𝕜) (s : Set 𝕜) :
     HasDerivWithinAt (fun x => x ^ n) ((n : 𝕜) * x ^ (n - 1)) s x :=
   (hasDerivAt_pow n x).HasDerivWithinAt
 #align has_deriv_within_at_pow hasDerivWithinAt_pow
+-/
 
+#print differentiableAt_pow /-
 theorem differentiableAt_pow : DifferentiableAt 𝕜 (fun x => x ^ n) x :=
   (hasDerivAt_pow n x).DifferentiableAt
 #align differentiable_at_pow differentiableAt_pow
+-/
 
+#print differentiableWithinAt_pow /-
 theorem differentiableWithinAt_pow : DifferentiableWithinAt 𝕜 (fun x => x ^ n) s x :=
   (differentiableAt_pow n).DifferentiableWithinAt
 #align differentiable_within_at_pow differentiableWithinAt_pow
+-/
 
+#print differentiable_pow /-
 theorem differentiable_pow : Differentiable 𝕜 fun x : 𝕜 => x ^ n := fun x => differentiableAt_pow n
 #align differentiable_pow differentiable_pow
+-/
 
+#print differentiableOn_pow /-
 theorem differentiableOn_pow : DifferentiableOn 𝕜 (fun x => x ^ n) s :=
   (differentiable_pow n).DifferentiableOn
 #align differentiable_on_pow differentiableOn_pow
+-/
 
+#print deriv_pow /-
 theorem deriv_pow : deriv (fun x => x ^ n) x = (n : 𝕜) * x ^ (n - 1) :=
   (hasDerivAt_pow n x).deriv
 #align deriv_pow deriv_pow
+-/
 
+#print deriv_pow' /-
 @[simp]
 theorem deriv_pow' : (deriv fun x => x ^ n) = fun x => (n : 𝕜) * x ^ (n - 1) :=
   funext fun x => deriv_pow n
 #align deriv_pow' deriv_pow'
+-/
 
+#print derivWithin_pow /-
 theorem derivWithin_pow (hxs : UniqueDiffWithinAt 𝕜 s x) :
     derivWithin (fun x => x ^ n) s x = (n : 𝕜) * x ^ (n - 1) :=
   (hasDerivWithinAt_pow n x s).derivWithin hxs
 #align deriv_within_pow derivWithin_pow
+-/
 
+#print HasDerivWithinAt.pow /-
 theorem HasDerivWithinAt.pow (hc : HasDerivWithinAt c c' s x) :
     HasDerivWithinAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') s x :=
   (hasDerivAt_pow n (c x)).comp_hasDerivWithinAt x hc
 #align has_deriv_within_at.pow HasDerivWithinAt.pow
+-/
 
+#print HasDerivAt.pow /-
 theorem HasDerivAt.pow (hc : HasDerivAt c c' x) :
     HasDerivAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') x := by
   rw [← hasDerivWithinAt_univ] at *; exact hc.pow n
 #align has_deriv_at.pow HasDerivAt.pow
+-/
 
+#print derivWithin_pow' /-
 theorem derivWithin_pow' (hc : DifferentiableWithinAt 𝕜 c s x) (hxs : UniqueDiffWithinAt 𝕜 s x) :
     derivWithin (fun x => c x ^ n) s x = (n : 𝕜) * c x ^ (n - 1) * derivWithin c s x :=
   (hc.HasDerivWithinAt.pow n).derivWithin hxs
 #align deriv_within_pow' derivWithin_pow'
+-/
 
+#print deriv_pow'' /-
 @[simp]
 theorem deriv_pow'' (hc : DifferentiableAt 𝕜 c x) :
     deriv (fun x => c x ^ n) x = (n : 𝕜) * c x ^ (n - 1) * deriv c x :=
   (hc.HasDerivAt.pow n).deriv
 #align deriv_pow'' deriv_pow''
+-/
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
 
 ! This file was ported from Lean 3 source module analysis.calculus.deriv.pow
-! leanprover-community/mathlib commit 3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe
+! leanprover-community/mathlib commit f60c6087a7275b72d5db3c5a1d0e19e35a429c0a
 ! 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.Comp
 /-!
 # Derivative of `(f x) ^ n`, `n : ℕ`
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we prove that `(x ^ n)' = n * x ^ (n - 1)`, where `n` is a natural number.
 
 For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of
Diff
@@ -27,7 +27,7 @@ derivative, power
 
 universe u v w
 
-open Classical Topology BigOperators Filter ENNReal
+open scoped Classical Topology BigOperators Filter ENNReal
 
 open Filter Asymptotics Set
 
Diff
@@ -107,10 +107,8 @@ theorem HasDerivWithinAt.pow (hc : HasDerivWithinAt c c' s x) :
 #align has_deriv_within_at.pow HasDerivWithinAt.pow
 
 theorem HasDerivAt.pow (hc : HasDerivAt c c' x) :
-    HasDerivAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') x :=
-  by
-  rw [← hasDerivWithinAt_univ] at *
-  exact hc.pow n
+    HasDerivAt (fun y => c y ^ n) ((n : 𝕜) * c x ^ (n - 1) * c') x := by
+  rw [← hasDerivWithinAt_univ] at *; exact hc.pow n
 #align has_deriv_at.pow HasDerivAt.pow
 
 theorem derivWithin_pow' (hc : DifferentiableWithinAt 𝕜 c s x) (hxs : UniqueDiffWithinAt 𝕜 s x) :

Changes in mathlib4

mathlib3
mathlib4
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -47,7 +47,7 @@ theorem hasStrictDerivAt_pow :
   | 0, x => by simp [hasStrictDerivAt_const]
   | 1, x => by simpa using hasStrictDerivAt_id x
   | n + 1 + 1, x => by
-    simpa [pow_succ', add_mul, mul_assoc] using
+    simpa [pow_succ, add_mul, mul_assoc] using
       (hasStrictDerivAt_pow (n + 1) x).mul (hasStrictDerivAt_id x)
 #align has_strict_deriv_at_pow hasStrictDerivAt_pow
 
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,25 +29,17 @@ open Topology BigOperators Filter ENNReal
 open Filter Asymptotics Set
 
 variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
-
 variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
-
 variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
-
 variable {f f₀ f₁ g : 𝕜 → F}
-
 variable {f' f₀' f₁' g' : F}
-
 variable {x : 𝕜}
-
 variable {s t : Set 𝕜}
-
 variable {L L₁ L₂ : Filter 𝕜}
 
 /-! ### Derivative of `x ↦ x^n` for `n : ℕ` -/
 
 variable {c : 𝕜 → 𝕜} {c' : 𝕜}
-
 variable (n : ℕ)
 
 theorem hasStrictDerivAt_pow :
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 ENNReal
+open scoped Classical
+open Topology BigOperators Filter ENNReal
 
 open Filter Asymptotics Set
 
@@ -119,4 +120,3 @@ theorem deriv_pow'' (hc : DifferentiableAt 𝕜 c x) :
     deriv (fun x => c x ^ n) x = (n : 𝕜) * c x ^ (n - 1) * deriv c x :=
   (hc.hasDerivAt.pow n).deriv
 #align deriv_pow'' deriv_pow''
-
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) 2019 Sébastien Gouëzel. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Sébastien Gouëzel
-
-! This file was ported from Lean 3 source module analysis.calculus.deriv.pow
-! 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.Mul
 import Mathlib.Analysis.Calculus.Deriv.Comp
 
+#align_import analysis.calculus.deriv.pow from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
+
 /-!
 # Derivative of `(f x) ^ n`, `n : ℕ`
 
feat: port Analysis.Calculus.Deriv.Pow (#4441)

Dependencies 10 + 683

684 files ported (98.6%)
303412 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