class NodeTemplate;
typedef NodeTemplate<true> Node;
-class AssertCommand;
-class BlockModelValuesCommand;
-class CheckSatCommand;
-class CheckSatAssumingCommand;
-class DatatypeDeclarationCommand;
-class DeclareFunctionCommand;
-class DeclareHeapCommand;
-class DeclareSortCommand;
-class DeclareSygusVarCommand;
-class DefineFunctionCommand;
-class DefineFunctionRecCommand;
-class DefineSortCommand;
+class Command;
class DType;
class DTypeConstructor;
class DTypeSelector;
-class GetAbductCommand;
-class GetInterpolCommand;
-class GetModelCommand;
-class GetQuantifierEliminationCommand;
-class GetUnsatCoreCommand;
-class GetValueCommand;
class NodeManager;
-class ResetCommand;
-class SetUserAttributeCommand;
-class SimplifyCommand;
class SmtEngine;
-class SygusConstraintCommand;
-class SygusInvConstraintCommand;
-class SynthFunCommand;
class TypeNode;
class Options;
-class QueryCommand;
class Random;
class Result;
*/
class CVC4_EXPORT Sort
{
- friend class cvc5::DatatypeDeclarationCommand;
- friend class cvc5::DeclareFunctionCommand;
- friend class cvc5::DeclareHeapCommand;
- friend class cvc5::DeclareSortCommand;
- friend class cvc5::DeclareSygusVarCommand;
- friend class cvc5::DefineSortCommand;
- friend class cvc5::GetAbductCommand;
- friend class cvc5::GetInterpolCommand;
- friend class cvc5::GetModelCommand;
- friend class cvc5::SynthFunCommand;
+ friend class cvc5::Command;
friend class DatatypeConstructor;
friend class DatatypeConstructorDecl;
friend class DatatypeSelector;
*/
class CVC4_EXPORT Term
{
- friend class cvc5::AssertCommand;
- friend class cvc5::BlockModelValuesCommand;
- friend class cvc5::CheckSatCommand;
- friend class cvc5::CheckSatAssumingCommand;
- friend class cvc5::DeclareSygusVarCommand;
- friend class cvc5::DefineFunctionCommand;
- friend class cvc5::DefineFunctionRecCommand;
- friend class cvc5::GetAbductCommand;
- friend class cvc5::GetInterpolCommand;
- friend class cvc5::GetModelCommand;
- friend class cvc5::GetQuantifierEliminationCommand;
- friend class cvc5::GetUnsatCoreCommand;
- friend class cvc5::GetValueCommand;
- friend class cvc5::SetUserAttributeCommand;
- friend class cvc5::SimplifyCommand;
- friend class cvc5::SygusConstraintCommand;
- friend class cvc5::SygusInvConstraintCommand;
- friend class cvc5::SynthFunCommand;
- friend class cvc5::QueryCommand;
+ friend class cvc5::Command;
friend class Datatype;
friend class DatatypeConstructor;
friend class DatatypeSelector;
*/
class CVC4_EXPORT Grammar
{
- friend class cvc5::GetAbductCommand;
- friend class cvc5::GetInterpolCommand;
- friend class cvc5::SynthFunCommand;
+ friend class cvc5::Command;
friend class Solver;
public:
friend class DatatypeSelector;
friend class Grammar;
friend class Op;
- friend class cvc5::ResetCommand;
+ friend class cvc5::Command;
friend class Sort;
friend class Term;
}
}
+Node Command::termToNode(const api::Term& term) { return term.getNode(); }
+
+std::vector<Node> Command::termVectorToNodes(
+ const std::vector<api::Term>& terms)
+{
+ return api::Term::termVectorToNodes(terms);
+}
+
+TypeNode Command::sortToTypeNode(const api::Sort& sort)
+{
+ return sort.getTypeNode();
+}
+
+std::vector<TypeNode> Command::sortVectorToTypeNodes(
+ const std::vector<api::Sort>& sorts)
+{
+ return api::Sort::sortVectorToTypeNodes(sorts);
+}
+
+TypeNode Command::grammarToTypeNode(api::Grammar* grammar)
+{
+ return grammar == nullptr ? TypeNode::null()
+ : sortToTypeNode(grammar->resolve());
+}
+
+Options& Command::getOriginalOptionsFrom(api::Solver* s)
+{
+ return *s->d_originalOptions.get();
+}
+
/* -------------------------------------------------------------------------- */
/* class EmptyCommand */
/* -------------------------------------------------------------------------- */
{
try
{
- solver->getSmtEngine()->assertFormula(d_term.getNode(), d_inUnsatCore);
+ solver->getSmtEngine()->assertFormula(termToNode(d_term), d_inUnsatCore);
d_commandStatus = CommandSuccess::instance();
}
catch (UnsafeInterruptException& e)
size_t dag,
OutputLanguage language) const
{
- Printer::getPrinter(language)->toStreamCmdAssert(out, d_term.getNode());
+ Printer::getPrinter(language)->toStreamCmdAssert(out, termToNode(d_term));
}
/* -------------------------------------------------------------------------- */
size_t dag,
OutputLanguage language) const
{
- Printer::getPrinter(language)->toStreamCmdCheckSat(out, d_term.getNode());
+ Printer::getPrinter(language)->toStreamCmdCheckSat(out, termToNode(d_term));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdCheckSatAssuming(
- out, api::Term::termVectorToNodes(d_terms));
+ out, termVectorToNodes(d_terms));
}
/* -------------------------------------------------------------------------- */
size_t dag,
OutputLanguage language) const
{
- Printer::getPrinter(language)->toStreamCmdQuery(out, d_term.getNode());
+ Printer::getPrinter(language)->toStreamCmdQuery(out, termToNode(d_term));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdDeclareVar(
- out, d_var.getNode(), d_sort.getTypeNode());
+ out, termToNode(d_var), sortToTypeNode(d_sort));
}
/* -------------------------------------------------------------------------- */
size_t dag,
OutputLanguage language) const
{
- std::vector<Node> nodeVars = api::Term::termVectorToNodes(d_vars);
+ std::vector<Node> nodeVars = termVectorToNodes(d_vars);
Printer::getPrinter(language)->toStreamCmdSynthFun(
out,
- d_fun.getNode(),
+ termToNode(d_fun),
nodeVars,
d_isInv,
- d_grammar == nullptr ? TypeNode::null()
- : d_grammar->resolve().getTypeNode());
+ d_grammar == nullptr ? TypeNode::null() : grammarToTypeNode(d_grammar));
}
/* -------------------------------------------------------------------------- */
size_t dag,
OutputLanguage language) const
{
- Printer::getPrinter(language)->toStreamCmdConstraint(out, d_term.getNode());
+ Printer::getPrinter(language)->toStreamCmdConstraint(out, termToNode(d_term));
}
/* -------------------------------------------------------------------------- */
{
Printer::getPrinter(language)->toStreamCmdInvConstraint(
out,
- d_predicates[0].getNode(),
- d_predicates[1].getNode(),
- d_predicates[2].getNode(),
- d_predicates[3].getNode());
+ termToNode(d_predicates[0]),
+ termToNode(d_predicates[1]),
+ termToNode(d_predicates[2]),
+ termToNode(d_predicates[3]));
}
/* -------------------------------------------------------------------------- */
{
sm->reset();
Options opts;
- opts.copyValues(*solver->d_originalOptions);
+ opts.copyValues(getOriginalOptionsFrom(solver));
// This reconstructs a new solver object at the same memory location as the
// current one. Note that this command does not own the solver object!
// It may be safer to instead make the ResetCommand a special case in the
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdDeclareFunction(
- out, d_func.toString(), d_sort.getTypeNode());
+ out, d_func.toString(), sortToTypeNode(d_sort));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdDeclareType(out,
- d_sort.getTypeNode());
+ sortToTypeNode(d_sort));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdDefineType(
- out,
- d_symbol,
- api::Sort::sortVectorToTypeNodes(d_params),
- d_sort.getTypeNode());
+ out, d_symbol, sortVectorToTypeNodes(d_params), sortToTypeNode(d_sort));
}
/* -------------------------------------------------------------------------- */
Printer::getPrinter(language)->toStreamCmdDefineFunction(
out,
d_func.toString(),
- api::Term::termVectorToNodes(d_formals),
- d_func.getNode().getType().getRangeType(),
- d_formula.getNode());
+ termVectorToNodes(d_formals),
+ termToNode(d_func).getType().getRangeType(),
+ termToNode(d_formula));
}
/* -------------------------------------------------------------------------- */
formals.reserve(d_formals.size());
for (const std::vector<api::Term>& formal : d_formals)
{
- formals.push_back(api::Term::termVectorToNodes(formal));
+ formals.push_back(termVectorToNodes(formal));
}
Printer::getPrinter(language)->toStreamCmdDefineFunctionRec(
- out,
- api::Term::termVectorToNodes(d_funcs),
- formals,
- api::Term::termVectorToNodes(d_formulas));
+ out, termVectorToNodes(d_funcs), formals, termVectorToNodes(d_formulas));
}
/* -------------------------------------------------------------------------- */
/* class DeclareHeapCommand */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdDeclareHeap(
- out, d_locSort.getTypeNode(), d_dataSort.getTypeNode());
+ out, sortToTypeNode(d_locSort), sortToTypeNode(d_dataSort));
}
/* -------------------------------------------------------------------------- */
{
if (!d_term.isNull())
{
- solver->getSmtEngine()->setUserAttribute(
- d_attr,
- d_term.getNode(),
- api::Term::termVectorToNodes(d_termValues),
- d_strValue);
+ solver->getSmtEngine()->setUserAttribute(d_attr,
+ termToNode(d_term),
+ termVectorToNodes(d_termValues),
+ d_strValue);
}
d_commandStatus = CommandSuccess::instance();
}
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdSetUserAttribute(
- out, d_attr, d_term.getNode());
+ out, d_attr, termToNode(d_term));
}
/* -------------------------------------------------------------------------- */
size_t dag,
OutputLanguage language) const
{
- Printer::getPrinter(language)->toStreamCmdSimplify(out, d_term.getNode());
+ Printer::getPrinter(language)->toStreamCmdSimplify(out, termToNode(d_term));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdGetValue(
- out, api::Term::termVectorToNodes(d_terms));
+ out, termVectorToNodes(d_terms));
}
/* -------------------------------------------------------------------------- */
std::vector<api::Sort> declareSorts = sm->getModelDeclareSorts();
for (const api::Sort& s : declareSorts)
{
- d_result->addDeclarationSort(s.getTypeNode());
+ d_result->addDeclarationSort(sortToTypeNode(s));
}
std::vector<api::Term> declareTerms = sm->getModelDeclareTerms();
for (const api::Term& t : declareTerms)
{
- d_result->addDeclarationTerm(t.getNode());
+ d_result->addDeclarationTerm(termToNode(t));
}
d_commandStatus = CommandSuccess::instance();
}
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdBlockModelValues(
- out, api::Term::termVectorToNodes(d_terms));
+ out, termVectorToNodes(d_terms));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdGetInterpol(
- out, d_name, d_conj.getNode(), d_sygus_grammar->resolve().getTypeNode());
+ out, d_name, termToNode(d_conj), grammarToTypeNode(d_sygus_grammar));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdGetAbduct(
- out, d_name, d_conj.getNode(), d_sygus_grammar->resolve().getTypeNode());
+ out, d_name, termToNode(d_conj), grammarToTypeNode(d_sygus_grammar));
}
/* -------------------------------------------------------------------------- */
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdGetQuantifierElimination(
- out, d_term.getNode());
+ out, termToNode(d_term));
}
/* -------------------------------------------------------------------------- */
if (options::dumpUnsatCoresFull())
{
// use the assertions
- UnsatCore ucr(api::Term::termVectorToNodes(d_result));
+ UnsatCore ucr(termVectorToNodes(d_result));
ucr.toStream(out);
}
else
OutputLanguage language) const
{
Printer::getPrinter(language)->toStreamCmdDatatypeDeclaration(
- out, api::Sort::sortVectorToTypeNodes(d_datatypes));
+ out, sortVectorToTypeNodes(d_datatypes));
}
} // namespace cvc5