algebra.category.fgModule.basicMathlib.Algebra.Category.FGModuleCat.Basic

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -84,7 +84,8 @@ instance (V : FGModuleCat R) : Module.Finite R V.obj :=
 instance : HasForget₂ (FGModuleCat.{u} R) (ModuleCat.{u} R) := by dsimp [FGModuleCat];
   infer_instance
 
-instance : Full (forget₂ (FGModuleCat R) (ModuleCat.{u} R)) where preimage X Y f := f
+instance : CategoryTheory.Functor.Full (forget₂ (FGModuleCat R) (ModuleCat.{u} R))
+    where preimage X Y f := f
 
 variable {R}
 
@@ -147,8 +148,8 @@ def forget₂Monoidal : MonoidalFunctor (FGModuleCat R) (ModuleCat.{u} R) :=
 -/
 
 #print FGModuleCat.forget₂Monoidal_faithful /-
-instance forget₂Monoidal_faithful : Faithful (forget₂Monoidal R).toFunctor := by
-  dsimp [forget₂_monoidal]; infer_instance
+instance forget₂Monoidal_faithful : CategoryTheory.Functor.Faithful (forget₂Monoidal R).toFunctor :=
+  by dsimp [forget₂_monoidal]; infer_instance
 #align fgModule.forget₂_monoidal_faithful FGModuleCat.forget₂Monoidal_faithful
 -/
 
Diff
@@ -7,7 +7,7 @@ import CategoryTheory.Monoidal.Rigid.Basic
 import CategoryTheory.Monoidal.Subcategory
 import LinearAlgebra.Coevaluation
 import LinearAlgebra.FreeModule.Finite.Matrix
-import Algebra.Category.Module.Monoidal.Closed
+import Algebra.Category.ModuleCat.Monoidal.Closed
 
 #align_import algebra.category.fgModule.basic from "leanprover-community/mathlib"@"08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5"
 
Diff
@@ -3,11 +3,11 @@ Copyright (c) 2021 Jakob von Raumer. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob von Raumer
 -/
-import Mathbin.CategoryTheory.Monoidal.Rigid.Basic
-import Mathbin.CategoryTheory.Monoidal.Subcategory
-import Mathbin.LinearAlgebra.Coevaluation
-import Mathbin.LinearAlgebra.FreeModule.Finite.Matrix
-import Mathbin.Algebra.Category.Module.Monoidal.Closed
+import CategoryTheory.Monoidal.Rigid.Basic
+import CategoryTheory.Monoidal.Subcategory
+import LinearAlgebra.Coevaluation
+import LinearAlgebra.FreeModule.Finite.Matrix
+import Algebra.Category.Module.Monoidal.Closed
 
 #align_import algebra.category.fgModule.basic from "leanprover-community/mathlib"@"08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5"
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Jakob von Raumer. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob von Raumer
-
-! This file was ported from Lean 3 source module algebra.category.fgModule.basic
-! leanprover-community/mathlib commit 08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.CategoryTheory.Monoidal.Rigid.Basic
 import Mathbin.CategoryTheory.Monoidal.Subcategory
@@ -14,6 +9,8 @@ import Mathbin.LinearAlgebra.Coevaluation
 import Mathbin.LinearAlgebra.FreeModule.Finite.Matrix
 import Mathbin.Algebra.Category.Module.Monoidal.Closed
 
+#align_import algebra.category.fgModule.basic from "leanprover-community/mathlib"@"08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5"
+
 /-!
 # The category of finitely generated modules over a ring
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob von Raumer
 
 ! This file was ported from Lean 3 source module algebra.category.fgModule.basic
-! leanprover-community/mathlib commit 74403a3b2551b0970855e14ef5e8fd0d6af1bfc2
+! leanprover-community/mathlib commit 08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -17,6 +17,9 @@ import Mathbin.Algebra.Category.Module.Monoidal.Closed
 /-!
 # The category of finitely generated modules over a ring
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This introduces `fgModule R`, the category of finitely generated modules over a ring `R`.
 It is implemented as a full subcategory on a subtype of `Module R`.
 
Diff
@@ -46,58 +46,69 @@ section Ring
 
 variable (R : Type u) [Ring R]
 
+#print FGModuleCat /-
 /-- Define `fgModule` as the subtype of `Module.{u} R` of finitely generated modules. -/
-def FgModule :=
+def FGModuleCat :=
   FullSubcategory fun V : ModuleCat.{u} R => Module.Finite R V
 deriving LargeCategory, ConcreteCategory, Preadditive
-#align fgModule FgModule
+#align fgModule FGModuleCat
+-/
 
 end Ring
 
-namespace FgModule
+namespace FGModuleCat
 
 section Ring
 
 variable (R : Type u) [Ring R]
 
-instance finite (V : FgModule R) : Module.Finite R V.obj :=
+#print FGModuleCat.finite /-
+instance finite (V : FGModuleCat R) : Module.Finite R V.obj :=
   V.property
-#align fgModule.finite FgModule.finite
+#align fgModule.finite FGModuleCat.finite
+-/
 
-instance : Inhabited (FgModule R) :=
+instance : Inhabited (FGModuleCat R) :=
   ⟨⟨ModuleCat.of R R, Module.Finite.self R⟩⟩
 
+#print FGModuleCat.of /-
 /-- Lift an unbundled finitely generated module to `fgModule R`. -/
-def of (V : Type u) [AddCommGroup V] [Module R V] [Module.Finite R V] : FgModule R :=
+def of (V : Type u) [AddCommGroup V] [Module R V] [Module.Finite R V] : FGModuleCat R :=
   ⟨ModuleCat.of R V, by change Module.Finite R V; infer_instance⟩
-#align fgModule.of FgModule.of
+#align fgModule.of FGModuleCat.of
+-/
 
