Skip to content

Commit

Permalink
Add _≥_ and _>_ to HasPreorder
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatisRT committed Dec 12, 2023
1 parent da49d6e commit 930c2a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Interface/HasOrder.agda
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ module _ {a} {A : Set a} where
module _ {_≈_ : Rel A a} where

record HasPreorder : Set (sucˡ a) where
infix 4 _≤_ _<_
infix 4 _≤_ _<_ _≥_ _>_
field
_≤_ _<_ : Rel A a
≤-isPreorder : IsPreorder _≈_ _≤_
<-irrefl : Irreflexive _≈_ _<_
≤⇔<∨≈ : {x y} x ≤ y ⇔ (x < y ⊎ x ≈ y)

_≥_ = flip _≤_
_>_ = flip _<_

open IsPreorder ≤-isPreorder public
using ()
renaming (isEquivalence to ≈-isEquivalence; refl to ≤-refl; trans to ≤-trans)
Expand Down
10 changes: 10 additions & 0 deletions src/Interface/HasOrder/Instance.agda
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ instance
⊎.[ <⇒≤ , ≤-reflexive ] }
ℤ-hasPartialOrder = HasPartialOrder ∋ record { ≤-antisym = Int.≤-antisym }
ℤ-hasDecPartialOrder = HasDecPartialOrder {A = ℤ} ∋ record {}

open import Data.Rational using (ℚ)
import Data.Rational.Properties as Rat hiding (_≟_)

ℚ-Dec-≤ = ⁇² Rat._≤?_
ℚ-Dec-< = ⁇² Rat._<?_

ℚ-hasPreorder = hasPreorderFromNonStrict Rat.≤-isPreorder _≟_
ℚ-hasPartialOrder = HasPartialOrder ∋ record { ≤-antisym = Rat.≤-antisym }
ℚ-hasDecPartialOrder = HasDecPartialOrder {A = ℚ} ∋ record {}
2 changes: 1 addition & 1 deletion src/Prelude.agda
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ open import Data.Sum public
open import Data.Product public
hiding (assocʳ; assocˡ; map; map₁; map₂; map₂′; swap; _<*>_)
open import Data.Nat public
hiding (_≟_; _≤_; _≤?_; _<_; _<?_; _≤ᵇ_; _≡ᵇ_; less-than-or-equal)
hiding (_≟_; _≤_; _≤?_; _<_; _<?_; _≤ᵇ_; _≡ᵇ_; _≥_; _>_; less-than-or-equal)
renaming (_+_ to _+ℕ_)
open import Data.Integer as ℤ public
using (ℤ; _⊖_)
Expand Down

0 comments on commit 930c2a8

Please sign in to comment.