category_theory.punitMathlib.CategoryTheory.PUnit

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2018 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Bhavik Mehta
 -/
-import Mathbin.CategoryTheory.Functor.Const
-import Mathbin.CategoryTheory.DiscreteCategory
+import CategoryTheory.Functor.Const
+import CategoryTheory.DiscreteCategory
 
 #align_import category_theory.punit from "leanprover-community/mathlib"@"23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2018 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Bhavik Mehta
-
-! This file was ported from Lean 3 source module category_theory.punit
-! leanprover-community/mathlib commit 23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.CategoryTheory.Functor.Const
 import Mathbin.CategoryTheory.DiscreteCategory
 
+#align_import category_theory.punit from "leanprover-community/mathlib"@"23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6"
+
 /-!
 # The category `discrete punit`
 
Diff
@@ -50,12 +50,14 @@ def punitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
 #align category_theory.functor.punit_ext CategoryTheory.Functor.punitExt
 -/
 
+#print CategoryTheory.Functor.punit_ext' /-
 /-- Any two functors to `discrete punit` are *equal*.
 You probably want to use `punit_ext` instead of this.
 -/
 theorem punit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
   Functor.ext (fun _ => by decide) fun _ _ _ => by decide
 #align category_theory.functor.punit_ext' CategoryTheory.Functor.punit_ext'
+-/
 
 #print CategoryTheory.Functor.fromPUnit /-
 /-- The functor from `discrete punit` sending everything to the given object. -/
@@ -64,6 +66,7 @@ abbrev fromPUnit (X : C) : Discrete PUnit.{v + 1} ⥤ C :=
 #align category_theory.functor.from_punit CategoryTheory.Functor.fromPUnit
 -/
 
+#print CategoryTheory.Functor.equiv /-
 /-- Functors from `discrete punit` are equivalent to the category itself. -/
 @[simps]
 def equiv : Discrete PUnit ⥤ C ≌ C
@@ -86,10 +89,12 @@ def equiv : Discrete PUnit ⥤ C ≌ C
     intro X Y f
     dsimp; simp
 #align category_theory.functor.equiv CategoryTheory.Functor.equiv
+-/
 
 -- See note [dsimp, simp].
 end Functor
 
+#print CategoryTheory.equiv_punit_iff_unique /-
 /-- A category being equivalent to `punit` is equivalent to it having a unique morphism between
   any two objects. (In fact, such a category is also a groupoid; see `groupoid.of_hom_unique`) -/
 theorem equiv_punit_iff_unique :
@@ -121,6 +126,7 @@ theorem equiv_punit_iff_unique :
             inv := default })
         fun _ _ _ => by tidy
 #align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_punit_iff_unique
+-/
 
 end CategoryTheory
 
Diff
@@ -42,20 +42,20 @@ def star : C ⥤ Discrete PUnit :=
 
 variable {C}
 
-#print CategoryTheory.Functor.pUnitExt /-
+#print CategoryTheory.Functor.punitExt /-
 /-- Any two functors to `discrete punit` are isomorphic. -/
 @[simps]
-def pUnitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
+def punitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
   NatIso.ofComponents (fun _ => eqToIso (by decide)) fun _ _ _ => by decide
-#align category_theory.functor.punit_ext CategoryTheory.Functor.pUnitExt
+#align category_theory.functor.punit_ext CategoryTheory.Functor.punitExt
 -/
 
 /-- Any two functors to `discrete punit` are *equal*.
 You probably want to use `punit_ext` instead of this.
 -/
-theorem pUnit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
+theorem punit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
   Functor.ext (fun _ => by decide) fun _ _ _ => by decide
-#align category_theory.functor.punit_ext' CategoryTheory.Functor.pUnit_ext'
+#align category_theory.functor.punit_ext' CategoryTheory.Functor.punit_ext'
 
 #print CategoryTheory.Functor.fromPUnit /-
 /-- The functor from `discrete punit` sending everything to the given object. -/
@@ -92,7 +92,7 @@ end Functor
 
 /-- A category being equivalent to `punit` is equivalent to it having a unique morphism between
   any two objects. (In fact, such a category is also a groupoid; see `groupoid.of_hom_unique`) -/
-theorem equiv_pUnit_iff_unique :
+theorem equiv_punit_iff_unique :
     Nonempty (C ≌ Discrete PUnit) ↔ Nonempty C ∧ ∀ x y : C, Nonempty <| Unique (x ⟶ y) :=
   by
   constructor