-instance (V : FgModule R) : Module.Finite R V.obj :=
+instance (V : FGModuleCat R) : Module.Finite R V.obj :=
   V.property
 
-instance : HasForget₂ (FgModule.{u} R) (ModuleCat.{u} R) := by dsimp [FgModule]; infer_instance
+instance : HasForget₂ (FGModuleCat.{u} R) (ModuleCat.{u} R) := by dsimp [FGModuleCat];
+  infer_instance
 
-instance : Full (forget₂ (FgModule R) (ModuleCat.{u} R)) where preimage X Y f := f
+instance : Full (forget₂ (FGModuleCat R) (ModuleCat.{u} R)) where preimage X Y f := f
 
 variable {R}
 
+#print FGModuleCat.isoToLinearEquiv /-
 /-- Converts and isomorphism in the category `fgModule R` to a `linear_equiv` between the underlying
 modules. -/
-def isoToLinearEquiv {V W : FgModule R} (i : V ≅ W) : V.obj ≃ₗ[R] W.obj :=
-  ((forget₂ (FgModule.{u} R) (ModuleCat.{u} R)).mapIso i).toLinearEquiv
-#align fgModule.iso_to_linear_equiv FgModule.isoToLinearEquiv
+def isoToLinearEquiv {V W : FGModuleCat R} (i : V ≅ W) : V.obj ≃ₗ[R] W.obj :=
+  ((forget₂ (FGModuleCat.{u} R) (ModuleCat.{u} R)).mapIso i).toLinearEquiv
+#align fgModule.iso_to_linear_equiv FGModuleCat.isoToLinearEquiv
+-/
 
+#print LinearEquiv.toFGModuleCatIso /-
 /-- Converts a `linear_equiv` to an isomorphism in the category `fgModule R`. -/
 @[simps]
-def LinearEquiv.toFgModuleIso {V W : Type u} [AddCommGroup V] [Module R V] [Module.Finite R V]
+def LinearEquiv.toFGModuleCatIso {V W : Type u} [AddCommGroup V] [Module R V] [Module.Finite R V]
     [AddCommGroup W] [Module R W] [Module.Finite R W] (e : V ≃ₗ[R] W) :
-    FgModule.of R V ≅ FgModule.of R W
+    FGModuleCat.of R V ≅ FGModuleCat.of R W
     where
   Hom := e.toLinearMap
   inv := e.symm.toLinearMap
   hom_inv_id' := by ext; exact e.left_inv x
   inv_hom_id' := by ext; exact e.right_inv x
-#align linear_equiv.to_fgModule_iso LinearEquiv.toFgModuleIso
+#align linear_equiv.to_fgModule_iso LinearEquiv.toFGModuleCatIso
+-/
 
 end Ring
 
@@ -105,44 +116,60 @@ section CommRing
 
 variable (R : Type u) [CommRing R]
 
-instance : Linear R (FgModule R) := by dsimp_result => dsimp [FgModule]; infer_instance
+instance : Linear R (FGModuleCat R) := by dsimp_result => dsimp [FGModuleCat]; infer_instance
 
+#print FGModuleCat.monoidalPredicate_module_finite /-
 instance monoidalPredicate_module_finite :
     MonoidalCategory.MonoidalPredicate fun V : ModuleCat.{u} R => Module.Finite R V
     where
   prop_id' := Module.Finite.self R
   prop_tensor' X Y hX hY := Module.Finite.tensorProduct R X Y
-#align fgModule.monoidal_predicate_module_finite FgModule.monoidalPredicate_module_finite
+#align fgModule.monoidal_predicate_module_finite FGModuleCat.monoidalPredicate_module_finite
+-/
 
-instance : MonoidalCategory (FgModule R) := by dsimp_result => dsimp [FgModule]; infer_instance
+instance : MonoidalCategory (FGModuleCat R) := by
+  dsimp_result => dsimp [FGModuleCat]; infer_instance
 
-instance : SymmetricCategory (FgModule R) := by dsimp_result => dsimp [FgModule]; infer_instance
+instance : SymmetricCategory (FGModuleCat R) := by
+  dsimp_result => dsimp [FGModuleCat]; infer_instance
 
-instance : MonoidalPreadditive (FgModule R) := by dsimp_result => dsimp [FgModule]; infer_instance
+instance : MonoidalPreadditive (FGModuleCat R) := by
+  dsimp_result => dsimp [FGModuleCat]; infer_instance
 
-instance : MonoidalLinear R (FgModule R) := by dsimp_result => dsimp [FgModule]; infer_instance
+instance : MonoidalLinear R (FGModuleCat R) := by
+  dsimp_result => dsimp [FGModuleCat]; infer_instance
 
+#print FGModuleCat.forget₂Monoidal /-
 /-- The forgetful functor `fgModule R ⥤ Module R` as a monoidal functor. -/
-def forget₂Monoidal : MonoidalFunctor (FgModule R) (ModuleCat.{u} R) :=
+def forget₂Monoidal : MonoidalFunctor (FGModuleCat R) (ModuleCat.{u} R) :=
   MonoidalCategory.fullMonoidalSubcategoryInclusion _
-#align fgModule.forget₂_monoidal FgModule.forget₂Monoidal
+#align fgModule.forget₂_monoidal FGModuleCat.forget₂Monoidal
+-/
 
+#print FGModuleCat.forget₂Monoidal_faithful /-
 instance forget₂Monoidal_faithful : Faithful (forget₂Monoidal R).toFunctor := by
   dsimp [forget₂_monoidal]; infer_instance
-#align fgModule.forget₂_monoidal_faithful FgModule.forget₂Monoidal_faithful
+#align fgModule.forget₂_monoidal_faithful FGModuleCat.forget₂Monoidal_faithful
+-/
 
