Debian Codegraph @

src/Relation/Binary/Morphism/Construct/Constant.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Constant morphisms between binary relations
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Relation.Binary.Morphism.Construct.Constant where
10
11 open import Function.Base using (const)
12 open import Level using (Level)
13 open import Relation.Binary.Core using (Rel)
14 open import Relation.Binary.Bundles using (Setoid; Preorder)
15 open import Relation.Binary.Definitions using (Reflexive)
16 open import Relation.Binary.Morphism.Structures
17 using (IsRelHomomorphism; IsOrderHomomorphism)
18 open import Relation.Binary.Morphism.Bundles
19 using (SetoidHomomorphism; PreorderHomomorphism)
20
21 private
22 variable
23 a b ℓ₁ ℓ₂ ℓ₃ ℓ₄ : Level
24 A B : Set a
25
26 ------------------------------------------------------------------------
27 -- Relations
28 ------------------------------------------------------------------------
29
30 module _ (≈₁ : Rel A ℓ₁) (≈₂ : Rel B ℓ₂) where
31
32 isRelHomomorphism : Reflexive ≈₂ →
33 ∀ x → IsRelHomomorphism ≈₁ ≈₂ (const x)
34 isRelHomomorphism refl x = record
35 { cong = const refl
36 }
37
38 module _ (S : Setoid a ℓ₁) (T : Setoid b ℓ₂) where
39
40 setoidHomomorphism : ∀ x → SetoidHomomorphism S T
41 setoidHomomorphism x = record
42 { isRelHomomorphism = isRelHomomorphism _ _ T.refl x
43 } where module T = Setoid T
44
45 ------------------------------------------------------------------------
46 -- Orders
47 ------------------------------------------------------------------------
48
49 module _ (≈₁ : Rel A ℓ₁) (≈₂ : Rel B ℓ₂) (∼₁ : Rel A ℓ₃) (∼₂ : Rel B ℓ₄) where
50
51 isOrderHomomorphism : Reflexive ≈₂ → Reflexive ∼₂ →
52 ∀ x → IsOrderHomomorphism ≈₁ ≈₂ ∼₁ ∼₂ (const x)
53 isOrderHomomorphism ≈-refl ∼-refl x = record
54 { cong = const ≈-refl
55 ; mono = const ∼-refl
56 }
57
58 module _ (P : Preorder a ℓ₁ ℓ₂) (Q : Preorder b ℓ₃ ℓ₄) where
59
60 preorderHomomorphism : ∀ x → PreorderHomomorphism P Q
61 preorderHomomorphism x = record
62 { isOrderHomomorphism = isOrderHomomorphism _ _ _ _ Q.Eq.refl Q.refl x
63 } where module Q = Preorder Q