In a Topos a predicate on an object is a morphism into the Subobject Classifier. Equivalently (by the classifier property) it is a Subobject , “the elements of for which holds”. A predicate on the Terminal Object is a proposition; the set of propositions is written .
Sources: 7 Sketches §7.2.2 (“A predicate on is a morphism ”), §7.4.3 (“Predicates”, “The poset of subobjects”), Eq. (7.63), Exercises 7.62, 7.64.
- In : is a Boolean-valued function, e.g.
likes_cats : People → 𝔹, and is the subset of people who like cats. Logical operations on predicates are set operations on subsets: AND is intersection. - In : a predicate gives for each open a function ; applied to a section it returns an open subset — the region where holds of . If is the sheaf of people over time and = “likes the weather”, is the set of times at which Bob likes the weather: “in summers yes, in April 2018 yes, otherwise no”. The subsheaf has as sections over the people alive throughout who like the weather throughout (7S Exercise 7.62).
- The poset of predicates , Eq. (7.63): iff for every and — ” implies ”, written . It is a Partial Order (since forces ) and in fact a Heyting Algebra: are computed pointwise (Internal Logic of a Topos). Quantification turns a predicate on into one on .
Docs: FinSets · C-set morphisms
using Catlab
# predicates on a finite set as Bool vectors; the poset of predicates is Sub(S)
S = FinSet(6)
p = Subobject(S, [2, 4, 6]) # "even"
q = Subobject(S, [2, 3, 5]) # "prime"
collect(hom(p ∧ q)), collect(hom(p ∨ q)) # [2], [2, 3, 4, 5, 6]
# the same predicates as Bool vectors S → 𝔹, ordered pointwise
pv = [iseven(n) for n in 1:6]; qv = [n in (2, 3, 5) for n in 1:6]
all(pv .<= qv) # false: "even" does not entail "prime"import Mathlib
-- in Type, predicates S → Prop are the same as Set S, ordered by implication
example (S : Type) (p q : S → Prop) : (∀ s, p s → q s) ↔ ({s | p s} ⊆ {s | q s}) := Iff.rfl
#check @CategoryTheory.Subobject.instPartialOrdertype Pred s = s -> Bool
implies :: Pred s -> Pred s -> Pred s -- pointwise Heyting implication on Bool
implies p q s = not (p s) || q s
entails :: [s] -> Pred s -> Pred s -> Bool -- p ⊢ q on a finite carrier
entails univ p q = all (\s -> not (p s) || q s) univ