001_VORA_HITEN_ASSIGNMENT 6

001_VORA_HITEN_ASSIGNMENT 6 - ASSIGNMENT 6 SUBMITTED BY...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ASSIGNMENT 6 SUBMITTED BY Name: Hiten M Vora ID: A20227482 Question 1. Consider the earliest meeting time UNITY program. 1a. Construct and formally prove partial correctness of a deterministic sequential program by showing that your program is a refinement of the UNITY program. Solution: {r>=0; r exists} r=0; old_r=-1 {u 0<=u<r : Com(u)} while old_r r do old_r =r r = f(r); r=g(r); r=h(r); end {u 0<=u<r : Com(u)} Consider the following computation tree for the above program When we enter the while loop and execute one of the assignments, such as {u 0<=u<r : Com(u)} r:=f(r) {u 0<=u<r : Com(u)} Then the computation tree for the above execution will be As we see, this tree is part of the overall computation tree. If each of the assignments are executed infinitely often we can argue that the program will be reaching a fixed point after a finite number of iterations, hence it can be shown that this tree is a branch or a part of the computation tree of unity program 1b. Prove partial correctness directly (1) To prove that the invariant holds before the loop { r>=0, r exists} r :=0; old_r =-1; {u 0<=u<r : Com(u)} { r>=o; r exists} => {u 0<=u<0 : Com(u)} True (2) To prove invariant holds inside the loop Considering for anyone of the assignments {u 0<=u<r : Com(u)} R:=f(r); {u 0<=u<r : Com(u)} {u 0<=u<r : Com(u)} => {u 0<=u<f(r) : Com(u)} Which can be written as {u 0<=u<r : Com(u)} => {u 0<=u<r : Com(u) u | 0<=u<f(r) : Com(u | )} Which holds true because of the precondition and the property : u 0<=u<f(r) : Com(u) Same can be proved for all other assignment statements...
View Full Document

This note was uploaded on 05/04/2011 for the course CS 536 taught by Professor Cs536 during the Spring '08 term at Illinois Tech.

Page1 / 9

001_VORA_HITEN_ASSIGNMENT 6 - ASSIGNMENT 6 SUBMITTED BY...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online