Skip to content

Commit 9bc1dcb

Browse files
committed
Updated README
1 parent e629a48 commit 9bc1dcb

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,46 @@ $ ./run_solver_file_with_weights.sh ../../benchmarks/C_instances/c_graph/69.c.js
135135
```
136136
-->
137137

138+
### Process for running Code2Inv with C files
139+
140+
Code2Inv only supports C files with one loop and no external function calls (refer to `benchmarks/C_instances/c/` for examples of supported C programs).
141+
142+
We refer to the file as `file.c`.
143+
144+
First, we need our input files which are the program graph json file and verification conditions SMT2 file. Follow the README in `clang-fe/` and build the front-end. Then perform the following while in the `clang-fe/` directory:
145+
```
146+
$ ./bin/clang-fe -ssa file.c > file.c.json 2>/dev/null
147+
$ ./bin/clang-fe -smt file.c > file.c.smt2 2>/dev/null
148+
```
149+
150+
Our graph file is now `file.c.json` and verification condition file is `file.c.smt2`. Now from the repository directory, do the following:
151+
```
152+
$ cd code2inv/prog_generator
153+
$ ./run_solver_file.sh file.c.json file.c.smt2 specs/c_spec -o file_inv.txt
154+
```
155+
156+
After the solution is found (if it is found), you will see the solution and its logs printed on the screen (the line begins with `Found a solution for 0...`). There will also be a file called file_inv.txt created with this information.
157+
158+
### Process for running Code2Inv with CHC clauses
159+
160+
Code2Inv has only been tested on the CHC constraints corresponding to single loop C files obtained from Seahorn (refer to `benchmarks/CHC_instances/sygus-constraints` for examples of supported CHC constraints).
161+
162+
We refer to our file as `file.chc`.
163+
164+
First, we need our input files which are the program graph json file and the verification conditions file. The CHC file itself will serve as our verification condition file, so we only need to extract a program graph from it:
165+
```
166+
$ cd chc-fe
167+
$ python graph-gen.py file.chc > file.json
168+
```
169+
170+
Our graph file is now `file.json` and verification condition file is `file.chc`. From the repository directory, do the following:
171+
```
172+
$ cd code2inv/prog_generator
173+
$ ./run_solver_file.sh file.c.json file.c.smt2 specs/c_spec -o file_inv.txt
174+
```
175+
176+
After the solution is found (if it is found), you will see the solution and its logs printed on the screen (the line begins with `Found a solution for 0...`). There will also be a file called file_inv.txt created with this information.
177+
138178
## Running with pretraining and fine-tuning
139179

140180
### Pretraining:

0 commit comments

Comments
 (0)