Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit b013b2d

Browse files
committed
feat(ring_theory): define subsemirings (#2837)
~~Depends on #2836,~~ needs a better module docstring. Some lemmas are missing, most notably `(subsemiring.closure s : set R) = add_submonoid.closure (submonoid.closure s)`.
1 parent 6c046c7 commit b013b2d

File tree

5 files changed

+601
-33
lines changed

5 files changed

+601
-33
lines changed

src/group_theory/congruence.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ noncomputable def quotient_ker_equiv_range (f : M →* P) : (ker f).quotient ≃
804804
{ map_mul' := monoid_hom.map_mul _,
805805
..@equiv.of_bijective _ _
806806
((@mul_equiv.to_monoid_hom (ker_lift f).mrange _ _ _
807-
$ mul_equiv.submonoid_congr ker_lift_range_eq).comp (ker_lift f).range_restrict) $
807+
$ mul_equiv.submonoid_congr ker_lift_range_eq).comp (ker_lift f).mrange_restrict) $
808808
(equiv.bijective _).comp
809809
⟨λ x y h, injective_ker_lift f $ by rcases x; rcases y; injections,
810810
λ ⟨w, z, hzm, hz⟩, ⟨z, by rcases hz; rcases _x; refl⟩⟩ }

src/group_theory/monoid_localization.lean

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,16 @@ by rw [mul_comm, sec_spec]
230230
@[to_additive "Given an add_monoid hom `f : M →+ N` and submonoid `S ⊆ M` such that
231231
`f(S) ⊆ add_units N`, for all `w : M, z : N` and `y ∈ S`, we have `w - f y = z ↔ w = f y + z`."]
232232
lemma mul_inv_left {f : M →* N} (h : ∀ y : S, is_unit (f y))
233-
(y : S) (w z) : w * ↑(is_unit.lift_right (f.restrict S) h y)⁻¹ = z ↔ w = f y * z :=
233+
(y : S) (w z) : w * ↑(is_unit.lift_right (f.mrestrict S) h y)⁻¹ = z ↔ w = f y * z :=
234234
by rw mul_comm; convert units.inv_mul_eq_iff_eq_mul _;
235-
exact (is_unit.coe_lift_right (f.restrict S) h _).symm
235+
exact (is_unit.coe_lift_right (f.mrestrict S) h _).symm
236236

237237
/-- Given a monoid hom `f : M →* N` and submonoid `S ⊆ M` such that `f(S) ⊆ units N`, for all
238238
`w : M, z : N` and `y ∈ S`, we have `z = w * (f y)⁻¹ ↔ z * f y = w`. -/
239239
@[to_additive "Given an add_monoid hom `f : M →+ N` and submonoid `S ⊆ M` such that
240240
`f(S) ⊆ add_units N`, for all `w : M, z : N` and `y ∈ S`, we have `z = w - f y ↔ z + f y = w`."]
241241
lemma mul_inv_right {f : M →* N} (h : ∀ y : S, is_unit (f y))
242-
(y : S) (w z) : z = w * ↑(is_unit.lift_right (f.restrict S) h y)⁻¹ ↔ z * f y = w :=
242+
(y : S) (w z) : z = w * ↑(is_unit.lift_right (f.mrestrict S) h y)⁻¹ ↔ z * f y = w :=
243243
by rw [eq_comm, mul_inv_left h, mul_comm, eq_comm]
244244

245245
/-- Given a monoid hom `f : M →* N` and submonoid `S ⊆ M` such that
@@ -249,8 +249,8 @@ by rw [eq_comm, mul_inv_left h, mul_comm, eq_comm]
249249
`f(S) ⊆ add_units N`, for all `x₁ x₂ : M` and `y₁, y₂ ∈ S`, we have
250250
`f x₁ - f y₁ = f x₂ - f y₂ ↔ f (x₁ + y₂) = f (x₂ + y₁)`."]
251251
lemma mul_inv {f : M →* N} (h : ∀ y : S, is_unit (f y)) {x₁ x₂} {y₁ y₂ : S} :
252-
f x₁ * ↑(is_unit.lift_right (f.restrict S) h y₁)⁻¹ =
253-
f x₂ * ↑(is_unit.lift_right (f.restrict S) h y₂)⁻¹ ↔ f (x₁ * y₂) = f (x₂ * y₁) :=
252+
f x₁ * ↑(is_unit.lift_right (f.mrestrict S) h y₁)⁻¹ =
253+
f x₂ * ↑(is_unit.lift_right (f.mrestrict S) h y₂)⁻¹ ↔ f (x₁ * y₂) = f (x₂ * y₁) :=
254254
by rw [mul_inv_right h, mul_assoc, mul_comm _ (f y₂), ←mul_assoc, mul_inv_left h, mul_comm x₂,
255255
f.map_mul, f.map_mul]
256256

@@ -259,17 +259,17 @@ by rw [mul_inv_right h, mul_assoc, mul_comm _ (f y₂), ←mul_assoc, mul_inv_le
259259
@[to_additive "Given an add_monoid hom `f : M →+ N` and submonoid `S ⊆ M` such that
260260
`f(S) ⊆ add_units N`, for all `y, z ∈ S`, we have `- (f y) = - (f z) → f y = f z`."]
261261
lemma inv_inj {f : M →* N} (hf : ∀ y : S, is_unit (f y)) {y z}
262-
(h : (is_unit.lift_right (f.restrict S) hf y)⁻¹ = (is_unit.lift_right (f.restrict S) hf z)⁻¹) :
262+
(h : (is_unit.lift_right (f.mrestrict S) hf y)⁻¹ = (is_unit.lift_right (f.mrestrict S) hf z)⁻¹) :
263263
f y = f z :=
264264
by rw [←mul_one (f y), eq_comm, ←mul_inv_left hf y (f z) 1, h];
265-
convert units.inv_mul _; exact (is_unit.coe_lift_right (f.restrict S) hf _).symm
265+
convert units.inv_mul _; exact (is_unit.coe_lift_right (f.mrestrict S) hf _).symm
266266

267267
/-- Given a monoid hom `f : M →* N` and submonoid `S ⊆ M` such that `f(S) ⊆ units N`, for all
268268
`y ∈ S`, `(f y)⁻¹` is unique. -/
269269
@[to_additive "Given an add_monoid hom `f : M →+ N` and submonoid `S ⊆ M` such that
270270
`f(S) ⊆ add_units N`, for all `y ∈ S`, `- (f y)` is unique."]
271271
lemma inv_unique {f : M →* N} (h : ∀ y : S, is_unit (f y)) {y : S}
272-
{z} (H : f y * z = 1) : ↑(is_unit.lift_right (f.restrict S) h y)⁻¹ = z :=
272+
{z} (H : f y * z = 1) : ↑(is_unit.lift_right (f.mrestrict S) h y)⁻¹ = z :=
273273
by rw [←one_mul ↑(_)⁻¹, mul_inv_left, ←H]
274274

275275
variables (f : localization_map S N)
@@ -292,7 +292,7 @@ f.map_right_cancel $ by rw [mul_comm _ x, mul_comm _ y, h]
292292
@[to_additive "Given a localization map `f : M →+ N`, the surjection sending `(x, y) : M × S`
293293
to `f x - f y`."]
294294
noncomputable def mk' (f : localization_map S N) (x : M) (y : S) : N :=
295-
f.to_map x * ↑(is_unit.lift_right (f.to_map.restrict S) f.map_units y)⁻¹
295+
f.to_map x * ↑(is_unit.lift_right (f.to_map.mrestrict S) f.map_units y)⁻¹
296296

297297
@[to_additive] lemma mk'_mul (x₁ x₂ : M) (y₁ y₂ : S) :
298298
f.mk' (x₁ * x₂) (y₁ * y₂) = f.mk' x₁ y₁ * f.mk' x₂ y₂ :=
@@ -399,9 +399,9 @@ by rw [mul_comm, mk'_mul_cancel_right]
399399

400400
@[to_additive] lemma is_unit_comp (j : N →* P) (y : S) :
401401
is_unit (j.comp f.to_map y) :=
402-
⟨units.map j $ is_unit.lift_right (f.to_map.restrict S) f.map_units y,
402+
⟨units.map j $ is_unit.lift_right (f.to_map.mrestrict S) f.map_units y,
403403
show j _ = j _, from congr_arg j $
404-
(is_unit.coe_lift_right (f.to_map.restrict S) f.map_units _)⟩
404+
(is_unit.coe_lift_right (f.to_map.mrestrict S) f.map_units _)⟩
405405

406406
variables {g : M →* P}
407407

@@ -414,7 +414,7 @@ lemma eq_of_eq (hg : ∀ y : S, is_unit (g y)) {x y} (h : f.to_map x = f.to_map
414414
g x = g y :=
415415
begin
416416
obtain ⟨c, hc⟩ := f.eq_iff_exists.1 h,
417-
rw [←mul_one (g x), ←is_unit.mul_lift_right_inv (g.restrict S) hg c],
417+
rw [←mul_one (g x), ←is_unit.mul_lift_right_inv (g.mrestrict S) hg c],
418418
show _ * (g c * _) = _,
419419
rw [←mul_assoc, ←g.map_mul, hc, mul_inv_left hg, g.map_mul, mul_comm],
420420
end
@@ -441,7 +441,7 @@ of `add_comm_monoid`s `g : M →+ P` such that `g y` is invertible for all `y :
441441
induced from `N` to `P` sending `z : N` to `g x - g y`, where `(x, y) : M × S` are such that
442442
`z = f x - f y`."]
443443
noncomputable def lift : N →* P :=
444-
{ to_fun := λ z, g (f.sec z).1 * ↑(is_unit.lift_right (g.restrict S) hg (f.sec z).2)⁻¹,
444+
{ to_fun := λ z, g (f.sec z).1 * ↑(is_unit.lift_right (g.mrestrict S) hg (f.sec z).2)⁻¹,
445445
map_one' := by rw [mul_inv_left, mul_one]; exact f.eq_of_eq hg
446446
(by rw [←sec_spec, one_mul]),
447447
map_mul' := λ x y,
@@ -461,7 +461,7 @@ variables {S g}
461461
of `add_comm_monoid`s `g : M →+ P` such that `g y` is invertible for all `y : S`, the homomorphism
462462
induced from `N` to `P` maps `f x - f y` to `g x - g y` for all `x : M, y ∈ S`."]
463463
lemma lift_mk' (x y) :
464-
f.lift hg (f.mk' x y) = g x * ↑(is_unit.lift_right (g.restrict S) hg y)⁻¹ :=
464+
f.lift hg (f.mk' x y) = g x * ↑(is_unit.lift_right (g.mrestrict S) hg y)⁻¹ :=
465465
(mul_inv hg).2 $ f.eq_of_eq hg $ by
466466
rw [f.to_map.map_mul, f.to_map.map_mul, sec_spec', mul_assoc, f.mk'_spec, mul_comm]
467467

@@ -585,7 +585,7 @@ begin
585585
obtain ⟨x, hx⟩ := f.surj z,
586586
use x,
587587
rw [←hz, f.eq_mk'_iff_mul_eq.2 hx, lift_mk', mul_assoc, mul_comm _ (g ↑x.2)],
588-
erw [is_unit.mul_lift_right_inv (g.restrict S) hg, mul_one] },
588+
erw [is_unit.mul_lift_right_inv (g.mrestrict S) hg, mul_one] },
589589
{ intros H v,
590590
obtain ⟨x, hx⟩ := H v,
591591
use f.mk' x.1 x.2,

src/group_theory/submonoid.lean

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ lemma closure_Union {ι} (s : ι → set M) : closure (⋃ i, s i) = ⨆ i, clos
791791
@[to_additive]
792792
lemma mem_supr_of_directed {ι} [hι : nonempty ι] {S : ι → submonoid M} (hS : directed (≤) S)
793793
{x : M} :
794-
x ∈ (supr S : submonoid M) ↔ ∃ i, x ∈ S i :=
794+
x ∈ (⨆ i, S i) ↔ ∃ i, x ∈ S i :=
795795
begin
796796
refine ⟨_, λ ⟨i, hi⟩, (le_def.1 $ le_supr S i) hi⟩,
797797
suffices : x ∈ closure (⋃ i, (S i : set M)) → ∃ i, x ∈ S i,
@@ -803,6 +803,11 @@ begin
803803
exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩ }
804804
end
805805

806+
@[to_additive]
807+
lemma coe_supr_of_directed {ι} [nonempty ι] {S : ι → submonoid M} (hS : directed (≤) S) :
808+
((⨆ i, S i : submonoid M) : set M) = ⋃ i, ↑(S i) :=
809+
set.ext $ λ x, by simp [mem_supr_of_directed hS]
810+
806811
@[to_additive]
807812
lemma mem_Sup_of_directed_on {S : set (submonoid M)} (Sne : S.nonempty)
808813
(hS : directed_on (≤) S) {x : M} :
@@ -813,6 +818,11 @@ begin
813818
exact (directed_on_iff_directed _).1 hS
814819
end
815820

821+
@[to_additive]
822+
lemma coe_Sup_of_directed_on {S : set (submonoid M)} (Sne : S.nonempty) (hS : directed_on (≤) S) :
823+
(↑(Sup S) : set M) = ⋃ s ∈ S, ↑s :=
824+
set.ext $ λ x, by simp [mem_Sup_of_directed_on Sne hS]
825+
816826
variables {N : Type*} [monoid N] {P : Type*} [monoid P]
817827

818828
/-- The preimage of a submonoid along a monoid homomorphism is a submonoid. -/
@@ -969,29 +979,26 @@ lemma map_mrange (g : N →* P) (f : M →* N) : f.mrange.map g = (g.comp f).mra
969979

970980
/-- Restriction of a monoid hom to a submonoid of the domain. -/
971981
@[to_additive "Restriction of an add_monoid hom to an `add_submonoid` of the domain."]
972-
def restrict {N : Type*} [monoid N] (f : M →* N) (S : submonoid M) : S →* N := f.comp S.subtype
982+
def mrestrict {N : Type*} [monoid N] (f : M →* N) (S : submonoid M) : S →* N := f.comp S.subtype
973983

974-
@[to_additive]
975-
lemma restrict_apply {N : Type*} [monoid N] (f : M →* N) (x : S) : f.restrict S x = f x := rfl
976-
977-
@[simp, to_additive] lemma restrict_eq {N : Type} [monoid N] (f : M →* N) (x) :
978-
f.restrict S x = f x := rfl
984+
@[simp, to_additive]
985+
lemma mrestrict_apply {N : Type*} [monoid N] (f : M →* N) (x : S) : f.mrestrict S x = f x := rfl
979986

980987
/-- Restriction of a monoid hom to a submonoid of the codomain. -/
981988
@[to_additive "Restriction of an `add_monoid` hom to an `add_submonoid` of the codomain."]
982-
def cod_restrict (f : M →* N) (S : submonoid N) (h : ∀ x, f x ∈ S) : M →* S :=
989+
def cod_mrestrict (f : M →* N) (S : submonoid N) (h : ∀ x, f x ∈ S) : M →* S :=
983990
{ to_fun := λ n, ⟨f n, h n⟩,
984991
map_one' := subtype.eq f.map_one,
985992
map_mul' := λ x y, subtype.eq (f.map_mul x y) }
986993

987994
/-- Restriction of a monoid hom to its range iterpreted as a submonoid. -/
988995
@[to_additive "Restriction of an `add_monoid` hom to its range interpreted as a submonoid."]
989-
def range_restrict {N} [monoid N] (f : M →* N) : M →* f.mrange :=
990-
f.cod_restrict f.mrange $ λ x, ⟨x, submonoid.mem_top x, rfl⟩
996+
def mrange_restrict {N} [monoid N] (f : M →* N) : M →* f.mrange :=
997+
f.cod_mrestrict f.mrange $ λ x, ⟨x, submonoid.mem_top x, rfl⟩
991998

992999
@[simp, to_additive]
993-
lemma coe_range_restrict {N} [monoid N] (f : M →* N) (x : M) :
994-
(f.range_restrict x : N) = f x :=
1000+
lemma coe_mrange_restrict {N} [monoid N] (f : M →* N) (x : M) :
1001+
(f.mrange_restrict x : N) = f x :=
9951002
rfl
9961003

9971004
@[to_additive]
@@ -1029,7 +1036,7 @@ lemma eq_of_eq_on_mdense {s : set M} (hs : closure s = ⊤) {f g : M →* N} (h
10291036
eq_of_eq_on_mtop $ hs ▸ eq_on_mclosure h
10301037

10311038
@[to_additive]
1032-
lemma closure_preimage_le (f : M →* N) (s : set N) :
1039+
lemma mclosure_preimage_le (f : M →* N) (s : set N) :
10331040
closure (f ⁻¹' s) ≤ (closure s).comap f :=
10341041
closure_le.2 $ λ x hx, mem_coe.2 $ mem_comap.2 $ subset_closure hx
10351042

@@ -1041,7 +1048,7 @@ lemma map_mclosure (f : M →* N) (s : set M) :
10411048
(closure s).map f = closure (f '' s) :=
10421049
le_antisymm
10431050
(map_le_iff_le_comap.2 $ le_trans (closure_mono $ set.subset_preimage_image _ _)
1044-
(closure_preimage_le _ _))
1051+
(mclosure_preimage_le _ _))
10451052
(closure_le.2 $ set.image_subset _ subset_closure)
10461053

10471054
end monoid_hom
@@ -1063,12 +1070,12 @@ namespace submonoid
10631070

10641071
variables {N : Type*} [monoid N]
10651072

1066-
open monoid_hom lattice
1073+
open monoid_hom
10671074

10681075
/-- The monoid hom associated to an inclusion of submonoids. -/
10691076
@[to_additive "The `add_monoid` hom associated to an inclusion of submonoids."]
10701077
def inclusion {S T : submonoid M} (h : S ≤ T) : S →* T :=
1071-
S.subtype.cod_restrict _ (λ x, h x.2)
1078+
S.subtype.cod_mrestrict _ (λ x, h x.2)
10721079

10731080
@[simp, to_additive]
10741081
lemma range_subtype (s : submonoid M) : s.subtype.mrange = s :=

src/ring_theory/localization.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ variables {g : R →+* P} (hg : ∀ y : M, is_unit (g y))
323323
`g : R →* P` such that `g y` is invertible for all `y : M`, the homomorphism induced from
324324
`S` to `P` maps `f x * (f y)⁻¹` to `g x * (g y)⁻¹` for all `x : R, y ∈ M`. -/
325325
lemma lift_mk' (x y) :
326-
f.lift hg (f.mk' x y) = g x * ↑(is_unit.lift_right (g.to_monoid_hom.restrict M) hg y)⁻¹ :=
326+
f.lift hg (f.mk' x y) = g x * ↑(is_unit.lift_right (g.to_monoid_hom.mrestrict M) hg y)⁻¹ :=
327327
f.to_localization_map.lift_mk' _ _ _
328328

329329
lemma lift_mk'_spec (x v) (y : M) :

0 commit comments

Comments
 (0)