@@ -85,20 +85,53 @@ module _ {a} {A : Set a} where
85
85
<⇒¬>⊎≈ x<y (inj₁ y<x) = <-asymmetric x<y y<x
86
86
<⇒¬>⊎≈ x<y (inj₂ x≈y) = <-irrefl (≈-sym x≈y) x<y
87
87
88
+ ≥⇒≮ : ∀ {x y} → y ≤ x → ¬ (x < y)
89
+ ≥⇒≮ y≤x x<y = contradiction (to ≤⇔<∨≈ y≤x) (<⇒¬>⊎≈ x<y)
90
+
91
+ open HasPartialOrder ⦃...⦄
92
+
88
93
record HasDecPartialOrder : Set (suc a) where
89
94
field
90
95
⦃ hasPartialOrder ⦄ : HasPartialOrder
91
96
⦃ dec-≤ ⦄ : _≤_ ⁇²
92
97
⦃ dec-< ⦄ : _<_ ⁇²
93
98
99
+ record HasTotalOrder : Set (suc a) where
100
+ field
101
+ ⦃ hasPartialOrder ⦄ : HasPartialOrder
102
+ ≤-total : Total _≤_
103
+
104
+ ≤-isTotalOrder : IsTotalOrder _≈_ _≤_
105
+ ≤-isTotalOrder = record { isPartialOrder = ≤-isPartialOrder ; total = ≤-total }
106
+
107
+ open IsEquivalence ≈-isEquivalence renaming (sym to ≈-sym)
108
+
109
+ ≮⇒≥ : Decidable _≈_ → ∀ {x y} → ¬ (x < y) → y ≤ x
110
+ ≮⇒≥ _≈?_ {x} {y} x≮y with x ≈? y | ≤-total y x
111
+ ... | yes x≈y | _ = IsPreorder.reflexive ≤-isPreorder (≈-sym x≈y)
112
+ ... | _ | inj₁ y≤x = y≤x
113
+ ... | no x≉y | inj₂ x≤y = contradiction (≤∧≉⇒< (x≤y , x≉y)) x≮y
114
+
115
+ open HasTotalOrder ⦃...⦄
116
+
117
+ record HasDecTotalOrder : Set (suc a) where
118
+ field
119
+ ⦃ hasTotalOrder ⦄ : HasTotalOrder
120
+ ⦃ dec-≤ ⦄ : _≤_ ⁇²
121
+ ⦃ dec-< ⦄ : _<_ ⁇²
122
+
94
123
HasPreorder≡ = HasPreorder {_≈_ = _≡_}
95
124
HasDecPreorder≡ = HasDecPreorder {_≈_ = _≡_}
96
125
HasPartialOrder≡ = HasPartialOrder {_≈_ = _≡_}
97
126
HasDecPartialOrder≡ = HasDecPartialOrder {_≈_ = _≡_}
127
+ HasTotalOrder≡ = HasTotalOrder {_≈_ = _≡_}
128
+ HasDecTotalOrder≡ = HasDecTotalOrder {_≈_ = _≡_}
98
129
99
130
open HasPreorder ⦃...⦄ public
100
131
open HasPartialOrder ⦃...⦄ public hiding (hasPreorder)
101
132
open HasDecPartialOrder ⦃...⦄ public hiding (hasPartialOrder)
133
+ open HasTotalOrder ⦃...⦄ public hiding (hasPartialOrder)
134
+ open HasDecTotalOrder ⦃...⦄ public hiding (hasTotalOrder)
102
135
103
136
module _ {a} {A : Set a} {_≈_ : Rel A a} where
104
137
0 commit comments