0
$\begingroup$

what is the meaning of postcondition and weakest postcondition in terms of programing and what are weakest postconditons of following statements.

1. a=2*(b-1)-1   {a>0}
2. b=(c+10)/3    {b>6}
3. a=(a+2*b-1)   {a>1}
4. a=2*b+1;b=a-3 {b<0}
$\endgroup$
  • 2
    $\begingroup$ I suggest repeating the material. They should explain what precondition and weakest precondition mean, hopefully with examples. $\endgroup$ – Yuval Filmus Sep 16 at 14:51
0
$\begingroup$

Let's do the first one. You want to find what condition on $b$ will imply $2(b-1)-1>0$. All you have to do is solve this inequality.

The other ones are similar.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.