Debian Codegraph @

src/Relation/Binary/Construct/Add/Extrema/Equality.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- A pointwise lifting of a relation 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.Equality
15 {a ℓ} {A : Set a} (_≈_ : Rel A ℓ) where
16
17 open import Function.Base using (_∘′_)
18 open import Relation.Binary.Structures
19 using (IsEquivalence; IsDecEquivalence)
20 open import Relation.Binary.Definitions
21 using (Reflexive; Symmetric; Transitive; Decidable; Irrelevant; Substitutive)
22 import Relation.Binary.Construct.Add.Infimum.Equality as AddInfimum
23 import Relation.Binary.Construct.Add.Supremum.Equality as AddSupremum
24 open import Relation.Nullary.Construct.Add.Extrema
25
26 ------------------------------------------------------------------------
27 -- Definition
28
29 private
30 module Inf = AddInfimum _≈_
31 module Sup = AddSupremum (Inf._≈₋_)
32
33 open Sup using () renaming (_≈⁺_ to _≈±_) public
34
35 ------------------------------------------------------------------------
36 -- Useful pattern synonyms
37
38 pattern ⊥±≈⊥± = Sup.[ Inf.⊥₋≈⊥₋ ]
39 pattern [_] p = Sup.[ Inf.[ p ] ]
40 pattern ⊤±≈⊤± = Sup.⊤⁺≈⊤⁺
41
42 ------------------------------------------------------------------------
43 -- Relational properties
44
45 [≈]-injective : ∀ {k l} → [ k ] ≈± [ l ] → k ≈ l
46 [≈]-injective = Inf.[≈]-injective ∘′ Sup.[≈]-injective
47
48 ≈±-refl : Reflexive _≈_ → Reflexive _≈±_
49 ≈±-refl = Sup.≈⁺-refl ∘′ Inf.≈₋-refl
50
51 ≈±-sym : Symmetric _≈_ → Symmetric _≈±_
52 ≈±-sym = Sup.≈⁺-sym ∘′ Inf.≈₋-sym
53
54 ≈±-trans : Transitive _≈_ → Transitive _≈±_
55 ≈±-trans = Sup.≈⁺-trans ∘′ Inf.≈₋-trans
56
57 ≈±-dec : Decidable _≈_ → Decidable _≈±_
58 ≈±-dec = Sup.≈⁺-dec ∘′ Inf.≈₋-dec
59
60 ≈±-irrelevant : Irrelevant _≈_ → Irrelevant _≈±_
61 ≈±-irrelevant = Sup.≈⁺-irrelevant ∘′ Inf.≈₋-irrelevant
62
63 ≈±-substitutive : ∀ {ℓ} → Substitutive _≈_ ℓ → Substitutive _≈±_ ℓ
64 ≈±-substitutive = Sup.≈⁺-substitutive ∘′ Inf.≈₋-substitutive
65
66 ------------------------------------------------------------------------
67 -- Structures
68
69 ≈±-isEquivalence : IsEquivalence _≈_ → IsEquivalence _≈±_
70 ≈±-isEquivalence = Sup.≈⁺-isEquivalence ∘′ Inf.≈₋-isEquivalence
71
72 ≈±-isDecEquivalence : IsDecEquivalence _≈_ → IsDecEquivalence _≈±_
73 ≈±-isDecEquivalence = Sup.≈⁺-isDecEquivalence ∘′ Inf.≈₋-isDecEquivalence