Skip to content

Commit

Permalink
defn: atomic sites
Browse files Browse the repository at this point in the history
  • Loading branch information
plt-amy committed Dec 22, 2024
1 parent 5643247 commit 6cee647
Show file tree
Hide file tree
Showing 17 changed files with 791 additions and 44 deletions.
14 changes: 0 additions & 14 deletions src/1Lab/Extensionality.agda
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,6 @@ instance
Extensional-Π'' ⦃ sb ⦄ .idsᵉ .to-path h i = sb .idsᵉ .to-path h i
Extensional-Π'' ⦃ sb ⦄ .idsᵉ .to-path-over h i = sb .idsᵉ .to-path-over h i

Extensional-×
: {ℓ ℓ' ℓr ℓs} {A : Type ℓ} {B : Type ℓ'}
→ ⦃ sa : Extensional A ℓr ⦄
→ ⦃ sb : Extensional B ℓs ⦄
Extensional (A × B) (ℓr ⊔ ℓs)
Extensional-× ⦃ sa ⦄ ⦃ sb ⦄ .Pathᵉ (x , y) (x' , y') = Pathᵉ sa x x' × Pathᵉ sb y y'
Extensional-× ⦃ sa ⦄ ⦃ sb ⦄ .reflᵉ (x , y) = reflᵉ sa x , reflᵉ sb y
Extensional-× ⦃ sa ⦄ ⦃ sb ⦄ .idsᵉ .to-path (p , q) = ap₂ _,_
(sa .idsᵉ .to-path p)
(sb .idsᵉ .to-path q)
Extensional-× ⦃ sa ⦄ ⦃ sb ⦄ .idsᵉ .to-path-over (p , q) = Σ-pathp
(sa .idsᵉ .to-path-over p)
(sb .idsᵉ .to-path-over q)

-- Some non-confluent "reduction rules" for extensionality are those
-- for functions from a type with a mapping-out property; here, we can
-- immediately define instances for functions from Σ-types (equality
Expand Down
2 changes: 1 addition & 1 deletion src/Algebra/Group/Ab/Sum.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ limits][rapl]).

Direct-sum-is-product .π₁∘⟨⟩ = trivial!
Direct-sum-is-product .π₂∘⟨⟩ = trivial!
Direct-sum-is-product .unique p q = ext λ x p #ₚ x , q #ₚ x
Direct-sum-is-product .unique p q = ext λ x p #ₚ x , q #ₚ x
```
2 changes: 1 addition & 1 deletion src/Algebra/Ring/Module/Category.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ path-mangling, but it's nothing _too_ bad:
Σ-pathp (f .preserves .linear _ _ _) (g .preserves .linear _ _ _)
prod .has-is-product .π₁∘⟨⟩ = trivial!
prod .has-is-product .π₂∘⟨⟩ = trivial!
prod .has-is-product .unique p q = ext λ x p #ₚ x , q #ₚ x
prod .has-is-product .unique p q = ext λ x p #ₚ x , q #ₚ x
```

<!-- [TODO: Amy, 2022-09-15]
Expand Down
8 changes: 4 additions & 4 deletions src/Cat/CartesianClosed/Instances/PSh.agda
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ module _ {o ℓ κ} {C : Precategory o ℓ} where
f .is-natural x y h i a , g .is-natural x y h i a
prod .has-is-product .π₁∘⟨⟩ = trivial!
prod .has-is-product .π₂∘⟨⟩ = trivial!
prod .has-is-product .unique p q = ext λ i x unext p i x , unext q i x
prod .has-is-product .unique p q = ext λ i x unext p i x , unext q i x

