In a Topos, the quantifiers and turn a Predicate of variables into predicates and on . They are defined purely from the topos structure:
- Universal: is the Subobject of obtained by pulling back (the currying of ) along the currying of (Currying, Exponential Object).
- Existential: take the subobject classified by , compose with the projection , and take the Epi-Mono Factorization; the mono part is the image.
Sources: 7 Sketches §7.4.4 (“Quantification”), Example 7.65, Exercises 7.66–7.68; §7.2.1 (epi-mono factorizations “in any topos”); DaoFP §11.4–11.5 (dependent sum and product as adjoints to substitution).
In
For , : holds exactly for , for all , for no , and for all (7S Exercise 7.66).
In a sheaf topos
For a section :
- is the largest open such that for all .
- is the union of all opens for which some satisfies . If the result is all of this does not mean a single works — only a cover with local witnesses : “the existential quantifier is doing a lot of work under the hood, taking coverings into account”.
Example 7.65: = people, = newsworthy items, = ” is worried about “. Then is the time during which is worried about everything in the news (7S Exercise 7.67), and is the time during which is worried about something — the worrying item being allowed to change over time (7S Exercise 7.68).
Adjoint form
Quantifiers are the adjoints of pullback: on subobject posets — the same triple as Direct Image, Preimage, and Dual Image for sets, and as Dependent Sum substitution Dependent Product for types (Lawvere: “quantifiers are adjoints”).
Docs: FinSets · Limits & colimits · C-set morphisms
using Catlab
# Set: quantify the finite predicate p(n, z) = (n ≤ |z|) on 0:3 × -3:3
N = 0:3; Z = -3:3
p(n, z) = n <= abs(z)
[n for n in N if all(p(n, z) for z in Z)] # ∀z: [0]
[n for n in N if any(p(n, z) for z in Z)] # ∃z: [0, 1, 2, 3]
# ∃ as the image of a subobject along a projection, in FinSet:
S = FinSet(length(N)); T = FinSet(length(Z))
P = product(S, T); πS = proj1(P)
sub = Subobject(ob(P), [i for i in 1:length(ob(P)) if p(N[πS(i)], Z[proj2(P)(i)])])
image = first(epi_mono(hom(sub) ⋅ πS)) # ∃_t p as the epi part's codomain
collect(compose(hom(sub), πS)) |> unique |> sort # elements of S in ∃z.pimport Mathlib
-- quantifiers as adjoints to preimage on Set: ∃ (image) ⊣ preimage ⊣ ∀ (dual image)
#check @Set.image_subset_iff -- f '' s ⊆ t ↔ s ⊆ f ⁻¹' t (∃_f ⊣ f^*)
#check @Set.preimage -- f^*
#check @CategoryTheory.Subobject.pullback-- quantifying a finite predicate over T
forallT, existsT :: [t] -> (s -> t -> Bool) -> (s -> Bool)
forallT ts p s = all (p s) ts
existsT ts p s = any (p s) ts
-- ∃ as image: existsT ts p s == s `elem` map fst (filter (uncurry p) [(s', t) | s' <- [s], t <- ts])