@@ -63,20 +63,22 @@ theorem lex_lt_of_lt [∀ i, PartialOrder (α i)] (r) [IsStrictOrder ι r] {x y
6363 exact lex_lt_of_lt_of_preorder r hlt
6464#align dfinsupp.lex_lt_of_lt DFinsupp.lex_lt_of_lt
6565
66- instance Lex.isStrictOrder [LinearOrder ι] [∀ i, PartialOrder (α i)] :
66+ variable [LinearOrder ι]
67+
68+ instance Lex.isStrictOrder [∀ i, PartialOrder (α i)] :
6769 IsStrictOrder (Lex (Π₀ i, α i)) (· < ·) :=
6870 let i : IsStrictOrder (Lex (∀ i, α i)) (· < ·) := Pi.Lex.isStrictOrder
6971 { irrefl := toLex.surjective.forall.2 fun _ ↦ @irrefl _ _ i.toIsIrrefl _
7072 trans := toLex.surjective.forall₃.2 fun _ _ _ ↦ @trans _ _ i.toIsTrans _ _ _ }
7173#align dfinsupp.lex.is_strict_order DFinsupp.Lex.isStrictOrder
7274
73- variable [LinearOrder ι]
74-
7575/-- The partial order on `DFinsupp`s obtained by the lexicographic ordering.
7676See `DFinsupp.Lex.linearOrder` for a proof that this partial order is in fact linear. -/
77- instance Lex.partialOrder [∀ i, PartialOrder (α i)] : PartialOrder (Lex (Π₀ i, α i)) :=
78- PartialOrder.lift (fun x ↦ toLex (⇑(ofLex x)))
79- (FunLike.coe_injective (F := DFinsupp fun i => α i))
77+ instance Lex.partialOrder [∀ i, PartialOrder (α i)] : PartialOrder (Lex (Π₀ i, α i)) where
78+ lt := (· < ·)
79+ le x y := ⇑(ofLex x) = ⇑(ofLex y) ∨ x < y
80+ __ := PartialOrder.lift (fun x : Lex (Π₀ i, α i) ↦ toLex (⇑(ofLex x)))
81+ (FunLike.coe_injective (F := DFinsupp α))
8082#align dfinsupp.lex.partial_order DFinsupp.Lex.partialOrder
8183
8284section LinearOrder
@@ -100,7 +102,7 @@ private def lt_trichotomy_rec {P : Lex (Π₀ i, α i) → Lex (Π₀ i, α i)
100102/-- The less-or-equal relation for the lexicographic ordering is decidable. -/
101103irreducible_def Lex.decidableLE : @DecidableRel (Lex (Π₀ i, α i)) (· ≤ ·) :=
102104 lt_trichotomy_rec (fun h ↦ isTrue <| Or.inr h)
103- (fun h ↦ isTrue <| Or.inl <| congr_arg _ <| congr_arg _ h)
105+ (fun h ↦ isTrue <| Or.inl <| congr_arg _ h)
104106 fun h ↦ isFalse fun h' ↦ lt_irrefl _ (h.trans_le h')
105107#align dfinsupp.lex.decidable_le DFinsupp.Lex.decidableLE
106108
@@ -111,16 +113,16 @@ irreducible_def Lex.decidableLT : @DecidableRel (Lex (Π₀ i, α i)) (· < ·)
111113
112114-- Porting note: Added `DecidableEq` for `LinearOrder`.
113115instance : DecidableEq (Lex (Π₀ i, α i)) :=
114- lt_trichotomy_rec (fun h ↦ isFalse fun h' => h'.not_lt h) ( fun h ↦ isTrue h)
115- fun h ↦ isFalse fun h' => h'.symm.not_lt h
116+ lt_trichotomy_rec (fun h ↦ isFalse fun h' ↦ h'.not_lt h) isTrue
117+ fun h ↦ isFalse fun h' ↦ h'.symm.not_lt h
116118
117119/-- The linear order on `DFinsupp`s obtained by the lexicographic ordering. -/
118- instance Lex.linearOrder : LinearOrder (Lex (Π₀ i, α i)) :=
119- { Lex.partialOrder with
120- le_total := lt_trichotomy_rec (fun h ↦ Or.inl h.le) (fun h ↦ Or.inl h.le) fun h ↦ Or.inr h.le
121- decidableLT := decidableLT
122- decidableLE := decidableLE
123- decidableEq := inferInstance }
120+ instance Lex.linearOrder : LinearOrder (Lex (Π₀ i, α i)) where
121+ __ := Lex.partialOrder
122+ le_total := lt_trichotomy_rec (fun h ↦ Or.inl h.le) (fun h ↦ Or.inl h.le) fun h ↦ Or.inr h.le
123+ decidableLT := decidableLT
124+ decidableLE := decidableLE
125+ decidableEq := inferInstance
124126#align dfinsupp.lex.linear_order DFinsupp.Lex.linearOrder
125127
126128end LinearOrder
@@ -208,12 +210,12 @@ instance Lex.orderedAddCommGroup [∀ i, OrderedAddCommGroup (α i)] :
208210instance Lex.linearOrderedCancelAddCommMonoid
209211 [∀ i, LinearOrderedCancelAddCommMonoid (α i)] :
210212 LinearOrderedCancelAddCommMonoid (Lex (Π₀ i, α i)) where
211- __ := (inferInstance : LinearOrder (Lex (Π₀ i, α i)))
212- __ := (inferInstance : OrderedCancelAddCommMonoid (Lex (Π₀ i, α i)))
213+ __ : LinearOrder (Lex (Π₀ i, α i)) := inferInstance
214+ __ : OrderedCancelAddCommMonoid (Lex (Π₀ i, α i)) := inferInstance
213215
214216instance Lex.linearOrderedAddCommGroup [∀ i, LinearOrderedAddCommGroup (α i)] :
215217 LinearOrderedAddCommGroup (Lex (Π₀ i, α i)) where
216- __ := (inferInstance : LinearOrder (Lex (Π₀ i, α i)))
218+ __ : LinearOrder (Lex (Π₀ i, α i)) := inferInstance
217219 add_le_add_left _ _ := add_le_add_left
218220
219221end OrderedAddMonoid
0 commit comments