Skip to content

Commit 494d834

Browse files
committed
feat(Algebra/Order): Add Add/Mul/Linear equiv versions of toLex/ofLex
1 parent cdda99e commit 494d834

File tree

4 files changed

+75
-21
lines changed

4 files changed

+75
-21
lines changed

Mathlib.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ import Mathlib.Algebra.Order.Group.Cyclic
819819
import Mathlib.Algebra.Order.Group.Defs
820820
import Mathlib.Algebra.Order.Group.DenselyOrdered
821821
import Mathlib.Algebra.Order.Group.End
822+
import Mathlib.Algebra.Order.Group.Equiv
822823
import Mathlib.Algebra.Order.Group.Finset
823824
import Mathlib.Algebra.Order.Group.Indicator
824825
import Mathlib.Algebra.Order.Group.InjSurj
@@ -874,6 +875,7 @@ import Mathlib.Algebra.Order.Kleene
874875
import Mathlib.Algebra.Order.Module.Algebra
875876
import Mathlib.Algebra.Order.Module.Basic
876877
import Mathlib.Algebra.Order.Module.Defs
878+
import Mathlib.Algebra.Order.Module.Equiv
877879
import Mathlib.Algebra.Order.Module.Field
878880
import Mathlib.Algebra.Order.Module.OrderedSMul
879881
import Mathlib.Algebra.Order.Module.Pointwise
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/-
2+
Copyright (c) 2025 Weiyi Wang. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Weiyi Wang
5+
-/
6+
import Mathlib.Algebra.Group.Equiv.Defs
7+
import Mathlib.Algebra.Order.Group.Synonym
8+
9+
/-!
10+
# Add/Mul equivalence for order type synonyms
11+
-/
12+
13+
variable (α : Type*)
14+
15+
/-- `toLex` as a `MulEquiv`. -/
16+
@[to_additive "`toLex` as a `AddEquiv`."]
17+
def toLexMulEquiv [Mul α] : α ≃* Lex α where
18+
__ := toLex
19+
map_mul' _ _ := by simp
20+
21+
@[to_additive (attr := simp)]
22+
theorem coe_toLexMulEquiv [Mul α] : ⇑(toLexMulEquiv α) = toLex := rfl
23+
24+
@[to_additive (attr := simp)]
25+
theorem coe_symm_toLexMulEquiv [Mul α] : ⇑(toLexMulEquiv α).symm = ofLex := rfl
26+
27+
/-- `ofLex` as a `MulEquiv`. -/
28+
@[to_additive "`ofLex` as a `AddEquiv`."]
29+
def ofLexMulEquiv [Mul α] : Lex α ≃* α where
30+
__ := ofLex
31+
map_mul' _ _ := by simp
32+
33+
@[to_additive (attr := simp)]
34+
theorem coe_ofLexMulEquiv [Mul α] : ⇑(ofLexMulEquiv α) = ofLex := rfl
35+
36+
@[to_additive (attr := simp)]
37+
theorem coe_symm_ofLexMulEquiv [Mul α] : ⇑(ofLexMulEquiv α).symm = toLex := rfl

Mathlib/Algebra/Order/GroupWithZero/Lex.lean

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yakov Pechersky
55
-/
66
import Mathlib.Algebra.GroupWithZero.ProdHom
7+
import Mathlib.Algebra.Order.Group.Equiv
78
import Mathlib.Algebra.Order.Hom.MonoidWithZero
89
import Mathlib.Algebra.Order.Monoid.Lex
910
import Mathlib.Data.Prod.Lex
@@ -25,33 +26,14 @@ Create the "LinOrdCommGrpWithZero" category.
2526
2627
-/
2728

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-
4729
@[simp]
4830
lemma toEquiv_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] :
49-
⇑(toLexMulEquiv G H : G × H ≃ G ×ₗ H) = toLex :=
31+
⇑(toLexMulEquiv (G × H) : G × H ≃ G ×ₗ H) = toLex :=
5032
rfl
5133

5234
@[simp]
5335
lemma toEquiv_symm_toLexMulEquiv (G H : Type*) [MulOneClass G] [MulOneClass H] :
54-
⇑((toLexMulEquiv G H).symm : G ×ₗ H ≃ G × H) = ofLex :=
36+
⇑((toLexMulEquiv (G × H)).symm : G ×ₗ H ≃ G × H) = ofLex :=
5537
rfl
5638

5739
namespace MonoidWithZeroHom
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/-
2+
Copyright (c) 2025 Weiyi Wang. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Weiyi Wang
5+
-/
6+
import Mathlib.Algebra.Module.Equiv.Basic
7+
import Mathlib.Algebra.Order.Group.Equiv
8+
import Mathlib.Algebra.Order.Module.Synonym
9+
10+
/-!
11+
# Linear equivalence for order type synonyms
12+
-/
13+
14+
variable (α β : Type*)
15+
variable [Semiring α] [AddCommMonoid β] [Module α β]
16+
17+
/-- `toLex` as a linear equivalence -/
18+
def toLexLinearEquiv : β ≃ₗ[α] Lex β := (toLexAddEquiv β).toLinearEquiv toLex_smul
19+
20+
@[simp]
21+
theorem coe_toLexLinearEquiv : ⇑(toLexLinearEquiv α β) = toLex := rfl
22+
23+
@[simp]
24+
theorem coe_symm_toLexLinearEquiv : ⇑(toLexLinearEquiv α β).symm = ofLex := rfl
25+
26+
/-- `ofLex` as a linear equivalence -/
27+
def ofLexLinearEquiv : Lex β ≃ₗ[α] β := (ofLexAddEquiv β).toLinearEquiv ofLex_smul
28+
29+
@[simp]
30+
theorem coe_ofLexLinearEquiv : ⇑(ofLexLinearEquiv α β) = ofLex := rfl
31+
32+
@[simp]
33+
theorem coe_symm_ofLexLinearEquiv : ⇑(ofLexLinearEquiv α β).symm = toLex := rfl

0 commit comments

Comments
 (0)