Professional Documents
Culture Documents
FALLSEM2020-21 CSE2003 ETH VL2020210106320 Reference Material I 22-Jul-2020 Algorithm Correctness2
FALLSEM2020-21 CSE2003 ETH VL2020210106320 Reference Material I 22-Jul-2020 Algorithm Correctness2
Proof of correctness
The algorithm is complete/correct: the post-condition
is respected on all possible inputs satisfying the pre-
condition
Precondition: a predicate I on the input data
Postcondition: a predicate O on the output data
Correctness: proving I ⇒ O
N`= 2
After
RULE 1: z == n*y
8 == 2*4 = 8 <=> True
so RULE 1 applies
Maintenance