@@ -120,7 +120,7 @@ theorem equiv_pUnit_iff_unique :
           { Hom := default
             inv := default })
         fun _ _ _ => by tidy
-#align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_pUnit_iff_unique
+#align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_punit_iff_unique
 
 end CategoryTheory
 
Diff
@@ -50,12 +50,6 @@ def pUnitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
 #align category_theory.functor.punit_ext CategoryTheory.Functor.pUnitExt
 -/
 
-/- warning: category_theory.functor.punit_ext' -> CategoryTheory.Functor.pUnit_ext' is a dubious translation:
-lean 3 declaration is
-  forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (F : CategoryTheory.Functor.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3})) (G : CategoryTheory.Functor.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3})), Eq.{succ (max u1 u2 u3)} (CategoryTheory.Functor.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3})) F G
-but is expected to have type
-  forall {C : Type.{u3}} [_inst_1 : CategoryTheory.Category.{u2, u3} C] (F : CategoryTheory.Functor.{u2, u1, u3, u1} C _inst_1 (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1})) (G : CategoryTheory.Functor.{u2, u1, u3, u1} C _inst_1 (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1})), Eq.{max (max (succ u3) (succ u2)) (succ u1)} (CategoryTheory.Functor.{u2, u1, u3, u1} C _inst_1 (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1})) F G
-Case conversion may be inaccurate. Consider using '#align category_theory.functor.punit_ext' CategoryTheory.Functor.pUnit_ext'ₓ'. -/
 /-- Any two functors to `discrete punit` are *equal*.
 You probably want to use `punit_ext` instead of this.
 -/
@@ -70,12 +64,6 @@ abbrev fromPUnit (X : C) : Discrete PUnit.{v + 1} ⥤ C :=
 #align category_theory.functor.from_punit CategoryTheory.Functor.fromPUnit
 -/
 
-/- warning: category_theory.functor.equiv -> CategoryTheory.Functor.equiv is a dubious translation:
-lean 3 declaration is
-  forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Equivalence.{max u3 u1, u1, max u3 u1 u3 u2, u2} (CategoryTheory.Functor.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) (CategoryTheory.Functor.category.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) C _inst_1
-but is expected to have type
-  forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Equivalence.{max u1 u3, u1, max (max (max u2 u3) u1) u3, u2} (CategoryTheory.Functor.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) C (CategoryTheory.Functor.category.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) _inst_1
-Case conversion may be inaccurate. Consider using '#align category_theory.functor.equiv CategoryTheory.Functor.equivₓ'. -/
 /-- Functors from `discrete punit` are equivalent to the category itself. -/
 @[simps]
 def equiv : Discrete PUnit ⥤ C ≌ C
@@ -102,12 +90,6 @@ def equiv : Discrete PUnit ⥤ C ≌ C
 -- See note [dsimp, simp].
 end Functor
 
-/- warning: category_theory.equiv_punit_iff_unique -> CategoryTheory.equiv_pUnit_iff_unique is a dubious translation:
-lean 3 declaration is
-  forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C], Iff (Nonempty.{max (succ u2) (succ u1) (succ u3)} (CategoryTheory.Equivalence.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}))) (And (Nonempty.{succ u2} C) (forall (x : C) (y : C), Nonempty.{succ u1} (Unique.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) x y))))
-but is expected to have type
-  forall (C : Type.{u3}) [_inst_1 : CategoryTheory.Category.{u2, u3} C], Iff (Nonempty.{max (max (succ u1) (succ u3)) (succ u2)} (CategoryTheory.Equivalence.{u2, u1, u3, u1} C (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) _inst_1 (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1}))) (And (Nonempty.{succ u3} C) (forall (x : C) (y : C), Nonempty.{succ u2} (Unique.{succ u2} (Quiver.Hom.{succ u2, u3} C (CategoryTheory.CategoryStruct.toQuiver.{u2, u3} C (CategoryTheory.Category.toCategoryStruct.{u2, u3} C _inst_1)) x y))))
-Case conversion may be inaccurate. Consider using '#align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_pUnit_iff_uniqueₓ'. -/
 /-- A category being equivalent to `punit` is equivalent to it having a unique morphism between
   any two objects. (In fact, such a category is also a groupoid; see `groupoid.of_hom_unique`) -/
 theorem equiv_pUnit_iff_unique :
Diff
@@ -116,20 +116,16 @@ theorem equiv_pUnit_iff_unique :
   constructor
   · rintro ⟨h⟩
     refine' ⟨⟨h.inverse.obj ⟨⟨⟩⟩⟩, fun x y => Nonempty.intro _⟩
