I tried solving past exam question but there is this one that I haven't been able to solve.
The question states that a suitable precondition should be found for the statement.
$$ a= i +2; i++\{(a = 7)\land(i = 5)\} $$ Here's my solution and where I got stuck:
$$ wp(a= i +2; i++,(a = 7 \land i = 5) \\ =wp(a= i +2, wp(i=i+1,a = 7\land i = 5) $$
I've tried solving it intuitively and I arrive at the conclusion that no such value for i
i should exist.
I haven't been able to find a rule to combine the two predicates of the post-condition.
Please I would like to know when solving similar questions can I change the ^
to an algebra symbol or should I take the relevant condition and find the weakest precondition with that.