@@ -33,30 +33,134 @@ variable {M}
3333
3434namespace 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+
51156variable (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
55160congruence 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
61165variable (x y : M)
62166
0 commit comments