You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-16
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,27 @@
2
2
# Environment Setup
3
3
4
4
## Basic Setup
5
-
- python-2.7
5
+
The following are needed for running the basic setup
6
+
- python-3.7
6
7
- PyTorch 0.4.0
7
8
- python library: numpy, tqdm, pyparsing
8
9
- gcc/g++ 5.4.0 (or higher)
10
+
- clang-7
9
11
- make, cmake
10
12
11
13
## Z3 Setup
12
14
code2inv uses the Z3 theorem prover to verify the correctness of generated loop invariants. Follow these steps to build Z3:
13
-
14
15
1. Clone the source code of Z3 from https://github.com/Z3Prover/z3
15
-
2. Run ```python scripts/mk_make.py --prefix /usr/local/; cd build; make -j16; make install```
16
+
2. Run ```git checkout tags/z3-4.8.7; python scripts/mk_make.py --prefix=<installation_prefix> --python --pypkgdir=<python_site_package_directory>; cd build; make; make install```
16
17
17
-
Remember to set environment variables DYLD_LIBRARY_PATH and PYTHONPATH to contain paths for Z3 shared libraries and Z3Py, respectively. These paths will be indicated upon successful installation of Z3.
18
+
Remember to set environment variables LD_LIBRARY_PATH and PYTHONPATH to contain paths for Z3 shared libraries and Z3Py, respectively. These paths will be indicated upon successful installation of Z3.
18
19
19
20
## Frontend Setup (Optional)
20
-
The frontend is used to extract program graphs and verification conditions (VCs) from the input C programs. The program graphs and VCs for our benchmarks are already included in the `benchmarks` directory. To build the frontend, follow the instructions in README in `clang-fe`.
21
+
There are two frontends, one each for the C and CHC instances. The C frontend is called clang-fe and can be found in the `clang-fe/` directory. The CHC frontend is called chc-fe and is located in the `chc-fe/` directory.
22
+
23
+
The `clang-fe` frontend is used to extract program graphs and verification conditions (VCs) from the input C programs. The program graphs and VCs for our benchmarks are already included in the `benchmarks/C_instances` directory and the same for the Non Linear benchmarks are included in the `benchmarks/nl-bench/` directory. To build the frontend, follow the instructions in README in `clang-fe`.
21
24
25
+
The `chc-fe` frontend is used to extract program graphs from the input CHC programs (the CHC constraints themselves serve as the verification conditions (VCs)). The graphs and the VCs are already included in the `benchmarks/CHC_instances` directory. To run the CHC frontend, follow the instructions in README in `chc-fe`.
22
26
23
27
# Experiments
24
28
@@ -30,41 +34,48 @@ Install the dev version of this package:
30
34
31
35
## Running as an out-of-the-box solver
32
36
33
-
```cd code2inv/prog_generator```, then directly run the script ```./run_solver.sh```
37
+
```cd code2inv/prog_generator```, then directly run the script ```./run_solver_file.sh <graph_file.json> <vc_file> <specification_file>```.
1. Set the ```data_folder``` option to the code folder that contains folders ```graph/``` and ```smt2/``` which are created by the front-end pre-processor
38
-
2. Set the ```file_list``` option to the file that contains a list of code names. See ```code2inv/benchmarks/names.txt``` as an example.
39
-
3. Set the ```single_sample``` option to be the index of code where you want to find the loopinv for.
40
-
4. Adjust other parameters if necessary. Make sure to change parameters like ```max_and, max_or, max_depth, list_op``` to make sure the loopinv space is large enough (but not too large).
43
+
The specification file is a file as such:
44
+
45
+
```
46
+
name_of_inv_grammar
47
+
name_of_solver_script (in the format of a python package)
48
+
var_format (ssa if graph has variables in the ssa format, leave blank if not)
49
+
```
50
+
51
+
Refer to the spec files in `spec/` directory as an example
where ```dataset``` is the data name, ```prog_idx``` stands for the set of random perturbed programs, and ```agg_check``` can be 0 or 1, denoting whether more aggressive checker should be used.
0 commit comments