ring_theory.derivation.basicMathlib.RingTheory.Derivation.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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -185,11 +185,11 @@ theorem map_algebraMap : D (algebraMap R A r) = 0 := by
 #align derivation.map_algebra_map Derivation.map_algebraMap
 -/
 
-#print Derivation.map_coe_nat /-
+#print Derivation.map_natCast /-
 @[simp]
-theorem map_coe_nat (n : ℕ) : D (n : A) = 0 := by
+theorem map_natCast (n : ℕ) : D (n : A) = 0 := by
   rw [← nsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]
-#align derivation.map_coe_nat Derivation.map_coe_nat
+#align derivation.map_coe_nat Derivation.map_natCast
 -/
 
 #print Derivation.leibniz_pow /-
@@ -482,11 +482,11 @@ protected theorem map_sub : D (a - b) = D a - D b :=
 #align derivation.map_sub Derivation.map_sub
 -/
 
-#print Derivation.map_coe_int /-
+#print Derivation.map_intCast /-
 @[simp]
-theorem map_coe_int (n : ℤ) : D (n : A) = 0 := by
+theorem map_intCast (n : ℤ) : D (n : A) = 0 := by
   rw [← zsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]
-#align derivation.map_coe_int Derivation.map_coe_int
+#align derivation.map_coe_int Derivation.map_intCast
 -/
 
 #print Derivation.leibniz_of_mul_eq_one /-
Diff
@@ -158,11 +158,9 @@ theorem leibniz : D (a * b) = a • D b + b • D a :=
 #align derivation.leibniz Derivation.leibniz
 -/
 
-#print Derivation.map_sum /-
 theorem map_sum {ι : Type _} (s : Finset ι) (f : ι → A) : D (∑ i in s, f i) = ∑ i in s, D (f i) :=
   D.toLinearMap.map_sum
 #align derivation.map_sum Derivation.map_sum
--/
 
 #print Derivation.map_smul_of_tower /-
 @[simp]
@@ -202,8 +200,8 @@ theorem leibniz_pow (n : ℕ) : D (a ^ n) = n • a ^ (n - 1) • D a :=
   · rw [pow_zero, map_one_eq_zero, zero_smul]
   · rcases(zero_le n).eq_or_lt with (rfl | hpos)
     · rw [pow_one, one_smul, pow_zero, one_smul]
-    · have : a * a ^ (n - 1) = a ^ n := by rw [← pow_succ, Nat.sub_add_cancel hpos]
-      simp only [pow_succ, leibniz, ihn, smul_comm a n, smul_smul a, add_smul, this,
+    · have : a * a ^ (n - 1) = a ^ n := by rw [← pow_succ', Nat.sub_add_cancel hpos]
+      simp only [pow_succ', leibniz, ihn, smul_comm a n, smul_smul a, add_smul, this,
         Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, one_nsmul]
 #align derivation.leibniz_pow Derivation.leibniz_pow
 -/
Diff
@@ -72,7 +72,7 @@ variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 instance : AddMonoidHomClass (Derivation R A M) A M
     where
   coe D := D.toFun
-  coe_injective' D1 D2 h := by cases D1; cases D2; congr; exact FunLike.coe_injective h
+  coe_injective' D1 D2 h := by cases D1; cases D2; congr; exact DFunLike.coe_injective h
   map_add D := D.toLinearMap.map_add'
   map_zero D := D.toLinearMap.map_zero
 
@@ -115,20 +115,20 @@ theorem coeFn_coe (f : Derivation R A M) : ⇑(f : A →ₗ[R] M) = f :=
 
 #print Derivation.coe_injective /-
 theorem coe_injective : @Function.Injective (Derivation R A M) (A → M) coeFn :=
-  FunLike.coe_injective
+  DFunLike.coe_injective
 #align derivation.coe_injective Derivation.coe_injective
 -/
 
 #print Derivation.ext /-
 @[ext]
 theorem ext (H : ∀ a, D1 a = D2 a) : D1 = D2 :=
-  FunLike.ext _ _ H
+  DFunLike.ext _ _ H
 #align derivation.ext Derivation.ext
 -/
 
 #print Derivation.congr_fun /-
 theorem congr_fun (h : D1 = D2) (a : A) : D1 a = D2 a :=
-  FunLike.congr_fun h a
+  DFunLike.congr_fun h a
 #align derivation.congr_fun Derivation.congr_fun
 -/
 
Diff
@@ -3,7 +3,7 @@ Copyright © 2020 Nicolò Cavalleri. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Nicolò Cavalleri, Andrew Yang
 -/
-import Mathbin.RingTheory.Adjoin.Basic
+import RingTheory.Adjoin.Basic
 
 #align_import ring_theory.derivation.basic from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
 
Diff
@@ -2,14 +2,11 @@
 Copyright © 2020 Nicolò Cavalleri. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Nicolò Cavalleri, Andrew Yang
-
-! This file was ported from Lean 3 source module ring_theory.derivation.basic
-! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.Adjoin.Basic
 
+#align_import ring_theory.derivation.basic from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
+
 /-!
 # Derivations
 
Diff
@@ -84,10 +84,12 @@ directly. -/
 instance : CoeFun (Derivation R A M) fun _ => A → M :=
   ⟨fun D => D.toLinearMap.toFun⟩
 
+#print Derivation.toFun_eq_coe /-
 -- Not a simp lemma because it can be proved via `coe_fn_coe` + `to_linear_map_eq_coe`
 theorem toFun_eq_coe : D.toFun = ⇑D :=
   rfl
 #align derivation.to_fun_eq_coe Derivation.toFun_eq_coe
+-/
 
 #print Derivation.hasCoeToLinearMap /-
 instance hasCoeToLinearMap : Coe (Derivation R A M) (A →ₗ[R] M) :=
@@ -100,73 +102,102 @@ theorem toLinearMap_eq_coe : D.toLinearMap = D :=
   rfl
 #align derivation.to_linear_map_eq_coe Derivation.toLinearMap_eq_coe
 
+#print Derivation.mk_coe /-
 @[simp]
 theorem mk_coe (f : A →ₗ[R] M) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : Derivation R A M) : A → M) = f :=
   rfl
 #align derivation.mk_coe Derivation.mk_coe
+-/
 
+#print Derivation.coeFn_coe /-
 @[simp, norm_cast]
 theorem coeFn_coe (f : Derivation R A M) : ⇑(f : A →ₗ[R] M) = f :=
   rfl
 #align derivation.coe_fn_coe Derivation.coeFn_coe
+-/
 
+#print Derivation.coe_injective /-
 theorem coe_injective : @Function.Injective (Derivation R A M) (A → M) coeFn :=
   FunLike.coe_injective
 #align derivation.coe_injective Derivation.coe_injective
+-/
 
+#print Derivation.ext /-
 @[ext]
 theorem ext (H : ∀ a, D1 a = D2 a) : D1 = D2 :=
   FunLike.ext _ _ H
 #align derivation.ext Derivation.ext
+-/
 
+#print Derivation.congr_fun /-
 theorem congr_fun (h : D1 = D2) (a : A) : D1 a = D2 a :=
   FunLike.congr_fun h a
 #align derivation.congr_fun Derivation.congr_fun
+-/
 
+#print Derivation.map_add /-
 protected theorem map_add : D (a + b) = D a + D b :=
   map_add D a b
 #align derivation.map_add Derivation.map_add
+-/
 
+#print Derivation.map_zero /-
 protected theorem map_zero : D 0 = 0 :=
   map_zero D
 #align derivation.map_zero Derivation.map_zero
+-/
 
+#print Derivation.map_smul /-
 @[simp]
 theorem map_smul : D (r • a) = r • D a :=
   D.toLinearMap.map_smul r a
 #align derivation.map_smul Derivation.map_smul
+-/
 
+#print Derivation.leibniz /-
 @[simp]
 theorem leibniz : D (a * b) = a • D b + b • D a :=
   D.leibniz' _ _
 #align derivation.leibniz Derivation.leibniz
+-/
 
+#print Derivation.map_sum /-
 theorem map_sum {ι : Type _} (s : Finset ι) (f : ι → A) : D (∑ i in s, f i) = ∑ i in s, D (f i) :=
   D.toLinearMap.map_sum
 #align derivation.map_sum Derivation.map_sum
+-/
 
+#print Derivation.map_smul_of_tower /-
 @[simp]
 theorem map_smul_of_tower {S : Type _} [SMul S A] [SMul S M] [LinearMap.CompatibleSMul A M S R]
     (D : Derivation R A M) (r : S) (a : A) : D (r • a) = r • D a :=
   D.toLinearMap.map_smul_of_tower r a
 #align derivation.map_smul_of_tower Derivation.map_smul_of_tower
