Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _≥_ and _>_ to HasPreorder and instance #326

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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._<?_
omelkonian marked this conversation as resolved.
Show resolved Hide resolved

ℚ-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