main
test-branch
| Line | |
|---|
| 1 | #include<assert.h>
|
|---|
| 2 |
|
|---|
| 3 | #pragma CIVL ACSL
|
|---|
| 4 | $input int N;
|
|---|
| 5 | $assume(0 < N);
|
|---|
| 6 | int a[N];
|
|---|
| 7 | int b[N];
|
|---|
| 8 |
|
|---|
| 9 | int main() {
|
|---|
| 10 |
|
|---|
| 11 | int x = 1;
|
|---|
| 12 | //@ focus I;
|
|---|
| 13 | /*@ loop invariant x == i+1;
|
|---|
| 14 | @*/
|
|---|
| 15 | for (int i = 0; i < N; i++) {
|
|---|
| 16 | a[i] = i + x;
|
|---|
| 17 | x = x+1;
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | //@ focus I;
|
|---|
| 21 | for (int i = 0; i < N; i++) {
|
|---|
| 22 | b[i] = i;
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | //@ focus I;
|
|---|
| 26 | for (int i = 0; i < N; i++) {
|
|---|
| 27 | a[i] = a[i] * b[i];
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | //@ focus I;
|
|---|
| 31 | $assert($forall(int i:0..N-1) a[i] == (2*i+1)*i);
|
|---|
| 32 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.