+-/
 
+#print Derivation.map_one_eq_zero /-
 @[simp]
 theorem map_one_eq_zero : D 1 = 0 :=
   D.map_one_eq_zero'
 #align derivation.map_one_eq_zero Derivation.map_one_eq_zero
+-/
 
+#print Derivation.map_algebraMap /-
 @[simp]
 theorem map_algebraMap : D (algebraMap R A r) = 0 := by
   rw [← mul_one r, RingHom.map_mul, RingHom.map_one, ← smul_def, map_smul, map_one_eq_zero,
     smul_zero]
 #align derivation.map_algebra_map Derivation.map_algebraMap
+-/
 
+#print Derivation.map_coe_nat /-
 @[simp]
 theorem map_coe_nat (n : ℕ) : D (n : A) = 0 := by
   rw [← nsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]
 #align derivation.map_coe_nat Derivation.map_coe_nat
+-/
 
+#print Derivation.leibniz_pow /-
 @[simp]
 theorem leibniz_pow (n : ℕ) : D (a ^ n) = n • a ^ (n - 1) • D a :=
   by
@@ -178,17 +209,22 @@ theorem leibniz_pow (n : ℕ) : D (a ^ n) = n • a ^ (n - 1) • D a :=
       simp only [pow_succ, leibniz, ihn, smul_comm a n, smul_smul a, add_smul, this,
         Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, one_nsmul]
 #align derivation.leibniz_pow Derivation.leibniz_pow
+-/
 
+#print Derivation.eqOn_adjoin /-
 theorem eqOn_adjoin {s : Set A} (h : Set.EqOn D1 D2 s) : Set.EqOn D1 D2 (adjoin R s) := fun x hx =>
   Algebra.adjoin_induction hx h (fun r => (D1.map_algebraMap r).trans (D2.map_algebraMap r).symm)
     (fun x y hx hy => by simp only [map_add, *]) fun x y hx hy => by simp only [leibniz, *]
 #align derivation.eq_on_adjoin Derivation.eqOn_adjoin
+-/
 
+#print Derivation.ext_of_adjoin_eq_top /-
 /-- If adjoin of a set is the whole algebra, then any two derivations equal on this set are equal
 on the whole algebra. -/
 theorem ext_of_adjoin_eq_top (s : Set A) (hs : adjoin R s = ⊤) (h : Set.EqOn D1 D2 s) : D1 = D2 :=
   ext fun a => eqOn_adjoin h <| hs.symm ▸ trivial
 #align derivation.ext_of_adjoin_eq_top Derivation.ext_of_adjoin_eq_top
+-/
 
 -- Data typeclasses
 instance : Zero (Derivation R A M) :=
@@ -196,19 +232,25 @@ instance : Zero (Derivation R A M) :=
       map_one_eq_zero' := rfl
       leibniz' := fun a b => by simp only [add_zero, LinearMap.zero_apply, smul_zero] }⟩
 
+#print Derivation.coe_zero /-
 @[simp]
 theorem coe_zero : ⇑(0 : Derivation R A M) = 0 :=
   rfl
 #align derivation.coe_zero Derivation.coe_zero
+-/
 
+#print Derivation.coe_zero_linearMap /-
 @[simp]
 theorem coe_zero_linearMap : ↑(0 : Derivation R A M) = (0 : A →ₗ[R] M) :=
   rfl
 #align derivation.coe_zero_linear_map Derivation.coe_zero_linearMap
+-/
 
+#print Derivation.zero_apply /-
 theorem zero_apply (a : A) : (0 : Derivation R A M) a = 0 :=
   rfl
 #align derivation.zero_apply Derivation.zero_apply
+-/
 
 instance : Add (Derivation R A M) :=
   ⟨fun D1 D2 =>
@@ -217,19 +259,25 @@ instance : Add (Derivation R A M) :=
       leibniz' := fun a b => by
         simp only [leibniz, LinearMap.add_apply, coe_fn_coe, smul_add, add_add_add_comm] }⟩
 
+#print Derivation.coe_add /-
 @[simp]
 theorem coe_add (D1 D2 : Derivation R A M) : ⇑(D1 + D2) = D1 + D2 :=
   rfl
 #align derivation.coe_add Derivation.coe_add
+-/
 
+#print Derivation.coe_add_linearMap /-
 @[simp]
 theorem coe_add_linearMap (D1 D2 : Derivation R A M) : ↑(D1 + D2) = (D1 + D2 : A →ₗ[R] M) :=
   rfl
 #align derivation.coe_add_linear_map Derivation.coe_add_linearMap
+-/
 
+#print Derivation.add_apply /-
 theorem add_apply : (D1 + D2) a = D1 a + D2 a :=
   rfl
 #align derivation.add_apply Derivation.add_apply
+-/
 
 instance : Inhabited (Derivation R A M) :=
   ⟨0⟩
@@ -249,23 +297,30 @@ instance (priority := 100) : SMul S (Derivation R A M) :=
       leibniz' := fun a b => by
         simp only [LinearMap.smul_apply, coe_fn_coe, leibniz, smul_add, smul_comm r] }⟩
 
+#print Derivation.coe_smul /-
 @[simp]
 theorem coe_smul (r : S) (D : Derivation R A M) : ⇑(r • D) = r • D :=
   rfl
 #align derivation.coe_smul Derivation.coe_smul
+-/
 
+#print Derivation.coe_smul_linearMap /-
 @[simp]
 theorem coe_smul_linearMap (r : S) (D : Derivation R A M) : ↑(r • D) = (r • D : A →ₗ[R] M) :=
   rfl
 #align derivation.coe_smul_linear_map Derivation.coe_smul_linearMap
+-/
 
+#print Derivation.smul_apply /-
 theorem smul_apply (r : S) (D : Derivation R A M) : (r • D) a = r • D a :=
   rfl
 #align derivation.smul_apply Derivation.smul_apply
+-/
 
 instance : AddCommMonoid (Derivation R A M) :=
   coe_injective.AddCommMonoid _ coe_zero coe_add fun _ _ => rfl
 
+#print Derivation.coeFnAddMonoidHom /-
 /-- `coe_fn` as an `add_monoid_hom`. -/
 def coeFnAddMonoidHom : Derivation R A M →+ A → M
     where
@@ -273,6 +328,7 @@ def coeFnAddMonoidHom : Derivation R A M →+ A → M
   map_zero' := coe_zero
   map_add' := coe_add
 #align derivation.coe_fn_add_monoid_hom Derivation.coeFnAddMonoidHom
+-/
 
 instance (priority := 100) : DistribMulAction S (Derivation R A M) :=
   Function.Injective.distribMulAction coeFnAddMonoidHom coe_injective coe_smul
