View the step-by-step solution to:

CSCI 5535: Homework Assignment 7 Due Thursday, March 18, 2010 Exercise 1: Indicate in a sentence or two how much time you spent on this homework, how...

I am lost on number 2
CSCI 5535: Homework Assignment 7 Due Thursday, March 18, 2010 Exercise 1: Indicate in a sentence or two how much time you spent on this homework, how diﬃcult you found it subjectively, and what you found to be the hardest part. Tell me something about yourself that I do not already know. Any non-empty answer will receive full credit. Also, if your opinions have changed since the last assignment, indicate one thing you like about the class so far and one thing you would change about it. Exercise 2: Veriﬁcation condition for let . In class, we gave the fol- lowing deﬁnitions for the (backward) veriﬁcation condition generation of se- quencing and assignment: vc( c 1 ; c 2 ,B ) def = vc( c 1 , vc( c 2 ,B )) vc( x := e,B ) def = [ e/x ] B Consider the following deﬁnition for let : vc( let x = e in c,B ) def = [ e/x ]vc( c,B ) The above deﬁnition for let has a bug. Give a correct deﬁnition for let . Given { A } c { B } , recall that we desire that A vc( c,B ) wp( c,B ) holds. We say that our vc deﬁnitions are sound if | = { vc( c,B ) } c { B } . Explain brieﬂy why the buggy let deﬁnition is unsound and demon- strate the unsoundness by giving the following six things: 1. a command c , 1
2. a post-condition B , 3. a state σ , and 4. a state σ 0 such that 5. σ | = vc( c,B ) and 6. h c,σ i ⇓ σ 0 but 7. σ 0 6| = B . Exercise 3: Consider the following three alternate Hoare rules for while (named huey , dewey , and louie ): ‘ { X } c { b X ∧ ¬ b Y } ‘ { b X ∧ ¬ b Y } while b do c { Y } huey ‘ { X b } c { X } ‘ { X } while b do c { X } dewey ‘ { X } c { X } ‘ { X } while b do c { X ∧ ¬ b } louie All three rules are sound, but only one rule is complete. Identify the one complete rule and the two incomplete rules. 1. For the complete rule, do the following: (a) Provide the name of the rule. (b) Show that the system of axioms remains complete if we replace the old rule for while with this one. You must show that any derivation that uses the old rule for while can be written with this rule instead. Hint: begin by considering a derivation that ends in the old rule for while . 2. For each incomplete rule, do the following: (a) Provide the name of the rule. (b) Give a counterexample by providing the following: i. an assertion A , ii. an assertion B , iii. a state σ , iv. a state σ 0 , and v. a command c such that vi. h c,σ i ⇓ σ 0 , vii. σ | = A , and 2
Show entire document

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
• -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents