CS 641 meeting -*- Outline -*- * fixpoints in complete lattices (Some prefer "fixedpoint" to "fixpoint".) ** motivation This is the key concept both in the denotational approach and in pred. transformer semantics a la Hesselink Also found in math and psychology (informally): love, religion, ... -------------------------------- FIXPOINTS def: Let W be a complete lattice. Let D : W -> W. Then v \in W is a *fixpoint of D* iff D.v = v. --------------------------------- note D has the same domain and range. Why? Q: how would you express a fixpoint in terms of the ordering on W not equality? v is a fixpoint iff D.v <= v and v <= D.v --------------------------------- def: v is a *least fixpoint* of D iff v is a fixpoint and for every fixpoint w, v <= w. def: v is a *greatest fixpoint* of D iff v is a fixpoint and for every fixpoint w, v >= w. -------------------------------- Note that the second line is the "universal property" of the lfp and gfp. Q: is the lfp unique? The gfp? In denotational semantics, typically only concerned with lfp. Q: Suppose f \in MT. What do these definitions mean? Recall MT = {f | f : |P -> |P, f monotone} p is a fixpoint iff f.p equiv p p is a least fixpoint iff for all other fixpoints q, [p ==> q] Q: Suppose f \in (Command -> MT) -> (Command -> MT). Then what? w is a fixpoint iff f.w = w What's the induced ordering? w1 <= w2 iff (all c :: w1.c <= w2.c) iff (all c,p :: w1.c.p <= w2.c.p) iff (all c,p :: [w1.c.p ==> w2.c.p]) So w is a least fixpoint iff for all other fixpoints w', (all c,p :: [w.c.p ==> w'.c.p]) --------------------------- Theorem (Knaster-Tarski): Let W be a complete lattice. Let D : W -> W be monotonic. Then D has a least fixpoint wa and a greatest fixpoint wb. Let V \subseteq W be D-invariant; i.e., (all v \in V :: D.v \in V). Then (a) if V is sup-closed, wa \in V. (b) if V is inf-closed, wb \in V. --------------------------- Remark, sup-closed or inf-closed sets contain the sup or inf of the empty set, and thus cannot be empty. Pf: Note that W itself is D-invariant by the type of D. Also, as W is a complete lattice, it is sup-closed. Hence D-invariant, sup-closed subsets of W exist. Let V be such a subset. To construct wa, let U be defined by u \in U equiv u \in V /\ (all w \in W : D.w <= w : u <= w). Q: how would you describe or picture this? Draw first W, then V, then where stuff goes in V then the subset of V where w <= D.w, then U, then wa. ------------------------------------------ ^ / \ W / \ / \ / ^ \ / / \ V \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / |------\ \ \ / / | w \ \ \ / / / \ \ \ \ / / / v \ \ \ / / [ D.w ] \ \ / / D.v -----*----- \ \ / / ^ / wa \ U \ \ / / / / = (sup U)\ \ \ < / v / \ \ > \ /_______/_________________\_________\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / v ------------------------------------------ Let wa = (sup U). Since U \subseteq V and V is sup-closed, wa \in V. Now we show wa \in U. wa \in U equiv {def of U, wa \in V} (all w \in W : D.w <= w : wa <= w) equiv {wa = (sup U) and def of (sup U)} (all w \in W : D.w <= w : (all u \in U :: u <= w)) equiv {def of U} (all w \in W : D.w <= w : true) equiv {calc} true It will be enough to show wa is a fixpoint: i.e., that D.wa <= wa and wa <= D.wa. This will be done using the above. D.wa <= wa <== {wa = (sup U), so wa is an upper bound of U} D.wa \in U equiv {def of U} D.wa \in V /\ (all w \in W :: D.w <= w : D.wa <= w) <== {V is D-invariant, and transitivity of <= (read from below)} wa \in V /\ (all w \in W :: D.w <= w : D.wa <= D.w) <== {D is monotone} wa \in V /\ (all w \in W :: D.w <= w : wa <= w) equiv {wa \in U and def of U} true (so this means wa is in the intersection of U and the set of (all w \in V :: D.w <= w) wa <= D.wa <== {def of U, with u := wa and w := D.wa} wa \in U /\ D.(D.wa) <= D.wa <== {wa \in U; monotony of D} true /\ D.wa <= wa <== {calculus and above calculation that D.wa <= wa} true So wa is a fixpoint. Remains to show it is least. But wa \in U, and the stuff in U is no larger than the fixpoints of D. QED Remark, in effect, the fixpoints of D form a complete lattice.