proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Category.Sheaf

Description

Sites and sheaves.

A cover of an object a is a family of arrows into a, its legs, that together count as all of a. The model is the opens of a space: an open is covered by smaller opens whose union it is. A Site is a category with a choice of covers, called a coverage.

Read an element of p a b as data over a (b is a parameter along for the ride). Restricting along a leg g :: x ~> a, with lmap g, gives data over x. A family, one element per leg, is matching when its elements agree wherever two legs overlap: for legs g, g' and any u :: z ~> x, v :: z ~> y with legArrow g . u = legArrow g' . v, lmap u (m g) = lmap v (m g'). p is a Sheaf when every matching family is the restriction of exactly one element at a. That rules out two failures:

  • Too many wholes. Two distinct elements at a restrict to the same family, so agreeing on every leg does not make two things equal, and nothing can be proved by taking a apart.
  • Too few. A matching family is the restriction of no element at a, so compatible local data cannot be assembled, and nothing can be built by putting a together.

Neither implies the other, and counting the two sides decides neither:

                                               elements at a   matching families   verdict
the representable at FLS, Atomic on BOOL             0                 1           too few
the constant presheaf, Joins on (BOOL, BOOL)         2                 1           too many
the collapsing presheaf, Atomic on BOOL              2                 2           not injective

Overlap is stated over every commuting square, not over the pullback, so two legs need not have a pullback object. Sums relies on this: it works over a free category that has none.

The arrows into a that factor through some leg form the sieve the cover generates. Covers are given by their legs because a list of legs is finite and a sieve usually is not. Sieves are the truth values of presheaf categories, see Proarrow.Profunctor.Instance.Sieve. When covers are stable and compose, the coverage generates a Grothendieck topology; Sums shows it need not.

Covers given by generating arrows, and gluing as an operation rather than a condition, follow Arnaud Spiwack's Sheaves in Haskell (Tweag, 2026, https://www.tweag.io/blog/2026-06-18-sheaves-in-haskell/). Added here: the category, the sieves, the classifier and a decision procedure for the sheaf condition, the last three in Proarrow.Category.Enriched.Finitary.Sheaf.

Synopsis

Sites

type Coverage = Type Source Github #

The kind of coverage names. A coverage is named by an empty type, the first argument of Site, and has no values.

class CategoryOf k => Site t k where Source Github #

A coverage, named t, on the category k. Several coverages can live on one category, so the name is a parameter rather than a wrapper on the kind.

A cover is given by its legs, the arrows of the covering family. Every object is covered by its identity; that cover is left implicit, and Cover and covers list the others. The laws are

Stability
covers pull back: restricting a cover of a to a part b of a gives a cover of b. Given a cover c of a and any f :: b ~> a, the object b has a cover (possibly just its identity) each of whose legs h satisfies f . h = legArrow g . h' for some leg g of c and some h'. Only the equation is asked for. No pullback object has to exist.
Naming
a family over a cover c, a function forall x. Leg t k a c x -> r as glue takes and PulledBack carries, is consulted only at the legs of c: those in legs c, or built from the cover's own data. Its values at other legs are unspecified.

Naming matters when several covers share a type-level name c, as Atomic's do on a category that is not thin and Joins's always do. Then Leg also admits the legs of the other covers with that name, so a hand-written glue takes its legs from the cover it was given.

Associated Types

data Cover t k (a :: k) c Source Github #

A cover of a. The type c names it, so that Leg can say which cover a leg belongs to; the value is the evidence that c covers a.

data Leg t k (a :: k) c (x :: k) Source Github #

A leg of the cover c of a, with source x.

Methods

legArrow :: forall (a :: k) c (x :: k). Leg t k a c x -> x ~> a Source Github #

The arrow a leg stands for.

legs :: forall (a :: k) c. Cover t k a c -> [SomeLeg t k a c] Source Github #

The legs of a cover.

Instances

Instances details
(HasPullbacks k, FiniteCat k) => Site Atomic k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg Atomic k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover Atomic k a c -> [SomeLeg Atomic k a c] Source Github #

(Thin k, FiniteCat k, Bicartesian k) => Site Joins k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg Joins k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover Joins k a c -> [SomeLeg Joins k a c] Source Github #

CategoryOf k => Site Trivial k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg Trivial k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover Trivial k a c -> [SomeLeg Trivial k a c] Source Github #

Elem HasBinaryCoproducts cs => Site Sums (FREE cs p) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: FREE cs p) c (x :: FREE cs p). Leg Sums (FREE cs p) a c x -> x ~> a Source Github #

