main
| Line | |
|---|
| 1 | /* Verifiable with -memeq but fails without. TODO: Figure out what the discrepency is.
|
|---|
| 2 | */
|
|---|
| 3 | #include <stdlib.h>
|
|---|
| 4 | #include <assert.h>
|
|---|
| 5 |
|
|---|
| 6 | #pragma CIVL ACSL
|
|---|
| 7 |
|
|---|
| 8 | $input int N;
|
|---|
| 9 | $assume(0 < N);
|
|---|
| 10 | short __VERIFIER_nondet_short() {
|
|---|
| 11 | short x;
|
|---|
| 12 | $havoc(&x);
|
|---|
| 13 | return x;
|
|---|
| 14 | }
|
|---|
| 15 | int main()
|
|---|
| 16 | {
|
|---|
| 17 | int a[N];
|
|---|
| 18 | int b[N];
|
|---|
| 19 | int k;
|
|---|
| 20 | int i;
|
|---|
| 21 |
|
|---|
| 22 | //@ focus I;
|
|---|
| 23 | for (i = 0; i<N ; i++)
|
|---|
| 24 | {
|
|---|
| 25 | a[i] = i;
|
|---|
| 26 | b[i] = i ;
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | //@ focus I;
|
|---|
| 30 | for (i=0; i< N; i++)
|
|---|
| 31 | {
|
|---|
| 32 | if(__VERIFIER_nondet_short())
|
|---|
| 33 | {
|
|---|
| 34 | k = __VERIFIER_nondet_short();
|
|---|
| 35 | a[i] = k;
|
|---|
| 36 | b[i] = k * k ;
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | // Modified
|
|---|
| 41 | //@ focus I;
|
|---|
| 42 | $assert($forall(int i:0..N-1) a[i] == b[i] || b[i] == a[i] * a[i]);
|
|---|
| 43 | // Original
|
|---|
| 44 | /*
|
|---|
| 45 | for (i=0; i< N; i++)
|
|---|
| 46 | {
|
|---|
| 47 | __VERIFIER_assert(a[i] == b[i] || b[i] == a[i] * a[i]);
|
|---|
| 48 | }
|
|---|
| 49 | */
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.