1
------------------------------------------------------------------------
3
------------------------------------------------------------------------
5
{-# OPTIONS --universe-polymorphism #-}
7
module Function.Injection where
9
open import Function as Fun using () renaming (_∘_ to _⟨∘⟩_)
11
open import Relation.Binary
12
open import Function.Equality as F
13
using (_⟶_; _⟨$⟩_) renaming (_∘_ to _⟪∘⟫_)
15
-- Injective functions.
17
Injective : ∀ {a₁ a₂ b₁ b₂} {A : Setoid a₁ a₂} {B : Setoid b₁ b₂} →
19
Injective {A = A} {B} f = ∀ {x y} → f ⟨$⟩ x ≈₂ f ⟨$⟩ y → x ≈₁ y
21
open Setoid A renaming (_≈_ to _≈₁_)
22
open Setoid B renaming (_≈_ to _≈₂_)
24
-- The set of all injections between two setoids.
26
record Injection {f₁ f₂ t₁ t₂}
27
(From : Setoid f₁ f₂) (To : Setoid t₁ t₂) :
28
Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where
31
injective : Injective to
33
-- Identity and composition.
37
id : ∀ {s₁ s₂} {S : Setoid s₁ s₂} → Injection S S
38
id = record { to = F.id; injective = Fun.id }
40
_∘_ : ∀ {f₁ f₂ m₁ m₂ t₁ t₂}
41
{F : Setoid f₁ f₂} {M : Setoid m₁ m₂} {T : Setoid t₁ t₂} →
42
Injection M T → Injection F M → Injection F T
45
; injective = (λ {_} → injective g) ⟨∘⟩ injective f
46
} where open Injection