Answered step by step
Verified Expert Solution
Link Copied!

Question

00
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 with AI-Powered 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

Students also viewed these Databases questions

Question

Define success.

Answered: 1 week ago