Skip to content
This repository was archived by the owner on Oct 3, 2021. It is now read-only.

Commit bf60b1f

Browse files
committed
Add benchmarks from zilu paper
These are some simple benchmarks with loops where linear/disjunctive/conjunctive/polynomial invariants are needed to prove the programs to be correct.
1 parent 6c5337a commit bf60b1f

File tree

110 files changed

+2543
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2543
-0
lines changed

c/ReachSafety-Loops.set

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ loop-industry-pattern/*.yml
99
loops-crafted-1/*.yml
1010
loop-invariants/*.yml
1111
loop-simple/*.yml
12+
loop-zilu/*.yml
1213
verifythis/duplets.yml
1314
verifythis/elimination_max.yml
1415
verifythis/lcp.yml

c/loop-zilu/LICENSE.GPLv2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE.GPLv2.txt

c/loop-zilu/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LEVEL := ../
2+
3+
include $(LEVEL)/Makefile.config

c/loop-zilu/README.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
These tasks were generated by Martin Spiessl
2+
from information in the tool repository of zilu,
3+
a tool for invariant generation throug selective sampling,
4+
which is described in the following publication:
5+
6+
Li, J., Sun, J., Li, L., Le, Q. L., & Lin, S. W. (2017, October).
7+
Automatic loop-invariant generation anc refinement through selective sampling.
8+
In 2017 32nd IEEE/ACM International Conference on Automated Software Engineering (ASE) (pp. 782-792). IEEE.
9+
10+
These tasks represent the 53 benchmarks
11+
that are listed in table 1 in this publication.
12+
13+
The original repository for zilu was at (according to the paper):
14+
https://github.com/lijiaying/zilu
15+
16+
It seems this repository was deleted or set to private.
17+
The original repository was published unter GPL-2.0,
18+
a copy I made can be found at:
19+
https://github.com/MartinSpiessl/zilu
20+
21+
So I supply these tasks unter GPL-2.0 as well.
22+
23+
The paper mentions that the tasks were collected
24+
from various papers/sources, one of them being SV-COMP.
25+
It is not easy to identify which tasks were taken from which source,
26+
and the authors state many of the SV-COMP tasks had to be excluded anyway
27+
because they were too complicated/ out of scope.
28+
Also the tasks are written down in a simplified format
29+
in the zilu repository in special files with the extension "cfg".
30+
31+
I did the translation into SV-COMP compliant tasks
32+
myself with a small python script.
33+
Due to these 2 transformations,
34+
I do not believe that the tasks contain
35+
any copyrightable material anymore
36+
from the publications they were originally taken from.
37+
Also the tasks are very simple,
38+
so they will probably fall below the
39+
threshold of originality anyway.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
extern void __assert_fail (__const char *__assertion, __const char *__file,
2+
unsigned int __line, __const char *__function)
3+
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
4+
extern int __VERIFIER_nondet_int(void);
5+
extern _Bool __VERIFIER_nondet_bool(void);
6+
7+
void reach_error(void) {__assert_fail ("0", "benchmark01_polynomial.c", 11, __PRETTY_FUNCTION__);}
8+
9+
void __VERIFIER_assert(int cond) {
10+
if (!cond) {
11+
reach_error();
12+
}
13+
}
14+
15+
/* 01.cfg:
16+
names=x y
17+
beforeloop=
18+
beforeloopinit=
19+
precondition=x==1 && y==1
20+
loopcondition=
21+
loop=x=x+y; y=x;
22+
postcondition=y>=1
23+
afterloop=
24+
learners= conj
25+
*/
26+
int main() {
27+
int x = __VERIFIER_nondet_int();
28+
int y = __VERIFIER_nondet_int();
29+
30+
if (!(x==1 && y==1)) return 0;
31+
while (1) {
32+
x=x+y;
33+
y=x;
34+
}
35+
__VERIFIER_assert(y>=1);
36+
return 0;
37+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
format_version: '2.0'
2+
3+
input_files: 'benchmark01_conjunctive.c'
4+
5+
properties:
6+
- property_file: ../properties/unreach-call.prp
7+
expected_verdict: true
8+
9+
options:
10+
language: C
11+
data_model: ILP32

c/loop-zilu/benchmark02_linear.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
extern void __assert_fail (__const char *__assertion, __const char *__file,
2+
unsigned int __line, __const char *__function)
3+
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
4+
extern int __VERIFIER_nondet_int(void);
5+
extern _Bool __VERIFIER_nondet_bool(void);
6+
7+
void reach_error(void) {__assert_fail ("0", "benchmark02_conjunctive.c", 11, __PRETTY_FUNCTION__);}
8+
9+
void __VERIFIER_assert(int cond) {
10+
if (!cond) {
11+
reach_error();
12+
}
13+
}
14+
15+
/* 02.cfg:
16+
names=l
17+
beforeloop= int n; int i;
18+
beforeloopinit= i = l;
19+
precondition= l>0
20+
loopcondition= i < n
21+
loop=i++;
22+
postcondition=l>=1
23+
afterloop=
24+
learners= linear
25+
*/
26+
int main() {
27+
int n = __VERIFIER_nondet_int();
28+
int i = __VERIFIER_nondet_int();
29+
int l = __VERIFIER_nondet_int();
30+
i = l;
31+
if (!(l>0)) return 0;
32+
while (i < n) {
33+
i++;
34+
}
35+
__VERIFIER_assert(l>=1);
36+
return 0;
37+
}

c/loop-zilu/benchmark02_linear.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
format_version: '2.0'
2+
3+
input_files: 'benchmark02_linear.c'
4+
5+
properties:
6+
- property_file: ../properties/unreach-call.prp
7+
expected_verdict: true
8+
9+
options:
10+
language: C
11+
data_model: ILP32

c/loop-zilu/benchmark03_linear.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
extern void __assert_fail (__const char *__assertion, __const char *__file,
2+
unsigned int __line, __const char *__function)
3+
__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
4+
extern int __VERIFIER_nondet_int(void);
5+
extern _Bool __VERIFIER_nondet_bool(void);
6+
7+
void reach_error(void) {__assert_fail ("0", "benchmark03_linear.c", 11, __PRETTY_FUNCTION__);}
8+
9+
void __VERIFIER_assert(int cond) {
10+
if (!cond) {
11+
reach_error();
12+
}
13+
}
14+
15+
/* 03.cfg:
16+
names=i j
17+
beforeloop=int x, y;
18+
beforeloopinit=x = 0; y = 0;
19+
symbolic=flag
20+
precondition=i==0 && j==0
21+
loopcondition=
22+
loop=x++; y++; i+=x; j+=y; if (flag) j+=1;
23+
postcondition=j>=i
24+
afterloop=
25+
learners= linear
26+
*/
27+
int main() {
28+
int x = __VERIFIER_nondet_int();
29+
int y = __VERIFIER_nondet_int();
30+
int i = __VERIFIER_nondet_int();
31+
int j = __VERIFIER_nondet_int();
32+
33+
_Bool flag = __VERIFIER_nondet_bool();
34+
x = 0; y = 0;
35+
if (!(i==0 && j==0)) return 0;
36+
while (1) {
37+
x++;
38+
y++;
39+
i+=x;
40+
j+=y;
41+
if (flag) j+=1;
42+
}
43+
__VERIFIER_assert(j>=i);
44+
return 0;
45+
}

c/loop-zilu/benchmark03_linear.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
format_version: '2.0'
2+
3+
input_files: 'benchmark03_linear.c'
4+
5+
properties:
6+
- property_file: ../properties/unreach-call.prp
7+
expected_verdict: true
8+
9+
options:
10+
language: C
11+
data_model: ILP32

0 commit comments

Comments
 (0)