summaryrefslogtreecommitdiff
path: root/src/smt/command.cpp
diff options
context:
space:
mode:
authorAbdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com>2020-10-27 13:19:11 -0500
committerGitHub <noreply@github.com>2020-10-27 13:19:11 -0500
commit70d6e3c33571807b7bb94bf4f462de4fdf7a369c (patch)
tree7bf85c35072f7a746de947d31d5f4a79acd6f279 /src/smt/command.cpp
parent88025001599c7e5ced8d55c3769e728758434f69 (diff)
Refactor DeclareSygusVarCommand and SynthFunCommand to use the API. (#5334)
This PR is part of migrating commands. DeclareSygusVarCommand and SynthFunCommand now call public API function instead of their corresponding SmtEngine functions. Those two commands don't fully initialize the solver anymore. Some operations in SygusInterpol::solveInterpolation, which creates an interpolation sub-solver, depend on the solver being fully initialized and were affected by this change. Those operations are now executed by the main solver instead of the sub-solver, which is not fully initialized by the time they are needed.
Diffstat (limited to 'src/smt/command.cpp')
-rw-r--r--src/smt/command.cpp33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/smt/command.cpp b/src/smt/command.cpp
index 9c45c0b19..eb03edf4f 100644
--- a/src/smt/command.cpp
+++ b/src/smt/command.cpp
@@ -581,16 +581,7 @@ api::Sort DeclareSygusVarCommand::getSort() const { return d_sort; }
void DeclareSygusVarCommand::invoke(api::Solver* solver)
{
- try
- {
- solver->getSmtEngine()->declareSygusVar(
- d_symbol, d_var.getNode(), TypeNode::fromType(d_sort.getType()));
- d_commandStatus = CommandSuccess::instance();
- }
- catch (exception& e)
- {
- d_commandStatus = new CommandFailure(e.what());
- }
+ d_commandStatus = CommandSuccess::instance();
}
Command* DeclareSygusVarCommand::clone() const
@@ -646,27 +637,7 @@ const api::Grammar* SynthFunCommand::getGrammar() const { return d_grammar; }
void SynthFunCommand::invoke(api::Solver* solver)
{
- try
- {
- std::vector<Node> vns;
- for (const api::Term& t : d_vars)
- {
- vns.push_back(Node::fromExpr(t.getExpr()));
- }
- solver->getSmtEngine()->declareSynthFun(
- d_symbol,
- Node::fromExpr(d_fun.getExpr()),
- TypeNode::fromType(d_grammar == nullptr
- ? d_sort.getType()
- : d_grammar->resolve().getType()),
- d_isInv,
- vns);
- d_commandStatus = CommandSuccess::instance();
- }
- catch (exception& e)
- {
- d_commandStatus = new CommandFailure(e.what());
- }
+ d_commandStatus = CommandSuccess::instance();
}
Command* SynthFunCommand::clone() const
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback