diff --git a/008-sum_product.dfy b/008-sum_product.dfy index 9d74fef..bd4dede 100644 --- a/008-sum_product.dfy +++ b/008-sum_product.dfy @@ -25,16 +25,20 @@ lemma prod_prop(s: seq) } method sum_product(numbers: seq) returns (s : int, p : int) + // post-condition-start ensures s == sum(numbers) ensures p == prod(numbers) + // post-condition-end { // impl-start assert numbers[..|numbers|] == numbers; // assert-line s := 0; p := 1; for i := 0 to |numbers| + // invariants-start invariant s == sum(numbers[..i]) invariant p == prod(numbers[..i]) + // invariants-end { // assert-start assert sum(numbers[..i + 1]) == sum(numbers[..i]) + numbers[i] by {