This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Array Assignments; Parallelism CS 536, Mon Nov 22, 2 1 Activity 12.1: Array Assignment A. Why? Array assignments arent like assignments to plain variables because the actual item to change cant be determined until runtime. We can handle this by e x tending our notion of assignment and/or substitution. B. Outcomes At the end of this activity you should: Be able to perform te x tual substitution to replace an array element. Be able to calculate the wp of an array element assignment. C. Questions For each of the questions below, calculate the given weakest precondition. Then try logically simplifying it to something easier to read. 1. What is wp ( b:= 9 , x > b[i] )? (x > b[i])[9/b is x > if i = 0 then 9 else b[i] fi 2. What is wp ( b[i]:= b[j] , b[k] = )? (b[k] = 0)[b[j]/b[i]] is if k = i then b[j] else b[k] fi = 0 3. What is wp ( b[i]:= b[j] , b[j] = z )? (b[j] = z)[b[j]/b[i]] is (if j = i then b[j] else b[j] fi) = z b[j] = z 4. What is wp ( b[i]:= 1 , b[i] = b[j] )?...
View Full Document
This note was uploaded on 04/17/2011 for the course CS 536 taught by Professor Cs536 during the Fall '08 term at Illinois Tech.
- Fall '08