-
Notifications
You must be signed in to change notification settings - Fork 274
Implement sending commands to solver in incremental SMT2 backend #6357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
e5676af
829c778
aad1bf5
3e9b4a8
778962e
9027d98
fba0629
f286c07
6bc8b1f
b6bfe48
74a83f7
5f01e32
3bc5ee4
6c33e07
28759bc
91da8ba
7a0da55
71d746a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,22 @@ | |
|
||
#include "smt2_incremental_decision_procedure.h" | ||
|
||
#include <solvers/smt2_incremental/smt_commands.h> | ||
#include <solvers/smt2_incremental/smt_to_smt2_string.h> | ||
#include <util/expr.h> | ||
#include <util/string_utils.h> | ||
|
||
smt2_incremental_decision_proceduret::smt2_incremental_decision_proceduret( | ||
std::string solver_command) | ||
: solver_command{std::move(solver_command)}, number_of_solver_calls{0} | ||
std::string _solver_command, | ||
message_handlert &message_handler) | ||
: solver_command(std::move(_solver_command)), | ||
number_of_solver_calls{0}, | ||
solver_process{split_string(solver_command, ' ', false, true)}, | ||
log{message_handler} | ||
{ | ||
send_to_solver(smt_set_option_commandt{smt_option_produce_modelst{true}}); | ||
send_to_solver(smt_set_logic_commandt{ | ||
smt_logic_quantifier_free_uninterpreted_functions_bit_vectorst{}}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to send these at solver construction time, or do we want to send/update these per query? I don't have a good answer now, but there was comment on another issue/PR that the logic could vary for different calls/inputs. Also do we want to be able to change these later (and is this allowed/easy to do)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to section 4.1 of the SMTLIB standard version 2.6, the TLDR; We should be sending these commands at construction time. |
||
} | ||
|
||
exprt smt2_incremental_decision_proceduret::handle(const exprt &expr) | ||
|
@@ -71,3 +81,12 @@ decision_proceduret::resultt smt2_incremental_decision_proceduret::dec_solve() | |
++number_of_solver_calls; | ||
UNIMPLEMENTED_FEATURE("solving."); | ||
} | ||
|
||
void smt2_incremental_decision_proceduret::send_to_solver( | ||
const smt_commandt &command) | ||
{ | ||
const std::string command_string = smt_to_smt2_string(command); | ||
log.debug() << "Sending command to SMT2 solver - " << command_string | ||
<< messaget::eom; | ||
solver_process.send(command_string + "\n"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The split_string looks brittle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arguments are provided to
cbmc
in space separated form. Therefore they currently need to be split in order separate them. Any suggestions for making this less brittle?