diff --git "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Adjunctions.jsonl" "b/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Adjunctions.jsonl" deleted file mode 100644--- "a/Extracted/Mathlib/TacticPrediction/Mathlib_Algebra_Category_GroupCat_Adjunctions.jsonl" +++ /dev/null @@ -1,49 +0,0 @@ -{"state":"⊢ ∀ {X' X : Type u} {Y : AddCommGroupCat} (f : X' ⟶ X) (g : X ⟶ (forget AddCommGroupCat).obj Y),\n ((fun X G => FreeAbelianGroup.lift.symm) X' Y).symm (f ≫ g) =\n free.map f ≫ ((fun X G => FreeAbelianGroup.lift.symm) X Y).symm g","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n ","nextTactic":"intros","declUpToTactic":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.71_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} "} -{"state":"X'✝ X✝ : Type u\nY✝ : AddCommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget AddCommGroupCat).obj Y✝\n⊢ ((fun X G => FreeAbelianGroup.lift.symm) X'✝ Y✝).symm (f✝ ≫ g✝) =\n free.map f✝ ≫ ((fun X G => FreeAbelianGroup.lift.symm) X✝ Y✝).symm g✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ","nextTactic":"ext","declUpToTactic":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.71_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} "} -{"state":"case w\nX'✝ X✝ : Type u\nY✝ : AddCommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget AddCommGroupCat).obj Y✝\nx✝ : ↑(free.obj X'✝)\n⊢ (((fun X G => FreeAbelianGroup.lift.symm) X'✝ Y✝).symm (f✝ ≫ g✝)) x✝ =\n (free.map f✝ ≫ ((fun X G => FreeAbelianGroup.lift.symm) X✝ Y✝).symm g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n ","nextTactic":"simp only [Equiv.symm_symm]","declUpToTactic":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.71_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} "} -{"state":"case w\nX'✝ X✝ : Type u\nY✝ : AddCommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget AddCommGroupCat).obj Y✝\nx✝ : ↑(free.obj X'✝)\n⊢ (FreeAbelianGroup.lift (f✝ ≫ g✝)) x✝ = (free.map f✝ ≫ FreeAbelianGroup.lift g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n ","nextTactic":"apply FreeAbelianGroup.lift_comp","declUpToTactic":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.71_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} "} -{"state":"⊢ ∀ (X : Type u),\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map (𝟙 X) =\n 𝟙 ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"X✝ : Type u\n⊢ { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map (𝟙 X✝) =\n 𝟙 ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ","nextTactic":"ext1","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w\nX✝ : Type u\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map (𝟙 X✝)) x✝ =\n (𝟙 ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; ","nextTactic":"erw [← FreeGroup.map.unique]","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w\nX✝ : Type u\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ?w.g x✝ = (𝟙 ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w.g\nX✝ : Type u\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ FreeGroup X✝ →* FreeGroup X✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w.hg\nX✝ : Type u\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ∀ (x : X✝), ?w.g (FreeGroup.of x) = FreeGroup.of (𝟙 X✝ x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w\nX✝ : Type u\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ?w.g x✝ = (𝟙 ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","nextTactic":"rfl","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w.hg\nX✝ : Type u\nx✝¹ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\nx✝ : X✝\n⊢ (𝟙 ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)) (FreeGroup.of x✝) =\n FreeGroup.of (𝟙 X✝ x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","nextTactic":"rfl","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"⊢ ∀ {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z),\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map (f ≫ g) =\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map f ≫\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map g","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"X✝ Y✝ Z✝ : Type u\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\n⊢ { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map (f✝ ≫ g✝) =\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map f✝ ≫\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map g✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ","nextTactic":"ext1","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w\nX✝ Y✝ Z✝ : Type u\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map (f✝ ≫ g✝)) x✝ =\n ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map f✝ ≫\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map g✝)\n x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; ","nextTactic":"erw [← FreeGroup.map.unique]","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w\nX✝ Y✝ Z✝ : Type u\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ?w.g x✝ =\n ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map f✝ ≫\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map g✝)\n x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w.g\nX✝ Y✝ Z✝ : Type u\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ FreeGroup X✝ →* FreeGroup Z✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w.hg\nX✝ Y✝ Z✝ : Type u\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ∀ (x : X✝), ?w.g (FreeGroup.of x) = FreeGroup.of ((f✝ ≫ g✝) x)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","nextTactic":"intros","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w\nX✝ Y✝ Z✝ : Type u\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\nx✝ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\n⊢ ?w.g x✝ =\n ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map f✝ ≫\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map g✝)\n x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","nextTactic":"rfl","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"case w.hg\nX✝ Y✝ Z✝ : Type u\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\nx✝¹ : ↑({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.obj X✝)\nx✝ : X✝\n⊢ ({ obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map f✝ ≫\n { obj := fun α => of (FreeGroup α), map := fun {X Y} => FreeGroup.map }.map g✝)\n (FreeGroup.of x✝) =\n FreeGroup.of ((f✝ ≫ g✝) x✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","nextTactic":"rfl","declUpToTactic":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.101_0.PVOXqCGxJtf2m0x","decl":"/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α "} -{"state":"⊢ ∀ {X' X : Type u} {Y : GroupCat} (f : X' ⟶ X) (g : X ⟶ (forget GroupCat).obj Y),\n ((fun X G => FreeGroup.lift.symm) X' Y).symm (f ≫ g) = free.map f ≫ ((fun X G => FreeGroup.lift.symm) X Y).symm g","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n ","nextTactic":"intros","declUpToTactic":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.114_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} "} -{"state":"X'✝ X✝ : Type u\nY✝ : GroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget GroupCat).obj Y✝\n⊢ ((fun X G => FreeGroup.lift.symm) X'✝ Y✝).symm (f✝ ≫ g✝) =\n free.map f✝ ≫ ((fun X G => FreeGroup.lift.symm) X✝ Y✝).symm g✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ","nextTactic":"ext1","declUpToTactic":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.114_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} "} -{"state":"case w\nX'✝ X✝ : Type u\nY✝ : GroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget GroupCat).obj Y✝\nx✝ : ↑(free.obj X'✝)\n⊢ (((fun X G => FreeGroup.lift.symm) X'✝ Y✝).symm (f✝ ≫ g✝)) x✝ =\n (free.map f✝ ≫ ((fun X G => FreeGroup.lift.symm) X✝ Y✝).symm g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n ","nextTactic":"simp only [Equiv.symm_symm]","declUpToTactic":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.114_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} "} -{"state":"case w\nX'✝ X✝ : Type u\nY✝ : GroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget GroupCat).obj Y✝\nx✝ : ↑(free.obj X'✝)\n⊢ (FreeGroup.lift (f✝ ≫ g✝)) x✝ = (free.map f✝ ≫ FreeGroup.lift g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n ","nextTactic":"apply Eq.symm","declUpToTactic":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.114_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} "} -{"state":"case w.h\nX'✝ X✝ : Type u\nY✝ : GroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget GroupCat).obj Y✝\nx✝ : ↑(free.obj X'✝)\n⊢ (free.map f✝ ≫ FreeGroup.lift g✝) x✝ = (FreeGroup.lift (f✝ ≫ g✝)) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n ","nextTactic":"apply FreeGroup.lift.unique","declUpToTactic":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.114_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} "} -{"state":"case w.h.hg\nX'✝ X✝ : Type u\nY✝ : GroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget GroupCat).obj Y✝\nx✝ : ↑(free.obj X'✝)\n⊢ ∀ (x : X'✝), (free.map f✝ ≫ FreeGroup.lift g✝) (FreeGroup.of x) = (f✝ ≫ g✝) x","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n ","nextTactic":"intros","declUpToTactic":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.114_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} "} -{"state":"case w.h.hg\nX'✝ X✝ : Type u\nY✝ : GroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget GroupCat).obj Y✝\nx✝¹ : ↑(free.obj X'✝)\nx✝ : X'✝\n⊢ (free.map f✝ ≫ FreeGroup.lift g✝) (FreeGroup.of x✝) = (f✝ ≫ g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n ","nextTactic":"apply FreeGroup.lift.of","declUpToTactic":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.114_0.PVOXqCGxJtf2m0x","decl":"/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} "} -{"state":"G : GroupCat\n⊢ CommGroup (Abelianization ↑G)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by ","nextTactic":"infer_instance","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ Y✝ : GroupCat\nf : X✝ ⟶ Y✝\n⊢ (fun x => Abelianization.of (f x)) 1 = 1","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by ","nextTactic":"simp","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ Y✝ : GroupCat\nf : X✝ ⟶ Y✝\n⊢ ∀ (x y : ↑X✝),\n OneHom.toFun { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) } (x * y) =\n OneHom.toFun { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) } x *\n OneHom.toFun { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) } y","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by ","nextTactic":"simp","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"⊢ ∀ (X : GroupCat),\n { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n (𝟙 X) =\n 𝟙\n ({ obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.obj\n X)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n ","nextTactic":"intros","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ : GroupCat\n⊢ { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n (𝟙 X✝) =\n 𝟙\n ({ obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.obj\n X✝)","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; ","nextTactic":"simp only [MonoidHom.mk_coe, coe_id]","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ : GroupCat\n⊢ Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of ((𝟙 X✝) x), map_one' := (_ : Abelianization.of ((𝟙 X✝) 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X✝),\n Abelianization.of ((𝟙 X✝) (a * a_1)) = Abelianization.of ((𝟙 X✝) a) * Abelianization.of ((𝟙 X✝) a_1)) } =\n 𝟙 (Bundled.mk (Abelianization ↑X✝))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n ","nextTactic":"apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ : GroupCat\n⊢ { toOneHom := { toFun := fun x => Abelianization.of ((𝟙 X✝) x), map_one' := (_ : Abelianization.of ((𝟙 X✝) 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X✝),\n Abelianization.of ((𝟙 X✝) (a * a_1)) = Abelianization.of ((𝟙 X✝) a) * Abelianization.of ((𝟙 X✝) a_1)) } =\n Abelianization.lift.symm (𝟙 (Bundled.mk (Abelianization ↑X✝)))","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; ","nextTactic":"rfl","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"⊢ ∀ {X Y Z : GroupCat} (f : X ⟶ Y) (g : Y ⟶ Z),\n { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n (f ≫ g) =\n { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n f ≫\n { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n g","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n ","nextTactic":"intros","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ Y✝ Z✝ : GroupCat\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\n⊢ { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n (f✝ ≫ g✝) =\n { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n f✝ ≫\n { obj := fun G => Bundled.mk (Abelianization ↑G),\n map := fun {X Y} f =>\n Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of (f x), map_one' := (_ : Abelianization.of (f 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X),\n Abelianization.of (f (a * a_1)) = Abelianization.of (f a) * Abelianization.of (f a_1)) } }.map\n g✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; ","nextTactic":"simp only [coe_comp]","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ Y✝ Z✝ : GroupCat\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\n⊢ Abelianization.lift\n {\n toOneHom :=\n { toFun := fun x => Abelianization.of ((f✝ ≫ g✝) x), map_one' := (_ : Abelianization.of ((f✝ ≫ g✝) 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X✝),\n Abelianization.of ((f✝ ≫ g✝) (a * a_1)) =\n Abelianization.of ((f✝ ≫ g✝) a) * Abelianization.of ((f✝ ≫ g✝) a_1)) } =\n Abelianization.lift\n { toOneHom := { toFun := fun x => Abelianization.of (f✝ x), map_one' := (_ : Abelianization.of (f✝ 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X✝),\n Abelianization.of (f✝ (a * a_1)) = Abelianization.of (f✝ a) * Abelianization.of (f✝ a_1)) } ≫\n Abelianization.lift\n { toOneHom := { toFun := fun x => Abelianization.of (g✝ x), map_one' := (_ : Abelianization.of (g✝ 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑Y✝),\n Abelianization.of (g✝ (a * a_1)) = Abelianization.of (g✝ a) * Abelianization.of (g✝ a_1)) }","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n ","nextTactic":"apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"X✝ Y✝ Z✝ : GroupCat\nf✝ : X✝ ⟶ Y✝\ng✝ : Y✝ ⟶ Z✝\n⊢ {\n toOneHom :=\n { toFun := fun x => Abelianization.of ((f✝ ≫ g✝) x), map_one' := (_ : Abelianization.of ((f✝ ≫ g✝) 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X✝),\n Abelianization.of ((f✝ ≫ g✝) (a * a_1)) =\n Abelianization.of ((f✝ ≫ g✝) a) * Abelianization.of ((f✝ ≫ g✝) a_1)) } =\n Abelianization.lift.symm\n (Abelianization.lift\n { toOneHom := { toFun := fun x => Abelianization.of (f✝ x), map_one' := (_ : Abelianization.of (f✝ 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑X✝),\n Abelianization.of (f✝ (a * a_1)) = Abelianization.of (f✝ a) * Abelianization.of (f✝ a_1)) } ≫\n Abelianization.lift\n { toOneHom := { toFun := fun x => Abelianization.of (g✝ x), map_one' := (_ : Abelianization.of (g✝ 1) = 1) },\n map_mul' :=\n (_ :\n ∀ (a a_1 : ↑Y✝),\n Abelianization.of (g✝ (a * a_1)) = Abelianization.of (g✝ a) * Abelianization.of (g✝ a_1)) })","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; ","nextTactic":"rfl","declUpToTactic":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.137_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G "} -{"state":"⊢ ∀ {X' X : GroupCat} {Y : CommGroupCat} (f : X' ⟶ X) (g : X ⟶ (forget₂ CommGroupCat GroupCat).obj Y),\n ((fun G A => Abelianization.lift.symm) X' Y).symm (f ≫ g) =\n abelianize.map f ≫ ((fun G A => Abelianization.lift.symm) X Y).symm g","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n ","nextTactic":"intros","declUpToTactic":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.156_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} "} -{"state":"X'✝ X✝ : GroupCat\nY✝ : CommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget₂ CommGroupCat GroupCat).obj Y✝\n⊢ ((fun G A => Abelianization.lift.symm) X'✝ Y✝).symm (f✝ ≫ g✝) =\n abelianize.map f✝ ≫ ((fun G A => Abelianization.lift.symm) X✝ Y✝).symm g✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ","nextTactic":"ext1","declUpToTactic":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.156_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} "} -{"state":"case w\nX'✝ X✝ : GroupCat\nY✝ : CommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget₂ CommGroupCat GroupCat).obj Y✝\nx✝ : ↑(abelianize.obj X'✝)\n⊢ (((fun G A => Abelianization.lift.symm) X'✝ Y✝).symm (f✝ ≫ g✝)) x✝ =\n (abelianize.map f✝ ≫ ((fun G A => Abelianization.lift.symm) X✝ Y✝).symm g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n ","nextTactic":"simp only [Equiv.symm_symm]","declUpToTactic":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.156_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} "} -{"state":"case w\nX'✝ X✝ : GroupCat\nY✝ : CommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget₂ CommGroupCat GroupCat).obj Y✝\nx✝ : ↑(abelianize.obj X'✝)\n⊢ (Abelianization.lift (f✝ ≫ g✝)) x✝ = (abelianize.map f✝ ≫ Abelianization.lift g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ��� GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n ","nextTactic":"apply Eq.symm","declUpToTactic":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.156_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} "} -{"state":"case w.h\nX'✝ X✝ : GroupCat\nY✝ : CommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget₂ CommGroupCat GroupCat).obj Y✝\nx✝ : ↑(abelianize.obj X'✝)\n⊢ (abelianize.map f✝ ≫ Abelianization.lift g✝) x✝ = (Abelianization.lift (f✝ ≫ g✝)) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n ","nextTactic":"apply Abelianization.lift.unique","declUpToTactic":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.156_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} "} -{"state":"case w.h.hφ\nX'✝ X✝ : GroupCat\nY✝ : CommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget₂ CommGroupCat GroupCat).obj Y✝\nx✝ : ↑(abelianize.obj X'✝)\n⊢ ∀ (x : ↑X'✝), (abelianize.map f✝ ≫ Abelianization.lift g✝) (Abelianization.of x) = (f✝ ≫ g✝) x","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n ","nextTactic":"intros","declUpToTactic":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.156_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} "} -{"state":"case w.h.hφ\nX'✝ X✝ : GroupCat\nY✝ : CommGroupCat\nf✝ : X'✝ ⟶ X✝\ng✝ : X✝ ⟶ (forget₂ CommGroupCat GroupCat).obj Y✝\nx✝¹ : ↑(abelianize.obj X'✝)\nx✝ : ↑X'✝\n⊢ (abelianize.map f✝ ≫ Abelianization.lift g✝) (Abelianization.of x✝) = (f✝ ≫ g✝) x✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n intros\n ","nextTactic":"apply Abelianization.lift.of","declUpToTactic":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n intros\n ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.156_0.PVOXqCGxJtf2m0x","decl":"/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} "} -{"state":"⊢ ∀ ⦃X Y : MonCat⦄ (f : X ⟶ Y),\n (MonCat.units ⋙ forget₂ GroupCat MonCat).map f ≫ (fun X => Units.coeHom ↑X) Y =\n (fun X => Units.coeHom ↑X) X ≫ (𝟭 MonCat).map f","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n intros\n apply Abelianization.lift.of }\n#align abelianize_adj abelianizeAdj\n\nend Abelianization\n\n/-- The functor taking a monoid to its subgroup of units. -/\n@[simps]\ndef MonCat.units : MonCat.{u} ⥤ GroupCat.{u} where\n obj R := GroupCat.of Rˣ\n map f := GroupCat.ofHom <| Units.map f\n map_id _ := MonoidHom.ext fun _ => Units.ext rfl\n map_comp _ _ := MonoidHom.ext fun _ => Units.ext rfl\n#align Mon.units MonCat.units\n\n/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by ","nextTactic":"intros","declUpToTactic":"/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.182_0.PVOXqCGxJtf2m0x","decl":"/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y "} -{"state":"X✝ Y✝ : MonCat\nf✝ : X✝ ⟶ Y✝\n⊢ (MonCat.units ⋙ forget₂ GroupCat MonCat).map f✝ ≫ (fun X => Units.coeHom ↑X) Y✝ =\n (fun X => Units.coeHom ↑X) X✝ ≫ (𝟭 MonCat).map f✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n intros\n apply Abelianization.lift.of }\n#align abelianize_adj abelianizeAdj\n\nend Abelianization\n\n/-- The functor taking a monoid to its subgroup of units. -/\n@[simps]\ndef MonCat.units : MonCat.{u} ⥤ GroupCat.{u} where\n obj R := GroupCat.of Rˣ\n map f := GroupCat.ofHom <| Units.map f\n map_id _ := MonoidHom.ext fun _ => Units.ext rfl\n map_comp _ _ := MonoidHom.ext fun _ => Units.ext rfl\n#align Mon.units MonCat.units\n\n/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by intros; ","nextTactic":"exact MonoidHom.ext fun x => rfl","declUpToTactic":"/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by intros; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.182_0.PVOXqCGxJtf2m0x","decl":"/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y "} -{"state":"⊢ ∀ ⦃X Y : CommMonCat⦄ (f : X ⟶ Y),\n (CommMonCat.units ⋙ forget₂ CommGroupCat CommMonCat).map f ≫ (fun X => Units.coeHom ↑X) Y =\n (fun X => Units.coeHom ↑X) X ≫ (𝟭 CommMonCat).map f","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n intros\n apply Abelianization.lift.of }\n#align abelianize_adj abelianizeAdj\n\nend Abelianization\n\n/-- The functor taking a monoid to its subgroup of units. -/\n@[simps]\ndef MonCat.units : MonCat.{u} ⥤ GroupCat.{u} where\n obj R := GroupCat.of Rˣ\n map f := GroupCat.ofHom <| Units.map f\n map_id _ := MonoidHom.ext fun _ => Units.ext rfl\n map_comp _ _ := MonoidHom.ext fun _ => Units.ext rfl\n#align Mon.units MonCat.units\n\n/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by intros; exact MonoidHom.ext fun x => rfl }\n homEquiv_unit := MonoidHom.ext fun _ => Units.ext rfl\n homEquiv_counit := MonoidHom.ext fun _ => rfl\n#align Group.forget₂_Mon_adj GroupCat.forget₂MonAdj\n\ninstance : IsRightAdjoint MonCat.units.{u} :=\n ⟨_, GroupCat.forget₂MonAdj⟩\n\n/-- The functor taking a monoid to its subgroup of units. -/\n@[simps]\ndef CommMonCat.units : CommMonCat.{u} ⥤ CommGroupCat.{u} where\n obj R := CommGroupCat.of Rˣ\n map f := CommGroupCat.ofHom <| Units.map f\n map_id _ := MonoidHom.ext fun _ => Units.ext rfl\n map_comp _ _ := MonoidHom.ext fun _ => Units.ext rfl\n#align CommMon.units CommMonCat.units\n\n/-- The forgetful-units adjunction between `CommGroup` and `CommMon`. -/\ndef CommGroupCat.forget₂CommMonAdj : forget₂ CommGroupCat CommMonCat ⊣ CommMonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by ","nextTactic":"intros","declUpToTactic":"/-- The forgetful-units adjunction between `CommGroup` and `CommMon`. -/\ndef CommGroupCat.forget₂CommMonAdj : forget₂ CommGroupCat CommMonCat ⊣ CommMonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.211_0.PVOXqCGxJtf2m0x","decl":"/-- The forgetful-units adjunction between `CommGroup` and `CommMon`. -/\ndef CommGroupCat.forget₂CommMonAdj : forget₂ CommGroupCat CommMonCat ⊣ CommMonCat.units.{u} where\n homEquiv X Y "} -{"state":"X✝ Y✝ : CommMonCat\nf✝ : X✝ ⟶ Y✝\n⊢ (CommMonCat.units ⋙ forget₂ CommGroupCat CommMonCat).map f✝ ≫ (fun X => Units.coeHom ↑X) Y✝ =\n (fun X => Units.coeHom ↑X) X✝ ≫ (𝟭 CommMonCat).map f✝","srcUpToTactic":"/-\nCopyright (c) 2019 Scott Morrison. All rights reserved.\nReleased under Apache 2.0 license as described in the file LICENSE.\nAuthors: Scott Morrison, Johannes Hölzl\n-/\nimport Mathlib.Algebra.Category.GroupCat.Basic\nimport Mathlib.GroupTheory.FreeAbelianGroup\n\n#align_import algebra.category.Group.adjunctions from \"leanprover-community/mathlib\"@\"ecef68622cf98f6d42c459e5b5a079aeecdd9842\"\n\n\n/-!\n# Adjunctions regarding the category of (abelian) groups\n\nThis file contains construction of basic adjunctions concerning the category of groups and the\ncategory of abelian groups.\n\n## Main definitions\n\n* `AddCommGroup.free`: constructs the functor associating to a type `X` the free abelian group with\n generators `x : X`.\n* `Group.free`: constructs the functor associating to a type `X` the free group with\n generators `x : X`.\n* `abelianize`: constructs the functor which associates to a group `G` its abelianization `Gᵃᵇ`.\n\n## Main statements\n\n* `AddCommGroup.adj`: proves that `AddCommGroup.free` is the left adjoint of the forgetful functor\n from abelian groups to types.\n* `Group.adj`: proves that `Group.free` is the left adjoint of the forgetful functor from groups to\n types.\n* `abelianize_adj`: proves that `abelianize` is left adjoint to the forgetful functor from\n abelian groups to groups.\n-/\n\nset_option linter.uppercaseLean3 false -- `AddCommGroup`\n\nnoncomputable section\n\nuniverse u\n\nopen CategoryTheory\n\nnamespace AddCommGroupCat\n\nopen scoped Classical\n\n/-- The free functor `Type u ⥤ AddCommGroup` sending a type `X` to the\nfree abelian group with generators `x : X`.\n-/\ndef free : Type u ⥤ AddCommGroupCat where\n obj α := of (FreeAbelianGroup α)\n map := FreeAbelianGroup.map\n map_id _ := AddMonoidHom.ext FreeAbelianGroup.map_id_apply\n map_comp _ _ := AddMonoidHom.ext FreeAbelianGroup.map_comp_apply\n#align AddCommGroup.free AddCommGroupCat.free\n\n@[simp]\ntheorem free_obj_coe {α : Type u} : (free.obj α : Type u) = FreeAbelianGroup α :=\n rfl\n#align AddCommGroup.free_obj_coe AddCommGroupCat.free_obj_coe\n\n-- This currently can't be a `simp` lemma,\n-- because `free_obj_coe` will simplify implicit arguments in the LHS.\n-- (The `simpNF` linter will, correctly, complain.)\ntheorem free_map_coe {α β : Type u} {f : α → β} (x : FreeAbelianGroup α) :\n (free.map f) x = f <$> x :=\n rfl\n#align AddCommGroup.free_map_coe AddCommGroupCat.free_map_coe\n\n/-- The free-forgetful adjunction for abelian groups.\n-/\ndef adj : free ⊣ forget AddCommGroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeAbelianGroup.lift.symm\n -- Porting note: used to be just `by intros; ext; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext\n simp only [Equiv.symm_symm]\n apply FreeAbelianGroup.lift_comp }\n#align AddCommGroup.adj AddCommGroupCat.adj\n\ninstance : IsRightAdjoint (forget AddCommGroupCat.{u}) :=\n ⟨_, adj⟩\n\n/-- As an example, we now give a high-powered proof that\nthe monomorphisms in `AddCommGroup` are just the injective functions.\n\n(This proof works in all universes.)\n-/\n-- Porting note: had to elaborate instance of Mono rather than just using `apply_instance`.\nexample {G H : AddCommGroupCat.{u}} (f : G ⟶ H) [Mono f] : Function.Injective f :=\n (mono_iff_injective (FunLike.coe f)).mp (Functor.map_mono (forget AddCommGroupCat) f)\n\n\nend AddCommGroupCat\n\nnamespace GroupCat\n\n/-- The free functor `Type u ⥤ Group` sending a type `X` to the free group with generators `x : X`.\n-/\ndef free : Type u ⥤ GroupCat where\n obj α := of (FreeGroup α)\n map := FreeGroup.map\n map_id := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n map_comp := by\n -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644\n intros; ext1; erw [← FreeGroup.map.unique] <;> intros <;> rfl\n#align Group.free GroupCat.free\n\n/-- The free-forgetful adjunction for groups.\n-/\ndef adj : free ⊣ forget GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun X G => FreeGroup.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply FreeGroup.lift.unique\n intros\n apply FreeGroup.lift.of }\n#align Group.adj GroupCat.adj\n\ninstance : IsRightAdjoint (forget GroupCat.{u}) :=\n ⟨_, adj⟩\n\nend GroupCat\n\nsection Abelianization\n\n/-- The abelianization functor `Group ⥤ CommGroup` sending a group `G` to its abelianization `Gᵃᵇ`.\n -/\ndef abelianize : GroupCat.{u} ⥤ CommGroupCat.{u} where\n obj G :=\n { α := Abelianization G\n str := by infer_instance }\n map f :=\n Abelianization.lift\n { toFun := fun x => Abelianization.of (f x)\n map_one' := by simp\n map_mul' := by simp }\n map_id := by\n intros; simp only [MonoidHom.mk_coe, coe_id]\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n map_comp := by\n intros; simp only [coe_comp];\n apply (Equiv.apply_eq_iff_eq_symm_apply Abelianization.lift).mpr; rfl\n#align abelianize abelianize\n\n/-- The abelianization-forgetful adjuction from `Group` to `CommGroup`.-/\ndef abelianizeAdj : abelianize ⊣ forget₂ CommGroupCat.{u} GroupCat.{u} :=\n Adjunction.mkOfHomEquiv\n { homEquiv := fun G A => Abelianization.lift.symm\n -- Porting note: used to be just `by intros; ext1; rfl`.\n homEquiv_naturality_left_symm := by\n intros\n ext1\n simp only [Equiv.symm_symm]\n apply Eq.symm\n apply Abelianization.lift.unique\n intros\n apply Abelianization.lift.of }\n#align abelianize_adj abelianizeAdj\n\nend Abelianization\n\n/-- The functor taking a monoid to its subgroup of units. -/\n@[simps]\ndef MonCat.units : MonCat.{u} ⥤ GroupCat.{u} where\n obj R := GroupCat.of Rˣ\n map f := GroupCat.ofHom <| Units.map f\n map_id _ := MonoidHom.ext fun _ => Units.ext rfl\n map_comp _ _ := MonoidHom.ext fun _ => Units.ext rfl\n#align Mon.units MonCat.units\n\n/-- The forgetful-units adjunction between `Group` and `Mon`. -/\ndef GroupCat.forget₂MonAdj : forget₂ GroupCat MonCat ⊣ MonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by intros; exact MonoidHom.ext fun x => rfl }\n homEquiv_unit := MonoidHom.ext fun _ => Units.ext rfl\n homEquiv_counit := MonoidHom.ext fun _ => rfl\n#align Group.forget₂_Mon_adj GroupCat.forget₂MonAdj\n\ninstance : IsRightAdjoint MonCat.units.{u} :=\n ⟨_, GroupCat.forget₂MonAdj⟩\n\n/-- The functor taking a monoid to its subgroup of units. -/\n@[simps]\ndef CommMonCat.units : CommMonCat.{u} ⥤ CommGroupCat.{u} where\n obj R := CommGroupCat.of Rˣ\n map f := CommGroupCat.ofHom <| Units.map f\n map_id _ := MonoidHom.ext fun _ => Units.ext rfl\n map_comp _ _ := MonoidHom.ext fun _ => Units.ext rfl\n#align CommMon.units CommMonCat.units\n\n/-- The forgetful-units adjunction between `CommGroup` and `CommMon`. -/\ndef CommGroupCat.forget₂CommMonAdj : forget₂ CommGroupCat CommMonCat ⊣ CommMonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by intros; ","nextTactic":"exact MonoidHom.ext fun x => rfl","declUpToTactic":"/-- The forgetful-units adjunction between `CommGroup` and `CommMon`. -/\ndef CommGroupCat.forget₂CommMonAdj : forget₂ CommGroupCat CommMonCat ⊣ CommMonCat.units.{u} where\n homEquiv X Y :=\n { toFun := fun f => MonoidHom.toHomUnits f\n invFun := fun f => (Units.coeHom Y).comp f\n left_inv := fun f => MonoidHom.ext fun _ => rfl\n right_inv := fun f => MonoidHom.ext fun _ => Units.ext rfl }\n unit :=\n { app := fun X => { (@toUnits X _).toMonoidHom with }\n naturality := fun X Y f => MonoidHom.ext fun x => Units.ext rfl }\n counit :=\n { app := fun X => Units.coeHom X\n naturality := by intros; ","declId":"Examples.Mathlib.SplitRw.Mathlib_Algebra_Category_GroupCat_Adjunctions.211_0.PVOXqCGxJtf2m0x","decl":"/-- The forgetful-units adjunction between `CommGroup` and `CommMon`. -/\ndef CommGroupCat.forget₂CommMonAdj : forget₂ CommGroupCat CommMonCat ⊣ CommMonCat.units.{u} where\n homEquiv X Y "}