+#print FGModuleCat.forget₂Monoidal_additive /-
 instance forget₂Monoidal_additive : (forget₂Monoidal R).toFunctor.Additive := by
   dsimp [forget₂_monoidal]; infer_instance
-#align fgModule.forget₂_monoidal_additive FgModule.forget₂Monoidal_additive
+#align fgModule.forget₂_monoidal_additive FGModuleCat.forget₂Monoidal_additive
+-/
 
+#print FGModuleCat.forget₂Monoidal_linear /-
 instance forget₂Monoidal_linear : (forget₂Monoidal R).toFunctor.Linear R := by
   dsimp [forget₂_monoidal]; infer_instance
-#align fgModule.forget₂_monoidal_linear FgModule.forget₂Monoidal_linear
+#align fgModule.forget₂_monoidal_linear FGModuleCat.forget₂Monoidal_linear
+-/
 
-theorem Iso.conj_eq_conj {V W : FgModule R} (i : V ≅ W) (f : End V) :
+#print FGModuleCat.Iso.conj_eq_conj /-
+theorem Iso.conj_eq_conj {V W : FGModuleCat R} (i : V ≅ W) (f : End V) :
     Iso.conj i f = LinearEquiv.conj (isoToLinearEquiv i) f :=
   rfl
-#align fgModule.iso.conj_eq_conj FgModule.Iso.conj_eq_conj
+#align fgModule.iso.conj_eq_conj FGModuleCat.Iso.conj_eq_conj
+-/
 
 end CommRing
 
@@ -150,84 +177,106 @@ section Field
 
 variable (K : Type u) [Field K]
 
-instance (V W : FgModule K) : Module.Finite K (V ⟶ W) :=
+instance (V W : FGModuleCat K) : Module.Finite K (V ⟶ W) :=
   (by infer_instance : Module.Finite K (V.obj →ₗ[K] W.obj))
 
+#print FGModuleCat.closedPredicateModuleFinite /-
 instance closedPredicateModuleFinite :
     MonoidalCategory.ClosedPredicate fun V : ModuleCat.{u} K => Module.Finite K V
     where prop_ihom' X Y hX hY := @Module.Finite.linearMap K X Y _ _ _ _ _ _ _ hX hY
-#align fgModule.closed_predicate_module_finite FgModule.closedPredicateModuleFinite
+#align fgModule.closed_predicate_module_finite FGModuleCat.closedPredicateModuleFinite
+-/
 
-instance : MonoidalClosed (FgModule K) := by dsimp_result => dsimp [FgModule]; infer_instance
+instance : MonoidalClosed (FGModuleCat K) := by dsimp_result => dsimp [FGModuleCat]; infer_instance
 
-variable (V W : FgModule K)
+variable (V W : FGModuleCat K)
 
+#print FGModuleCat.ihom_obj /-
 @[simp]
-theorem ihom_obj : (ihom V).obj W = FgModule.of K (V.obj →ₗ[K] W.obj) :=
+theorem ihom_obj : (ihom V).obj W = FGModuleCat.of K (V.obj →ₗ[K] W.obj) :=
   rfl
-#align fgModule.ihom_obj FgModule.ihom_obj
+#align fgModule.ihom_obj FGModuleCat.ihom_obj
+-/
 
+#print FGModuleCat.FGModuleCatDual /-
 /-- The dual module is the dual in the rigid monoidal category `fgModule K`. -/
-def fgModuleDual : FgModule K :=
-  ⟨ModuleCat.of K (Module.Dual K V.obj), Subspace.Module.Dual.finiteDimensional⟩
-#align fgModule.fgModule_dual FgModule.fgModuleDual
+def FGModuleCatDual : FGModuleCat K :=
+  ⟨ModuleCat.of K (Module.Dual K V.obj), Subspace.instModuleDualFiniteDimensional⟩
+#align fgModule.fgModule_dual FGModuleCat.FGModuleCatDual
+-/
 
 open CategoryTheory.MonoidalCategory
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print FGModuleCat.FGModuleCatCoevaluation /-
 /-- The coevaluation map is defined in `linear_algebra.coevaluation`. -/
-def fgModuleCoevaluation : 𝟙_ (FgModule K) ⟶ V ⊗ fgModuleDual K V := by apply coevaluation K V.obj
-#align fgModule.fgModule_coevaluation FgModule.fgModuleCoevaluation
+def FGModuleCatCoevaluation : 𝟙_ (FGModuleCat K) ⟶ V ⊗ FGModuleCatDual K V := by
+  apply coevaluation K V.obj
+#align fgModule.fgModule_coevaluation FGModuleCat.FGModuleCatCoevaluation
+-/
 
-theorem fgModuleCoevaluation_apply_one :
-    fgModuleCoevaluation K V (1 : K) =
+#print FGModuleCat.FGModuleCatCoevaluation_apply_one /-
+theorem FGModuleCatCoevaluation_apply_one :
+    FGModuleCatCoevaluation K V (1 : K) =
       ∑ i : Basis.ofVectorSpaceIndex K V.obj,
         (Basis.ofVectorSpace K V.obj) i ⊗ₜ[K] (Basis.ofVectorSpace K V.obj).Coord i :=
   by apply coevaluation_apply_one K V.obj
-#align fgModule.fgModule_coevaluation_apply_one FgModule.fgModuleCoevaluation_apply_one
+#align fgModule.fgModule_coevaluation_apply_one FGModuleCat.FGModuleCatCoevaluation_apply_one
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print FGModuleCat.FGModuleCatEvaluation /-
 /-- The evaluation morphism is given by the contraction map. -/
