123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566-------------------------------------------------------------------------- The Agda standard library---- Consequences of a monomorphism between binary relations------------------------------------------------------------------------ -- See Data.Nat.Binary.Properties for examples of how this and similar-- modules can be used to easily translate properties between types. {-# OPTIONS --cubical-compatible --safe #-} open import Function.Baseopen import Relation.Binary.Core using (Rel)open import Relation.Binary.Structures using (IsEquivalence; IsDecEquivalence)open import Relation.Binary.Definitions using (Reflexive; Symmetric; Transitive; Total; Asymmetric; Decidable)open import Relation.Binary.Morphism module Relation.Binary.Morphism.RelMonomorphism {a b ℓ₁ ℓ₂} {A : Set a} {B : Set b} {_∼₁_ : Rel A ℓ₁} {_∼₂_ : Rel B ℓ₂} {⟦_⟧ : A → B} (isMonomorphism : IsRelMonomorphism _∼₁_ _∼₂_ ⟦_⟧) where open import Data.Sum.Base as Sumopen import Relation.Nullary.Decidable using (yes; no)open import Relation.Nullary.Decidable open IsRelMonomorphism isMonomorphism -------------------------------------------------------------------------- Properties refl : Reflexive _∼₂_ → Reflexive _∼₁_refl refl = injective refl sym : Symmetric _∼₂_ → Symmetric _∼₁_sym sym x∼y = injective (sym (cong x∼y)) trans : Transitive _∼₂_ → Transitive _∼₁_trans trans x∼y y∼z = injective (trans (cong x∼y) (cong y∼z)) total : Total _∼₂_ → Total _∼₁_total total x y = Sum.map injective injective (total ⟦ x ⟧ ⟦ y ⟧) asym : Asymmetric _∼₂_ → Asymmetric _∼₁_asym asym x∼y y∼x = asym (cong x∼y) (cong y∼x) dec : Decidable _∼₂_ → Decidable _∼₁_dec _∼?_ x y = map′ injective cong (⟦ x ⟧ ∼? ⟦ y ⟧) -------------------------------------------------------------------------- Structures isEquivalence : IsEquivalence _∼₂_ → IsEquivalence _∼₁_isEquivalence isEq = record { refl = refl E.refl ; sym = sym E.sym ; trans = trans E.trans } where module E = IsEquivalence isEq isDecEquivalence : IsDecEquivalence _∼₂_ → IsDecEquivalence _∼₁_isDecEquivalence isDecEq = record { isEquivalence = isEquivalence E.isEquivalence ; _≟_ = dec E._≟_ } where module E = IsDecEquivalence isDecEq