legs :: forall (a :: FREE cs p) c. Cover Sums (FREE cs p) a c -> [SomeLeg Sums (FREE cs p) a c] Source Github #

(Corepresentable w, Finitary w, FiniteCat k) => Site (ByImage w) j Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: j) c (x :: j). Leg (ByImage w) j a c x -> x ~> a Source Github #

legs :: forall (a :: j) c. Cover (ByImage w) j a c -> [SomeLeg (ByImage w) j a c] Source Github #

(Site t j, Corepresentable w, LocallyFinite j, FiniteCat k) => Site (Induced t w) k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg (Induced t w) k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover (Induced t w) k a c -> [SomeLeg (Induced t w) k a c] Source Github #

data SomeLeg t k (a :: k) c where Source Github #

A leg of the cover c of a, with its source hidden.

Constructors

SomeLeg :: forall t k (a :: k) c (x :: k). Leg t k a c x -> SomeLeg t k a c 

class Site t k => HasFiniteCovers t k where Source Github #

A site whose covers can be listed, object by object, as the law tests and the decision procedure of Proarrow.Category.Enriched.Finitary.Sheaf need. A free category is a Site but not this: its Ob cannot tell whether an object is a sum.

Composition
covers compose. If c covers a and every leg of c is itself covered, the composites cover a too. With Stability this makes the coverage generate a Grothendieck topology, so closure is idempotent and preserves meets, which Plus needs. testLawvereTierney is the check.

Methods

covers :: forall (a :: k). Ob a => [SomeCover t k a] Source Github #

The covers of an object, beyond the identity.

Instances

Instances details
(HasPullbacks k, FiniteCat k) => HasFiniteCovers Atomic k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover Atomic k a] Source Github #

(Thin k, FiniteCat k, Bicartesian k) => HasFiniteCovers Joins k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover Joins k a] Source Github #

CategoryOf k => HasFiniteCovers Trivial k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover Trivial k a] Source Github #

(Corepresentable w, Finitary w, FiniteCat k) => HasFiniteCovers (ByImage w) j Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: j). Ob a => [SomeCover (ByImage w) j a] Source Github #

(HasFiniteCovers t j, Corepresentable w, LocallyFinite j, FiniteCat k) => HasFiniteCovers (Induced t w) k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover (Induced t w) k a] Source Github #

data SomeCover t k (a :: k) where Source Github #

A cover of a, with its name hidden.

Constructors

SomeCover :: forall t k (a :: k) c. Cover t k a c -> SomeCover t k a 

data Factors t k (a :: k) c (x :: k) where Source Github #

How an arrow into a factors through a cover of a: the leg it goes through, and the arrow to that leg's source. The equation f = legArrow g . h is the caller's to rely on and the instance's to respect.

Constructors

Factors :: forall t k (a :: k) c (y :: k) (x :: k). Leg t k a c y -> (x ~> y) -> Factors t k a c x 

factorThroughCover :: forall t k (a :: k) c (x :: k). (Site t k, LocallyFinite k) => Cover t k a c -> (x ~> a) -> Maybe (Factors t k a c x) Source Github #

How an arrow into a factors through a cover of a, if it does: through the first leg it factors through, found by factorThrough. Only the hom-sets have to be finite.

data PulledBack t k (a :: k) c (b :: k) where Source Github #

