| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- This module is DEPRECATED. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
{-# OPTIONS --warning=noUserWarning #-} |
| 9 |
|
| 10 |
module Function.Injection where |
| 11 |
|
| 12 |
{-# WARNING_ON_IMPORT |
| 13 |
"Function.Injection was deprecated in v2.0. |
| 14 |
Use the standard function hierarchy in Function/Function.Bundles instead." |
| 15 |
#-} |
| 16 |
|
| 17 |
open import Function.Base as Fun using () renaming (_∘_ to _⟨∘⟩_) |
| 18 |
open import Level |
| 19 |
open import Relation.Binary.Bundles using (Setoid) |
| 20 |
open import Function.Equality as F |
| 21 |
using (_⟶_; _⟨$⟩_ ; Π) renaming (_∘_ to _⟪∘⟫_) |
| 22 |
open import Relation.Binary.PropositionalEquality as ≡ using (_≡_) |
| 23 |
|
| 24 |
------------------------------------------------------------------------ |
| 25 |
-- Injective functions |
| 26 |
|
| 27 |
Injective : ∀ {a₁ a₂ b₁ b₂} {A : Setoid a₁ a₂} {B : Setoid b₁ b₂} → |
| 28 |
A ⟶ B → Set _ |
| 29 |
Injective {A = A} {B} f = ∀ {x y} → f ⟨$⟩ x ≈₂ f ⟨$⟩ y → x ≈₁ y |
| 30 |
where |
| 31 |
open Setoid A renaming (_≈_ to _≈₁_) |
| 32 |
open Setoid B renaming (_≈_ to _≈₂_) |
| 33 |
{-# WARNING_ON_USAGE Injective |
| 34 |
"Warning: Injective was deprecated in v2.0. |
| 35 |
Please use Function.(Definitions.)Injective instead." |
| 36 |
#-} |
| 37 |
|
| 38 |
------------------------------------------------------------------------ |
| 39 |
-- The set of all injections between two setoids |
| 40 |
|
| 41 |
record Injection {f₁ f₂ t₁ t₂} |
| 42 |
(From : Setoid f₁ f₂) (To : Setoid t₁ t₂) : |
| 43 |
Set (f₁ ⊔ f₂ ⊔ t₁ ⊔ t₂) where |
| 44 |
field |
| 45 |
to : From ⟶ To |
| 46 |
injective : Injective to |
| 47 |
|
| 48 |
open Π to public |
| 49 |
{-# WARNING_ON_USAGE Injection |
| 50 |
"Warning: Injection was deprecated in v2.0. |
| 51 |
Please use Function.(Bundles.)Injection instead." |
| 52 |
#-} |
| 53 |
|
| 54 |
------------------------------------------------------------------------ |
| 55 |
-- The set of all injections from one set to another (i.e. injections |
| 56 |
-- with propositional equality) |
| 57 |
|
| 58 |
infix 3 _↣_ |
| 59 |
|
| 60 |
_↣_ : ∀ {f t} → Set f → Set t → Set _ |
| 61 |
From ↣ To = Injection (≡.setoid From) (≡.setoid To) |
| 62 |
{-# WARNING_ON_USAGE _↣_ |
| 63 |
"Warning: _↣_ was deprecated in v2.0. |
| 64 |
Please use Function.(Bundles.)_↣_ instead." |
| 65 |
#-} |
| 66 |
|
| 67 |
injection : ∀ {f t} {From : Set f} {To : Set t} → (to : From → To) → |
| 68 |
(∀ {x y} → to x ≡ to y → x ≡ y) → From ↣ To |
| 69 |
injection to injective = record |
| 70 |
{ to = record |
| 71 |
{ _⟨$⟩_ = to |
| 72 |
; cong = ≡.cong to |
| 73 |
} |
| 74 |
; injective = injective |
| 75 |
} |
| 76 |
{-# WARNING_ON_USAGE injection |
| 77 |
"Warning: injection was deprecated in v2.0. |
| 78 |
Please use Function.(Bundles.)mk↣ instead." |
| 79 |
#-} |
| 80 |
|
| 81 |
------------------------------------------------------------------------ |
| 82 |
-- Identity and composition. |
| 83 |
|
| 84 |
infixr 9 _∘_ |
| 85 |
|
| 86 |
id : ∀ {s₁ s₂} {S : Setoid s₁ s₂} → Injection S S |
| 87 |
id = record |
| 88 |
{ to = F.id |
| 89 |
; injective = Fun.id |
| 90 |
} |
| 91 |
{-# WARNING_ON_USAGE id |
| 92 |
"Warning: id was deprecated in v2.0. |
| 93 |
Please use Function.Properties.Injection.refl or |
| 94 |
Function.Construct.Identity.injection instead." |
| 95 |
#-} |
| 96 |
|
| 97 |
_∘_ : ∀ {f₁ f₂ m₁ m₂ t₁ t₂} |
| 98 |
{F : Setoid f₁ f₂} {M : Setoid m₁ m₂} {T : Setoid t₁ t₂} → |
| 99 |
Injection M T → Injection F M → Injection F T |
| 100 |
f ∘ g = record |
| 101 |
{ to = to f ⟪∘⟫ to g |
| 102 |
; injective = (λ {_} → injective g) ⟨∘⟩ injective f |
| 103 |
} where open Injection |
| 104 |
{-# WARNING_ON_USAGE _∘_ |
| 105 |
"Warning: _∘_ was deprecated in v2.0. |
| 106 |
Please use Function.Properties.Injection.trans or |
| 107 |
Function.Construct.Composition.injection instead." |
| 108 |
#-} |