| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Indexed universes |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
module Data.Universe.Indexed where |
| 10 |
|
| 11 |
open import Data.Product.Base using (∃; proj₂) |
| 12 |
open import Data.Universe using (Universe) |
| 13 |
open import Function.Base using (_∘_) |
| 14 |
open import Level using (Level; _⊔_; suc) |
| 15 |
|
| 16 |
------------------------------------------------------------------------ |
| 17 |
-- Definitions |
| 18 |
|
| 19 |
record IndexedUniverse i u e : Set (suc (i ⊔ u ⊔ e)) where |
| 20 |
field |
| 21 |
I : Set i -- Index set. |
| 22 |
U : I → Set u -- Codes. |
| 23 |
El : ∀ {i} → U i → Set e -- Decoding function. |
| 24 |
|
| 25 |
-- An indexed universe can be turned into an unindexed one. |
| 26 |
|
| 27 |
unindexed-universe : Universe (i ⊔ u) e |
| 28 |
unindexed-universe = record |
| 29 |
{ U = ∃ λ i → U i |
| 30 |
; El = El ∘ proj₂ |
| 31 |
} |