diff --git "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Basic.jsonl" "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Basic.jsonl" deleted file mode 100644--- "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Basic.jsonl" +++ /dev/null @@ -1,25 +0,0 @@ -{"state":"⊢ ConcreteCategory GroupCat","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n ","nextTactic":"dsimp only [GroupCat]","declUpToTactic":"@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.50_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat "} -{"state":"⊢ ConcreteCategory (Bundled Group)","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n ","nextTactic":"infer_instance","declUpToTactic":"@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.50_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat "} -{"state":"R S : GroupCat\ni : R ⟶ S\nr : ↑R\nh : r = 1\n⊢ i r = 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by ","nextTactic":"simp [h]","declUpToTactic":"@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.165_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 "} -{"state":"⊢ ConcreteCategory CommGroupCat","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n ","nextTactic":"dsimp only [CommGroupCat]","declUpToTactic":"@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.195_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat "} -{"state":"⊢ ConcreteCategory (Bundled CommGroup)","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n ","nextTactic":"infer_instance","declUpToTactic":"@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.195_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat "} -{"state":"R S : CommGroupCat\ni : R ⟶ S\nr : ↑R\nh : r = 1\n⊢ i r = 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by ","nextTactic":"simp [h]","declUpToTactic":"@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.332_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 "} -{"state":"G : AddCommGroupCat\nh k : ↑G\nw : asHom h = asHom k\n⊢ h = k","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n ","nextTactic":"convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w","declUpToTactic":"theorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.355_0.kWB42XWRpLpYIMU","decl":"theorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) "} -{"state":"case h.e'_2\nG : AddCommGroupCat\nh k : ↑G\nw : asHom h = asHom k\n⊢ h = (asHom h) 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> ","nextTactic":"simp","declUpToTactic":"theorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.355_0.kWB42XWRpLpYIMU","decl":"theorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) "} -{"state":"case h.e'_3\nG : AddCommGroupCat\nh k : ↑G\nw : asHom h = asHom k\n⊢ k = (asHom k) 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> ","nextTactic":"simp","declUpToTactic":"theorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.355_0.kWB42XWRpLpYIMU","decl":"theorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\ninst✝ : Mono f\ng₁ g₂ : ↑G\nh : f g₁ = f g₂\n⊢ g₁ = g₂","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n ","nextTactic":"have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat","declUpToTactic":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.369_0.kWB42XWRpLpYIMU","decl":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\ninst✝ : Mono f\ng₁ g₂ : ↑G\nh : f g₁ = f g₂\n⊢ asHom g₁ ≫ f = asHom g₂ ≫ f","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by ","nextTactic":"aesop_cat","declUpToTactic":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.369_0.kWB42XWRpLpYIMU","decl":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\ninst✝ : Mono f\ng₁ g₂ : ↑G\nh : f g₁ = f g₂\nt0 : asHom g₁ ≫ f = asHom g₂ ≫ f\n⊢ g₁ = g₂","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n ","nextTactic":"have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0","declUpToTactic":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.369_0.kWB42XWRpLpYIMU","decl":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f "} -{"state":"G H : AddCommGroupCat\nf : G ⟶ H\ninst✝ : Mono f\ng₁ g₂ : ↑G\nh : f g₁ = f g₂\nt0 : asHom g₁ ≫ f = asHom g₂ ≫ f\nt1 : asHom g₁ = asHom g₂\n⊢ g₁ = g₂","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ��� S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n ","nextTactic":"apply asHom_injective t1","declUpToTactic":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.369_0.kWB42XWRpLpYIMU","decl":"theorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f "} -{"state":"α : Type u\n⊢ (fun g => g.toEquiv) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by ","nextTactic":"aesop","declUpToTactic":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.467_0.kWB42XWRpLpYIMU","decl":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom "} -{"state":"α : Type u\n⊢ ∀ (x y : ↑(GroupCat.of (Aut α))),\n OneHom.toFun { toFun := fun g => g.toEquiv, map_one' := (_ : (fun g => g.toEquiv) 1 = 1) } (x * y) =\n OneHom.toFun { toFun := fun g => g.toEquiv, map_one' := (_ : (fun g => g.toEquiv) 1 = 1) } x *\n OneHom.toFun { toFun := fun g => g.toEquiv, map_one' := (_ : (fun g => g.toEquiv) 1 = 1) } y","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by ","nextTactic":"aesop","declUpToTactic":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.467_0.kWB42XWRpLpYIMU","decl":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom "} -{"state":"α : Type u\n⊢ (fun g => Equiv.toIso g) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by ","nextTactic":"aesop","declUpToTactic":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.467_0.kWB42XWRpLpYIMU","decl":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom "} -{"state":"α : Type u\n⊢ ∀ (x y : ↑(GroupCat.of (Equiv.Perm α))),\n OneHom.toFun { toFun := fun g => Equiv.toIso g, map_one' := (_ : (fun g => Equiv.toIso g) 1 = 1) } (x * y) =\n OneHom.toFun { toFun := fun g => Equiv.toIso g, map_one' := (_ : (fun g => Equiv.toIso g) 1 = 1) } x *\n OneHom.toFun { toFun := fun g => Equiv.toIso g, map_one' := (_ : (fun g => Equiv.toIso g) 1 = 1) } y","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by ","nextTactic":"aesop","declUpToTactic":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.467_0.kWB42XWRpLpYIMU","decl":"/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom "} -{"state":"X Y : GroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget GroupCat).map f)\n⊢ IsIso f","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n ","nextTactic":"let i := asIso ((forget GroupCat).map f)","declUpToTactic":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.490_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ "} -{"state":"X Y : GroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget GroupCat).map f)\ni : (forget GroupCat).obj X ≅ (forget GroupCat).obj Y := asIso ((forget GroupCat).map f)\n⊢ IsIso f","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n ","nextTactic":"let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }","declUpToTactic":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.490_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ "} -{"state":"X Y : GroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget GroupCat).map f)\ni : (forget GroupCat).obj X ≅ (forget GroupCat).obj Y := asIso ((forget GroupCat).map f)\nsrc✝ : (forget GroupCat).obj X ≃ (forget GroupCat).obj Y := i.toEquiv\n⊢ ∀ (x y : ↑X),\n Equiv.toFun\n { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n (x * y) =\n Equiv.toFun\n { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n x *\n Equiv.toFun\n { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n y","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by ","nextTactic":"aesop","declUpToTactic":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.490_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ "} -{"state":"X Y : GroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget GroupCat).map f)\ni : (forget GroupCat).obj X ≅ (forget GroupCat).obj Y := asIso ((forget GroupCat).map f)\ne : ↑X ≃* ↑Y :=\n let src := i.toEquiv;\n {\n toEquiv :=\n { toFun := src.toFun, invFun := src.invFun, left_inv := (_ : Function.LeftInverse src.invFun src.toFun),\n right_inv := (_ : Function.RightInverse src.invFun src.toFun) },\n map_mul' := (_ : ∀ (x_1 y : ↑X), f (x_1 * y) = f x_1 * f y) }\n⊢ IsIso f","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n ","nextTactic":"exact IsIso.of_iso e.toGroupCatIso","declUpToTactic":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.490_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ "} -{"state":"X Y : CommGroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget CommGroupCat).map f)\n⊢ IsIso f","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n exact IsIso.of_iso e.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align Group.forget_reflects_isos GroupCat.forget_reflects_isos\nset_option linter.uppercaseLean3 false in\n#align AddGroup.forget_reflects_isos AddGroupCat.forget_reflects_isos\n\n@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n ","nextTactic":"let i := asIso ((forget CommGroupCat).map f)","declUpToTactic":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.501_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ "} -{"state":"X Y : CommGroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget CommGroupCat).map f)\ni : (forget CommGroupCat).obj X ≅ (forget CommGroupCat).obj Y := asIso ((forget CommGroupCat).map f)\n⊢ IsIso f","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n exact IsIso.of_iso e.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align Group.forget_reflects_isos GroupCat.forget_reflects_isos\nset_option linter.uppercaseLean3 false in\n#align AddGroup.forget_reflects_isos AddGroupCat.forget_reflects_isos\n\n@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget CommGroupCat).map f)\n ","nextTactic":"let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }","declUpToTactic":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget CommGroupCat).map f)\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.501_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ "} -{"state":"X Y : CommGroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget CommGroupCat).map f)\ni : (forget CommGroupCat).obj X ≅ (forget CommGroupCat).obj Y := asIso ((forget CommGroupCat).map f)\nsrc✝ : (forget CommGroupCat).obj X ≃ (forget CommGroupCat).obj Y := i.toEquiv\n⊢ ∀ (x y : ↑X),\n Equiv.toFun\n { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n (x * y) =\n Equiv.toFun\n { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n x *\n Equiv.toFun\n { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),\n right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }\n y","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n exact IsIso.of_iso e.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align Group.forget_reflects_isos GroupCat.forget_reflects_isos\nset_option linter.uppercaseLean3 false in\n#align AddGroup.forget_reflects_isos AddGroupCat.forget_reflects_isos\n\n@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget CommGroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by ","nextTactic":"aesop","declUpToTactic":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget CommGroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.501_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ "} -{"state":"X Y : CommGroupCat\nf : X ⟶ Y\nx✝ : IsIso ((forget CommGroupCat).map f)\ni : (forget CommGroupCat).obj X ≅ (forget CommGroupCat).obj Y := asIso ((forget CommGroupCat).map f)\ne : ↑X ≃* ↑Y :=\n let src := i.toEquiv;\n {\n toEquiv :=\n { toFun := src.toFun, invFun := src.invFun, left_inv := (_ : Function.LeftInverse src.invFun src.toFun),\n right_inv := (_ : Function.RightInverse src.invFun src.toFun) },\n map_mul' := (_ : ∀ (x_1 y : ↑X), f (x_1 * y) = f x_1 * f y) }\n⊢ IsIso f","srcUpToTactic":"/-\nCopyright (c) 2018 Johan Commelin. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Johan Commelin\n-/\nimport Mathlib.Algebra.Category.MonCat.Basic\nimport Mathlib.CategoryTheory.Endomorphism\n\n#align_import algebra.category.Group.basic from \"leanprover-community/mathlib\"@\"524793de15bc4c52ee32d254e7d7867c7176b3af\"\n\n/-!\n# Category instances for Group, AddGroup, CommGroup, and AddCommGroup.\n\nWe introduce the bundled categories:\n* `GroupCat`\n* `AddGroupCat`\n* `CommGroupCat`\n* `AddCommGroupCat`\nalong with the relevant forgetful functors between them, and to the bundled monoid categories.\n-/\n\nset_option autoImplicit true\n\n\nuniverse u v\n\nopen CategoryTheory\n\n/-- The category of groups and group morphisms. -/\n@[to_additive]\ndef GroupCat : Type (u + 1) :=\n Bundled Group\nset_option linter.uppercaseLean3 false in\n#align Group GroupCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup AddGroupCat\n\n/-- The category of additive groups and group morphisms -/\nadd_decl_doc AddGroupCat\n\nnamespace GroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection\n (fun {α : Type*} (h : Group α) => h.toDivInvMonoid.toMonoid) := ⟨⟩\n\nderiving instance LargeCategory for GroupCat\nattribute [to_additive] instGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory GroupCat := by\n dsimp only [GroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort GroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance (X : GroupCat) : Group X := X.str\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : GroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : GroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : GroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : GroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[simp] lemma forget_map (f : X ⟶ Y) : (forget GroupCat).map f = (f : X → Y) := rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : GroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `Group` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (X : Type u) [Group X] : GroupCat :=\n Bundled.of X\nset_option linter.uppercaseLean3 false in\n#align Group.of GroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of AddGroupCat.of\n\n/-- Construct a bundled `AddGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddGroupCat.of\n\n@[to_additive (attr := simp)]\ntheorem coe_of (R : Type u) [Group R] : ↑(GroupCat.of R) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.coe_of GroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddGroup.coe_of AddGroupCat.coe_of\n\n@[to_additive]\ninstance : Inhabited GroupCat :=\n ⟨GroupCat.of PUnit⟩\n\n@[to_additive hasForgetToAddMonCat]\ninstance hasForgetToMonCat : HasForget₂ GroupCat MonCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align Group.has_forget_to_Mon GroupCat.hasForgetToMonCat\nset_option linter.uppercaseLean3 false in\n#align AddGroup.has_forget_to_AddMon AddGroupCat.hasForgetToAddMonCat\n\n@[to_additive]\ninstance : Coe GroupCat.{u} MonCat.{u} where coe := (forget₂ GroupCat MonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : GroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : GroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.one_apply GroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.zero_apply AddGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `GroupCat`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [Group X] [Group Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom GroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom AddGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddGroup`. -/\nadd_decl_doc AddGroupCat.ofHom\n\n@[to_additive]\ntheorem ofHom_apply {X Y : Type _} [Group X] [Group Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align Group.of_hom_apply GroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_hom_apply AddGroupCat.ofHom_apply\n\n@[to_additive]\ninstance ofUnique (G : Type*) [Group G] [i : Unique G] : Unique (GroupCat.of G) := i\nset_option linter.uppercaseLean3 false in\n#align Group.of_unique GroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddGroup.of_unique AddGroupCat.ofUnique\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : GroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend GroupCat\n\n/-- The category of commutative groups and group morphisms. -/\n@[to_additive]\ndef CommGroupCat : Type (u + 1) :=\n Bundled CommGroup\nset_option linter.uppercaseLean3 false in\n#align CommGroup CommGroupCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup AddCommGroupCat\n\n/-- The category of additive commutative groups and group morphisms. -/\nadd_decl_doc AddCommGroupCat\n\n/-- `Ab` is an abbreviation for `AddCommGroup`, for the sake of mathematicians' sanity. -/\nabbrev Ab := AddCommGroupCat\nset_option linter.uppercaseLean3 false in\n#align Ab Ab\n\nnamespace CommGroupCat\n\n@[to_additive]\ninstance : BundledHom.ParentProjection @CommGroup.toGroup := ⟨⟩\n\nderiving instance LargeCategory for CommGroupCat\nattribute [to_additive] instCommGroupCatLargeCategory\n\n@[to_additive]\ninstance concreteCategory : ConcreteCategory CommGroupCat := by\n dsimp only [CommGroupCat]\n infer_instance\n\n@[to_additive]\ninstance : CoeSort CommGroupCat (Type*) where\n coe X := X.α\n\n@[to_additive]\ninstance commGroupInstance (X : CommGroupCat) : CommGroup X := X.str\nset_option linter.uppercaseLean3 false in\n#align CommGroup.comm_group_instance CommGroupCat.commGroupInstance\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.add_comm_group_instance AddCommGroupCat.addCommGroupInstance\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance {X Y : CommGroupCat} : CoeFun (X ⟶ Y) fun _ => X → Y where\n coe (f : X →* Y) := f\n\n@[to_additive]\ninstance FunLike_instance (X Y : CommGroupCat) : FunLike (X ⟶ Y) X (fun _ => Y) :=\n show FunLike (X →* Y) X (fun _ => Y) from inferInstance\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_id {X : CommGroupCat} : (𝟙 X : X → X) = id := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma coe_comp {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g : X → Z) = g ∘ f := rfl\n\n@[to_additive]\nlemma comp_def {X Y Z : CommGroupCat} {f : X ⟶ Y} {g : Y ⟶ Z} : f ≫ g = g.comp f := rfl\n\n-- porting note: added\n@[to_additive (attr := simp)]\nlemma forget_map {X Y : CommGroupCat} (f : X ⟶ Y) :\n (forget CommGroupCat).map f = (f : X → Y) :=\n rfl\n\n@[to_additive (attr := ext)]\nlemma ext {X Y : CommGroupCat} {f g : X ⟶ Y} (w : ∀ x : X, f x = g x) : f = g :=\n MonoidHom.ext w\n\n/-- Construct a bundled `CommGroup` from the underlying type and typeclass. -/\n@[to_additive]\ndef of (G : Type u) [CommGroup G] : CommGroupCat :=\n Bundled.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of CommGroupCat.of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of AddCommGroupCat.of\n\n/-- Construct a bundled `AddCommGroup` from the underlying type and typeclass. -/\nadd_decl_doc AddCommGroupCat.of\n\n@[to_additive]\ninstance : Inhabited CommGroupCat :=\n ⟨CommGroupCat.of PUnit⟩\n\n-- Porting note: removed `@[simp]` here, as it makes it harder to tell when to apply\n-- bundled or unbundled lemmas.\n-- (This change seems dangerous!)\n@[to_additive]\ntheorem coe_of (R : Type u) [CommGroup R] : (CommGroupCat.of R : Type u) = R :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.coe_of CommGroupCat.coe_of\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.coe_of AddCommGroupCat.coe_of\n\n@[to_additive]\ninstance ofUnique (G : Type*) [CommGroup G] [i : Unique G] : Unique (CommGroupCat.of G) :=\n i\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_unique CommGroupCat.ofUnique\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_unique AddCommGroupCat.ofUnique\n\n@[to_additive]\ninstance hasForgetToGroup : HasForget₂ CommGroupCat GroupCat :=\n BundledHom.forget₂ _ _\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_Group CommGroupCat.hasForgetToGroup\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddGroup AddCommGroupCat.hasForgetToAddGroup\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} GroupCat.{u} where coe := (forget₂ CommGroupCat GroupCat).obj\n\n@[to_additive hasForgetToAddCommMonCat]\ninstance hasForgetToCommMonCat : HasForget₂ CommGroupCat CommMonCat :=\n InducedCategory.hasForget₂ fun G : CommGroupCat => CommMonCat.of G\nset_option linter.uppercaseLean3 false in\n#align CommGroup.has_forget_to_CommMon CommGroupCat.hasForgetToCommMonCat\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.has_forget_to_AddCommMon AddCommGroupCat.hasForgetToAddCommMonCat\n\n@[to_additive]\ninstance : Coe CommGroupCat.{u} CommMonCat.{u} where coe := (forget₂ CommGroupCat CommMonCat).obj\n\n-- porting note: this instance was not necessary in mathlib\n@[to_additive]\ninstance (G H : CommGroupCat) : One (G ⟶ H) := (inferInstance : One (MonoidHom G H))\n\n@[to_additive (attr := simp)]\ntheorem one_apply (G H : CommGroupCat) (g : G) : ((1 : G ⟶ H) : G → H) g = 1 :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.one_apply CommGroupCat.one_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.zero_apply AddCommGroupCat.zero_apply\n\n/-- Typecheck a `MonoidHom` as a morphism in `CommGroup`. -/\n@[to_additive]\ndef ofHom {X Y : Type u} [CommGroup X] [CommGroup Y] (f : X →* Y) : of X ⟶ of Y :=\n f\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom CommGroupCat.ofHom\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom AddCommGroupCat.ofHom\n\n/-- Typecheck an `AddMonoidHom` as a morphism in `AddCommGroup`. -/\nadd_decl_doc AddCommGroupCat.ofHom\n\n@[to_additive (attr := simp)]\ntheorem ofHom_apply {X Y : Type _} [CommGroup X] [CommGroup Y] (f : X →* Y) (x : X) :\n (ofHom f) x = f x :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align CommGroup.of_hom_apply CommGroupCat.ofHom_apply\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.of_hom_apply AddCommGroupCat.ofHom_apply\n\n-- We verify that simp lemmas apply when coercing morphisms to functions.\n@[to_additive]\nexample {R S : CommGroupCat} (i : R ⟶ S) (r : R) (h : r = 1) : i r = 1 := by simp [h]\n\nend CommGroupCat\n\nnamespace AddCommGroupCat\n\n-- Note that because `ℤ : Type 0`, this forces `G : AddCommGroup.{0}`,\n-- so we write this explicitly to be clear.\n-- TODO generalize this, requiring a `ULiftInstances.lean` file\n/-- Any element of an abelian group gives a unique morphism from `ℤ` sending\n`1` to that element. -/\ndef asHom {G : AddCommGroupCat.{0}} (g : G) : AddCommGroupCat.of ℤ ⟶ G :=\n zmultiplesHom G g\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom AddCommGroupCat.asHom\n\n@[simp]\ntheorem asHom_apply {G : AddCommGroupCat.{0}} (g : G) (i : ℤ) : (asHom g) i = i • g :=\n rfl\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_apply AddCommGroupCat.asHom_apply\n\ntheorem asHom_injective {G : AddCommGroupCat.{0}} : Function.Injective (@asHom G) := fun h k w => by\n convert congr_arg (fun k : AddCommGroupCat.of ℤ ⟶ G => (k : ℤ → G) (1 : ℤ)) w <;> simp\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.as_hom_injective AddCommGroupCat.asHom_injective\n\n@[ext]\ntheorem int_hom_ext {G : AddCommGroupCat.{0}} (f g : AddCommGroupCat.of ℤ ⟶ G)\n (w : f (1 : ℤ) = g (1 : ℤ)) : f = g :=\n @AddMonoidHom.ext_int G _ f g w\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.int_hom_ext AddCommGroupCat.int_hom_ext\n\n-- TODO: this argument should be generalised to the situation where\n-- the forgetful functor is representable.\ntheorem injective_of_mono {G H : AddCommGroupCat.{0}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n fun g₁ g₂ h => by\n have t0 : asHom g₁ ≫ f = asHom g₂ ≫ f := by aesop_cat\n have t1 : asHom g₁ = asHom g₂ := (cancel_mono _).1 t0\n apply asHom_injective t1\nset_option linter.uppercaseLean3 false in\n#align AddCommGroup.injective_of_mono AddCommGroupCat.injective_of_mono\n\nend AddCommGroupCat\n\n/-- Build an isomorphism in the category `GroupCat` from a `MulEquiv` between `Group`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toGroupCatIso {X Y : GroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_Group_iso MulEquiv.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddGroup_iso AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `AddGroup` from an `AddEquiv` between `AddGroup`s. -/\nadd_decl_doc AddEquiv.toAddGroupCatIso\n\n/-- Build an isomorphism in the category `CommGroupCat` from a `MulEquiv`\nbetween `CommGroup`s. -/\n@[to_additive (attr := simps)]\ndef MulEquiv.toCommGroupCatIso {X Y : CommGroupCat} (e : X ≃* Y) : X ≅ Y where\n hom := e.toMonoidHom\n inv := e.symm.toMonoidHom\nset_option linter.uppercaseLean3 false in\n#align mul_equiv.to_CommGroup_iso MulEquiv.toCommGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv.to_AddCommGroup_iso AddEquiv.toAddCommGroupCatIso\n\n/-- Build an isomorphism in the category `AddCommGroupCat` from an `AddEquiv`\nbetween `AddCommGroup`s. -/\nadd_decl_doc AddEquiv.toAddCommGroupCatIso\n\nnamespace CategoryTheory.Iso\n\n/-- Build a `MulEquiv` from an isomorphism in the category `GroupCat`. -/\n@[to_additive (attr := simp)]\ndef groupIsoToMulEquiv {X Y : GroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.Group_iso_to_mul_equiv CategoryTheory.Iso.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddGroup_iso_to_add_equiv CategoryTheory.Iso.addGroupIsoToAddEquiv\n\n/-- Build an `addEquiv` from an isomorphism in the category `AddGroup` -/\nadd_decl_doc addGroupIsoToAddEquiv\n\n/-- Build a `MulEquiv` from an isomorphism in the category `CommGroup`. -/\n@[to_additive (attr := simps!)]\ndef commGroupIsoToMulEquiv {X Y : CommGroupCat} (i : X ≅ Y) : X ≃* Y :=\n MonoidHom.toMulEquiv i.hom i.inv i.hom_inv_id i.inv_hom_id\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.CommGroup_iso_to_mul_equiv CategoryTheory.Iso.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.iso.AddCommGroup_iso_to_add_equiv CategoryTheory.Iso.addCommGroupIsoToAddEquiv\n\n/-- Build an `AddEquiv` from an isomorphism in the category `AddCommGroup`. -/\nadd_decl_doc addCommGroupIsoToAddEquiv\n\nend CategoryTheory.Iso\n\n/-- multiplicative equivalences between `Group`s are the same as (isomorphic to) isomorphisms\nin `GroupCat` -/\n@[to_additive]\ndef mulEquivIsoGroupIso {X Y : GroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toGroupCatIso\n inv i := i.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_Group_iso mulEquivIsoGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddGroup_iso addEquivIsoAddGroupIso\n\n/-- \"additive equivalences between `add_group`s are the same\nas (isomorphic to) isomorphisms in `AddGroup` -/\nadd_decl_doc addEquivIsoAddGroupIso\n\n/-- multiplicative equivalences between `comm_group`s are the same as (isomorphic to) isomorphisms\nin `CommGroup` -/\n@[to_additive]\ndef mulEquivIsoCommGroupIso {X Y : CommGroupCat.{u}} : X ≃* Y ≅ X ≅ Y where\n hom e := e.toCommGroupCatIso\n inv i := i.commGroupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align mul_equiv_iso_CommGroup_iso mulEquivIsoCommGroupIso\nset_option linter.uppercaseLean3 false in\n#align add_equiv_iso_AddCommGroup_iso addEquivIsoAddCommGroupIso\n\n/-- additive equivalences between `AddCommGroup`s are\nthe same as (isomorphic to) isomorphisms in `AddCommGroup` -/\nadd_decl_doc addEquivIsoAddCommGroupIso\n\nnamespace CategoryTheory.Aut\n\n/-- The (bundled) group of automorphisms of a type is isomorphic to the (bundled) group\nof permutations. -/\ndef isoPerm {α : Type u} : GroupCat.of (Aut α) ≅ GroupCat.of (Equiv.Perm α) where\n hom :=\n { toFun := fun g => g.toEquiv\n map_one' := by aesop\n map_mul' := by aesop }\n inv :=\n { toFun := fun g => g.toIso\n map_one' := by aesop\n map_mul' := by aesop }\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.iso_perm CategoryTheory.Aut.isoPerm\n\n/-- The (unbundled) group of automorphisms of a type is `mul_equiv` to the (unbundled) group\nof permutations. -/\ndef mulEquivPerm {α : Type u} : Aut α ≃* Equiv.Perm α :=\n isoPerm.groupIsoToMulEquiv\nset_option linter.uppercaseLean3 false in\n#align category_theory.Aut.mul_equiv_perm CategoryTheory.Aut.mulEquivPerm\n\nend CategoryTheory.Aut\n\n@[to_additive]\ninstance GroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget GroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget GroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n exact IsIso.of_iso e.toGroupCatIso\nset_option linter.uppercaseLean3 false in\n#align Group.forget_reflects_isos GroupCat.forget_reflects_isos\nset_option linter.uppercaseLean3 false in\n#align AddGroup.forget_reflects_isos AddGroupCat.forget_reflects_isos\n\n@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget CommGroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n ","nextTactic":"exact IsIso.of_iso e.toCommGroupCatIso","declUpToTactic":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ := by\n let i := asIso ((forget CommGroupCat).map f)\n let e : X ≃* Y := { i.toEquiv with map_mul' := by aesop }\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Basic.501_0.kWB42XWRpLpYIMU","decl":"@[to_additive]\ninstance CommGroupCat.forget_reflects_isos : ReflectsIsomorphisms (forget CommGroupCat.{u}) where\n reflects {X Y} f _ "}