-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Merged by Bors] - feat(Algebra/Order/{Monoid,GroupWithZero}/Lex): ordered inclusions and projections of prod of ordered groups #22420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 53 commits
7b03e85
506bc5f
a8463c8
b14da2a
6bc9a81
88d7332
7ea6195
315bd58
74f79be
9ab6eda
6cba8eb
3059eef
a397cba
c769623
6a66db7
e9e206d
76121f8
1f4bc08
46b87ff
cbaa7c5
318579b
fc240da
233d2b2
fdd05a3
9763c9c
36f1598
cfbe5a0
80c2d38
1e3f448
c90d29a
1e8d5d9
63d0e73
2edc2b8
866cafe
7e0fbce
b2bb4c8
8406ba3
266fde2
c6e0c28
fecaea9
d5355f3
f52b692
d943088
39d3d7a
eb84758
29beaa7
88f6a0c
a4035ef
827132b
bcf598a
9be70f5
badf618
a30753b
1b61419
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| /- | ||
| Copyright (c) 2025 Yakov Pechersky. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Yakov Pechersky | ||
| -/ | ||
| import Mathlib.Algebra.GroupWithZero.ProdHom | ||
| import Mathlib.Algebra.Order.Hom.Monoid | ||
| import Mathlib.Algebra.Order.Monoid.Lex | ||
| import Mathlib.Data.Prod.Lex | ||
|
|
||
| /-! | ||
| # Order homomorphisms for products of linearly ordered groups with zero | ||
|
|
||
| This file defines order homomorphisms for products of linearly ordered groups with zero, | ||
| which is identified with the `WithZero` of the lexicographic product of the units of the groups. | ||
|
|
||
| The product of linearly ordered groups with zero `WithZero (αˣ ×ₗ βˣ)` is a | ||
| linearly ordered group with zero itself with natural inclusions but only one projection. | ||
| One has to work with the lexicographic product of the units `αˣ ×ₗ βˣ` since otherwise, | ||
| the plain product `αˣ × βˣ` would not be linearly ordered. | ||
|
|
||
| ## TODO | ||
|
|
||
| Create the "LinOrdCommGrpWithZero" category. | ||
|
|
||
| -/ | ||
|
|
||
| -- TODO: find a better place | ||
| /-- `toLex` as a monoid isomorphism. -/ | ||
| def toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : G × H ≃* G ×ₗ H where | ||
| toFun := toLex | ||
| invFun := ofLex | ||
| left_inv := ofLex_toLex | ||
| right_inv := toLex_ofLex | ||
| map_mul' := toLex_mul | ||
|
|
||
| @[simp] | ||
| lemma coe_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : | ||
| ⇑(toLexMulEquiv G H) = toLex := | ||
| rfl | ||
|
|
||
| @[simp] | ||
| lemma coe_symm_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : | ||
| ⇑(toLexMulEquiv G H).symm = ofLex := | ||
| rfl | ||
|
|
||
| @[simp] | ||
| lemma toEquiv_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : | ||
| ⇑(toLexMulEquiv G H : G × H ≃ G ×ₗ H) = toLex := | ||
| rfl | ||
|
|
||
| @[simp] | ||
| lemma toEquiv_symm_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : | ||
| ⇑((toLexMulEquiv G H).symm : G ×ₗ H ≃ G × H) = ofLex := | ||
| rfl | ||
|
|
||
| namespace MonoidWithZeroHom | ||
|
|
||
| variable {M₀ N₀ : Type*} | ||
|
|
||
| lemma inl_mono [LinearOrderedCommGroupWithZero M₀] [GroupWithZero N₀] [Preorder N₀] | ||
| [DecidablePred fun x : M₀ ↦ x = 0] : Monotone (inl M₀ N₀) := by | ||
| refine (WithZero.map'_mono MonoidHom.inl_mono).comp ?_ | ||
| intro x y | ||
| obtain rfl | ⟨x, rfl⟩ := GroupWithZero.eq_zero_or_unit x <;> | ||
| obtain rfl | ⟨y, rfl⟩ := GroupWithZero.eq_zero_or_unit y <;> | ||
| · simp [WithZero.zero_le, WithZero.withZeroUnitsEquiv] | ||
|
|
||
| lemma inl_strictMono [LinearOrderedCommGroupWithZero M₀] [GroupWithZero N₀] [PartialOrder N₀] | ||
| [DecidablePred fun x : M₀ ↦ x = 0] : StrictMono (inl M₀ N₀) := | ||
| inl_mono.strictMono_of_injective inl_injective | ||
|
|
||
| lemma inr_mono [GroupWithZero M₀] [Preorder M₀] [LinearOrderedCommGroupWithZero N₀] | ||
| [DecidablePred fun x : N₀ ↦ x = 0] : Monotone (inr M₀ N₀) := by | ||
| refine (WithZero.map'_mono MonoidHom.inr_mono).comp ?_ | ||
| intro x y | ||
| obtain rfl | ⟨x, rfl⟩ := GroupWithZero.eq_zero_or_unit x <;> | ||
| obtain rfl | ⟨y, rfl⟩ := GroupWithZero.eq_zero_or_unit y <;> | ||
| · simp [WithZero.zero_le, WithZero.withZeroUnitsEquiv] | ||
|
|
||
| lemma inr_strictMono [GroupWithZero M₀] [PartialOrder M₀] [LinearOrderedCommGroupWithZero N₀] | ||
| [DecidablePred fun x : N₀ ↦ x = 0] : StrictMono (inr M₀ N₀) := | ||
| inr_mono.strictMono_of_injective inr_injective | ||
|
|
||
| lemma fst_mono [LinearOrderedCommGroupWithZero M₀] [GroupWithZero N₀] [Preorder N₀] : | ||
| Monotone (fst M₀ N₀) := by | ||
| refine WithZero.forall.mpr ?_ | ||
| simp +contextual [WithZero.forall, Prod.le_def] | ||
|
|
||
|
|
||
| lemma snd_mono [GroupWithZero M₀] [Preorder M₀] [LinearOrderedCommGroupWithZero N₀] : | ||
| Monotone (snd M₀ N₀) := by | ||
| refine WithZero.forall.mpr ?_ | ||
| simp [WithZero.forall, Prod.le_def] | ||
|
|
||
| end MonoidWithZeroHom | ||
|
|
||
| namespace LinearOrderedCommGroupWithZero | ||
|
|
||
| variable (α β : Type*) [LinearOrderedCommGroupWithZero α] [LinearOrderedCommGroupWithZero β] | ||
|
|
||
| open MonoidWithZeroHom | ||
|
|
||
| /-- Given linearly ordered groups with zero M, N, the natural inclusion ordered homomorphism from | ||
| M to `WithZero (Mˣ ×ₗ Nˣ)`, which is the linearly ordered group with zero that can be identified | ||
| as their product. -/ | ||
| @[simps!] | ||
| nonrec def inl : α →*₀o WithZero (αˣ ×ₗ βˣ) where | ||
| __ := (WithZero.map' (toLexMulEquiv ..).toMonoidHom).comp (inl α β) | ||
| monotone' := by simpa using (WithZero.map'_mono (Prod.Lex.toLex_mono)).comp inl_mono | ||
|
|
||
| /-- Given linearly ordered groups with zero M, N, the natural inclusion ordered homomorphism from | ||
| N to `WithZero (Mˣ ×ₗ Nˣ)`, which is the linearly ordered group with zero that can be identified | ||
| as their product. -/ | ||
| @[simps!] | ||
| nonrec def inr : β →*₀o WithZero (αˣ ×ₗ βˣ) where | ||
| __ := (WithZero.map' (toLexMulEquiv ..).toMonoidHom).comp (inr α β) | ||
| monotone' := by simpa using (WithZero.map'_mono (Prod.Lex.toLex_mono)).comp inr_mono | ||
|
|
||
| /-- Given linearly ordered groups with zero M, N, the natural projection ordered homomorphism from | ||
| `WithZero (Mˣ ×ₗ Nˣ)` to M, which is the linearly ordered group with zero that can be identified | ||
| as their product. -/ | ||
| @[simps!] | ||
| nonrec def fst : WithZero (αˣ ×ₗ βˣ) →*₀o α where | ||
| __ := (fst α β).comp (WithZero.map' (toLexMulEquiv ..).symm.toMonoidHom) | ||
| monotone' := by | ||
| -- this can't rely on `Monotone.comp` since `ofLex` is not monotone | ||
| intro x y | ||
| cases x <;> | ||
| cases y | ||
| · simp | ||
| · simp | ||
| · simp [WithZero.zero_lt_coe] | ||
| · simpa using Prod.Lex.monotone_fst _ _ | ||
|
|
||
| @[simp] | ||
| theorem fst_comp_inl : (fst _ _).comp (inl α β) = .id α := by | ||
| ext x | ||
| obtain rfl | ⟨_, rfl⟩ := GroupWithZero.eq_zero_or_unit x <;> | ||
| simp | ||
|
|
||
| theorem inlₗ_mul_inrₗ_eq_coe_toLex {m : α} {n : β} (hm : m ≠ 0) (hn : n ≠ 0) : | ||
| (inl α β m * inr α β n) = toLex (Units.mk0 _ hm, Units.mk0 _ hn) := by | ||
| lift m to αˣ using isUnit_iff_ne_zero.mpr hm | ||
| lift n to βˣ using isUnit_iff_ne_zero.mpr hn | ||
| simp [← toLex_mul, ← WithZero.coe_mul] | ||
|
|
||
| end LinearOrderedCommGroupWithZero | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -926,15 +926,31 @@ end Mul | |||||
| section LinearOrderedCommMonoidWithZero | ||||||
|
|
||||||
| variable {hα : Preorder α} {hα' : MulZeroOneClass α} {hβ : Preorder β} {hβ' : MulZeroOneClass β} | ||||||
| {hγ : Preorder γ} {hγ' : MulZeroOneClass γ} | ||||||
|
|
||||||
| @[simp] | ||||||
| theorem toMonoidWithZeroHom_eq_coe (f : α →*₀o β) : f.toMonoidWithZeroHom = f := by | ||||||
| rfl | ||||||
|
|
||||||
| @[simp] | ||||||
| theorem toMonoidWithZeroHom_mk (f : α →*₀ β) (hf : Monotone f) : | ||||||
| ((OrderMonoidWithZeroHom.mk f hf) : α →*₀ β) = ⟨f, f.map_one, f.map_mul⟩ := by | ||||||
| rfl | ||||||
|
|
||||||
| @[simp] | ||||||
| lemma toMonoidWithZeroHom_coe (f : β →*₀o γ) (g : α →*₀o β) : | ||||||
| (f.comp g : α →*₀ γ) = (f : β →*₀ γ).comp g := | ||||||
| rfl | ||||||
|
|
||||||
| @[simp] | ||||||
| theorem toOrderMonoidHom_eq_coe (f : α →*₀o β) : f.toOrderMonoidHom = f := | ||||||
| rfl | ||||||
|
|
||||||
| @[simp] | ||||||
| lemma comp_coe_orderMonoidHom (f : β →*₀o γ) (g : α →*₀o β) : | ||||||
|
||||||
| lemma comp_coe_orderMonoidHom (f : β →*₀o γ) (g : α →*₀o β) : | |
| lemma toOrderMonoidHom_comp (f : β →*₀o γ) (g : α →*₀o β) : |
for clarity
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,152 @@ | ||||||||||
| /- | ||||||||||
| Copyright (c) 2025 Yakov Pechersky. All rights reserved. | ||||||||||
| Released under Apache 2.0 license as described in the file LICENSE. | ||||||||||
| Authors: Yakov Pechersky | ||||||||||
| -/ | ||||||||||
| import Mathlib.Algebra.Group.Prod | ||||||||||
| import Mathlib.Algebra.Order.Hom.Monoid | ||||||||||
| import Mathlib.Data.Prod.Lex | ||||||||||
| import Mathlib.Order.Prod.Lex.Hom | ||||||||||
|
|
||||||||||
| /-! | ||||||||||
| # Order homomorphisms for products of ordered monoids | ||||||||||
|
|
||||||||||
| This file defines order homomorphisms for products of ordered monoids, for both the plain product | ||||||||||
| and the lexicographic product. | ||||||||||
|
|
||||||||||
| The product of ordered monoids `α × β` is an ordered monoid itself with both natural inclusions | ||||||||||
| and projections, making it the coproduct as well. | ||||||||||
|
|
||||||||||
| TODO: Create the "OrdCommMon" category. | ||||||||||
|
||||||||||
| TODO: Create the "OrdCommMon" category. | |
| ## TODO | |
| Create the "OrdCommMon" category. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's evil!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which is the evil part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected
| __ := (Prod.Lex.toLexOrderHom).comp (inr α β) | |
| __ := Prod.Lex.toLexOrderHom.comp (inr α β) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /- | ||
| Copyright (c) 2025 Yakov Pechersky. All rights reserved. | ||
| Released under Apache 2.0 license as described in the file LICENSE. | ||
| Authors: Yakov Pechersky | ||
| -/ | ||
| import Mathlib.Data.Prod.Lex | ||
| import Mathlib.Order.Hom.Basic | ||
|
|
||
| /-! | ||
| # Order homomorphism for `Prod.Lex` | ||
| -/ | ||
|
|
||
| /-- `toLex` as an `OrderHom`. -/ | ||
| @[simps] | ||
| def Prod.Lex.toLexOrderHom {α β : Type*} [PartialOrder α] [Preorder β] : | ||
| α × β →o α ×ₗ β where | ||
| toFun := toLex | ||
| monotone' := Prod.Lex.toLex_mono |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no
inrₗ_mul_inlₗversion?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what that would give differently, since this is over a commgroup