A cover pulled back along an arrow f :: b ~> a: either f itself factors through a leg (the pullback is b's implicit identity cover), or some cover of b has every leg factoring through one.

Constructors

AlreadyFactors :: forall t k (a :: k) c (b :: k). Factors t k a c b -> PulledBack t k a c b 
PulledBack :: forall t k (b :: k) c' (a :: k) c. Cover t k b c' -> (forall (x :: k). Leg t k b c' x -> Factors t k a c x) -> PulledBack t k a c b 

class Site t k => StableSite t k where Source Github #

Site's Stability law as an operation: a pullback one can compute with, carrying the factorisation of each new leg through an old one. It lets a sheaf be glued structurally. Without it, gluing into a carrier with no glue of its own (an internal hom, the closed sieves) means searching the carrier's elements (glueBySearch), which needs the carrier to be finitary.

Separate from Site because Sums cannot implement it: a free bicartesian category is not extensive, so its covers do not pull back.

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover t k a c -> (b ~> a) -> PulledBack t k a c b Source Github #

Instances

Instances details
(HasPullbacks k, FiniteCat k) => StableSite Atomic k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover Atomic k a c -> (b ~> a) -> PulledBack Atomic k a c b Source Github #

(Thin k, FiniteCat k, Bicartesian k) => StableSite Joins k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover Joins k a c -> (b ~> a) -> PulledBack Joins k a c b Source Github #

CategoryOf k => StableSite Trivial k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover Trivial k a c -> (b ~> a) -> PulledBack Trivial k a c b Source Github #

(Corepresentable w, Finitary w, FiniteCat k) => StableSite (ByImage w) j Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: j) (a :: j) c. Ob b => Cover (ByImage w) j a c -> (b ~> a) -> PulledBack (ByImage w) j a c b Source Github #

(StableSite t j, Corepresentable w, LocallyFinite j, FiniteCat k) => StableSite (Induced t w) k Source Github #

Pulling back along h' is pulling the cover of F d back along F h'.

Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover (Induced t w) k a c -> (b ~> a) -> PulledBack (Induced t w) k a c b Source Github #

pullbackAlongId :: forall t k (a :: k) c. Site t k => Cover t k a c -> PulledBack t k a c a Source Github #

A cover pulled back along the identity of the object it covers: itself, each leg factoring through itself. Every instance needs this clause, and this version cannot get it wrong. In a hand-written one, naming another leg with the same source type-checks.

Sheaves

class (Site t k, Profunctor p) => Sheaf t (p :: j +-> k) where Source Github #

A profunctor that is a sheaf for the coverage t on its contravariant side: every matching family over a cover glues to one element. A family m over the legs of a cover c is matching when it agrees on overlaps: for legs g, g' and any u :: z ~> x, v :: z ~> y with legArrow g . u = legArrow g' . v, lmap u (m g) = lmap v (m g'). Sums below is the smallest worked instance. The laws are

Restriction
for matching m, lmap (legArrow g) (glue c m) = m g at every leg g of c: the gluing restricts back to the family;
Uniqueness
glue c (\g -> lmap (legArrow g) x) = x: an element is the gluing of its own restrictions.

Together they make restriction a bijection from the elements at a to the matching families on c. On a non-matching family glue is unspecified. The Sums instance keeps one leg's covariant component and drops the other, which is sound only because matching forces them equal.

p is a sheaf when each presheaf p (-) b is one, and glue is stated for every b at once. A cosheaf, gluing on the covariant side, is a Sheaf t (Op p) for a coverage on OPPOSITE k. The library defines no such coverage.

Instances are indexed by the shape of the profunctor: the limits below, a site's representables, and the image of sheafification. An instance per coverage would overlap all of them, so Trivial gets the function glueTrivial instead.

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> p x b) -> p a b Source Github #

Instances

Instances details
(Site t k, CategoryOf j) => Sheaf t (TerminalProfunctor :: k -> j -> Type) Source Github #

The limits of profunctors are sheaves whenever their factors are: the terminal profunctor for every coverage, and a product of sheaves glued componentwise.

Instance details

Defined in Proarrow.Category.Sheaf

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> TerminalProfunctor x b) -> TerminalProfunctor a b Source Github #

(StableSite t k, CategoryOf j) => Sheaf t (ClosedSieve t :: k -> j -> Type) Source Github #

The classifier is a sheaf, with gluing built directly: the glued sieve contains g iff every leg of the cover pulled back along g is in the sieve of the family member it factors through. Anything in the glued sieve passes this test, since sieves are closed under precomposition, and anything that passes is in it, since the sieves are closed.

