Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 ( 4 pts . , 1 pt . each ) : Hoare Triples State whether each Hoare triple is valid. If it is

Problem 2(4 pts.,1 pt. each): Hoare Triples
State whether each Hoare triple is valid. If it is invalid, explain why and show how you would
modify the postcondition to make it the strongest for the given precondition. Unless otherwise
stated, assume all referenced variables are defined as integers.
(1){ x >0}
y =-2* x ;
{ y >0 y %2=0}
(2){
x 1>= k }
x = x +1;
{ k >0}
(3){ i + j =0 i j =0}
i = j -1;
k = i * j ;
j = i +1;
{ i =0 i =-j k = i j }
(4){ false }
if ( n < m )
x = n ;
else
x = m ;
{ x = max(n, m)}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

Find the class equation for S 5 and S 6 .

Answered: 1 week ago

Question

Define success.

Answered: 1 week ago