








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









Comment form The root of the assertion. of all bugs!
precondition postcondition
precondition postcondition
x = 0; i = 2 while i <= 5: x = x + i*i i = i +
i = 2 i <= 5 i = i + true false x = x + i*i The loop processes the range 2.. # invariant
true init (^) cond k= k +1; false Process k invariant invariant
Initialize variables (if necessary) to make invariant true
while k <= c: # Process k k = k + 1
k = 0 while k < len(s):
k = k +
Command to do something Equivalent postcondition
k: next integer to process. Which have been processed? What is the invariant? for s = 'ebeee', x = 2
c = ?? k = ??
while k < len(s):
k = k+
c is largest element in s[0..k–1] Command to do something Equivalent postcondition