| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Bundles for types of functions |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
-- The contents of this file should usually be accessed from `Function`. |
| 8 |
|
| 9 |
-- Note that these bundles differ from those found elsewhere in other |
| 10 |
-- library hierarchies as they take Setoids as parameters. This is |
| 11 |
-- because a function is of no use without knowing what its domain and |
| 12 |
-- codomain is, as well which equalities are being considered over them. |
| 13 |
-- One consequence of this is that they are not built from the |
| 14 |
-- definitions found in `Function.Structures` as is usually the case in |
| 15 |
-- other library hierarchies, as this would duplicate the equality |
| 16 |
-- axioms. |
| 17 |
|
| 18 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 19 |
|
| 20 |
module Function.Dependent.Bundles where |
| 21 |
|
| 22 |
open import Level using (Level; _⊔_) |
| 23 |
open import Relation.Binary.Bundles using (Setoid) |
| 24 |
open import Relation.Binary.Indexed.Heterogeneous using (IndexedSetoid) |
| 25 |
|
| 26 |
private |
| 27 |
variable |
| 28 |
a b ℓ₁ ℓ₂ : Level |
| 29 |
|
| 30 |
------------------------------------------------------------------------ |
| 31 |
-- Setoid bundles |
| 32 |
------------------------------------------------------------------------ |
| 33 |
|
| 34 |
module _ |
| 35 |
(From : Setoid a ℓ₁) |
| 36 |
(To : IndexedSetoid (Setoid.Carrier From) b ℓ₂) |
| 37 |
where |
| 38 |
|
| 39 |
open Setoid From using () renaming (Carrier to A; _≈_ to _≈₁_) |
| 40 |
open IndexedSetoid To using () renaming (Carrier to B; _≈_ to _≈₂_) |
| 41 |
|
| 42 |
------------------------------------------------------------------------ |
| 43 |
-- Bundles with one element |
| 44 |
|
| 45 |
-- Called `Func` rather than `Function` in order to avoid clashing |
| 46 |
-- with the top-level module. |
| 47 |
record Func : Set (a ⊔ b ⊔ ℓ₁ ⊔ ℓ₂) where |
| 48 |
field |
| 49 |
to : (x : A) → B x |
| 50 |
cong : ∀ {x y} → x ≈₁ y → to x ≈₂ to y |