-    apply uniqueOfSubsingleton _
-    swap
+    apply uniqueOfSubsingleton _; swap
     · have hx : x ⟶ h.inverse.obj ⟨⟨⟩⟩ := by convert h.unit.app x
       have hy : h.inverse.obj ⟨⟨⟩⟩ ⟶ y := by convert h.unit_inv.app y
       exact hx ≫ hy
-    have : ∀ z, z = h.unit.app x ≫ (h.functor ⋙ h.inverse).map z ≫ h.unit_inv.app y :=
-      by
-      intro z
+    have : ∀ z, z = h.unit.app x ≫ (h.functor ⋙ h.inverse).map z ≫ h.unit_inv.app y := by intro z;
       simpa using congr_arg (· ≫ h.unit_inv.app y) (h.unit.naturality z)
     apply Subsingleton.intro
     intro a b
     rw [this a, this b]
-    simp only [functor.comp_map]
-    congr
+    simp only [functor.comp_map]; congr
   · rintro ⟨⟨p⟩, h⟩
     haveI := fun x y => (h x y).some
     refine'
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Bhavik Mehta
 
 ! This file was ported from Lean 3 source module category_theory.punit
-! leanprover-community/mathlib commit c9c9fa15fec7ca18e9ec97306fb8764bfe988a7e
+! leanprover-community/mathlib commit 23aa88e32dcc9d2a24cca7bc23268567ed4cd7d6
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.CategoryTheory.DiscreteCategory
 /-!
 # The category `discrete punit`
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 We define `star : C ⥤ discrete punit` sending everything to `punit.star`,
 show that any two functors to `discrete punit` are naturally isomorphic,
 and construct the equivalence `(discrete punit ⥤ C) ≌ C`.
Diff
@@ -29,20 +29,30 @@ variable (C : Type u) [Category.{v} C]
 
 namespace Functor
 
+#print CategoryTheory.Functor.star /-
 /-- The constant functor sending everything to `punit.star`. -/
 @[simps]
 def star : C ⥤ Discrete PUnit :=
   (Functor.const _).obj ⟨⟨⟩⟩
 #align category_theory.functor.star CategoryTheory.Functor.star
+-/
 
 variable {C}
 
+#print CategoryTheory.Functor.pUnitExt /-
 /-- Any two functors to `discrete punit` are isomorphic. -/
 @[simps]
-def punitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
+def pUnitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
   NatIso.ofComponents (fun _ => eqToIso (by decide)) fun _ _ _ => by decide
-#align category_theory.functor.punit_ext CategoryTheory.Functor.punitExt
+#align category_theory.functor.punit_ext CategoryTheory.Functor.pUnitExt
+-/
 
+/- warning: category_theory.functor.punit_ext' -> CategoryTheory.Functor.pUnit_ext' is a dubious translation:
+lean 3 declaration is
+  forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C] (F : CategoryTheory.Functor.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3})) (G : CategoryTheory.Functor.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3})), Eq.{succ (max u1 u2 u3)} (CategoryTheory.Functor.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3})) F G
+but is expected to have type
+  forall {C : Type.{u3}} [_inst_1 : CategoryTheory.Category.{u2, u3} C] (F : CategoryTheory.Functor.{u2, u1, u3, u1} C _inst_1 (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1})) (G : CategoryTheory.Functor.{u2, u1, u3, u1} C _inst_1 (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1})), Eq.{max (max (succ u3) (succ u2)) (succ u1)} (CategoryTheory.Functor.{u2, u1, u3, u1} C _inst_1 (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1})) F G
+Case conversion may be inaccurate. Consider using '#align category_theory.functor.punit_ext' CategoryTheory.Functor.pUnit_ext'ₓ'. -/
 /-- Any two functors to `discrete punit` are *equal*.
 You probably want to use `punit_ext` instead of this.
 -/
@@ -50,11 +60,19 @@ theorem pUnit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
   Functor.ext (fun _ => by decide) fun _ _ _ => by decide
 #align category_theory.functor.punit_ext' CategoryTheory.Functor.pUnit_ext'
 
+#print CategoryTheory.Functor.fromPUnit /-
 /-- The functor from `discrete punit` sending everything to the given object. -/
-abbrev fromPunit (X : C) : Discrete PUnit.{v + 1} ⥤ C :=
+abbrev fromPUnit (X : C) : Discrete PUnit.{v + 1} ⥤ C :=
   (Functor.const _).obj X
