ASSERT( P ) /* determine what is P */
A[i] = A[m];
A[k] = 2;
ASSERT( A[i] == x + 5 )
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityI don't know about the weakest but I can tell you about candidate precondition,a[m] is assigned to a[i] so the range of m must concide with that of i,the postcondition is a[i]==x+5 so a[m]==x+5.
I have used the fact that array is a collection of tuples of index and value and thus the above result.