module Cat.Instances.Sheaves.Omega {β„“} {C : Precategory β„“ β„“} (J : Coverage C β„“) where

Closed sieves and the subobject classifierπŸ”—

The category of sheaves on a small site is a topos, which means that β€” in addition to finite limits and exponential objects β€” it has a subobject classifier, a sheaf which plays the role of the β€œuniverse of propositions”. We can construct the sheaf explicitly, as the sheaf of sieves.

A sieve is if it contains every morphism it covers. This notion is evidently closed under pullback, so the closed sieves form a presheaf on

is-closed : βˆ€ {U} β†’ Sieve C U β†’ Type β„“
is-closed {U} S = βˆ€ {V} (h : Hom V U) β†’ J βˆ‹ pullback h S β†’ h ∈ S

abstract
  is-closed-pullback
    : βˆ€ {U V} (f : Hom V U) (S : Sieve C U)
    β†’ is-closed S β†’ is-closed (pullback f S)
  is-closed-pullback f S c h p = c (f ∘ h) (subst (J βˆ‹_) (sym pullback-∘) p)
Ξ©J : Sheaf J β„“
Ξ©J .fst = pre where
  pre : Functor (C ^op) (Sets β„“)
  pre .Fβ‚€ U = el! (Ξ£[ R ∈ Sieve C U ] is-closed R)
  pre .F₁ f (R , c) = pullback f R , is-closed-pullback f R c
  pre .F-id    = funext Ξ» _ β†’ Ξ£-prop-path! pullback-id
  pre .F-∘ f g = funext Ξ» _ β†’ Ξ£-prop-path! pullback-∘

It remains to show that this is a sheaf. We start by showing that it is separated. Suppose we have two closed sieves which agree everywhere on some We want to show so fix some we’ll show iff

Ξ©J .snd = from-is-separated sep mk where

It appears that we don’t know much about how and behave outside of their agreement on but knowing that they’re closed will be enough to show that they agree everywhere. First, let’s codify that they actually agree on their intersection with

  sep : is-separated J (Ξ©J .fst)
  sep {U} R {S , cS} {T , cT} Ξ± = ext Ξ» {V} h β†’
    let
      rem₁ : S ∩S ⟦ R ⟧ ≑ T ∩S ⟦ R ⟧
      rem₁ = ext Ξ» {V} h β†’ biimp
        (Ξ» (h∈S , h∈R) β†’ cT h (subst (J βˆ‹_) (ap fst (Ξ± h h∈R)) (max (S .closed h∈S id))) , h∈R)
        (Ξ» (h∈T , h∈R) β†’ cS h (subst (J βˆ‹_) (ap fst (sym (Ξ± h h∈R))) (max (T .closed h∈T id))) , h∈R)

Then, assuming w.l.o.g. that we know that the pullback is a covering sieve. And since is a subsieve of we conclude that if then is and since is closed, this implies also that

      remβ‚‚ : h ∈ S β†’ J βˆ‹ pullback h (S ∩S ⟦ R ⟧)
      remβ‚‚ h∈S = local (pull h (inc R)) Ξ» f hf∈R β†’ max
        ( S .closed h∈S (f ∘ id)
        , subst (_∈ R) (ap (h ∘_) (intror refl)) hf∈R
        )

      remβ‚‚' : h ∈ S β†’ J βˆ‹ pullback h T
      remβ‚‚' h∈S = incl (Ξ» _ β†’ fst) (subst (J βˆ‹_) (ap (pullback h) rem₁) (remβ‚‚ h∈S))

