{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Act07_Pf_Rules_and_Pfs

# Act07_Pf_Rules_and_Pfs - Illinois Institute of Technology...

This preview shows pages 1–3. Sign up to view the full content.

CS 536: Proof Rules and Proofs Activity 7.1: Verification Proofs for Straight-Line Code A. Why? •Veri fi cation of straight-line code (basically, a sequence of assignments/skips) is a good base for verifying larger and more complicated programs. B. Outcomes At the end of this activity you should: •Be able to write a short proof of correctness for simple programs involving a sequence of assignments. C. Questions 1. Using the assignment and precondition strengthening rules, fi ll in the rest of the formal proof below. 1. { ??? } y:=–x { y 0 } Ass i g n me n t ??? is (y 0)[–x/y] is –x 0 2. x=y x<0 –x 0 Predicate logic 3. { ??? } y:=x { y 0 } Precond. Strengthening, lines 2, 1 x=y x<0 2. Using the skip and precondition strengthening rules, fi ll in the rest of the formal proof below. 1. { ??? } skip { y 0 } skip y 0 2. x=y x 0 y 0 Predicate logic 3. { ??? } skip { y 0 } Precond. Strengthening, l in es 2, 1 x=y x 0 3. Using the (backward) assignment and composition rules, fi ll in the rest of the formal proof below. 1. { ??? 0 i+1 n s+i+1=sum(0,i+1) } Ass i g n me n t i:=i+1 { 0 i n s+i=sum(0,i) } Illinois Institute of Technology Activities for Lecture 7 CS 536: Science of Programming - 1 of 6 - © James Sasaki, 2010

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

View Full Document
2. { ??? 0 i n s+i=sum(0,i) } Ass i g n me n t s:=s+i { 0 i n s=sum(0,i) } 3. { ??? 0 i+1 n s+i+1=sum(0,i+1) } Compos i t i o n 1, 2 i:=i+1; s:=s+i { 0 i n s=sum(0,i) } 4. Using the (backward) assignment and composition rules, fi ll in the rest of the formal proof below.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern