| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- The lifting of a strict order to incorporate new extrema |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
-- This module is designed to be used with |
| 10 |
-- Relation.Nullary.Construct.Add.Extrema |
| 11 |
|
| 12 |
open import Relation.Binary.Core using (Rel) |
| 13 |
|
| 14 |
module Relation.Binary.Construct.Add.Extrema.Strict |
| 15 |
{a ℓ} {A : Set a} (_<_ : Rel A ℓ) where |
| 16 |
|
| 17 |
open import Level |
| 18 |
open import Function.Base using (_∘′_) |
| 19 |
import Relation.Nullary.Construct.Add.Infimum as I using (⊥₋; [_]) |
| 20 |
open import Relation.Nullary.Construct.Add.Extrema using (⊥±; ⊤±; [_]) |
| 21 |
open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl) |
| 22 |
import Relation.Binary.Construct.Add.Infimum.Strict as AddInfimum |
| 23 |
import Relation.Binary.Construct.Add.Supremum.Strict as AddSupremum |
| 24 |
import Relation.Binary.Construct.Add.Extrema.Equality as Equality |
| 25 |
import Relation.Binary.Construct.Add.Extrema.NonStrict as NonStrict |
| 26 |
open import Relation.Binary.Definitions |
| 27 |
using (Asymmetric; Transitive; Decidable; Irrelevant; Trichotomous |
| 28 |
; Irreflexive; Trans; _Respectsˡ_; _Respectsʳ_; _Respects₂_) |
| 29 |
open import Relation.Binary.Structures |
| 30 |
using (IsStrictPartialOrder; IsDecStrictPartialOrder; IsStrictTotalOrder) |
| 31 |
|
| 32 |
------------------------------------------------------------------------ |
| 33 |
-- Definition |
| 34 |
|
| 35 |
private |
| 36 |
module Inf = AddInfimum _<_ |
| 37 |
module Sup = AddSupremum Inf._<₋_ |
| 38 |
|
| 39 |
open Sup using () renaming (_<⁺_ to _<±_) public |
| 40 |
|
| 41 |
------------------------------------------------------------------------ |
| 42 |
-- Useful pattern synonyms |
| 43 |
|
| 44 |
pattern ⊥±<[_] l = Sup.[ Inf.⊥₋<[ l ] ] |
| 45 |
pattern [_] p = Sup.[ Inf.[ p ] ] |
| 46 |
pattern ⊥±<⊤± = Sup.[ I.⊥₋ ]<⊤⁺ |
| 47 |
pattern [_]<⊤± k = Sup.[ I.[ k ] ]<⊤⁺ |
| 48 |
|
| 49 |
------------------------------------------------------------------------ |
| 50 |
-- Relational properties |
| 51 |
|
| 52 |
[<]-injective : ∀ {k l} → [ k ] <± [ l ] → k < l |
| 53 |
[<]-injective = Inf.[<]-injective ∘′ Sup.[<]-injective |
| 54 |
|
| 55 |
<±-asym : Asymmetric _<_ → Asymmetric _<±_ |
| 56 |
<±-asym = Sup.<⁺-asym ∘′ Inf.<₋-asym |
| 57 |
|
| 58 |
<±-trans : Transitive _<_ → Transitive _<±_ |
| 59 |
<±-trans = Sup.<⁺-trans ∘′ Inf.<₋-trans |
| 60 |
|
| 61 |
<±-dec : Decidable _<_ → Decidable _<±_ |
| 62 |
<±-dec = Sup.<⁺-dec ∘′ Inf.<₋-dec |
| 63 |
|
| 64 |
<±-irrelevant : Irrelevant _<_ → Irrelevant _<±_ |
| 65 |
<±-irrelevant = Sup.<⁺-irrelevant ∘′ Inf.<₋-irrelevant |
| 66 |
|
| 67 |
module _ {r} {_≤_ : Rel A r} where |
| 68 |
|
| 69 |
open NonStrict _≤_ |
| 70 |
|
| 71 |
<±-transʳ : Trans _≤_ _<_ _<_ → Trans _≤±_ _<±_ _<±_ |
| 72 |
<±-transʳ = Sup.<⁺-transʳ ∘′ Inf.<₋-transʳ |
| 73 |
|
| 74 |
<±-transˡ : Trans _<_ _≤_ _<_ → Trans _<±_ _≤±_ _<±_ |
| 75 |
<±-transˡ = Sup.<⁺-transˡ ∘′ Inf.<₋-transˡ |
| 76 |
|
| 77 |
------------------------------------------------------------------------ |
| 78 |
-- Relational properties + propositional equality |
| 79 |
|
| 80 |
<±-cmp-≡ : Trichotomous _≡_ _<_ → Trichotomous _≡_ _<±_ |
| 81 |
<±-cmp-≡ = Sup.<⁺-cmp-≡ ∘′ Inf.<₋-cmp-≡ |
| 82 |
|
| 83 |
<±-irrefl-≡ : Irreflexive _≡_ _<_ → Irreflexive _≡_ _<±_ |
| 84 |
<±-irrefl-≡ = Sup.<⁺-irrefl-≡ ∘′ Inf.<₋-irrefl-≡ |
| 85 |
|
| 86 |
<±-respˡ-≡ : _<±_ Respectsˡ _≡_ |
| 87 |
<±-respˡ-≡ = Sup.<⁺-respˡ-≡ |
| 88 |
|
| 89 |
<±-respʳ-≡ : _<±_ Respectsʳ _≡_ |
| 90 |
<±-respʳ-≡ = Sup.<⁺-respʳ-≡ |
| 91 |
|
| 92 |
<±-resp-≡ : _<±_ Respects₂ _≡_ |
| 93 |
<±-resp-≡ = Sup.<⁺-resp-≡ |
| 94 |
|
| 95 |
------------------------------------------------------------------------ |
| 96 |
-- Relational properties + setoid equality |
| 97 |
|
| 98 |
module _ {e} {_≈_ : Rel A e} where |
| 99 |
|
| 100 |
open Equality _≈_ |
| 101 |
|
| 102 |
<±-cmp : Trichotomous _≈_ _<_ → Trichotomous _≈±_ _<±_ |
| 103 |
<±-cmp = Sup.<⁺-cmp ∘′ Inf.<₋-cmp |
| 104 |
|
| 105 |
<±-irrefl : Irreflexive _≈_ _<_ → Irreflexive _≈±_ _<±_ |
| 106 |
<±-irrefl = Sup.<⁺-irrefl ∘′ Inf.<₋-irrefl |
| 107 |
|
| 108 |
<±-respˡ-≈± : _<_ Respectsˡ _≈_ → _<±_ Respectsˡ _≈±_ |
| 109 |
<±-respˡ-≈± = Sup.<⁺-respˡ-≈⁺ ∘′ Inf.<₋-respˡ-≈₋ |
| 110 |
|
| 111 |
<±-respʳ-≈± : _<_ Respectsʳ _≈_ → _<±_ Respectsʳ _≈±_ |
| 112 |
<±-respʳ-≈± = Sup.<⁺-respʳ-≈⁺ ∘′ Inf.<₋-respʳ-≈₋ |
| 113 |
|
| 114 |
<±-resp-≈± : _<_ Respects₂ _≈_ → _<±_ Respects₂ _≈±_ |
| 115 |
<±-resp-≈± = Sup.<⁺-resp-≈⁺ ∘′ Inf.<₋-resp-≈₋ |
| 116 |
|
| 117 |
------------------------------------------------------------------------ |
| 118 |
-- Structures + propositional equality |
| 119 |
|
| 120 |
<±-isStrictPartialOrder-≡ : IsStrictPartialOrder _≡_ _<_ → |
| 121 |
IsStrictPartialOrder _≡_ _<±_ |
| 122 |
<±-isStrictPartialOrder-≡ = |
| 123 |
Sup.<⁺-isStrictPartialOrder-≡ ∘′ Inf.<₋-isStrictPartialOrder-≡ |
| 124 |
|
| 125 |
<±-isDecStrictPartialOrder-≡ : IsDecStrictPartialOrder _≡_ _<_ → |
| 126 |
IsDecStrictPartialOrder _≡_ _<±_ |
| 127 |
<±-isDecStrictPartialOrder-≡ = |
| 128 |
Sup.<⁺-isDecStrictPartialOrder-≡ ∘′ Inf.<₋-isDecStrictPartialOrder-≡ |
| 129 |
|
| 130 |
<±-isStrictTotalOrder-≡ : IsStrictTotalOrder _≡_ _<_ → |
| 131 |
IsStrictTotalOrder _≡_ _<±_ |
| 132 |
<±-isStrictTotalOrder-≡ = |
| 133 |
Sup.<⁺-isStrictTotalOrder-≡ ∘′ Inf.<₋-isStrictTotalOrder-≡ |
| 134 |
|
| 135 |
------------------------------------------------------------------------ |
| 136 |
-- Structures + setoid equality |
| 137 |
|
| 138 |
module _ {e} {_≈_ : Rel A e} where |
| 139 |
|
| 140 |
open Equality _≈_ |
| 141 |
|
| 142 |
<±-isStrictPartialOrder : IsStrictPartialOrder _≈_ _<_ → |
| 143 |
IsStrictPartialOrder _≈±_ _<±_ |
| 144 |
<±-isStrictPartialOrder = |
| 145 |
Sup.<⁺-isStrictPartialOrder ∘′ Inf.<₋-isStrictPartialOrder |
| 146 |
|
| 147 |
<±-isDecStrictPartialOrder : IsDecStrictPartialOrder _≈_ _<_ → |
| 148 |
IsDecStrictPartialOrder _≈±_ _<±_ |
| 149 |
<±-isDecStrictPartialOrder = |
| 150 |
Sup.<⁺-isDecStrictPartialOrder ∘′ Inf.<₋-isDecStrictPartialOrder |
| 151 |
|
| 152 |
<±-isStrictTotalOrder : IsStrictTotalOrder _≈_ _<_ → |
| 153 |
IsStrictTotalOrder _≈±_ _<±_ |
| 154 |
<±-isStrictTotalOrder = |
| 155 |
Sup.<⁺-isStrictTotalOrder ∘′ Inf.<₋-isStrictTotalOrder |