Skip to content

Commit 9e64191

Browse files
committed
Merge remote-tracking branch 'origin/eric-wieser/mulKer' into xfr-subgroup_orderIso
2 parents 60c8caa + 424545f commit 9e64191

File tree

2 files changed

+115
-86
lines changed

2 files changed

+115
-86
lines changed

Mathlib/GroupTheory/Congruence/Defs.lean

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,6 @@ theorem toSetoid_inj {c d : Con M} (H : c.toSetoid = d.toSetoid) : c = d :=
175175
are equal."]
176176
theorem coe_inj {c d : Con M} : ⇑c = ⇑d ↔ c = d := DFunLike.coe_injective.eq_iff
177177

178-
/-- The kernel of a multiplication-preserving function as a congruence relation. -/
179-
@[to_additive "The kernel of an addition-preserving function as an additive congruence relation."]
180-
def mulKer (f : M → P) (h : ∀ x y, f (x * y) = f x * f y) : Con M where
181-
toSetoid := Setoid.ker f
182-
mul' h1 h2 := by
183-
dsimp [Setoid.ker, onFun] at *
184-
rw [h, h1, h2, h]
185-
186178
variable (c)
187179

188180
-- Quotients
@@ -284,12 +276,6 @@ with an addition."]
284276
instance hasMul : Mul c.Quotient :=
285277
⟨Quotient.map₂ (· * ·) fun _ _ h1 _ _ h2 => c.mul h1 h2⟩
286278

