{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw2 - Homework 2 CSC 7101 Spring 2011 Due 28 February 2011...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 2 CSC 7101, Spring 2011 Due: 28 February 2011 1. (5 pts) What set of states does the formula ‘ x.x = 3’ characterize? What set of states does the formula ‘ x.x = x ’ characterize? Explain your answers. 2. (10 pts) Which of the following Hoare triples are valid: (a) { true } x := 2 { true } (b) { true } x := x { false } (c) { false } x := 2 { true } (d) { false } x := 2 { false } (e) { true } while true do x := 2 end { false } (f) { true } x := x + 1 { x = x + 1 } (g) { x = y } t := x; x := y; y := t { x = y } (h) { x >= 0 } x := y { y >= 0 } 3. (5 pts) The following axiom for the assignment isn’t sound: { true } x := e { x = e } Find an example that demonstrates the unsoundness of the rule, i.e., a Hoare triple that can be proved with this rule but that isn’t operationally valid. 4. (10 pts) Give a good (i.e., sound and complete) rule for the assignment statement where the post- condition is determined by the precondition. In other words, fill in the question mark in the following proof rule. Explain why your rule is good. { P } x := e { ? } Hint: make sure you don’t lose the information contained in P . 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
5. (10 pts)
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern