module Cat.CartesianClosed.Free.Signature whereSignatures 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 β TyWeβ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
    same-ty : 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 _ β₯)
    refl-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
    from-same-ty : β x y β β same-ty x y β β x β‘ y
    from-same-ty `β€       `β€       p = refl
    from-same-ty (` 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))
    instance
      H-Level-Ty : β {n} β H-Level Ty (2 + n)
      H-Level-Ty = basic-instance 2 $ set-identity-systemβhlevel
        (Ξ» x y β β same-ty x y β) refl-same-ty (Ξ» x y β hlevel 1) from-same-tyopen types using (module Ty ; `_ ; _`Γ_ ; _`β_ ; `β€) publicA 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
    Ob         : Type β
    Ob-is-set  : is-set Ob
    Hom        : types.Ty Ob β Ob β Type β
    Hom-is-set : β {Ο Ο} β is-set (Hom Ο Ο)  -- This module is meant to always be opened instantiated, so we don't
  -- provide these as instances.
  instance
    H-Level-Ob : β {n} β H-Level Ob (2 + n)
    H-Level-Ob = basic-instance 2 Ob-is-set
    H-Level-Hom : β {Ο Ο n} β H-Level (Hom Ο Ο) (2 + n)
    H-Level-Hom = basic-instance 2 Hom-is-set
  open types Ob using (Ty) public
  open types.code Ob β¦ auto β¦ public