@@ -299,6 +355,7 @@ variable {N : Type _} [AddCommMonoid N] [Module A N] [Module R N] [IsScalarTower
 
 variable (f : M →ₗ[A] N) (e : M ≃ₗ[A] N)
 
+#print LinearMap.compDer /-
 /-- We can push forward derivations using linear maps, i.e., the composition of a derivation with a
 linear map is a derivation. Furthermore, this operation is linear on the spaces of derivations. -/
 def LinearMap.compDer : Derivation R A M →ₗ[R] Derivation R A N
@@ -312,17 +369,23 @@ def LinearMap.compDer : Derivation R A M →ₗ[R] Derivation R A N
   map_add' D₁ D₂ := by ext; exact LinearMap.map_add _ _ _
   map_smul' r D := by ext; exact LinearMap.map_smul _ _ _
 #align linear_map.comp_der LinearMap.compDer
+-/
 
+#print Derivation.coe_to_linearMap_comp /-
 @[simp]
 theorem coe_to_linearMap_comp : (f.compDer D : A →ₗ[R] N) = (f : M →ₗ[R] N).comp (D : A →ₗ[R] M) :=
   rfl
 #align derivation.coe_to_linear_map_comp Derivation.coe_to_linearMap_comp
+-/
 
+#print Derivation.coe_comp /-
 @[simp]
 theorem coe_comp : (f.compDer D : A → N) = (f : M →ₗ[R] N).comp (D : A →ₗ[R] M) :=
   rfl
 #align derivation.coe_comp Derivation.coe_comp
+-/
 
+#print Derivation.llcomp /-
 /-- The composition of a derivation with a linear map as a bilinear map -/
 @[simps]
 def llcomp : (M →ₗ[A] N) →ₗ[A] Derivation R A M →ₗ[R] Derivation R A N
@@ -331,7 +394,9 @@ def llcomp : (M →ₗ[A] N) →ₗ[A] Derivation R A M →ₗ[R] Derivation R A
   map_add' f₁ f₂ := by ext; rfl
   map_smul' r D := by ext; rfl
 #align derivation.llcomp Derivation.llcomp
+-/
 
+#print LinearEquiv.compDer /-
 /-- Pushing a derivation foward through a linear equivalence is an equivalence. -/
 def LinearEquiv.compDer : Derivation R A M ≃ₗ[R] Derivation R A N :=
   { e.toLinearMap.compDer with
@@ -339,6 +404,7 @@ def LinearEquiv.compDer : Derivation R A M ≃ₗ[R] Derivation R A N :=
     left_inv := fun D => by ext a; exact e.symm_apply_apply (D a)
     right_inv := fun D => by ext a; exact e.apply_symm_apply (D a) }
 #align linear_equiv.comp_der LinearEquiv.compDer
+-/
 
 end PushForward
 
@@ -370,6 +436,7 @@ section Cancel
 variable {R : Type _} [CommSemiring R] {A : Type _} [CommSemiring A] [Algebra R A] {M : Type _}
   [AddCancelCommMonoid M] [Module R M] [Module A M]
 
+#print Derivation.mk' /-
 /-- Define `derivation R A M` from a linear map when `M` is cancellative by verifying the Leibniz
 rule. -/
 def mk' (D : A →ₗ[R] M) (h : ∀ a b, D (a * b) = a • D b + b • D a) : Derivation R A M
@@ -378,16 +445,21 @@ def mk' (D : A →ₗ[R] M) (h : ∀ a b, D (a * b) = a • D b + b • D a) : D
   map_one_eq_zero' := add_right_eq_self.1 <| by simpa only [one_smul, one_mul] using (h 1 1).symm
   leibniz' := h
 #align derivation.mk' Derivation.mk'
+-/
 
+#print Derivation.coe_mk' /-
 @[simp]
 theorem coe_mk' (D : A →ₗ[R] M) (h) : ⇑(mk' D h) = D :=
   rfl
 #align derivation.coe_mk' Derivation.coe_mk'
+-/
 
+#print Derivation.coe_mk'_linearMap /-
 @[simp]
 theorem coe_mk'_linearMap (D : A →ₗ[R] M) (h) : (mk' D h : A →ₗ[R] M) = D :=
   rfl
 #align derivation.coe_mk'_linear_map Derivation.coe_mk'_linearMap
+-/
 
 end Cancel
 
@@ -403,19 +475,26 @@ variable {M : Type _} [AddCommGroup M] [Module A M] [Module R M]
 
 variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 
+#print Derivation.map_neg /-
 protected theorem map_neg : D (-a) = -D a :=
   map_neg D a
 #align derivation.map_neg Derivation.map_neg
+-/
 
+#print Derivation.map_sub /-
 protected theorem map_sub : D (a - b) = D a - D b :=
   map_sub D a b
 #align derivation.map_sub Derivation.map_sub
+-/
 
+#print Derivation.map_coe_int /-
 @[simp]
 theorem map_coe_int (n : ℤ) : D (n : A) = 0 := by
   rw [← zsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]
 #align derivation.map_coe_int Derivation.map_coe_int
+-/
 
+#print Derivation.leibniz_of_mul_eq_one /-
 theorem leibniz_of_mul_eq_one {a b : A} (h : a * b = 1) : D a = -a ^ 2 • D b :=
   by
   rw [neg_smul]
@@ -425,11 +504,15 @@ theorem leibniz_of_mul_eq_one {a b : A} (h : a * b = 1) : D a = -a ^ 2 • D b :
     _ = a • D (a * b) := by rw [leibniz, smul_add, add_comm]
     _ = 0 := by rw [h, map_one_eq_zero, smul_zero]
 #align derivation.leibniz_of_mul_eq_one Derivation.leibniz_of_mul_eq_one
+-/
 
+#print Derivation.leibniz_invOf /-
 theorem leibniz_invOf [Invertible a] : D (⅟ a) = -⅟ a ^ 2 • D a :=
   D.leibniz_of_mul_eq_one <| invOf_mul_self a
 #align derivation.leibniz_inv_of Derivation.leibniz_invOf
+-/
 
+#print Derivation.leibniz_inv /-
 theorem leibniz_inv {K : Type _} [Field K] [Module K M] [Algebra R K] (D : Derivation R K M)
     (a : K) : D a⁻¹ = -a⁻¹ ^ 2 • D a :=
   by