-def fgModuleEvaluation : fgModuleDual K V ⊗ V ⟶ 𝟙_ (FgModule K) := by apply contractLeft K V.obj
-#align fgModule.fgModule_evaluation FgModule.fgModuleEvaluation
+def FGModuleCatEvaluation : FGModuleCatDual K V ⊗ V ⟶ 𝟙_ (FGModuleCat K) := by
+  apply contractLeft K V.obj
+#align fgModule.fgModule_evaluation FGModuleCat.FGModuleCatEvaluation
+-/
 
+#print FGModuleCat.FGModuleCatEvaluation_apply /-
 @[simp]
-theorem fgModuleEvaluation_apply (f : (fgModuleDual K V).obj) (x : V.obj) :
-    (fgModuleEvaluation K V) (f ⊗ₜ x) = f.toFun x := by apply contractLeft_apply f x
-#align fgModule.fgModule_evaluation_apply FgModule.fgModuleEvaluation_apply
+theorem FGModuleCatEvaluation_apply (f : (FGModuleCatDual K V).obj) (x : V.obj) :
+    (FGModuleCatEvaluation K V) (f ⊗ₜ x) = f.toFun x := by apply contractLeft_apply f x
+#align fgModule.fgModule_evaluation_apply FGModuleCat.FGModuleCatEvaluation_apply
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 private theorem coevaluation_evaluation :
-    let V' : FgModule K := fgModuleDual K V
-    (𝟙 V' ⊗ fgModuleCoevaluation K V) ≫ (α_ V' V V').inv ≫ (fgModuleEvaluation K V ⊗ 𝟙 V') =
+    let V' : FGModuleCat K := FGModuleCatDual K V
+    (𝟙 V' ⊗ FGModuleCatCoevaluation K V) ≫ (α_ V' V V').inv ≫ (FGModuleCatEvaluation K V ⊗ 𝟙 V') =
       (ρ_ V').Hom ≫ (λ_ V').inv :=
   by apply contractLeft_assoc_coevaluation K V.obj
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 private theorem evaluation_coevaluation :
-    (fgModuleCoevaluation K V ⊗ 𝟙 V) ≫
-        (α_ V (fgModuleDual K V) V).Hom ≫ (𝟙 V ⊗ fgModuleEvaluation K V) =
+    (FGModuleCatCoevaluation K V ⊗ 𝟙 V) ≫
+        (α_ V (FGModuleCatDual K V) V).Hom ≫ (𝟙 V ⊗ FGModuleCatEvaluation K V) =
       (λ_ V).Hom ≫ (ρ_ V).inv :=
   by apply contractLeft_assoc_coevaluation' K V.obj
 
-instance exactPairing : ExactPairing V (fgModuleDual K V)
+#print FGModuleCat.exactPairing /-
+instance exactPairing : ExactPairing V (FGModuleCatDual K V)
     where
-  coevaluation := fgModuleCoevaluation K V
-  evaluation := fgModuleEvaluation K V
+  coevaluation := FGModuleCatCoevaluation K V
+  evaluation := FGModuleCatEvaluation K V
   coevaluation_evaluation' := coevaluation_evaluation K V
   evaluation_coevaluation' := evaluation_coevaluation K V
-#align fgModule.exact_pairing FgModule.exactPairing
+#align fgModule.exact_pairing FGModuleCat.exactPairing
+-/
 
+#print FGModuleCat.rightDual /-
 instance rightDual : HasRightDual V :=
-  ⟨fgModuleDual K V⟩
-#align fgModule.right_dual FgModule.rightDual
+  ⟨FGModuleCatDual K V⟩
+#align fgModule.right_dual FGModuleCat.rightDual
+-/
 
-instance rightRigidCategory : RightRigidCategory (FgModule K) where
-#align fgModule.right_rigid_category FgModule.rightRigidCategory
+#print FGModuleCat.rightRigidCategory /-
+instance rightRigidCategory : RightRigidCategory (FGModuleCat K) where
+#align fgModule.right_rigid_category FGModuleCat.rightRigidCategory
+-/
 
 end Field
 
-end FgModule
+end FGModuleCat
 
Diff
@@ -153,10 +153,10 @@ variable (K : Type u) [Field K]
 instance (V W : FgModule K) : Module.Finite K (V ⟶ W) :=
   (by infer_instance : Module.Finite K (V.obj →ₗ[K] W.obj))
 
-instance closedPredicate_module_finite :
+instance closedPredicateModuleFinite :
     MonoidalCategory.ClosedPredicate fun V : ModuleCat.{u} K => Module.Finite K V
     where prop_ihom' X Y hX hY := @Module.Finite.linearMap K X Y _ _ _ _ _ _ _ hX hY
-#align fgModule.closed_predicate_module_finite FgModule.closedPredicate_module_finite
+#align fgModule.closed_predicate_module_finite FgModule.closedPredicateModuleFinite
 
 instance : MonoidalClosed (FgModule K) := by dsimp_result => dsimp [FgModule]; infer_instance
 
Diff
@@ -48,8 +48,8 @@ variable (R : Type u) [Ring R]
 
 /-- Define `fgModule` as the subtype of `Module.{u} R` of finitely generated modules. -/
 def FgModule :=
-  FullSubcategory fun V : ModuleCat.{u} R => Module.Finite R V deriving LargeCategory,
-  ConcreteCategory, Preadditive
+  FullSubcategory fun V : ModuleCat.{u} R => Module.Finite R V
+deriving LargeCategory, ConcreteCategory, Preadditive
 #align fgModule FgModule
 
 end Ring
Diff
@@ -38,7 +38,7 @@ noncomputable section
 
 open CategoryTheory ModuleCat.monoidalCategory
 
-open Classical BigOperators
+open scoped Classical BigOperators
 
 universe u
 
