main
test-branch
|
Last change
on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
599 bytes
|
| Rev | Line | |
|---|
| [01c5b2ce] | 1 | #include<assert.h>
|
|---|
| 2 |
|
|---|
| 3 | #pragma CIVL ACSL
|
|---|
| 4 | $input int N;
|
|---|
| 5 | $assume(0 < N);
|
|---|
| 6 | $input int X;
|
|---|
| 7 | $assume(0 <= X);
|
|---|
| 8 | int a[N];
|
|---|
| 9 | int b[N+X];
|
|---|
| 10 |
|
|---|
| 11 | int main() {
|
|---|
| 12 | //@ focus A;
|
|---|
| 13 | for (int i = 0; i < N; i++) {
|
|---|
| 14 | a[i] = i+1;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | //@ focus A;
|
|---|
| 18 | for (int i = 0; i < N; i++) {
|
|---|
| 19 | b[i+X] = i;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | //@ focus B;
|
|---|
| 23 | for (int i = 0; i <= X; i++) {
|
|---|
| 24 | b[i] = i;
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | //@ focus B;
|
|---|
| 28 | $assert($forall(int i:0..X) b[i] == i);
|
|---|
| 29 |
|
|---|
| 30 | //@ focus A;
|
|---|
| 31 | for (int i = 0; i < N; i++) {
|
|---|
| 32 | a[i] = a[i] * b[i+X];
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | //@ focus A;
|
|---|
| 36 | $assert($forall(int i:0..N-1)
|
|---|
| 37 | (i == 0 => a[i] == X) &&
|
|---|
| 38 | (i > 0 => a[i] == (i+1)*i));
|
|---|
| 39 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.