module Cat.CartesianClosed.Free.Signature where
Signatures for free CCCsπ
module types {β} (T : Type β) where
infixr 22 _`β_
infixr 20 _`Γ_
infix 25 `_
The type of simple types over a type of base types is the inductive type with a constructor for base types, a nullary constructor for the unit type, and binary constructors for products and functions.
data Ty : Type β where
: Ty
`β€ _ : T β Ty
`_`Γ_ _`β_ : Ty β Ty β Ty
Weβll need an βobservationalβ equality on types, both to show that the types of a given are a set, and later to show this also of further constructions on syntax.
module code β¦ _ : H-Level T 2 β¦ where
: Ty β Ty β Prop β
same-ty = el! (Lift _ β€)
same-ty `β€ `β€ _ = el! (Lift _ β₯)
same-ty `β€
(` x) (` y) = el! (x β‘ y)
same-ty (` x) _ = el! (Lift _ β₯)
same-ty
(a `Γ x) (b `Γ y) = el! (β same-ty a b β Γ β same-ty x y β)
same-ty (a `Γ x) _ = el! (Lift _ β₯)
same-ty
(a `β x) (b `β y) = el! (β same-ty a b β Γ β same-ty x y β)
same-ty (a `β x) _ = el! (Lift _ β₯)
same-ty
: β x β β same-ty x x β
refl-same-ty = lift tt
refl-same-ty `β€ (` x) = refl
refl-same-ty (a `Γ b) = refl-same-ty a , refl-same-ty b
refl-same-ty (a `β b) = refl-same-ty a , refl-same-ty b
refl-same-ty
: β x y β β same-ty x y β β x β‘ y
from-same-ty = refl
from-same-ty `β€ `β€ p (` x) (` y) p = ap `_ p
from-same-ty (a `Γ x) (b `Γ y) p = apβ _`Γ_ (from-same-ty a b (p .fst)) (from-same-ty x y (p .snd))
from-same-ty (a `β x) (b `β y) p = apβ _`β_ (from-same-ty a b (p .fst)) (from-same-ty x y (p .snd))
from-same-ty
instance
: β {n} β H-Level Ty (2 + n)
H-Level-Ty = basic-instance 2 $ set-identity-systemβhlevel
H-Level-Ty (Ξ» x y β β same-ty x y β) refl-same-ty (Ξ» x y β hlevel 1) from-same-ty
open types using (module Ty ; `_ ; _`Γ_ ; _`β_ ; `β€) public
A consists of a set of base types, and, for each simple type and base type a set of operations
record Ξ»-Signature β : Type (lsuc β) where
field
: Type β
Ob : is-set Ob
Ob-is-set : types.Ty Ob β Ob β Type β
Hom : β {Ο Ο} β is-set (Hom Ο Ο) Hom-is-set
-- This module is meant to always be opened instantiated, so we don't
-- provide these as instances.
instance
: β {n} β H-Level Ob (2 + n)
H-Level-Ob = basic-instance 2 Ob-is-set
H-Level-Ob
: β {Ο Ο n} β H-Level (Hom Ο Ο) (2 + n)
H-Level-Hom = basic-instance 2 Hom-is-set
H-Level-Hom
open types Ob using (Ty) public
open types.code Ob β¦ auto β¦ public