------------------------------------------------------------------------ -- The Agda standard library -- -- Many properties which hold for `∼` also hold for `flip ∼`. Unlike -- the module `Relation.Binary.Construct.Flip.Ord` this module does not -- flip the underlying equality. ------------------------------------------------------------------------ {-# OPTIONS --cubical-compatible --safe #-} module Relation.Binary.Construct.Flip.EqAndOrd where open import Data.Product.Base using (_,_) open import Function.Base using (flip; _∘_) open import Level using (Level) open import Relation.Binary.Core using (Rel; REL; _⇒_) open import Relation.Binary.Bundles using (Setoid; DecSetoid; Preorder; Poset; TotalOrder; DecTotalOrder ; StrictPartialOrder; StrictTotalOrder; TotalPreorder) open import Relation.Binary.Structures using (IsEquivalence; IsDecEquivalence; IsPreorder; IsPartialOrder ; IsTotalOrder; IsDecTotalOrder; IsStrictPartialOrder ; IsStrictTotalOrder; IsTotalPreorder) open import Relation.Binary.Definitions using (Reflexive; Symmetric; Transitive; Asymmetric; Total; _Respects_ ; _Respects₂_; Minimum; Maximum; Irreflexive; Antisymmetric ; Trichotomous; Decidable; tri<; tri>; tri≈) private variable a b p ℓ ℓ₁ ℓ₂ : Level A B : Set a ≈ ∼ ≤ < : Rel A ℓ ------------------------------------------------------------------------ -- Properties module _ (∼ : Rel A ℓ) where refl : Reflexive ∼ → Reflexive (flip ∼) refl refl = refl sym : Symmetric ∼ → Symmetric (flip ∼) sym sym = sym trans : Transitive ∼ → Transitive (flip ∼) trans trans = flip trans asym : Asymmetric ∼ → Asymmetric (flip ∼) asym asym = asym total : Total ∼ → Total (flip ∼) total total x y = total y x resp : ∀ {p} (P : A → Set p) → Symmetric ∼ → P Respects ∼ → P Respects (flip ∼) resp _ sym resp ∼ = resp (sym ∼) max : ∀ {⊥} → Minimum ∼ ⊥ → Maximum (flip ∼) ⊥ max min = min min : ∀ {⊤} → Maximum ∼ ⊤ → Minimum (flip ∼) ⊤ min max = max module _ {≈ : Rel A ℓ₁} (∼ : Rel A ℓ₂) where reflexive : Symmetric ≈ → (≈ ⇒ ∼) → (≈ ⇒ flip ∼) reflexive sym impl = impl ∘ sym irrefl : Symmetric ≈ → Irreflexive ≈ ∼ → Irreflexive ≈ (flip ∼) irrefl sym irrefl x≈y y∼x = irrefl (sym x≈y) y∼x antisym : Antisymmetric ≈ ∼ → Antisymmetric ≈ (flip ∼) antisym antisym = flip antisym compare : Trichotomous ≈ ∼ → Trichotomous ≈ (flip ∼) compare cmp x y with cmp x y ... | tri< x y≮x x≉y x x≮y x≉y y