We omit the symmetric converse for brevity.

    in biimp (Ξ» h∈S β†’ cT h (remβ‚‚' h∈S)) (Ξ» h∈T β†’ cS h (rem₃ h∈T))

Now we have to show that a family of compatible closed sieves over a sieve can be uniquely patched to a closed sieve on This is the sieve which is defined to contain whenever, for all in the part is the maximal sieve.

  module _ {U : ⌞ C ⌟} (R : J ʻ U) (S : Patch (ΩJ .fst) ⟦ R ⟧) where
    S' : Sieve C U
    S' .arrows {V} g = elΞ© $
      βˆ€ {W} (f : Hom W V) (hf : f ∈ pullback g ⟦ R ⟧) β†’
      βˆ€ {V'} (i : Hom V' W) β†’ i ∈ S .part (g ∘ f) hf .fst

    S' .closed = elim! Ξ» Ξ± h β†’ inc Ξ» {W} g hf β†’
      subst (Ξ» e β†’ βˆ€ (h : e ∈ R) {V'} (i : Hom V' W) β†’ i ∈ S .part e h .fst)
        (assoc _ _ _) (α (h ∘ g)) hf

The first thing we have to show is that this pulls back to This is, as usual, a proof of biimplication, though in this case both directions are painful β€” and entirely mechanical β€” calculations.

    restrict : βˆ€ {V} (f : Hom V U) (hf : f ∈ R) β†’ pullback f S' ≑ S .part f hf .fst
    restrict f hf = ext Ξ» {V} h β†’ biimp
      (rec! Ξ» Ξ± β†’
        let
          step₁ : id ∈ S .part (f ∘ h ∘ id) (⟦ R ⟧ .closed hf (h ∘ id)) .fst
          step₁ = substβ‚‚ (Ξ» e e' β†’ id ∈ S .part e e' .fst) (pullr refl) (to-pathp⁻ refl)
            (Ξ± id _ id)

          stepβ‚‚ : ((h ∘ id) ∘ id) ∈ S .part f hf .fst
          stepβ‚‚ = lemma.to f hf (h ∘ id) (⟦ R ⟧ .closed hf (h ∘ id)) {id} step₁

        in subst (Ξ» e β†’ ⌞ S .part f hf .fst .arrows e ⌟) (cancelr (idr _)) stepβ‚‚)
      (Ξ» hh β†’ inc Ξ» {W} g hg {V'} i β†’ S .part ((f ∘ h) ∘ g) hg .snd i (max
        let
          s1 : i ∈ S .part (f ∘ h ∘ g) _ .fst
          s1 = lemma.from f hf (h ∘ g) _
            (subst (_∈ S .part f hf .fst) (assoc _ _ _)
              (S .part f hf .fst .closed hh (g ∘ i)))

          q : PathP (Ξ» i β†’ assoc f h g i ∈ R) _ hg
          q = to-pathp⁻ refl
        in transport (Ξ» j β†’ ⌞ S .part (assoc f h g j) (q j) .fst .arrows (idr i (~ j)) ⌟) s1))

Finally, we can use this to show that is closed.

    abstract
      S'-closed : is-closed S'
      S'-closed {V} h hb = inc Ξ» {W} f hf {V'} i β†’ S .part (h ∘ f) hf .snd i $
        let
          p =
            pullback (f ∘ i) (pullback h S')     β‰‘Λ˜βŸ¨ pullback-∘ βŸ©β‰‘Λ˜
            pullback (h ∘ f ∘ i) S'              β‰‘βŸ¨ restrict (h ∘ f ∘ i) (subst (_∈ R) (sym (assoc h f i)) (⟦ R ⟧ .closed hf i)) βŸ©β‰‘
            S .part (h ∘ f ∘ i) _ .fst           β‰‘βŸ¨ apβ‚‚ (Ξ» e e' β†’ S .part e e' .fst) (assoc h f i) (to-pathp⁻ refl) βŸ©β‰‘
            S .part ((h ∘ f) ∘ i) _ .fst         β‰‘Λ˜βŸ¨ ap fst (S .patch (h ∘ f) hf i (⟦ R ⟧ .closed hf i)) βŸ©β‰‘Λ˜
            pullback i (S .part (h ∘ f) hf .fst) ∎
        in subst (J βˆ‹_) p (pull (f ∘ i) hb)