{-# TERMINATING #-}
PSh-coproducts : (A B : PSh.Ob) Coproduct (PSh κ C) A B
Expand Down Expand Up @@ -217,13 +217,13 @@ module _ {κ} {C : Precategory κ κ} where
adj .unit .η x .η i a =
NT (λ j (h , b) x .F₁ h a , b) λ _ _ _ funext λ _
Σ-pathp (happly (x .F-∘ _ _) _) refl
adj .unit .η x .is-natural _ _ _ = ext λ _ _ _ _ sym (x .F-∘ _ _ # _) , refl
adj .unit .is-natural x y f = ext λ _ _ _ _ _ sym (f .is-natural _ _ _ $ₚ _) , refl
adj .unit .η x .is-natural _ _ _ = ext λ _ _ _ _ sym (x .F-∘ _ _ # _) , refl
adj .unit .is-natural x y f = ext λ _ _ _ _ _ sym (f .is-natural _ _ _ $ₚ _) , refl
adj .counit .η _ .η _ x = x .fst .η _ (C.id , x .snd)
adj .counit .η _ .is-natural x y f = funext λ h
ap (h .fst .η _) (Σ-pathp C.id-comm refl) ∙ happly (h .fst .is-natural _ _ _) _
adj .counit .is-natural x y f = trivial!
adj .zig {A} = ext λ x _ _ happly (F-id A) _ , refl
adj .zig {A} = ext λ x _ _ happly (F-id A) _ , refl
adj .zag {A} = ext λ _ x i f g j x .η i (C.idr f j , g)

cc : Cartesian-closed (PSh κ C) (PSh-products {C = C}) (PSh-terminal {C = C})
Expand Down
48 changes: 47 additions & 1 deletion src/Cat/Diagram/Coproduct/Copower.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
open import Cat.Diagram.Colimit.Coproduct
open import Cat.Diagram.Coproduct.Indexed
open import Cat.Diagram.Colimit.Base
open import Cat.Functor.Adjoint.Hom
open import Cat.Functor.Naturality
open import Cat.Instances.Discrete
open import Cat.Instances.Product
open import Cat.Diagram.Terminal
open import Cat.Functor.Adjoint
open import Cat.Instances.Sets
open import Cat.Functor.Hom
open import Cat.Prelude
Expand Down Expand Up @@ -54,9 +57,9 @@ module Copowers
(coprods : (S : Set ℓ) has-coproducts-indexed-by C ∣ S ∣)
where

open Functor
open Indexed-coproduct
open Cat.Reasoning C
open Functor
```
-->

Expand Down Expand Up @@ -120,3 +123,46 @@ cocomplete→copowering colim = Copowers.Copowering λ S F →
Colimit→IC _ (is-hlevel-suc 2 (S .is-tr)) F (colim _)
```
-->

## Constant objects

If $\cC$ has a terminal object $\star$, then the copower $S \times
\star$ is referred to as the **constant object** on $S$. By simplifying
the universal power of the copower, we obtain that constant objects
assemble into a functor left adjoint to $\cC(\star,-)$.^[This right
adjoint is often called the **global sections functor**]

<!--
```agda
module Consts
{o ℓ} {C : Precategory o ℓ}
(term : Terminal C)
(coprods : (S : Set ℓ) has-coproducts-indexed-by C ∣ S ∣)
where

open Indexed-coproduct
open Cat.Reasoning C
open Copowers coprods
open Functor

open Terminal term renaming (top to *C)
```
-->

```agda
Constant-objects : Functor (Sets ℓ) C
Constant-objects .F₀ S = S ⊗ *C
Constant-objects .F₁ f = coprods _ _ .match λ i coprods _ _ .ι (f i)
Constant-objects .F-id = sym $ coprods _ _ .unique _ λ i idl _
Constant-objects .F-∘ f g = sym $ coprods _ _ .unique _ λ i
pullr (coprods _ _ .commute) ∙ coprods _ _ .commute

Const⊣Γ : Constant-objects ⊣ Hom-from _ *C
Const⊣Γ = hom-iso→adjoints
(λ f x f ∘ coprods _ _ .ι x)
(is-iso→is-equiv (iso
(λ h coprods _ _ .match h)
(λ h ext λ i coprods _ _ .commute)
(λ x sym (coprods _ _ .unique _ λ i refl))))
(λ g h x ext λ y pullr (pullr (coprods _ _ .commute)))
```
8 changes: 8 additions & 0 deletions src/Cat/Diagram/Sieve.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ module _ {o ℓ : _} {C : Precategory o ℓ} where
intersect {I = I} F .closed x g = inc λ i F i .closed (□-out! x i) g
```

<!--
```agda
_∩S_ : {U} Sieve C U Sieve C U Sieve C U
(S ∩S T) .arrows f = S .arrows f ∧Ω T .arrows f
(S ∩S T) .closed (Sf , Tf) g = S .closed Sf g , T .closed Tf g
```
-->

## Representing subfunctors {defines="sieves-as-presheaves"}

Let $S$ be a sieve on $\cC$. We show that it determines a presheaf
Expand Down
2 changes: 1 addition & 1 deletion src/Cat/Instances/OFE/Product.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ OFE-Product A B .has-is-product .⟨_,_⟩ f g .preserves .pres-≈ p =

OFE-Product A B .has-is-product .π₁∘⟨⟩ = trivial!
OFE-Product A B .has-is-product .π₂∘⟨⟩ = trivial!
OFE-Product A B .has-is-product .unique p q = ext λ x p #ₚ x , q #ₚ x
OFE-Product A B .has-is-product .unique p q = ext λ x p #ₚ x , q #ₚ x
```

<!--
Expand Down
4 changes: 2 additions & 2 deletions src/Cat/Instances/Sheaves/Exponentials.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ This concludes the proof that $B^A$ is $J$-separated.

```agda
abstract
sep : {U} {c : J .covers U} is-separated₁ psh (J .cover c)
sep : {U : ⌞ C ⌟} {c : J ʻ U} is-separated₁ psh (J .cover c)
sep {c = c} {x} {y} loc = ext λ V f z bshf.separate (pull f (inc c)) λ g hg
B ⟪ g ⟫ x .η V (f , z) ≡˘⟨ x .is-natural _ _ _ $ₚ _ ⟩
x .η _ (f ∘ g , A ⟪ g ⟫ z) ≡⟨ ap (x .η _) (Σ-pathp (intror refl) refl) ⟩
Expand All @@ -98,7 +98,7 @@ U$, as long as we're given $x : A(V)$. Each part of $p'$ is given by
evaluating the corresponding part of $p$:

```agda
module _ {U} {c : J .covers U} (p : Patch psh (J .cover c)) where
module _ {U} {c : J ʻ U} (p : Patch psh (J .cover c)) where
p' : {V} (e : A ʻ V) (f : Hom V U) Patch B (pullback f (J .cover c))
p' e f .part g hg = p .part (f ∘ g) hg .η _ (id , A ⟪ g ⟫ e)
p' e f .patch g hg h hh =
Expand Down
200 changes: 200 additions & 0 deletions src/Cat/Instances/Sheaves/Omega.lagda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<!--
```agda
open import Cat.Diagram.Sieve
open import Cat.Site.Closure
open import Cat.Site.Base
open import Cat.Prelude

import Cat.Reasoning as Cat
```
-->

```agda
module Cat.Instances.Sheaves.Omega {ℓ} {C : Precategory ℓ ℓ} (J : Coverage C ℓ) where
```

# Closed sieves and the subobject classifier {defines="subobject-classifier-sheaf"}

<!--
```agda
open Functor
open Cat C

open Coverage J using (Membership-covers ; Sem-covers)
```
-->

The category of [[sheaves]] $\Sh(\cC, J)$ on a small [[site]] $\cC$ 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 $\Omega_J$ explicitly, as the sheaf of **$J$-closed sieves**.

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

```agda
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)
```

<!--
```agda
private instance
Extensional-closed-sieve : {ℓr U} ⦃ _ : Extensional (Sieve C U) ℓr ⦄ Extensional (Σ[ R ∈ Sieve C U ] is-closed R) ℓr
Extensional-closed-sieve ⦃ e ⦄ = injection→extensional! Σ-prop-path! e
```
-->

```agda
Ω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|separated presheaf]]. Suppose we have two closed sieves $S$,
$T$ which agree everywhere on some $R \in J(U)$. We want to show $S =
T$, so fix some $h : V \to U$; we'll show $h \in S$ iff $h \in T$.

```agda
ΩJ .snd = from-is-separated sep mk where
```

It appears that we don't know much about how $S$ and $T$ behave outside
of their agreement on $R$, 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 $R$:

```agda
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 Ω-ua
(λ (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 $h \in S$, we know that the pullback $h^*(S
\cap R)$ is a covering sieve. And since $h^*(T)$ is a subsieve of
$h^*(S \cap R) = h^*(T \cap R)$, we conclude that if $h \in S$, then
$h^*(T)$ is $J$-covering; and since $T$ is closed, this implies also
that $h \in T$.

```agda
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.

<!--
```agda
rem₃ : h ∈ T J ∋ pullback h S
rem₃ ht = incl (λ _ fst) (subst (J ∋_) (ap (pullback h) (sym rem₁))
(local (pull h (inc R)) λ f rfh max (T .closed ht (f ∘ id) , subst (_∈ R) (ap (h ∘_) (intror refl)) rfh)))
```
-->

```agda
in Ω-ua (λ h∈S cT h (rem₂' h∈S)) (λ h∈T cS h (rem₃ h∈T))
```

Now we have to show that a family $S$ of compatible closed sieves over a
$J(U)$-covering sieve $R$ can be uniquely patched to a closed sieve on
$U$. This is the sieve which is defiend to contain $g : V \to U$
whenever, for all $f : W \to V$ in $g^*(R)$, the part $S(gf)$ is the
maximal sieve.

```agda
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
```

<!--
```agda
module _ {V W W'} (f : Hom V U) (hf : f ∈ ⟦ R ⟧) (g : Hom W V) (hfg : f ∘ g ∈ ⟦ R ⟧) {h : Hom W' W} where
lemma : h ∈ S .part (f ∘ g) hfg .fst ≡ (g ∘ h) ∈ S .part f hf .fst
lemma = sym (ap (λ e ⌞ e .fst .arrows h ⌟) (S .patch f hf g hfg))

module lemma = Equiv (path→equiv lemma)
```
-->

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

```agda
restrict : {V} (f : Hom V U) (hf : f ∈ R) pullback f S' ≡ S .part f hf .fst
restrict f hf = ext λ {V} h Ω-ua
(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 $S'$ is closed.

```agda
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)
```

<!--
```agda
mk : Section (ΩJ .fst) S
mk .whole = S' , S'-closed
mk .glues f hf = Σ-prop-path! (restrict f hf)
```
-->
4 changes: 2 additions & 2 deletions src/Cat/Monoidal/Instances/Day.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ module Day (X Y : ⌞ PSh ℓ C ⌟) where

Day-diagram c .F₁ ((f⁻ , g⁻) , f⁺ , g⁺) (h , x , y) = (f⁺ ⊗₁ g⁺) ∘ h , X .F₁ f⁻ x , Y .F₁ g⁻ y

Day-diagram c .F-id = ext λ h x y eliml (-⊗- .F-id) , X .F-id #ₚ x , Y .F-id #ₚ y
Day-diagram c .F-∘ f g = ext λ h x y pushl (-⊗- .F-∘ _ _) , X .F-∘ _ _ #ₚ _ , Y .F-∘ _ _ #ₚ _
Day-diagram c .F-id = ext λ h x y eliml (-⊗- .F-id) , X .F-id #ₚ x , Y .F-id #ₚ y
Day-diagram c .F-∘ f g = ext λ h x y pushl (-⊗- .F-∘ _ _) , X .F-∘ _ _ #ₚ _ , Y .F-∘ _ _ #ₚ _
```
-->

Expand Down
Loading

0 comments on commit 6cee647

Please sign in to comment.