category_theory.preadditive.MatMathlib.CategoryTheory.Preadditive.Mat

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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
@@ -313,10 +313,10 @@ def embedding : C ⥤ Mat_ C where
 
 namespace Embedding
 
-instance : Faithful (embedding C)
+instance : CategoryTheory.Functor.Faithful (embedding C)
     where map_injective' X Y f g h := congr_fun (congr_fun h PUnit.unit) PUnit.unit
 
-instance : Full (embedding C) where Preimage X Y f := f PUnit.unit PUnit.unit
+instance : CategoryTheory.Functor.Full (embedding C) where Preimage X Y f := f PUnit.unit PUnit.unit
 
 instance : Functor.Additive (embedding C) where
 
@@ -629,15 +629,16 @@ def equivalenceSingleObjInverse : Mat_ (SingleObj Rᵐᵒᵖ) ⥤ Mat R
 #align category_theory.Mat.equivalence_single_obj_inverse CategoryTheory.Mat.equivalenceSingleObjInverse
 -/
 
-instance : Faithful (equivalenceSingleObjInverse R)
+instance : CategoryTheory.Functor.Faithful (equivalenceSingleObjInverse R)
     where map_injective' X Y f g w := by
     ext i j
     apply_fun MulOpposite.unop using MulOpposite.unop_injective
     exact congr_fun (congr_fun w i) j
 
-instance : Full (equivalenceSingleObjInverse R) where Preimage X Y f i j := MulOpposite.op (f i j)
+instance : CategoryTheory.Functor.Full (equivalenceSingleObjInverse R)
+    where Preimage X Y f i j := MulOpposite.op (f i j)
 
-instance : EssSurj (equivalenceSingleObjInverse R)
+instance : CategoryTheory.Functor.EssSurj (equivalenceSingleObjInverse R)
     where mem_essImage X :=
     ⟨{  ι := X
         pt := fun _ => PUnit.unit }, ⟨eqToIso (by dsimp; cases X; congr)⟩⟩
Diff
@@ -8,9 +8,9 @@ import Algebra.BigOperators.Pi
 import CategoryTheory.Limits.Shapes.Biproducts
 import CategoryTheory.Preadditive.Basic
 import CategoryTheory.Preadditive.AdditiveFunctor
-import Data.Matrix.Dmatrix
+import Data.Matrix.DMatrix
 import Data.Matrix.Basic
-import CategoryTheory.Fintype
+import CategoryTheory.FintypeCat
 import CategoryTheory.Preadditive.SingleObj
 import Algebra.Opposites
 
Diff
@@ -306,7 +306,7 @@ variable (C)
 def embedding : C ⥤ Mat_ C where
   obj X := ⟨PUnit, fun _ => X⟩
   map X Y f _ _ := f
-  map_id' X := by ext ⟨⟩ ⟨⟩; simp
+  map_id'' X := by ext ⟨⟩ ⟨⟩; simp
   map_comp' X Y Z f g := by ext ⟨⟩ ⟨⟩; simp
 #align category_theory.Mat_.embedding CategoryTheory.Mat_.embedding
 -/
@@ -424,7 +424,7 @@ def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D
     where
   obj X := ⨁ fun i => F.obj (X.pt i)
   map X Y f := biproduct.matrix fun i j => F.map (f i j)
-  map_id' X := by
+  map_id'' X := by
     ext i j
     by_cases h : i = j
     · subst h; simp
@@ -625,7 +625,7 @@ def equivalenceSingleObjInverse : Mat_ (SingleObj Rᵐᵒᵖ) ⥤ Mat R
     where
   obj X := FintypeCat.of X.ι
   map X Y f i j := MulOpposite.unop (f i j)
-  map_id' X := by ext i j; simp [id_def, Mat_.id_def]; split_ifs <;> rfl
+  map_id'' X := by ext i j; simp [id_def, Mat_.id_def]; split_ifs <;> rfl
 #align category_theory.Mat.equivalence_single_obj_inverse CategoryTheory.Mat.equivalenceSingleObjInverse
 -/
 
Diff
@@ -3,16 +3,16 @@ Copyright (c) 2021 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
 -/
-import Mathbin.Algebra.BigOperators.Basic
-import Mathbin.Algebra.BigOperators.Pi
-import Mathbin.CategoryTheory.Limits.Shapes.Biproducts
-import Mathbin.CategoryTheory.Preadditive.Basic
-import Mathbin.CategoryTheory.Preadditive.AdditiveFunctor
-import Mathbin.Data.Matrix.Dmatrix
-import Mathbin.Data.Matrix.Basic
-import Mathbin.CategoryTheory.Fintype
-import Mathbin.CategoryTheory.Preadditive.SingleObj
-import Mathbin.Algebra.Opposites
+import Algebra.BigOperators.Basic
+import Algebra.BigOperators.Pi
+import CategoryTheory.Limits.Shapes.Biproducts
+import CategoryTheory.Preadditive.Basic
+import CategoryTheory.Preadditive.AdditiveFunctor
+import Data.Matrix.Dmatrix
+import Data.Matrix.Basic
+import CategoryTheory.Fintype
+import CategoryTheory.Preadditive.SingleObj
+import Algebra.Opposites
 
 #align_import category_theory.preadditive.Mat from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
 
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2021 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
-
-! This file was ported from Lean 3 source module category_theory.preadditive.Mat
-! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.BigOperators.Basic
 import Mathbin.Algebra.BigOperators.Pi
@@ -19,6 +14,8 @@ import Mathbin.CategoryTheory.Fintype
 import Mathbin.CategoryTheory.Preadditive.SingleObj
 import Mathbin.Algebra.Opposites
 
+#align_import category_theory.preadditive.Mat from "leanprover-community/mathlib"@"6b31d1eebd64eab86d5bd9936bfaada6ca8b5842"
+
 /-!
 # Matrices over a category.
 
Diff
@@ -118,7 +118,7 @@ instance : Category.{v₁} (Mat_ C) where
   id_comp' M N f := by simp [dite_comp]
   comp_id' M N f := by simp [comp_dite]
   assoc' M N K L f g h := by
-    ext (i k)
+    ext i k
     simp_rw [hom.comp, sum_comp, comp_sum, category.assoc]
     rw [Finset.sum_comm]
 
@@ -212,7 +212,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
               apply eq_to_hom
               substs h h'
             ι_π := fun j j' => by
