Debian Codegraph @

src/Relation/Binary/Structures/Biased.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Ways to give instances of certain structures where some fields can
5 -- be given in terms of others
6 ------------------------------------------------------------------------
7
8 -- The contents of this module should be accessed via `Relation.Binary`.
9
10 {-# OPTIONS --cubical-compatible --safe #-}
11
12 open import Relation.Binary.Core using (Rel)
13
14 module Relation.Binary.Structures.Biased
15 {a ℓ} {A : Set a} -- The underlying set
16 (_≈_ : Rel A ℓ) -- The underlying equality relation
17 where
18
19 open import Level using (Level; _⊔_)
20 open import Relation.Binary.Consequences using (tri⇒irr; tri⇒asym; trans∧tri⇒resp)
21 open import Relation.Binary.Definitions using (Transitive; Trichotomous)
22
23 open import Relation.Binary.Structures _≈_
24
25 private
26 variable
27 ℓ₂ : Level
28
29 -- To construct a StrictTotalOrder you only need to prove transitivity and
30 -- trichotomy as the current implementation of `Trichotomous` subsumes
31 -- irreflexivity and asymmetry.
32 record IsStrictTotalOrderᶜ (_<_ : Rel A ℓ₂) : Set (a ⊔ ℓ ⊔ ℓ₂) where
33 field
34 isEquivalence : IsEquivalence
35 trans : Transitive _<_
36 compare : Trichotomous _≈_ _<_
37
38 isStrictTotalOrderᶜ : IsStrictTotalOrder _<_
39 isStrictTotalOrderᶜ = record
40 { isStrictPartialOrder = record
41 { isEquivalence = isEquivalence
42 ; irrefl = tri⇒irr compare
43 ; trans = trans
44 ; <-resp-≈ = trans∧tri⇒resp Eq.sym Eq.trans trans compare
45 }
46 ; compare = compare
47 } where module Eq = IsEquivalence isEquivalence
48
49 open IsStrictTotalOrderᶜ public
50 using (isStrictTotalOrderᶜ)