| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Properties satisfied by preorders |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Relation.Binary.Bundles using (Preorder; Setoid) |
| 10 |
|
| 11 |
module Relation.Binary.Properties.Preorder |
| 12 |
{p₁ p₂ p₃} (P : Preorder p₁ p₂ p₃) where |
| 13 |
|
| 14 |
open import Function.Base using (flip) |
| 15 |
open import Data.Product.Base as Product using (_×_; _,_; swap) |
| 16 |
import Relation.Binary.Construct.Flip.EqAndOrd as EqAndOrd |
| 17 |
using (isPreorder; preorder) |
| 18 |
open import Relation.Binary.Structures using (IsPreorder) |
| 19 |
|
| 20 |
open Preorder P |
| 21 |
|
| 22 |
|
| 23 |
------------------------------------------------------------------------ |
| 24 |
-- The converse relation is also a preorder. |
| 25 |
|
| 26 |
converse-isPreorder : IsPreorder _≈_ _≳_ |
| 27 |
converse-isPreorder = EqAndOrd.isPreorder isPreorder |
| 28 |
|
| 29 |
converse-preorder : Preorder p₁ p₂ p₃ |
| 30 |
converse-preorder = EqAndOrd.preorder P |
| 31 |
|
| 32 |
------------------------------------------------------------------------ |
| 33 |
-- For every preorder there is an induced equivalence |
| 34 |
|
| 35 |
InducedEquivalence : Setoid _ _ |
| 36 |
InducedEquivalence = record |
| 37 |
{ _≈_ = λ x y → x ≲ y × x ≳ y |
| 38 |
; isEquivalence = record |
| 39 |
{ refl = (refl , refl) |
| 40 |
; sym = swap |
| 41 |
; trans = Product.zip trans (flip trans) |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
------------------------------------------------------------------------ |
| 48 |
-- DEPRECATED NAMES |
| 49 |
------------------------------------------------------------------------ |
| 50 |
-- Please use the new names as continuing support for the old names is |
| 51 |
-- not guaranteed. |
| 52 |
|
| 53 |
-- Version 2.0 |
| 54 |
|
| 55 |
invIsPreorder = converse-isPreorder |
| 56 |
{-# WARNING_ON_USAGE invIsPreorder |
| 57 |
"Warning: invIsPreorder was deprecated in v2.0. |
| 58 |
Please use converse-isPreorder instead." |
| 59 |
#-} |
| 60 |
invPreorder = converse-preorder |
| 61 |
{-# WARNING_ON_USAGE invPreorder |
| 62 |
"Warning: invPreorder was deprecated in v2.0. |
| 63 |
Please use converse-preorder instead." |
| 64 |
#-} |