|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Yakov Pechersky. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Yakov Pechersky |
| 5 | +-/ |
| 6 | +import Mathlib.Algebra.GroupWithZero.ProdHom |
| 7 | +import Mathlib.Algebra.Order.Hom.Monoid |
| 8 | +import Mathlib.Algebra.Order.Monoid.Lex |
| 9 | +import Mathlib.Data.Prod.Lex |
| 10 | + |
| 11 | +/-! |
| 12 | +# Order homomorphisms for products of linearly ordered groups with zero |
| 13 | +
|
| 14 | +This file defines order homomorphisms for products of linearly ordered groups with zero, |
| 15 | +which is identified with the `WithZero` of the lexicographic product of the units of the groups. |
| 16 | +
|
| 17 | +The product of linearly ordered groups with zero `WithZero (αˣ ×ₗ βˣ)` is a |
| 18 | +linearly ordered group with zero itself with natural inclusions but only one projection. |
| 19 | +One has to work with the lexicographic product of the units `αˣ ×ₗ βˣ` since otherwise, |
| 20 | +the plain product `αˣ × βˣ` would not be linearly ordered. |
| 21 | +
|
| 22 | +## TODO |
| 23 | +
|
| 24 | +Create the "LinOrdCommGrpWithZero" category. |
| 25 | +
|
| 26 | +-/ |
| 27 | + |
| 28 | +-- TODO: find a better place |
| 29 | +/-- `toLex` as a monoid isomorphism. -/ |
| 30 | +def toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : G × H ≃* G ×ₗ H where |
| 31 | + toFun := toLex |
| 32 | + invFun := ofLex |
| 33 | + left_inv := ofLex_toLex |
| 34 | + right_inv := toLex_ofLex |
| 35 | + map_mul' := toLex_mul |
| 36 | + |
| 37 | +@[simp] |
| 38 | +lemma coe_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : |
| 39 | + ⇑(toLexMulEquiv G H) = toLex := |
| 40 | + rfl |
| 41 | + |
| 42 | +@[simp] |
| 43 | +lemma coe_symm_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : |
| 44 | + ⇑(toLexMulEquiv G H).symm = ofLex := |
| 45 | + rfl |
| 46 | + |
| 47 | +@[simp] |
| 48 | +lemma toEquiv_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : |
| 49 | + ⇑(toLexMulEquiv G H : G × H ≃ G ×ₗ H) = toLex := |
| 50 | + rfl |
| 51 | + |
| 52 | +@[simp] |
| 53 | +lemma toEquiv_symm_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] : |
| 54 | + ⇑((toLexMulEquiv G H).symm : G ×ₗ H ≃ G × H) = ofLex := |
| 55 | + rfl |
| 56 | + |
| 57 | +namespace MonoidWithZeroHom |
| 58 | + |
| 59 | +variable {M₀ N₀ : Type*} |
| 60 | + |
| 61 | +lemma inl_mono [LinearOrderedCommGroupWithZero M₀] [GroupWithZero N₀] [Preorder N₀] |
| 62 | + [DecidablePred fun x : M₀ ↦ x = 0] : Monotone (inl M₀ N₀) := by |
| 63 | + refine (WithZero.map'_mono MonoidHom.inl_mono).comp ?_ |
| 64 | + intro x y |
| 65 | + obtain rfl | ⟨x, rfl⟩ := GroupWithZero.eq_zero_or_unit x <;> |
| 66 | + obtain rfl | ⟨y, rfl⟩ := GroupWithZero.eq_zero_or_unit y <;> |
| 67 | + · simp [WithZero.zero_le, WithZero.withZeroUnitsEquiv] |
| 68 | + |
| 69 | +lemma inl_strictMono [LinearOrderedCommGroupWithZero M₀] [GroupWithZero N₀] [PartialOrder N₀] |
| 70 | + [DecidablePred fun x : M₀ ↦ x = 0] : StrictMono (inl M₀ N₀) := |
| 71 | + inl_mono.strictMono_of_injective inl_injective |
| 72 | + |
| 73 | +lemma inr_mono [GroupWithZero M₀] [Preorder M₀] [LinearOrderedCommGroupWithZero N₀] |
| 74 | + [DecidablePred fun x : N₀ ↦ x = 0] : Monotone (inr M₀ N₀) := by |
| 75 | + refine (WithZero.map'_mono MonoidHom.inr_mono).comp ?_ |
| 76 | + intro x y |
| 77 | + obtain rfl | ⟨x, rfl⟩ := GroupWithZero.eq_zero_or_unit x <;> |
| 78 | + obtain rfl | ⟨y, rfl⟩ := GroupWithZero.eq_zero_or_unit y <;> |
| 79 | + · simp [WithZero.zero_le, WithZero.withZeroUnitsEquiv] |
| 80 | + |
| 81 | +lemma inr_strictMono [GroupWithZero M₀] [PartialOrder M₀] [LinearOrderedCommGroupWithZero N₀] |
| 82 | + [DecidablePred fun x : N₀ ↦ x = 0] : StrictMono (inr M₀ N₀) := |
| 83 | + inr_mono.strictMono_of_injective inr_injective |
| 84 | + |
| 85 | +lemma fst_mono [LinearOrderedCommGroupWithZero M₀] [GroupWithZero N₀] [Preorder N₀] : |
| 86 | + Monotone (fst M₀ N₀) := by |
| 87 | + refine WithZero.forall.mpr ?_ |
| 88 | + simp +contextual [WithZero.forall, Prod.le_def] |
| 89 | + |
| 90 | + |
| 91 | +lemma snd_mono [GroupWithZero M₀] [Preorder M₀] [LinearOrderedCommGroupWithZero N₀] : |
| 92 | + Monotone (snd M₀ N₀) := by |
| 93 | + refine WithZero.forall.mpr ?_ |
| 94 | + simp [WithZero.forall, Prod.le_def] |
| 95 | + |
| 96 | +end MonoidWithZeroHom |
| 97 | + |
| 98 | +namespace LinearOrderedCommGroupWithZero |
| 99 | + |
| 100 | +variable (α β : Type*) [LinearOrderedCommGroupWithZero α] [LinearOrderedCommGroupWithZero β] |
| 101 | + |
| 102 | +open MonoidWithZeroHom |
| 103 | + |
| 104 | +/-- Given linearly ordered groups with zero M, N, the natural inclusion ordered homomorphism from |
| 105 | +M to `WithZero (Mˣ ×ₗ Nˣ)`, which is the linearly ordered group with zero that can be identified |
| 106 | +as their product. -/ |
| 107 | +@[simps!] |
| 108 | +nonrec def inl : α →*₀o WithZero (αˣ ×ₗ βˣ) where |
| 109 | + __ := (WithZero.map' (toLexMulEquiv ..).toMonoidHom).comp (inl α β) |
| 110 | + monotone' := by simpa using (WithZero.map'_mono (Prod.Lex.toLex_mono)).comp inl_mono |
| 111 | + |
| 112 | +/-- Given linearly ordered groups with zero M, N, the natural inclusion ordered homomorphism from |
| 113 | +N to `WithZero (Mˣ ×ₗ Nˣ)`, which is the linearly ordered group with zero that can be identified |
| 114 | +as their product. -/ |
| 115 | +@[simps!] |
| 116 | +nonrec def inr : β →*₀o WithZero (αˣ ×ₗ βˣ) where |
| 117 | + __ := (WithZero.map' (toLexMulEquiv ..).toMonoidHom).comp (inr α β) |
| 118 | + monotone' := by simpa using (WithZero.map'_mono (Prod.Lex.toLex_mono)).comp inr_mono |
| 119 | + |
| 120 | +/-- Given linearly ordered groups with zero M, N, the natural projection ordered homomorphism from |
| 121 | +`WithZero (Mˣ ×ₗ Nˣ)` to M, which is the linearly ordered group with zero that can be identified |
| 122 | +as their product. -/ |
| 123 | +@[simps!] |
| 124 | +nonrec def fst : WithZero (αˣ ×ₗ βˣ) →*₀o α where |
| 125 | + __ := (fst α β).comp (WithZero.map' (toLexMulEquiv ..).symm.toMonoidHom) |
| 126 | + monotone' := by |
| 127 | + -- this can't rely on `Monotone.comp` since `ofLex` is not monotone |
| 128 | + intro x y |
| 129 | + cases x <;> |
| 130 | + cases y |
| 131 | + · simp |
| 132 | + · simp |
| 133 | + · simp [WithZero.zero_lt_coe] |
| 134 | + · simpa using Prod.Lex.monotone_fst _ _ |
| 135 | + |
| 136 | +@[simp] |
| 137 | +theorem fst_comp_inl : (fst _ _).comp (inl α β) = .id α := by |
| 138 | + ext x |
| 139 | + obtain rfl | ⟨_, rfl⟩ := GroupWithZero.eq_zero_or_unit x <;> |
| 140 | + simp |
| 141 | + |
| 142 | +variable {α β} |
| 143 | + |
| 144 | +lemma inl_eq_coe_inlₗ {m : α} (hm : m ≠ 0) : |
| 145 | + inl α β m = OrderMonoidHom.inlₗ αˣ βˣ (Units.mk0 _ hm) := by |
| 146 | + lift m to αˣ using isUnit_iff_ne_zero.mpr hm |
| 147 | + simp |
| 148 | + |
| 149 | +lemma inr_eq_coe_inrₗ {n : β} (hn : n ≠ 0) : |
| 150 | + inr α β n = OrderMonoidHom.inrₗ αˣ βˣ (Units.mk0 _ hn) := by |
| 151 | + lift n to βˣ using isUnit_iff_ne_zero.mpr hn |
| 152 | + simp |
| 153 | + |
| 154 | +theorem inl_mul_inr_eq_coe_toLex {m : α} {n : β} (hm : m ≠ 0) (hn : n ≠ 0) : |
| 155 | + inl α β m * inr α β n = toLex (Units.mk0 _ hm, Units.mk0 _ hn) := by |
| 156 | + rw [inl_eq_coe_inlₗ hm, inr_eq_coe_inrₗ hn, |
| 157 | + ← WithZero.coe_mul, OrderMonoidHom.inlₗ_mul_inrₗ_eq_toLex] |
| 158 | + |
| 159 | +end LinearOrderedCommGroupWithZero |
0 commit comments