CS 641 meeting -*- Outline -*- * introduction formal semantics of ;, [], and recursion justification of postulates and results used earlier plan: lattices (4.1), Knaster-Tarski theorem (4.2), syntactic algebra for unbounded choice (4.3), wp and wlp for recursion and unbounded choice (4.4) healthiness laws justified (4.5) * complete lattices and predicate transformers idea is that |P will be a complete lattice, and so will set of predicate transformers |P -> |P. Hence, we'll be able to find sups (lubs) and infs (glbs), which will be used in semantics of recursion. Recall: (partially) ordered set is (W, <=), where <= is a (partial) order on W (refl., trans, antisymmetric). ** lattices *** sup and inf ------------------- LATTICES SUPREMUM (LUB) Let (W, <=) be an ordered set. def: Let U \subset W. x \in W is a *supremum* (lub) of U iff for all w \in W, x <= w equiv (all u \in U :: u <= w). notation: x = (sup u \in U :: u) x = (sup U) ------------------- Some sets don't have a supremum. For example, bowtie, set of integers in usual order. the notation x = (sup U) means the sup exists. Consider the powerset of {1,2,3} ordered by subset inclusion. Q: What is (sup {{2}, {3}})? motivates alternative notation |_| for sup. (Also note connections to \/.) Q: how does the definition say x is an upper bound? least? ------------------- INFIMUM (GLB) def: Let U \subset W. x \in W is a *infimum* (glb) of U iff for all w \in W, w <= x equiv (all u \in U :: w <= u). notation: x = (inf u \in U :: u) x = (inf U) ------------------- Notice that you just reverse all the inclusions. so this is the dual of supremum. Consider the powerset of {1,2,3} ordered by subset inclusion. Q: What is (inf {{2}, {3}})? _ motivates alternative notation | | for inf. (Also note connections to /\.) *** complete lattice -------------------- COMPLETE LATTICE def: (W, <=) is a *complete lattice* iff it is an ordered set such that each subset has a sup and inf in W. -------------------- Note: this includes infinite subsets Example, the powerset of {1,2,3}, ordered by subset inclusion, with sup being union, inf being intersection Example, lattice of booleans, with false < true. This is the strength order, as false ==> true i.e., b1 <= b2 iff b1 ==> b2 Counterexample, the integers in the usual ordering Q: why? *** sup- and inf-closed subsets --------------------------- def: a subset V of complete lattice W is *sup-closed* iff for all U \subseteq V, (sup U) \in V is *inf-closed* iff for all U \subseteq V, (inf U) \in V ---------------------------- e.g, every chain is inf- and sup-closed Q: if V is sup-closed, where is (sup V)? Can V be empty? *** induced order -------------------------- INDUCED ORDER ON FUNCTIONS TO ORDERED SETS def: Let W be an ordered set. Y a set. Then the set Y -> W is ordered by f <= g equiv (all y \in Y :: f.y <= g.y) -------------------------- the <= on the right is W's, the <= on the left is being defined draw graph picture... main example: |P = X -> |B -------------------------- Theorem: if W is a complete lattice, so is Y -> W and for any subset U of Y -> W, (inf U).y = (inf f \in U :: f.y) and (sup U).y = (sup f \in U :: f.y) -------------------------- Q: how would you prove that? show the def defines the sup of U. ** lattice of booleans, predicates ------------------------ LATTICE OF BOOLEANS |B = ({false, true}, <=), where p <= q iff p ==> q e.g., false < true PREDICATES |P = X -> |B with induced order p <= q iff [p ==> q] Let U \subseteq |P. (sup U) = (exists p \in U :: p) (inf U) = (all p \in U :: p) ------------------------ Q: why are these right? (sup U) = (exists p \in U :: p) equiv {def} (all r \in |P :: (exists p \in U :: p) <= r equiv (all p \in U :: p <= r)) equiv {induced order on |P} (all r \in |P :: [(exists p \in U :: p) ==> r] equiv (all p \in U :: [p ==> r])) equiv {exercise 1.1.4(b)} true Q: can prove the second? ** predicate transformers ------------------------- PREDICATE TRANSFORMERS def: PT = (|P -> |P) is the complete lattice of predicate transformers Let U \subseteq PT. (sup U).p = (exists f \in U :: f.p) (inf U).p = (all f \in U :: f.p) ------------------------- These follow from theorem 3. -------------------------- def: MT = {f \in PT | f is monotone} MC = {f | f is finitely conjunctive} MP = {f | f is positively conjunctive} MU = {f | f is univerially conjunctive} MU \subset MP \subset MC \subset MT -------------------------- Q: is not (~) in MT? no. Why? Thm: (a) MT is sup-closed and inf-closed in PT. (b) MT is a complete lattice, and sups and infs in MT have same value as in PT (c) MU, MP, and MC are inf-closed in PT (d) for all f,g,h \in MT with f <= g, f o h <= g o h and h o f <= h o g. Remark, when X has more than one element, MU, MP, and MC are not sup-closed in PT. so we mainly use MT in the theory.