Instance details

Defined in Proarrow.Category.Enriched.Finitary.Sheaf

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> ClosedSieve t x b) -> ClosedSieve t a b Source Github #

(Site t k, LocallyFinite k, CategoryOf j) => Sheaf t (Sheafify t p :: k -> j -> Type) Source Github #

Sheafification lands in the sheaves (isSheaf @t @(Sheafify t p) confirms it by enumeration), so a Sheafify can be used wherever a Sheaf is asked for.

gluePlus is lawful only on a separated q, which Plus t p always is, hence the double plus in the head. The also true Sheaf t p => Sheaf t (Plus t p) would overlap this instance with neither more specific.

Instance details

Defined in Proarrow.Category.Enriched.Finitary.Sheaf

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> Sheafify t p x b) -> Sheafify t p a b Source Github #

(StableSite t k, Sheaf t q, Profunctor p, CategoryOf j) => Sheaf t (p :~>: q :: k -> j -> Type) Source Github #

The presheaf internal hom into a sheaf is already a sheaf: a matching family of maps p -> q over a cover glues pointwise, because the values glue in q. p needs no condition.

The glued map, at an arrow g into a, pulls the cover back along g (StableSite). Each pulled-back leg factors through an original leg, whose map is asked, and the answers are glued in q. Neither p nor q has to be Finitary. The generic glueBySearch would be exponential in the size of p.

Instance details

Defined in Proarrow.Category.Enriched.Finitary.Sheaf

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> (p :~>: q) x b) -> (p :~>: q) a b Source Github #

(Sheaf t p, Sheaf t q) => Sheaf t (p :*: q :: k -> j -> Type) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> (p :*: q) x b) -> (p :*: q) a b Source Github #

