CS 641 Lecture -*- Outline -*- * Relational Updates (11.4) Q: Intuitively, what is does an angelic update, {R}, based on relation R do? Q: What does a demonic update, [R], based on relation R do? See also figure 11.1 ------------------------------------------ RELATIONAL UPDATES Definitions: {R}.q.s == (\exists g :: R.s.g /\ q.g) [R].q.s == (\forall g :: R.s.g ==> q.g) Sugars wp.{R} == {R} wp.[R] == [R] Special cases: choose == {True} (arbitrary choice) chaos == [True] (chaotic choice) ------------------------------------------ Q: How does that match intiution? Q: How would you describe these in terms of set notation? Q: What is {False}? [False]? ------------------------------------------ RELATIONAL ASSIGNMENTS Demonic: [x := x' | b] Angelic: {x := x' | b} Theorem 11.3. Assume that x is a list of program variables and b is Boolean expression, and q is a Boolean expression in which x' does not occur free. Then (a) var x |- {x := x' | b}.q == (\exists x' :: b /\ q[x := x']) (b) var x |- [x := x' | b].q == (\forall x' :: b ==> q[x := x']) ------------------------------------------ Q: What is [x := x' | x' > x + y].(x > y)? Q: What is [x := x' | x' > x + y].q? Q: What is [x := x' | x * x <= x' /\ x' < (x+1)*(x+1)].(x == 2)?