diff --git "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Colimits.jsonl" "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Colimits.jsonl" deleted file mode 100644--- "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Colimits.jsonl" +++ /dev/null @@ -1,91 +0,0 @@ -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nx : ?m.34014\n⊢ ColimitType F","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by ","nextTactic":"exact Quot.mk Setoid.r (neg x)","declUpToTactic":"@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.130_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nx : Prequotient F\n⊢ ColimitType F","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by ","nextTactic":"exact Quot.mk Setoid.r x","declUpToTactic":"@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.130_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nx : ?m.34601\ny : ?m.34604\n⊢ ColimitType F","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by ","nextTactic":"exact Quot.mk Setoid.r (add x y)","declUpToTactic":"@[simp]\ntheorem quot_add (x y) :\n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.138_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nx y : Prequotient F\n⊢ ColimitType F","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by ","nextTactic":"exact Quot.mk Setoid.r x","declUpToTactic":"@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.138_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nx y : Prequotient F\n⊢ ColimitType F","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by ","nextTactic":"exact Quot.mk Setoid.r y","declUpToTactic":"@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.138_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj : J\n⊢ coconeFun F j 0 = 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by ","nextTactic":"apply Quot.sound","declUpToTactic":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.156_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun "} -{"state":"case a\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj : J\n⊢ Setoid.r (Prequotient.of j 0) zero","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; ","nextTactic":"apply Relation.zero","declUpToTactic":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.156_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj : J\n⊢ ∀ (x y : ↑(F.obj j)),\n ZeroHom.toFun\n { toFun := coconeFun F j, map_zero' := (_ : Quot.mk Setoid.r (Prequotient.of j 0) = Quot.mk Setoid.r zero) }\n (x + y) =\n ZeroHom.toFun\n { toFun := coconeFun F j, map_zero' := (_ : Quot.mk Setoid.r (Prequotient.of j 0) = Quot.mk Setoid.r zero) }\n x +\n ZeroHom.toFun\n { toFun := coconeFun F j, map_zero' := (_ : Quot.mk Setoid.r (Prequotient.of j 0) = Quot.mk Setoid.r zero) } y","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by ","nextTactic":"intros","declUpToTactic":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.156_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj : J\nx✝ y✝ : ↑(F.obj j)\n⊢ ZeroHom.toFun\n { toFun := coconeFun F j, map_zero' := (_ : Quot.mk Setoid.r (Prequotient.of j 0) = Quot.mk Setoid.r zero) }\n (x✝ + y✝) =\n ZeroHom.toFun\n { toFun := coconeFun F j, map_zero' := (_ : Quot.mk Setoid.r (Prequotient.of j 0) = Quot.mk Setoid.r zero) }\n x✝ +\n ZeroHom.toFun\n { toFun := coconeFun F j, map_zero' := (_ : Quot.mk Setoid.r (Prequotient.of j 0) = Quot.mk Setoid.r zero) } y✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; ","nextTactic":"apply Quot.sound","declUpToTactic":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.156_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun "} -{"state":"case a\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj : J\nx✝ y✝ : ↑(F.obj j)\n⊢ Setoid.r (Prequotient.of j (x✝ + y✝)) (add (Prequotient.of j x✝) (Prequotient.of j y✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; ","nextTactic":"apply Relation.add","declUpToTactic":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.156_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj j' : J\nf : j ⟶ j'\n⊢ F.map f ≫ coconeMorphism F j' = coconeMorphism F j","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ","nextTactic":"ext","declUpToTactic":"@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.164_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j "} -{"state":"case w\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj j' : J\nf : j ⟶ j'\nx✝ : ↑(F.obj j)\n⊢ (F.map f ≫ coconeMorphism F j') x✝ = (coconeMorphism F j) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n ","nextTactic":"apply Quot.sound","declUpToTactic":"@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.164_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j "} -{"state":"case w.a\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj j' : J\nf : j ⟶ j'\nx✝ : ↑(F.obj j)\n⊢ Setoid.r (Prequotient.of j' ((F.map f) x✝)) (Prequotient.of j x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n ","nextTactic":"apply Relation.map","declUpToTactic":"@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.164_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj j' : J\nf : j ⟶ j'\nx : ↑(F.obj j)\n⊢ (coconeMorphism F j') ((F.map f) x) = (coconeMorphism F j) x","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n ","nextTactic":"rw [← cocone_naturality F f]","declUpToTactic":"@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.172_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\nj j' : J\nf : j ⟶ j'\nx : ↑(F.obj j)\n⊢ (coconeMorphism F j') ((F.map f) x) = (F.map f ≫ coconeMorphism F j') x","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n ","nextTactic":"rfl","declUpToTactic":"@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.172_0.SNtL2EmEoMGqOYp","decl":"@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\n⊢ ColimitType F → ↑s.pt","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n ","nextTactic":"fapply Quot.lift","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case f\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\n⊢ Prequotient F → ↑s.pt","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · ","nextTactic":"exact descFunLift F s","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\n⊢ ∀ (a b : Prequotient F), Setoid.r a b → descFunLift F s a = descFunLift F s b","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · ","nextTactic":"intro x y r","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nr : Setoid.r x y\n⊢ descFunLift F s x = descFunLift F s y","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n ","nextTactic":"induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nr : Setoid.r x y\n⊢ descFunLift F s x = descFunLift F s y","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n ","nextTactic":"induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.refl\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s x✝ = descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n ","nextTactic":"| refl => rfl","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.refl\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s x✝ = descFunLift F s x���","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => ","nextTactic":"rfl","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.symm\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ y✝ : Prequotient F\nx✝ : Relation F x✝¹ y✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s y✝\n⊢ descFunLift F s y✝ = descFunLift F s x✝¹","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n ","nextTactic":"| symm _ _ _ r_ih => exact r_ih.symm","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.symm\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ y✝ : Prequotient F\nx✝ : Relation F x✝¹ y✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s y✝\n⊢ descFunLift F s y✝ = descFunLift F s x✝¹","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => ","nextTactic":"exact r_ih.symm","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.trans\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝² y✝ z✝ : Prequotient F\nx✝¹ : Relation F x✝² y✝\nx✝ : Relation F y✝ z✝\nr_ih_h : descFunLift F s x✝² = descFunLift F s y✝\nr_ih_k : descFunLift F s y✝ = descFunLift F s z✝\n⊢ descFunLift F s x✝² = descFunLift F s z✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n ","nextTactic":"| trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.trans\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝² y✝ z✝ : Prequotient F\nx✝¹ : Relation F x✝² y✝\nx✝ : Relation F y✝ z✝\nr_ih_h : descFunLift F s x✝² = descFunLift F s y✝\nr_ih_k : descFunLift F s y✝ = descFunLift F s z✝\n⊢ descFunLift F s x✝² = descFunLift F s z✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => ","nextTactic":"exact Eq.trans r_ih_h r_ih_k","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.map\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx✝ y : Prequotient F\nj j' : J\nf : j ⟶ j'\nx : ↑(F.obj j)\n⊢ descFunLift F s (Prequotient.of j' ((F.map f) x)) = descFunLift F s (Prequotient.of j x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n ","nextTactic":"| map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.map\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx✝ y : Prequotient F\nj j' : J\nf : j ⟶ j'\nx : ↑(F.obj j)\n⊢ descFunLift F s (Prequotient.of j' ((F.map f) x)) = descFunLift F s (Prequotient.of j x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => ","nextTactic":"simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nj✝ : J\n⊢ descFunLift F s (Prequotient.of j✝ 0) = descFunLift F s zero","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n ","nextTactic":"| zero => simp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.zero\nJ : Type u\ninst�� : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nj✝ : J\n⊢ descFunLift F s (Prequotient.of j✝ 0) = descFunLift F s zero","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => ","nextTactic":"simp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nj✝ : J\nx✝ : ↑(F.obj j✝)\n⊢ descFunLift F s (Prequotient.of j✝ (-x✝)) = descFunLift F s (neg (Prequotient.of j✝ x✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n ","nextTactic":"| neg => simp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nj✝ : J\nx✝ : ↑(F.obj j✝)\n⊢ descFunLift F s (Prequotient.of j✝ (-x✝)) = descFunLift F s (neg (Prequotient.of j✝ x✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => ","nextTactic":"simp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nj✝ : J\nx✝ y✝ : ↑(F.obj j✝)\n⊢ descFunLift F s (Prequotient.of j✝ (x✝ + y✝)) = descFunLift F s (add (Prequotient.of j✝ x✝) (Prequotient.of j✝ y✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n ","nextTactic":"| add => simp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : Prequotient F\nj✝ : J\nx✝ y✝ : ↑(F.obj j✝)\n⊢ descFunLift F s (Prequotient.of j✝ (x✝ + y✝)) = descFunLift F s (add (Prequotient.of j✝ x✝) (Prequotient.of j✝ y✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => ","nextTactic":"simp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.neg_1\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ x'✝ : Prequotient F\nx✝ : Relation F x✝¹ x'✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s x'✝\n⊢ descFunLift F s (neg x✝¹) = descFunLift F s (neg x'✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n ","nextTactic":"| neg_1 _ _ _ r_ih => dsimp; rw [r_ih]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.neg_1\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ x'✝ : Prequotient F\nx✝ : Relation F x✝¹ x'✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s x'✝\n⊢ descFunLift F s (neg x✝¹) = descFunLift F s (neg x'✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.neg_1\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ x'✝ : Prequotient F\nx✝ : Relation F x✝¹ x'✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s x'✝\n⊢ -descFunLift F s x✝¹ = -descFunLift F s x'✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; ","nextTactic":"rw [r_ih]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_1\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ x'✝ y✝ : Prequotient F\nx✝ : Relation F x✝¹ x'✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s x'✝\n⊢ descFunLift F s (add x✝¹ y✝) = descFunLift F s (add x'✝ y✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n ","nextTactic":"| add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_1\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ x'✝ y✝ : Prequotient F\nx✝ : Relation F x✝¹ x'✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s x'✝\n⊢ descFunLift F s (add x✝¹ y✝) = descFunLift F s (add x'✝ y✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_1\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ x'✝ y✝ : Prequotient F\nx✝ : Relation F x✝¹ x'✝\nr_ih : descFunLift F s x✝¹ = descFunLift F s x'✝\n⊢ descFunLift F s x✝¹ + descFunLift F s y✝ = descFunLift F s x'✝ + descFunLift F s y✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; ","nextTactic":"rw [r_ih]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_2\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ y✝ y'✝ : Prequotient F\nx✝ : Relation F y✝ y'✝\nr_ih : descFunLift F s y✝ = descFunLift F s y'✝\n⊢ descFunLift F s (add x✝¹ y✝) = descFunLift F s (add x✝¹ y'✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n ","nextTactic":"| add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_2\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ y✝ y'✝ : Prequotient F\nx✝ : Relation F y✝ y'✝\nr_ih : descFunLift F s y✝ = descFunLift F s y'✝\n⊢ descFunLift F s (add x✝¹ y✝) = descFunLift F s (add x✝¹ y'✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_2\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝¹ y✝ y'✝ : Prequotient F\nx✝ : Relation F y✝ y'✝\nr_ih : descFunLift F s y✝ = descFunLift F s y'✝\n⊢ descFunLift F s x✝¹ + descFunLift F s y✝ = descFunLift F s x✝¹ + descFunLift F s y'✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; ","nextTactic":"rw [r_ih]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.zero_add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s (add zero x✝) = descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n ","nextTactic":"| zero_add => dsimp; rw [zero_add]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.zero_add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s (add zero x✝) = descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.zero_add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ 0 + descFunLift F s x✝ = descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; ","nextTactic":"rw [zero_add]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s (add x✝ zero) = descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n ","nextTactic":"| add_zero => dsimp; rw [add_zero]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s (add x✝ zero) = descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s x✝ + 0 = descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; ","nextTactic":"rw [add_zero]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_left_neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s (add (neg x✝) x✝) = descFunLift F s zero","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n ","nextTactic":"| add_left_neg => dsimp; rw [add_left_neg]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_left_neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ descFunLift F s (add (neg x✝) x✝) = descFunLift F s zero","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_left_neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ : Prequotient F\n⊢ -descFunLift F s x✝ + descFunLift F s x✝ = 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; ","nextTactic":"rw [add_left_neg]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_comm\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ y✝ : Prequotient F\n⊢ descFunLift F s (add x✝ y✝) = descFunLift F s (add y✝ x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n ","nextTactic":"| add_comm => dsimp; rw [add_comm]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_comm\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ y✝ : Prequotient F\n⊢ descFunLift F s (add x✝ y✝) = descFunLift F s (add y✝ x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_comm\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ y✝ : Prequotient F\n⊢ descFunLift F s x✝ + descFunLift F s y✝ = descFunLift F s y✝ + descFunLift F s x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; ","nextTactic":"rw [add_comm]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_assoc\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ y✝ z✝ : Prequotient F\n⊢ descFunLift F s (add (add x✝ y✝) z✝) = descFunLift F s (add x✝ (add y✝ z✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n ","nextTactic":"| add_assoc => dsimp; rw [add_assoc]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_assoc\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ y✝ z✝ : Prequotient F\n⊢ descFunLift F s (add (add x✝ y✝) z✝) = descFunLift F s (add x✝ (add y✝ z✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => ","nextTactic":"dsimp","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"case a.add_assoc\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y x✝ y✝ z✝ : Prequotient F\n⊢ descFunLift F s x✝ + descFunLift F s y✝ + descFunLift F s z✝ =\n descFunLift F s x✝ + (descFunLift F s y✝ + descFunLift F s z✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; ","nextTactic":"rw [add_assoc]","declUpToTactic":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.195_0.SNtL2EmEoMGqOYp","decl":"/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : ↑(colimit F)\nx✝¹ x✝ : Prequotient F\n⊢ ZeroHom.toFun { toFun := descFun F s, map_zero' := (_ : descFun F s 0 = descFun F s 0) }\n (Quot.mk Setoid.r x✝¹ + Quot.mk Setoid.r x✝) =\n ZeroHom.toFun { toFun := descFun F s, map_zero' := (_ : descFun F s 0 = descFun F s 0) } (Quot.mk Setoid.r x✝¹) +\n ZeroHom.toFun { toFun := descFun F s, map_zero' := (_ : descFun F s 0 = descFun F s 0) } (Quot.mk Setoid.r x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by ","nextTactic":"dsimp","declUpToTactic":"/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.219_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : ↑(colimit F)\nx✝¹ x✝ : Prequotient F\n⊢ descFun F s (Quot.mk Setoid.r x✝¹ + Quot.mk Setoid.r x✝) =\n descFun F s (Quot.mk Setoid.r x✝¹) + descFun F s (Quot.mk Setoid.r x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; ","nextTactic":"rw [← quot_add F]","declUpToTactic":"/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.219_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nx y : ↑(colimit F)\nx✝¹ x✝ : Prequotient F\n⊢ descFun F s (Quot.mk Setoid.r (add x✝¹ x✝)) = descFun F s (Quot.mk Setoid.r x✝¹) + descFun F s (Quot.mk Setoid.r x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; ","nextTactic":"rfl","declUpToTactic":"/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.219_0.SNtL2EmEoMGqOYp","decl":"/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\n⊢ m (Quot.mk Setoid.r x) = ((fun s => descMorphism F s) s) (Quot.mk Setoid.r x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n ","nextTactic":"change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\n⊢ m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n ","nextTactic":"induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"J : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\n⊢ m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n ","nextTactic":"induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case of\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nj : J\nx : ↑(F.obj j)\n⊢ m (Quot.mk Setoid.r (Prequotient.of j x)) = (descMorphism F s) (Quot.mk Setoid.r (Prequotient.of j x))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n ","nextTactic":"| of j x => exact FunLike.congr_fun (w j) x","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case of\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nj : J\nx : ↑(F.obj j)\n⊢ m (Quot.mk Setoid.r (Prequotient.of j x)) = (descMorphism F s) (Quot.mk Setoid.r (Prequotient.of j x))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => ","nextTactic":"exact FunLike.congr_fun (w j) x","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx : Quot Setoid.r\n⊢ m (Quot.mk Setoid.r zero) = (descMorphism F s) (Quot.mk Setoid.r zero)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n ","nextTactic":"| zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx : Quot Setoid.r\n⊢ m (Quot.mk Setoid.r zero) = (descMorphism F s) (Quot.mk Setoid.r zero)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n ","nextTactic":"dsimp only [quot_zero]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx : Quot Setoid.r\n⊢ m 0 = (descMorphism F s) 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n ","nextTactic":"rw [map_zero]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case zero\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx : Quot Setoid.r\n⊢ 0 = (descMorphism F s) 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n ","nextTactic":"rw [map_zero]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\nih : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\n⊢ m (Quot.mk Setoid.r (neg x)) = (descMorphism F s) (Quot.mk Setoid.r (neg x))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n ","nextTactic":"| neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\nih : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\n⊢ m (Quot.mk Setoid.r (neg x)) = (descMorphism F s) (Quot.mk Setoid.r (neg x))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n ","nextTactic":"dsimp only [quot_neg]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\nih : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\n⊢ m (-Quot.mk Setoid.r x) = (descMorphism F s) (-Quot.mk Setoid.r x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n ","nextTactic":"rw [map_neg]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\nih : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\n⊢ -m (Quot.mk Setoid.r x) = (descMorphism F s) (-Quot.mk Setoid.r x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n ","nextTactic":"rw [map_neg]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case neg\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx : Prequotient F\nih : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\n⊢ -m (Quot.mk Setoid.r x) = -(descMorphism F s) (Quot.mk Setoid.r x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n ","nextTactic":"rw [ih]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx y : Prequotient F\nihx : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\nihy : m (Quot.mk Setoid.r y) = (descMorphism F s) (Quot.mk Setoid.r y)\n⊢ m (Quot.mk Setoid.r (add x y)) = (descMorphism F s) (Quot.mk Setoid.r (add x y))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n ","nextTactic":"| add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx y : Prequotient F\nihx : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\nihy : m (Quot.mk Setoid.r y) = (descMorphism F s) (Quot.mk Setoid.r y)\n⊢ m (Quot.mk Setoid.r (add x y)) = (descMorphism F s) (Quot.mk Setoid.r (add x y))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n ","nextTactic":"simp only [quot_add]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"case add\nJ : Type u\ninst✝ : Category.{v, u} J\nF : J ⥤ AddCommGroupCat\ns : Cocone F\nm : (colimitCocone F).pt ⟶ s.pt\nw : ∀ (j : J), (colimitCocone F).ι.app j ≫ m = s.ι.app j\nx✝ : Quot Setoid.r\nx y : Prequotient F\nihx : m (Quot.mk Setoid.r x) = (descMorphism F s) (Quot.mk Setoid.r x)\nihy : m (Quot.mk Setoid.r y) = (descMorphism F s) (Quot.mk Setoid.r y)\n⊢ m (Quot.mk Setoid.r x + Quot.mk Setoid.r y) = (descMorphism F s) (Quot.mk Setoid.r x + Quot.mk Setoid.r y)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n ","nextTactic":"erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]","declUpToTactic":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.227_0.SNtL2EmEoMGqOYp","decl":"/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\n⊢ f ≫ mk' (AddMonoidHom.range f) = 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ","nextTactic":"ext x","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"case w\nG H : AddCommGroupCat\nf : G ⟶ H\nx : ↑G\n⊢ (f ≫ mk' (AddMonoidHom.range f)) x = 0 x","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n ","nextTactic":"apply Quotient.sound","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"case w.a\nG H : AddCommGroupCat\nf : G ⟶ H\nx : ↑G\n⊢ f x ≈ 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n ","nextTactic":"apply leftRel_apply.mpr","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"case w.a\nG H : AddCommGroupCat\nf : G ⟶ H\nx : ↑G\n⊢ -f x + 0 ∈ AddMonoidHom.range f","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n ","nextTactic":"fconstructor","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"case w.a.w\nG H : AddCommGroupCat\nf : G ⟶ H\nx : ↑G\n⊢ ↑G\ncase w.a.h G H : AddCommGroupCat f : G ⟶ H x : ↑G ⊢ f ?w.a.w = -f x + 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n ","nextTactic":"exact -x","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"case w.a.h\nG H : AddCommGroupCat\nf : G ⟶ H\nx : ↑G\n⊢ f (-x) = -f x + 0","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n ","nextTactic":"simp only [add_zero, AddMonoidHom.map_neg]","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\n⊢ AddMonoidHom.range f ≤ AddMonoidHom.ker (cokernel.π f)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n ","nextTactic":"rintro _ ⟨x, rfl⟩","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"case intro\nG H : AddCommGroupCat\nf : G ⟶ H\nx : ↑G\n⊢ f x ∈ AddMonoidHom.ker (cokernel.π f)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n ","nextTactic":"exact cokernel.condition_apply f x","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\n⊢ cokernel.desc f (mk' (AddMonoidHom.range f)) (_ : f ≫ mk' (AddMonoidHom.range f) = 0) ≫\n lift (AddMonoidHom.range f) (cokernel.π f)\n (_ : ∀ ⦃x : ↑H⦄, x ∈ AddMonoidHom.range f → x ∈ AddMonoidHom.ker (cokernel.π f)) =\n 𝟙 (cokernel f)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n ","nextTactic":"refine coequalizer.hom_ext ?_","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\n⊢ coequalizer.π f 0 ≫\n cokernel.desc f (mk' (AddMonoidHom.range f)) (_ : f ≫ mk' (AddMonoidHom.range f) = 0) ≫\n lift (AddMonoidHom.range f) (cokernel.π f)\n (_ : ∀ ⦃x : ↑H⦄, x ∈ AddMonoidHom.range f → x ∈ AddMonoidHom.ker (cokernel.π f)) =\n coequalizer.π f 0 ≫ 𝟙 (cokernel f)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n ","nextTactic":"simp only [coequalizer_as_cokernel, cokernel.π_desc_assoc, Category.comp_id]","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\n⊢ mk' (AddMonoidHom.range f) ≫\n lift (AddMonoidHom.range f) (cokernel.π f)\n (_ : ∀ ⦃x : ↑H⦄, x ∈ AddMonoidHom.range f → x ∈ AddMonoidHom.ker (cokernel.π f)) =\n cokernel.π f","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n simp only [coequalizer_as_cokernel, cokernel.π_desc_assoc, Category.comp_id]\n ","nextTactic":"rfl","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n simp only [coequalizer_as_cokernel, cokernel.π_desc_assoc, Category.comp_id]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\n⊢ lift (AddMonoidHom.range f) (cokernel.π f)\n (_ : ∀ ⦃x : ↑H⦄, x ∈ AddMonoidHom.range f → x ∈ AddMonoidHom.ker (cokernel.π f)) ≫\n cokernel.desc f (mk' (AddMonoidHom.range f)) (_ : f ≫ mk' (AddMonoidHom.range f) = 0) =\n 𝟙 (of (↑H ⧸ AddMonoidHom.range f))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n simp only [coequalizer_as_cokernel, cokernel.π_desc_assoc, Category.comp_id]\n rfl\n inv_hom_id := by\n ","nextTactic":"ext x","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n simp only [coequalizer_as_cokernel, cokernel.π_desc_assoc, Category.comp_id]\n rfl\n inv_hom_id := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "} -{"state":"case w\nG H : AddCommGroupCat\nf : G ⟶ H\nx : ↑(of (↑H ⧸ AddMonoidHom.range f))\n⊢ (lift (AddMonoidHom.range f) (cokernel.π f)\n (_ : ∀ ⦃x : ↑H⦄, x ∈ AddMonoidHom.range f → x ∈ AddMonoidHom.ker (cokernel.π f)) ≫\n cokernel.desc f (mk' (AddMonoidHom.range f)) (_ : f ≫ mk' (AddMonoidHom.range f) = 0))\n x =\n (𝟙 (of (↑H ⧸ AddMonoidHom.range f))) x","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison\n-/\nimport Mathlib.Algebra.Category.GroupCat.Preadditive\nimport Mathlib.GroupTheory.QuotientGroup\nimport Mathlib.CategoryTheory.Limits.Shapes.Kernels\nimport Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits\nimport Mathlib.CategoryTheory.ConcreteCategory.Elementwise\n\n#align_import algebra.category.Group.colimits from \"leanprover-community/mathlib\"@\"70fd9563a21e7b963887c9360bd29b2393e6225a\"\n\n/-!\n# The category of additive commutative groups has all colimits.\n\nThis file uses a \"pre-automated\" approach, just as for `Mon/Colimits.lean`.\nIt is a very uniform approach, that conceivably could be synthesised directly\nby a tactic that analyses the shape of `AddCommGroup` and `MonoidHom`.\n\nTODO:\nIn fact, in `AddCommGroupCat` there is a much nicer model of colimits as quotients\nof finitely supported functions, and we really should implement this as well (or instead).\n-/\n\n-- porting note: `AddCommGroup` in all the names\nset_option linter.uppercaseLean3 false\n\nuniverse w u v\n\nopen CategoryTheory Limits\n\n-- [ROBOT VOICE]:\n-- You should pretend for now that this file was automatically generated.\n-- It follows the same template as colimits in Mon.\nnamespace AddCommGroupCat\n\nvariable {J : Type u} [Category.{v} J] (F : J ⥤ AddCommGroupCat.{max u v w})\n\nnamespace Colimits\n\n/-!\nWe build the colimit of a diagram in `AddCommGroupCat` by constructing the\nfree group on the disjoint union of all the abelian groups in the diagram,\nthen taking the quotient by the abelian group laws within each abelian group,\nand the identifications given by the morphisms in the diagram.\n-/\n\n/-- An inductive type representing all group expressions (without relations)\non a collection of types indexed by the objects of `J`.\n-/\ninductive Prequotient\n -- There's always `of`\n | of : ∀ (j : J) (_ : F.obj j), Prequotient\n -- Then one generator for each operation\n | zero : Prequotient\n | neg : Prequotient → Prequotient\n | add : Prequotient → Prequotient → Prequotient\n#align AddCommGroup.colimits.prequotient AddCommGroupCat.Colimits.Prequotient\n\ninstance : Inhabited (Prequotient.{w} F) :=\n ⟨Prequotient.zero⟩\n\nopen Prequotient\n\n/-- The relation on `prequotient` saying when two expressions are equal\nbecause of the abelian group laws, or\nbecause one element is mapped to another by a morphism in the diagram.\n-/\ninductive Relation : Prequotient.{w} F → Prequotient.{w} F → Prop\n -- Make it an equivalence relation:\n | refl : ∀ x, Relation x x\n | symm : ∀ (x y) (_ : Relation x y), Relation y x\n | trans : ∀ (x y z) (_ : Relation x y) (_ : Relation y z), Relation x z\n -- There's always a `map` relation\n | map : ∀ (j j' : J) (f : j ⟶ j') (x : F.obj j), Relation (Prequotient.of j' (F.map f x))\n (Prequotient.of j x)\n -- Then one relation per operation, describing the interaction with `of`\n | zero : ∀ j, Relation (Prequotient.of j 0) zero\n | neg : ∀ (j) (x : F.obj j), Relation (Prequotient.of j (-x)) (neg (Prequotient.of j x))\n | add : ∀ (j) (x y : F.obj j), Relation (Prequotient.of j (x + y)) (add (Prequotient.of j x)\n (Prequotient.of j y))\n -- Then one relation per argument of each operation\n | neg_1 : ∀ (x x') (_ : Relation x x'), Relation (neg x) (neg x')\n | add_1 : ∀ (x x' y) (_ : Relation x x'), Relation (add x y) (add x' y)\n | add_2 : ∀ (x y y') (_ : Relation y y'), Relation (add x y) (add x y')\n -- And one relation per axiom\n | zero_add : ∀ x, Relation (add zero x) x\n | add_zero : ∀ x, Relation (add x zero) x\n | add_left_neg : ∀ x, Relation (add (neg x) x) zero\n | add_comm : ∀ x y, Relation (add x y) (add y x)\n | add_assoc : ∀ x y z, Relation (add (add x y) z) (add x (add y z))\n#align AddCommGroup.colimits.relation AddCommGroupCat.Colimits.Relation\n\n/--\nThe setoid corresponding to group expressions modulo abelian group relations and identifications.\n-/\ndef colimitSetoid : Setoid (Prequotient.{w} F) where\n r := Relation F\n iseqv := ⟨Relation.refl, fun r => Relation.symm _ _ r, fun r => Relation.trans _ _ _ r⟩\n#align AddCommGroup.colimits.colimit_setoid AddCommGroupCat.Colimits.colimitSetoid\n\nattribute [instance] colimitSetoid\n\n/-- The underlying type of the colimit of a diagram in `AddCommGroupCat`.\n-/\ndef ColimitType : Type max u v w :=\n Quotient (colimitSetoid.{w} F)\n#align AddCommGroup.colimits.colimit_type AddCommGroupCat.Colimits.ColimitType\n\ninstance : AddCommGroup (ColimitType.{w} F) where\n zero := Quotient.mk _ zero\n neg := Quotient.map neg Relation.neg_1\n add := Quotient.map₂ add <| fun x x' rx y y' ry =>\n Setoid.trans (Relation.add_1 _ _ y rx) (Relation.add_2 x' _ _ ry)\n zero_add := Quotient.ind <| fun _ => Quotient.sound <| Relation.zero_add _\n add_zero := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_zero _\n add_left_neg := Quotient.ind <| fun _ => Quotient.sound <| Relation.add_left_neg _\n add_comm := Quotient.ind₂ <| fun _ _ => Quotient.sound <| Relation.add_comm _ _\n add_assoc := Quotient.ind <| fun _ => Quotient.ind₂ <| fun _ _ =>\n Quotient.sound <| Relation.add_assoc _ _ _\n\ninstance ColimitTypeInhabited : Inhabited (ColimitType.{w} F) := ⟨0⟩\n\n@[simp]\ntheorem quot_zero : Quot.mk Setoid.r zero = (0 : ColimitType.{w} F) :=\n rfl\n#align AddCommGroup.colimits.quot_zero AddCommGroupCat.Colimits.quot_zero\n\n@[simp]\ntheorem quot_neg (x) :\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r (neg x) : ColimitType.{w} F) =\n -(by exact Quot.mk Setoid.r x) :=\n rfl\n#align AddCommGroup.colimits.quot_neg AddCommGroupCat.Colimits.quot_neg\n\n@[simp]\ntheorem quot_add (x y) :\n (by exact Quot.mk Setoid.r (add x y) : ColimitType.{w} F) =\n -- Porting note : force Lean to treat `ColimitType F` no as `Quot _`\n (by exact Quot.mk Setoid.r x) + (by exact Quot.mk Setoid.r y) :=\n rfl\n#align AddCommGroup.colimits.quot_add AddCommGroupCat.Colimits.quot_add\n\n/-- The bundled abelian group giving the colimit of a diagram. -/\ndef colimit : AddCommGroupCat :=\n AddCommGroupCat.of (ColimitType.{w} F)\n#align AddCommGroup.colimits.colimit AddCommGroupCat.Colimits.colimit\n\n/-- The function from a given abelian group in the diagram to the colimit abelian group. -/\ndef coconeFun (j : J) (x : F.obj j) : ColimitType.{w} F :=\n Quot.mk _ (Prequotient.of j x)\n#align AddCommGroup.colimits.cocone_fun AddCommGroupCat.Colimits.coconeFun\n\n/-- The group homomorphism from a given abelian group in the diagram to the colimit abelian\ngroup. -/\ndef coconeMorphism (j : J) : F.obj j ⟶ colimit.{w} F where\n toFun := coconeFun F j\n map_zero' := by apply Quot.sound; apply Relation.zero\n map_add' := by intros; apply Quot.sound; apply Relation.add\n#align AddCommGroup.colimits.cocone_morphism AddCommGroupCat.Colimits.coconeMorphism\n\n@[simp]\ntheorem cocone_naturality {j j' : J} (f : j ⟶ j') :\n F.map f ≫ coconeMorphism.{w} F j' = coconeMorphism F j := by\n ext\n apply Quot.sound\n apply Relation.map\n#align AddCommGroup.colimits.cocone_naturality AddCommGroupCat.Colimits.cocone_naturality\n\n@[simp]\ntheorem cocone_naturality_components (j j' : J) (f : j ⟶ j') (x : F.obj j) :\n (coconeMorphism.{w} F j') (F.map f x) = (coconeMorphism F j) x := by\n rw [← cocone_naturality F f]\n rfl\n#align AddCommGroup.colimits.cocone_naturality_components AddCommGroupCat.Colimits.cocone_naturality_components\n\n/-- The cocone over the proposed colimit abelian group. -/\ndef colimitCocone : Cocone F where\n pt := colimit.{w} F\n ι := { app := coconeMorphism F }\n#align AddCommGroup.colimits.colimit_cocone AddCommGroupCat.Colimits.colimitCocone\n\n/-- The function from the free abelian group on the diagram to the cone point of any other\ncocone. -/\n@[simp]\ndef descFunLift (s : Cocone F) : Prequotient.{w} F → s.pt\n | Prequotient.of j x => (s.ι.app j) x\n | zero => 0\n | neg x => -descFunLift s x\n | add x y => descFunLift s x + descFunLift s y\n#align AddCommGroup.colimits.desc_fun_lift AddCommGroupCat.Colimits.descFunLift\n\n/-- The function from the colimit abelian group to the cone point of any other cocone. -/\ndef descFun (s : Cocone F) : ColimitType.{w} F → s.pt := by\n fapply Quot.lift\n · exact descFunLift F s\n · intro x y r\n induction r with\n | refl => rfl\n | symm _ _ _ r_ih => exact r_ih.symm\n | trans _ _ _ _ _ r_ih_h r_ih_k => exact Eq.trans r_ih_h r_ih_k\n | map j j' f x => simpa only [descFunLift, Functor.const_obj_obj] using\n FunLike.congr_fun (s.ι.naturality f) x\n | zero => simp\n | neg => simp\n | add => simp\n | neg_1 _ _ _ r_ih => dsimp; rw [r_ih]\n | add_1 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | add_2 _ _ _ _ r_ih => dsimp; rw [r_ih]\n | zero_add => dsimp; rw [zero_add]\n | add_zero => dsimp; rw [add_zero]\n | add_left_neg => dsimp; rw [add_left_neg]\n | add_comm => dsimp; rw [add_comm]\n | add_assoc => dsimp; rw [add_assoc]\n#align AddCommGroup.colimits.desc_fun AddCommGroupCat.Colimits.descFun\n\n/-- The group homomorphism from the colimit abelian group to the cone point of any other cocone. -/\ndef descMorphism (s : Cocone F) : colimit.{w} F ⟶ s.pt where\n toFun := descFun F s\n map_zero' := rfl\n -- Porting note : in `mathlib3`, nothing needs to be done after `induction`\n map_add' x y := Quot.induction_on₂ x y fun _ _ => by dsimp; rw [← quot_add F]; rfl\n#align AddCommGroup.colimits.desc_morphism AddCommGroupCat.Colimits.descMorphism\n\n/-- Evidence that the proposed colimit is the colimit. -/\ndef colimitCoconeIsColimit : IsColimit (colimitCocone.{w} F) where\n desc s := descMorphism F s\n uniq s m w := FunLike.ext _ _ <| fun x => Quot.inductionOn x fun x => by\n change (m : ColimitType F →+ s.pt) _ = (descMorphism F s : ColimitType F →+ s.pt) _\n induction x using Prequotient.recOn with\n | of j x => exact FunLike.congr_fun (w j) x\n | zero =>\n dsimp only [quot_zero]\n rw [map_zero]\n rw [map_zero]\n | neg x ih =>\n dsimp only [quot_neg]\n rw [map_neg]\n rw [map_neg]\n rw [ih]\n | add x y ihx ihy =>\n simp only [quot_add]\n erw [m.map_add, (descMorphism F s).map_add, ihx, ihy]\n#align AddCommGroup.colimits.colimit_cocone_is_colimit AddCommGroupCat.Colimits.colimitCoconeIsColimit\n\nend Colimits\n\nlemma hasColimit : HasColimit F := ⟨_, Colimits.colimitCoconeIsColimit.{w} F⟩\n\nvariable (J)\n\nlemma hasColimitsOfShape : HasColimitsOfShape J AddCommGroupCat.{max u v w} where\n has_colimit F := hasColimit.{w} F\n\nlemma hasColimitsOfSize : HasColimitsOfSize.{v, u} AddCommGroupCat.{max u v w} :=\n ⟨fun _ => hasColimitsOfShape.{w} _⟩\n\ninstance hasColimits : HasColimits AddCommGroupCat.{w} := hasColimitsOfSize.{w}\n#align AddCommGroup.colimits.has_colimits_AddCommGroup AddCommGroupCat.hasColimits\n\ninstance : HasColimitsOfSize.{v, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{u, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{v}\ninstance : HasColimitsOfSize.{u, v} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{v, u} (AddCommGroupCatMax.{u, v}) := hasColimitsOfSize.{u}\ninstance : HasColimitsOfSize.{0, 0} (AddCommGroupCat.{u}) := hasColimitsOfSize.{u, 0, 0}\n\nexample : HasColimits AddCommGroupCatMax.{v, u} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCatMax.{u, v} :=\n inferInstance\n\nexample : HasColimits AddCommGroupCat.{u} :=\n inferInstance\n\nend AddCommGroupCat\n\nnamespace AddCommGroupCat\n\nopen QuotientAddGroup\n\n/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n simp only [coequalizer_as_cokernel, cokernel.π_desc_assoc, Category.comp_id]\n rfl\n inv_hom_id := by\n ext x\n ","nextTactic":"exact QuotientAddGroup.induction_on x <| cokernel.π_desc_apply f _ _","declUpToTactic":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom := cokernel.desc f (mk' _) <| by\n ext x\n apply Quotient.sound\n apply leftRel_apply.mpr\n fconstructor\n exact -x\n simp only [add_zero, AddMonoidHom.map_neg]\n inv :=\n QuotientAddGroup.lift _ (cokernel.π f) <| by\n rintro _ ⟨x, rfl⟩\n exact cokernel.condition_apply f x\n hom_inv_id := by\n refine coequalizer.hom_ext ?_\n simp only [coequalizer_as_cokernel, cokernel.π_desc_assoc, Category.comp_id]\n rfl\n inv_hom_id := by\n ext x\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Colimits.284_0.SNtL2EmEoMGqOYp","decl":"/-- The categorical cokernel of a morphism in `AddCommGroupCat`\nagrees with the usual group-theoretical quotient.\n-/\nnoncomputable def cokernelIsoQuotient {G H : AddCommGroupCat.{u}} (f : G ⟶ H) :\n cokernel f ≅ AddCommGroupCat.of (H ⧸ AddMonoidHom.range f) where\n hom "}