Computer Architecture > QUESTIONS & ANSWERS > CIS 4930/6930: Programs, Functions, Strange Loops, and Consciousness Programs and Functions Assignme (All)
CIS 4930/6930: Programs, Functions, Strange Loops, and Consciousness Programs and Functions Assignment 2 1. (4 pts.) Which one of the following statements best captures the precise meaning of the ... strong correctness predicate, "{P} S {Q} strongly"? (Circle ONE only.) a. P must hold before S executes and Q must hold if S terminates. b. {P} S {Q} is true unless Q could be false if S terminates. c. If P holds before executing S, S must terminate in state Q. d. If P holds before executing S, {P} S {Q} is true unless S could terminate with Q being false. e. {P} S {Q} is true unless Q is always false when S terminates, given that P held before executing S. 2. (9 pts.) Consider the hypothesized invariant: for the assertion: Which of the following correctly identifies which of the while_do statement ROI antecedents would hold when attempting to prove this assertion using the given hypothesized invariant? (Circle ONE only.) a. initialization only (6 pts.) e. initialization and finalization only (9 pts.) b. preservation only (0 pts.) f. initialization and preservation only (3 pts.) c. finalization only (6 pts.) g. initialization, preservation, and finalization (6 pts.) d. preservation and finalization only (3 pts.) h. none of the antecedents would hold (3 pts.) 3. (12 pts.) Circle either “valid” or “invalid” for each of the following hypothesized Rules of Inference. {true} if b then S {Q} valid invalid {P} while b do S {Q} (¬b) Q B valid {P} while b do S {Q} strongly {true} S {I}, (I Л b) Q valid invalid {P} repeat S until b {Q} P (wp(S, Q) Л K) valid invalid {P} S {Q} 4. (9 pts.) Circle either “true” or “false” for each of the following assertions. (Hint: “I is a loop invariant” I satisfies initialization and preservation; “I is a Q- 2 adequate loop invariant” I is a loop invariant that (also) satisfies finalization.) a. Z=XJ is a loop invariant for the assertion: true false {Z=0 Л J=0} while J<Y do Z := Z+X; J := J+1 end_while {Z=XY} b. Z=XJ Л J≤Y is a Q-adequate loop invariant for true false the assertion given in part (a) above. c. {P} repeat S until b {Q} {P} true false S; while NOT b do S end_while {Q} 3 [Show More]
Last updated: 2 years ago
Preview 1 out of 3 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 23, 2023
Number of pages
3
Written in
This document has been written for:
Uploaded
Apr 23, 2023
Downloads
0
Views
58
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·