source: CIVL/examples/focus/multiLoop.cvl@ bb03188

main test-branch
Last change on this file since bb03188 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: 451 bytes
RevLine 
[01c5b2ce]1#include<assert.h>
2
3#pragma CIVL ACSL
4$input int N;
5$assume(0 < N);
6int a[N];
7int b[N];
8
9int 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.