2018-03-21 13:39:56 +00:00
|
|
|
|
-- | Custom prelude for this module
|
|
|
|
|
module Cat.Prelude where
|
|
|
|
|
|
|
|
|
|
open import Agda.Primitive public
|
|
|
|
|
-- FIXME Use:
|
|
|
|
|
-- open import Agda.Builtin.Sigma public
|
|
|
|
|
-- Rather than
|
|
|
|
|
open import Data.Product public
|
|
|
|
|
renaming (∃! to ∃!≈)
|
|
|
|
|
|
|
|
|
|
-- TODO Import Data.Function under appropriate names.
|
|
|
|
|
|
|
|
|
|
open import Cubical public
|
|
|
|
|
-- FIXME rename `gradLemma` to `fromIsomorphism` - perhaps just use wrapper
|
|
|
|
|
-- module.
|
|
|
|
|
open import Cubical.GradLemma
|
|
|
|
|
using (gradLemma)
|
|
|
|
|
public
|
|
|
|
|
open import Cubical.NType
|
2018-03-21 14:01:31 +00:00
|
|
|
|
using (⟨-2⟩ ; ⟨-1⟩ ; ⟨0⟩ ; TLevel ; HasLevel)
|
2018-03-21 13:39:56 +00:00
|
|
|
|
public
|
|
|
|
|
open import Cubical.NType.Properties
|
|
|
|
|
using
|
|
|
|
|
( lemPropF ; lemSig ; lemSigP ; isSetIsProp
|
|
|
|
|
; propPi ; propHasLevel ; setPi ; propSet)
|
|
|
|
|
public
|
2018-03-22 13:27:16 +00:00
|
|
|
|
|
|
|
|
|
propIsContr : {ℓ : Level} → {A : Set ℓ} → isProp (isContr A)
|
|
|
|
|
propIsContr = propHasLevel ⟨-2⟩
|
|
|
|
|
|
2018-04-03 13:23:11 +00:00
|
|
|
|
open import Cubical.Sigma using (setSig ; sigPresSet ; sigPresNType) public
|
2018-03-21 14:01:31 +00:00
|
|
|
|
|
|
|
|
|
module _ (ℓ : Level) where
|
|
|
|
|
-- FIXME Ask if we can push upstream.
|
|
|
|
|
-- A redefinition of `Cubical.Universe` with an explicit parameter
|
|
|
|
|
_-type : TLevel → Set (lsuc ℓ)
|
|
|
|
|
n -type = Σ (Set ℓ) (HasLevel n)
|
|
|
|
|
|
|
|
|
|
hSet : Set (lsuc ℓ)
|
|
|
|
|
hSet = ⟨0⟩ -type
|
|
|
|
|
|
|
|
|
|
Prop : Set (lsuc ℓ)
|
|
|
|
|
Prop = ⟨-1⟩ -type
|
2018-03-21 13:39:56 +00:00
|
|
|
|
|
|
|
|
|
-----------------
|
|
|
|
|
-- * Utilities --
|
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
|
|
-- | Unique existensials.
|
|
|
|
|
∃! : ∀ {a b} {A : Set a}
|
|
|
|
|
→ (A → Set b) → Set (a ⊔ b)
|
|
|
|
|
∃! = ∃!≈ _≡_
|
|
|
|
|
|
|
|
|
|
∃!-syntax : ∀ {a b} {A : Set a} → (A → Set b) → Set (a ⊔ b)
|
2018-03-27 12:18:13 +00:00
|
|
|
|
∃!-syntax = ∃!
|
2018-03-21 13:39:56 +00:00
|
|
|
|
|
|
|
|
|
syntax ∃!-syntax (λ x → B) = ∃![ x ] B
|
2018-03-21 13:47:01 +00:00
|
|
|
|
|
2018-04-03 10:40:20 +00:00
|
|
|
|
module _ {ℓa ℓb} {A : Set ℓa} {P : A → Set ℓb} (f g : ∃! P) where
|
|
|
|
|
open Σ (proj₂ f) renaming (proj₂ to u)
|
|
|
|
|
|
|
|
|
|
∃-unique : proj₁ f ≡ proj₁ g
|
|
|
|
|
∃-unique = u (proj₁ (proj₂ g))
|
|
|
|
|
|
2018-03-21 13:47:01 +00:00
|
|
|
|
module _ {ℓa ℓb : Level} {A : Set ℓa} {B : A → Set ℓb} {a b : Σ A B}
|
|
|
|
|
(proj₁≡ : (λ _ → A) [ proj₁ a ≡ proj₁ b ])
|
|
|
|
|
(proj₂≡ : (λ i → B (proj₁≡ i)) [ proj₂ a ≡ proj₂ b ]) where
|
|
|
|
|
|
|
|
|
|
Σ≡ : a ≡ b
|
|
|
|
|
proj₁ (Σ≡ i) = proj₁≡ i
|
|
|
|
|
proj₂ (Σ≡ i) = proj₂≡ i
|