diff options
author | Abdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com> | 2020-10-27 13:19:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 13:19:11 -0500 |
commit | 70d6e3c33571807b7bb94bf4f462de4fdf7a369c (patch) | |
tree | 7bf85c35072f7a746de947d31d5f4a79acd6f279 /src/theory/quantifiers/sygus/sygus_interpol.cpp | |
parent | 88025001599c7e5ced8d55c3769e728758434f69 (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/theory/quantifiers/sygus/sygus_interpol.cpp')
-rw-r--r-- | src/theory/quantifiers/sygus/sygus_interpol.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/theory/quantifiers/sygus/sygus_interpol.cpp b/src/theory/quantifiers/sygus/sygus_interpol.cpp index e4e7a02c7..d5ab0e51f 100644 --- a/src/theory/quantifiers/sygus/sygus_interpol.cpp +++ b/src/theory/quantifiers/sygus/sygus_interpol.cpp @@ -319,6 +319,18 @@ bool SygusInterpol::solveInterpolation(const std::string& name, const TypeNode& itpGType, Node& interpol) { + // Some instructions in setSynthGrammar and mkSygusConjecture need a fully + // initialized solver to work properly. Notice, however, that the sub-solver + // created below is not fully initialized by the time those two methods are + // needed. Therefore, we call them while the current parent solver is in scope + // (i.e., before creating the sub-solver). + collectSymbols(axioms, conj); + createVariables(itpGType.isNull()); + TypeNode grammarType = setSynthGrammar(itpGType, axioms, conj); + + Node itp = mkPredicate(name); + mkSygusConjecture(itp, axioms, conj); + std::unique_ptr<SmtEngine> subSolver; initializeSubsolver(subSolver); // get the logic @@ -327,17 +339,12 @@ bool SygusInterpol::solveInterpolation(const std::string& name, l.enableSygus(); subSolver->setLogic(l); - collectSymbols(axioms, conj); - createVariables(itpGType.isNull()); for (Node var : d_vars) { subSolver->declareSygusVar(name, var, var.getType()); } std::vector<Node> vars_empty; - TypeNode grammarType = setSynthGrammar(itpGType, axioms, conj); - Node itp = mkPredicate(name); subSolver->declareSynthFun(name, itp, grammarType, false, vars_empty); - mkSygusConjecture(itp, axioms, conj); Trace("sygus-interpol") << "SmtEngine::getInterpol: made conjecture : " << d_sygusConj << ", solving for " << d_sygusConj[0][0] << std::endl; |