Sheaf t p => Sheaf t (Reindex 'Subobject p fs :: k -> j -> Type) Source Github #

Restricting a sheaf to a subobject gives a sheaf, provided the subobject is a subsheaf: the element glued from a family of kept elements must be kept too. The tables of equalize and the pullbacks are subsheaves. This is a precondition, and a violation fails loudly: toIndex finds the glued element in no fibre.

There is no instance for Quotient. A quotient of a sheaf is no sheaf in general (glue would depend on which representative of each class it was handed), so colimits of sheaves go through sheafification.

Instance details

Defined in Proarrow.Category.Enriched.Finitary.Topos

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> Reindex 'Subobject p fs x b) -> Reindex 'Subobject p fs a b Source Github #

(Site t k, FiniteCat j, FiniteCat k, KnownTables j k lm rm) => Sheaf t (Tabulated t lm rm :: k -> j -> Type) Source Github #

A tabulated profunctor glues by search, since it knows nothing of the profunctor it presents. Only for the coverage its tag names. The tag is the only evidence that the search will find its element, so a presentation may be used as a sheaf for the coverage it was checked against and for no other. At Trivial, which withTabulated applies and which has no covers, the instance is vacuous and glueBySearch is unreachable.

Instance details

Defined in Proarrow.Category.Enriched.Finitary.Topos

Methods

glue :: forall (a :: k) c (b :: j). (Ob a, Ob b) => Cover t k a c -> (forall (x :: k). Leg t k a c x -> Tabulated t lm rm x b) -> Tabulated t lm rm a b Source Github #

(Corepresentable w, Finitary w, FiniteCat k, Profunctor q) => Sheaf (ByImage w) (Rift ('OP w) q :: j -> i -> Type) Source Github #

The extension of a presheaf along w is a sheaf: gluing reads each leg's family at the identity of its source.

Instance details

Defined in Proarrow.Category.Sheaf

Methods

glue :: forall (a :: j) c (b :: i). (Ob a, Ob b) => Cover (ByImage w) j a c -> (forall (x :: j). Leg (ByImage w) j a c x -> Rift ('OP w) q x b) -> Rift ('OP w) q a b Source Github #

(Elem HasBinaryCoproducts cs, Elem HasInitialObject cs, CategoryOf j) => Sheaf Sums (Yo x ('OP b) :: FREE cs p -> j -> Type) Source Github #

Sums are colimits, so the representables are sheaves for Sums: gluing is ||| on the contravariant component.

The initial object is needed too. An element of Yo x (OP b) also has a covariant component b ~> d. A family over the two injections has one per leg, and the glued element only one. Matching forces the two to agree because the injections overlap at the initial object, lft . initiate = rgt . initiate. Without it every family matches vacuously, and restriction fails for any j with a hom-set bigger than one.

Instance details

Defined in Proarrow.Category.Sheaf

Methods

glue :: forall (a :: FREE cs p) c (b0 :: j). (Ob a, Ob b0) => Cover Sums (FREE cs p) a c -> (forall (x0 :: FREE cs p). Leg Sums (FREE cs p) a c x0 -> Yo x ('OP b) x0 b0) -> Yo x ('OP b) a b0 Source Github #

Coverages

data Trivial Source Github #

The trivial coverage: only identities cover, so every profunctor is a sheaf.

Instances

Instances details
CategoryOf k => HasFiniteCovers Trivial k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover Trivial k a] Source Github #

CategoryOf k => Site Trivial k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg Trivial k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover Trivial k a c -> [SomeLeg Trivial k a c] Source Github #

CategoryOf k => StableSite Trivial k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover Trivial k a c -> (b ~> a) -> PulledBack Trivial k a c b Source Github #

data Cover Trivial k (a :: k) c Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Cover Trivial k (a :: k) c
data Leg Trivial k (a :: k) c (x :: k) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Leg Trivial k (a :: k) c (x :: k)

glueTrivial :: forall {k1} k2 (a :: k2) c p (b :: k1). Cover Trivial k2 a c -> (forall (x :: k2). Leg Trivial k2 a c x -> p x b) -> p a b Source Github #

Every profunctor is a sheaf for Trivial, by the eliminator of an empty Cover. This is a function rather than an instance Sheaf Trivial p because that head and the two closure instances above overlap (at Sheaf Trivial TerminalProfunctor, say) with neither more specific than the other, so GHC could not choose between them. Write glue = glueTrivial to get the instance for one profunctor.

data Atomic Source Github #

The atomic coverage: every single arrow into an object covers it. So a sieve is covering iff it is nonempty (the atomic topology, with HasPullbacks as its Ore condition). A sheaf is a profunctor whose restriction along every arrow is a bijection. On a chain that is a presheaf that is constant up to iso.

Stability is the pullback square: pulling a leg back along an arrow into its target gives the cover of that arrow's source by the pullback projection, and the other projection factors it through the old leg. Covers compose, since a composite of single arrows is a single arrow. This is the first coverage here whose legs are themselves covered, so it is the first to exercise HasFiniteCovers's Composition law.

The identity is listed as a cover too. It decides nothing new, and dropping it would take deciding b ~ a under foreachOb, which a coverage generic in k cannot do.

Instances

Instances details
(HasPullbacks k, FiniteCat k) => HasFiniteCovers Atomic k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover Atomic k a] Source Github #

(HasPullbacks k, FiniteCat k) => Site Atomic k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg Atomic k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover Atomic k a c -> [SomeLeg Atomic k a c] Source Github #

(HasPullbacks k, FiniteCat k) => StableSite Atomic k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover Atomic k a c -> (b ~> a) -> PulledBack Atomic k a c b Source Github #

data Cover Atomic k (a :: k) c Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Cover Atomic k (a :: k) c where
data Leg Atomic k (a :: k) c (x :: k) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Leg Atomic k (a :: k) c (x :: k) where

data Along (b :: k) Source Github #

The name of the Atomic cover of an object by a single arrow out of b: the Cover constructor is Solely and its one Leg constructor is Only. Two distinct arrows b ~> a share the name, so the name is not a singleton, and Site's Naming law makes that harmless: pullbackCover answers for the leg of the cover it built, and says nothing true about an Only built from another arrow. On a thin category the arrow is unique and the name a singleton after all.

data Joins Source Github #

The open-cover coverage of a finite distributive lattice: an object is covered by any family of objects below it whose join it is. Read the lattice as the opens of a finite space and its sheaves are the sheaves on that space: a section over an open is determined by, and assembled from, its sections over any opens that cover it. On (BOOL, BOOL), the opens of the discrete two-point space (see Proarrow.Category.Instance.Product), the whole space is covered by its two points.

The empty family covers the bottom, the join of nothing, so a sheaf has exactly one section over the bottom, as over the empty set. On a chain nothing else is covered.

covers lists the antichains strictly below an object that join to it, found by enumerating subsets, so it is for small lattices only. Other families generate the same sieves.

The instances ask for Bicartesian (meet is the product, join the coproduct) and Thin, so that "is there an arrow" reads as <=. FINSET is bicartesian and distributive but not thin, and this coverage would mean nothing there. Distributivity gives stability: pulled back along b <= a, a cover {x_i} of a becomes {b && x_i}, whose join is b. Covers compose, since a join of joins is a join. The topology is subcanonical (representable presheaves are sheaves), but a two-sided Yo a (OP b) need not be one: the empty cover asks for one element at the bottom for every object of j, and it has none at an object b has no arrow to.

The finite, stable counterpart of Sums: a distributive lattice is the thin case of the extensivity that a free bicartesian category lacks.

Instances

Instances details
(Thin k, FiniteCat k, Bicartesian k) => HasFiniteCovers Joins k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover Joins k a] Source Github #

(Thin k, FiniteCat k, Bicartesian k) => Site Joins k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg Joins k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover Joins k a c -> [SomeLeg Joins k a c] Source Github #

(Thin k, FiniteCat k, Bicartesian k) => StableSite Joins k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover Joins k a c -> (b ~> a) -> PulledBack Joins k a c b Source Github #

data Cover Joins k (a :: k) c Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Cover Joins k (a :: k) c where
data Leg Joins k (a :: k) c (x :: k) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Leg Joins k (a :: k) c (x :: k) where

data Join Source Github #

The name of every Joins cover: the Cover constructor is ByJoin, holding its legs, and the Leg constructor is Under, one per member of the family. A ByJoin is a cover of a only when its legs join to a; covers lists exactly the antichains that do. All the covers of an object share the name, so Site's Naming law matters here: a family over one of them is not asked about the legs of another.

sourceBelow :: forall {k} (x :: k) (y :: k) (a :: k) (b :: k). FiniteCat k => (x ~> a) -> (y ~> b) -> Bool Source Github #

Whether the source of the first arrow is below that of the second: in a thin category, whether there is an arrow between them at all.

legBelow :: forall k (a :: k). FiniteCat k => SomeLeg Joins k a Join -> SomeLeg Joins k a Join -> Bool Source Github #

Whether one leg's source is below the other's.

joinOf :: forall {k} (a :: k) r. (HasBinaryCoproducts k, HasInitialObject k, Ob a) => [SomeLeg Joins k a Join] -> (forall (j :: k). (j ~> a) -> r) -> r Source Github #

The join of the legs' sources, as the arrow it has into their common target: the copairing of the legs, starting from the initial object.

pullbackJoin :: forall {k} (b :: k) (a :: k). (Thin k, FiniteCat k, Bicartesian k, Ob b) => Cover Joins k a Join -> [SomeLeg Joins k a Join] -> (b ~> a) -> PulledBack Joins k a Join b Source Github #

Joins's Stability: the meets of the source with the legs. Each is below its leg, so the factorisation is found by factorThroughCover; it is recomputed per leg rather than carried, as a leg is only its arrow. The search fails only for a leg of some other cover of b, which Site's Naming law rules out.

data Sums Source Github #

The sum coverage on a free category with binary coproducts: a sum is covered by its two injections. This is the syntactic site of Spiwack's post (see the module header). In the free bicartesian closed category FREE cs p, the booleans TermF + TermF are covered by true and false.

Read p a as the ways of producing an a. Being a sheaf means p Bool ≅ p TermF × p TermF: every pair of branches has a conditional, and only one. With too many, a proof by cases establishes nothing. With too few, if-then-else is not definable. On a representable the conditional is |||, which is why glue below is [t, e]. The conditional on a test f :: c ~> Bool uses the distributive law as well, as in caseOf.

Stability does not hold. It would need every arrow into a sum to split its source into a sum (extensivity), and a free bicartesian category is not extensive. The restriction of id ||| lft :: (u + u) + u ~> u + u to the left summand is id, which factors through neither injection. With a richer constraint list, mempty :: UnitF ~> u + u has a source that is not a sum at all. So the coverage generates no Grothendieck topology. Nothing here relies on stability: glue's laws are the coproduct's universal property, and FREE cannot list the covers of an arbitrary object, so it is not a HasFiniteCovers and the topology machinery never runs at it.

Instances

Instances details
Elem HasBinaryCoproducts cs => Site Sums (FREE cs p) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: FREE cs p) c (x :: FREE cs p). Leg Sums (FREE cs p) a c x -> x ~> a Source Github #

legs :: forall (a :: FREE cs p) c. Cover Sums (FREE cs p) a c -> [SomeLeg Sums (FREE cs p) a c] Source Github #

(Elem HasBinaryCoproducts cs, Elem HasInitialObject cs, CategoryOf j) => Sheaf Sums (Yo x ('OP b) :: FREE cs p -> j -> Type) Source Github #

Sums are colimits, so the representables are sheaves for Sums: gluing is ||| on the contravariant component.

The initial object is needed too. An element of Yo x (OP b) also has a covariant component b ~> d. A family over the two injections has one per leg, and the glued element only one. Matching forces the two to agree because the injections overlap at the initial object, lft . initiate = rgt . initiate. Without it every family matches vacuously, and restriction fails for any j with a hom-set bigger than one.

Instance details

Defined in Proarrow.Category.Sheaf

Methods

glue :: forall (a :: FREE cs p) c (b0 :: j). (Ob a, Ob b0) => Cover Sums (FREE cs p) a c -> (forall (x0 :: FREE cs p). Leg Sums (FREE cs p) a c x0 -> Yo x ('OP b) x0 b0) -> Yo x ('OP b) a b0 Source Github #

data Cover Sums (FREE cs p) (a :: FREE cs p) c Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Cover Sums (FREE cs p) (a :: FREE cs p) c where
data Leg Sums (FREE cs p) (a :: FREE cs p) c (z :: FREE cs p) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Leg Sums (FREE cs p) (a :: FREE cs p) c (z :: FREE cs p) where

data Summands (x :: k) (y :: k) Source Github #

The name of the cover of x + y by its injections, whose Cover constructor is BySummands and whose Leg constructors are AtLeft and AtRight.

data ByImage (w :: j +-> k) Source Github #

The coverage by the image of a functor. A Corepresentable w is a functor F = w %% - from k to j, with w d c ≅ F d ~> c. Every object c of j is covered by all the arrows into it from the image, F d ~> c, so a leg is an element of w. For an object in the image the cover contains its identity and asks nothing.

It is stable, since pulling a leg back along g is composing with g, and the covers compose, since the cover of a leg's source is again an image cover, and contains that source's identity. A presheaf on k extends to a sheaf on j: its right Kan lift q <| w (Rift), whose value at c is a family over all the arrows F d ~> c. The restriction of a sheaf back to k is w :.: s, and the two are adjoint by the Corepresentable instance of Star (Rift (OP w)).

The comparison lemma needs F to be fully faithful: corepMap is a bijection on each hom-set, equivalently (~>) ≅ w |> w (testRanFullyFaithful). Then the unit of the adjunction is an isomorphism exactly on the sheaves, the counit is an isomorphism, and the sheaves are the presheaves on k. Without it the coverage is still lawful, but its sheaves are the presheaves on the full subcategory of j on the objects F d. When F sends two objects to one, every presheaf is a sheaf, and the unit is a diagonal.

Two examples: the left inclusion of a collage, whose other objects are covered by the arrows from the left layer, and the edges of a graph, covering each vertex by the two ends of an edge.

Instances

Instances details
(Corepresentable w, Finitary w, FiniteCat k, Profunctor q) => Sheaf (ByImage w) (Rift ('OP w) q :: j -> i -> Type) Source Github #

The extension of a presheaf along w is a sheaf: gluing reads each leg's family at the identity of its source.

Instance details

Defined in Proarrow.Category.Sheaf

Methods

glue :: forall (a :: j) c (b :: i). (Ob a, Ob b) => Cover (ByImage w) j a c -> (forall (x :: j). Leg (ByImage w) j a c x -> Rift ('OP w) q x b) -> Rift ('OP w) q a b Source Github #

(Corepresentable w, Finitary w, FiniteCat k) => HasFiniteCovers (ByImage w) j Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: j). Ob a => [SomeCover (ByImage w) j a] Source Github #

(Corepresentable w, Finitary w, FiniteCat k) => Site (ByImage w) j Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: j) c (x :: j). Leg (ByImage w) j a c x -> x ~> a Source Github #

legs :: forall (a :: j) c. Cover (ByImage w) j a c -> [SomeLeg (ByImage w) j a c] Source Github #

(Corepresentable w, Finitary w, FiniteCat k) => StableSite (ByImage w) j Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: j) (a :: j) c. Ob b => Cover (ByImage w) j a c -> (b ~> a) -> PulledBack (ByImage w) j a c b Source Github #

data Cover (ByImage w) j (a :: j) c Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Cover (ByImage w) j (a :: j) c where
data Leg (ByImage w) j (a :: j) c (x :: j) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Leg (ByImage w) j (a :: j) c (x :: j) where

data Image Source Github #

The name of the one ByImage cover of an object, whose Cover constructor is Images and whose Leg constructor is FromImage, one leg per element of w.

data Induced t (w :: j +-> k) Source Github #

The coverage induced along a functor. For a coverage t on j and a functor F = w %% - from k to j, a cover of d is a t-cover c of F d, and its legs are all the arrows h :: e ~> d whose image F h factors through a leg of c.

The comparison lemma: when F is fully faithful and every object of j is covered by arrows out of the image (testCoveredByImage), the sheaves for t are the sheaves for Induced t w. Restriction is w :.: s and extension is the right Kan lift q <| w, glued by glueExtension, the adjunction of ByImage. ByImage is the case where t has only the image covers. Then every induced cover contains an identity, and every presheaf on k is a sheaf.

The opens of a space and a basis of it are the standard example: sheaves on the space are sheaves on the basis.

Instances

Instances details
(HasFiniteCovers t j, Corepresentable w, LocallyFinite j, FiniteCat k) => HasFiniteCovers (Induced t w) k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

covers :: forall (a :: k). Ob a => [SomeCover (Induced t w) k a] Source Github #

(Site t j, Corepresentable w, LocallyFinite j, FiniteCat k) => Site (Induced t w) k Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

Methods

legArrow :: forall (a :: k) c (x :: k). Leg (Induced t w) k a c x -> x ~> a Source Github #

legs :: forall (a :: k) c. Cover (Induced t w) k a c -> [SomeLeg (Induced t w) k a c] Source Github #

(StableSite t j, Corepresentable w, LocallyFinite j, FiniteCat k) => StableSite (Induced t w) k Source Github #

Pulling back along h' is pulling the cover of F d back along F h'.

Instance details

Defined in Proarrow.Category.Sheaf

Methods

pullbackCover :: forall (b :: k) (a :: k) c. Ob b => Cover (Induced t w) k a c -> (b ~> a) -> PulledBack (Induced t w) k a c b Source Github #

data Cover (Induced t w) k (d :: k) c Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Cover (Induced t w) k (d :: k) c where
data Leg (Induced t w) k (d :: k) c (e :: k) Source Github # 
Instance details

Defined in Proarrow.Category.Sheaf

data Leg (Induced t w) k (d :: k) c (e :: k) where

glueExtension :: forall t {i} {j} {k} (w :: j +-> k) (q :: i +-> k) (a :: j) c (b :: i). (StableSite t j, Corepresentable w, LocallyFinite j, FiniteCat k, Sheaf (Induced t w) q, Ob a, Ob b) => Cover t j a c -> (forall (x :: j). Leg t j a c x -> Rift ('OP w) q x b) -> Rift ('OP w) q a b Source Github #

The extension of a sheaf for the induced coverage is a sheaf for t. Its value at x :: F e ~> a is found by pulling the cover back along x and gluing in q over the induced cover of e.

A function instead of an instance, because an instance would overlap the ByImage one.