Diff
@@ -69,18 +69,13 @@ instance : Inhabited (FgModule R) :=
 
 /-- Lift an unbundled finitely generated module to `fgModule R`. -/
 def of (V : Type u) [AddCommGroup V] [Module R V] [Module.Finite R V] : FgModule R :=
-  ⟨ModuleCat.of R V, by
-    change Module.Finite R V
-    infer_instance⟩
+  ⟨ModuleCat.of R V, by change Module.Finite R V; infer_instance⟩
 #align fgModule.of FgModule.of
 
 instance (V : FgModule R) : Module.Finite R V.obj :=
   V.property
 
-instance : HasForget₂ (FgModule.{u} R) (ModuleCat.{u} R) :=
-  by
-  dsimp [FgModule]
-  infer_instance
+instance : HasForget₂ (FgModule.{u} R) (ModuleCat.{u} R) := by dsimp [FgModule]; infer_instance
 
 instance : Full (forget₂ (FgModule R) (ModuleCat.{u} R)) where preimage X Y f := f
 
@@ -100,12 +95,8 @@ def LinearEquiv.toFgModuleIso {V W : Type u} [AddCommGroup V] [Module R V] [Modu
     where
   Hom := e.toLinearMap
   inv := e.symm.toLinearMap
-  hom_inv_id' := by
-    ext
-    exact e.left_inv x
-  inv_hom_id' := by
-    ext
-    exact e.right_inv x
+  hom_inv_id' := by ext; exact e.left_inv x
+  inv_hom_id' := by ext; exact e.right_inv x
 #align linear_equiv.to_fgModule_iso LinearEquiv.toFgModuleIso
 
 end Ring
@@ -136,22 +127,16 @@ def forget₂Monoidal : MonoidalFunctor (FgModule R) (ModuleCat.{u} R) :=
   MonoidalCategory.fullMonoidalSubcategoryInclusion _
 #align fgModule.forget₂_monoidal FgModule.forget₂Monoidal
 
-instance forget₂Monoidal_faithful : Faithful (forget₂Monoidal R).toFunctor :=
-  by
-  dsimp [forget₂_monoidal]
-  infer_instance
+instance forget₂Monoidal_faithful : Faithful (forget₂Monoidal R).toFunctor := by
+  dsimp [forget₂_monoidal]; infer_instance
 #align fgModule.forget₂_monoidal_faithful FgModule.forget₂Monoidal_faithful
 
-instance forget₂Monoidal_additive : (forget₂Monoidal R).toFunctor.Additive :=
-  by
-  dsimp [forget₂_monoidal]
-  infer_instance
+instance forget₂Monoidal_additive : (forget₂Monoidal R).toFunctor.Additive := by
+  dsimp [forget₂_monoidal]; infer_instance
 #align fgModule.forget₂_monoidal_additive FgModule.forget₂Monoidal_additive
 
-instance forget₂Monoidal_linear : (forget₂Monoidal R).toFunctor.Linear R :=
-  by
-  dsimp [forget₂_monoidal]
-  infer_instance
+instance forget₂Monoidal_linear : (forget₂Monoidal R).toFunctor.Linear R := by
+  dsimp [forget₂_monoidal]; infer_instance
 #align fgModule.forget₂_monoidal_linear FgModule.forget₂Monoidal_linear
 
 theorem Iso.conj_eq_conj {V W : FgModule R} (i : V ≅ W) (f : End V) :
Diff
@@ -218,7 +218,6 @@ private theorem coevaluation_evaluation :
     (𝟙 V' ⊗ fgModuleCoevaluation K V) ≫ (α_ V' V V').inv ≫ (fgModuleEvaluation K V ⊗ 𝟙 V') =
       (ρ_ V').Hom ≫ (λ_ V').inv :=
   by apply contractLeft_assoc_coevaluation K V.obj
-#align fgModule.coevaluation_evaluation fgModule.coevaluation_evaluation
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@@ -227,7 +226,6 @@ private theorem evaluation_coevaluation :
         (α_ V (fgModuleDual K V) V).Hom ≫ (𝟙 V ⊗ fgModuleEvaluation K V) =
       (λ_ V).Hom ≫ (ρ_ V).inv :=
   by apply contractLeft_assoc_coevaluation' K V.obj
-#align fgModule.evaluation_coevaluation fgModule.evaluation_coevaluation
 
 instance exactPairing : ExactPairing V (fgModuleDual K V)
     where
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob von Raumer
 
 ! This file was ported from Lean 3 source module algebra.category.fgModule.basic
-! leanprover-community/mathlib commit b1c23399f01266afe392a0d8f71f599a0dad4f7b
+! leanprover-community/mathlib commit 74403a3b2551b0970855e14ef5e8fd0d6af1bfc2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -12,7 +12,7 @@ import Mathbin.CategoryTheory.Monoidal.Rigid.Basic
 import Mathbin.CategoryTheory.Monoidal.Subcategory
 import Mathbin.LinearAlgebra.Coevaluation
 import Mathbin.LinearAlgebra.FreeModule.Finite.Matrix
-import Mathbin.Algebra.Category.Module.Monoidal
+import Mathbin.Algebra.Category.Module.Monoidal.Closed
 
 /-!
 # The category of finitely generated modules over a ring
Diff
@@ -4,13 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob von Raumer
 
 ! This file was ported from Lean 3 source module algebra.category.fgModule.basic
-! leanprover-community/mathlib commit 19a70dceb9dff0994b92d2dd049de7d84d28112b
+! leanprover-community/mathlib commit b1c23399f01266afe392a0d8f71f599a0dad4f7b
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.CategoryTheory.Monoidal.Rigid.Basic
 import Mathbin.CategoryTheory.Monoidal.Subcategory
 import Mathbin.LinearAlgebra.Coevaluation
+import Mathbin.LinearAlgebra.FreeModule.Finite.Matrix
 import Mathbin.Algebra.Category.Module.Monoidal
 
 /-!
@@ -169,7 +170,7 @@ instance (V W : FgModule K) : Module.Finite K (V ⟶ W) :=
 
 instance closedPredicate_module_finite :
     MonoidalCategory.ClosedPredicate fun V : ModuleCat.{u} K => Module.Finite K V
-    where prop_ihom' X Y hX hY := @LinearMap.finiteDimensional K _ X _ _ hX Y _ _ hY
+    where prop_ihom' X Y hX hY := @Module.Finite.linearMap K X Y _ _ _ _ _ _ _ hX hY
 #align fgModule.closed_predicate_module_finite FgModule.closedPredicate_module_finite
 
 instance : MonoidalClosed (FgModule K) := by dsimp_result => dsimp [FgModule]; infer_instance
Diff
@@ -147,11 +147,11 @@ instance forget₂Monoidal_additive : (forget₂Monoidal R).toFunctor.Additive :
   infer_instance
 #align fgModule.forget₂_monoidal_additive FgModule.forget₂Monoidal_additive
 
-instance forget₂MonoidalLinear : (forget₂Monoidal R).toFunctor.Linear R :=
+instance forget₂Monoidal_linear : (forget₂Monoidal R).toFunctor.Linear R :=
   by
   dsimp [forget₂_monoidal]
   infer_instance
-#align fgModule.forget₂_monoidal_linear FgModule.forget₂MonoidalLinear
+#align fgModule.forget₂_monoidal_linear FgModule.forget₂Monoidal_linear
 
 theorem Iso.conj_eq_conj {V W : FgModule R} (i : V ≅ W) (f : End V) :
     Iso.conj i f = LinearEquiv.conj (isoToLinearEquiv i) f :=

Changes in mathlib4

mathlib3
mathlib4
chore(CategoryTheory): make Functor.Full a Prop (#12449)

Before this PR, Functor.Full contained the data of the preimage of maps by a full functor F. This PR makes Functor.Full a proposition. This is to prevent any diamond to appear.

The lemma Functor.image_preimage is also renamed Functor.map_preimage.

Co-authored-by: Joël Riou <37772949+joelriou@users.noreply.github.com>

Diff
@@ -119,7 +119,7 @@ instance : HasForget₂ (FGModuleCat.{u} R) (ModuleCat.{u} R) := by
   infer_instance
 
 instance : (forget₂ (FGModuleCat R) (ModuleCat.{u} R)).Full where
-  preimage f := f
+  map_surjective f := ⟨f, rfl⟩
 
 variable {R}
 
chore(CategoryTheory): move Full, Faithful, EssSurj, IsEquivalence and ReflectsIsomorphisms to the Functor namespace (#11985)

These notions on functors are now Functor.Full, Functor.Faithful, Functor.EssSurj, Functor.IsEquivalence, Functor.ReflectsIsomorphisms. Deprecated aliases are introduced for the previous names.

Diff
@@ -118,7 +118,7 @@ instance : HasForget₂ (FGModuleCat.{u} R) (ModuleCat.{u} R) := by
   dsimp [FGModuleCat]
   infer_instance
 
-instance : Full (forget₂ (FGModuleCat R) (ModuleCat.{u} R)) where
+instance : (forget₂ (FGModuleCat R) (ModuleCat.{u} R)).Full where
   preimage f := f
 
 variable {R}
@@ -183,19 +183,19 @@ def forget₂Monoidal : MonoidalFunctor (FGModuleCat R) (ModuleCat.{u} R) :=
   MonoidalCategory.fullMonoidalSubcategoryInclusion _
 #align fgModule.forget₂_monoidal FGModuleCat.forget₂Monoidal
 
-instance forget₂Monoidal_faithful : Faithful (forget₂Monoidal R).toFunctor := by
+instance forget₂Monoidal_faithful : (forget₂Monoidal R).Faithful := by
   dsimp [forget₂Monoidal]
   -- Porting note (#11187): was `infer_instance`
   exact FullSubcategory.faithful _
 #align fgModule.forget₂_monoidal_faithful FGModuleCat.forget₂Monoidal_faithful
 
-instance forget₂Monoidal_additive : (forget₂Monoidal R).toFunctor.Additive := by
+instance forget₂Monoidal_additive : (forget₂Monoidal R).Additive := by
   dsimp [forget₂Monoidal]
   -- Porting note (#11187): was `infer_instance`
   exact Functor.fullSubcategoryInclusion_additive _
 #align fgModule.forget₂_monoidal_additive FGModuleCat.forget₂Monoidal_additive
 
-instance forget₂Monoidal_linear : (forget₂Monoidal R).toFunctor.Linear R := by
+instance forget₂Monoidal_linear : (forget₂Monoidal R).Linear R := by
   dsimp [forget₂Monoidal]
   -- Porting note (#11187): was `infer_instance`
   exact Functor.fullSubcategoryInclusionLinear _ _
chore(CategoryTheory/Monoidal): replace 𝟙 X ⊗ f with X ◁ f (#11223)

Extracted from #6307

Diff
@@ -269,13 +269,13 @@ theorem FGModuleCatEvaluation_apply (f : FGModuleCatDual K V) (x : V) :
 
 private theorem coevaluation_evaluation :
     letI V' : FGModuleCat K := FGModuleCatDual K V
-    (𝟙 V' ⊗ FGModuleCatCoevaluation K V) ≫ (α_ V' V V').inv ≫ (FGModuleCatEvaluation K V ⊗ 𝟙 V') =
+    V' ◁ FGModuleCatCoevaluation K V ≫ (α_ V' V V').inv ≫ FGModuleCatEvaluation K V ▷ V' =
       (ρ_ V').hom ≫ (λ_ V').inv := by
   apply contractLeft_assoc_coevaluation K V
 
 private theorem evaluation_coevaluation :
-    (FGModuleCatCoevaluation K V ⊗ 𝟙 V) ≫
-        (α_ V (FGModuleCatDual K V) V).hom ≫ (𝟙 V ⊗ FGModuleCatEvaluation K V) =
+    FGModuleCatCoevaluation K V ▷ V ≫
+        (α_ V (FGModuleCatDual K V) V).hom ≫ V ◁ FGModuleCatEvaluation K V =
       (λ_ V).hom ≫ (ρ_ V).inv := by
   apply contractLeft_assoc_coevaluation' K V
 
chore: classify was infer_instance porting notes (#11188)

Classifying by adding issue number #11187 to porting notes claiming:

was infer_instance

Diff
@@ -185,19 +185,19 @@ def forget₂Monoidal : MonoidalFunctor (FGModuleCat R) (ModuleCat.{u} R) :=
 
 instance forget₂Monoidal_faithful : Faithful (forget₂Monoidal R).toFunctor := by
   dsimp [forget₂Monoidal]
-  -- Porting note: was `infer_instance`
+  -- Porting note (#11187): was `infer_instance`
   exact FullSubcategory.faithful _
 #align fgModule.forget₂_monoidal_faithful FGModuleCat.forget₂Monoidal_faithful
 
 instance forget₂Monoidal_additive : (forget₂Monoidal R).toFunctor.Additive := by
   dsimp [forget₂Monoidal]
-  -- Porting note: was `infer_instance`
+  -- Porting note (#11187): was `infer_instance`
   exact Functor.fullSubcategoryInclusion_additive _
 #align fgModule.forget₂_monoidal_additive FGModuleCat.forget₂Monoidal_additive
 
 instance forget₂Monoidal_linear : (forget₂Monoidal R).toFunctor.Linear R := by
   dsimp [forget₂Monoidal]
-  -- Porting note: was `infer_instance`
+  -- Porting note (#11187): was `infer_instance`
   exact Functor.fullSubcategoryInclusionLinear _ _
 #align fgModule.forget₂_monoidal_linear FGModuleCat.forget₂Monoidal_linear
 
@@ -222,7 +222,7 @@ instance closedPredicateModuleFinite :
 
 instance : MonoidalClosed (FGModuleCat K) := by
   dsimp [FGModuleCat]
-  -- Porting note: was `infer_instance`
+  -- Porting note (#11187): was `infer_instance`
   exact MonoidalCategory.fullMonoidalClosedSubcategory
     (fun V : ModuleCat.{u} K => Module.Finite K V)
 
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
@@ -77,6 +77,9 @@ instance : LargeCategory (FGModuleCat R) := by
   dsimp [FGModuleCat]
   infer_instance
 
+instance {M N : FGModuleCat R} : FunLike (M ⟶ N) M N :=
+  LinearMap.instFunLike
+
 instance {M N : FGModuleCat R} : LinearMapClass (M ⟶ N) R M N :=
   LinearMap.semilinearMapClass
 
feat(LinearAlgebra): generalize results about Module.rank of LinearMap. (#9677)

LinearAlgebra/LinearIndependent: generalize linearIndependent_algHom_toLinearMap(') to allow different domain and codomain of the AlgHom.

LinearAlgebra/Basic: add LinearEquiv.congrLeft that works for two rings with commuting actions on the codomain.

LinearAlgebra/FreeModule/Finite/Matrix: generalize Module.Free.linearMap, Module.Finite.linearMap, and FiniteDimensional.finrank_linearMap to work with two different rings that may be noncommutative. Add FiniteDimensional.rank_linearMap, FiniteDimensional.(fin)rank_linearMap_self, and card/cardinal_mk_algHom_le_rank.

FieldTheory/Tower: remove the instance LinearMap.finite_dimensional'' which becomes redundant; mark finrank_linear_map' as deprecated (superseded by finrank_linearMap_self.

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>

Diff
@@ -213,8 +213,8 @@ instance (V W : FGModuleCat K) : Module.Finite K (V ⟶ W) :=
   (by infer_instance : Module.Finite K (V →ₗ[K] W))
 
 instance closedPredicateModuleFinite :
-    MonoidalCategory.ClosedPredicate fun V : ModuleCat.{u} K => Module.Finite K V where
-  prop_ihom := @fun X Y hX hY => @Module.Finite.linearMap K X Y _ _ _ _ _ _ _ hX hY
+    MonoidalCategory.ClosedPredicate fun V : ModuleCat.{u} K ↦ Module.Finite K V where
+  prop_ihom {X Y} _ _ := Module.Finite.linearMap K K X Y
 #align fgModule.closed_predicate_module_finite FGModuleCat.closedPredicateModuleFinite
 
 instance : MonoidalClosed (FGModuleCat K) := by
chore: removing unneeded maxHeartbeats (#7761)

Due to recent changes in core we can reduce or remove many set_option maxHeartbeats statements.

I have tried to be careful to not leave anything too close to the line, so don't be surprised if some of these can still be reduced further.

This reduces us from 96 maxHeartbeats statements to 44. (There are 10 false positives in meta or testing code.)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -264,17 +264,12 @@ theorem FGModuleCatEvaluation_apply (f : FGModuleCatDual K V) (x : V) :
   contractLeft_apply f x
 #align fgModule.fgModule_evaluation_apply FGModuleCat.FGModuleCatEvaluation_apply
 
--- Porting note: extremely slow, was fast in mathlib3.
--- I tried many things using `dsimp` and `change`, but couldn't find anything faster than this.
-set_option maxHeartbeats 1500000 in
 private theorem coevaluation_evaluation :
     letI V' : FGModuleCat K := FGModuleCatDual K V
     (𝟙 V' ⊗ FGModuleCatCoevaluation K V) ≫ (α_ V' V V').inv ≫ (FGModuleCatEvaluation K V ⊗ 𝟙 V') =
       (ρ_ V').hom ≫ (λ_ V').inv := by
   apply contractLeft_assoc_coevaluation K V
 
--- Porting note: extremely slow, was fast in mathlib3.
-set_option maxHeartbeats 400000 in
 private theorem evaluation_coevaluation :
     (FGModuleCatCoevaluation K V ⊗ 𝟙 V) ≫
         (α_ V (FGModuleCatDual K V) V).hom ≫ (𝟙 V ⊗ FGModuleCatEvaluation K V) =
feat(CategoryTheory/Monoidal/Transport): generalize to a faithful functor (#7237)

I needed this to transfer the monoidal structure from ModuleCat to QuadraticModuleCat, but would also work for transferring the same structure from ModuleCat to AlgebraCat.

The changes are:

  • A new CategoryTheory.Monoidal.induced definition, proven from scratch with slightly uglier proofs than what transport used. The new proofs use simp rather more than targeted slice commands, mainly due to lack of patience on my part.
  • CategoryTheory.Monoidal.transport now has a trivial implementation in terms of induced, as does CategoryTheory.MonoidalCategory.fullMonoidalSubcategory (though this was already fairly trivial)
  • CategoryTheory.Monoidal.laxToTransported has been removed, as it's just a less useful version of CategoryTheory.Monoidal.toTransported
  • CategoryTheory.Monoidal.toTransported has been golfed to oblivion, as it now falls out trivially by showing fromTransported first.
Diff
@@ -220,7 +220,8 @@ instance closedPredicateModuleFinite :
 instance : MonoidalClosed (FGModuleCat K) := by
   dsimp [FGModuleCat]
   -- Porting note: was `infer_instance`
-  exact MonoidalCategory.fullMonoidalClosedSubcategory _
+  exact MonoidalCategory.fullMonoidalClosedSubcategory
+    (fun V : ModuleCat.{u} K => Module.Finite K V)
 
 variable (V W : FGModuleCat K)
 
chore: update/remove heart beat bumps (#6860)

We clean up heart beat bumps after #6474.

Diff
@@ -265,7 +265,7 @@ theorem FGModuleCatEvaluation_apply (f : FGModuleCatDual K V) (x : V) :
 
 -- Porting note: extremely slow, was fast in mathlib3.
 -- I tried many things using `dsimp` and `change`, but couldn't find anything faster than this.
-set_option maxHeartbeats 1600000 in
+set_option maxHeartbeats 1500000 in
 private theorem coevaluation_evaluation :
     letI V' : FGModuleCat K := FGModuleCatDual K V
     (𝟙 V' ⊗ FGModuleCatCoevaluation K V) ≫ (α_ V' V V').inv ≫ (FGModuleCatEvaluation K V ⊗ 𝟙 V') =
@@ -273,7 +273,7 @@ private theorem coevaluation_evaluation :
   apply contractLeft_assoc_coevaluation K V
 
 -- Porting note: extremely slow, was fast in mathlib3.
-set_option maxHeartbeats 1600000 in
+set_option maxHeartbeats 400000 in
 private theorem evaluation_coevaluation :
     (FGModuleCatCoevaluation K V ⊗ 𝟙 V) ≫
         (α_ V (FGModuleCatDual K V) V).hom ≫ (𝟙 V ⊗ FGModuleCatEvaluation K V) =
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,11 +2,6 @@
 Copyright (c) 2021 Jakob von Raumer. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jakob von Raumer
-
-! This file was ported from Lean 3 source module algebra.category.fgModule.basic
-! leanprover-community/mathlib commit 74403a3b2551b0970855e14ef5e8fd0d6af1bfc2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.CategoryTheory.Monoidal.Rigid.Basic
 import Mathlib.CategoryTheory.Monoidal.Subcategory
@@ -14,6 +9,8 @@ import Mathlib.LinearAlgebra.Coevaluation
 import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
 import Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed
 
+#align_import algebra.category.fgModule.basic from "leanprover-community/mathlib"@"74403a3b2551b0970855e14ef5e8fd0d6af1bfc2"
+
 /-!
 # The category of finitely generated modules over a ring
 
chore: tidy various files (#5628)
Diff
@@ -124,12 +124,12 @@ instance : Full (forget₂ (FGModuleCat R) (ModuleCat.{u} R)) where
 variable {R}
 
 /-- Converts and isomorphism in the category `FGModuleCat R` to
-a `linear_equiv` between the underlying modules. -/
+a `LinearEquiv` between the underlying modules. -/
 def isoToLinearEquiv {V W : FGModuleCat R} (i : V ≅ W) : V ≃ₗ[R] W :=
   ((forget₂ (FGModuleCat.{u} R) (ModuleCat.{u} R)).mapIso i).toLinearEquiv
 #align fgModule.iso_to_linear_equiv FGModuleCat.isoToLinearEquiv
 
-/-- Converts a `linear_equiv` to an isomorphism in the category `FGModuleCat R`. -/
+/-- Converts a `LinearEquiv` to an isomorphism in the category `FGModuleCat R`. -/
 @[simps]
 def _root_.LinearEquiv.toFGModuleCatIso
     {V W : Type u} [AddCommGroup V] [Module R V] [Module.Finite R V]
feat: port Algebra.Category.FGModule.basic (#4878)

Sets new records for set_option maxHeartbeats. :-( I spent too long struggling with this one; if anyone would like to take another look please do.

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Dependencies 11 + 656

657 files ported (98.4%)
259457 lines ported (98.7%)
Show graph

The unported dependencies are