-#align category_theory.functor.from_punit CategoryTheory.Functor.fromPunit
+#align category_theory.functor.from_punit CategoryTheory.Functor.fromPUnit
+-/
 
+/- warning: category_theory.functor.equiv -> CategoryTheory.Functor.equiv is a dubious translation:
+lean 3 declaration is
+  forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Equivalence.{max u3 u1, u1, max u3 u1 u3 u2, u2} (CategoryTheory.Functor.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) (CategoryTheory.Functor.category.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) C _inst_1
+but is expected to have type
+  forall {C : Type.{u2}} [_inst_1 : CategoryTheory.Category.{u1, u2} C], CategoryTheory.Equivalence.{max u1 u3, u1, max (max (max u2 u3) u1) u3, u2} (CategoryTheory.Functor.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) C (CategoryTheory.Functor.category.{u3, u1, u3, u2} (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}) C _inst_1) _inst_1
+Case conversion may be inaccurate. Consider using '#align category_theory.functor.equiv CategoryTheory.Functor.equivₓ'. -/
 /-- Functors from `discrete punit` are equivalent to the category itself. -/
 @[simps]
 def equiv : Discrete PUnit ⥤ C ≌ C
@@ -81,6 +99,12 @@ def equiv : Discrete PUnit ⥤ C ≌ C
 -- See note [dsimp, simp].
 end Functor
 
+/- warning: category_theory.equiv_punit_iff_unique -> CategoryTheory.equiv_pUnit_iff_unique is a dubious translation:
+lean 3 declaration is
+  forall (C : Type.{u2}) [_inst_1 : CategoryTheory.Category.{u1, u2} C], Iff (Nonempty.{max (succ u2) (succ u1) (succ u3)} (CategoryTheory.Equivalence.{u1, u3, u2, u3} C _inst_1 (CategoryTheory.Discrete.{u3} PUnit.{succ u3}) (CategoryTheory.discreteCategory.{u3} PUnit.{succ u3}))) (And (Nonempty.{succ u2} C) (forall (x : C) (y : C), Nonempty.{succ u1} (Unique.{succ u1} (Quiver.Hom.{succ u1, u2} C (CategoryTheory.CategoryStruct.toQuiver.{u1, u2} C (CategoryTheory.Category.toCategoryStruct.{u1, u2} C _inst_1)) x y))))
+but is expected to have type
+  forall (C : Type.{u3}) [_inst_1 : CategoryTheory.Category.{u2, u3} C], Iff (Nonempty.{max (max (succ u1) (succ u3)) (succ u2)} (CategoryTheory.Equivalence.{u2, u1, u3, u1} C (CategoryTheory.Discrete.{u1} PUnit.{succ u1}) _inst_1 (CategoryTheory.discreteCategory.{u1} PUnit.{succ u1}))) (And (Nonempty.{succ u3} C) (forall (x : C) (y : C), Nonempty.{succ u2} (Unique.{succ u2} (Quiver.Hom.{succ u2, u3} C (CategoryTheory.CategoryStruct.toQuiver.{u2, u3} C (CategoryTheory.Category.toCategoryStruct.{u2, u3} C _inst_1)) x y))))
+Case conversion may be inaccurate. Consider using '#align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_pUnit_iff_uniqueₓ'. -/
 /-- A category being equivalent to `punit` is equivalent to it having a unique morphism between
   any two objects. (In fact, such a category is also a groupoid; see `groupoid.of_hom_unique`) -/
 theorem equiv_pUnit_iff_unique :

Changes in mathlib4