@@ -437,44 +520,57 @@ theorem leibniz_inv {K : Type _} [Field K] [Module K M] [Algebra R K] (D : Deriv
   · simp
   · exact D.leibniz_of_mul_eq_one (inv_mul_cancel ha)
 #align derivation.leibniz_inv Derivation.leibniz_inv
+-/
 
 instance : Neg (Derivation R A M) :=
   ⟨fun D =>
     mk' (-D) fun a b => by
       simp only [LinearMap.neg_apply, smul_neg, neg_add_rev, leibniz, coe_fn_coe, add_comm]⟩
 
+#print Derivation.coe_neg /-
 @[simp]
 theorem coe_neg (D : Derivation R A M) : ⇑(-D) = -D :=
   rfl
 #align derivation.coe_neg Derivation.coe_neg
+-/
 
+#print Derivation.coe_neg_linearMap /-
 @[simp]
 theorem coe_neg_linearMap (D : Derivation R A M) : ↑(-D) = (-D : A →ₗ[R] M) :=
   rfl
 #align derivation.coe_neg_linear_map Derivation.coe_neg_linearMap
+-/
 
+#print Derivation.neg_apply /-
 theorem neg_apply : (-D) a = -D a :=
   rfl
 #align derivation.neg_apply Derivation.neg_apply
+-/
 
 instance : Sub (Derivation R A M) :=
   ⟨fun D1 D2 =>
     mk' (D1 - D2 : A →ₗ[R] M) fun a b => by
       simp only [LinearMap.sub_apply, leibniz, coe_fn_coe, smul_sub, add_sub_add_comm]⟩
 
+#print Derivation.coe_sub /-
 @[simp]
 theorem coe_sub (D1 D2 : Derivation R A M) : ⇑(D1 - D2) = D1 - D2 :=
   rfl
 #align derivation.coe_sub Derivation.coe_sub
+-/
 
+#print Derivation.coe_sub_linearMap /-
 @[simp]
 theorem coe_sub_linearMap (D1 D2 : Derivation R A M) : ↑(D1 - D2) = (D1 - D2 : A →ₗ[R] M) :=
   rfl
 #align derivation.coe_sub_linear_map Derivation.coe_sub_linearMap
+-/
 
+#print Derivation.sub_apply /-
 theorem sub_apply : (D1 - D2) a = D1 a - D2 a :=
   rfl
 #align derivation.sub_apply Derivation.sub_apply
+-/
 
 instance : AddCommGroup (Derivation R A M) :=
   coe_injective.AddCommGroup _ coe_zero coe_add coe_neg coe_sub (fun _ _ => rfl) fun _ _ => rfl
Diff
@@ -424,7 +424,6 @@ theorem leibniz_of_mul_eq_one {a b : A} (h : a * b = 1) : D a = -a ^ 2 • D b :
     D a + a ^ 2 • D b = a • b • D a + a • a • D b := by simp only [smul_smul, h, one_smul, sq]
     _ = a • D (a * b) := by rw [leibniz, smul_add, add_comm]
     _ = 0 := by rw [h, map_one_eq_zero, smul_zero]
-    
 #align derivation.leibniz_of_mul_eq_one Derivation.leibniz_of_mul_eq_one
 
 theorem leibniz_invOf [Invertible a] : D (⅟ a) = -⅟ a ^ 2 • D a :=
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Nicolò Cavalleri, Andrew Yang
 
 ! This file was ported from Lean 3 source module ring_theory.derivation.basic
-! leanprover-community/mathlib commit b608348ffaeb7f557f2fd46876037abafd326ff3
+! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.RingTheory.Adjoin.Basic
 /-!
 # Derivations
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file defines derivation. A derivation `D` from the `R`-algebra `A` to the `A`-module `M` is an
 `R`-linear map that satisfy the Leibniz rule `D (a * b) = a * D b + D a * b`.
 
@@ -40,6 +43,7 @@ open Algebra
 
 open scoped BigOperators
 
+#print Derivation /-
 /-- `D : derivation R A M` is an `R`-linear map from `A` to `M` that satisfies the `leibniz`
 equality. We also require that `D 1 = 0`. See `derivation.mk'` for a constructor that deduces this
 assumption from the Leibniz rule when `M` is cancellative.
@@ -51,6 +55,7 @@ structure Derivation (R : Type _) (A : Type _) [CommSemiring R] [CommSemiring A]
   map_one_eq_zero' : to_linear_map 1 = 0
   leibniz' (a b : A) : to_linear_map (a * b) = a • to_linear_map b + b • to_linear_map a
 #align derivation Derivation
+-/
 
 /-- The `linear_map` underlying a `derivation`. -/
 add_decl_doc Derivation.toLinearMap
@@ -84,9 +89,11 @@ theorem toFun_eq_coe : D.toFun = ⇑D :=
   rfl
 #align derivation.to_fun_eq_coe Derivation.toFun_eq_coe
 
+#print Derivation.hasCoeToLinearMap /-
 instance hasCoeToLinearMap : Coe (Derivation R A M) (A →ₗ[R] M) :=
   ⟨fun D => D.toLinearMap⟩
 #align derivation.has_coe_to_linear_map Derivation.hasCoeToLinearMap
+-/
 
 @[simp]
 theorem toLinearMap_eq_coe : D.toLinearMap = D :=
@@ -343,6 +350,7 @@ variable [Algebra S A] [Module S M] [LinearMap.CompatibleSMul A M R S]
 
 variable (R)
 
+#print Derivation.restrictScalars /-
 /-- If `A` is both an `R`-algebra and an `S`-algebra; `M` is both an `R`-module and an `S`-module,
 then an `S`-derivation `A → M` is also an `R`-derivation if it is also `R`-linear. -/
 protected def restrictScalars (d : Derivation S A M) : Derivation R A M
@@ -351,6 +359,7 @@ protected def restrictScalars (d : Derivation S A M) : Derivation R A M
   leibniz' := d.leibniz
   toLinearMap := d.toLinearMap.restrictScalars R
 #align derivation.restrict_scalars Derivation.restrictScalars
+-/
 
 end RestrictScalars
 
Diff
@@ -3,14 +3,12 @@ Copyright © 2020 Nicolò Cavalleri. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Nicolò Cavalleri, Andrew Yang
 
-! This file was ported from Lean 3 source module ring_theory.derivation
-! leanprover-community/mathlib commit 26ae6f6771ba2d8c76ac47efb84ef2908f178630
+! This file was ported from Lean 3 source module ring_theory.derivation.basic
+! leanprover-community/mathlib commit b608348ffaeb7f557f2fd46876037abafd326ff3
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.Algebra.Lie.OfAssociative
 import Mathbin.RingTheory.Adjoin.Basic
-import Mathbin.RingTheory.Ideal.QuotientOperations
 
 /-!
 # Derivations
@@ -23,7 +21,11 @@ This file defines derivation. A derivation `D` from the `R`-algebra `A` to the `
 - `derivation`: The type of `R`-derivations from `A` to `M`. This has an `A`-module structure.
 - `derivation.llcomp`: We may compose linear maps and derivations to obtain a derivation,
   and the composition is bilinear.
+
+See `ring_theory.derivation.lie` for
 - `derivation.lie_algebra`: The `R`-derivations from `A` to `A` form an lie algebra over `R`.
+
+and `ring_theory.derivation.to_square_zero` for
 - `derivation_to_square_zero_equiv_lift`: The `R`-derivations from `A` into a square-zero ideal `I`
   of `B` corresponds to the lifts `A →ₐ[R] B` of the map `A →ₐ[R] B ⧸ I`.
 
@@ -471,163 +473,7 @@ instance : AddCommGroup (Derivation R A M) :=
 
 end
 
-section LieStructures
-
-/-! # Lie structures -/
-
-
-variable (D : Derivation R A A) {D1 D2 : Derivation R A A} (r : R) (a b : A)
-
-/-- The commutator of derivations is again a derivation. -/
-instance : Bracket (Derivation R A A) (Derivation R A A) :=
-  ⟨fun D1 D2 =>
-    mk' ⁅(D1 : Module.End R A), (D2 : Module.End R A)⁆ fun a b =>
-      by
-      simp only [Ring.lie_def, map_add, id.smul_eq_mul, LinearMap.mul_apply, leibniz, coe_fn_coe,
-        LinearMap.sub_apply]
-      ring⟩
-
-@[simp]
-theorem commutator_coe_linear_map : ↑⁅D1, D2⁆ = ⁅(D1 : Module.End R A), (D2 : Module.End R A)⁆ :=
-  rfl
-#align derivation.commutator_coe_linear_map Derivation.commutator_coe_linear_map
-
-theorem commutator_apply : ⁅D1, D2⁆ a = D1 (D2 a) - D2 (D1 a) :=
-  rfl
-#align derivation.commutator_apply Derivation.commutator_apply
-
-instance : LieRing (Derivation R A A)
-    where
-  add_lie d e f := by ext a; simp only [commutator_apply, add_apply, map_add]; ring
-  lie_add d e f := by ext a; simp only [commutator_apply, add_apply, map_add]; ring
-  lie_self d := by ext a; simp only [commutator_apply, add_apply, map_add]; ring_nf
-  leibniz_lie d e f := by ext a; simp only [commutator_apply, add_apply, sub_apply, map_sub]; ring
-
-instance : LieAlgebra R (Derivation R A A) :=
-  { Derivation.module with
-    lie_smul := fun r d e => by ext a;
-      simp only [commutator_apply, map_smul, smul_sub, smul_apply] }
-
-end LieStructures
-
 end
 
 end Derivation
 
-section ToSquareZero
-
-universe u v w
-
-variable {R : Type u} {A : Type v} {B : Type w} [CommSemiring R] [CommSemiring A] [CommRing B]
-
-variable [Algebra R A] [Algebra R B] (I : Ideal B) (hI : I ^ 2 = ⊥)
-
-/-- If `f₁ f₂ : A →ₐ[R] B` are two lifts of the same `A →ₐ[R] B ⧸ I`,
-  we may define a map `f₁ - f₂ : A →ₗ[R] I`. -/
-def diffToIdealOfQuotientCompEq (f₁ f₂ : A →ₐ[R] B)
-    (e : (Ideal.Quotient.mkₐ R I).comp f₁ = (Ideal.Quotient.mkₐ R I).comp f₂) : A →ₗ[R] I :=
-  LinearMap.codRestrict (I.restrictScalars _) (f₁.toLinearMap - f₂.toLinearMap)
-    (by
-      intro x
-      change f₁ x - f₂ x ∈ I
-      rw [← Ideal.Quotient.eq, ← Ideal.Quotient.mkₐ_eq_mk R, ← AlgHom.comp_apply, e]
-      rfl)
-#align diff_to_ideal_of_quotient_comp_eq diffToIdealOfQuotientCompEq
-
-@[simp]
-theorem diffToIdealOfQuotientCompEq_apply (f₁ f₂ : A →ₐ[R] B)
-    (e : (Ideal.Quotient.mkₐ R I).comp f₁ = (Ideal.Quotient.mkₐ R I).comp f₂) (x : A) :
-    ((diffToIdealOfQuotientCompEq I f₁ f₂ e) x : B) = f₁ x - f₂ x :=
-  rfl
-#align diff_to_ideal_of_quotient_comp_eq_apply diffToIdealOfQuotientCompEq_apply
-
-variable [Algebra A B] [IsScalarTower R A B]
-
-include hI
-
-/-- Given a tower of algebras `R → A → B`, and a square-zero `I : ideal B`, each lift `A →ₐ[R] B`
-of the canonical map `A →ₐ[R] B ⧸ I` corresponds to a `R`-derivation from `A` to `I`. -/
-def derivationToSquareZeroOfLift (f : A →ₐ[R] B)
-    (e : (Ideal.Quotient.mkₐ R I).comp f = IsScalarTower.toAlgHom R A (B ⧸ I)) : Derivation R A I :=
-  by
-  refine'
-    {
-      diffToIdealOfQuotientCompEq I f (IsScalarTower.toAlgHom R A B)
-        _ with
-      map_one_eq_zero' := _
-      leibniz' := _ }
-  · rw [e]; ext; rfl
-  · ext; change f 1 - algebraMap A B 1 = 0; rw [map_one, map_one, sub_self]
-  · intro x y
-    let F := diffToIdealOfQuotientCompEq I f (IsScalarTower.toAlgHom R A B) (by rw [e]; ext; rfl)
-    have : (f x - algebraMap A B x) * (f y - algebraMap A B y) = 0 :=
-      by
-      rw [← Ideal.mem_bot, ← hI, pow_two]
-      convert Ideal.mul_mem_mul (F x).2 (F y).2 using 1
-    ext
-    dsimp only [Submodule.coe_add, Submodule.coe_mk, LinearMap.coe_mk,
-      diffToIdealOfQuotientCompEq_apply, Submodule.coe_smul_of_tower, IsScalarTower.coe_toAlgHom',
-      LinearMap.toFun_eq_coe]
-    simp only [map_mul, sub_mul, mul_sub, Algebra.smul_def] at this ⊢
-    rw [sub_eq_iff_eq_add, sub_eq_iff_eq_add] at this 
-    rw [this]
-    ring
-#align derivation_to_square_zero_of_lift derivationToSquareZeroOfLift
-
-theorem derivationToSquareZeroOfLift_apply (f : A →ₐ[R] B)
-    (e : (Ideal.Quotient.mkₐ R I).comp f = IsScalarTower.toAlgHom R A (B ⧸ I)) (x : A) :
-    (derivationToSquareZeroOfLift I hI f e x : B) = f x - algebraMap A B x :=
-  rfl
-#align derivation_to_square_zero_of_lift_apply derivationToSquareZeroOfLift_apply
-
-/-- Given a tower of algebras `R → A → B`, and a square-zero `I : ideal B`, each `R`-derivation
-from `A` to `I` corresponds to a lift `A →ₐ[R] B` of the canonical map `A →ₐ[R] B ⧸ I`. -/
-@[simps (config := { attrs := [] })]
-def liftOfDerivationToSquareZero (f : Derivation R A I) : A →ₐ[R] B :=
-  {
-    ((I.restrictScalars R).Subtype.comp f.toLinearMap + (IsScalarTower.toAlgHom R A B).toLinearMap :
-      A →ₗ[R] B) with
-    toFun := fun x => f x + algebraMap A B x
-    map_one' := by rw [map_one, f.map_one_eq_zero, Submodule.coe_zero, zero_add]
-    map_mul' := fun x y =>
-      by
-      have : (f x : B) * f y = 0 := by rw [← Ideal.mem_bot, ← hI, pow_two];
-        convert Ideal.mul_mem_mul (f x).2 (f y).2 using 1
-      simp only [map_mul, f.leibniz, add_mul, mul_add, Submodule.coe_add,
-        Submodule.coe_smul_of_tower, Algebra.smul_def, this]
-      ring
-    commutes' := fun r => by
-      simp only [Derivation.map_algebraMap, eq_self_iff_true, zero_add, Submodule.coe_zero, ←
-        IsScalarTower.algebraMap_apply R A B r]
-    map_zero' :=
-      ((I.restrictScalars R).Subtype.comp f.toLinearMap +
-          (IsScalarTower.toAlgHom R A B).toLinearMap).map_zero }
-#align lift_of_derivation_to_square_zero liftOfDerivationToSquareZero
-
-@[simp]
-theorem liftOfDerivationToSquareZero_mk_apply (d : Derivation R A I) (x : A) :
-    Ideal.Quotient.mk I (liftOfDerivationToSquareZero I hI d x) = algebraMap A (B ⧸ I) x :=
-  by
-  rw [liftOfDerivationToSquareZero_apply, map_add, ideal.quotient.eq_zero_iff_mem.mpr (d x).Prop,
-    zero_add]
-  rfl
-#align lift_of_derivation_to_square_zero_mk_apply liftOfDerivationToSquareZero_mk_apply
-
-/-- Given a tower of algebras `R → A → B`, and a square-zero `I : ideal B`,
-there is a 1-1 correspondance between `R`-derivations from `A` to `I` and
-lifts `A →ₐ[R] B` of the canonical map `A →ₐ[R] B ⧸ I`. -/
-@[simps]
-def derivationToSquareZeroEquivLift :
-    Derivation R A I ≃
-      { f : A →ₐ[R] B // (Ideal.Quotient.mkₐ R I).comp f = IsScalarTower.toAlgHom R A (B ⧸ I) } :=
-  by
-  refine'
-    ⟨fun d => ⟨liftOfDerivationToSquareZero I hI d, _⟩, fun f =>
-      (derivationToSquareZeroOfLift I hI f.1 f.2 : _), _, _⟩
-  · ext x; exact liftOfDerivationToSquareZero_mk_apply I hI d x
-  · intro d; ext x; exact add_sub_cancel (d x : B) (algebraMap A B x)
-  · rintro ⟨f, hf⟩; ext x; exact sub_add_cancel (f x) (algebraMap A B x)
-#align derivation_to_square_zero_equiv_lift derivationToSquareZeroEquivLift
-
-end ToSquareZero
-

Changes in mathlib4

mathlib3
mathlib4
feat(RingTheory/Kaehler): The Kaehler differential module of polynomial algebras. (#11895)

Co-authored-by: Andrew Yang <36414270+erdOne@users.noreply.github.com>

Diff
@@ -4,6 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Nicolò Cavalleri, Andrew Yang
 -/
 import Mathlib.RingTheory.Adjoin.Basic
+import Mathlib.Algebra.Polynomial.AlgebraMap
+import Mathlib.Algebra.Polynomial.Derivative
 
 #align_import ring_theory.derivation.basic from "leanprover-community/mathlib"@"b608348ffaeb7f557f2fd46876037abafd326ff3"
 
@@ -163,6 +165,15 @@ theorem leibniz_pow (n : ℕ) : D (a ^ n) = n • a ^ (n - 1) • D a := by
         Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, one_nsmul]
 #align derivation.leibniz_pow Derivation.leibniz_pow
 
+open Polynomial in
+@[simp]
+theorem map_aeval (P : R[X]) (x : A) :
+    D (aeval x P) = aeval x (derivative P) • D x := by
+  induction P using Polynomial.induction_on
+  · simp
+  · simp [add_smul, *]
+  · simp [mul_smul, nsmul_eq_smul_cast A]
+
 theorem eqOn_adjoin {s : Set A} (h : Set.EqOn D1 D2 s) : Set.EqOn D1 D2 (adjoin R s) := fun x hx =>
   Algebra.adjoin_induction hx h (fun r => (D1.map_algebraMap r).trans (D2.map_algebraMap r).symm)
     (fun x y hx hy => by simp only [map_add, *]) fun x y hx hy => by simp only [leibniz, *]
chore: Rename coe_nat/coe_int/coe_rat to natCast/intCast/ratCast (#11499)

This is less exhaustive than its sibling #11486 because edge cases are harder to classify. No fundamental difficulty, just me being a bit fast and lazy.

Reduce the diff of #11203

Diff
@@ -148,9 +148,9 @@ theorem map_algebraMap : D (algebraMap R A r) = 0 := by
 #align derivation.map_algebra_map Derivation.map_algebraMap
 
 @[simp]
-theorem map_coe_nat (n : ℕ) : D (n : A) = 0 := by
+theorem map_natCast (n : ℕ) : D (n : A) = 0 := by
   rw [← nsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]
-#align derivation.map_coe_nat Derivation.map_coe_nat
+#align derivation.map_coe_nat Derivation.map_natCast
 
 @[simp]
 theorem leibniz_pow (n : ℕ) : D (a ^ n) = n • a ^ (n - 1) • D a := by
@@ -395,9 +395,13 @@ protected theorem map_sub : D (a - b) = D a - D b :=
 #align derivation.map_sub Derivation.map_sub
 
 @[simp]
-theorem map_coe_int (n : ℤ) : D (n : A) = 0 := by
+theorem map_intCast (n : ℤ) : D (n : A) = 0 := by
   rw [← zsmul_one, D.map_smul_of_tower n, map_one_eq_zero, smul_zero]
-#align derivation.map_coe_int Derivation.map_coe_int
+#align derivation.map_coe_int Derivation.map_intCast
+
+-- 2024-04-05
+@[deprecated] alias map_coe_nat := map_natCast
+@[deprecated] alias map_coe_int := map_intCast
 
 theorem leibniz_of_mul_eq_one {a b : A} (h : a * b = 1) : D a = -a ^ 2 • D b := by
   rw [neg_smul]
chore(RingTheory): delete useless lemma (#11827)

As discussed in https://github.com/leanprover-community/mathlib4/pull/11790 for the case of Lie derivations, it seems that this map_sum lemma is not useful since we can use the generic version.

Diff
@@ -33,7 +33,6 @@ and `RingTheory.Derivation.ToSquareZero` for
 -/
 
 open Algebra
-open scoped BigOperators
 
 /-- `D : Derivation R A M` is an `R`-linear map from `A` to `M` that satisfies the `leibniz`
 equality. We also require that `D 1 = 0`. See `Derivation.mk'` for a constructor that deduces this
@@ -129,10 +128,7 @@ theorem leibniz : D (a * b) = a • D b + b • D a :=
   D.leibniz' _ _
 #align derivation.leibniz Derivation.leibniz
 
-nonrec theorem map_sum {ι : Type*} (s : Finset ι) (f : ι → A) :
-    D (∑ i in s, f i) = ∑ i in s, D (f i) :=
-  map_sum D _ _
-#align derivation.map_sum Derivation.map_sum
+#noalign derivation.map_sum
 
 @[simp]
 theorem map_smul_of_tower {S : Type*} [SMul S A] [SMul S M] [LinearMap.CompatibleSMul A M S R]
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
@@ -162,8 +162,8 @@ theorem leibniz_pow (n : ℕ) : D (a ^ n) = n • a ^ (n - 1) • D a := by
   · rw [Nat.zero_eq, pow_zero, map_one_eq_zero, zero_smul]
   · rcases (zero_le n).eq_or_lt with (rfl | hpos)
     · erw [pow_one, one_smul, pow_zero, one_smul]
-    · have : a * a ^ (n - 1) = a ^ n := by rw [← pow_succ, Nat.sub_add_cancel hpos]
-      simp only [pow_succ, leibniz, ihn, smul_comm a n (_ : M), smul_smul a, add_smul, this,
+    · have : a * a ^ (n - 1) = a ^ n := by rw [← pow_succ', Nat.sub_add_cancel hpos]
+      simp only [pow_succ', leibniz, ihn, smul_comm a n (_ : M), smul_smul a, add_smul, this,
         Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, one_nsmul]
 #align derivation.leibniz_pow Derivation.leibniz_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
@@ -225,9 +225,7 @@ instance : Inhabited (Derivation R A M) :=
 section Scalar
 
 variable {S T : Type*}
-
 variable [Monoid S] [DistribMulAction S M] [SMulCommClass R S M] [SMulCommClass S A M]
-
 variable [Monoid T] [DistribMulAction T M] [SMulCommClass R T M] [SMulCommClass T A M]
 
 instance : SMul S (Derivation R A M) :=
@@ -342,9 +340,7 @@ def compAlgebraMap [Algebra A B] [IsScalarTower R A B] [IsScalarTower A B M]
 section RestrictScalars
 
 variable {S : Type*} [CommSemiring S]
-
 variable [Algebra S A] [Module S M] [LinearMap.CompatibleSMul A M R S]
-
 variable (R)
 
 /-- If `A` is both an `R`-algebra and an `S`-algebra; `M` is both an `R`-module and an `S`-module,
@@ -387,13 +383,11 @@ end Cancel
 section
 
 variable {R : Type*} [CommRing R]
-
 variable {A : Type*} [CommRing A] [Algebra R A]
 
 section
 
 variable {M : Type*} [AddCommGroup M] [Module A M] [Module R M]
-
 variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 
 protected theorem map_neg : D (-a) = -D a :=
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -86,7 +86,7 @@ instance hasCoeToLinearMap : Coe (Derivation R A M) (A →ₗ[R] M) :=
   ⟨fun D => D.toLinearMap⟩
 #align derivation.has_coe_to_linear_map Derivation.hasCoeToLinearMap
 
-#noalign derivation.to_linear_map_eq_coe -- porting note: not needed anymore
+#noalign derivation.to_linear_map_eq_coe -- Porting note: not needed anymore
 
 @[simp]
 theorem mk_coe (f : A →ₗ[R] M) (h₁ h₂) : ((⟨f, h₁, h₂⟩ : Derivation R A M) : A → M) = f :=
refactor(Data/FunLike): use unbundled inheritance from FunLike (#8386)

The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike is EquivLike, since that has a custom coe_injective' field that is easier to implement. All other classes should take FunLike or EquivLike as a parameter.

Zulip thread

Important changes

Previously, morphism classes would be Type-valued and extend FunLike:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

After this PR, they should be Prop-valued and take FunLike as a parameter:

/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
  [FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))

(Note that A B stay marked as outParam even though they are not purely required to be so due to the FunLike parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam is slightly faster.)

Similarly, MyEquivClass should take EquivLike as a parameter.

As a result, every mention of [MyHomClass F A B] should become [FunLike F A B] [MyHomClass F A B].

Remaining issues

Slower (failing) search

While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul is more expensive. This is due to suboptimal processing of arguments. For example:

variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)

theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y

example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _

Before this PR, applying map_mul f gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Since M and N are out_params, [MulHomClass F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found.

After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]. Now [FunLike F ?M ?N] is synthesized first, supplies values for ?M and ?N and then the Mul M and Mul N instances can be found, before trying MulHomClass F M N which fails. Since the Mul hierarchy is very big, this can be slow to fail, especially when there is no such Mul instance.

A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N] because MulHomClass fails or succeeds much faster than the others.

As a consequence, the simpNF linter is much slower since by design it tries and fails to apply many map_ lemmas. The same issue occurs a few times in existing calls to simp [map_mul], where map_mul is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.

simp not firing sometimes

This affects map_smulₛₗ and related definitions. For simp lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw can find every argument to map_smulₛₗ successfully but simp can't: leanprover/lean4#3701.

Missing instances due to unification failing

Especially in the category theory library, we might sometimes have a type A which is also accessible as a synonym (Bundled A hA).1. Instance synthesis doesn't always work if we have f : A →* B but x * y : (Bundled A hA).1 or vice versa. This seems to be mostly fixed by keeping A B as outParams in MulHomClass F A B. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1 instead of using the syntax in the discrimination tree.)

Workaround for issues

The timeouts can be worked around for now by specifying which map_mul we mean, either as map_mul f for some explicit f, or as e.g. MonoidHomClass.map_mul.

map_smulₛₗ not firing as simp lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ a simp lemma instead of the generic map_smulₛₗ. Writing simp [map_smulₛₗ _] also works.

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -62,17 +62,14 @@ variable [Module A M] [Module B M] [Module R M]
 
 variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 
-instance : AddMonoidHomClass (Derivation R A M) A M where
+instance : FunLike (Derivation R A M) A M where
   coe D := D.toFun
   coe_injective' D1 D2 h := by cases D1; cases D2; congr; exact DFunLike.coe_injective h
+
+instance : AddMonoidHomClass (Derivation R A M) A M where
   map_add D := D.toLinearMap.map_add'
   map_zero D := D.toLinearMap.map_zero
 
-/-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun`
-directly. -/
-instance : CoeFun (Derivation R A M) fun _ => A → M :=
-  ⟨DFunLike.coe⟩
-
 -- Not a simp lemma because it can be proved via `coeFn_coe` + `toLinearMap_eq_coe`
 theorem toFun_eq_coe : D.toFun = ⇑D :=
   rfl
chore(*): rename FunLike to DFunLike (#9785)

This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.

This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:

sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean     
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean

Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -64,14 +64,14 @@ variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 
 instance : AddMonoidHomClass (Derivation R A M) A M where
   coe D := D.toFun
-  coe_injective' D1 D2 h := by cases D1; cases D2; congr; exact FunLike.coe_injective h
+  coe_injective' D1 D2 h := by cases D1; cases D2; congr; exact DFunLike.coe_injective h
   map_add D := D.toLinearMap.map_add'
   map_zero D := D.toLinearMap.map_zero
 
-/-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
+/-- Helper instance for when there's too many metavariables to apply `DFunLike.hasCoeToFun`
 directly. -/
 instance : CoeFun (Derivation R A M) fun _ => A → M :=
-  ⟨FunLike.coe⟩
+  ⟨DFunLike.coe⟩
 
 -- Not a simp lemma because it can be proved via `coeFn_coe` + `toLinearMap_eq_coe`
 theorem toFun_eq_coe : D.toFun = ⇑D :=
@@ -101,17 +101,17 @@ theorem coeFn_coe (f : Derivation R A M) : ⇑(f : A →ₗ[R] M) = f :=
   rfl
 #align derivation.coe_fn_coe Derivation.coeFn_coe
 
-theorem coe_injective : @Function.Injective (Derivation R A M) (A → M) FunLike.coe :=
-  FunLike.coe_injective
+theorem coe_injective : @Function.Injective (Derivation R A M) (A → M) DFunLike.coe :=
+  DFunLike.coe_injective
 #align derivation.coe_injective Derivation.coe_injective
 
 @[ext]
 theorem ext (H : ∀ a, D1 a = D2 a) : D1 = D2 :=
-  FunLike.ext _ _ H
+  DFunLike.ext _ _ H
 #align derivation.ext Derivation.ext
 
 theorem congr_fun (h : D1 = D2) (a : A) : D1 a = D2 a :=
-  FunLike.congr_fun h a
+  DFunLike.congr_fun h a
 #align derivation.congr_fun Derivation.congr_fun
 
 protected theorem map_add : D (a + b) = D a + D b :=
chore(RingTheory/Derivation/Basic): generalize Derivation.compAlgebraMap to semirings (#8151)

Also adds a simps configuration so we get nice lemmas names with @[simps] and shuffles the variable order to put all the types first

Diff
@@ -40,8 +40,9 @@ equality. We also require that `D 1 = 0`. See `Derivation.mk'` for a constructor
 assumption from the Leibniz rule when `M` is cancellative.
 
 TODO: update this when bimodules are defined. -/
-structure Derivation (R : Type*) (A : Type*) [CommSemiring R] [CommSemiring A] [Algebra R A]
-    (M : Type*) [AddCommMonoid M] [Module A M] [Module R M] extends A →ₗ[R] M where
+structure Derivation (R : Type*) (A : Type*) (M : Type*)
+    [CommSemiring R] [CommSemiring A] [AddCommMonoid M] [Algebra R A] [Module A M] [Module R M]
+    extends A →ₗ[R] M where
   protected map_one_eq_zero' : toLinearMap 1 = 0
   protected leibniz' (a b : A) : toLinearMap (a * b) = a • toLinearMap b + b • toLinearMap a
 #align derivation Derivation
@@ -53,11 +54,11 @@ namespace Derivation
 
 section
 
-variable {R : Type*} [CommSemiring R]
+variable {R : Type*} {A : Type*} {B : Type*} {M : Type*}
+variable [CommSemiring R] [CommSemiring A] [CommSemiring B] [AddCommMonoid M]
+variable [Algebra R A] [Algebra R B]
+variable [Module A M] [Module B M] [Module R M]
 
-variable {A : Type*} [CommSemiring A] [Algebra R A]
-
-variable {M : Type*} [AddCommMonoid M] [Module A M] [Module R M]
 
 variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 
@@ -77,6 +78,11 @@ theorem toFun_eq_coe : D.toFun = ⇑D :=
   rfl
 #align derivation.to_fun_eq_coe Derivation.toFun_eq_coe
 
+/-- See Note [custom simps projection] -/
+def Simps.apply (D : Derivation R A M) : A → M := D
+
+initialize_simps_projections Derivation (toFun → apply)
+
 attribute [coe] toLinearMap
 
 instance hasCoeToLinearMap : Coe (Derivation R A M) (A →ₗ[R] M) :=
@@ -325,6 +331,17 @@ def _root_.LinearEquiv.compDer : Derivation R A M ≃ₗ[R] Derivation R A N :=
 
 end PushForward
 
+variable (A) in
+/-- For a tower `R → A → B` and an `R`-derivation `B → M`, we may compose with `A → B` to obtain an
+`R`-derivation `A → M`. -/
+@[simps!]
+def compAlgebraMap [Algebra A B] [IsScalarTower R A B] [IsScalarTower A B M]
+    (d : Derivation R B M) : Derivation R A M where
+  map_one_eq_zero' := by simp
+  leibniz' a b := by simp
+  toLinearMap := d.toLinearMap.comp (IsScalarTower.toAlgHom R A B).toLinearMap
+#align derivation.comp_algebra_map Derivation.compAlgebraMap
+
 section RestrictScalars
 
 variable {S : Type*} [CommSemiring S]
@@ -461,4 +478,5 @@ end
 
 end
 
+
 end Derivation
chore: use _root_.map_sum more consistently (#7189)

Also _root_.map_smul when in the neighbourhood.

Diff
@@ -126,8 +126,9 @@ theorem leibniz : D (a * b) = a • D b + b • D a :=
   D.leibniz' _ _
 #align derivation.leibniz Derivation.leibniz
 
-theorem map_sum {ι : Type*} (s : Finset ι) (f : ι → A) : D (∑ i in s, f i) = ∑ i in s, D (f i) :=
-  D.toLinearMap.map_sum
+nonrec theorem map_sum {ι : Type*} (s : Finset ι) (f : ι → A) :
+    D (∑ i in s, f i) = ∑ i in s, D (f i) :=
+  map_sum D _ _
 #align derivation.map_sum Derivation.map_sum
 
 @[simp]
style: fix wrapping of where (#7149)
Diff
@@ -260,8 +260,9 @@ def coeFnAddMonoidHom : Derivation R A M →+ A → M where
 instance : DistribMulAction S (Derivation R A M) :=
   Function.Injective.distribMulAction coeFnAddMonoidHom coe_injective coe_smul
 
-instance [DistribMulAction Sᵐᵒᵖ M] [IsCentralScalar S M] : IsCentralScalar S (Derivation R A M)
-    where op_smul_eq_smul _ _ := ext fun _ => op_smul_eq_smul _ _
+instance [DistribMulAction Sᵐᵒᵖ M] [IsCentralScalar S M] :
+    IsCentralScalar S (Derivation R A M) where
+  op_smul_eq_smul _ _ := ext fun _ => op_smul_eq_smul _ _
 
 instance [SMul S T] [IsScalarTower S T M] : IsScalarTower S T (Derivation R A M) :=
   ⟨fun _ _ _ => ext fun _ => smul_assoc _ _ _⟩
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -40,8 +40,8 @@ equality. We also require that `D 1 = 0`. See `Derivation.mk'` for a constructor
 assumption from the Leibniz rule when `M` is cancellative.
 
 TODO: update this when bimodules are defined. -/
-structure Derivation (R : Type _) (A : Type _) [CommSemiring R] [CommSemiring A] [Algebra R A]
-    (M : Type _) [AddCommMonoid M] [Module A M] [Module R M] extends A →ₗ[R] M where
+structure Derivation (R : Type*) (A : Type*) [CommSemiring R] [CommSemiring A] [Algebra R A]
+    (M : Type*) [AddCommMonoid M] [Module A M] [Module R M] extends A →ₗ[R] M where
   protected map_one_eq_zero' : toLinearMap 1 = 0
   protected leibniz' (a b : A) : toLinearMap (a * b) = a • toLinearMap b + b • toLinearMap a
 #align derivation Derivation
@@ -53,11 +53,11 @@ namespace Derivation
 
 section
 
-variable {R : Type _} [CommSemiring R]
+variable {R : Type*} [CommSemiring R]
 
-variable {A : Type _} [CommSemiring A] [Algebra R A]
+variable {A : Type*} [CommSemiring A] [Algebra R A]
 
-variable {M : Type _} [AddCommMonoid M] [Module A M] [Module R M]
+variable {M : Type*} [AddCommMonoid M] [Module A M] [Module R M]
 
 variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 
@@ -126,12 +126,12 @@ theorem leibniz : D (a * b) = a • D b + b • D a :=
   D.leibniz' _ _
 #align derivation.leibniz Derivation.leibniz
 
-theorem map_sum {ι : Type _} (s : Finset ι) (f : ι → A) : D (∑ i in s, f i) = ∑ i in s, D (f i) :=
+theorem map_sum {ι : Type*} (s : Finset ι) (f : ι → A) : D (∑ i in s, f i) = ∑ i in s, D (f i) :=
   D.toLinearMap.map_sum
 #align derivation.map_sum Derivation.map_sum
 
 @[simp]
-theorem map_smul_of_tower {S : Type _} [SMul S A] [SMul S M] [LinearMap.CompatibleSMul A M S R]
+theorem map_smul_of_tower {S : Type*} [SMul S A] [SMul S M] [LinearMap.CompatibleSMul A M S R]
     (D : Derivation R A M) (r : S) (a : A) : D (r • a) = r • D a :=
   D.toLinearMap.map_smul_of_tower r a
 #align derivation.map_smul_of_tower Derivation.map_smul_of_tower
@@ -220,7 +220,7 @@ instance : Inhabited (Derivation R A M) :=
 
 section Scalar
 
-variable {S T : Type _}
+variable {S T : Type*}
 
 variable [Monoid S] [DistribMulAction S M] [SMulCommClass R S M] [SMulCommClass S A M]
 
@@ -271,13 +271,13 @@ instance [SMulCommClass S T M] : SMulCommClass S T (Derivation R A M) :=
 
 end Scalar
 
-instance instModule {S : Type _} [Semiring S] [Module S M] [SMulCommClass R S M]
+instance instModule {S : Type*} [Semiring S] [Module S M] [SMulCommClass R S M]
     [SMulCommClass S A M] : Module S (Derivation R A M) :=
   Function.Injective.module S coeFnAddMonoidHom coe_injective coe_smul
 
 section PushForward
 
-variable {N : Type _} [AddCommMonoid N] [Module A N] [Module R N] [IsScalarTower R A M]
+variable {N : Type*} [AddCommMonoid N] [Module A N] [Module R N] [IsScalarTower R A M]
   [IsScalarTower R A N]
 
 variable (f : M →ₗ[A] N) (e : M ≃ₗ[A] N)
@@ -325,7 +325,7 @@ end PushForward
 
 section RestrictScalars
 
-variable {S : Type _} [CommSemiring S]
+variable {S : Type*} [CommSemiring S]
 
 variable [Algebra S A] [Module S M] [LinearMap.CompatibleSMul A M R S]
 
@@ -345,7 +345,7 @@ end
 
 section Cancel
 
-variable {R : Type _} [CommSemiring R] {A : Type _} [CommSemiring A] [Algebra R A] {M : Type _}
+variable {R : Type*} [CommSemiring R] {A : Type*} [CommSemiring A] [Algebra R A] {M : Type*}
   [AddCancelCommMonoid M] [Module R M] [Module A M]
 
 /-- Define `Derivation R A M` from a linear map when `M` is cancellative by verifying the Leibniz
@@ -370,13 +370,13 @@ end Cancel
 
 section
 
-variable {R : Type _} [CommRing R]
+variable {R : Type*} [CommRing R]
 
-variable {A : Type _} [CommRing A] [Algebra R A]
+variable {A : Type*} [CommRing A] [Algebra R A]
 
 section
 
-variable {M : Type _} [AddCommGroup M] [Module A M] [Module R M]
+variable {M : Type*} [AddCommGroup M] [Module A M] [Module R M]
 
 variable (D : Derivation R A M) {D1 D2 : Derivation R A M} (r : R) (a b : A)
 
@@ -407,7 +407,7 @@ theorem leibniz_invOf [Invertible a] : D (⅟ a) = -⅟ a ^ 2 • D a :=
   D.leibniz_of_mul_eq_one <| invOf_mul_self a
 #align derivation.leibniz_inv_of Derivation.leibniz_invOf
 
-theorem leibniz_inv {K : Type _} [Field K] [Module K M] [Algebra R K] (D : Derivation R K M)
+theorem leibniz_inv {K : Type*} [Field K] [Module K M] [Algebra R K] (D : Derivation R K M)
     (a : K) : D a⁻¹ = -a⁻¹ ^ 2 • D a := by
   rcases eq_or_ne a 0 with (rfl | ha)
   · 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,14 +2,11 @@
 Copyright © 2020 Nicolò Cavalleri. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Nicolò Cavalleri, Andrew Yang
-
-! This file was ported from Lean 3 source module ring_theory.derivation.basic
-! leanprover-community/mathlib commit b608348ffaeb7f557f2fd46876037abafd326ff3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.Adjoin.Basic
 
+#align_import ring_theory.derivation.basic from "leanprover-community/mathlib"@"b608348ffaeb7f557f2fd46876037abafd326ff3"
+
 /-!
 # Derivations
 
fix: filenames with typos in doc (#5836)
Diff
@@ -22,10 +22,10 @@ This file defines derivation. A derivation `D` from the `R`-algebra `A` to the `
 - `Derivation.llcomp`: We may compose linear maps and derivations to obtain a derivation,
   and the composition is bilinear.
 
-See `ring_theory.derivation.lie` for
+See `RingTheory.Derivation.Lie` for
 - `derivation.lie_algebra`: The `R`-derivations from `A` to `A` form a lie algebra over `R`.
 
-and `ring_theory.derivation.to_square_zero` for
+and `RingTheory.Derivation.ToSquareZero` for
 - `derivation_to_square_zero_equiv_lift`: The `R`-derivations from `A` into a square-zero ideal `I`
   of `B` corresponds to the lifts `A →ₐ[R] B` of the map `A →ₐ[R] B ⧸ I`.
 
feat: port Geometry.Manifold.Algebra.LeftInvariantDerivation (#5665)

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com> Co-authored-by: Matthew Ballard <matt@mrb.email>

Diff
@@ -229,7 +229,7 @@ variable [Monoid S] [DistribMulAction S M] [SMulCommClass R S M] [SMulCommClass
 
 variable [Monoid T] [DistribMulAction T M] [SMulCommClass R T M] [SMulCommClass T A M]
 
-instance (priority := 100) : SMul S (Derivation R A M) :=
+instance : SMul S (Derivation R A M) :=
   ⟨fun r D =>
     { toLinearMap := r • D.1
       map_one_eq_zero' := by rw [LinearMap.smul_apply, coeFn_coe, D.map_one_eq_zero, smul_zero]
@@ -260,7 +260,7 @@ def coeFnAddMonoidHom : Derivation R A M →+ A → M where
   map_add' := coe_add
 #align derivation.coe_fn_add_monoid_hom Derivation.coeFnAddMonoidHom
 
-instance (priority := 100) : DistribMulAction S (Derivation R A M) :=
+instance : DistribMulAction S (Derivation R A M) :=
   Function.Injective.distribMulAction coeFnAddMonoidHom coe_injective coe_smul
 
 instance [DistribMulAction Sᵐᵒᵖ M] [IsCentralScalar S M] : IsCentralScalar S (Derivation R A M)
@@ -274,7 +274,7 @@ instance [SMulCommClass S T M] : SMulCommClass S T (Derivation R A M) :=
 
 end Scalar
 
-instance (priority := 100) instModule {S : Type _} [Semiring S] [Module S M] [SMulCommClass R S M]
+instance instModule {S : Type _} [Semiring S] [Module S M] [SMulCommClass R S M]
     [SMulCommClass S A M] : Module S (Derivation R A M) :=
   Function.Injective.module S coeFnAddMonoidHom coe_injective coe_smul
 
chore: fix grammar 3/3 (#5003)

Part 3 of #5001

Diff
@@ -23,7 +23,7 @@ This file defines derivation. A derivation `D` from the `R`-algebra `A` to the `
   and the composition is bilinear.
 
 See `ring_theory.derivation.lie` for
-- `derivation.lie_algebra`: The `R`-derivations from `A` to `A` form an lie algebra over `R`.
+- `derivation.lie_algebra`: The `R`-derivations from `A` to `A` form a lie algebra over `R`.
 
 and `ring_theory.derivation.to_square_zero` for
 - `derivation_to_square_zero_equiv_lift`: The `R`-derivations from `A` into a square-zero ideal `I`
chore: fix many typos (#4967)

These are all doc fixes

Diff
@@ -316,7 +316,7 @@ def llcomp : (M →ₗ[A] N) →ₗ[A] Derivation R A M →ₗ[R] Derivation R A
   map_smul' r D := by ext; rfl
 #align derivation.llcomp Derivation.llcomp
 
-/-- Pushing a derivation foward through a linear equivalence is an equivalence. -/
+/-- Pushing a derivation forward through a linear equivalence is an equivalence. -/
 def _root_.LinearEquiv.compDer : Derivation R A M ≃ₗ[R] Derivation R A N :=
   { e.toLinearMap.compDer with
     invFun := e.symm.toLinearMap.compDer
feat: port RingTheory.Derivation.Lie (#4620)
Diff
@@ -274,7 +274,7 @@ instance [SMulCommClass S T M] : SMulCommClass S T (Derivation R A M) :=
 
 end Scalar
 
-instance (priority := 100) {S : Type _} [Semiring S] [Module S M] [SMulCommClass R S M]
+instance (priority := 100) instModule {S : Type _} [Semiring S] [Module S M] [SMulCommClass R S M]
     [SMulCommClass S A M] : Module S (Derivation R A M) :=
   Function.Injective.module S coeFnAddMonoidHom coe_injective coe_smul
 
@@ -403,7 +403,7 @@ theorem leibniz_of_mul_eq_one {a b : A} (h : a * b = 1) : D a = -a ^ 2 • D b :
     D a + a ^ 2 • D b = a • b • D a + a • a • D b := by simp only [smul_smul, h, one_smul, sq]
     _ = a • D (a * b) := by rw [leibniz, smul_add, add_comm]
     _ = 0 := by rw [h, map_one_eq_zero, smul_zero]
-    
+
 #align derivation.leibniz_of_mul_eq_one Derivation.leibniz_of_mul_eq_one
 
 theorem leibniz_invOf [Invertible a] : D (⅟ a) = -⅟ a ^ 2 • D a :=
feat: port RingTheory.Derivation.Basic (#4575)

Dependencies 8 + 456

457 files ported (98.3%)
188662 lines ported (98.4%)
Show graph

The unported dependencies are