-              ext (x y)
+              ext x y
               dsimp
               simp_rw [dite_comp, comp_dite]
               simp only [if_t_t, dite_eq_ite, dif_ctx_congr, limits.comp_zero, limits.zero_comp,
@@ -265,7 +265,7 @@ def mapMat_ (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ Mat_ D
     where
   obj M := ⟨M.ι, fun i => F.obj (M.pt i)⟩
   map M N f i j := F.map (f i j)
-  map_comp' M N K f g := by ext (i k); simp
+  map_comp' M N K f g := by ext i k; simp
 #align category_theory.functor.map_Mat_ CategoryTheory.Functor.mapMat_
 -/
 
@@ -276,7 +276,7 @@ def mapMat_ (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ Mat_ D
 def mapMatId : (𝟭 C).mapMat_ ≅ 𝟭 (Mat_ C) :=
   NatIso.ofComponents (fun M => eqToIso (by cases M; rfl)) fun M N f =>
     by
-    ext (i j)
+    ext i j
     cases M; cases N
     simp [comp_dite, dite_comp]
 #align category_theory.functor.map_Mat_id CategoryTheory.Functor.mapMatId
@@ -290,7 +290,7 @@ def mapMatComp {E : Type _} [Category.{v₁} E] [Preadditive E] (F : C ⥤ D) [F
     (G : D ⥤ E) [Functor.Additive G] : (F ⋙ G).mapMat_ ≅ F.mapMat_ ⋙ G.mapMat_ :=
   NatIso.ofComponents (fun M => eqToIso (by cases M; rfl)) fun M N f =>
     by
-    ext (i j)
+    ext i j
     cases M; cases N
     simp [comp_dite, dite_comp]
 #align category_theory.functor.map_Mat_comp CategoryTheory.Functor.mapMatComp
@@ -309,8 +309,8 @@ variable (C)
 def embedding : C ⥤ Mat_ C where
   obj X := ⟨PUnit, fun _ => X⟩
   map X Y f _ _ := f
-  map_id' X := by ext (⟨⟩⟨⟩); simp
-  map_comp' X Y Z f g := by ext (⟨⟩⟨⟩); simp
+  map_id' X := by ext ⟨⟩ ⟨⟩; simp
+  map_comp' X Y Z f g := by ext ⟨⟩ ⟨⟩; simp
 #align category_theory.Mat_.embedding CategoryTheory.Mat_.embedding
 -/
 
@@ -359,7 +359,7 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     intro j
     simp only [category.id_comp, category.assoc, biproduct.lift_π, biproduct.ι_desc_assoc,
       biproduct.ι_π]
-    ext (⟨⟩⟨⟩)
+    ext ⟨⟩ ⟨⟩
     simp [dite_comp, comp_dite]
     split_ifs
     · subst h; simp
@@ -428,11 +428,11 @@ def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D
   obj X := ⨁ fun i => F.obj (X.pt i)
   map X Y f := biproduct.matrix fun i j => F.map (f i j)
   map_id' X := by
-    ext (i j)
+    ext i j
     by_cases h : i = j
     · subst h; simp
     · simp [h, Mat_.id_apply]
-  map_comp' X Y Z f g := by ext (i j); simp
+  map_comp' X Y Z f g := by ext i j; simp
 #align category_theory.Mat_.lift CategoryTheory.Mat_.lift
 -/
 
@@ -477,7 +477,7 @@ def liftUnique (F : C ⥤ D) [Functor.Additive F] (L : Mat_ C ⥤ D) [Functor.Ad
     simp only [additive_obj_iso_biproduct_naturality']
     simp only [biproduct.map_matrix_assoc, category.assoc]
     congr
-    ext (j k⟨⟩)
+    ext j k ⟨⟩
     dsimp; simp
     exact α.hom.naturality (f j k)
 #align category_theory.Mat_.lift_unique CategoryTheory.Mat_.liftUnique
@@ -628,13 +628,13 @@ def equivalenceSingleObjInverse : Mat_ (SingleObj Rᵐᵒᵖ) ⥤ Mat R
     where
   obj X := FintypeCat.of X.ι
   map X Y f i j := MulOpposite.unop (f i j)
-  map_id' X := by ext (i j); simp [id_def, Mat_.id_def]; split_ifs <;> rfl
+  map_id' X := by ext i j; simp [id_def, Mat_.id_def]; split_ifs <;> rfl
 #align category_theory.Mat.equivalence_single_obj_inverse CategoryTheory.Mat.equivalenceSingleObjInverse
 -/
 
 instance : Faithful (equivalenceSingleObjInverse R)
     where map_injective' X Y f g w := by
-    ext (i j)
+    ext i j
     apply_fun MulOpposite.unop using MulOpposite.unop_injective
     exact congr_fun (congr_fun w i) j
 
Diff
@@ -82,22 +82,28 @@ namespace Mat_
 
 variable {C}
 
+#print CategoryTheory.Mat_.Hom /-
 /-- A morphism in `Mat_ C` is a dependently typed matrix of morphisms. -/
 @[nolint has_nonempty_instance]
 def Hom (M N : Mat_ C) : Type v₁ :=
   DMatrix M.ι N.ι fun i j => M.pt i ⟶ N.pt j
 #align category_theory.Mat_.hom CategoryTheory.Mat_.Hom
+-/
 
 namespace Hom
 
+#print CategoryTheory.Mat_.Hom.id /-
 /-- The identity matrix consists of identity morphisms on the diagonal, and zeros elsewhere. -/
 def id (M : Mat_ C) : Hom M M := fun i j => if h : i = j then eqToHom (congr_arg M.pt h) else 0
 #align category_theory.Mat_.hom.id CategoryTheory.Mat_.Hom.id
+-/
 
+#print CategoryTheory.Mat_.Hom.comp /-
 /-- Composition of matrices using matrix multiplication. -/
 def comp {M N K : Mat_ C} (f : Hom M N) (g : Hom N K) : Hom M K := fun i k =>
   ∑ j : N.ι, f i j ≫ g j k
 #align category_theory.Mat_.hom.comp CategoryTheory.Mat_.Hom.comp
+-/
 
 end Hom
 
@@ -116,35 +122,47 @@ instance : Category.{v₁} (Mat_ C) where
     simp_rw [hom.comp, sum_comp, comp_sum, category.assoc]
     rw [Finset.sum_comm]
 
+#print CategoryTheory.Mat_.id_def /-
 theorem id_def (M : Mat_ C) :
     (𝟙 M : Hom M M) = fun i j => if h : i = j then eqToHom (congr_arg M.pt h) else 0 :=
   rfl
 #align category_theory.Mat_.id_def CategoryTheory.Mat_.id_def
+-/
 
+#print CategoryTheory.Mat_.id_apply /-
 theorem id_apply (M : Mat_ C) (i j : M.ι) :
     (𝟙 M : Hom M M) i j = if h : i = j then eqToHom (congr_arg M.pt h) else 0 :=
   rfl
 #align category_theory.Mat_.id_apply CategoryTheory.Mat_.id_apply
+-/
 
+#print CategoryTheory.Mat_.id_apply_self /-
 @[simp]
 theorem id_apply_self (M : Mat_ C) (i : M.ι) : (𝟙 M : Hom M M) i i = 𝟙 _ := by simp [id_apply]
 #align category_theory.Mat_.id_apply_self CategoryTheory.Mat_.id_apply_self
+-/
 
+#print CategoryTheory.Mat_.id_apply_of_ne /-
 @[simp]
 theorem id_apply_of_ne (M : Mat_ C) (i j : M.ι) (h : i ≠ j) : (𝟙 M : Hom M M) i j = 0 := by
   simp [id_apply, h]
 #align category_theory.Mat_.id_apply_of_ne CategoryTheory.Mat_.id_apply_of_ne
+-/
 
+#print CategoryTheory.Mat_.comp_def /-
 theorem comp_def {M N K : Mat_ C} (f : M ⟶ N) (g : N ⟶ K) :
     f ≫ g = fun i k => ∑ j : N.ι, f i j ≫ g j k :=
   rfl
 #align category_theory.Mat_.comp_def CategoryTheory.Mat_.comp_def
+-/
 
+#print CategoryTheory.Mat_.comp_apply /-
 @[simp]
 theorem comp_apply {M N K : Mat_ C} (f : M ⟶ N) (g : N ⟶ K) (i k) :
     (f ≫ g) i k = ∑ j : N.ι, f i j ≫ g j k :=
   rfl
 #align category_theory.Mat_.comp_apply CategoryTheory.Mat_.comp_apply
+-/
 
 instance (M N : Mat_ C) : Inhabited (M ⟶ N) :=
   ⟨fun i j => (0 : M.pt i ⟶ N.pt j)⟩
@@ -157,13 +175,16 @@ instance : Preadditive (Mat_ C)
   add_comp M N K f f' g := by ext; simp [Finset.sum_add_distrib]
   comp_add M N K f g g' := by ext; simp [Finset.sum_add_distrib]
 
+#print CategoryTheory.Mat_.add_apply /-
 @[simp]
 theorem add_apply {M N : Mat_ C} (f g : M ⟶ N) (i j) : (f + g) i j = f i j + g i j :=
   rfl
 #align category_theory.Mat_.add_apply CategoryTheory.Mat_.add_apply
+-/
 
 open CategoryTheory.Limits
 
+#print CategoryTheory.Mat_.hasFiniteBiproducts /-
 /-- We now prove that `Mat_ C` has finite biproducts.
 
 Be warned, however, that `Mat_ C` is not necessarily Krull-Schmidt,
@@ -226,6 +247,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
               · subst h; simp
               · simp [h]) }
 #align category_theory.Mat_.has_finite_biproducts CategoryTheory.Mat_.hasFiniteBiproducts
+-/
 
 end Mat_
 
@@ -235,6 +257,7 @@ variable {C} {D : Type _} [Category.{v₁} D] [Preadditive D]
 
 attribute [local simp] Mat_.id_apply eq_to_hom_map
 
+#print CategoryTheory.Functor.mapMat_ /-
 /-- A functor induces a functor of matrix categories.
 -/
 @[simps]
@@ -244,7 +267,9 @@ def mapMat_ (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ Mat_ D
   map M N f i j := F.map (f i j)
   map_comp' M N K f g := by ext (i k); simp
 #align category_theory.functor.map_Mat_ CategoryTheory.Functor.mapMat_
+-/
 
+#print CategoryTheory.Functor.mapMatId /-
 /-- The identity functor induces the identity functor on matrix categories.
 -/
 @[simps]
@@ -255,7 +280,9 @@ def mapMatId : (𝟭 C).mapMat_ ≅ 𝟭 (Mat_ C) :=
     cases M; cases N
     simp [comp_dite, dite_comp]
 #align category_theory.functor.map_Mat_id CategoryTheory.Functor.mapMatId
+-/
 
+#print CategoryTheory.Functor.mapMatComp /-
 /-- Composite functors induce composite functors on matrix categories.
 -/
 @[simps]
@@ -267,6 +294,7 @@ def mapMatComp {E : Type _} [Category.{v₁} E] [Preadditive E] (F : C ⥤ D) [F
     cases M; cases N
     simp [comp_dite, dite_comp]
 #align category_theory.functor.map_Mat_comp CategoryTheory.Functor.mapMatComp
+-/
 
 end Functor
 
@@ -274,6 +302,7 @@ namespace Mat_
 
 variable (C)
 
+#print CategoryTheory.Mat_.embedding /-
 /-- The embedding of `C` into `Mat_ C` as one-by-one matrices.
 (We index the summands by `punit`.) -/
 @[simps]
@@ -283,6 +312,7 @@ def embedding : C ⥤ Mat_ C where
   map_id' X := by ext (⟨⟩⟨⟩); simp
   map_comp' X Y Z f g := by ext (⟨⟩⟨⟩); simp
 #align category_theory.Mat_.embedding CategoryTheory.Mat_.embedding
+-/
 
 namespace Embedding
 
@@ -302,6 +332,7 @@ open CategoryTheory.Limits
 
 variable {C}
 
+#print CategoryTheory.Mat_.isoBiproductEmbedding /-
 /-- Every object in `Mat_ C` is isomorphic to the biproduct of its summands.
 -/
 @[simps]
@@ -334,18 +365,22 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     · subst h; simp
     · simp [h]
 #align category_theory.Mat_.iso_biproduct_embedding CategoryTheory.Mat_.isoBiproductEmbedding
+-/
 
 variable {D : Type u₁} [Category.{v₁} D] [Preadditive D]
 
+#print CategoryTheory.Mat_.additiveObjIsoBiproduct /-
 /-- Every `M` is a direct sum of objects from `C`, and `F` preserves biproducts. -/
 @[simps]
 def additiveObjIsoBiproduct (F : Mat_ C ⥤ D) [Functor.Additive F] (M : Mat_ C) :
     F.obj M ≅ ⨁ fun i => F.obj ((embedding C).obj (M.pt i)) :=
   F.mapIso (isoBiproductEmbedding M) ≪≫ F.mapBiproduct _
 #align category_theory.Mat_.additive_obj_iso_biproduct CategoryTheory.Mat_.additiveObjIsoBiproduct
+-/
 
 variable [HasFiniteBiproducts D]
 
+#print CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality /-
 @[reassoc]
 theorem additiveObjIsoBiproduct_naturality (F : Mat_ C ⥤ D) [Functor.Additive F] {M N : Mat_ C}
     (f : M ⟶ N) :
@@ -371,7 +406,9 @@ theorem additiveObjIsoBiproduct_naturality (F : Mat_ C ⥤ D) [Functor.Additive
   ext
   simp
 #align category_theory.Mat_.additive_obj_iso_biproduct_naturality CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality
+-/
 
+#print CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality' /-
 @[reassoc]
 theorem additiveObjIsoBiproduct_naturality' (F : Mat_ C ⥤ D) [Functor.Additive F] {M N : Mat_ C}
     (f : M ⟶ N) :
@@ -380,7 +417,9 @@ theorem additiveObjIsoBiproduct_naturality' (F : Mat_ C ⥤ D) [Functor.Additive
         (additiveObjIsoBiproduct F N).inv :=
   by rw [iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, additive_obj_iso_biproduct_naturality]
 #align category_theory.Mat_.additive_obj_iso_biproduct_naturality' CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality'
+-/
 
+#print CategoryTheory.Mat_.lift /-
 /-- Any additive functor `C ⥤ D` to a category `D` with finite biproducts extends to
 a functor `Mat_ C ⥤ D`. -/
 @[simps]
@@ -395,9 +434,12 @@ def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D
     · simp [h, Mat_.id_apply]
   map_comp' X Y Z f g := by ext (i j); simp
 #align category_theory.Mat_.lift CategoryTheory.Mat_.lift
+-/
 
+#print CategoryTheory.Mat_.lift_additive /-
 instance lift_additive (F : C ⥤ D) [Functor.Additive F] : Functor.Additive (lift F) where
 #align category_theory.Mat_.lift_additive CategoryTheory.Mat_.lift_additive
+-/
 
 #print CategoryTheory.Mat_.embeddingLiftIso /-
 /-- An additive functor `C ⥤ D` factors through its lift to `Mat_ C ⥤ D`. -/
@@ -417,6 +459,7 @@ def embeddingLiftIso (F : C ⥤ D) [Functor.Additive F] : embedding C ⋙ lift F
 #align category_theory.Mat_.embedding_lift_iso CategoryTheory.Mat_.embeddingLiftIso
 -/
 
+#print CategoryTheory.Mat_.liftUnique /-
 /-- `Mat_.lift F` is the unique additive functor `L : Mat_ C ⥤ D` such that `F ≅ embedding C ⋙ L`.
 -/
 def liftUnique (F : C ⥤ D) [Functor.Additive F] (L : Mat_ C ⥤ D) [Functor.Additive L]
@@ -438,7 +481,9 @@ def liftUnique (F : C ⥤ D) [Functor.Additive F] (L : Mat_ C ⥤ D) [Functor.Ad
     dsimp; simp
     exact α.hom.naturality (f j k)
 #align category_theory.Mat_.lift_unique CategoryTheory.Mat_.liftUnique
+-/
 
+#print CategoryTheory.Mat_.ext /-
 -- TODO is there some uniqueness statement for the natural isomorphism in `lift_unique`?
 /-- Two additive functors `Mat_ C ⥤ D` are naturally isomorphic if
 their precompositions with `embedding C` are naturally isomorphic as functors `C ⥤ D`. -/
@@ -447,7 +492,9 @@ def ext {F G : Mat_ C ⥤ D} [Functor.Additive F] [Functor.Additive G]
     (α : embedding C ⋙ F ≅ embedding C ⋙ G) : F ≅ G :=
   liftUnique (embedding C ⋙ G) _ α ≪≫ (liftUnique _ _ (Iso.refl _)).symm
 #align category_theory.Mat_.ext CategoryTheory.Mat_.ext
+-/
 
+#print CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproductsAux /-
 /-- Natural isomorphism needed in the construction of `equivalence_self_of_has_finite_biproducts`.
 -/
 def equivalenceSelfOfHasFiniteBiproductsAux [HasFiniteBiproducts C] :
@@ -456,7 +503,9 @@ def equivalenceSelfOfHasFiniteBiproductsAux [HasFiniteBiproducts C] :
     (Functor.leftUnitor _).symm ≪≫
       isoWhiskerRight (embeddingLiftIso _).symm _ ≪≫ Functor.associator _ _ _
 #align category_theory.Mat_.equivalence_self_of_has_finite_biproducts_aux CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproductsAux
+-/
 
+#print CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproducts /-
 /--
 A preadditive category that already has finite biproducts is equivalent to its additive envelope.
 
@@ -471,20 +520,25 @@ def equivalenceSelfOfHasFiniteBiproducts (C : Type (u₁ + 1)) [LargeCategory C]
       (𝟭 C))
     (embedding C) (ext equivalenceSelfOfHasFiniteBiproductsAux) (embeddingLiftIso (𝟭 C))
 #align category_theory.Mat_.equivalence_self_of_has_finite_biproducts CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproducts
+-/
 
+#print CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproducts_functor /-
 @[simp]
 theorem equivalenceSelfOfHasFiniteBiproducts_functor {C : Type (u₁ + 1)} [LargeCategory C]
     [Preadditive C] [HasFiniteBiproducts C] :
     (equivalenceSelfOfHasFiniteBiproducts C).Functor = lift (𝟭 C) :=
   rfl
 #align category_theory.Mat_.equivalence_self_of_has_finite_biproducts_functor CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproducts_functor
+-/
 
+#print CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproducts_inverse /-
 @[simp]
 theorem equivalenceSelfOfHasFiniteBiproducts_inverse {C : Type (u₁ + 1)} [LargeCategory C]
     [Preadditive C] [HasFiniteBiproducts C] :
     (equivalenceSelfOfHasFiniteBiproducts C).inverse = embedding C :=
   rfl
 #align category_theory.Mat_.equivalence_self_of_has_finite_biproducts_inverse CategoryTheory.Mat_.equivalenceSelfOfHasFiniteBiproducts_inverse
+-/
 
 end Mat_
 
@@ -518,33 +572,45 @@ section
 
 variable (R : Type u) [Semiring R]
 
+#print CategoryTheory.Mat.id_def /-
 theorem id_def (M : Mat R) : 𝟙 M = fun i j => if h : i = j then 1 else 0 :=
   rfl
 #align category_theory.Mat.id_def CategoryTheory.Mat.id_def
+-/
 
+#print CategoryTheory.Mat.id_apply /-
 theorem id_apply (M : Mat R) (i j : M) : (𝟙 M : Matrix M M R) i j = if h : i = j then 1 else 0 :=
   rfl
 #align category_theory.Mat.id_apply CategoryTheory.Mat.id_apply
+-/
 
+#print CategoryTheory.Mat.id_apply_self /-
 @[simp]
 theorem id_apply_self (M : Mat R) (i : M) : (𝟙 M : Matrix M M R) i i = 1 := by simp [id_apply]
 #align category_theory.Mat.id_apply_self CategoryTheory.Mat.id_apply_self
+-/
 
+#print CategoryTheory.Mat.id_apply_of_ne /-
 @[simp]
 theorem id_apply_of_ne (M : Mat R) (i j : M) (h : i ≠ j) : (𝟙 M : Matrix M M R) i j = 0 := by
   simp [id_apply, h]
 #align category_theory.Mat.id_apply_of_ne CategoryTheory.Mat.id_apply_of_ne
+-/
 
+#print CategoryTheory.Mat.comp_def /-
 theorem comp_def {M N K : Mat R} (f : M ⟶ N) (g : N ⟶ K) :
     f ≫ g = fun i k => ∑ j : N, f i j * g j k :=
   rfl
 #align category_theory.Mat.comp_def CategoryTheory.Mat.comp_def
+-/
 
+#print CategoryTheory.Mat.comp_apply /-
 @[simp]
 theorem comp_apply {M N K : Mat R} (f : M ⟶ N) (g : N ⟶ K) (i k) :
     (f ≫ g) i k = ∑ j : N, f i j * g j k :=
   rfl
 #align category_theory.Mat.comp_apply CategoryTheory.Mat.comp_apply
+-/
 
 instance (M N : Mat R) : Inhabited (M ⟶ N) :=
   ⟨fun (i : M) (j : N) => (0 : R)⟩
@@ -555,6 +621,7 @@ variable (R : Type) [Ring R]
 
 open Opposite
 
+#print CategoryTheory.Mat.equivalenceSingleObjInverse /-
 /-- Auxiliary definition for `category_theory.Mat.equivalence_single_obj`. -/
 @[simps]
 def equivalenceSingleObjInverse : Mat_ (SingleObj Rᵐᵒᵖ) ⥤ Mat R
@@ -563,6 +630,7 @@ def equivalenceSingleObjInverse : Mat_ (SingleObj Rᵐᵒᵖ) ⥤ Mat R
   map X Y f i j := MulOpposite.unop (f i j)
   map_id' X := by ext (i j); simp [id_def, Mat_.id_def]; split_ifs <;> rfl
 #align category_theory.Mat.equivalence_single_obj_inverse CategoryTheory.Mat.equivalenceSingleObjInverse
+-/
 
 instance : Faithful (equivalenceSingleObjInverse R)
     where map_injective' X Y f g w := by
@@ -577,12 +645,14 @@ instance : EssSurj (equivalenceSingleObjInverse R)
     ⟨{  ι := X
         pt := fun _ => PUnit.unit }, ⟨eqToIso (by dsimp; cases X; congr)⟩⟩
 
+#print CategoryTheory.Mat.equivalenceSingleObj /-
 /-- The categorical equivalence between the category of matrices over a ring,
 and the category of matrices over that ring considered as a single-object category. -/
 def equivalenceSingleObj : Mat R ≌ Mat_ (SingleObj Rᵐᵒᵖ) :=
   haveI := equivalence.of_fully_faithfully_ess_surj (equivalence_single_obj_inverse R)
   (equivalence_single_obj_inverse R).asEquivalence.symm
 #align category_theory.Mat.equivalence_single_obj CategoryTheory.Mat.equivalenceSingleObj
+-/
 
 instance : Preadditive (Mat R)
     where
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
 
 ! This file was ported from Lean 3 source module category_theory.preadditive.Mat
-! leanprover-community/mathlib commit 829895f162a1f29d0133f4b3538f4cd1fb5bffd3
+! leanprover-community/mathlib commit 6b31d1eebd64eab86d5bd9936bfaada6ca8b5842
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -22,6 +22,9 @@ import Mathbin.Algebra.Opposites
 /-!
 # Matrices over a category.
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 When `C` is a preadditive category, `Mat_ C` is the preadditive category
 whose objects are finite tuples of objects in `C`, and
 whose morphisms are matrices of morphisms from `C`.
Diff
@@ -71,7 +71,7 @@ structure Mat_ where
   ι : Type
   [f : Fintype ι]
   pt : ι → C
-#align category_theory.Mat_ CategoryTheory.Mat_
+#align category_theory.Mat_ CategoryTheory.Mat_ₓ
 
 attribute [instance] Mat_.F
 
@@ -396,6 +396,7 @@ def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D
 instance lift_additive (F : C ⥤ D) [Functor.Additive F] : Functor.Additive (lift F) where
 #align category_theory.Mat_.lift_additive CategoryTheory.Mat_.lift_additive
 
+#print CategoryTheory.Mat_.embeddingLiftIso /-
 /-- An additive functor `C ⥤ D` factors through its lift to `Mat_ C ⥤ D`. -/
 @[simps]
 def embeddingLiftIso (F : C ⥤ D) [Functor.Additive F] : embedding C ⋙ lift F ≅ F :=
@@ -411,6 +412,7 @@ def embeddingLiftIso (F : C ⥤ D) [Functor.Additive F] : embedding C ⋙ lift F
     -- Not sure why this doesn't fire via `simp`.
     simp
 #align category_theory.Mat_.embedding_lift_iso CategoryTheory.Mat_.embeddingLiftIso
+-/
 
 /-- `Mat_.lift F` is the unique additive functor `L : Mat_ C ⥤ D` such that `F ≅ embedding C ⋙ L`.
 -/
@@ -485,6 +487,7 @@ end Mat_
 
 universe u
 
+#print CategoryTheory.Mat /-
 /-- A type synonym for `Fintype`, which we will equip with a category structure
 where the morphisms are matrices with components in `R`. -/
 @[nolint unused_arguments]
@@ -492,6 +495,7 @@ def Mat (R : Type u) :=
   FintypeCat.{u}
 deriving Inhabited
 #align category_theory.Mat CategoryTheory.Mat
+-/
 
 instance (R : Type u) : CoeSort (Mat R) (Type u) :=
   Bundled.hasCoeToSort
Diff
@@ -173,16 +173,16 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
     {
       HasBiproduct := fun f =>
         hasBiproduct_of_total
-          { pt := ⟨Σj, (f j).ι, fun p => (f p.1).pt p.2⟩
+          { pt := ⟨Σ j, (f j).ι, fun p => (f p.1).pt p.2⟩
             π := fun j x y => by
-              dsimp at x⊢
+              dsimp at x ⊢
               refine' if h : x.1 = j then _ else 0
               refine' if h' : @Eq.ndrec (Fin n) x.1 (fun j => (f j).ι) x.2 _ h = y then _ else 0
               apply eq_to_hom
               substs h h'
             -- Notice we were careful not to use `subst` until we had a goal in `Prop`.
             ι := fun j x y => by
-              dsimp at y⊢
+              dsimp at y ⊢
               refine' if h : y.1 = j then _ else 0
               refine' if h' : @Eq.ndrec _ y.1 (fun j => (f j).ι) y.2 _ h = x then _ else 0
               apply eq_to_hom
@@ -206,7 +206,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
           (by
             dsimp
             funext i₁
-            dsimp at i₁⊢
+            dsimp at i₁ ⊢
             rcases i₁ with ⟨j₁, i₁⟩
             -- I'm not sure why we can't just `simp` by `finset.sum_apply`: something doesn't quite match
             convert Finset.sum_apply _ _ _ using 1
@@ -489,7 +489,8 @@ universe u
 where the morphisms are matrices with components in `R`. -/
 @[nolint unused_arguments]
 def Mat (R : Type u) :=
-  FintypeCat.{u}deriving Inhabited
+  FintypeCat.{u}
+deriving Inhabited
 #align category_theory.Mat CategoryTheory.Mat
 
 instance (R : Type u) : CoeSort (Mat R) (Type u) :=
@@ -502,7 +503,7 @@ instance (R : Type u) [Semiring R] : Category (Mat R)
   hom X Y := Matrix X Y R
   id X := 1
   comp X Y Z f g := f ⬝ g
-  assoc' := by intros ; simp [Matrix.mul_assoc]
+  assoc' := by intros; simp [Matrix.mul_assoc]
 
 namespace Mat
 
@@ -567,7 +568,7 @@ instance : Full (equivalenceSingleObjInverse R) where Preimage X Y f i j := MulO
 instance : EssSurj (equivalenceSingleObjInverse R)
     where mem_essImage X :=
     ⟨{  ι := X
-        pt := fun _ => PUnit.unit }, ⟨eqToIso (by dsimp; cases X; congr )⟩⟩
+        pt := fun _ => PUnit.unit }, ⟨eqToIso (by dsimp; cases X; congr)⟩⟩
 
 /-- The categorical equivalence between the category of matrices over a ring,
 and the category of matrices over that ring considered as a single-object category. -/
@@ -578,8 +579,8 @@ def equivalenceSingleObj : Mat R ≌ Mat_ (SingleObj Rᵐᵒᵖ) :=
 
 instance : Preadditive (Mat R)
     where
-  add_comp := by intros ; ext; simp [add_mul, Finset.sum_add_distrib]
-  comp_add := by intros ; ext; simp [mul_add, Finset.sum_add_distrib]
+  add_comp := by intros; ext; simp [add_mul, Finset.sum_add_distrib]
+  comp_add := by intros; ext; simp [mul_add, Finset.sum_add_distrib]
 
 -- TODO show `Mat R` has biproducts, and that `biprod.map` "is" forming a block diagonal matrix.
 end Mat
Diff
@@ -55,7 +55,7 @@ Ideally this would conveniently interact with both `Mat_` and `matrix`.
 
 open CategoryTheory CategoryTheory.Preadditive
 
-open BigOperators Classical
+open scoped BigOperators Classical
 
 noncomputable section
 
@@ -495,7 +495,7 @@ def Mat (R : Type u) :=
 instance (R : Type u) : CoeSort (Mat R) (Type u) :=
   Bundled.hasCoeToSort
 
-open Classical Matrix
+open scoped Classical Matrix
 
 instance (R : Type u) [Semiring R] : Category (Mat R)
     where
Diff
@@ -150,15 +150,9 @@ end
 
 instance : Preadditive (Mat_ C)
     where
-  homGroup M N := by
-    change AddCommGroup (DMatrix M.ι N.ι _)
-    infer_instance
-  add_comp M N K f f' g := by
-    ext
-    simp [Finset.sum_add_distrib]
-  comp_add M N K f g g' := by
-    ext
-    simp [Finset.sum_add_distrib]
+  homGroup M N := by change AddCommGroup (DMatrix M.ι N.ι _); infer_instance
+  add_comp M N K f f' g := by ext; simp [Finset.sum_add_distrib]
+  comp_add M N K f g g' := by ext; simp [Finset.sum_add_distrib]
 
 @[simp]
 theorem add_apply {M N : Mat_ C} (f g : M ⟶ N) (i j) : (f + g) i j = f i j + g i j :=
@@ -226,8 +220,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
                 Finset.sum_const_zero, Finset.sum_congr, Finset.sum_dite_eq, Finset.sum_apply,
                 limits.comp_zero, limits.zero_comp, eq_to_hom_trans, Mat_.id_apply]
               by_cases h : j₁ = j₂
-              · subst h
-                simp
+              · subst h; simp
               · simp [h]) }
 #align category_theory.Mat_.has_finite_biproducts CategoryTheory.Mat_.hasFiniteBiproducts
 
@@ -246,22 +239,15 @@ def mapMat_ (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ Mat_ D
     where
   obj M := ⟨M.ι, fun i => F.obj (M.pt i)⟩
   map M N f i j := F.map (f i j)
-  map_comp' M N K f g := by
-    ext (i k)
-    simp
+  map_comp' M N K f g := by ext (i k); simp
 #align category_theory.functor.map_Mat_ CategoryTheory.Functor.mapMat_
 
 /-- The identity functor induces the identity functor on matrix categories.
 -/
 @[simps]
 def mapMatId : (𝟭 C).mapMat_ ≅ 𝟭 (Mat_ C) :=
-  NatIso.ofComponents
-    (fun M =>
-      eqToIso
-        (by
-          cases M
-          rfl))
-    fun M N f => by
+  NatIso.ofComponents (fun M => eqToIso (by cases M; rfl)) fun M N f =>
+    by
     ext (i j)
     cases M; cases N
     simp [comp_dite, dite_comp]
@@ -272,13 +258,8 @@ def mapMatId : (𝟭 C).mapMat_ ≅ 𝟭 (Mat_ C) :=
 @[simps]
 def mapMatComp {E : Type _} [Category.{v₁} E] [Preadditive E] (F : C ⥤ D) [Functor.Additive F]
     (G : D ⥤ E) [Functor.Additive G] : (F ⋙ G).mapMat_ ≅ F.mapMat_ ⋙ G.mapMat_ :=
-  NatIso.ofComponents
-    (fun M =>
-      eqToIso
-        (by
-          cases M
-          rfl))
-    fun M N f => by
+  NatIso.ofComponents (fun M => eqToIso (by cases M; rfl)) fun M N f =>
+    by
     ext (i j)
     cases M; cases N
     simp [comp_dite, dite_comp]
@@ -296,12 +277,8 @@ variable (C)
 def embedding : C ⥤ Mat_ C where
   obj X := ⟨PUnit, fun _ => X⟩
   map X Y f _ _ := f
-  map_id' X := by
-    ext (⟨⟩⟨⟩)
-    simp
-  map_comp' X Y Z f g := by
-    ext (⟨⟩⟨⟩)
-    simp
+  map_id' X := by ext (⟨⟩⟨⟩); simp
+  map_comp' X Y Z f g := by ext (⟨⟩⟨⟩); simp
 #align category_theory.Mat_.embedding CategoryTheory.Mat_.embedding
 
 namespace Embedding
@@ -334,8 +311,7 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     funext i
     dsimp
     convert Finset.sum_apply _ _ _
-    · dsimp
-      rfl
+    · dsimp; rfl
     · apply hEq_of_eq
       symm
       funext j
@@ -352,8 +328,7 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     ext (⟨⟩⟨⟩)
     simp [dite_comp, comp_dite]
     split_ifs
-    · subst h
-      simp
+    · subst h; simp
     · simp [h]
 #align category_theory.Mat_.iso_biproduct_embedding CategoryTheory.Mat_.isoBiproductEmbedding
 
@@ -413,12 +388,9 @@ def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D
   map_id' X := by
     ext (i j)
     by_cases h : i = j
-    · subst h
-      simp
+    · subst h; simp
     · simp [h, Mat_.id_apply]
-  map_comp' X Y Z f g := by
-    ext (i j)
-    simp
+  map_comp' X Y Z f g := by ext (i j); simp
 #align category_theory.Mat_.lift CategoryTheory.Mat_.lift
 
 instance lift_additive (F : C ⥤ D) [Functor.Additive F] : Functor.Additive (lift F) where
@@ -530,9 +502,7 @@ instance (R : Type u) [Semiring R] : Category (Mat R)
   hom X Y := Matrix X Y R
   id X := 1
   comp X Y Z f g := f ⬝ g
-  assoc' := by
-    intros
-    simp [Matrix.mul_assoc]
+  assoc' := by intros ; simp [Matrix.mul_assoc]
 
 namespace Mat
 
@@ -583,10 +553,7 @@ def equivalenceSingleObjInverse : Mat_ (SingleObj Rᵐᵒᵖ) ⥤ Mat R
     where
   obj X := FintypeCat.of X.ι
   map X Y f i j := MulOpposite.unop (f i j)
-  map_id' X := by
-    ext (i j)
-    simp [id_def, Mat_.id_def]
-    split_ifs <;> rfl
+  map_id' X := by ext (i j); simp [id_def, Mat_.id_def]; split_ifs <;> rfl
 #align category_theory.Mat.equivalence_single_obj_inverse CategoryTheory.Mat.equivalenceSingleObjInverse
 
 instance : Faithful (equivalenceSingleObjInverse R)
@@ -600,12 +567,7 @@ instance : Full (equivalenceSingleObjInverse R) where Preimage X Y f i j := MulO
 instance : EssSurj (equivalenceSingleObjInverse R)
     where mem_essImage X :=
     ⟨{  ι := X
-        pt := fun _ => PUnit.unit },
-      ⟨eqToIso
-          (by
-            dsimp
-            cases X
-            congr )⟩⟩
+        pt := fun _ => PUnit.unit }, ⟨eqToIso (by dsimp; cases X; congr )⟩⟩
 
 /-- The categorical equivalence between the category of matrices over a ring,
 and the category of matrices over that ring considered as a single-object category. -/
@@ -616,14 +578,8 @@ def equivalenceSingleObj : Mat R ≌ Mat_ (SingleObj Rᵐᵒᵖ) :=
 
 instance : Preadditive (Mat R)
     where
-  add_comp := by
-    intros
-    ext
-    simp [add_mul, Finset.sum_add_distrib]
-  comp_add := by
-    intros
-    ext
-    simp [mul_add, Finset.sum_add_distrib]
+  add_comp := by intros ; ext; simp [add_mul, Finset.sum_add_distrib]
+  comp_add := by intros ; ext; simp [mul_add, Finset.sum_add_distrib]
 
 -- TODO show `Mat R` has biproducts, and that `biprod.map` "is" forming a block diagonal matrix.
 end Mat
Diff
@@ -368,7 +368,7 @@ def additiveObjIsoBiproduct (F : Mat_ C ⥤ D) [Functor.Additive F] (M : Mat_ C)
 
 variable [HasFiniteBiproducts D]
 
-@[reassoc.1]
+@[reassoc]
 theorem additiveObjIsoBiproduct_naturality (F : Mat_ C ⥤ D) [Functor.Additive F] {M N : Mat_ C}
     (f : M ⟶ N) :
     F.map f ≫ (additiveObjIsoBiproduct F N).hom =
@@ -394,7 +394,7 @@ theorem additiveObjIsoBiproduct_naturality (F : Mat_ C ⥤ D) [Functor.Additive
   simp
 #align category_theory.Mat_.additive_obj_iso_biproduct_naturality CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality
 
-@[reassoc.1]
+@[reassoc]
 theorem additiveObjIsoBiproduct_naturality' (F : Mat_ C ⥤ D) [Functor.Additive F] {M N : Mat_ C}
     (f : M ⟶ N) :
     (additiveObjIsoBiproduct F M).inv ≫ F.map f =
Diff
@@ -153,10 +153,10 @@ instance : Preadditive (Mat_ C)
   homGroup M N := by
     change AddCommGroup (DMatrix M.ι N.ι _)
     infer_instance
-  add_comp' M N K f f' g := by
+  add_comp M N K f f' g := by
     ext
     simp [Finset.sum_add_distrib]
-  comp_add' M N K f g g' := by
+  comp_add M N K f g g' := by
     ext
     simp [Finset.sum_add_distrib]
 
@@ -616,11 +616,11 @@ def equivalenceSingleObj : Mat R ≌ Mat_ (SingleObj Rᵐᵒᵖ) :=
 
 instance : Preadditive (Mat R)
     where
-  add_comp' := by
+  add_comp := by
     intros
     ext
     simp [add_mul, Finset.sum_add_distrib]
-  comp_add' := by
+  comp_add := by
     intros
     ext
     simp [mul_add, Finset.sum_add_distrib]
Diff
@@ -70,7 +70,7 @@ variable (C : Type u₁) [Category.{v₁} C] [Preadditive C]
 structure Mat_ where
   ι : Type
   [f : Fintype ι]
-  x : ι → C
+  pt : ι → C
 #align category_theory.Mat_ CategoryTheory.Mat_
 
 attribute [instance] Mat_.F
@@ -82,13 +82,13 @@ variable {C}
 /-- A morphism in `Mat_ C` is a dependently typed matrix of morphisms. -/
 @[nolint has_nonempty_instance]
 def Hom (M N : Mat_ C) : Type v₁ :=
-  DMatrix M.ι N.ι fun i j => M.x i ⟶ N.x j
+  DMatrix M.ι N.ι fun i j => M.pt i ⟶ N.pt j
 #align category_theory.Mat_.hom CategoryTheory.Mat_.Hom
 
 namespace Hom
 
 /-- The identity matrix consists of identity morphisms on the diagonal, and zeros elsewhere. -/
-def id (M : Mat_ C) : Hom M M := fun i j => if h : i = j then eqToHom (congr_arg M.x h) else 0
+def id (M : Mat_ C) : Hom M M := fun i j => if h : i = j then eqToHom (congr_arg M.pt h) else 0
 #align category_theory.Mat_.hom.id CategoryTheory.Mat_.Hom.id
 
 /-- Composition of matrices using matrix multiplication. -/
@@ -114,12 +114,12 @@ instance : Category.{v₁} (Mat_ C) where
     rw [Finset.sum_comm]
 
 theorem id_def (M : Mat_ C) :
-    (𝟙 M : Hom M M) = fun i j => if h : i = j then eqToHom (congr_arg M.x h) else 0 :=
+    (𝟙 M : Hom M M) = fun i j => if h : i = j then eqToHom (congr_arg M.pt h) else 0 :=
   rfl
 #align category_theory.Mat_.id_def CategoryTheory.Mat_.id_def
 
 theorem id_apply (M : Mat_ C) (i j : M.ι) :
-    (𝟙 M : Hom M M) i j = if h : i = j then eqToHom (congr_arg M.x h) else 0 :=
+    (𝟙 M : Hom M M) i j = if h : i = j then eqToHom (congr_arg M.pt h) else 0 :=
   rfl
 #align category_theory.Mat_.id_apply CategoryTheory.Mat_.id_apply
 
@@ -144,7 +144,7 @@ theorem comp_apply {M N K : Mat_ C} (f : M ⟶ N) (g : N ⟶ K) (i k) :
 #align category_theory.Mat_.comp_apply CategoryTheory.Mat_.comp_apply
 
 instance (M N : Mat_ C) : Inhabited (M ⟶ N) :=
-  ⟨fun i j => (0 : M.x i ⟶ N.x j)⟩
+  ⟨fun i j => (0 : M.pt i ⟶ N.pt j)⟩
 
 end
 
@@ -179,7 +179,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
     {
       HasBiproduct := fun f =>
         hasBiproduct_of_total
-          { x := ⟨Σj, (f j).ι, fun p => (f p.1).x p.2⟩
+          { pt := ⟨Σj, (f j).ι, fun p => (f p.1).pt p.2⟩
             π := fun j x y => by
               dsimp at x⊢
               refine' if h : x.1 = j then _ else 0
@@ -244,7 +244,7 @@ attribute [local simp] Mat_.id_apply eq_to_hom_map
 @[simps]
 def mapMat_ (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ Mat_ D
     where
-  obj M := ⟨M.ι, fun i => F.obj (M.x i)⟩
+  obj M := ⟨M.ι, fun i => F.obj (M.pt i)⟩
   map M N f i j := F.map (f i j)
   map_comp' M N K f g := by
     ext (i k)
@@ -325,10 +325,10 @@ variable {C}
 /-- Every object in `Mat_ C` is isomorphic to the biproduct of its summands.
 -/
 @[simps]
-def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M.x i)
+def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M.pt i)
     where
-  hom := biproduct.lift fun i j k => if h : j = i then eqToHom (congr_arg M.x h) else 0
-  inv := biproduct.desc fun i j k => if h : i = k then eqToHom (congr_arg M.x h) else 0
+  hom := biproduct.lift fun i j k => if h : j = i then eqToHom (congr_arg M.pt h) else 0
+  inv := biproduct.desc fun i j k => if h : i = k then eqToHom (congr_arg M.pt h) else 0
   hom_inv_id' := by
     simp only [biproduct.lift_desc]
     funext i
@@ -362,7 +362,7 @@ variable {D : Type u₁} [Category.{v₁} D] [Preadditive D]
 /-- Every `M` is a direct sum of objects from `C`, and `F` preserves biproducts. -/
 @[simps]
 def additiveObjIsoBiproduct (F : Mat_ C ⥤ D) [Functor.Additive F] (M : Mat_ C) :
-    F.obj M ≅ ⨁ fun i => F.obj ((embedding C).obj (M.x i)) :=
+    F.obj M ≅ ⨁ fun i => F.obj ((embedding C).obj (M.pt i)) :=
   F.mapIso (isoBiproductEmbedding M) ≪≫ F.mapBiproduct _
 #align category_theory.Mat_.additive_obj_iso_biproduct CategoryTheory.Mat_.additiveObjIsoBiproduct
 
@@ -408,7 +408,7 @@ a functor `Mat_ C ⥤ D`. -/
 @[simps]
 def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D
     where
-  obj X := ⨁ fun i => F.obj (X.x i)
+  obj X := ⨁ fun i => F.obj (X.pt i)
   map X Y f := biproduct.matrix fun i j => F.map (f i j)
   map_id' X := by
     ext (i j)
@@ -447,8 +447,8 @@ def liftUnique (F : C ⥤ D) [Functor.Additive F] (L : Mat_ C ⥤ D) [Functor.Ad
   NatIso.ofComponents
     (fun M =>
       additiveObjIsoBiproduct L M ≪≫
-        (biproduct.mapIso fun i => α.app (M.x i)) ≪≫
-          (biproduct.mapIso fun i => (embeddingLiftIso F).symm.app (M.x i)) ≪≫
+        (biproduct.mapIso fun i => α.app (M.pt i)) ≪≫
+          (biproduct.mapIso fun i => (embeddingLiftIso F).symm.app (M.pt i)) ≪≫
             (additiveObjIsoBiproduct (lift F) M).symm)
     fun M N f => by
     dsimp only [iso.trans_hom, iso.symm_hom, biproduct.map_iso_hom]
@@ -600,7 +600,7 @@ instance : Full (equivalenceSingleObjInverse R) where Preimage X Y f i j := MulO
 instance : EssSurj (equivalenceSingleObjInverse R)
     where mem_essImage X :=
     ⟨{  ι := X
-        x := fun _ => PUnit.unit },
+        pt := fun _ => PUnit.unit },
       ⟨eqToIso
           (by
             dsimp
Diff
@@ -178,7 +178,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
     where out n :=
     {
       HasBiproduct := fun f =>
-        hasBiproductOfTotal
+        hasBiproduct_of_total
           { x := ⟨Σj, (f j).ι, fun p => (f p.1).x p.2⟩
             π := fun j x y => by
               dsimp at x⊢

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
@@ -316,7 +316,7 @@ namespace Embedding
 instance : (embedding C).Faithful where
   map_injective h := congr_fun (congr_fun h PUnit.unit) PUnit.unit
 
-instance : (embedding C).Full where preimage f := f PUnit.unit PUnit.unit
+instance : (embedding C).Full where map_surjective f := ⟨f PUnit.unit PUnit.unit, rfl⟩
 
 instance : Functor.Additive (embedding C) where
 
@@ -644,7 +644,7 @@ instance : (equivalenceSingleObjInverse R).Faithful where
     exact congr_fun (congr_fun w _) _
 
 instance : (equivalenceSingleObjInverse R).Full where
-  preimage f i j := MulOpposite.op (f i j)
+  map_surjective f := ⟨fun i j => MulOpposite.op (f i j), rfl⟩
 
 instance : (equivalenceSingleObjInverse R).EssSurj where
   mem_essImage X :=
chore: classify porting notes referring to missing linters (#12098)

Reference the newly created issues #12094 and #12096, as well as the pre-existing #5171. Change all references to #10927 to #5171. Some of these changes were not labelled as "porting note"; change this for good measure.

Diff
@@ -77,7 +77,7 @@ namespace Mat_
 
 variable {C}
 
--- porting note (#10927): removed @[nolint has_nonempty_instance]
+-- porting note (#5171): removed @[nolint has_nonempty_instance]
 /-- A morphism in `Mat_ C` is a dependently typed matrix of morphisms. -/
 def Hom (M N : Mat_ C) : Type v₁ :=
   DMatrix M.ι N.ι fun i j => M.X i ⟶ N.X j
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
@@ -313,10 +313,10 @@ set_option linter.uppercaseLean3 false in
 
 namespace Embedding
 
-instance : Faithful (embedding C) where
+instance : (embedding C).Faithful where
   map_injective h := congr_fun (congr_fun h PUnit.unit) PUnit.unit
 
-instance : Full (embedding C) where preimage f := f PUnit.unit PUnit.unit
+instance : (embedding C).Full where preimage f := f PUnit.unit PUnit.unit
 
 instance : Functor.Additive (embedding C) where
 
@@ -637,16 +637,16 @@ def equivalenceSingleObjInverse : Mat_ (SingleObj Rᵐᵒᵖ) ⥤ Mat R where
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat.equivalence_single_obj_inverse CategoryTheory.Mat.equivalenceSingleObjInverse
 
-instance : Faithful (equivalenceSingleObjInverse R) where
+instance : (equivalenceSingleObjInverse R).Faithful where
   map_injective w := by
     ext
     apply_fun MulOpposite.unop using MulOpposite.unop_injective
     exact congr_fun (congr_fun w _) _
 
-instance : Full (equivalenceSingleObjInverse R) where
+instance : (equivalenceSingleObjInverse R).Full where
   preimage f i j := MulOpposite.op (f i j)
 
-instance : EssSurj (equivalenceSingleObjInverse R) where
+instance : (equivalenceSingleObjInverse R).EssSurj where
   mem_essImage X :=
     ⟨{  ι := X
         X := fun _ => PUnit.unit }, ⟨eqToIso (by dsimp; cases X; congr)⟩⟩
@@ -654,7 +654,7 @@ instance : EssSurj (equivalenceSingleObjInverse R) where
 /-- The categorical equivalence between the category of matrices over a ring,
 and the category of matrices over that ring considered as a single-object category. -/
 def equivalenceSingleObj : Mat R ≌ Mat_ (SingleObj Rᵐᵒᵖ) :=
-  haveI := Equivalence.ofFullyFaithfullyEssSurj (equivalenceSingleObjInverse R)
+  haveI := Functor.IsEquivalence.ofFullyFaithfullyEssSurj (equivalenceSingleObjInverse R)
   (equivalenceSingleObjInverse R).asEquivalence.symm
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat.equivalence_single_obj CategoryTheory.Mat.equivalenceSingleObj
doc: replace mathlib3 names in doc comments (#11952)

A few miscellaneous directories: RingTheory, SetTheory, Combinatorics and CategoryTheory.

Co-authored-by: Scott Morrison <scott@tqft.net>

Diff
@@ -301,7 +301,7 @@ end Functor
 namespace Mat_
 
 /-- The embedding of `C` into `Mat_ C` as one-by-one matrices.
-(We index the summands by `punit`.) -/
+(We index the summands by `PUnit`.) -/
 @[simps]
 def embedding : C ⥤ Mat_ C where
   obj X := ⟨PUnit, fun _ => X⟩
chore: classify removed @[ext] porting notes (#11183)

Classifies by adding issue number #11182 to porting notes claiming:

removed @[ext]

Diff
@@ -484,7 +484,7 @@ def liftUnique (F : C ⥤ D) [Functor.Additive F] (L : Mat_ C ⥤ D) [Functor.Ad
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.lift_unique CategoryTheory.Mat_.liftUnique
 
--- Porting note: removed @[ext] as the statement is not an equality
+-- Porting note (#11182): removed @[ext] as the statement is not an equality
 -- TODO is there some uniqueness statement for the natural isomorphism in `liftUnique`?
 /-- Two additive functors `Mat_ C ⥤ D` are naturally isomorphic if
 their precompositions with `embedding C` are naturally isomorphic as functors `C ⥤ D`. -/
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
@@ -115,7 +115,7 @@ instance : Category.{v₁} (Mat_ C) where
     simp_rw [Hom.comp, sum_comp, comp_sum, Category.assoc]
     rw [Finset.sum_comm]
 
--- porting note: added because `DMatrix.ext` is not triggered automatically
+-- Porting note: added because `DMatrix.ext` is not triggered automatically
 -- See https://github.com/leanprover-community/mathlib4/issues/5229
 @[ext]
 theorem hom_ext {M N : Mat_ C} (f g : M ⟶ N) (H : ∀ i j, f i j = g i j) : f = g :=
@@ -162,7 +162,7 @@ instance (M N : Mat_ C) : Inhabited (M ⟶ N) :=
 
 end
 
--- porting note: to ease the construction of the preadditive structure, the `AddCommGroup`
+-- Porting note: to ease the construction of the preadditive structure, the `AddCommGroup`
 -- was introduced separately and the lemma `add_apply` was moved upwards
 instance (M N : Mat_ C) : AddCommGroup (M ⟶ N) := by
   change AddCommGroup (DMatrix M.ι N.ι _)
@@ -366,12 +366,12 @@ set_option linter.uppercaseLean3 false in
 
 variable {D : Type u₁} [Category.{v₁} D] [Preadditive D]
 
--- porting note: added because it was not found automatically
+-- Porting note: added because it was not found automatically
 instance (F : Mat_ C ⥤ D) [Functor.Additive F] (M : Mat_ C) :
     HasBiproduct (fun i => F.obj ((embedding C).obj (M.X i))) :=
   F.hasBiproduct_of_preserves _
 
--- porting note: removed the @[simps] attribute as the automatically generated lemmas
+-- Porting note: removed the @[simps] attribute as the automatically generated lemmas
 -- are not very useful; two more useful lemmas have been added just after this
 -- definition in order to ease the proof of `additiveObjIsoBiproduct_naturality`
 /-- Every `M` is a direct sum of objects from `C`, and `F` preserves biproducts. -/
@@ -484,7 +484,7 @@ def liftUnique (F : C ⥤ D) [Functor.Additive F] (L : Mat_ C ⥤ D) [Functor.Ad
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.lift_unique CategoryTheory.Mat_.liftUnique
 
--- porting note: removed @[ext] as the statement is not an equality
+-- Porting note: removed @[ext] as the statement is not an equality
 -- TODO is there some uniqueness statement for the natural isomorphism in `liftUnique`?
 /-- Two additive functors `Mat_ C ⥤ D` are naturally isomorphic if
 their precompositions with `embedding C` are naturally isomorphic as functors `C ⥤ D`. -/
@@ -569,7 +569,7 @@ section
 
 variable {R : Type u} [Semiring R]
 
--- porting note: added because `Matrix.ext` is not triggered automatically
+-- Porting note: added because `Matrix.ext` is not triggered automatically
 -- See https://github.com/leanprover-community/mathlib4/issues/5229
 @[ext]
 theorem hom_ext {X Y : Mat R} (f g : X ⟶ Y) (h : ∀ i j, f i j = g i j) : f = g :=
@@ -659,7 +659,7 @@ def equivalenceSingleObj : Mat R ≌ Mat_ (SingleObj Rᵐᵒᵖ) :=
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat.equivalence_single_obj CategoryTheory.Mat.equivalenceSingleObj
 
--- porting note: added as this was not found automatically
+-- Porting note: added as this was not found automatically
 instance (X Y : Mat R) : AddCommGroup (X ⟶ Y) := by
   change AddCommGroup (Matrix X Y R)
   infer_instance
chore: classify removed @[nolint has_nonempty_instance] porting notes (#10929)

Classifies by adding issue number (#10927) to porting notes claiming removed @[nolint has_nonempty_instance].

Diff
@@ -77,7 +77,7 @@ namespace Mat_
 
 variable {C}
 
--- porting note: removed @[nolint has_nonempty_instance]
+-- porting note (#10927): removed @[nolint has_nonempty_instance]
 /-- A morphism in `Mat_ C` is a dependently typed matrix of morphisms. -/
 def Hom (M N : Mat_ C) : Type v₁ :=
   DMatrix M.ι N.ι fun i j => M.X i ⟶ N.X j
chore: classify added to ease automation porting notes (#10689)
  • Classifies by adding issue number (#10688) to porting notes claiming anything semantically equivalent to added to ease automation.
  • Enforce singular convention converting "porting notes" to "porting note".
Diff
@@ -666,7 +666,7 @@ instance (X Y : Mat R) : AddCommGroup (X ⟶ Y) := by
 
 variable {R}
 
--- porting note: added to ease automation
+-- Porting note (#10688): added to ease automation
 @[simp]
 theorem add_apply {M N : Mat R} (f g : M ⟶ N) (i j) : (f + g) i j = f i j + g i j :=
   rfl
fix: decapitalize names of proof-valued fields (#8509)

Only Prop-values fields should be capitalized, not P-valued fields where P is Prop-valued.

Rather than fixing Nonempty := in constructors, I just deleted the line as the instance can almost always be found automatically.

Diff
@@ -66,12 +66,12 @@ variable (C : Type u₁) [Category.{v₁} C] [Preadditive C]
 -/
 structure Mat_ where
   ι : Type
-  [F : Fintype ι]
+  [fintype : Fintype ι]
   X : ι → C
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_ CategoryTheory.Mat_
 
-attribute [instance] Mat_.F
+attribute [instance] Mat_.fintype
 
 namespace Mat_
 
chore: add missing hypothesis names to by_cases (#8533)

I've also got a change to make this required, but I'd like to land this first.

Diff
@@ -243,11 +243,11 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C) where
               simp at hj
             simp only [eqToHom_refl, dite_eq_ite, ite_true, Category.id_comp, ne_eq,
               Sigma.mk.inj_iff, not_and, id_def]
-            by_cases i' = i
+            by_cases h : i' = i
             · subst h
               rw [dif_pos rfl]
               simp only [heq_eq_eq, true_and]
-              by_cases j' = j
+              by_cases h : j' = j
               · subst h
                 simp
               · rw [dif_neg h, dif_neg (Ne.symm h)]
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

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

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

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

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

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

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

leanprover/lean4#2722

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

leanprover/lean4#2783

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

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

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

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

Diff
@@ -107,8 +107,8 @@ instance : Category.{v₁} (Mat_ C) where
   Hom := Hom
   id := Hom.id
   comp f g := f.comp g
-  id_comp f := by simp [dite_comp]
-  comp_id f := by simp [comp_dite]
+  id_comp f := by simp (config := { unfoldPartialApp := true }) [dite_comp]
+  comp_id f := by simp (config := { unfoldPartialApp := true }) [comp_dite]
   assoc f g h := by
     apply DMatrix.ext
     intros
chore: cleanup some spaces (#7484)

Purely cosmetic PR.

Diff
@@ -252,7 +252,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C) where
                 simp
               · rw [dif_neg h, dif_neg (Ne.symm h)]
             · rw [dif_neg h, dif_neg]
-              tauto ) }
+              tauto) }
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.has_finite_biproducts CategoryTheory.Mat_.hasFiniteBiproducts
 
style: fix wrapping of where (#7149)
Diff
@@ -187,8 +187,8 @@ and so the internal indexing of a biproduct may have nothing to do with the exte
 even though the construction we give uses a sigma type.
 See however `isoBiproductEmbedding`.
 -/
-instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
-    where out n :=
+instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C) where
+  out n :=
     { has_biproduct := fun f =>
         hasBiproduct_of_total
           { pt := ⟨Σ j, (f j).ι, fun p => (f p.1).X p.2⟩
@@ -313,8 +313,8 @@ set_option linter.uppercaseLean3 false in
 
 namespace Embedding
 
-instance : Faithful (embedding C)
-    where map_injective h := congr_fun (congr_fun h PUnit.unit) PUnit.unit
+instance : Faithful (embedding C) where
+  map_injective h := congr_fun (congr_fun h PUnit.unit) PUnit.unit
 
 instance : Full (embedding C) where preimage f := f PUnit.unit PUnit.unit
 
@@ -646,8 +646,8 @@ instance : Faithful (equivalenceSingleObjInverse R) where
 instance : Full (equivalenceSingleObjInverse R) where
   preimage f i j := MulOpposite.op (f i j)
 
-instance : EssSurj (equivalenceSingleObjInverse R)
-    where mem_essImage X :=
+instance : EssSurj (equivalenceSingleObjInverse R) where
+  mem_essImage X :=
     ⟨{  ι := X
         X := fun _ => PUnit.unit }, ⟨eqToIso (by dsimp; cases X; congr)⟩⟩
 
chore: remove unused simps (#6632)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -387,7 +387,6 @@ lemma additiveObjIsoBiproduct_hom_π (F : Mat_ C ⥤ D) [Functor.Additive F] (M
       F.map (M.isoBiproductEmbedding.hom ≫ biproduct.π _ i) := by
   dsimp [additiveObjIsoBiproduct]
   rw [biproduct.lift_π, Category.assoc]
-  dsimp [Functor.mapBiproduct]
   erw [biproduct.lift_π, ← F.map_comp]
   simp
 
refactor(Data/Matrix): Eliminate notation in favor of HMul (#6487)

The main difficulty here is that * has a slightly difference precedence to . notably around smul and neg.

The other annoyance is that ↑U ⬝ A ⬝ ↑U⁻¹ : Matrix m m 𝔸 now has to be written U.val * A * (U⁻¹).val in order to typecheck.

A downside of this change to consider: if you have a goal of A * (B * C) = (A * B) * C, mul_assoc now gives the illusion of matching, when in fact Matrix.mul_assoc is needed. Previously the distinct symbol made it easy to avoid this mistake.

On the flipside, there is now no need to rewrite by Matrix.mul_eq_mul all the time (indeed, the lemma is now removed).

Diff
@@ -561,7 +561,7 @@ open Matrix
 instance (R : Type u) [Semiring R] : Category (Mat R) where
   Hom X Y := Matrix X Y R
   id X := (1 : Matrix X X R)
-  comp f g := f ⬝ g
+  comp {X Y Z} f g := (show Matrix X Y R from f) * (show Matrix Y Z R from g)
   assoc := by intros; simp [Matrix.mul_assoc]
 
 namespace Mat
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
@@ -260,7 +260,7 @@ end Mat_
 
 namespace Functor
 
-variable {C} {D : Type _} [Category.{v₁} D] [Preadditive D]
+variable {C} {D : Type*} [Category.{v₁} D] [Preadditive D]
 
 attribute [local simp] Mat_.id_apply eqToHom_map
 
@@ -287,7 +287,7 @@ set_option linter.uppercaseLean3 false in
 /-- Composite functors induce composite functors on matrix categories.
 -/
 @[simps!]
-def mapMatComp {E : Type _} [Category.{v₁} E] [Preadditive E] (F : C ⥤ D) [Functor.Additive F]
+def mapMatComp {E : Type*} [Category.{v₁} E] [Preadditive E] (F : C ⥤ D) [Functor.Additive F]
     (G : D ⥤ E) [Functor.Additive G] : (F ⋙ G).mapMat_ ≅ F.mapMat_ ⋙ G.mapMat_ :=
   NatIso.ofComponents (fun M => eqToIso (by cases M; rfl)) fun {M N} f => by
     ext
chore: remove simp lemmas about biproducts that expand into sums (#6256)

These simp lemmas were unhelpful, and sometimes create unnecessarily complicated terms.

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

Diff
@@ -429,6 +429,8 @@ theorem additiveObjIsoBiproduct_naturality' (F : Mat_ C ⥤ D) [Functor.Additive
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.additive_obj_iso_biproduct_naturality' CategoryTheory.Mat_.additiveObjIsoBiproduct_naturality'
 
+attribute [local simp] biproduct.lift_desc
+
 /-- Any additive functor `C ⥤ D` to a category `D` with finite biproducts extends to
 a functor `Mat_ C ⥤ D`. -/
 @[simps]
@@ -455,7 +457,6 @@ def embeddingLiftIso (F : C ⥤ D) [Functor.Additive F] : embedding C ⋙ lift F
     (fun X =>
       { hom := biproduct.desc fun _ => 𝟙 (F.obj X)
         inv := biproduct.lift fun _ => 𝟙 (F.obj X) })
-    (by aesop_cat)
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.embedding_lift_iso CategoryTheory.Mat_.embeddingLiftIso
 
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 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison
-
-! This file was ported from Lean 3 source module category_theory.preadditive.Mat
-! leanprover-community/mathlib commit 829895f162a1f29d0133f4b3538f4cd1fb5bffd3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.BigOperators.Basic
 import Mathlib.Algebra.BigOperators.Pi
@@ -19,6 +14,8 @@ import Mathlib.CategoryTheory.FintypeCat
 import Mathlib.CategoryTheory.Preadditive.SingleObj
 import Mathlib.Algebra.Opposites
 
+#align_import category_theory.preadditive.Mat from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3"
+
 /-!
 # Matrices over a category.
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

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

Diff
@@ -386,7 +386,7 @@ set_option linter.uppercaseLean3 false in
 
 @[reassoc (attr := simp)]
 lemma additiveObjIsoBiproduct_hom_π (F : Mat_ C ⥤ D) [Functor.Additive F] (M : Mat_ C) (i : M.ι) :
-    (additiveObjIsoBiproduct F M).hom ≫ biproduct.π _ i  =
+    (additiveObjIsoBiproduct F M).hom ≫ biproduct.π _ i =
       F.map (M.isoBiproductEmbedding.hom ≫ biproduct.π _ i) := by
   dsimp [additiveObjIsoBiproduct]
   rw [biproduct.lift_π, Category.assoc]
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -230,14 +230,14 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
             rintro ⟨i', j'⟩
             rw [Finset.sum_apply, Finset.sum_apply]
             dsimp
-            rw [Finset.sum_eq_single i] ; rotate_left
+            rw [Finset.sum_eq_single i]; rotate_left
             · intro b _ hb
               apply Finset.sum_eq_zero
               intro x _
               rw [dif_neg hb.symm, zero_comp]
             · intro hi
               simp at hi
-            rw [Finset.sum_eq_single j] ; rotate_left
+            rw [Finset.sum_eq_single j]; rotate_left
             · intro b _ hb
               rw [dif_pos rfl, dif_neg, zero_comp]
               simp only
@@ -342,7 +342,7 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     simp only [biproduct.lift_desc]
     funext i j
     dsimp [id_def]
-    rw [Finset.sum_apply, Finset.sum_apply, Finset.sum_eq_single i] ; rotate_left
+    rw [Finset.sum_apply, Finset.sum_apply, Finset.sum_eq_single i]; rotate_left
     · intro b _ hb
       dsimp
       simp only [Finset.sum_const, Finset.card_singleton, one_smul]
chore: fix focusing dots (#5708)

This PR is the result of running

find . -type f -name "*.lean" -exec sed -i -E 's/^( +)\. /\1· /' {} \;
find . -type f -name "*.lean" -exec sed -i -E 'N;s/^( +·)\n +(.*)$/\1 \2/;P;D' {} \;

which firstly replaces . focusing dots with · and secondly removes isolated instances of such dots, unifying them with the following line. A new rule is placed in the style linter to verify this.

Diff
@@ -221,9 +221,9 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
               split_ifs with h h'
               · substs h h'
                 simp only [CategoryTheory.eqToHom_refl, CategoryTheory.Mat_.id_apply_self]
-              . subst h
+              · subst h
                 rw [eqToHom_refl, id_apply_of_ne _ _ _ h']
-              . rfl }
+              · rfl }
           (by
             dsimp
             ext1 ⟨i, j⟩
@@ -231,30 +231,30 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
             rw [Finset.sum_apply, Finset.sum_apply]
             dsimp
             rw [Finset.sum_eq_single i] ; rotate_left
-            . intro b _ hb
+            · intro b _ hb
               apply Finset.sum_eq_zero
               intro x _
               rw [dif_neg hb.symm, zero_comp]
-            . intro hi
+            · intro hi
               simp at hi
             rw [Finset.sum_eq_single j] ; rotate_left
-            . intro b _ hb
+            · intro b _ hb
               rw [dif_pos rfl, dif_neg, zero_comp]
               simp only
               tauto
-            . intro hj
+            · intro hj
               simp at hj
             simp only [eqToHom_refl, dite_eq_ite, ite_true, Category.id_comp, ne_eq,
               Sigma.mk.inj_iff, not_and, id_def]
             by_cases i' = i
-            . subst h
+            · subst h
               rw [dif_pos rfl]
               simp only [heq_eq_eq, true_and]
               by_cases j' = j
-              . subst h
+              · subst h
                 simp
-              . rw [dif_neg h, dif_neg (Ne.symm h)]
-            . rw [dif_neg h, dif_neg]
+              · rw [dif_neg h, dif_neg (Ne.symm h)]
+            · rw [dif_neg h, dif_neg]
               tauto ) }
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.has_finite_biproducts CategoryTheory.Mat_.hasFiniteBiproducts
@@ -343,11 +343,11 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     funext i j
     dsimp [id_def]
     rw [Finset.sum_apply, Finset.sum_apply, Finset.sum_eq_single i] ; rotate_left
-    . intro b _ hb
+    · intro b _ hb
       dsimp
       simp only [Finset.sum_const, Finset.card_singleton, one_smul]
       rw [dif_neg hb.symm, zero_comp]
-    . intro h
+    · intro h
       simp at h
     simp
   inv_hom_id := by
@@ -361,9 +361,9 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     simp only [embedding, comp_apply, comp_dite, dite_comp, comp_zero, zero_comp,
       Finset.sum_dite_eq', Finset.mem_univ, ite_true, eqToHom_refl, Category.comp_id]
     split_ifs with h
-    . subst h
+    · subst h
       simp
-    . rfl
+    · rfl
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.iso_biproduct_embedding CategoryTheory.Mat_.isoBiproductEmbedding
 
@@ -442,8 +442,8 @@ def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D where
     dsimp
     ext i j
     by_cases h : j = i
-    . subst h; simp
-    . simp [h]
+    · subst h; simp
+    · simp [h]
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.lift CategoryTheory.Mat_.lift
 
feat: more consistent use of ext, and updating porting notes. (#5242)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -119,6 +119,7 @@ instance : Category.{v₁} (Mat_ C) where
     rw [Finset.sum_comm]
 
 -- porting note: added because `DMatrix.ext` is not triggered automatically
+-- See https://github.com/leanprover-community/mathlib4/issues/5229
 @[ext]
 theorem hom_ext {M N : Mat_ C} (f g : M ⟶ N) (H : ∀ i j, f i j = g i j) : f = g :=
   DMatrix.ext_iff.mp H
@@ -408,11 +409,11 @@ theorem additiveObjIsoBiproduct_naturality (F : Mat_ C ⥤ D) [Functor.Additive
     F.map f ≫ (additiveObjIsoBiproduct F N).hom =
       (additiveObjIsoBiproduct F M).hom ≫
         biproduct.matrix fun i j => F.map ((embedding C).map (f i j)) := by
-  refine' biproduct.hom_ext _ _ (fun i => _)
+  ext i : 1
   simp only [Category.assoc, additiveObjIsoBiproduct_hom_π, isoBiproductEmbedding_hom,
     embedding_obj_ι, embedding_obj_X, biproduct.lift_π, biproduct.matrix_π,
     ← cancel_epi (additiveObjIsoBiproduct F M).inv, Iso.inv_hom_id_assoc]
-  refine' biproduct.hom_ext' _ _ (fun j => _)
+  ext j : 1
   simp only [ι_additiveObjIsoBiproduct_inv_assoc, isoBiproductEmbedding_inv,
     biproduct.ι_desc, ← F.map_comp]
   congr 1
@@ -440,7 +441,7 @@ def lift (F : C ⥤ D) [Functor.Additive F] : Mat_ C ⥤ D where
   map_id X := by
     dsimp
     ext i j
-    by_cases h : i = j
+    by_cases h : j = i
     . subst h; simp
     . simp [h]
 set_option linter.uppercaseLean3 false in
@@ -572,6 +573,7 @@ section
 variable {R : Type u} [Semiring R]
 
 -- porting note: added because `Matrix.ext` is not triggered automatically
+-- See https://github.com/leanprover-community/mathlib4/issues/5229
 @[ext]
 theorem hom_ext {X Y : Mat R} (f g : X ⟶ Y) (h : ∀ i j, f i j = g i j) : f = g :=
   Matrix.ext_iff.mp h
chore: bump Std4 (#5219)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -208,11 +208,7 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C)
               substs h h'
               rfl
             ι_π := fun j j' => by
-              -- porting note: it was `ext (x y)`; it seems that when it uses a given
-              -- ext lemma, the mathlib4 `ext` tactic is not able to introduce
-              -- more than one named variable?
-              ext x
-              intro y
+              ext x y
               dsimp
               simp_rw [dite_comp, comp_dite]
               simp only [ite_self, dite_eq_ite, dif_ctx_congr, Limits.comp_zero, Limits.zero_comp,
@@ -312,8 +308,8 @@ namespace Mat_
 def embedding : C ⥤ Mat_ C where
   obj X := ⟨PUnit, fun _ => X⟩
   map f _ _ := f
-  map_id _ := by ext ⟨⟩; rintro ⟨⟩; simp
-  map_comp _ _ := by ext ⟨⟩; rintro ⟨⟩ ; simp
+  map_id _ := by ext ⟨⟩; simp
+  map_comp _ _ := by ext ⟨⟩; simp
 set_option linter.uppercaseLean3 false in
 #align category_theory.Mat_.embedding CategoryTheory.Mat_.embedding
 
@@ -360,8 +356,7 @@ def isoBiproductEmbedding (M : Mat_ C) : M ≅ ⨁ fun i => (embedding C).obj (M
     intro j
     simp only [Category.id_comp, Category.assoc, biproduct.lift_π, biproduct.ι_desc_assoc,
       biproduct.ι_π]
-    ext ⟨⟩
-    rintro ⟨⟩
+    ext ⟨⟩ ⟨⟩
     simp only [embedding, comp_apply, comp_dite, dite_comp, comp_zero, zero_comp,
       Finset.sum_dite_eq', Finset.mem_univ, ite_true, eqToHom_refl, Category.comp_id]
     split_ifs with h
feat: port CategoryTheory.Preadditive.Mat (#4796)

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

Dependencies 8 + 483

484 files ported (98.4%)
190155 lines ported (98.4%)
Show graph

The unported dependencies are