Skip to content

Commit e00101e

Browse files
authored
Merge pull request #954 from manastasova/array_bound_guide_file_fix
Update array_bound macro description in proof_guide.md
2 parents 96b7b6e + ea517ea commit e00101e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

proofs/cbmc/proof_guide.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ condition (usually depending on `k`).
8787

8888
A prominent condition built from `forall` are `array_bound`:
8989
`array_bound(arr, idx_low, idx_high, value_low, value_high)` asserts that the values of the array `arr` within
90-
`[idx_low, ..., idx_high - 1]` are within the range `[value_low, ..., value_high]`. There is also `array_abs_bound(...)`
90+
`[idx_low, ..., idx_high - 1]` are within the range `[value_low, ..., value_high - 1]`. There is also `array_abs_bound(...)`
9191
for absolute value constraints.
9292

9393
### Loop invariants
@@ -456,13 +456,12 @@ We can use the macros in [mlkem/cbmc.h](../../mlkem/cbmc.h) to help, thus:
456456
void mlk_poly_tobytes(uint8_t r[MLKEM_POLYBYTES], const mlk_poly *a)
457457
__contract__(
458458
requires(memory_no_alias(a, sizeof(mlk_poly)))
459-
requires(array_bound(a->coeffs, 0, MLKEM_N, 0, (MLKEM_Q - 1)))
459+
requires(array_bound(a->coeffs, 0, MLKEM_N, 0, MLKEM_Q))
460460
assigns(object_whole(r)));
461461
```
462462
463463
`array_bound` is a macro that expands to a quantified expression that expresses that the elemtns of `a->coeffs` between
464-
index values `0` (inclusive) and `MLKEM_N` (exclusive) are in the range `0` through `(MLKEM_Q - 1)` (both
465-
inclusive). See the macro definition in [mlkem/cbmc.h](../../mlkem/cbmc.h) for details.
464+
index values `0` (inclusive) and `MLKEM_N` (exclusive) are in the range `0` (inclusive) through `MLKEM_Q` (exclusive). See the macro definition in [mlkem/cbmc.h](../../mlkem/cbmc.h) for details.
466465
467466
### Interior contracts and loop invariants
468467

0 commit comments

Comments
 (0)