meeting -*- Outline -*- * Posets, Lattices, and Categories (chapter 2) This is background for formalizing the refinement calculus. these concepts are also quite often used in denotational semantics, and in other contexts in semantics. The following is from Appendix A ------------------------------------------ ASCII NOTATION In the following, we write ``.'' for function application, ``!'' for complement, ``;'' for forward composition, ``o'' for backward composition _ ``\meet'' for meet (| |), ``\intersect'' for intersection, ``\join'' for join (|_|), ``\union'' for union, ``<='' for the ordering (\sqsubseteq), ``>='' for the inverse ordering, ``<'' for strict ordering (\sqsubset), ``>'' for strict inverse ordering ``\subseteq'' for non-strict subset, ``\supseteq'' for nonstrict superset, ``\subset'' for strict subset, ``\supset'' for strict superset, ``=='' for equality, ``/\'' for conjunction (and), ``\/'' for disjunction (or) ``==>'' for implication ``<=='' for consequence ``<==>'' for logical equivalence This table is also arranged in precedence order, with "not" having the highest precedence (binding most tightly). ------------------------------------------ Although Back and von Wright distinguish precedence levels for \meet and \intersect vs. \join and \union, and between conjunction and disjunction, I won't do that. ** partially ordered sets (2.1) Q: what is a preorder? a relation that is reflexive and transitive Q: what is a preordered set? a pair consisting of a set and a preorder subtyping can be naturally viewed as a preorder... Q: what is a partial order? a preorder that is antisymmetric Q: what is a partially ordered set (poset)? a preordered set whose preorder is a partial order Q: what's the smallest example of a partially ordered set? Q: what's another example? Q: are there infinite partially ordered sets? Q: what's an example of a set with a discrete order? Q: what's an example of a set with a linear order? Q: do does it make sense to talk about the least element of a preordered set? Q: what is the greatest element of an entire partially ordered set? Q: does that always exist? Is it unique? Q: what's the Hasse diagram for the booleans ordered by implication look like? for the subsets of the set {6, 4, 1}? *** congruence and monotonicity def: Let A and B be sets and ==_A and ==_B be equivalence relations. Let f be a function of type A -> B. Then if is a congruence iff a ==_A a' ==> f.a ==_B f.a'. This generalizes to a monotonic (order-preserving) function by replacing ==_A with <=_A. Q: What's an example of a monotonic function on the natural numbers? Q: what's an example of a antimonotonic function on the natural numbers? Q: what's on several function that is neither monotonic nor antimonotonic on the natural numbers? Q: what's an order embedding of the natural numbers into the Booleans? Q: Is every order embedding injective (i.e., 1 to 1)? Yes. Proof: Suppose f is an order embedding and f.x == f.y. Then f.x <= f.y and f.y <= f.x by reflexivity. So by definition of order embedding, x <= y and y <= x. So by antisymmetry, x == y. Q: Is every injective monotonic function an order embedding? No Counterexample: Let D2 be the set {a,b} in the discrete order. Then the map f: D2 -> Bool defined by f(a) == F, f(b) == T is monotonic and injective, but not an order embedding. (See why?) Q: consider subtraction on integers, in what argument is it monotonic? *** meet and join Q: how would you define a lower bound of a set? The greatest lower bound? the set has to be a subset of some partially ordered set. Q: in a poset, is a lower bound of a subset an element of that subset? not necessarily, e.g., in the powerset of {a,b,c}, {} is the lower bound of the set {{a}, {b}} Q: what is the greatest lower bound (infimum, or meet) of a subset in a partially ordered set? The greatest element of the set of lower bounds. see the first two properties on p. 33 "it's a lower bound" (general \glb elimination) b \in B ==> \glb B <= b "it's the greatest" (general \glb introduction) (\forall b \in B . a <= b) ==> a <= \glb B Q: does it always exist? no, consider the integers Q: is it meaningful to take the glb of an empty set? yes, it's the top element if it exists Q: what properties characterize the mean of two elements in a partially ordered set? (\meet elimination) b1 \meet \b2 <= b1 and b1 \meet \b2 <= b2 (\meet introduction) a <= b1 /\ a <= b2 ==> a <= b1 \meet b2 Q: How does all this relate to upper bounds and the least upper bound (supremum, join)? ------------------------------------------ Lemma 2.1 (correspondence) Let a, b be elements of a poset. Then a \meet b == a <==> a <= b a \join b == b <==> a <= b. ------------------------------------------ Q: how would you prove this? shows the calculational-style proof of the meet part by double implication. Q: What's join in the Booleans? Q: what is the join operation in the power set poset? Q: in the natural numbers? ** lattices (2.2) Q: In a lattice, can we consider meet and join to be operators? yes, so it's algebraic. Q: What's the unit of the meet operator in the Booleans? the zero? true, false Q: Is the unit of the meet operator in a lattice always the top element? yes Q: what's an example of a partially ordered set that is not a lattice? the integers in the discrete ordering Q: What does absorbtion mean for the booleans? Some misconceptions... Q: If a poset has a top element is it a lattice? Q: If a poset has a bottom element, do meets exist in it? Q: If a poset is bounded, is it a lattice? *** complete lattices Q: what's an example of a lattice that is not a complete lettuce? the integers in the usual ordering Q: is every finite lattice a complete lattice? Q: does every complete lattice have a top and a bottom? Why? Q: what do meet and join of infinite sets correspond to in the Booleans? Q: are the natural numbers a complete lattice? Q: what about the set of functions from a complete lattice to another complete lattice? Does the domain have to be a complete lattice? Some misconceptions... Q: If a lattice has a bottom and a top element, is it complete? no, consider [0,1] \subseteq Q (i.e., [0,1] as a subset of the rationals in the usual order, the set { x | x < 1 / \pi } has no lub in [0,1]) *** distributive lattices Q: what is the advantage of having distributivity? Q: Which lattices we've seen are distributive? An example... Q: Is Nat distributive? *** Boolean Lattices Q: what does a complete Boolean lattice have that a complete distributive lattice doesn't? (a complement operator, like negation) Q: is the subset lattice a boolean lattice? Q: Are the natural numbers a complete Boolean lattice? why? no because (a) it's not a complete lattice, and (b) there's no way to define complement such that -x is in the lattice and the contradiction and exhuastiveness properties hold. If you try -x as the usual negation, that's not in the lattice; if you try -x as 0, it doesn't satisfy exhaustiveness. *** atomic lattices Q: what is an atom in a lattice? Q: what are atoms useful for? - you can represent an element in a lattice by the atoms below it - also, any atomic complete Boolean lattice is isomorphic to the subset lattice of its atoms. Q: So what's the best example of a complete, boolean, and atomic lattice? the subsets of a set (theorem 2.3) *** duality Q: What's the dual (or opposite) of a lattice? the same set with the reverse ordering Q: what's the dual of the Boolean lattice? The subset lattice? Q: what properties are preserved by taking the dual of a lattice? Q: should de Morgan have published two papers or just one? ** product and function spaces (2.3) *** product spaces Q: Is (1,3) less than (6,4)? Why? Q: how is the ordering defined on the product? Q: what's the bottom element of Nat x Nat? *** function spaces Q: what is the ordering for functions? don't confuse this with monotonicity Q: can you give an example function ordering, on Nat -> Nat? Q: Are functions on Nat -> Nat always comparable? Q: Is Nat -> Nat a poset? A lattice? A complete lattice? Q: Are functions on Nat -> Bool always comparable? no Q: Is Nat -> Bool a poset? A lattice? A complete lattice? yes, yes, yes (Lemma 2.5) Predicates: think of D -> Bool as characteristic function of a subset A of D. Such functions are called *predicates*. So D -> Bool is isomorphic to powerset(D), and has all its lattice properties. Q: What does the pointwise extension Lemma (2.5) tell us about relations? Q: Are binary relations ordered by subset inclusion an atomic lattice? ** Lattice Homomorphisms (2.4) Q: What's a meet homomorphism? a join homomorphism? Q: What kind of homomorphism is a strict function? Q: How would you summarize the property of preserving X (being X-homomorphic)? Q: What's an embedding? Why is that an appropriate term? Q: An epimorphism? An image? Q: What's an isomorphism? Q: Is being "isomorphic" an equivalence relation? *** binary lattice operations as homomorphisms Q: how could we regard the meet operation as a homomorphism? by fixing one argument, i.e. f_a.x == a \meet x it is easy to show this is meet homomorphic, and by distributivity is also join homomorphic Q: What property defines a function that is universally meet homomorphic? Positively meet homomorphic? Q: Can a function a universal join homomorphism if it is strict and preserves least upper bounds of nonempty sets? (no, lemma 2.6) Q: can a function be a positive meet homomorphism without being a meet homomorphism? (no, lemma 2.6) could do exercise 2.8 at this point. *** tabular representation (skip) this seems self-explanatory. ** categories (2.5) Q: What is a concrete category? a collection of sets with some structure, and structure-preserving functions Q: what's an example of a concrete category? the book gives: - lattices and meet homomorphisms - posets and monotonic functions Q: Would the collection of posets and non-monotonic functions be a category? no because it wouldn't "preserve the structure" *** abstract categories (as if they weren't abstract enough to begin with :-) Q: what's the difference between an abstract and concrete category? Q: what features does a category have? - objects, Obj(C), which can be compared for equality - morphisms (arrows), Mor(C), each of which has a source and a target - identity morphisms for each object, (1_A for object A) - a composition operator, (;), that is associative laws: f;(g;h) == (f;g);h 1;f == f and f;1 == f Q: Why isn't the category of relations a concrete category? because the morphisms are not necessarily functions. Q: How is an abstract category different than a directed graph? Q: How is an abstract category different than a preorder? *** functors and homomorphisms Q: if we consider categories themselves to the objects, what structure would their morphisms preserve? sources, targets, compositions, and identity morphisms def: Let C and D be categories. A functor F: C -> D maps Obj(C) to Obj(D) and Mor(C) to Mor(D) (i.e., if g: A -> B \in Mor(C), then F.g: F.A -> F.B in Mor(D)) such that: For all g,h in Mor(C), F(g;h) == F.g; F.h for all A \in Obj(C), F.1_A == 1_(F.A) Q: If a category is like a preorder, how is a functor like a monotonic function? These morphisms of categories are called functors, although isomorphisms are also called "natural transformations" *** order-enriched categories Q: what is an order enriched category? one in which composition is monotonic in both arguments Q: what is a left order-enriched category? f <= f' ==> f;g <= f';g Q: Is the category of relations in the subset ordering order-enriched?