Skip to content

Commit

Permalink
Add instances of total orders
Browse files Browse the repository at this point in the history
  • Loading branch information
javierdiaz72 authored and omelkonian committed Nov 15, 2024
1 parent 3b82fcb commit 70a6c7a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Class/HasOrder/Instance.agda
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,25 @@ instance
ℕ-hasPartialOrder = HasPartialOrder ∋ record
{ ≤-antisym = Nat.≤-antisym }
ℕ-hasDecPartialOrder = HasDecPartialOrder {A = ℕ} ∋ record {}
ℕ-hasTotalOrder = HasTotalOrder ∋ record
{ ≤-total = Nat.≤-total }
ℕ-hasDecTotalOrder = HasDecTotalOrder {A = ℕ} ∋ record {}

import Data.Integer.Properties as Int hiding (_≟_)
ℤ-hasPreorder = HasPreorder ∋ record {Int; ≤⇔<∨≈ = let open Int in mk⇔
(λ a≤b case _ ≟ _ of λ where (yes p) inj₂ p ; (no ¬p) inj₁ (≤∧≢⇒< a≤b ¬p))
[ <⇒≤ , ≤-reflexive ] }
ℤ-hasPartialOrder = HasPartialOrder ∋ record { ≤-antisym = Int.≤-antisym }
ℤ-hasDecPartialOrder = HasDecPartialOrder {A = ℤ} ∋ record {}
ℤ-hasTotalOrder = HasTotalOrder ∋ record
{ ≤-total = Int.≤-total }
ℤ-hasDecTotalOrder = HasDecTotalOrder {A = ℤ} ∋ record {}

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

ℚ-hasPreorder = hasPreorderFromNonStrict Rat.≤-isPreorder _≟_
ℚ-hasPartialOrder = HasPartialOrder ∋ record { ≤-antisym = Rat.≤-antisym }
ℚ-hasDecPartialOrder = HasDecPartialOrder {A = ℚ} ∋ record {}
ℚ-hasTotalOrder = HasTotalOrder ∋ record
{ ≤-total = Rat.≤-total }
ℚ-hasDecTotalOrder = HasDecTotalOrder {A = ℚ} ∋ record {}

0 comments on commit 70a6c7a

Please sign in to comment.