@@ -49,20 +49,24 @@ theorem lex_eq_invImage_dfinsupp_lex (r : α → α → Prop) (s : N → N → P
4949instance [LT α] [LT N] : LT (Lex (α →₀ N)) :=
5050 ⟨fun f g ↦ Finsupp.Lex (· < ·) (· < ·) (ofLex f) (ofLex g)⟩
5151
52+ instance [LT α] [LT N] : LT (Colex (α →₀ N)) :=
53+ ⟨fun f g ↦ Finsupp.Lex (· > ·) (· < ·) (ofColex f) (ofColex g)⟩
54+
5255theorem Lex.lt_iff [LT α] [LT N] {a b : Lex (α →₀ N)} :
5356 a < b ↔ ∃ i, (∀ j, j < i → a j = b j) ∧ a i < b i :=
5457 .rfl
5558
5659@[deprecated (since := "2025-11-29")]
5760alias lex_lt_iff := Lex.lt_iff
5861
59- theorem Lex.lt_of_lt_of_preorder [Preorder N] (r) [IsStrictOrder α r] {x y : α →₀ N} (hlt : x < y) :
62+ theorem Colex.lt_iff [LT α] [LT N] {a b : Colex (α →₀ N)} :
63+ a < b ↔ ∃ i, (∀ j, i < j → a j = b j) ∧ a i < b i :=
64+ .rfl
65+
66+ theorem lex_lt_of_lt_of_preorder [Preorder N] (r) [IsStrictOrder α r] {x y : α →₀ N} (hlt : x < y) :
6067 ∃ i, (∀ j, r j i → x j ≤ y j ∧ y j ≤ x j) ∧ x i < y i :=
6168 DFinsupp.lex_lt_of_lt_of_preorder r (id hlt : x.toDFinsupp < y.toDFinsupp)
6269
63- @[deprecated (since := "2025-11-29")]
64- alias lex_lt_of_lt_of_preorder := Lex.lt_of_lt_of_preorder
65-
6670theorem lex_lt_of_lt [PartialOrder N] (r) [IsStrictOrder α r] {x y : α →₀ N} (hlt : x < y) :
6771 Pi.Lex r (· < ·) x y :=
6872 DFinsupp.lex_lt_of_lt r (id hlt : x.toDFinsupp < y.toDFinsupp)
@@ -78,12 +82,18 @@ theorem Lex.lt_iff_of_unique [Unique α] [LT N] [Preorder α] {x y : Lex (α →
7882@[deprecated (since := "2025-11-29")]
7983alias lex_lt_iff_of_unique := Lex.lt_iff_of_unique
8084
81- instance Lex.isStrictOrder [LinearOrder α] [PartialOrder N] :
82- IsStrictOrder (Lex (α →₀ N)) (· < ·) where
85+ theorem Colex.lt_iff_of_unique [Unique α] [LT N] [Preorder α] {x y : Colex (α →₀ N)} :
86+ x < y ↔ x default < y default :=
87+ Lex.lt_iff_of_unique (α := αᵒᵈ)
88+
89+ variable [LinearOrder α]
90+
91+ instance Lex.isStrictOrder [PartialOrder N] : IsStrictOrder (Lex (α →₀ N)) (· < ·) where
8392 irrefl _ := lt_irrefl (α := Lex (α → N)) _
8493 trans _ _ _ := lt_trans (α := Lex (α → N))
8594
86- variable [LinearOrder α]
95+ instance Colex.isStrictOrder [PartialOrder N] : IsStrictOrder (Colex (α →₀ N)) (· < ·) :=
96+ Lex.isStrictOrder (α := αᵒᵈ)
8797
8898/-- The partial order on `Finsupp`s obtained by the lexicographic ordering.
8999See `Finsupp.Lex.linearOrder` for a proof that this partial order is in fact linear. -/
@@ -93,18 +103,36 @@ instance Lex.partialOrder [PartialOrder N] : PartialOrder (Lex (α →₀ N)) wh
93103 __ := PartialOrder.lift (fun x : Lex (α →₀ N) ↦ toLex (⇑(ofLex x)))
94104 (DFunLike.coe_injective (F := Finsupp α N))
95105
106+ /-- The partial order on `Finsupp`s obtained by the colexicographic ordering.
107+ See `Finsupp.Colex.linearOrder` for a proof that this partial order is in fact linear. -/
108+ instance Colex.partialOrder [PartialOrder N] : PartialOrder (Colex (α →₀ N)) where
109+ lt := (· < ·)
110+ le x y := ⇑(ofColex x) = ⇑(ofColex y) ∨ x < y
111+ __ := PartialOrder.lift (fun x : Colex (α →₀ N) ↦ toColex (⇑(ofColex x)))
112+ (DFunLike.coe_injective (F := Finsupp α N))
113+
96114/-- The linear order on `Finsupp`s obtained by the lexicographic ordering. -/
97115instance Lex.linearOrder [LinearOrder N] : LinearOrder (Lex (α →₀ N)) where
98116 __ := Lex.partialOrder
99117 __ := LinearOrder.lift' (toLex ∘ toDFinsupp ∘ ofLex) finsuppEquivDFinsupp.injective
100118
119+ /-- The linear order on `Finsupp`s obtained by the colexicographic ordering. -/
120+ instance Colex.linearOrder [LinearOrder N] : LinearOrder (Colex (α →₀ N)) where
121+ lt := (· < ·)
122+ le := (· ≤ ·)
123+ __ := LinearOrder.lift' (toColex ∘ toDFinsupp ∘ ofColex) finsuppEquivDFinsupp.injective
124+
101125theorem Lex.le_iff_of_unique [Unique α] [PartialOrder N] {x y : Lex (α →₀ N)} :
102126 x ≤ y ↔ x default ≤ y default :=
103127 Pi.lex_le_iff_of_unique
104128
105129@[deprecated (since := "2025-11-29")]
106130alias lex_le_iff_of_unique := Lex.le_iff_of_unique
107131
132+ theorem Colex.le_iff_of_unique [Unique α] [PartialOrder N] {x y : Colex (α →₀ N)} :
133+ x ≤ y ↔ x default ≤ y default :=
134+ Lex.le_iff_of_unique (α := αᵒᵈ)
135+
108136theorem Lex.single_strictAnti : StrictAnti fun (a : α) ↦ toLex (single a 1 ) := by
109137 intro a b h
110138 simp only [LT.lt, Finsupp.lex_def]
@@ -115,12 +143,22 @@ theorem Lex.single_strictAnti : StrictAnti fun (a : α) ↦ toLex (single a 1) :
115143 simp only [Finsupp.single_eq_of_ne hd.ne, Finsupp.single_eq_of_ne (hd.trans h).ne]
116144 · simp [h.ne']
117145
146+ theorem Colex.single_strictMono : StrictMono fun (a : α) ↦ toColex (single a 1 ) :=
147+ fun _ _ h ↦ Lex.single_strictAnti (α := αᵒᵈ) h
148+
118149theorem Lex.single_lt_iff {a b : α} : toLex (single b 1 ) < toLex (single a 1 ) ↔ a < b :=
119150 Lex.single_strictAnti.lt_iff_gt
120151
152+ theorem Colex.single_lt_iff {a b : α} : toColex (single a 1 ) < toColex (single b 1 ) ↔ a < b :=
153+ Colex.single_strictMono.lt_iff_lt
154+
121155theorem Lex.single_le_iff {a b : α} : toLex (single b 1 ) ≤ toLex (single a 1 ) ↔ a ≤ b :=
122156 Lex.single_strictAnti.le_iff_ge
123157
158+ theorem Colex.single_le_iff {a b : α} : toColex (single a 1 ) ≤ toColex (single b 1 ) ↔ a ≤ b :=
159+ Colex.single_strictMono.le_iff_le
160+
161+ @[deprecated Lex.single_strictAnti (since := "2025-10-28")]
124162theorem Lex.single_antitone : Antitone fun (a : α) ↦ toLex (single a 1 ) :=
125163 Lex.single_strictAnti.antitone
126164
@@ -129,6 +167,9 @@ variable [PartialOrder N]
129167theorem toLex_monotone : Monotone (@toLex (α →₀ N)) :=
130168 fun a b h ↦ DFinsupp.toLex_monotone (id h : ∀ i, (toDFinsupp a) i ≤ (toDFinsupp b) i)
131169
170+ theorem toColex_monotone : Monotone (@toColex (α →₀ N)) :=
171+ toLex_monotone (α := αᵒᵈ)
172+
132173@[deprecated Lex.lt_iff (since := "2025-10-12")]
133174theorem lt_of_forall_lt_of_lt (a b : Lex (α →₀ N)) (i : α) :
134175 (∀ j < i, ofLex a j = ofLex b j) → ofLex a i < ofLex b i → a < b :=
@@ -155,9 +196,15 @@ variable [AddLeftStrictMono N]
155196instance Lex.addLeftStrictMono : AddLeftStrictMono (Lex (α →₀ N)) :=
156197 ⟨fun _ _ _ ⟨a, lta, ha⟩ ↦ ⟨a, fun j ja ↦ congr_arg _ (lta j ja), add_lt_add_right ha _⟩⟩
157198
199+ instance Colex.addLeftStrictMono : AddLeftStrictMono (Colex (α →₀ N)) :=
200+ Lex.addLeftStrictMono (α := αᵒᵈ)
201+
158202instance Lex.addLeftMono : AddLeftMono (Lex (α →₀ N)) :=
159203 addLeftMono_of_addLeftStrictMono _
160204
205+ instance Colex.addLeftMono : AddLeftMono (Colex (α →₀ N)) :=
206+ addLeftMono_of_addLeftStrictMono _
207+
161208end Left
162209
163210section Right
@@ -167,9 +214,15 @@ variable [AddRightStrictMono N]
167214instance Lex.addRightStrictMono : AddRightStrictMono (Lex (α →₀ N)) :=
168215 ⟨fun f _ _ ⟨a, lta, ha⟩ ↦ ⟨a, fun j ja ↦ congr($(lta j ja) + f j), add_lt_add_left ha _⟩⟩
169216
217+ instance Colex.addRightStrictMono : AddRightStrictMono (Colex (α →₀ N)) :=
218+ Lex.addRightStrictMono (α := αᵒᵈ)
219+
170220instance Lex.addRightMono : AddRightMono (Lex (α →₀ N)) :=
171221 addRightMono_of_addRightStrictMono _
172222
223+ instance Colex.addRightMono : AddRightMono (Colex (α →₀ N)) :=
224+ addRightMono_of_addRightStrictMono _
225+
173226end Right
174227
175228end Covariants
@@ -183,12 +236,22 @@ instance Lex.orderBot [AddCommMonoid N] [PartialOrder N] [CanonicallyOrderedAdd
183236 bot := 0
184237 bot_le _ := Finsupp.toLex_monotone bot_le
185238
239+ instance Colex.orderBot [AddCommMonoid N] [PartialOrder N] [CanonicallyOrderedAdd N] :
240+ OrderBot (Colex (α →₀ N)) where
241+ bot := 0
242+ bot_le _ := Finsupp.toColex_monotone bot_le
243+
186244instance Lex.isOrderedCancelAddMonoid
187245 [AddCommMonoid N] [PartialOrder N] [IsOrderedCancelAddMonoid N] :
188246 IsOrderedCancelAddMonoid (Lex (α →₀ N)) where
189247 add_le_add_left _ _ h _ := add_le_add_left (α := Lex (α → N)) h _
190248 le_of_add_le_add_left _ _ _ := le_of_add_le_add_left (α := Lex (α → N))
191249
250+ instance Colex.isOrderedCancelAddMonoid
251+ [AddCommMonoid N] [PartialOrder N] [IsOrderedCancelAddMonoid N] :
252+ IsOrderedCancelAddMonoid (Colex (α →₀ N)) :=
253+ Lex.isOrderedCancelAddMonoid (α := αᵒᵈ)
254+
192255end OrderedAddMonoid
193256
194257end Finsupp
0 commit comments