For a Preorder and , the principal upper set is . Then:
- is an Upper Set;
- is a Monotone Map (from the Opposite Preorder);
- in if and only if .
Source: 7 Sketches Exercise 1.66 (“the Yoneda lemma for preorders”); Kittenlab Lecture 10, 12.
Proof. (1) If and then , so . (2) If then for we get , so ; this is monotonicity from . (3) Monotonicity gives one direction; conversely always, so forces , i.e. .
“Up to equivalence, to know an element is the same as knowing its upper set — its web of relationships with the other elements.” The general Yoneda Lemma says the same for a Category: an object is determined by its representable functor (Kittenlab: if and otherwise, so iff ). Upper sets are the -valued copresheaves, and is the Yoneda Embedding.
Picture for : , , ; the map reverses the order.
Docs: Kittenlab Lecture 10
principal_up(leq, xs, p) = Set(q for q in xs if leq(p, q))
# Yoneda: p ≤ p' iff ↑p' ⊆ ↑p
xs = [:a, :b, :c]; leq(x, y) = x == y || x == :a
all(leq(p, q) == issubset(principal_up(leq, xs, q), principal_up(leq, xs, p)) for p in xs, q in xs)#check @Set.Ici -- ↑p as a set
#check @Set.Ici_subset_Ici -- Ici a ⊆ Ici b ↔ b ≤ a (part 3)
#check @UpperSet.Ici -- as a bundled upper setprincipalUp :: Preorder a => [a] -> a -> [a]
principalUp xs p = [q | q <- xs, leq p q]
yonedaPre :: (Preorder a, Eq a) => [a] -> a -> a -> Bool
yonedaPre xs p p' = all (`elem` principalUp xs p) (principalUp xs p') -- == leq p p'