category_theory.pi.basicMathlib.CategoryTheory.Pi.Basic

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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,7 +3,7 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon, Scott Morrison
 -/
-import CategoryTheory.NaturalIsomorphism
+import CategoryTheory.NatIso
 import CategoryTheory.EqToHom
 import Data.Sum.Basic
 
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon, Scott Morrison
 -/
-import Mathbin.CategoryTheory.NaturalIsomorphism
-import Mathbin.CategoryTheory.EqToHom
-import Mathbin.Data.Sum.Basic
+import CategoryTheory.NaturalIsomorphism
+import CategoryTheory.EqToHom
+import Data.Sum.Basic
 
 #align_import category_theory.pi.basic from "leanprover-community/mathlib"@"e97cf15cd1aec9bd5c193b2ffac5a6dc9118912b"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon, Scott Morrison
-
-! This file was ported from Lean 3 source module category_theory.pi.basic
-! leanprover-community/mathlib commit e97cf15cd1aec9bd5c193b2ffac5a6dc9118912b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.CategoryTheory.NaturalIsomorphism
 import Mathbin.CategoryTheory.EqToHom
 import Mathbin.Data.Sum.Basic
 
+#align_import category_theory.pi.basic from "leanprover-community/mathlib"@"e97cf15cd1aec9bd5c193b2ffac5a6dc9118912b"
+
 /-!
 # Categories of indexed families of objects.
 
Diff
@@ -145,6 +145,7 @@ instance sumElimCategory : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
   | Sum.inr j => by dsimp; infer_instance
 #align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓ
 
+#print CategoryTheory.Pi.sum /-
 /-- The bifunctor combining an `I`-indexed family of objects with a `J`-indexed family of objects
 to obtain an `I ⊕ J`-indexed family of objects.
 -/
@@ -156,6 +157,7 @@ def sum : (∀ i, C i) ⥤ (∀ j, D j) ⥤ ∀ s : Sum I J, Sum.elim C D s
       map := fun g g' α s => Sum.rec (fun i => 𝟙 (f i)) α s }
   map f f' α := { app := fun g s => Sum.rec α (fun j => 𝟙 (g j)) s }
 #align category_theory.pi.sum CategoryTheory.Pi.sum
+-/
 
 end
 
Diff
@@ -140,23 +140,11 @@ section
 
 variable {J : Type w₀} {D : J → Type u₁} [∀ j, Category.{v₁} (D j)]
 
-/- warning: category_theory.pi.sum_elim_category -> CategoryTheory.Pi.sumElimCategoryₓ is a dubious translation:
-lean 3 declaration is
-  forall {I : Type.{u1}} (C : I -> Type.{u3}) [_inst_1 : forall (i : I), CategoryTheory.Category.{u2, u3} (C i)] {J : Type.{u1}} {D : J -> Type.{u3}} [_inst_2 : forall (j : J), CategoryTheory.Category.{u2, u3} (D j)] (s : Sum.{u1, u1} I J), CategoryTheory.Category.{u2, u3} (Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s)
-but is expected to have type
-  forall {I : Type.{u3}} (C : I -> Type.{u1}) [_inst_1 : forall (i : I), CategoryTheory.Category.{u2, u1} (C i)] {J : Type.{u3}} {D : J -> Type.{u1}} [_inst_2 : forall (j : J), CategoryTheory.Category.{u2, u1} (D j)] (s : Sum.{u3, u3} I J), CategoryTheory.Category.{u2, u1} (Sum.elim.{u3, u3, succ (succ u1)} I J Type.{u1} C D s)
-Case conversion may be inaccurate. Consider using '#align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓₓ'. -/
 instance sumElimCategory : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
   | Sum.inl i => by dsimp; infer_instance
   | Sum.inr j => by dsimp; infer_instance
 #align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓ
 
