1-- The center of a group and centralizers of subsets: both are subgroups,2-- the center is a normal abelian subgroup, and it is the whole group3-- exactly when the group is abelian4-- Part of Cumulus, the Grace17 mathematics library.5-- Copyright (c) 2026 Grant Passmore.6-- Released under the Apache License 2.0. See LICENSE in the repository root.7-- Authors: Grant Passmore89module Grace.Cumulus.Algebra.Group.Center10import Generated1112-- The elements commuting with everything in S, and with everything.13def centralizer (G S : Set) : Set:= { z ∈ G.carrier |∀ x ∈ S, G.mul(z, x) = G.mul(x, z) }14def center (G : Set) : Set:= centralizer(G, G.carrier)1516theorem center.membership (G z : Set)17shows z ∈ center(G) ↔ z ∈ G.carrier ∧ (∀ x ∈ G.carrier, G.mul(z, x) = G.mul(x, z))18proof19simp [center, centralizer]2021theorem centralizer.subset (G S : Set)22shows centralizer(G, S) ⊆ G.carrier23proof24intros z hz25have parts := centralizer.membership.forward with hz26exact parts.left2728theorem center.subset (G : Set)29shows center(G) ⊆ G.carrier30proof31intros z hz32have parts := center.membership.forward with hz33exact parts.left3435theorem center.eq_centralizer (G : Set)36shows center(G) = centralizer(G, G.carrier)37proof38simp [center]3940theorem centralizer.antitone (G S T : Set)41requires included : S ⊆ T42shows centralizer(G, T) ⊆ centralizer(G, S)43proof44intros z hz45have parts := centralizer.membership.forward with hz46apply centralizer.membership.backward47refine⟨parts.left, ?_⟩48intros x hx49have xT := included with x, hx50exact parts.right with x, xT5152theorem center.subset_centralizer (G S : Set)53requires bounded : S ⊆ G.carrier54shows center(G) ⊆ centralizer(G, S)55proof56rw center.eq_centralizer57exact centralizer.antitone at G, S, G.carrier with bounded5859theorem centralizer.empty (G : Set)60shows centralizer(G, ∅) = G.carrier61proof62apply Subset.antisymmetric with (centralizer.subset at G, ∅)63intros z hz64apply centralizer.membership.backward65refine⟨hz, ?_⟩66intros x hx67exfalso68exactset.empty with hx6970theorem centralizer.singleton_mem (G x : Set)71requires hx : x ∈ G.carrier72shows x ∈ centralizer(G, {x})73proof74apply centralizer.membership.backward75refine⟨hx, ?_⟩76intros y hy77have equal := singleton.membership.forward with hy78rw equal79rfl8081section CenterLaws82variable (G : Set)83hypothesis group : Group(G)8485theorem centralizer.commute (S z : Set) (x : G)86requires hz : z ∈ centralizer(G, S)87requires hx : x ∈ S88shows z * x = x * z89proof90have parts := centralizer.membership.forward with hz91exact parts.right with x, hx9293theorem center.commute (z : Set) (x : G)94requires hz : z ∈ center(G)95shows z * x = x * z96proof97have parts := center.membership.forward with hz98have xIn : x ∈ G byassumption99exact parts.right with x, xIn100101theorem centralizer.one_mem (S : Set)102requires bounded : S ⊆ G103shows G.one ∈ centralizer(G, S)104proof105apply centralizer.membership.backward106refine⟨(Group.one_mem with group), ?_⟩107intros x hx108have xIn := bounded with x, hx109rw [one_mul, mul_one]110rfl111112theorem centralizer.subgroup (S : Set)113requires bounded : S ⊆ G114shows Subgroup(centralizer(G, S), G)115proof116have unitIn := centralizer.one_mem with group, bounded117apply Subgroup.mk with group, (centralizer.subset at G, S), unitIn118 . intros z hz w hw119have pz := centralizer.membership.forward with hz120have pw := centralizer.membership.forward with hw121have zIn := pz.left122have wIn := pw.left123apply centralizer.membership.backward124refine⟨(Group.mul_mem with*), ?_⟩125intros x hx126have xIn := bounded with x, hx127have commuteZ := pz.right with x, hx128have commuteW := pw.right with x, hx129rw [mul_assoc, commuteW, ← mul_assoc, commuteZ, mul_assoc]130rfl131 . intros z hz132have pz := centralizer.membership.forward with hz133have zIn := pz.left134apply centralizer.membership.backward135refine⟨(Group.inv_mem with*), ?_⟩136intros x hx137have xIn := bounded with x, hx138have commute := pz.right with x, hx139have criterion : z⁻¹ * x = x * z⁻¹ ↔ x = z * (x * z⁻¹) := inv_mul_eq_iff_eq_mul with*140apply criterion.backward141rw [← mul_assoc, commute, mul_inv_cancel_right]142rfl143144theorem center.subgroup145shows Subgroup(center(G), G)146proof147rw center.eq_centralizer148exact centralizer.subgroup with group, (Subset.reflexive at G.carrier)149150theorem center.normal151shows NormalSubgroup(center(G), G)152proof153have subgroup := center.subgroup with group154apply NormalSubgroup.mk with subgroup155intros g hg z hz156have zIn : z ∈ G := Subgroup.mem_carrier with*157have commute : z * g = g * z := center.commute with*158have swapped : g * z = z * g bycc159have fixed : conjugate(G, g, z) = z := conjugate.of_commute with*160 rwa fixed161162theorem center.commutative163shows Commutative(center(G), G.mul)164proof165intros z hz w hw166have wIn := center.subset at G with w, hw167exact center.commute with*168169theorem center.eq_carrier_iff170shows center(G) = G.carrier ↔ Commutative(G.carrier, G.mul)171proof172constructor173 . intros equal x hx y hy174have xCenter : x ∈ center(G) by rwa equal175exact center.commute with*176 . intro commutative177apply Subset.antisymmetric with (center.subset at G)178intros x hx179apply center.membership.backward180refine⟨hx, ?_⟩181intros y hy182exact commutative with x, hx, y, hy183184theorem centralizer.self_mem_iff (S : Set)185requires bounded : S ⊆ G186shows S ⊆ centralizer(G, S) ↔ Commutative(S, G.mul)187proof188constructor189 . intros included x hx y hy190have xCentral := included with x, hx191have yIn := bounded with y, hy192exact centralizer.commute with*193 . intros commutative x hx194have xIn := bounded with x, hx195apply centralizer.membership.backward196refine⟨xIn, ?_⟩197intros y hy198exact commutative with x, hx, y, hy199200theorem centralizer.pow_mem (x : G) (n : Nat)201shows x ^ n ∈ centralizer(G, {x})202proof203have bounded : {x} ⊆ G204intros y hy205have equal := singleton.membership.forward with hy206 rwa equal207have subgroup := centralizer.subgroup at G, {x} with group, bounded208have member : x ∈ centralizer(G, {x}) := centralizer.singleton_mem with*209exact Subgroup.pow_mem with*210211theorem centralizer.generated_subset (S : Set)212requires bounded : S ⊆ G213shows generatedSubgroup(G, S) ⊆ centralizer(G, centralizer(G, S))214proof215have subgroup := centralizer.subgroup at G, centralizer(G, S) with group, (centralizer.subset at G, S)216have included : S ⊆ centralizer(G, centralizer(G, S))217intros x hx218have xIn := bounded with x, hx219apply centralizer.membership.backward220refine⟨xIn, ?_⟩221intros z hz222have commute : z * x = x * z := centralizer.commute with*223 symm224exact commute225exact generatedSubgroup.least with subgroup, included226227instance center.inv_mem (z : Set)228requires hz : z ∈ center(G)229shows z⁻¹ ∈ center(G)230proof231have subgroup := center.subgroup with group232exact Subgroup.inv_mem with*233234instance center.mul_mem (z w : Set)235requires hz : z ∈ center(G)236requires hw : w ∈ center(G)237shows z * w ∈ center(G)238proof239have subgroup := center.subgroup with group240exact Subgroup.mul_mem with*241242theorem center.conjugate_fixed (g : G) (z : Set)243requires hz : z ∈ center(G)244shows conjugate(G, g, z) = z245proof246have zIn := center.subset at G with z, hz247have commute : z * g = g * z := center.commute with*248have swapped : g * z = z * g bycc249exact conjugate.of_commute with*250251end CenterLaws252253theorem center.of_abelian (G : Set)254requires abelian : AbelianGroup(G)255shows center(G) = G.carrier256proof257have group := AbelianGroup.to_group with abelian258have commutative := IsAbelianGroup.commutative with (AbelianGroup.parts with abelian)259have criterion := center.eq_carrier_iff with group260exact criterion.backward with commutative261262theorem center.image_subset (f G H : Set)263requires hom : f : G →* H264requires surjective : SurjectiveBetween(f, G.carrier, H.carrier)265shows functionImage(f, center(G), H.carrier) ⊆ center(H)266proof267have group := GroupHom.source with hom268have target := GroupHom.target with hom269have function := GroupHom.function with hom270intros y hy271obtain⟨yIn, z, hz, yEq⟩:= functionImage.membership.forward with hy272have zIn := center.subset at G with z, hz273apply center.membership.backward274refine⟨yIn, ?_⟩275intros w hw276obtain⟨x, hx, edge⟩:= surjective.right with w, hw277have wEq := FunctionBetween.apply_value with function, hx, edge278have commute : z * x = x * z := center.commute with*279have first : f(z * x) = f(z) * f(x) := GroupHom.map_mul with*280have second : f(x * z) = f(x) * f(z) := GroupHom.map_mul with*281cc282