Debian Codegraph @

src/Function/Properties/Injection.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Properties for injections
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Function.Properties.Injection where
10
11 open import Function.Definitions using (Injective)
12 open import Function.Bundles using (Injection; Func; _⟶_; _↣_)
13 import Function.Construct.Identity as Identity using (injection)
14 import Function.Construct.Composition as Compose using (injection)
15 open import Level using (Level)
16 open import Data.Product.Base using (proj₁; proj₂)
17 open import Relation.Binary.Definitions
18 open import Relation.Binary using (Setoid)
19
20 private
21 variable
22 a b c ℓ ℓ₁ ℓ₂ ℓ₃ : Level
23 A B : Set a
24 T S U : Setoid a ℓ
25
26 ------------------------------------------------------------------------
27 -- Constructors
28
29 mkInjection : (f : Func S T) (open Func f) →
30 Injective Eq₁._≈_ Eq₂._≈_ to →
31 Injection S T
32 mkInjection f injective = record
33 { Func f
34 ; injective = injective
35 }
36
37 ------------------------------------------------------------------------
38 -- Conversion functions
39
40 ↣⇒⟶ : A ↣ B → A ⟶ B
41 ↣⇒⟶ = Injection.function
42
43 ------------------------------------------------------------------------
44 -- Setoid properties
45
46 refl : Reflexive (Injection {a} {ℓ})
47 refl {x = x} = Identity.injection x
48
49 trans : Trans (Injection {a} {ℓ₁} {b} {ℓ₂})
50 (Injection {b} {ℓ₂} {c} {ℓ₃})
51 (Injection {a} {ℓ₁} {c} {ℓ₃})
52 trans = Compose.injection
53
54 ------------------------------------------------------------------------
55 -- Propositonal properties
56
57 ↣-refl : Injection S S
58 ↣-refl = refl
59
60 ↣-trans : Injection S T → Injection T U → Injection S U
61 ↣-trans = trans