open import Cat.Displayed.Instances.Pullback
open import Cat.Displayed.Instances.Slice
open import Cat.Instances.Sets.Complete
open import Cat.Displayed.Cartesian
open import Cat.Diagram.Terminal
open import Cat.Instances.Slice
open import Cat.Displayed.Base
open import Cat.Prelude

import Cat.Functor.Hom as Hom
module Cat.Displayed.Instances.Scone
  {o ℓ} (B : Precategory o ℓ)
  (terminal : Terminal B)
  where
open Precategory B
open Terminal terminal
open /-Obj
open Hom B

Sierpinski cones🔗

Given a category we can construct a displayed category of “Sierpinski cones” over or “scones” for short. Scones provide a powerful set of tools for proving various properties of categories that we want to think of as somehow “syntactic”.

Note

When is a Cartesian category, the scone is simply the Artin gluing along the global sections functor. The discussion below generalises it to the case where we merely assume that has a terminal object.

A scone over some object consists of a set along with a function If we think about as some sort of category of contexts, then a scone over some context is some means of attaching semantic information (the set to such that we can recover closed terms of from elements of

Morphisms behave like they do in an arrow category of given a map in a map over in the category between and consists of a function such that for all we have

With the exposition out of the way, we can now define the category of scones by abstract nonsense: the category of scones over is the pullback of the fundamental fibration of along the global sections functor.

Scones : Displayed B (lsuc ℓ)
Scones = Change-of-base Hom[ top ,-] (Slices (Sets ℓ))

We can unfold the abstract definition to see that we obtain the same objects and morphisms described above.

private module Scones = Displayed Scones
scone :  {X}  (U : Set)  (∣ U ∣  Hom top X)  Scones ʻ X
scone U s = cut {dom = U} s

scone-hom
  :  {X Y} {f : Hom X Y} {U V : Set}
   {su : ∣ U ∣  Hom top X} {sv : ∣ V ∣  Hom top Y}
   (uv : ∣ U ∣  ∣ V ∣)
   (∀ u  sv (uv u) ≡ f ∘ (su u))
   Scones.Hom[ f ] (scone U su) (scone V sv)
scone-hom uv p = record { map = uv ; com = funext p }

As a fibration🔗

The category of scones over is always a fibration. This is where our definition by abstract nonsense begins to shine: base change preserves fibrations, and the codomain fibration is a fibration whenever the base category has pullbacks, which sets has!

Scones-fibration : Cartesian-fibration Scones
Scones-fibration =
  Change-of-base-fibration _ _ $
  Codomain-fibration _         $
  Sets-pullbacks