| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties satisfied by decidable total orders |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Relation.Binary.Bundles using (DecTotalOrder; StrictTotalOrder) |
| 10 |
|
| 11 |
module Relation.Binary.Properties.DecTotalOrder |
| 12 |
{d₁ d₂ d₃} (DTO : DecTotalOrder d₁ d₂ d₃) where |
| 13 |
|
| 14 |
import Relation.Binary.Construct.Flip.EqAndOrd as EqAndOrd |
| 15 |
using (isDecTotalOrder) |
| 16 |
open import Relation.Binary.Structures |
| 17 |
using (IsDecTotalOrder; IsStrictTotalOrder) |
| 18 |
open import Relation.Nullary.Negation.Core using (¬_) |
| 19 |
|
| 20 |
open DecTotalOrder DTO hiding (trans) |
| 21 |
|
| 22 |
import Relation.Binary.Properties.TotalOrder totalOrder as TotalOrderProperties |
| 23 |
import Relation.Binary.Construct.NonStrictToStrict _≈_ _≤_ as ToStrict |
| 24 |
|
| 25 |
------------------------------------------------------------------------ |
| 26 |
-- _≥_ - the flipped relation is also a total order |
| 27 |
|
| 28 |
open TotalOrderProperties public |
| 29 |
using |
| 30 |
( ≥-refl |
| 31 |
; ≥-reflexive |
| 32 |
; ≥-trans |
| 33 |
; ≥-antisym |
| 34 |
; ≥-total |
| 35 |
; ≥-isPreorder |
| 36 |
; ≥-isPartialOrder |
| 37 |
; ≥-isTotalOrder |
| 38 |
; ≥-preorder |
| 39 |
; ≥-poset |
| 40 |
; ≥-totalOrder |
| 41 |
) |
| 42 |
|
| 43 |
≥-isDecTotalOrder : IsDecTotalOrder _≈_ _≥_ |
| 44 |
≥-isDecTotalOrder = EqAndOrd.isDecTotalOrder isDecTotalOrder |
| 45 |
|
| 46 |
≥-decTotalOrder : DecTotalOrder _ _ _ |
| 47 |
≥-decTotalOrder = record |
| 48 |
{ isDecTotalOrder = ≥-isDecTotalOrder |
| 49 |
} |
| 50 |
|
| 51 |
open DecTotalOrder ≥-decTotalOrder public |
| 52 |
using () renaming (_≤?_ to _≥?_) |
| 53 |
|
| 54 |
------------------------------------------------------------------------ |
| 55 |
-- _<_ - the strict version is a strict total order |
| 56 |
|
| 57 |
open TotalOrderProperties public |
| 58 |
using |
| 59 |
( _<_ |
| 60 |
; <-resp-≈ |
| 61 |
; <-respʳ-≈ |
| 62 |
; <-respˡ-≈ |
| 63 |
; <-irrefl |
| 64 |
; <-asym |
| 65 |
; <-trans |
| 66 |
; <-isStrictPartialOrder |
| 67 |
; <-strictPartialOrder |
| 68 |
; <⇒≉ |
| 69 |
; ≤∧≉⇒< |
| 70 |
; <⇒≱ |
| 71 |
; ≤⇒≯ |
| 72 |
) |
| 73 |
|
| 74 |
<-isStrictTotalOrder : IsStrictTotalOrder _≈_ _<_ |
| 75 |
<-isStrictTotalOrder = ToStrict.<-isStrictTotalOrder₂ isDecTotalOrder |
| 76 |
|
| 77 |
<-strictTotalOrder : StrictTotalOrder _ _ _ |
| 78 |
<-strictTotalOrder = record |
| 79 |
{ isStrictTotalOrder = <-isStrictTotalOrder |
| 80 |
} |
| 81 |
|
| 82 |
open StrictTotalOrder <-strictTotalOrder public |
| 83 |
using (_≮_) renaming (compare to <-compare) |
| 84 |
|
| 85 |
------------------------------------------------------------------------ |
| 86 |
-- _≰_ - the negated order |
| 87 |
|
| 88 |
open TotalOrderProperties public |
| 89 |
using |
| 90 |
( ≰-respʳ-≈ |
| 91 |
; ≰-respˡ-≈ |
| 92 |
; ≰⇒> |
| 93 |
; ≰⇒≥ |
| 94 |
) |
| 95 |
|
| 96 |
≮⇒≥ : ∀ {x y} → x ≮ y → y ≤ x |
| 97 |
≮⇒≥ = ToStrict.≮⇒≥ Eq.sym _≟_ reflexive total |
| 98 |
|