-/- warning: category_theory.pi.sum -> CategoryTheory.Pi.sum is a dubious translation:
-lean 3 declaration is
-  forall {I : Type.{u1}} (C : I -> Type.{u3}) [_inst_1 : forall (i : I), CategoryTheory.Category.{u2, u3} (C i)] {J : Type.{u1}} {D : J -> Type.{u3}} [_inst_2 : forall (j : J), CategoryTheory.Category.{u2, u3} (D j)], CategoryTheory.Functor.{max u1 u2, max (max u1 u3) u1 u2, max u1 u3, max (max u1 u2) u1 u3} (forall (i : I), C i) (CategoryTheory.pi.{u1, u2, u3} I (fun (i : I) => C i) (fun (i : I) => _inst_1 i)) (CategoryTheory.Functor.{max u1 u2, max u1 u2, max u1 u3, max u1 u3} (forall (j : J), D j) (CategoryTheory.pi.{u1, u2, u3} J (fun (j : J) => D j) (fun (i : J) => _inst_2 i)) (forall (s : Sum.{u1, u1} I J), Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (CategoryTheory.pi.{u1, u2, u3} (Sum.{u1, u1} I J) (fun (s : Sum.{u1, u1} I J) => Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (fun (i : Sum.{u1, u1} I J) => CategoryTheory.Pi.sumElimCategoryₓ.{u1, u2, u3} I C (fun (i : I) => _inst_1 i) J D (fun (j : J) => _inst_2 j) i))) (CategoryTheory.Functor.category.{max u1 u2, max u1 u2, max u1 u3, max u1 u3} (forall (j : J), D j) (CategoryTheory.pi.{u1, u2, u3} J (fun (j : J) => D j) (fun (i : J) => _inst_2 i)) (forall (s : Sum.{u1, u1} I J), Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (CategoryTheory.pi.{u1, u2, u3} (Sum.{u1, u1} I J) (fun (s : Sum.{u1, u1} I J) => Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (fun (i : Sum.{u1, u1} I J) => CategoryTheory.Pi.sumElimCategoryₓ.{u1, u2, u3} I C (fun (i : I) => _inst_1 i) J D (fun (j : J) => _inst_2 j) i)))
-but is expected to have type
-  forall {I : Type.{u1}} (C : I -> Type.{u3}) [_inst_1 : forall (i : I), CategoryTheory.Category.{u2, u3} (C i)] {J : Type.{u1}} {D : J -> Type.{u3}} [_inst_2 : forall (j : J), CategoryTheory.Category.{u2, u3} (D j)], CategoryTheory.Functor.{max u2 u1, max (max u3 u2) u1, max u3 u1, max (max u3 u1) u2 u1} (forall (i : I), C i) (CategoryTheory.pi.{u1, u2, u3} I (fun (i : I) => C i) (fun (i : I) => _inst_1 i)) (CategoryTheory.Functor.{max u2 u1, max u2 u1, max u3 u1, max u3 u1} (forall (j : J), D j) (CategoryTheory.pi.{u1, u2, u3} J (fun (j : J) => D j) (fun (i : J) => _inst_2 i)) (forall (s : Sum.{u1, u1} I J), Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (CategoryTheory.pi.{u1, u2, u3} (Sum.{u1, u1} I J) (fun (s : Sum.{u1, u1} I J) => Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (fun (i : Sum.{u1, u1} I J) => CategoryTheory.Pi.sumElimCategory.{u1, u2, u3} I C (fun (i : I) => (fun (i : I) => _inst_1 i) i) J D (fun (j : J) => (fun (j : J) => _inst_2 j) j) i))) (CategoryTheory.Functor.category.{max u2 u1, max u2 u1, max u3 u1, max u3 u1} (forall (j : J), D j) (CategoryTheory.pi.{u1, u2, u3} J (fun (j : J) => D j) (fun (i : J) => _inst_2 i)) (forall (s : Sum.{u1, u1} I J), Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (CategoryTheory.pi.{u1, u2, u3} (Sum.{u1, u1} I J) (fun (s : Sum.{u1, u1} I J) => Sum.elim.{u1, u1, succ (succ u3)} I J Type.{u3} C D s) (fun (i : Sum.{u1, u1} I J) => CategoryTheory.Pi.sumElimCategory.{u1, u2, u3} I C (fun (i : I) => (fun (i : I) => _inst_1 i) i) J D (fun (j : J) => (fun (j : J) => _inst_2 j) j) i)))
-Case conversion may be inaccurate. Consider using '#align category_theory.pi.sum CategoryTheory.Pi.sumₓ'. -/
 /-- The bifunctor combining an `I`-indexed family of objects with a `J`-indexed family of objects
 to obtain an `I ⊕ J`-indexed family of objects.
 -/
Diff
@@ -147,12 +147,8 @@ but is expected to have type
   forall {I : Type.{u3}} (C : I -> Type.{u1}) [_inst_1 : forall (i : I), CategoryTheory.Category.{u2, u1} (C i)] {J : Type.{u3}} {D : J -> Type.{u1}} [_inst_2 : forall (j : J), CategoryTheory.Category.{u2, u1} (D j)] (s : Sum.{u3, u3} I J), CategoryTheory.Category.{u2, u1} (Sum.elim.{u3, u3, succ (succ u1)} I J Type.{u1} C D s)
 Case conversion may be inaccurate. Consider using '#align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓₓ'. -/
 instance sumElimCategory : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
-  | Sum.inl i => by
-    dsimp
-    infer_instance
-  | Sum.inr j => by
-    dsimp
-    infer_instance
+  | Sum.inl i => by dsimp; infer_instance
+  | Sum.inr j => by dsimp; infer_instance
 #align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓ
 
 /- warning: category_theory.pi.sum -> CategoryTheory.Pi.sum is a dubious translation:
@@ -182,11 +178,7 @@ variable {C}
 pair of corresponding components. -/
 @[simps]
 def isoApp {X Y : ∀ i, C i} (f : X ≅ Y) (i : I) : X i ≅ Y i :=
-  ⟨f.Hom i, f.inv i, by
-    dsimp
-    rw [← comp_apply, iso.hom_inv_id, id_apply],
-    by
-    dsimp
+  ⟨f.Hom i, f.inv i, by dsimp; rw [← comp_apply, iso.hom_inv_id, id_apply], by dsimp;
     rw [← comp_apply, iso.inv_hom_id, id_apply]⟩
 #align category_theory.pi.iso_app CategoryTheory.Pi.isoApp
 -/
@@ -248,10 +240,7 @@ section EqToHom
 #print CategoryTheory.Functor.eqToHom_proj /-
 @[simp]
 theorem eqToHom_proj {x x' : ∀ i, C i} (h : x = x') (i : I) :
-    (eqToHom h : x ⟶ x') i = eqToHom (Function.funext_iff.mp h i) :=
-  by
-  subst h
-  rfl
+    (eqToHom h : x ⟶ x') i = eqToHom (Function.funext_iff.mp h i) := by subst h; rfl
 #align category_theory.functor.eq_to_hom_proj CategoryTheory.Functor.eqToHom_proj
 -/
 
@@ -273,16 +262,10 @@ theorem pi'_eval (f : ∀ i, A ⥤ C i) (i : I) : pi' f ⋙ Pi.eval C i = f i :=
 theorem pi_ext (f f' : A ⥤ ∀ i, C i) (h : ∀ i, f ⋙ Pi.eval C i = f' ⋙ Pi.eval C i) : f = f' :=
   by
   apply Functor.ext; swap
-  · intro X
-    ext i
-    specialize h i
-    have := congr_obj h X
-    simpa
-  · intro x y p
-    ext i
-    specialize h i
-    have := congr_hom h p
-    simpa
+  · intro X; ext i; specialize h i
+    have := congr_obj h X; simpa
+  · intro x y p; ext i; specialize h i
+    have := congr_hom h p; simpa
 #align category_theory.functor.pi_ext CategoryTheory.Functor.pi_ext
 -/
 

Changes in mathlib4

mathlib3
mathlib4
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
@@ -387,9 +387,9 @@ def pi (E : ∀ i, C i ≌ D i) : (∀ i, C i) ≌ (∀ i, D i) where
   unitIso := NatIso.pi (fun i => (E i).unitIso)
   counitIso := NatIso.pi (fun i => (E i).counitIso)
 
-instance (F : ∀ i, C i ⥤ D i) [∀ i, IsEquivalence (F i)] :
-    IsEquivalence (Functor.pi F) :=
-  IsEquivalence.ofEquivalence (pi (fun i => (F i).asEquivalence))
+instance (F : ∀ i, C i ⥤ D i) [∀ i, (F i).IsEquivalence] :
+    (Functor.pi F).IsEquivalence :=
+  Functor.IsEquivalence.ofEquivalence (pi (fun i => (F i).asEquivalence))
 
 end Equivalence
 
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -101,7 +101,6 @@ def comapId : comap C (id : I → I) ≅ 𝟭 (∀ i, C i) where
 example (g : J → I) : (j : J) → Category (C (g j)) := by infer_instance
 
 variable {I}
-
 variable {K : Type w₂}
 
 /-- The natural isomorphism comparing between
@@ -197,7 +196,6 @@ end Pi
 namespace Functor
 
 variable {C}
-
 variable {D : I → Type u₂} [∀ i, Category.{v₂} (D i)] {A : Type u₃} [Category.{v₃} A]
 
 /-- Assemble an `I`-indexed family of functors into a functor between the pi types.
@@ -266,9 +264,7 @@ end Functor
 namespace NatTrans
 
 variable {C}
-
 variable {D : I → Type u₂} [∀ i, Category.{v₂} (D i)]
-
 variable {F G : ∀ i, C i ⥤ D i}
 
 /-- Assemble an `I`-indexed family of natural transformations into a single natural transformation.
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -6,7 +6,6 @@ Authors: Simon Hudon, Scott Morrison
 import Mathlib.CategoryTheory.EqToHom
 import Mathlib.CategoryTheory.NatIso
 import Mathlib.CategoryTheory.Products.Basic
-import Mathlib.Data.Sum.Basic
 
 #align_import category_theory.pi.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
 
chore: cleanup spaces (#9745)
Diff
@@ -373,7 +373,7 @@ def Pi.optionEquivalence (C' : Option J → Type u₁) [∀ i, Category.{v₁} (
   inverse := Functor.pi' (fun i => match i with
     | none => Prod.fst _ _
     | some i => Prod.snd _ _ ⋙ (Pi.eval _ i))
-  unitIso :=  NatIso.pi' (fun i => match i with
+  unitIso := NatIso.pi' (fun i => match i with
     | none => Iso.refl _
     | some i => Iso.refl _)
   counitIso := by exact Iso.refl _
feat(CategoryTheory): more API for product categories (#8865)

This PR develops notions about product categories (natural isomorphisms, equivalences) in order to fill the prerequisites of PR #8864 about the localization of product categories.

Diff
@@ -3,8 +3,9 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon, Scott Morrison
 -/
-import Mathlib.CategoryTheory.NatIso
 import Mathlib.CategoryTheory.EqToHom
+import Mathlib.CategoryTheory.NatIso
+import Mathlib.CategoryTheory.Products.Basic
 import Mathlib.Data.Sum.Basic
 
 #align_import category_theory.pi.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
@@ -19,7 +20,7 @@ We define the pointwise category structure on indexed families of objects in a c
 
 namespace CategoryTheory
 
-universe w₀ w₁ w₂ v₁ v₂ u₁ u₂
+universe w₀ w₁ w₂ v₁ v₂ v₃ u₁ u₂ u₃
 
 variable {I : Type w₀} {J : Type w₁} (C : I → Type u₁) [∀ i, Category.{v₁} (C i)]
 
@@ -198,7 +199,7 @@ namespace Functor
 
 variable {C}
 
-variable {D : I → Type u₁} [∀ i, Category.{v₁} (D i)] {A : Type u₁} [Category.{u₁} A]
+variable {D : I → Type u₂} [∀ i, Category.{v₂} (D i)] {A : Type u₃} [Category.{v₃} A]
 
 /-- Assemble an `I`-indexed family of functors into a functor between the pi types.
 -/
@@ -216,6 +217,12 @@ def pi' (f : ∀ i, A ⥤ C i) : A ⥤ ∀ i, C i where
   map h i := (f i).map h
 #align category_theory.functor.pi' CategoryTheory.Functor.pi'
 
+/-- The projections of `Functor.pi' F` are isomorphic to the functors of the family `F` -/
+@[simps!]
+def pi'CompEval {A : Type*} [Category A] (F : ∀ i, A ⥤ C i) (i : I) :
+    pi' F ⋙ Pi.eval C i ≅ F i :=
+  Iso.refl _
+
 section EqToHom
 
 @[simp]
@@ -261,7 +268,7 @@ namespace NatTrans
 
 variable {C}
 
-variable {D : I → Type u₁} [∀ i, Category.{v₁} (D i)]
+variable {D : I → Type u₂} [∀ i, Category.{v₂} (D i)]
 
 variable {F G : ∀ i, C i ⥤ D i}
 
@@ -272,6 +279,123 @@ def pi (α : ∀ i, F i ⟶ G i) : Functor.pi F ⟶ Functor.pi G where
   app f i := (α i).app (f i)
 #align category_theory.nat_trans.pi CategoryTheory.NatTrans.pi
 
+/-- Assemble an `I`-indexed family of natural transformations into a single natural transformation.
+-/
+@[simps]
+def pi' {E : Type*} [Category E] {F G : E ⥤ ∀ i, C i}
+    (τ : ∀ i, F ⋙ Pi.eval C i ⟶ G ⋙ Pi.eval C i) : F ⟶ G where
+  app := fun X i => (τ i).app X
+  naturality _ _ f := by
+    ext i
+    exact (τ i).naturality f
+
 end NatTrans
 
+namespace NatIso
+
+variable {C}
+variable {D : I → Type u₂} [∀ i, Category.{v₂} (D i)]
+variable {F G : ∀ i, C i ⥤ D i}
+
+/-- Assemble an `I`-indexed family of natural isomorphisms into a single natural isomorphism.
+-/
+@[simps]
+def pi (e : ∀ i, F i ≅ G i) : Functor.pi F ≅ Functor.pi G where
+  hom := NatTrans.pi (fun i => (e i).hom)
+  inv := NatTrans.pi (fun i => (e i).inv)
+
+/-- Assemble an `I`-indexed family of natural isomorphisms into a single natural isomorphism.
+-/
+@[simps]
+def pi' {E : Type*} [Category E] {F G : E ⥤ ∀ i, C i}
+    (e : ∀ i, F ⋙ Pi.eval C i ≅ G ⋙ Pi.eval C i) : F ≅ G where
+  hom := NatTrans.pi' (fun i => (e i).hom)
+  inv := NatTrans.pi' (fun i => (e i).inv)
+
+end NatIso
+
+variable {C}
+
+lemma isIso_pi_iff {X Y : ∀ i, C i} (f : X ⟶ Y) :
+    IsIso f ↔ ∀ i, IsIso (f i) := by
+  constructor
+  · intro _ i
+    exact IsIso.of_iso (Pi.isoApp (asIso f) i)
+  · intro
+    exact ⟨fun i => inv (f i), by aesop_cat, by aesop_cat⟩
+
+variable (C)
+
+/-- For a family of categories `C i` indexed by `I`, an equality `i = j` in `I` induces
+an equivalence `C i ≌ C j`. -/
+def Pi.eqToEquivalence {i j : I} (h : i = j) : C i ≌ C j := by subst h; rfl
+
+/-- When `i = j`, projections `Pi.eval C i` and `Pi.eval C j` are related by the equivalence
+`Pi.eqToEquivalence C h : C i ≌ C j`. -/
+@[simps!]
+def Pi.evalCompEqToEquivalenceFunctor {i j : I} (h : i = j) :
+    Pi.eval C i ⋙ (Pi.eqToEquivalence C h).functor ≅
+      Pi.eval C j :=
+  eqToIso (by subst h; rfl)
+
+/-- The equivalences given by `Pi.eqToEquivalence` are compatible with reindexing. -/
+@[simps!]
+def Pi.eqToEquivalenceFunctorIso (f : J → I) {i' j' : J} (h : i' = j') :
+    (Pi.eqToEquivalence C (congr_arg f h)).functor ≅
+      (Pi.eqToEquivalence (fun i' => C (f i')) h).functor :=
+  eqToIso (by subst h; rfl)
+
+attribute [local simp] eqToHom_map
+
+/-- Reindexing a family of categories gives equivalent `Pi` categories. -/
+@[simps]
+noncomputable def Pi.equivalenceOfEquiv (e : J ≃ I) :
+    (∀ j, C (e j)) ≌ (∀ i, C i) where
+  functor := Functor.pi' (fun i => Pi.eval _ (e.symm i) ⋙
+    (Pi.eqToEquivalence C (by simp)).functor)
+  inverse := Functor.pi' (fun i' => Pi.eval _ (e i'))
+  unitIso := NatIso.pi' (fun i' => Functor.leftUnitor _ ≪≫
+    (Pi.evalCompEqToEquivalenceFunctor (fun j => C (e j)) (e.symm_apply_apply i')).symm ≪≫
+    isoWhiskerLeft _ ((Pi.eqToEquivalenceFunctorIso C e (e.symm_apply_apply i')).symm) ≪≫
+    (Functor.pi'CompEval _ _).symm ≪≫ isoWhiskerLeft _ (Functor.pi'CompEval _ _).symm ≪≫
+    (Functor.associator _ _ _).symm)
+  counitIso := NatIso.pi' (fun i => (Functor.associator _ _ _).symm ≪≫
+    isoWhiskerRight (Functor.pi'CompEval _ _) _ ≪≫
+    Pi.evalCompEqToEquivalenceFunctor C (e.apply_symm_apply i) ≪≫
+    (Functor.leftUnitor _).symm)
+
+/-- A product of categories indexed by `Option J` identifies to a binary product. -/
+@[simps]
+def Pi.optionEquivalence (C' : Option J → Type u₁) [∀ i, Category.{v₁} (C' i)] :
+    (∀ i, C' i) ≌ C' none × (∀ (j : J), C' (some j)) where
+  functor := Functor.prod' (Pi.eval C' none)
+    (Functor.pi' (fun i => (Pi.eval _ (some i))))
+  inverse := Functor.pi' (fun i => match i with
+    | none => Prod.fst _ _
+    | some i => Prod.snd _ _ ⋙ (Pi.eval _ i))
+  unitIso :=  NatIso.pi' (fun i => match i with
+    | none => Iso.refl _
+    | some i => Iso.refl _)
+  counitIso := by exact Iso.refl _
+
+namespace Equivalence
+
+variable {C}
+variable {D : I → Type u₂} [∀ i, Category.{v₂} (D i)]
+
+/-- Assemble an `I`-indexed family of equivalences of categories
+into a single equivalence. -/
+@[simps]
+def pi (E : ∀ i, C i ≌ D i) : (∀ i, C i) ≌ (∀ i, D i) where
+  functor := Functor.pi (fun i => (E i).functor)
+  inverse := Functor.pi (fun i => (E i).inverse)
+  unitIso := NatIso.pi (fun i => (E i).unitIso)
+  counitIso := NatIso.pi (fun i => (E i).counitIso)
+
+instance (F : ∀ i, C i ⥤ D i) [∀ i, IsEquivalence (F i)] :
+    IsEquivalence (Functor.pi F) :=
+  IsEquivalence.ofEquivalence (pi (fun i => (F i).asEquivalence))
+
+end Equivalence
+
 end CategoryTheory
style: a linter for colons (#6761)

A linter that throws on seeing a colon at the start of a line, according to the style guideline that says these operators should go before linebreaks.

Diff
@@ -239,8 +239,8 @@ theorem pi'_eval (f : ∀ i, A ⥤ C i) (i : I) : pi' f ⋙ Pi.eval C i = f i :=
 #align category_theory.functor.pi'_eval CategoryTheory.Functor.pi'_eval
 
 /-- Two functors to a product category are equal iff they agree on every coordinate. -/
-theorem pi_ext (f f' : A ⥤ ∀ i, C i) (h : ∀ i, f ⋙ (Pi.eval C i) = f' ⋙ (Pi.eval C i))
-    : f = f' := by
+theorem pi_ext (f f' : A ⥤ ∀ i, C i) (h : ∀ i, f ⋙ (Pi.eval C i) = f' ⋙ (Pi.eval C i)) :
+    f = f' := by
   apply Functor.ext; rotate_left
   · intro X
     ext i
chore: remove unused simps (#6632)

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

Diff
@@ -172,11 +172,8 @@ variable {C}
 pair of corresponding components. -/
 @[simps]
 def isoApp {X Y : ∀ i, C i} (f : X ≅ Y) (i : I) : X i ≅ Y i :=
-  ⟨f.hom i, f.inv i, by
-    dsimp
-    rw [← comp_apply, Iso.hom_inv_id, id_apply], by
-    dsimp
-    rw [← comp_apply, Iso.inv_hom_id, id_apply]⟩
+  ⟨f.hom i, f.inv i,
+    by rw [← comp_apply, Iso.hom_inv_id, id_apply], by rw [← comp_apply, Iso.inv_hom_id, id_apply]⟩
 #align category_theory.pi.iso_app CategoryTheory.Pi.isoApp
 
 @[simp]
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

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

Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2020 Scott Morrison. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Simon Hudon, Scott Morrison
-
-! This file was ported from Lean 3 source module category_theory.pi.basic
-! leanprover-community/mathlib commit dc6c365e751e34d100e80fe6e314c3c3e0fd2988
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.CategoryTheory.NatIso
 import Mathlib.CategoryTheory.EqToHom
 import Mathlib.Data.Sum.Basic
 
+#align_import category_theory.pi.basic from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
+
 /-!
 # Categories of indexed families of objects.
 
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
@@ -236,7 +236,7 @@ end EqToHom
 -- One could add some natural isomorphisms showing
 -- how `Functor.pi` commutes with `Pi.eval` and `Pi.comap`.
 @[simp]
-theorem pi'_eval (f : ∀ i, A ⥤ C i) (i : I) : pi' f ⋙  Pi.eval C i = f i := by
+theorem pi'_eval (f : ∀ i, A ⥤ C i) (i : I) : pi' f ⋙ Pi.eval C i = f i := by
   apply Functor.ext
   intro _ _ _
   · simp
chore: cleanup CategoryTheory.Pi.Basic (#5180)

While experimenting with making ext more powerful a proof was failing here. Rather than fix it, it seemed easier to just remove it.

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

Diff
@@ -57,6 +57,11 @@ theorem comp_apply {X Y Z : ∀ i, C i} (f : X ⟶ Y) (g : Y ⟶ Z) (i) :
   rfl
 #align category_theory.pi.comp_apply CategoryTheory.Pi.comp_apply
 
+-- Porting note: need to add an additional `ext` lemma.
+@[ext]
+lemma ext {X Y : ∀ i, C i} {f g : X ⟶ Y} (w : ∀ i, f i = g i) : f = g :=
+  funext (w ·)
+
 /--
 The evaluation functor at `i : I`, sending an `I`-indexed family of objects to the object over `i`.
 -/
@@ -80,7 +85,7 @@ instance (f : J → I) : (j : J) → Category ((C ∘ f) j) := by
 /-- Pull back an `I`-indexed family of objects to a `J`-indexed family, along a function `J → I`.
 -/
 @[simps]
-def comap (h : J → I) : (∀ i, C i) ⥤  (∀ j, C (h j)) where
+def comap (h : J → I) : (∀ i, C i) ⥤ (∀ j, C (h j)) where
   obj f i := f (h i)
   map α i := α (h i)
 #align category_theory.pi.comap CategoryTheory.Pi.comap
@@ -92,7 +97,7 @@ pulling back a grading along the identity function,
 and the identity functor. -/
 @[simps]
 def comapId : comap C (id : I → I) ≅ 𝟭 (∀ i, C i) where
-  hom := { app := fun X => 𝟙 X, naturality := by simp only [comap]; aesop_cat }
+  hom := { app := fun X => 𝟙 X }
   inv := { app := fun X => 𝟙 X }
 #align category_theory.pi.comap_id CategoryTheory.Pi.comapId
 
@@ -114,14 +119,6 @@ def comapComp (f : K → J) (g : J → I) : comap C g ⋙ comap (C ∘ g) f ≅
   inv :=
   { app := fun X b => 𝟙 (X (g (f b)))
     naturality := fun X Y f' => by simp only [comap, Function.comp]; funext; simp }
-  hom_inv_id := by
-    simp only [comap]
-    ext Y
-    simp [CategoryStruct.comp,CategoryStruct.id]
-  inv_hom_id := by
-    simp only [comap]
-    ext X
-    simp [CategoryStruct.comp,CategoryStruct.id]
 #align category_theory.pi.comap_comp CategoryTheory.Pi.comapComp
 
 /-- The natural isomorphism between pulling back then evaluating, and just evaluating. -/
@@ -162,25 +159,12 @@ def sum : (∀ i, C i) ⥤ (∀ j, D j) ⥤ ∀ s : Sum I J, Sum.elim C D s wher
       map := fun {Y} {Y'} f s =>
         match s with
         | .inl i => 𝟙 (X i)
-        | .inr j => f j
-      map_id := fun Y => by
-          dsimp
-          simp only [CategoryStruct.id]
-          funext s
-          match s with
-          | .inl i => simp
-          | .inr j => simp
-      map_comp := fun {Y₁} {Y₂} {Y₃} f g => by funext s; cases s; repeat {simp} }
+        | .inr j => f j }
   map {X} {X'} f :=
     { app := fun Y s =>
         match s with
         | .inl i => f i
-        | .inr j => 𝟙 (Y j)
-      naturality := fun {Y} {Y'} g => by funext s; cases s; repeat {simp} }
-  map_id := fun X => by
-    ext Y; dsimp; simp only [CategoryStruct.id]; funext s; cases s; repeat {simp}
-  map_comp := fun f g => by
-    ext Y; dsimp; simp only [CategoryStruct.comp]; funext s; cases s; repeat {simp}
+        | .inr j => 𝟙 (Y j) }
 #align category_theory.pi.sum CategoryTheory.Pi.sum
 
 end
@@ -292,7 +276,6 @@ variable {F G : ∀ i, C i ⥤ D i}
 @[simps!]
 def pi (α : ∀ i, F i ⟶ G i) : Functor.pi F ⟶ Functor.pi G where
   app f i := (α i).app (f i)
-  naturality := fun X Y f => by simp [Functor.pi,CategoryStruct.comp]
 #align category_theory.nat_trans.pi CategoryTheory.NatTrans.pi
 
 end NatTrans
chore: fix grammar 2/3 (#5002)

Part 2 of #5001

Diff
@@ -77,7 +77,7 @@ instance (f : J → I) : (j : J) → Category ((C ∘ f) j) := by
   dsimp
   infer_instance
 
-/-- Pull back an `I`-indexed family of objects to an `J`-indexed family, along a function `J → I`.
+/-- Pull back an `I`-indexed family of objects to a `J`-indexed family, along a function `J → I`.
 -/
 @[simps]
 def comap (h : J → I) : (∀ i, C i) ⥤  (∀ j, C (h j)) where
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
@@ -92,7 +92,7 @@ pulling back a grading along the identity function,
 and the identity functor. -/
 @[simps]
 def comapId : comap C (id : I → I) ≅ 𝟭 (∀ i, C i) where
-  hom := { app := fun X => 𝟙 X, naturality := by simp only [comap]; aesop_cat}
+  hom := { app := fun X => 𝟙 X, naturality := by simp only [comap]; aesop_cat }
   inv := { app := fun X => 𝟙 X }
 #align category_theory.pi.comap_id CategoryTheory.Pi.comapId
 
@@ -108,14 +108,12 @@ pulling back along their composition
 -/
 @[simps!]
 def comapComp (f : K → J) (g : J → I) : comap C g ⋙ comap (C ∘ g) f ≅ comap C (g ∘ f) where
-  hom := {
-    app := fun X b => 𝟙 (X (g (f b)))
-    naturality := fun X Y f' => by simp only [comap,Function.comp]; funext; simp
-    }
-  inv := {
-    app := fun X b => 𝟙 (X (g (f b)))
-    naturality := fun X Y f' => by simp only [comap,Function.comp]; funext; simp
-    }
+  hom :=
+  { app := fun X b => 𝟙 (X (g (f b)))
+    naturality := fun X Y f' => by simp only [comap, Function.comp]; funext; simp }
+  inv :=
+  { app := fun X b => 𝟙 (X (g (f b)))
+    naturality := fun X Y f' => by simp only [comap, Function.comp]; funext; simp }
   hom_inv_id := by
     simp only [comap]
     ext Y
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -195,8 +195,7 @@ pair of corresponding components. -/
 def isoApp {X Y : ∀ i, C i} (f : X ≅ Y) (i : I) : X i ≅ Y i :=
   ⟨f.hom i, f.inv i, by
     dsimp
-    rw [← comp_apply, Iso.hom_inv_id, id_apply],
-    by
+    rw [← comp_apply, Iso.hom_inv_id, id_apply], by
     dsimp
     rw [← comp_apply, Iso.inv_hom_id, id_apply]⟩
 #align category_theory.pi.iso_app CategoryTheory.Pi.isoApp
chore: tidy various files (#2321)
Diff
@@ -29,8 +29,7 @@ variable {I : Type w₀} {J : Type w₁} (C : I → Type u₁) [∀ i, Category.
 
 /-- `pi C` gives the cartesian product of an indexed family of categories.
 -/
-instance pi : Category.{max w₀ v₁} (∀ i, C i)
-    where
+instance pi : Category.{max w₀ v₁} (∀ i, C i) where
   Hom X Y := ∀ i, X i ⟶ Y i
   id X i := 𝟙 (X i)
   comp f g i := f i ≫ g i
@@ -71,18 +70,17 @@ section
 
 variable {J : Type w₁}
 
-/- Porting note: add this because Lean cannot see directly through the `∘` for 
+/- Porting note: add this because Lean cannot see directly through the `∘` for
 `Function.comp` -/
 
-instance (f : J → I) : (j : J) → Category ((C ∘ f) j) := by 
+instance (f : J → I) : (j : J) → Category ((C ∘ f) j) := by
   dsimp
-  infer_instance 
+  infer_instance
 
 /-- Pull back an `I`-indexed family of objects to an `J`-indexed family, along a function `J → I`.
 -/
 @[simps]
-def comap (h : J → I) : (∀ i, C i) ⥤  (∀ j, C (h j))
-    where
+def comap (h : J → I) : (∀ i, C i) ⥤  (∀ j, C (h j)) where
   obj f i := f (h i)
   map α i := α (h i)
 #align category_theory.pi.comap CategoryTheory.Pi.comap
@@ -93,13 +91,12 @@ variable (I)
 pulling back a grading along the identity function,
 and the identity functor. -/
 @[simps]
-def comapId : comap C (id : I → I) ≅ 𝟭 (∀ i, C i)
-    where
+def comapId : comap C (id : I → I) ≅ 𝟭 (∀ i, C i) where
   hom := { app := fun X => 𝟙 X, naturality := by simp only [comap]; aesop_cat}
   inv := { app := fun X => 𝟙 X }
 #align category_theory.pi.comap_id CategoryTheory.Pi.comapId
 
-example (g : J → I) : (j : J) → Category (C (g j)) := by infer_instance 
+example (g : J → I) : (j : J) → Category (C (g j)) := by infer_instance
 
 variable {I}
 
@@ -110,21 +107,20 @@ pulling back along two successive functions, and
 pulling back along their composition
 -/
 @[simps!]
-def comapComp (f : K → J) (g : J → I) : comap C g ⋙ comap (C ∘ g) f ≅ comap C (g ∘ f)
-    where
-  hom := { 
-    app := fun X b => 𝟙 (X (g (f b))) 
+def comapComp (f : K → J) (g : J → I) : comap C g ⋙ comap (C ∘ g) f ≅ comap C (g ∘ f) where
+  hom := {
+    app := fun X b => 𝟙 (X (g (f b)))
     naturality := fun X Y f' => by simp only [comap,Function.comp]; funext; simp
     }
-  inv := { 
+  inv := {
     app := fun X b => 𝟙 (X (g (f b)))
     naturality := fun X Y f' => by simp only [comap,Function.comp]; funext; simp
     }
-  hom_inv_id := by 
-    simp only [comap] 
-    ext Y 
+  hom_inv_id := by
+    simp only [comap]
+    ext Y
     simp [CategoryStruct.comp,CategoryStruct.id]
-  inv_hom_id := by 
+  inv_hom_id := by
     simp only [comap]
     ext X
     simp [CategoryStruct.comp,CategoryStruct.id]
@@ -143,51 +139,49 @@ section
 variable {J : Type w₀} {D : J → Type u₁} [∀ j, Category.{v₁} (D j)]
 
 /- Porting note: maybe mixing up universes -/
-set_option align.precheck false
-instance sumElimCategoryₓ : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
+instance sumElimCategory : ∀ s : Sum I J, Category.{v₁} (Sum.elim C D s)
   | Sum.inl i => by
     dsimp
     infer_instance
   | Sum.inr j => by
     dsimp
     infer_instance
-#align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓ 
+#align category_theory.pi.sum_elim_category CategoryTheory.Pi.sumElimCategoryₓ
 
-/- Porting note: replaced `Sum.rec` with `match`'s per the error about 
-current state of code generation -/ 
+/- Porting note: replaced `Sum.rec` with `match`'s per the error about
+current state of code generation -/
 
 /-- The bifunctor combining an `I`-indexed family of objects with a `J`-indexed family of objects
 to obtain an `I ⊕ J`-indexed family of objects.
 -/
 @[simps]
-def sum : (∀ i, C i) ⥤ (∀ j, D j) ⥤ ∀ s : Sum I J, Sum.elim C D s
-    where
+def sum : (∀ i, C i) ⥤ (∀ j, D j) ⥤ ∀ s : Sum I J, Sum.elim C D s where
   obj X :=
-    { obj := fun Y s => 
-        match s with 
-        | .inl i => X i 
+    { obj := fun Y s =>
+        match s with
+        | .inl i => X i
         | .inr j => Y j
-      map := fun {Y} {Y'} f s => 
-        match s with 
-        | .inl i => 𝟙 (X i) 
+      map := fun {Y} {Y'} f s =>
+        match s with
+        | .inl i => 𝟙 (X i)
         | .inr j => f j
-      map_id := fun Y => by 
+      map_id := fun Y => by
           dsimp
           simp only [CategoryStruct.id]
-          funext s 
-          match s with 
-          | .inl i => simp 
-          | .inr j => simp 
+          funext s
+          match s with
+          | .inl i => simp
+          | .inr j => simp
       map_comp := fun {Y₁} {Y₂} {Y₃} f g => by funext s; cases s; repeat {simp} }
-  map {X} {X'} f := 
-    { app := fun Y s => 
-        match s with 
-        | .inl i => f i 
-        | .inr j => 𝟙 (Y j) 
+  map {X} {X'} f :=
+    { app := fun Y s =>
+        match s with
+        | .inl i => f i
+        | .inr j => 𝟙 (Y j)
       naturality := fun {Y} {Y'} g => by funext s; cases s; repeat {simp} }
-  map_id := fun X => by 
+  map_id := fun X => by
     ext Y; dsimp; simp only [CategoryStruct.id]; funext s; cases s; repeat {simp}
-  map_comp := fun f g => by 
+  map_comp := fun f g => by
     ext Y; dsimp; simp only [CategoryStruct.comp]; funext s; cases s; repeat {simp}
 #align category_theory.pi.sum CategoryTheory.Pi.sum
 
@@ -234,8 +228,7 @@ variable {D : I → Type u₁} [∀ i, Category.{v₁} (D i)] {A : Type u₁} [C
 /-- Assemble an `I`-indexed family of functors into a functor between the pi types.
 -/
 @[simps]
-def pi (F : ∀ i, C i ⥤ D i) : (∀ i, C i) ⥤ ∀ i, D i
-    where
+def pi (F : ∀ i, C i ⥤ D i) : (∀ i, C i) ⥤ ∀ i, D i where
   obj f i := (F i).obj (f i)
   map α i := (F i).map (α i)
 #align category_theory.functor.pi CategoryTheory.Functor.pi
@@ -243,8 +236,7 @@ def pi (F : ∀ i, C i ⥤ D i) : (∀ i, C i) ⥤ ∀ i, D i
 /-- Similar to `pi`, but all functors come from the same category `A`
 -/
 @[simps]
-def pi' (f : ∀ i, A ⥤ C i) : A ⥤ ∀ i, C i
-    where
+def pi' (f : ∀ i, A ⥤ C i) : A ⥤ ∀ i, C i where
   obj a i := (f i).obj a
   map h i := (f i).map h
 #align category_theory.functor.pi' CategoryTheory.Functor.pi'
@@ -264,15 +256,15 @@ end EqToHom
 -- how `Functor.pi` commutes with `Pi.eval` and `Pi.comap`.
 @[simp]
 theorem pi'_eval (f : ∀ i, A ⥤ C i) (i : I) : pi' f ⋙  Pi.eval C i = f i := by
-  apply Functor.ext 
-  intro _ _ _ 
-  · simp 
-  · intro _ 
-    rfl 
+  apply Functor.ext
+  intro _ _ _
+  · simp
+  · intro _
+    rfl
 #align category_theory.functor.pi'_eval CategoryTheory.Functor.pi'_eval
 
 /-- Two functors to a product category are equal iff they agree on every coordinate. -/
-theorem pi_ext (f f' : A ⥤ ∀ i, C i) (h : ∀ i, f ⋙  (Pi.eval C i) = f' ⋙  (Pi.eval C i)) 
+theorem pi_ext (f f' : A ⥤ ∀ i, C i) (h : ∀ i, f ⋙ (Pi.eval C i) = f' ⋙ (Pi.eval C i))
     : f = f' := by
   apply Functor.ext; rotate_left
   · intro X
@@ -281,7 +273,7 @@ theorem pi_ext (f f' : A ⥤ ∀ i, C i) (h : ∀ i, f ⋙  (Pi.eval C i) = f' 
     have := congr_obj h X
     simpa
   · intro X Y g
-    dsimp 
+    dsimp
     funext i
     specialize h i
     have := congr_hom h g
@@ -301,8 +293,8 @@ variable {F G : ∀ i, C i ⥤ D i}
 /-- Assemble an `I`-indexed family of natural transformations into a single natural transformation.
 -/
 @[simps!]
-def pi (α : ∀ i, F i ⟶ G i) : Functor.pi F ⟶ Functor.pi G where 
-  app f i := (α i).app (f i) 
+def pi (α : ∀ i, F i ⟶ G i) : Functor.pi F ⟶ Functor.pi G where
+  app f i := (α i).app (f i)
   naturality := fun X Y f => by simp [Functor.pi,CategoryStruct.comp]
 #align category_theory.nat_trans.pi CategoryTheory.NatTrans.pi
 
feat port/CategoryTheory.Pi.Basic (#2230)

Dependencies 13

14 files ported (100.0%)
3942 lines ported (100.0%)

All dependencies are ported!