Skip to content

Commit 5d603e4

Browse files
Merge pull request #7161 from esteffin/esteffin/add-dump-smt-formula-arg
Log to file the SMT formula run by the solver
2 parents c1e2ed3 + 481c43e commit 5d603e4

15 files changed

+135
-8
lines changed

doc/man/cbmc.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ The flag \fB\-\-slice\-formula\fR should be added to remove some not-yet support
467467
\fB\-\-outfile\fR filename
468468
output formula to given file
469469
.TP
470+
\fB\-\-dump\-smt\-formula\fR filename
471+
output smt incremental formula to the given file
472+
.TP
470473
\fB\-\-write\-solver\-stats\-to\fR json\-file
471474
collect the solver query complexity
472475
.TP

doc/man/jbmc.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ incremental solving (experimental)
445445
\fB\-\-outfile\fR filename
446446
output formula to given file
447447
.TP
448+
\fB\-\-dump\-smt\-formula\fR filename
449+
output smt incremental formula to the given file
450+
.TP
448451
\fB\-\-write\-solver\-stats\-to\fR \fIjson\-file\fR
449452
collect the solver query complexity
450453
.TP
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
\(set-option :produce-models true\)
2+
\(set-logic ALL\)
3+
\(define-fun B0 \(\) Bool true\)
4+
\(declare-fun |main::1::x!0@1#1| \(\) \(_ BitVec 32\)\)
5+
\(define-fun B1 \(\) Bool \(= |main::1::x!0@1#1| |main::1::x!0@1#1|\)\)
6+
\(assert \(not \(not \(= |main::1::x!0@1#1| \(_ bv0 32\)\)\)\)\)
7+
\(define-fun B2 \(\) Bool \(not false\)\)
8+
\(assert B2\)
9+
\(check-sat\)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
test.c
3+
--incremental-smt2-solver 'cvc5 --lang=smtlib2.6 --incremental' --slice-formula --dump-smt-formula %out-file-name%
4+
Passing problem to incremental SMT2 solving via "cvc5 --lang=smtlib2.6 --incremental"
5+
\[main.assertion.\d+\] line \d+ Nondeterministic int assert.: FAILURE
6+
Output file matches.
7+
^EXIT=0$
8+
^SIGNAL=0$
9+
--
10+
Test to check that the --dump-smt-formula argument is used correctly and that the output file
11+
matches the rules defined in test-outfile-rules.txt
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
\(set-option :produce-models true\)
2+
\(set-logic ALL\)
3+
\(define-fun B0 \(\) Bool true\)
4+
\(define-fun B2 \(\) Bool \(not false\)\)
5+
\(check-sat\)
6+
\(assert B2\)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
test.c
3+
--incremental-smt2-solver 'cvc5 --lang=smtlib2.6 --incremental' --slice-formula --dump-smt-formula %out-file-name%
4+
Passing problem to incremental SMT2 solving via "cvc5 --lang=smtlib2.6 --incremental"
5+
\[main.assertion.\d+\] line \d+ Nondeterministic int assert.: FAILURE
6+
Output file does not match.
7+
^EXIT=1$
8+
^SIGNAL=0$
9+
--
10+
Test to check that the --dump-smt-formula argument is used correctly and that the output file does
11+
not match the rules defined in test-outfile-rules.txt
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
int main()
3+
{
4+
int x;
5+
__CPROVER_assert(x, "Nondeterministic int assert.");
6+
return 0;
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
\(set-option :produce-models true\)
2+
\(set-logic ALL\)
3+
\(define-fun B0 \(\) Bool true\)
4+
\(declare-fun |main::1::x!0@1#1| \(\) \(_ BitVec 32\)\)
5+
\(define-fun B1 \(\) Bool \(= |main::1::x!0@1#1| |main::1::x!0@1#1|\)\)
6+
\(assert \(not \(not \(= |main::1::x!0@1#1| \(_ bv0 32\)\)\)\)\)
7+
\(define-fun B2 \(\) Bool \(not false\)\)
8+
\(assert B2\)
9+
\(check-sat\)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
test.c
3+
--incremental-smt2-solver 'z3 --smt2 -in' --slice-formula --dump-smt-formula %out-file-name%
4+
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
5+
\[main.assertion.\d+\] line \d+ Nondeterministic int assert.: FAILURE
6+
Output file matches.
7+
^EXIT=0$
8+
^SIGNAL=0$
9+
--
10+
Test to check that the --dump-smt-formula argument is used correctly and that the output file
11+
matches the rules defined in test-outfile-rules.txt
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
\(set-option :produce-models true\)
2+
\(set-logic ALL\)
3+
\(define-fun B0 \(\) Bool true\)
4+
\(define-fun B2 \(\) Bool \(not false\)\)
5+
\(check-sat\)
6+
\(assert B2\)

0 commit comments

Comments
 (0)