287-
/-- The kernel of the quotient map induced by a congruence relation `c` equals `c`. -/
288-
@[to_additive (attr := simp) "The kernel of the quotient map induced by an additive congruence
289-
relation `c` equals `c`."]
290-
theorem mul_ker_mk_eq : (mulKer ((↑) : M → c.Quotient) fun _ _ => rfl) = c :=
291-
ext fun _ _ => Quotient.eq''
292-
293279
variable {c}
294280

295281
/-- The coercion to the quotient of a congruence relation commutes with multiplication (by
@@ -487,36 +473,6 @@ protected def gi : @GaloisInsertion (M → M → Prop) (Con M) _ _ conGen DFunLi
487473

488474
variable {M} (c)
489475

490-
/-- Given a function `f`, the smallest congruence relation containing the binary relation on `f`'s
491-
image defined by '`x ≈ y` iff the elements of `f⁻¹(x)` are related to the elements of `f⁻¹(y)`
492-
by a congruence relation `c`.' -/
493-
@[to_additive "Given a function `f`, the smallest additive congruence relation containing the
494-
binary relation on `f`'s image defined by '`x ≈ y` iff the elements of `f⁻¹(x)` are related to the
495-
elements of `f⁻¹(y)` by an additive congruence relation `c`.'"]
496-
def mapGen (f : M → N) : Con N :=
497-
conGen <| Relation.Map c f f
498-
499-
/-- Given a surjective multiplicative-preserving function `f` whose kernel is contained in a
500-
congruence relation `c`, the congruence relation on `f`'s codomain defined by '`x ≈ y` iff the
501-
elements of `f⁻¹(x)` are related to the elements of `f⁻¹(y)` by `c`.' -/
502-
@[to_additive "Given a surjective addition-preserving function `f` whose kernel is contained in
503-
an additive congruence relation `c`, the additive congruence relation on `f`'s codomain defined
504-
by '`x ≈ y` iff the elements of `f⁻¹(x)` are related to the elements of `f⁻¹(y)` by `c`.'"]
505-
def mapOfSurjective (f : M → N) (H : ∀ x y, f (x * y) = f x * f y) (h : mulKer f H ≤ c)
506-
(hf : Surjective f) : Con N :=
507-
{ c.toSetoid.mapOfSurjective f h hf with
508-
mul' := fun h₁ h₂ => by
509-
rcases h₁ with ⟨a, b, h1, rfl, rfl⟩
510-
rcases h₂ with ⟨p, q, h2, rfl, rfl⟩
511-
exact ⟨a * p, b * q, c.mul h1 h2, by rw [H], by rw [H]⟩ }
512-
513-
/-- A specialization of 'the smallest congruence relation containing a congruence relation `c`
514-
equals `c`'. -/
515-
@[to_additive "A specialization of 'the smallest additive congruence relation containing
516-
an additive congruence relation `c` equals `c`'."]
517-
theorem mapOfSurjective_eq_mapGen {c : Con M} {f : M → N} (H : ∀ x y, f (x * y) = f x * f y)
518-
(h : mulKer f H ≤ c) (hf : Surjective f) : c.mapGen f = c.mapOfSurjective f H h hf := by
519-
rw [← conGen_of_con (c.mapOfSurjective f H h hf)]; rfl
520476

521477
/-- Given types with multiplications `M, N` and a congruence relation `c` on `N`, a
522478
multiplication-preserving map `f : M → N` induces a congruence relation on `f`'s domain
@@ -537,37 +493,6 @@ section
537493

538494
open Quotient
539495

540-
/-- Given a congruence relation `c` on a type `M` with a multiplication, the order-preserving
541-
bijection between the set of congruence relations containing `c` and the congruence relations
542-
on the quotient of `M` by `c`. -/
543-
@[to_additive "Given an additive congruence relation `c` on a type `M` with an addition,
544-
the order-preserving bijection between the set of additive congruence relations containing `c` and
545-
the additive congruence relations on the quotient of `M` by `c`."]
546-
def correspondence : { d // c ≤ d } ≃o Con c.Quotient where
547-
toFun d :=
548-
d.1.mapOfSurjective (↑) (fun _ _ => rfl) (by rw [mul_ker_mk_eq]; exact d.2) <|
549-
Quotient.mk_surjective
550-
invFun d :=
551-
⟨comap ((↑) : M → c.Quotient) (fun _ _ => rfl) d, fun x y h =>
552-
show d x y by rw [c.eq.2 h]; exact d.refl _⟩
553-
left_inv d :=
554-
Subtype.ext_iff_val.2 <|
555-
ext fun x y =>
556-
fun ⟨a, b, H, hx, hy⟩ =>
557-
d.1.trans (d.1.symm <| d.2 <| c.eq.1 hx) <| d.1.trans H <| d.2 <| c.eq.1 hy,
558-
fun h => ⟨_, _, h, rfl, rfl⟩⟩
559-
right_inv d :=
560-
ext fun x y =>
561-
fun ⟨_, _, H, hx, hy⟩ =>
562-
hx ▸ hy ▸ H,
563-
Con.induction_on₂ x y fun w z h => ⟨w, z, h, rfl, rfl⟩⟩
564-
map_rel_iff' {s t} := by
565-
constructor
566-
· intros h x y hs
567-
rcases h ⟨x, y, hs, rfl, rfl⟩ with ⟨a, b, ht, hx, hy⟩
568-
exact t.1.trans (t.1.symm <| t.2 <| c.eq.1 hx) (t.1.trans ht (t.2 <| c.eq.1 hy))
569-
· exact Relation.map_mono
570-
571496
end
572497

573498
end

Mathlib/GroupTheory/Congruence/Hom.lean

Lines changed: 115 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,134 @@ variable {M}
3333

3434
namespace Con
3535

36-
section MulOneClass
36+
section Mul
37+
variable {F} [Mul M] [Mul N] [Mul P] [FunLike F M N] [MulHomClass F M N]
3738

38-
variable [MulOneClass M] [MulOneClass N] [MulOneClass P] {c : Con M}
3939

40-
/-- The kernel of a monoid homomorphism as a congruence relation. -/
41-
@[to_additive "The kernel of an `AddMonoid` homomorphism as an additive congruence relation."]
42-
def ker (f : M →* P) : Con M :=
43-
mulKer f (map_mul f)
40+
/-- The natural homomorphism from a magma to its quotient by a congruence relation. -/
41+
@[to_additive (attr := simps)"The natural homomorphism from an additive magma to its quotient by an
42+
additive congruence relation."]
43+
def mkMulHom (c : Con M) : MulHom M c.Quotient where
44+
toFun := (↑)
45+
map_mul' _ _ := rfl
46+
47+
48+
/-- The kernel of a multiplicative homomorphism as a congruence relation. -/
49+
@[to_additive "The kernel of an additive homomorphism as an additive congruence relation."]
50+
def ker (f : F) : Con M where
51+
toSetoid := Setoid.ker f
52+
mul' h1 h2 := by
53+
dsimp [Setoid.ker, onFun] at *
54+
rw [map_mul, h1, h2, map_mul]
55+
56+
@[to_additive (attr := norm_cast)]
57+
theorem ker_coeMulHom (f : F) : ker (f : MulHom M N) = ker f := rfl
4458

4559
/-- The definition of the congruence relation defined by a monoid homomorphism's kernel. -/
4660
@[to_additive (attr := simp) "The definition of the additive congruence relation defined by an
4761
`AddMonoid` homomorphism's kernel."]
48-
theorem ker_rel (f : M →* P) {x y} : ker f x y ↔ f x = f y :=
62+
theorem ker_rel (f : F) {x y} : ker f x y ↔ f x = f y :=
4963
Iff.rfl
5064

65+
@[to_additive (attr := simp) "The kernel of the quotient map induced by an additive congruence
66+
relation `c` equals `c`."]
67+
theorem ker_mkMulHom_eq (c : Con M) : ker (mkMulHom c) = c :=
68+
ext fun _ _ => Quotient.eq''
69+
70+
/-- The kernel of a multiplication-preserving function as a congruence relation. -/
71+
@[to_additive "The kernel of an addition-preserving function as an additive congruence relation."]
72+
abbrev mulKer (f : M → P) (h : ∀ x y, f (x * y) = f x * f y) : Con M :=
73+
ker <| MulHom.mk f h
74+
75+
attribute [deprecated Con.ker (since := "2025-03-23")] mulKer
76+
attribute [deprecated AddCon.ker (since := "2025-03-23")] AddCon.addKer
77+
78+
set_option linter.deprecated false in
79+
/-- The kernel of the quotient map induced by a congruence relation `c` equals `c`. -/
80+
@[to_additive (attr := simp) "The kernel of the quotient map induced by an additive congruence
81+
relation `c` equals `c`."]
82+
theorem mul_ker_mk_eq {c : Con M} :
83+
(mulKer ((↑) : M → c.Quotient) fun _ _ => rfl) = c :=
84+
ext fun _ _ => Quotient.eq''
85+
86+
attribute [deprecated Con.ker_mkMulHom_eq (since := "2025-03-23")] mul_ker_mk_eq
87+
attribute [deprecated AddCon.ker_mkAddHom_eq (since := "2025-03-23")] AddCon.add_ker_mk_eq
88+
89+
/-- Given a function `f`, the smallest congruence relation containing the binary relation on `f`'s
90+
image defined by '`x ≈ y` iff the elements of `f⁻¹(x)` are related to the elements of `f⁻¹(y)`
91+
by a congruence relation `c`.' -/
92+
@[to_additive "Given a function `f`, the smallest additive congruence relation containing the
93+
binary relation on `f`'s image defined by '`x ≈ y` iff the elements of `f⁻¹(x)` are related to the
94+
elements of `f⁻¹(y)` by an additive congruence relation `c`.'"]
95+
def mapGen {c : Con M} (f : M → N) : Con N :=
96+
conGen <| Relation.Map c f f
97+
98+
/-- Given a surjective multiplicative-preserving function `f` whose kernel is contained in a
99+
congruence relation `c`, the congruence relation on `f`'s codomain defined by '`x ≈ y` iff the
100+
elements of `f⁻¹(x)` are related to the elements of `f⁻¹(y)` by `c`.' -/
101+
@[to_additive "Given a surjective addition-preserving function `f` whose kernel is contained in
102+
an additive congruence relation `c`, the additive congruence relation on `f`'s codomain defined
103+
by '`x ≈ y` iff the elements of `f⁻¹(x)` are related to the elements of `f⁻¹(y)` by `c`.'"]
104+
def mapOfSurjective {c : Con M} (f : F) (h : ker f ≤ c) (hf : Surjective f) : Con N where
105+
__ := c.toSetoid.mapOfSurjective f h hf
106+
mul' h₁ h₂ := by
107+
rcases h₁ with ⟨a, b, h1, rfl, rfl⟩
108+
rcases h₂ with ⟨p, q, h2, rfl, rfl⟩
109+
exact ⟨a * p, b * q, c.mul h1 h2, map_mul f _ _, map_mul f _ _⟩
110+
111+
/-- A specialization of 'the smallest congruence relation containing a congruence relation `c`
112+
equals `c`'. -/
113+
@[to_additive "A specialization of 'the smallest additive congruence relation containing
114+
an additive congruence relation `c` equals `c`'."]
115+
theorem mapOfSurjective_eq_mapGen {c : Con M} {f : F} (h : ker f ≤ c) (hf : Surjective f) :
116+
c.mapGen f = c.mapOfSurjective f h hf := by
117+
rw [← conGen_of_con (c.mapOfSurjective f h hf)]; rfl
118+
119+
/-- Given a congruence relation `c` on a type `M` with a multiplication, the order-preserving
120+
bijection between the set of congruence relations containing `c` and the congruence relations
121+
on the quotient of `M` by `c`. -/
122+
@[to_additive "Given an additive congruence relation `c` on a type `M` with an addition,
123+
the order-preserving bijection between the set of additive congruence relations containing `c` and
124+
the additive congruence relations on the quotient of `M` by `c`."]
125+
def correspondence {c : Con M} : { d // c ≤ d } ≃o Con c.Quotient where
126+
toFun d :=
127+
d.1.mapOfSurjective (mkMulHom c) (by rw [Con.ker_mkMulHom_eq]; exact d.2) <|
128+
Quotient.mk_surjective
129+
invFun d :=
130+
⟨comap ((↑) : M → c.Quotient) (fun _ _ => rfl) d, fun x y h =>
131+
show d x y by rw [c.eq.2 h]; exact d.refl _⟩
132+
left_inv d :=
133+
Subtype.ext_iff_val.2 <|
134+
ext fun x y =>
135+
fun ⟨a, b, H, hx, hy⟩ =>
136+
d.1.trans (d.1.symm <| d.2 <| c.eq.1 hx) <| d.1.trans H <| d.2 <| c.eq.1 hy,
137+
fun h => ⟨_, _, h, rfl, rfl⟩⟩
138+
right_inv d :=
139+
ext fun x y =>
140+
fun ⟨_, _, H, hx, hy⟩ =>
141+
hx ▸ hy ▸ H,
142+
Con.induction_on₂ x y fun w z h => ⟨w, z, h, rfl, rfl⟩⟩
143+
map_rel_iff' {s t} := by
144+
constructor
145+
· intros h x y hs
146+
rcases h ⟨x, y, hs, rfl, rfl⟩ with ⟨a, b, ht, hx, hy⟩
147+
exact t.1.trans (t.1.symm <| t.2 <| c.eq.1 hx) (t.1.trans ht (t.2 <| c.eq.1 hy))
148+
· exact Relation.map_mono
149+
150+
end Mul
151+
152+
section MulOneClass
153+
154+
variable [MulOneClass M] [MulOneClass N] [MulOneClass P] {c : Con M}
155+
51156
variable (c)
52157

53158
/-- The natural homomorphism from a monoid to its quotient by a congruence relation. -/
54159
@[to_additive "The natural homomorphism from an `AddMonoid` to its quotient by an additive
55160
congruence relation."]
56-
def mk' : M →* c.Quotient :=
57-
{ toFun := (↑)
58-
map_one' := rfl
59-
map_mul' := fun _ _ => rfl }
161+
def mk' : M →* c.Quotient where
162+
__ := mkMulHom c
163+
map_one' := rfl
60164

61165
variable (x y : M)
62166

0 commit comments

Comments
 (0)