mathlib3
mathlib4
chore: classify simp can prove porting notes (#10930)

Classify by adding issue number (#10618) to porting notes claiming anything semantically equivalent to

  • "simp can prove this"
  • "simp can simplify this`"
  • "was @[simp], now can be proved by simp"
  • "was @[simp], but simp can prove it"
  • "removed simp attribute as the equality can already be obtained by simp"
  • "simp can already prove this"
  • "simp already proves this"
  • "simp can prove these"
Diff
@@ -31,7 +31,7 @@ namespace Functor
 def star : C ⥤ Discrete PUnit.{w + 1} :=
   (Functor.const _).obj ⟨⟨⟩⟩
 #align category_theory.functor.star CategoryTheory.Functor.star
--- Porting note: simp can simplify this
+-- Porting note (#10618): simp can simplify this
 attribute [nolint simpNF] star_map_down_down
 variable {C}
 
fix: attribute [simp] ... in -> attribute [local simp] ... in (#7678)

Mathlib.Logic.Unique contains the line attribute [simp] eq_iff_true_of_subsingleton in ...:

https://github.com/leanprover-community/mathlib4/blob/96a11c7aac574c00370c2b3dab483cb676405c5d/Mathlib/Logic/Unique.lean#L255-L256

Despite what the in part may imply, this adds the lemma to the simp set "globally", including for downstream files; it is likely that attribute [local simp] eq_iff_true_of_subsingleton in ... was meant instead (or maybe scoped simp, but I think "scoped" refers to the current namespace). Indeed, the relevant lemma is not marked with @[simp] for possible slowness: https://github.com/leanprover/std4/blob/846e9e1d6bb534774d1acd2dc430e70987da3c18/Std/Logic.lean#L749. Adding it to the simp set causes the example at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Regression.20in.20simp to slow down.

This PR changes this and fixes the relevant downstream simps. There was also one ocurrence of attribute [simp] FullSubcategory.comp_def FullSubcategory.id_def in in Mathlib.CategoryTheory.Monoidal.Subcategory but that was much easier to fix.

https://github.com/leanprover-community/mathlib4/blob/bc49eb9ba756a233370b4b68bcdedd60402f71ed/Mathlib/CategoryTheory/Monoidal/Subcategory.lean#L118-L119

Diff
@@ -89,7 +89,7 @@ theorem equiv_punit_iff_unique :
     simp only [Functor.comp_map]
     congr 3
     apply ULift.ext
-    simp
+    simp [eq_iff_true_of_subsingleton]
   · rintro ⟨⟨p⟩, h⟩
     haveI := fun x y => (h x y).some
     refine'
refactor: move morphisms in StructuredArrow to a lower universe (#6397)

This PR changes the definition

abbrev fromPUnit (X : C) : Discrete PUnit.{v + 1} ⥤ C :=
  (Functor.const _).obj X

to

abbrev fromPUnit (X : C) : Discrete PUnit.{w + 1} ⥤ C :=
  (Functor.const _).obj X

and then redefines

def StructuredArrow (S : D) (T : C ⥤ D) :=
  Comma (Functor.fromPUnit S) T

to

def StructuredArrow (S : D) (T : C ⥤ D) :=
  Comma (Functor.fromPUnit.{0} S) T

The effect of this is that given {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] (S : D) (T : C ⥤ D), the morphisms of StructuredArrow S T no longer live in max v₁ v₂, but in v₁, as they should. Thus, this PR is basically a better version of #6388.

My guess for why we used to have the larger universe is that back in the day, the universes for limits were much more restricted, so stating the results of Limits/Comma.lean was not possible if the morphisms of StructuredArrow live in v₁. Luckily, by now it is possible to state everything correctly, and this PR adjusts Limits/Comma.lean and Limits/Over.lean accordingly.

Diff
@@ -17,7 +17,7 @@ and construct the equivalence `(Discrete PUnit ⥤ C) ≌ C`.
 -/
 
 
-universe v u
+universe w v u
 
 -- morphism levels before object levels. See note [CategoryTheory universes].
 namespace CategoryTheory
@@ -28,7 +28,7 @@ namespace Functor
 
 /-- The constant functor sending everything to `PUnit.star`. -/
 @[simps!]
-def star : C ⥤ Discrete PUnit :=
+def star : C ⥤ Discrete PUnit.{w + 1} :=
   (Functor.const _).obj ⟨⟨⟩⟩
 #align category_theory.functor.star CategoryTheory.Functor.star
 -- Porting note: simp can simplify this
@@ -37,7 +37,7 @@ variable {C}
 
 /-- Any two functors to `Discrete PUnit` are isomorphic. -/
 @[simps!]
-def punitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
+def punitExt (F G : C ⥤ Discrete PUnit.{w + 1}) : F ≅ G :=
   NatIso.ofComponents fun X => eqToIso (by simp only [eq_iff_true_of_subsingleton])
 #align category_theory.functor.punit_ext CategoryTheory.Functor.punitExt
 -- Porting note: simp does indeed fire for these despite the linter warning
@@ -45,18 +45,18 @@ attribute [nolint simpNF] punitExt_hom_app_down_down punitExt_inv_app_down_down
 
 /-- Any two functors to `Discrete PUnit` are *equal*.
 You probably want to use `punitExt` instead of this. -/
-theorem punit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
+theorem punit_ext' (F G : C ⥤ Discrete PUnit.{w + 1}) : F = G :=
   Functor.ext fun X => by simp only [eq_iff_true_of_subsingleton]
 #align category_theory.functor.punit_ext' CategoryTheory.Functor.punit_ext'
 
 /-- The functor from `Discrete PUnit` sending everything to the given object. -/
-abbrev fromPUnit (X : C) : Discrete PUnit.{v + 1} ⥤ C :=
+abbrev fromPUnit (X : C) : Discrete PUnit.{w + 1} ⥤ C :=
   (Functor.const _).obj X
 #align category_theory.functor.from_punit CategoryTheory.Functor.fromPUnit
 
 /-- Functors from `Discrete PUnit` are equivalent to the category itself. -/
 @[simps]
-def equiv : Discrete PUnit ⥤ C ≌ C where
+def equiv : Discrete PUnit.{w + 1} ⥤ C ≌ C where
   functor :=
     { obj := fun F => F.obj ⟨⟨⟩⟩
       map := fun θ => θ.app ⟨⟨⟩⟩ }
@@ -71,7 +71,7 @@ end Functor
   any two objects. (In fact, such a category is also a groupoid;
   see `CategoryTheory.Groupoid.ofHomUnique`) -/
 theorem equiv_punit_iff_unique :
-    Nonempty (C ≌ Discrete PUnit) ↔ Nonempty C ∧ ∀ x y : C, Nonempty <| Unique (x ⟶ y) := by
+    Nonempty (C ≌ Discrete PUnit.{w + 1}) ↔ Nonempty C ∧ ∀ x y : C, Nonempty <| Unique (x ⟶ y) := by
   constructor
   · rintro ⟨h⟩
     refine' ⟨⟨h.inverse.obj ⟨⟨⟩⟩⟩, fun x y => Nonempty.intro _⟩
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2018 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Scott Morrison, Bhavik Mehta
-
-! This file was ported from Lean 3 source module category_theory.punit
-! leanprover-community/mathlib commit 2738d2ca56cbc63be80c3bd48e9ed90ad94e947d
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.CategoryTheory.Functor.Const
 import Mathlib.CategoryTheory.DiscreteCategory
 
+#align_import category_theory.punit from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"
+
 /-!
 # The category `Discrete PUnit`
 
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
@@ -78,11 +78,11 @@ theorem equiv_punit_iff_unique :
   constructor
   · rintro ⟨h⟩
     refine' ⟨⟨h.inverse.obj ⟨⟨⟩⟩⟩, fun x y => Nonempty.intro _⟩
-    let f : x ⟶  y := by
+    let f : x ⟶ y := by
       have hx : x ⟶ h.inverse.obj ⟨⟨⟩⟩ := by convert h.unit.app x
       have hy : h.inverse.obj ⟨⟨⟩⟩ ⟶ y := by convert h.unitInv.app y
       exact hx ≫ hy
-    suffices sub : Subsingleton (x ⟶  y) from uniqueOfSubsingleton f
+    suffices sub : Subsingleton (x ⟶ y) from uniqueOfSubsingleton f
     have : ∀ z, z = h.unit.app x ≫ (h.functor ⋙ h.inverse).map z ≫ h.unitInv.app y := by
       intro z
       simp [congrArg (· ≫ h.unitInv.app y) (h.unit.naturality z)]
chore: tidy various files (#4997)
Diff
@@ -40,17 +40,17 @@ variable {C}
 
 /-- Any two functors to `Discrete PUnit` are isomorphic. -/
 @[simps!]
-def pUnitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
+def punitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
   NatIso.ofComponents fun X => eqToIso (by simp only [eq_iff_true_of_subsingleton])
-#align category_theory.functor.punit_ext CategoryTheory.Functor.pUnitExt
+#align category_theory.functor.punit_ext CategoryTheory.Functor.punitExt
 -- Porting note: simp does indeed fire for these despite the linter warning
-attribute [nolint simpNF] pUnitExt_hom_app_down_down pUnitExt_inv_app_down_down
+attribute [nolint simpNF] punitExt_hom_app_down_down punitExt_inv_app_down_down
 
 /-- Any two functors to `Discrete PUnit` are *equal*.
-You probably want to use `pUnitExt` instead of this. -/
-theorem pUnit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
+You probably want to use `punitExt` instead of this. -/
+theorem punit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
   Functor.ext fun X => by simp only [eq_iff_true_of_subsingleton]
-#align category_theory.functor.punit_ext' CategoryTheory.Functor.pUnit_ext'
+#align category_theory.functor.punit_ext' CategoryTheory.Functor.punit_ext'
 
 /-- The functor from `Discrete PUnit` sending everything to the given object. -/
 abbrev fromPUnit (X : C) : Discrete PUnit.{v + 1} ⥤ C :=
@@ -73,7 +73,7 @@ end Functor
 /-- A category being equivalent to `PUnit` is equivalent to it having a unique morphism between
   any two objects. (In fact, such a category is also a groupoid;
   see `CategoryTheory.Groupoid.ofHomUnique`) -/
-theorem equiv_pUnit_iff_unique :
+theorem equiv_punit_iff_unique :
     Nonempty (C ≌ Discrete PUnit) ↔ Nonempty C ∧ ∀ x y : C, Nonempty <| Unique (x ⟶ y) := by
   constructor
   · rintro ⟨h⟩
@@ -98,11 +98,11 @@ theorem equiv_pUnit_iff_unique :
     refine'
       Nonempty.intro
         (CategoryTheory.Equivalence.mk ((Functor.const _).obj ⟨⟨⟩⟩)
-          ((@Functor.const <| Discrete PUnit).obj p) ?_ (by apply Functor.pUnitExt))
+          ((@Functor.const <| Discrete PUnit).obj p) ?_ (by apply Functor.punitExt))
     exact
       NatIso.ofComponents fun _ =>
         { hom := default
           inv := default }
-#align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_pUnit_iff_unique
+#align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_punit_iff_unique
 
 end CategoryTheory
chore: review of automation in category theory (#4793)

Clean up of automation in the category theory library. Leaving out unnecessary proof steps, or fields done by aesop_cat, and making more use of available autoparameters.

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

Diff
@@ -40,20 +40,16 @@ variable {C}
 
 /-- Any two functors to `Discrete PUnit` are isomorphic. -/
 @[simps!]
-def pUnitExt (F G : C ⥤ Discrete PUnit) : F ≅ G := by
-  refine NatIso.ofComponents (fun X => eqToIso ?_) fun {X} {Y} f => ?_
-  · simp only [eq_iff_true_of_subsingleton]
-  · aesop_cat
+def pUnitExt (F G : C ⥤ Discrete PUnit) : F ≅ G :=
+  NatIso.ofComponents fun X => eqToIso (by simp only [eq_iff_true_of_subsingleton])
 #align category_theory.functor.punit_ext CategoryTheory.Functor.pUnitExt
 -- Porting note: simp does indeed fire for these despite the linter warning
 attribute [nolint simpNF] pUnitExt_hom_app_down_down pUnitExt_inv_app_down_down
 
 /-- Any two functors to `Discrete PUnit` are *equal*.
 You probably want to use `pUnitExt` instead of this. -/
-theorem pUnit_ext' (F G : C ⥤ Discrete PUnit) : F = G := by
-  refine Functor.ext (fun X => ?_) fun {X} {Y} f => ?_
-  · simp only [eq_iff_true_of_subsingleton]
-  · aesop_cat
+theorem pUnit_ext' (F G : C ⥤ Discrete PUnit) : F = G :=
+  Functor.ext fun X => by simp only [eq_iff_true_of_subsingleton]
 #align category_theory.functor.punit_ext' CategoryTheory.Functor.pUnit_ext'
 
 /-- The functor from `Discrete PUnit` sending everything to the given object. -/
@@ -68,22 +64,10 @@ def equiv : Discrete PUnit ⥤ C ≌ C where
     { obj := fun F => F.obj ⟨⟨⟩⟩
       map := fun θ => θ.app ⟨⟨⟩⟩ }
   inverse := Functor.const _
-  unitIso := by
-    apply NatIso.ofComponents _ _
-    intro X
-    apply Discrete.natIso
-    rintro ⟨⟨⟩⟩
-    apply Iso.refl _
-    intros
-    ext ⟨⟨⟩⟩
-    simp
-  counitIso := by
-    refine' NatIso.ofComponents Iso.refl _
-    intro X Y f
-    dsimp; simp
+  unitIso := NatIso.ofComponents fun X => Discrete.natIso fun i => Iso.refl _
+  counitIso := NatIso.ofComponents Iso.refl
 #align category_theory.functor.equiv CategoryTheory.Functor.equiv
 
--- See note [dsimp, simp].
 end Functor
 
 /-- A category being equivalent to `PUnit` is equivalent to it having a unique morphism between
@@ -116,11 +100,9 @@ theorem equiv_pUnit_iff_unique :
         (CategoryTheory.Equivalence.mk ((Functor.const _).obj ⟨⟨⟩⟩)
           ((@Functor.const <| Discrete PUnit).obj p) ?_ (by apply Functor.pUnitExt))
     exact
-      NatIso.ofComponents
-        (fun _ =>
-          { hom := default
-            inv := default })
-        fun {X} {Y} f => by aesop_cat
+      NatIso.ofComponents fun _ =>
+        { hom := default
+          inv := default }
 #align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_pUnit_iff_unique
 
 end CategoryTheory
chore: strip trailing spaces in lean files (#2828)

vscode is already configured by .vscode/settings.json to trim these on save. It's not clear how they've managed to stick around.

By doing this all in one PR now, it avoids getting random whitespace diffs in PRs later.

This was done with a regex search in vscode,

image

Diff
@@ -30,28 +30,28 @@ variable (C : Type u) [Category.{v} C]
 namespace Functor
 
 /-- The constant functor sending everything to `PUnit.star`. -/
-@[simps!] 
+@[simps!]
 def star : C ⥤ Discrete PUnit :=
   (Functor.const _).obj ⟨⟨⟩⟩
 #align category_theory.functor.star CategoryTheory.Functor.star
--- Porting note: simp can simplify this 
+-- Porting note: simp can simplify this
 attribute [nolint simpNF] star_map_down_down
 variable {C}
 
 /-- Any two functors to `Discrete PUnit` are isomorphic. -/
-@[simps!] 
+@[simps!]
 def pUnitExt (F G : C ⥤ Discrete PUnit) : F ≅ G := by
   refine NatIso.ofComponents (fun X => eqToIso ?_) fun {X} {Y} f => ?_
   · simp only [eq_iff_true_of_subsingleton]
-  · aesop_cat 
+  · aesop_cat
 #align category_theory.functor.punit_ext CategoryTheory.Functor.pUnitExt
--- Porting note: simp does indeed fire for these despite the linter warning 
-attribute [nolint simpNF] pUnitExt_hom_app_down_down pUnitExt_inv_app_down_down 
+-- Porting note: simp does indeed fire for these despite the linter warning
+attribute [nolint simpNF] pUnitExt_hom_app_down_down pUnitExt_inv_app_down_down
 
 /-- Any two functors to `Discrete PUnit` are *equal*.
 You probably want to use `pUnitExt` instead of this. -/
-theorem pUnit_ext' (F G : C ⥤ Discrete PUnit) : F = G := by 
-  refine Functor.ext (fun X => ?_) fun {X} {Y} f => ?_ 
+theorem pUnit_ext' (F G : C ⥤ Discrete PUnit) : F = G := by
+  refine Functor.ext (fun X => ?_) fun {X} {Y} f => ?_
   · simp only [eq_iff_true_of_subsingleton]
   · aesop_cat
 #align category_theory.functor.punit_ext' CategoryTheory.Functor.pUnit_ext'
@@ -87,7 +87,7 @@ def equiv : Discrete PUnit ⥤ C ≌ C where
 end Functor
 
 /-- A category being equivalent to `PUnit` is equivalent to it having a unique morphism between
-  any two objects. (In fact, such a category is also a groupoid; 
+  any two objects. (In fact, such a category is also a groupoid;
   see `CategoryTheory.Groupoid.ofHomUnique`) -/
 theorem equiv_pUnit_iff_unique :
     Nonempty (C ≌ Discrete PUnit) ↔ Nonempty C ∧ ∀ x y : C, Nonempty <| Unique (x ⟶ y) := by
@@ -113,7 +113,7 @@ theorem equiv_pUnit_iff_unique :
     haveI := fun x y => (h x y).some
     refine'
       Nonempty.intro
-        (CategoryTheory.Equivalence.mk ((Functor.const _).obj ⟨⟨⟩⟩) 
+        (CategoryTheory.Equivalence.mk ((Functor.const _).obj ⟨⟨⟩⟩)
           ((@Functor.const <| Discrete PUnit).obj p) ?_ (by apply Functor.pUnitExt))
     exact
       NatIso.ofComponents
@@ -124,4 +124,3 @@ theorem equiv_pUnit_iff_unique :
 #align category_theory.equiv_punit_iff_unique CategoryTheory.equiv_pUnit_iff_unique
 
 end CategoryTheory
-
feat: port/CategoryTheory.PUnit (#2367)

Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Matthew Robert Ballard <100034030+mattrobball@users.noreply.github.com> Co-authored-by: Johan Commelin <johan@commelin.net>

Dependencies 32

33 files ported (100.0%)
11709 lines ported (100.0%)

All dependencies are ported!