context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- SmtGlobals* globals) :
- Theory(THEORY_$alt_id, c, u, out, valuation, logicInfo, globals) {
+ const LogicInfo& logicInfo) :
+ Theory(THEORY_$alt_id, c, u, out, valuation, logicInfo) {
}/* Theory$camel::Theory$camel() */
void Theory$camel::check(Effort level) {
context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- SmtGlobals* globals);
+ const LogicInfo& logicInfo);
void check(Effort);
context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- SmtGlobals* globals) :
- Theory(THEORY_$id, c, u, out, valuation, logicInfo, globals) {
+ const LogicInfo& logicInfo) :
+ Theory(THEORY_$id, c, u, out, valuation, logicInfo) {
}/* Theory$camel::Theory$camel() */
void Theory$camel::check(Effort level) {
context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- SmtGlobals* globals);
+ const LogicInfo& logicInfo);
void check(Effort);
#include "expr/expr.h"
#include "expr/expr_iomanip.h"
-#include "options/base_options.h"
#include "options/language.h"
#include "options/options.h"
} else {
// 0-extend to size
Expr extendOp = em()->mkConst(BitVectorZeroExtend(newSize - size()));
- return em()->mkExpr(extendOp, d_expr);
+ return em()->mkExpr(extendOp, d_expr);
}
}
ExprManager* Word::em() {
if (s_manager == 0) {
CVC4::Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
- options.set(outputLanguage, language::output::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
+ options.setOutputLanguage(language::output::LANG_SMTLIB_V2);
s_manager = new CVC4::ExprManager(options);
}
return s_manager;
d_expr = b.getExpr();
}
}
-
-
#include "expr/expr.h"
#include "expr/expr_iomanip.h"
#include "options/language.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "options/set_language.h"
#include "parser/parser.h"
using namespace std;
using namespace CVC4;
using namespace CVC4::parser;
-using namespace CVC4::options;
using namespace CVC4::theory;
int main(int argc, char* argv[])
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
ExprManager exprManager(options);
cout << language::SetLanguage(language::output::LANG_SMTLIB_V2)
#include <vector>
#include "expr/expr.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
ExprManager exprManager(options);
-
+
// Create the parser
ParserBuilder parserBuilder(&exprManager, input, options);
Parser* parser = parserBuilder.build();
-
+
// Variables and assertions
vector<string> variables;
vector<string> info_tags;
#include "expr/expr.h"
#include "expr/expr_iomanip.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
using namespace CVC4::parser;
using namespace CVC4::options;
-int main(int argc, char* argv[])
+int main(int argc, char* argv[])
{
- // Get the filename
+ // Get the filename
string input(argv[1]);
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
- options.set(outputLanguage, language::output::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
+ options.setOutputLanguage(language::output::LANG_SMTLIB_V2);
ExprManager exprManager(options);
cout << expr::ExprDag(0) << expr::ExprSetDepth(-1);
-
+
// Create the parser
ParserBuilder parserBuilder(&exprManager, input, options);
Parser* parser = parserBuilder.build();
// Get rid of the parser
delete parser;
}
-
-
#include <vector>
#include "expr/expr.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
ExprManager exprManager(options);
// Create the parser
#include <vector>
#include "expr/expr.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
using namespace std;
using namespace CVC4;
using namespace CVC4::parser;
-using namespace CVC4::options;
void translate_to_mathematica(
string input,
const vector<string>& info_tags,
const vector<string>& info_data,
- const map<Expr, unsigned>& variables,
+ const map<Expr, unsigned>& variables,
const vector<Expr>& assertions);
-int main(int argc, char* argv[])
+int main(int argc, char* argv[])
{
- // Get the filename
+ // Get the filename
string input(argv[1]);
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
ExprManager exprManager(options);
-
+
// Create the parser
ParserBuilder parserBuilder(&exprManager, input, options);
Parser* parser = parserBuilder.build();
// End resolve
cout << ", Reals]" << endl;
}
-
#include <vector>
#include "expr/expr.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
using namespace std;
using namespace CVC4;
using namespace CVC4::parser;
-using namespace CVC4::options;
-
void translate_to_qepcad(
string input,
const vector<string>& info_tags,
const vector<string>& info_data,
- const map<Expr, unsigned>& variables,
+ const map<Expr, unsigned>& variables,
const vector<Expr>& assertions);
-int main(int argc, char* argv[])
+int main(int argc, char* argv[])
{
std::map<Expr, unsigned> vars2id;
- // Get the filename
+ // Get the filename
string input(argv[1]);
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
ExprManager exprManager(options);
-
+
// Create the parser
ParserBuilder parserBuilder(&exprManager, input, options);
Parser* parser = parserBuilder.build();
continue;
}
- DeclareFunctionCommand* declare = dynamic_cast<DeclareFunctionCommand*>(cmd);
+ DeclareFunctionCommand* declare =
+ dynamic_cast<DeclareFunctionCommand*>(cmd);
if (declare) {
string name = declare->getSymbol();
Expr var = parser->getVariable(name);
delete cmd;
continue;
}
-
+
AssertCommand* assert = dynamic_cast<AssertCommand*>(cmd);
if (assert) {
assertions.push_back(assert->getExpr());
continue;
}
- delete cmd;
+ delete cmd;
}
// Do the translation
translate_to_qepcad(input, info_tags, info_data, variables, assertions);
-
+
// Get rid of the parser
delete parser;
}
-void translate_to_qepcad_term(const std::map<Expr, unsigned>& variables, const Expr& term) {
+void translate_to_qepcad_term(const std::map<Expr, unsigned>& variables,
+ const Expr& term)
+{
bool first;
unsigned n = term.getNumChildren();
-
+
if (n == 0) {
if (term.getKind() == kind::CONST_RATIONAL) {
cout << term.getConst<Rational>();
- } else {
+ } else {
assert(variables.find(term) != variables.end());
cout << "x" << variables.find(term)->second;
}
} else {
-
+
switch (term.getKind()) {
case kind::PLUS:
cout << "(";
translate_to_qepcad_term(variables, term[i]);
}
cout << ")";
- break;
+ break;
case kind::MINUS:
cout << "(";
translate_to_qepcad_term(variables, term[0]);
cout << " - ";
- translate_to_qepcad_term(variables, term[1]);
+ translate_to_qepcad_term(variables, term[1]);
cout << ")";
break;
case kind::UMINUS:
assert(false);
break;
}
- }
+ }
}
-void translate_to_qepcad(const std::map<Expr, unsigned>& variables, const Expr& assertion) {
+void translate_to_qepcad(const std::map<Expr, unsigned>& variables,
+ const Expr& assertion)
+{
bool first;
-
+
unsigned n = assertion.getNumChildren();
-
+
if (n == 0) {
assert(false);
} else {
-
+
std::string op;
bool theory = false;
bool binary = false;
-
+
switch (assertion.getKind()) {
- case kind::NOT:
- cout << "[~";
+ case kind::NOT:
+ cout << "[~";
translate_to_qepcad(variables, assertion[0]);
cout << "]";
break;
translate_to_qepcad(variables, assertion[i]);
}
cout << "]";
- break;
+ break;
case kind::IMPLIES:
op = "==>";
binary = true;
case kind::IFF:
op = "<==>";
binary = true;
- break;
+ break;
case kind::EQUAL:
op = "=";
theory = true;
cout << " " << op << " ";
translate_to_qepcad_term(variables, assertion[1]);
cout << "]";
- }
+ }
if (binary) {
cout << "[";
cout << " " << op << " ";
translate_to_qepcad(variables, assertion[1]);
cout << "]";
- }
- }
+ }
+ }
}
void translate_to_qepcad(
string input,
const vector<string>& info_tags,
const vector<string>& info_data,
- const std::map<Expr, unsigned>& variables,
+ const std::map<Expr, unsigned>& variables,
const vector<Expr>& assertions)
{
bool first;
cout << "[ translated from " << input << " ";
bool dump_tags = false;
- if (dump_tags) {
- first = true;
+ if (dump_tags) {
+ first = true;
for (unsigned i = 0; i < info_tags.size(); ++ i) {
if (!first) {
- cout << ", ";
+ cout << ", ";
}
first = false;
cout << info_tags[i] << " = " << info_data[i];
}
}
-
- cout << "]" << endl;
+
+ cout << "]" << endl;
// Declare the variables
cout << "(";
-
+
first = true;
for (unsigned i = 0; i < variables.size(); ++ i) {
if (!first) {
first = false;
cout << "x" << i;;
}
-
+
cout << ")" << endl;
- // Number of free variables
+ // Number of free variables
cout << "0" << endl;
- // The quantifiers first
+ // The quantifiers first
for (unsigned i = 0; i < variables.size(); ++ i) {
cout << "(Ex" << i << ")";
}
-
+
// Now the formula
cout << "[";
if (assertions.size() > 1) {
for (unsigned i = 0; i < assertions.size(); ++ i) {
if (!first) {
cout << " /\\ ";
- }
+ }
first = false;
translate_to_qepcad(variables, assertions[i]);
}
} else {
translate_to_qepcad(variables, assertions[0]);
}
- cout << "]." << endl;
+ cout << "]." << endl;
// Before normalization
cout << "go" << endl;
-
+
// Before projection
if (variables.size() > 3) {
cout << "proj-op (m,m";
for (unsigned i = 3; i < variables.size(); ++ i) {
cout << ",h";
- }
+ }
cout << ")" << endl;
}
cout << "go" << endl;
-
+
// Before choice
cout << "d-stat" << endl;
-
+
// Before solution
- cout << "go" << endl;
+ cout << "go" << endl;
// Finish up
cout << "finish" << endl;
}
-
#include <vector>
#include "expr/expr.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
string command,
const vector<string>& info_tags,
const vector<string>& info_data,
- const map<Expr, unsigned>& variables,
+ const map<Expr, unsigned>& variables,
const vector<Expr>& assertions);
-int main(int argc, char* argv[])
+int main(int argc, char* argv[])
{
- // Get the filename
+ // Get the filename
string input(argv[1]);
// Get the redlog command
string command(argv[2]);
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
ExprManager exprManager(options);
-
+
// Create the parser
ParserBuilder parserBuilder(&exprManager, input, options);
Parser* parser = parserBuilder.build();
assert(false);
break;
}
- }
+ }
}
void translate_to_redlog(const map<Expr, unsigned>& variables, const Expr& assertion) {
bool first;
-
+
unsigned n = assertion.getNumChildren();
-
+
if (n == 0) {
if (assertion.isConst()) {
if (assertion.getConst<bool>()) {
assert(false);
}
} else {
-
+
std::string op;
bool binary = false;
bool theory = false;
-
+
switch (assertion.getKind()) {
- case kind::NOT:
+ case kind::NOT:
cout << "(not ";
translate_to_redlog(variables, assertion[0]);
cout << ")";
cout << "quit;" << endl;
}
-
#include "expr/expr.h"
#include "options/language.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "options/set_language.h"
#include "parser/parser.h"
// Create the expression manager
Options options;
- options.set(inputLanguage, language::input::LANG_SMTLIB_V2);
+ options.setInputLanguage(language::input::LANG_SMTLIB_V2);
cout << language::SetLanguage(language::output::LANG_SMTLIB_V2);
// cout << Expr::dag(0);
ExprManager exprManager(options);
#include "expr/expr.h"
#include "expr/expr_iomanip.h"
-#include "options/base_options.h"
#include "options/language.h"
+#include "options/options.h"
#include "options/set_language.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
*out << language::SetLanguage(toLang);
Options opts;
- opts.set(options::inputLanguage, fromLang);
+ opts.setInputLanguage(fromLang);
ExprManager exprMgr(opts);
ParserBuilder parserBuilder(&exprMgr, filename, opts);
if(!strcmp(filename, "-")) {
prop/sat_solver_types.h \
prop/sat_solver_factory.h \
prop/sat_solver_factory.cpp \
- smt/smt_engine.cpp \
- smt/smt_engine_check_proof.cpp \
- smt/smt_engine.h \
- smt/smt_globals.cpp \
- smt/smt_globals.h \
+ smt/boolean_terms.cpp \
+ smt/boolean_terms.h \
+ smt/command_list.cpp \
+ smt/command_list.h \
+ smt/logic_exception.h \
+ smt/logic_request.cpp \
+ smt/logic_request.h \
+ smt/managed_ostreams.cpp \
+ smt/managed_ostreams.h \
smt/model_postprocessor.cpp \
smt/model_postprocessor.h \
+ smt/smt_engine.cpp \
+ smt/smt_engine.h \
+ smt/smt_engine_check_proof.cpp \
smt/smt_engine_scope.cpp \
smt/smt_engine_scope.h \
- smt/smt_options_handler.cpp \
- smt/smt_options_handler.h \
smt/smt_statistics_registry.cpp \
smt/smt_statistics_registry.h \
- smt/command_list.cpp \
- smt/command_list.h \
- smt/boolean_terms.h \
- smt/boolean_terms.cpp \
- smt/logic_exception.h \
- smt/logic_request.h \
- smt/logic_request.cpp \
+ smt/update_ostream.h \
theory/logic_info.h \
theory/logic_info.cpp \
theory/output_channel.h \
rev=0; \
mods=false; \
fi; \
- echo "#include \"util/configuration.h\""; \
+ echo "#include \"base/configuration.h\""; \
echo "const bool ::CVC4::Configuration::IS_SUBVERSION_BUILD = $$issvn;"; \
echo "const char* const ::CVC4::Configuration::SUBVERSION_BRANCH_NAME = \"$$branch\";"; \
echo "const unsigned ::CVC4::Configuration::SUBVERSION_REVISION = $$rev;"; \
rev=unknown; \
mods=false; \
fi; \
- echo "#include \"util/configuration.h\""; \
+ echo "#include \"base/configuration.h\""; \
echo "const bool ::CVC4::Configuration::IS_GIT_BUILD = $$isgit;"; \
echo "const char* const ::CVC4::Configuration::GIT_BRANCH_NAME = \"$$branch\";"; \
echo "const char* const ::CVC4::Configuration::GIT_COMMIT = \"$$rev\";"; \
libbase_la_SOURCES = \
Makefile.am \
Makefile.in \
+ configuration.cpp \
+ configuration.h \
+ configuration_private.h \
cvc4_assert.cpp \
cvc4_assert.h \
exception.cpp \
BUILT_SOURCES = \
tls.h
+# listing {Debug,Trace}_tags too ensures that make doesn't auto-remove it
+# after building (if it does, we don't get the "cached" effect with
+# the .tmp files below, and we have to re-compile and re-link each
+# time, even when there are no changes).
+BUILT_SOURCES += \
+ Debug_tags.h \
+ Debug_tags \
+ Trace_tags.h \
+ Trace_tags
+
+MOSTLYCLEANFILES = \
+ Debug_tags \
+ Trace_tags \
+ Debug_tags.tmp \
+ Trace_tags.tmp \
+ Debug_tags.h \
+ Trace_tags.h
+
EXTRA_DIST = \
+ configuration.i \
exception.i \
+ mktagheaders \
+ mktags \
modal_exception.i \
tls.h.in
DISTCLEANFILES = \
tls.h.tmp \
tls.h
+
+%_tags.h: %_tags mktagheaders
+ $(AM_V_at)chmod +x @srcdir@/mktagheaders
+ $(AM_V_GEN)( @srcdir@/mktagheaders "$<" "$<" ) >"$@"
+
+# This .tmp business is to keep from having to re-compile options.cpp
+# (and then re-link the libraries) if nothing has changed.
+%_tags: %_tags.tmp
+ $(AM_V_GEN)\
+ diff -q "$^" "$@" &>/dev/null || mv "$^" "$@" || true
+# .PHONY ensures the .tmp version is always rebuilt (to check for any changes)
+.PHONY: Debug_tags.tmp Trace_tags.tmp
+# The "sed" invocation below is particularly obnoxious, but it works around
+# inconsistencies in REs on different platforms, using only a basic regular
+# expression (no |, no \<, ...).
+Debug_tags.tmp Trace_tags.tmp: mktags
+ $(AM_V_at)chmod +x @srcdir@/mktags
+ $(AM_V_GEN)(@srcdir@/mktags \
+ '$(@:_tags.tmp=)' \
+ "$$(find @srcdir@/../ -name '*.cpp' -o -name '*.h' -o -name '*.cc' -o -name '*.g')") >"$@"
--- /dev/null
+/********************* */
+/*! \file configuration.cpp
+ ** \verbatim
+ ** Original author: Morgan Deters
+ ** Major contributors: none
+ ** Minor contributors (to current version): Liana Hadarean, Tim King, ACSYS, Christopher L. Conway, Dejan Jovanovic, Francois Bobot
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Implementation of Configuration class, which provides compile-time
+ ** configuration information about the CVC4 library
+ **
+ ** Implementation of Configuration class, which provides compile-time
+ ** configuration information about the CVC4 library.
+ **/
+#include "base/configuration.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <sstream>
+#include <string>
+
+#include "cvc4autoconfig.h"
+#include "base/configuration_private.h"
+
+#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
+# include "base/Debug_tags.h"
+#endif /* CVC4_DEBUG && CVC4_TRACING */
+
+#ifdef CVC4_TRACING
+# include "base/Trace_tags.h"
+#endif /* CVC4_TRACING */
+
+using namespace std;
+
+namespace CVC4 {
+
+string Configuration::getName() {
+ return PACKAGE_NAME;
+}
+
+bool Configuration::isDebugBuild() {
+ return IS_DEBUG_BUILD;
+}
+
+bool Configuration::isStatisticsBuild() {
+ return IS_STATISTICS_BUILD;
+}
+
+bool Configuration::isReplayBuild() {
+ return IS_REPLAY_BUILD;
+}
+
+bool Configuration::isTracingBuild() {
+ return IS_TRACING_BUILD;
+}
+
+bool Configuration::isDumpingBuild() {
+ return IS_DUMPING_BUILD;
+}
+
+bool Configuration::isMuzzledBuild() {
+ return IS_MUZZLED_BUILD;
+}
+
+bool Configuration::isAssertionBuild() {
+ return IS_ASSERTIONS_BUILD;
+}
+
+bool Configuration::isProofBuild() {
+ return IS_PROOFS_BUILD;
+}
+
+bool Configuration::isCoverageBuild() {
+ return IS_COVERAGE_BUILD;
+}
+
+bool Configuration::isProfilingBuild() {
+ return IS_PROFILING_BUILD;
+}
+
+bool Configuration::isCompetitionBuild() {
+ return IS_COMPETITION_BUILD;
+}
+
+string Configuration::getPackageName() {
+ return PACKAGE_NAME;
+}
+
+string Configuration::getVersionString() {
+ return CVC4_RELEASE_STRING;
+}
+
+unsigned Configuration::getVersionMajor() {
+ return CVC4_MAJOR;
+}
+
+unsigned Configuration::getVersionMinor() {
+ return CVC4_MINOR;
+}
+
+unsigned Configuration::getVersionRelease() {
+ return CVC4_RELEASE;
+}
+
+std::string Configuration::getVersionExtra() {
+ return CVC4_EXTRAVERSION;
+}
+
+std::string Configuration::about() {
+ return CVC4_ABOUT_STRING;
+}
+
+bool Configuration::licenseIsGpl() {
+ return IS_GPL_BUILD;
+}
+
+bool Configuration::isBuiltWithGmp() {
+ return IS_GMP_BUILD;
+}
+
+bool Configuration::isBuiltWithCln() {
+ return IS_CLN_BUILD;
+}
+
+bool Configuration::isBuiltWithGlpk() {
+ return IS_GLPK_BUILD;
+}
+
+bool Configuration::isBuiltWithAbc() {
+ return IS_ABC_BUILD;
+}
+
+bool Configuration::isBuiltWithReadline() {
+ return IS_READLINE_BUILD;
+}
+
+bool Configuration::isBuiltWithCudd() {
+ return false;
+}
+
+bool Configuration::isBuiltWithTlsSupport() {
+ return USING_TLS;
+}
+
+unsigned Configuration::getNumDebugTags() {
+#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
+ /* -1 because a NULL pointer is inserted as the last value */
+ return (sizeof(Debug_tags) / sizeof(Debug_tags[0])) - 1;
+#else /* CVC4_DEBUG && CVC4_TRACING */
+ return 0;
+#endif /* CVC4_DEBUG && CVC4_TRACING */
+}
+
+char const* const* Configuration::getDebugTags() {
+#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
+ return Debug_tags;
+#else /* CVC4_DEBUG && CVC4_TRACING */
+ static char const* no_tags[] = { NULL };
+ return no_tags;
+#endif /* CVC4_DEBUG && CVC4_TRACING */
+}
+
+int strcmpptr(const char **s1, const char **s2){
+ return strcmp(*s1,*s2);
+}
+
+bool Configuration::isDebugTag(char const *tag){
+#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
+ unsigned ntags = getNumDebugTags();
+ char const* const* tags = getDebugTags();
+ for (unsigned i = 0; i < ntags; ++ i) {
+ if (strcmp(tag, tags[i]) == 0) {
+ return true;
+ }
+ }
+#endif /* CVC4_DEBUG && CVC4_TRACING */
+ return false;
+}
+
+unsigned Configuration::getNumTraceTags() {
+#if CVC4_TRACING
+ /* -1 because a NULL pointer is inserted as the last value */
+ return sizeof(Trace_tags) / sizeof(Trace_tags[0]) - 1;
+#else /* CVC4_TRACING */
+ return 0;
+#endif /* CVC4_TRACING */
+}
+
+char const* const* Configuration::getTraceTags() {
+#if CVC4_TRACING
+ return Trace_tags;
+#else /* CVC4_TRACING */
+ static char const* no_tags[] = { NULL };
+ return no_tags;
+#endif /* CVC4_TRACING */
+}
+
+bool Configuration::isTraceTag(char const * tag){
+#if CVC4_TRACING
+ unsigned ntags = getNumTraceTags();
+ char const* const* tags = getTraceTags();
+ for (unsigned i = 0; i < ntags; ++ i) {
+ if (strcmp(tag, tags[i]) == 0) {
+ return true;
+ }
+ }
+#endif /* CVC4_TRACING */
+ return false;
+}
+
+bool Configuration::isGitBuild() {
+ return IS_GIT_BUILD;
+}
+
+const char* Configuration::getGitBranchName() {
+ return GIT_BRANCH_NAME;
+}
+
+const char* Configuration::getGitCommit() {
+ return GIT_COMMIT;
+}
+
+bool Configuration::hasGitModifications() {
+ return GIT_HAS_MODIFICATIONS;
+}
+
+std::string Configuration::getGitId() {
+ if(! isGitBuild()) {
+ return "";
+ }
+
+ const char* branchName = getGitBranchName();
+ if(*branchName == '\0') {
+ branchName = "-";
+ }
+
+ stringstream ss;
+ ss << "git " << branchName << " " << string(getGitCommit()).substr(0, 8)
+ << ( ::CVC4::Configuration::hasGitModifications() ? " (with modifications)" : "" );
+ return ss.str();
+}
+
+bool Configuration::isSubversionBuild() {
+ return IS_SUBVERSION_BUILD;
+}
+
+const char* Configuration::getSubversionBranchName() {
+ return SUBVERSION_BRANCH_NAME;
+}
+
+unsigned Configuration::getSubversionRevision() {
+ return SUBVERSION_REVISION;
+}
+
+bool Configuration::hasSubversionModifications() {
+ return SUBVERSION_HAS_MODIFICATIONS;
+}
+
+std::string Configuration::getSubversionId() {
+ if(! isSubversionBuild()) {
+ return "";
+ }
+
+ stringstream ss;
+ ss << "subversion " << getSubversionBranchName() << " r" << getSubversionRevision()
+ << ( ::CVC4::Configuration::hasSubversionModifications() ? " (with modifications)" : "" );
+ return ss.str();
+}
+
+std::string Configuration::getCompiler() {
+ stringstream ss;
+#ifdef __GNUC__
+ ss << "GCC";
+#else /* __GNUC__ */
+ ss << "unknown compiler";
+#endif /* __GNUC__ */
+#ifdef __VERSION__
+ ss << " version " << __VERSION__;
+#else /* __VERSION__ */
+ ss << ", unknown version";
+#endif /* __VERSION__ */
+ return ss.str();
+}
+
+std::string Configuration::getCompiledDateTime() {
+ return __DATE__ " " __TIME__;
+}
+
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file configuration.h
+ ** \verbatim
+ ** Original author: Morgan Deters
+ ** Major contributors: none
+ ** Minor contributors (to current version): ACSYS, Liana Hadarean, Tim King, Francois Bobot
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Interface to a public class that provides compile-time information
+ ** about the CVC4 library.
+ **
+ ** Interface to a public class that provides compile-time information
+ ** about the CVC4 library.
+ **/
+
+#include "cvc4_public.h"
+
+#ifndef __CVC4__CONFIGURATION_H
+#define __CVC4__CONFIGURATION_H
+
+#include <string>
+
+namespace CVC4 {
+
+/**
+ * Represents the (static) configuration of CVC4.
+ */
+class CVC4_PUBLIC Configuration {
+private:
+ /** Private default ctor: Disallow construction of this class */
+ Configuration();
+
+ // these constants are filled in by the build system
+ static const bool IS_SUBVERSION_BUILD;
+ static const char* const SUBVERSION_BRANCH_NAME;
+ static const unsigned SUBVERSION_REVISION;
+ static const bool SUBVERSION_HAS_MODIFICATIONS;
+ static const bool IS_GIT_BUILD;
+ static const char* const GIT_BRANCH_NAME;
+ static const char* const GIT_COMMIT;
+ static const bool GIT_HAS_MODIFICATIONS;
+
+public:
+
+ static std::string getName();
+
+ static bool isDebugBuild();
+
+ static bool isStatisticsBuild();
+
+ static bool isReplayBuild();
+
+ static bool isTracingBuild();
+
+ static bool isDumpingBuild();
+
+ static bool isMuzzledBuild();
+
+ static bool isAssertionBuild();
+
+ static bool isProofBuild();
+
+ static bool isCoverageBuild();
+
+ static bool isProfilingBuild();
+
+ static bool isCompetitionBuild();
+
+ static std::string getPackageName();
+
+ static std::string getVersionString();
+
+ static unsigned getVersionMajor();
+
+ static unsigned getVersionMinor();
+
+ static unsigned getVersionRelease();
+
+ static std::string getVersionExtra();
+
+ static std::string about();
+
+ static bool licenseIsGpl();
+
+ static bool isBuiltWithGmp();
+
+ static bool isBuiltWithCln();
+
+ static bool isBuiltWithGlpk();
+
+ static bool isBuiltWithAbc();
+
+ static bool isBuiltWithReadline();
+
+ static bool isBuiltWithCudd();
+
+ static bool isBuiltWithTlsSupport();
+
+ /* Return the number of debug tags */
+ static unsigned getNumDebugTags();
+ /* Return a sorted array of the debug tags name */
+ static char const* const* getDebugTags();
+ /* Test if the given argument is a known debug tag name */
+ static bool isDebugTag(char const *);
+
+ /* Return the number of trace tags */
+ static unsigned getNumTraceTags();
+ /* Return a sorted array of the trace tags name */
+ static char const* const* getTraceTags();
+ /* Test if the given argument is a known trace tag name */
+ static bool isTraceTag(char const *);
+
+ static bool isGitBuild();
+ static const char* getGitBranchName();
+ static const char* getGitCommit();
+ static bool hasGitModifications();
+ static std::string getGitId();
+
+ static bool isSubversionBuild();
+ static const char* getSubversionBranchName();
+ static unsigned getSubversionRevision();
+ static bool hasSubversionModifications();
+ static std::string getSubversionId();
+
+ static std::string getCompiler();
+ static std::string getCompiledDateTime();
+
+};/* class Configuration */
+
+}/* CVC4 namespace */
+
+#endif /* __CVC4__CONFIGURATION_H */
--- /dev/null
+%{
+#include "base/configuration.h"
+%}
+
+%apply char **STRING_ARRAY { char const* const* }
+%include "base/configuration.h"
+%clear char const* const*;
--- /dev/null
+/********************* */
+/*! \file configuration_private.h
+ ** \verbatim
+ ** Original author: Christopher L. Conway
+ ** Major contributors: ACSYS, Morgan Deters
+ ** Minor contributors (to current version): Liana Hadarean, Tim King
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Provides compile-time configuration information about the
+ ** CVC4 library.
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__CONFIGURATION_PRIVATE_H
+#define __CVC4__CONFIGURATION_PRIVATE_H
+
+#include <string>
+
+#include "base/configuration.h"
+
+namespace CVC4 {
+
+#ifdef CVC4_DEBUG
+# define IS_DEBUG_BUILD true
+#else /* CVC4_DEBUG */
+# define IS_DEBUG_BUILD false
+#endif /* CVC4_DEBUG */
+
+#ifdef CVC4_STATISTICS_ON
+# define IS_STATISTICS_BUILD true
+#else /* CVC4_STATISTICS_ON */
+# define IS_STATISTICS_BUILD false
+#endif /* CVC4_STATISTICS_ON */
+
+#ifdef CVC4_REPLAY
+# define IS_REPLAY_BUILD true
+#else /* CVC4_REPLAY */
+# define IS_REPLAY_BUILD false
+#endif /* CVC4_REPLAY */
+
+#ifdef CVC4_TRACING
+# define IS_TRACING_BUILD true
+#else /* CVC4_TRACING */
+# define IS_TRACING_BUILD false
+#endif /* CVC4_TRACING */
+
+#ifdef CVC4_DUMPING
+# define IS_DUMPING_BUILD true
+#else /* CVC4_DUMPING */
+# define IS_DUMPING_BUILD false
+#endif /* CVC4_DUMPING */
+
+#ifdef CVC4_MUZZLE
+# define IS_MUZZLED_BUILD true
+#else /* CVC4_MUZZLE */
+# define IS_MUZZLED_BUILD false
+#endif /* CVC4_MUZZLE */
+
+#ifdef CVC4_ASSERTIONS
+# define IS_ASSERTIONS_BUILD true
+#else /* CVC4_ASSERTIONS */
+# define IS_ASSERTIONS_BUILD false
+#endif /* CVC4_ASSERTIONS */
+
+#ifdef CVC4_PROOF
+# define IS_PROOFS_BUILD true
+#else /* CVC4_PROOF */
+# define IS_PROOFS_BUILD false
+#endif /* CVC4_PROOF */
+
+#ifdef CVC4_COVERAGE
+# define IS_COVERAGE_BUILD true
+#else /* CVC4_COVERAGE */
+# define IS_COVERAGE_BUILD false
+#endif /* CVC4_COVERAGE */
+
+#ifdef CVC4_PROFILING
+# define IS_PROFILING_BUILD true
+#else /* CVC4_PROFILING */
+# define IS_PROFILING_BUILD false
+#endif /* CVC4_PROFILING */
+
+#ifdef CVC4_COMPETITION_MODE
+# define IS_COMPETITION_BUILD true
+#else /* CVC4_COMPETITION_MODE */
+# define IS_COMPETITION_BUILD false
+#endif /* CVC4_COMPETITION_MODE */
+
+#ifdef CVC4_GMP_IMP
+# define IS_GMP_BUILD true
+#else /* CVC4_GMP_IMP */
+# define IS_GMP_BUILD false
+#endif /* CVC4_GMP_IMP */
+
+#ifdef CVC4_CLN_IMP
+# define IS_CLN_BUILD true
+#else /* CVC4_CLN_IMP */
+# define IS_CLN_BUILD false
+#endif /* CVC4_CLN_IMP */
+
+#if CVC4_USE_GLPK
+# define IS_GLPK_BUILD true
+#else /* CVC4_USE_GLPK */
+# define IS_GLPK_BUILD false
+#endif /* CVC4_USE_GLPK */
+
+#if CVC4_USE_ABC
+# define IS_ABC_BUILD true
+#else /* CVC4_USE_ABC */
+# define IS_ABC_BUILD false
+#endif /* CVC4_USE_ABC */
+
+#ifdef HAVE_LIBREADLINE
+# define IS_READLINE_BUILD true
+#else /* HAVE_LIBREADLINE */
+# define IS_READLINE_BUILD false
+#endif /* HAVE_LIBREADLINE */
+
+#if CVC4_GPL_DEPS
+# define IS_GPL_BUILD true
+#else /* CVC4_GPL_DEPS */
+# define IS_GPL_BUILD false
+#endif /* CVC4_GPL_DEPS */
+
+#ifdef TLS
+# define USING_TLS true
+#else /* TLS */
+# define USING_TLS false
+#endif /* TLS */
+
+#define CVC4_ABOUT_STRING ( ::std::string("\
+This is CVC4 version " CVC4_RELEASE_STRING ) + \
+ ( ::CVC4::Configuration::isGitBuild() \
+ ? ( ::std::string(" [") + ::CVC4::Configuration::getGitId() + "]" ) \
+ : \
+ ( ::CVC4::Configuration::isSubversionBuild() \
+ ? ( ::std::string(" [") + ::CVC4::Configuration::getSubversionId() + "]" ) \
+ : ::std::string("") \
+ )) + "\n\
+compiled with " + ::CVC4::Configuration::getCompiler() + "\n\
+on " + ::CVC4::Configuration::getCompiledDateTime() + "\n\n\
+Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014\n\
+ New York University and The University of Iowa\n\n" + \
+ ( IS_GPL_BUILD ? "\
+This build of CVC4 uses GPLed libraries, and is thus covered by the GNU\n\
+General Public License (GPL) version 3. Versions of CVC4 are available\n\
+that are covered by the (modified) BSD license. If you want to license\n\
+CVC4 under this license, please configure CVC4 with the \"--bsd\" option\n\
+before building from sources.\n\
+" : \
+"This CVC4 library uses GMP as its multi-precision arithmetic library.\n\n\
+CVC4 is open-source and is covered by the BSD license (modified).\n\n\
+" ) + "\
+THIS SOFTWARE PROVIDED AS-IS, WITHOUT ANY WARRANTIES. USE AT YOUR OWN RISK.\n\n\
+See the file COPYING (distributed with the source code, and with all binaries)\n\
+for the full CVC4 copyright, licensing, and (lack of) warranty information.\n" )
+
+}/* CVC4 namespace */
+
+#endif /* __CVC4__CONFIGURATION_PRIVATE_H */
}
}
-char* IllegalArgumentException::s_header = "Illegal argument detected";
+const char* IllegalArgumentException::s_header = "Illegal argument detected";
std::string IllegalArgumentException::formatVariadic() {
return std::string();
static std::string format_extra(const char* condStr, const char* argDesc);
- static char* s_header;
+ static const char* s_header;
public:
private:
/* Disallow copies */
- LastExceptionBuffer(const LastExceptionBuffer&) CVC4_UNUSED;
- LastExceptionBuffer& operator=(const LastExceptionBuffer&) CVC4_UNUSED;
+ LastExceptionBuffer(const LastExceptionBuffer&) CVC4_UNDEFINED;
+ LastExceptionBuffer& operator=(const LastExceptionBuffer&) CVC4_UNDEFINED;
char* d_contents;
bool ListenerCollection::empty() const { return d_listeners.empty(); }
-RegisterListener::RegisterListener(ListenerCollection* collection,
- Listener* listener)
+ListenerCollection::Registration::Registration(
+ ListenerCollection* collection, Listener* listener)
: d_listener(listener)
, d_position()
, d_collection(collection)
d_position = d_collection->addListener(d_listener);
}
-RegisterListener::~RegisterListener() {
+ListenerCollection::Registration::~Registration() {
d_collection->removeListener(d_position);
delete d_listener;
}
+ ListenerCollection::Registration* ListenerCollection::registerListener(
+ Listener* listener)
+{
+ return new Registration(this, listener);
+}
+
+
+ListenerRegistrationList::ListenerRegistrationList()
+ : d_registrations()
+{}
+
+ListenerRegistrationList::~ListenerRegistrationList() {
+ clear();
+}
+
+void ListenerRegistrationList::add(
+ ListenerCollection::Registration* registration)
+{
+ d_registrations.push_back(registration);
+}
+
+void ListenerRegistrationList::clear(){
+ typedef std::list<ListenerCollection::Registration*>::iterator iterator;
+ for(iterator i = d_registrations.begin(), iend = d_registrations.end();
+ i != iend; ++i)
+ {
+ ListenerCollection::Registration* current = *i;
+ delete current;
+ }
+ d_registrations.clear();
+}
+
+
}/* CVC4 namespace */
** Utilities for the development of a Listener interface class. This class
** provides a single notification that must be overwritten. This file also
** provides a utility class for a collection of listeners and an RAII style
- ** RegisterListener class for managing the relationship between Listeners
- ** and the manager.
+ ** Registration class for managing the relationship between Listeners
+ ** and the collection.
**/
#include "cvc4_public.h"
typedef std::list<Listener*> ListenerList;
typedef ListenerList::iterator iterator;
+ /** Creates an empty listener collection. */
ListenerCollection();
+ /**
+ * Destroys an iterator collection.
+ * If assertions are on, this throws an AssertionException if the collection
+ * is not empty().
+ */
~ListenerCollection();
+ /**
+ * This adds a listener to the current collection and returns
+ * an iterator to the listener in the collection.
+ * The user of the collection must call removeListener() using
+ * this iterator.
+ * The collection does not take over the memory for the listener.
+ */
iterator addListener(Listener* listener);
+ /**
+ * Remove an listener using the iterator distributed when adding the
+ * listener.
+ */
void removeListener(iterator position);
+ /** Calls notify() on all listeners in the collection. */
void notify();
+ /** Returns true if the collection contains no listeners. */
bool empty() const;
+ /**
+ * Registration is an RAII utility function for using Listener
+ * with ListenerCollection.
+ *
+ * On construction, the Registration takes a ListenerCollection,
+ * collection,
+ * and a Listener*, listener. It takes over the memory for listener. It then
+ * adds listener to collection. On destruction it removes listener and calls
+ * delete on listener.
+ *
+ * Because of this usage, a Registration must be destroyed before the
+ * ListenerCollection it is attached to.
+ */
+ class CVC4_PUBLIC Registration {
+ public:
+ Registration(ListenerCollection* collection, Listener* listener);
+ ~Registration();
+
+ private:
+ Listener* d_listener;
+ ListenerCollection::iterator d_position;
+ ListenerCollection* d_collection;
+ };/* class CVC4::ListenerCollection::Registration */
+
+
+ /**
+ * Returns a new Registration given a Listener that is attached to this
+ * ListenerCollection. Management of the memory is handed to the user of
+ * this function. To remove the listener, call the destructor for the
+ * Registration.
+ */
+ Registration* registerListener(Listener* listener);
+
private:
+
+ /**
+ * Disabling the copy-constructor.
+ * The user of the class must be know to remove listeners on the collection.
+ * Allowing copies will only cause confusion.
+ */
+ ListenerCollection(const ListenerCollection& copy) CVC4_UNDEFINED;
+
+ /**
+ * Disabling the assignment operator.
+ * The user of the class must be know to remove listeners on the collection.
+ * Allowing copies will only cause confusion.
+ */
+ ListenerCollection& operator=(const ListenerCollection& copy) CVC4_UNDEFINED;
+
+ /** A list of the listeners in the collection.*/
ListenerList d_listeners;
-};
+};/* class CVC4::ListenerCollection */
/**
- * RegisterListener is an RAII utility function for using Listener
- * with ListenerCollection.
+ * A list of ListenerCollection::Registration* pointers.
*
- * On construction, the RegisterListener takes a ListenerCollection, collection,
- * and a Listener*, listener. It takes over the memory for listener. It then
- * add listener to collection. On destruction it removes listener and calls
- * delete on listener.
- *
- * Because of this usage, a RegisterListener must be destroyed before
- * collection.
+ * This list assumes it has control over all of the memory of the registrations.
*/
-class CVC4_PUBLIC RegisterListener {
-public:
- RegisterListener(ListenerCollection* collection, Listener* listener);
- ~RegisterListener();
-
-private:
- Listener* d_listener;
- ListenerCollection::iterator d_position;
- ListenerCollection* d_collection;
-};
-
+class ListenerRegistrationList {
+ public:
+ ListenerRegistrationList();
+ ~ListenerRegistrationList();
+
+ void add(ListenerCollection::Registration* registration);
+ void clear();
+
+ private:
+ /** Disallow copying.*/
+ ListenerRegistrationList(const ListenerRegistrationList&) CVC4_UNDEFINED;
+ /** Disallow assignment.*/
+ ListenerRegistrationList operator=(const ListenerRegistrationList&)
+ CVC4_UNDEFINED;
+ std::list<ListenerCollection::Registration*> d_registrations;
+};/* class CVC4::ListenerRegistrationList */
}/* CVC4 namespace */
--- /dev/null
+#!/bin/bash
+#
+# mktagheaders
+#
+# The purpose of this script is to generate the *_tag.h header file from the
+# *_tags file.
+#
+# Invocation:
+#
+# mktagheaders <tag-name> <tag-file>
+#
+# <tag-name> will be the name of the generated array.
+# <tag-file> each line of this file is turned into a string in the generated
+# array.
+
+TAG_NAME=$1
+TAG_FILE=$2
+
+echo 'static char const* const '$TAG_NAME'[] = {';
+for tag in `cat $TAG_FILE`; do
+ echo "\"$tag\",";
+done;
+echo 'NULL';
+echo '};'
--- /dev/null
+#!/bin/bash
+#
+# mktags
+#
+# The purpose of this script is to create Debug_tags and Trace_tags files.
+# Note that in the Makefile workflow these are first stored in a *_tags.tmp
+# file. This file contains a list of all of the strings that occur in things
+# like Debug("foo") or Debug.isOn("bar") in a given directory. The list is
+# seperated by newlines. The expected Debug_tags file for the previous two
+# tags would be:
+# bar
+# foo
+#
+# Invocation:
+#
+# mktags {Debug,Trace} <input-files>
+#
+# <input-files> is expected to be passed a single space separated list of files.
+# One can use quotes to achieve this. This is one reason to use "$(...)"
+# instead of back ticks `...`.
+
+DebugOrTrace=$1
+InputFiles=$2
+
+grep -h '\<'$DebugOrTrace'\(\.isOn\)* *( *\".*\" *)' \
+ $InputFiles | \
+ sed 's/\/\/.*//;s/^'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | \
+ LC_ALL=C sort | \
+ uniq
+
+
+# Reference copy of what this is replacing.
+# grep -h '\<$(@:_tags.tmp=)\(\.isOn\)* *( *\".*\" *)' \
+# `find @srcdir@/../ -name "*.cpp" -o -name "*.h" -o -name "*.cc" -o -name "*.g"` | \
+# sed 's/\/\/.*//;s/^$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | LC_ALL=C sort | uniq
bool off(std::string tag) { d_tags.erase (tag); return false; }
bool off() { d_tags.clear(); return false; }
- bool isOn(const char* tag) { return d_tags.find(std::string(tag)) != d_tags.end(); }
+ bool isOn(const char* tag) { return d_tags.find(std::string(tag)) != d_tags.end(); }
bool isOn(std::string tag) { return d_tags.find(tag) != d_tags.end(); }
- std::ostream& setStream(std::ostream& os) { d_os = &os; return os; }
+ std::ostream& setStream(std::ostream* os) { d_os = os; return *os; }
std::ostream& getStream() { return *d_os; }
+ std::ostream* getStreamPointer() { return d_os; }
};/* class DebugC */
/** The warning output class */
CVC4ostream operator()() { return CVC4ostream(d_os); }
- std::ostream& setStream(std::ostream& os) { d_os = &os; return os; }
+ std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; }
std::ostream& getStream() { return *d_os; }
+ std::ostream* getStreamPointer() { return d_os; }
bool isOn() const { return d_os != &null_os; }
CVC4ostream operator()() { return CVC4ostream(d_os); }
- std::ostream& setStream(std::ostream& os) { d_os = &os; return os; }
+ std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; }
std::ostream& getStream() { return *d_os; }
+ std::ostream* getStreamPointer() { return d_os; }
bool isOn() const { return d_os != &null_os; }
};/* class MessageC */
CVC4ostream operator()() { return CVC4ostream(d_os); }
- std::ostream& setStream(std::ostream& os) { d_os = &os; return os; }
+ std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; }
std::ostream& getStream() { return *d_os; }
+ std::ostream* getStreamPointer() { return d_os; }
bool isOn() const { return d_os != &null_os; }
};/* class NoticeC */
CVC4ostream operator()() { return CVC4ostream(d_os); }
- std::ostream& setStream(std::ostream& os) { d_os = &os; return os; }
+ std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; }
std::ostream& getStream() { return *d_os; }
+ std::ostream* getStreamPointer() { return d_os; }
bool isOn() const { return d_os != &null_os; }
};/* class ChatC */
bool isOn(const char* tag) { return d_tags.find(std::string(tag)) != d_tags.end(); }
bool isOn(std::string tag) { return d_tags.find(tag) != d_tags.end(); }
- std::ostream& setStream(std::ostream& os) { d_os = &os; return os; }
+ std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; }
std::ostream& getStream() { return *d_os; }
+ std::ostream* getStreamPointer() { return d_os; }
+
};/* class TraceC */
/** The dump output class */
bool isOn(const char* tag) { return d_tags.find(std::string(tag)) != d_tags.end(); }
bool isOn(std::string tag) { return d_tags.find(tag) != d_tags.end(); }
- std::ostream& setStream(std::ostream& os) { d_os = &os; return os; }
+ std::ostream& setStream(std::ostream* os) { d_os = os; return *d_os; }
std::ostream& getStream() { return *d_os; }
+ std::ostream* getStreamPointer() { return d_os; }
};/* class DumpOutC */
/** The debug output singleton */
#include "expr/expr_iomanip.h"
#include "expr/kind.h"
#include "expr/predicate.h"
-#include "options/base_options.h"
-#include "options/expr_options.h"
-#include "options/parser_options.h"
+#include "options/options.h"
#include "options/set_language.h"
-#include "options/smt_options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
#include "smt_util/command.h"
}
InputLanguage ExprManager::getInputLang() const {
- return getOptions()[CVC4::options::inputLanguage];
+ return getOptions().getInputLanguage();
}
InputLanguage ExprManager::getOutputLang() const {
- return CVC4::language::toInputLanguage(getOptions()[CVC4::options::outputLanguage]);
+ return CVC4::language::toInputLanguage(getOptions().getOutputLanguage());
}
Expr Expr::operator[](int i) const {
d_smt->setOption("input-language", clflags["lang"].getString());
if(clflags["output-lang"].getString() == "") {
stringstream langss;
- langss << CVC4::language::toOutputLanguage(options[CVC4::options::inputLanguage]);
+ langss << CVC4::language::toOutputLanguage(options.getInputLanguage());
d_smt->setOption("output-language", langss.str());
} else {
d_smt->setOption("output-language", clflags["output-lang"].getString());
void ValidityChecker::printExpr(const Expr& e, std::ostream& os) {
CVC4::expr::ExprSetDepth::Scope sd(os, -1);
CVC4::expr::ExprPrintTypes::Scope pt(os, false);
- CVC4::language::SetLanguage::Scope sl(os, d_em->getOptions()[CVC4::options::outputLanguage]);
+ CVC4::language::SetLanguage::Scope sl(
+ os, d_em->getOptions().getOutputLanguage());
os << e;
}
static void doCommands(CVC4::parser::Parser* parser, CVC4::SmtEngine* smt, CVC4::Options& opts) {
while(CVC4::Command* cmd = parser->nextCommand()) {
- if(opts[CVC4::options::verbosity] >= 0) {
- cmd->invoke(smt, *opts[CVC4::options::out]);
+ if(opts.getVerbosity() >= 0) {
+ cmd->invoke(smt, *opts.getOut());
} else {
cmd->invoke(smt);
}
InputLanguage lang,
bool interactive,
bool calledFromParser) {
- CVC4::Options opts = d_em->getOptions();
+ CVC4::Options opts;
+ opts.copyValues(d_em->getOptions());
stringstream langss;
langss << lang;
d_smt->setOption("input-language", CVC4::SExpr(langss.str()));
void ValidityChecker::loadFile(std::istream& is,
InputLanguage lang,
bool interactive) {
- CVC4::Options opts = d_em->getOptions();
+ CVC4::Options opts;
+ opts.copyValues(d_em->getOptions());
+
stringstream langss;
langss << lang;
d_smt->setOption("input-language", CVC4::SExpr(langss.str()));
// TIM:
// At the moment, the header includes seem to need to follow a special order.
// I don't know why. I am following the build order
+%include "base/configuration.i"
%include "base/exception.i"
%include "base/modal_exception.i"
// Tim: The remainder of util/.
%include "util/bool.i"
%include "util/cardinality.i"
-%include "util/configuration.i"
%include "util/hash.i"
%include "util/proof.i"
%include "util/regexp.i"
node_manager.cpp \
node_manager.h \
node_manager_attributes.h \
- node_self_iterator.h \
+ node_manager_listeners.cpp \
+ node_manager_listeners.h \
node_self_iterator.h \
node_value.cpp \
node_value.h \
// compiler directs the user to the template file instead of the
// generated one. We don't want the user to modify the generated one,
// since it'll get overwritten on a later build.
-#line 45 "${template}"
+#line 44 "${template}"
namespace CVC4 {
${getConst_instantiations}
-#line 939 "${template}"
+#line 557 "${template}"
inline size_t ExprHashFunction::operator()(CVC4::Expr e) const {
return (size_t) e.getId();
#include <functional>
#include <stdint.h>
+#include "base/configuration.h"
#include "base/cvc4_assert.h"
#include "base/exception.h"
#include "base/output.h"
#include "expr/expr_iomanip.h"
#include "options/language.h"
#include "options/set_language.h"
-#include "util/configuration.h"
#include "util/utility.h"
#include "util/hash.h"
#include <utility>
#include "base/cvc4_assert.h"
+#include "base/listener.h"
#include "base/tls.h"
#include "expr/attribute.h"
#include "expr/node_manager_attributes.h"
+#include "expr/node_manager_listeners.h"
#include "expr/type_checker.h"
#include "options/options.h"
#include "options/smt_options.h"
d_options(new Options()),
d_statisticsRegistry(new StatisticsRegistry()),
d_resourceManager(new ResourceManager()),
+ d_registrations(new ListenerRegistrationList()),
next_id(0),
d_attrManager(new expr::attr::AttributeManager()),
d_exprManager(exprManager),
NodeManager::NodeManager(ExprManager* exprManager,
const Options& options) :
- d_options(new Options(options)),
+ d_options(new Options()),
d_statisticsRegistry(new StatisticsRegistry()),
d_resourceManager(new ResourceManager()),
+ d_registrations(new ListenerRegistrationList()),
next_id(0),
d_attrManager(new expr::attr::AttributeManager()),
d_exprManager(exprManager),
d_nodeUnderDeletion(NULL),
d_inReclaimZombies(false),
d_abstractValueCount(0),
- d_skolemCounter(0) {
+ d_skolemCounter(0)
+{
+ d_options->copyValues(options);
init();
}
if((*d_options)[options::cpuTime]) {
d_resourceManager->useCPUTime(true);
}
+
+ // Do not notify() upon registration as these were handled manually above.
+ d_registrations->add(d_options->registerTlimitListener(
+ new TlimitListener(d_resourceManager), false));
+ d_registrations->add(d_options->registerTlimitPerListener(
+ new TlimitPerListener(d_resourceManager), false));
+ d_registrations->add(d_options->registerRlimitListener(
+ new RlimitListener(d_resourceManager), false));
+ d_registrations->add(d_options->registerRlimitPerListener(
+ new RlimitPerListener(d_resourceManager), false));
}
NodeManager::~NodeManager() {
// defensive coding, in case destruction-order issues pop up (they often do)
delete d_statisticsRegistry;
d_statisticsRegistry = NULL;
+ delete d_registrations;
+ d_registrations = NULL;
delete d_resourceManager;
d_resourceManager = NULL;
delete d_attrManager;
Options* d_options;
StatisticsRegistry* d_statisticsRegistry;
+
ResourceManager* d_resourceManager;
+ /**
+ * A list of registrations on d_options to that call into d_resourceManager.
+ * These must be garbage collected before d_options and d_resourceManager.
+ */
+ ListenerRegistrationList* d_registrations;
+
NodeValuePool d_nodeValuePool;
size_t next_id;
// undefined private copy constructor (disallow copy)
NodeManager(const NodeManager&) CVC4_UNDEFINED;
+ NodeManager& operator=(const NodeManager&) CVC4_UNDEFINED;
+
void init();
/**
--- /dev/null
+/********************* */
+/*! \file node_manager_listeners.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Listeners that NodeManager registers to its Options object.
+ **
+ ** Listeners that NodeManager registers to its Options object.
+ **/
+
+#include "node_manager_listeners.h"
+
+#include "base/listener.h"
+#include "options/smt_options.h"
+#include "util/resource_manager.h"
+
+namespace CVC4 {
+namespace expr {
+
+
+void TlimitListener::notify() {
+ d_rm->setTimeLimit(options::cumulativeMillisecondLimit(), true);
+}
+
+void TlimitPerListener::notify() {
+ d_rm->setTimeLimit(options::perCallMillisecondLimit(), false);
+}
+
+void RlimitListener::notify() {
+ d_rm->setTimeLimit(options::cumulativeResourceLimit(), true);
+}
+
+void RlimitPerListener::notify() {
+ d_rm->setTimeLimit(options::perCallResourceLimit(), false);
+}
+
+}/* CVC4::expr namespace */
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file node_manager_listeners.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Listeners that NodeManager registers to its Options object.
+ **
+ ** Listeners that NodeManager registers to its Options object.
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__EXPR__NODE_MANAGER_LISTENERS_H
+#define __CVC4__EXPR__NODE_MANAGER_LISTENERS_H
+
+#include "base/listener.h"
+#include "util/resource_manager.h"
+
+namespace CVC4 {
+namespace expr {
+
+class TlimitListener : public Listener {
+ public:
+ TlimitListener(ResourceManager* rm) : d_rm(rm) {}
+ virtual void notify();
+ private:
+ ResourceManager* d_rm;
+};
+
+class TlimitPerListener : public Listener {
+ public:
+ TlimitPerListener(ResourceManager* rm) : d_rm(rm) {}
+ virtual void notify();
+ private:
+ ResourceManager* d_rm;
+};
+
+class RlimitListener : public Listener {
+ public:
+ RlimitListener(ResourceManager* rm) : d_rm(rm) {}
+ virtual void notify();
+ private:
+ ResourceManager* d_rm;
+};
+
+class RlimitPerListener : public Listener {
+ public:
+ RlimitPerListener(ResourceManager* rm) : d_rm(rm) {}
+ virtual void notify();
+ private:
+ ResourceManager* d_rm;
+};
+
+}/* CVC4::expr namespace */
+}/* CVC4 namespace */
+
+#endif /* __CVC4__EXPR__NODE_MANAGER_LISTENERS_H */
#ifndef __CVC4__CVC4_H
#define __CVC4__CVC4_H
+#include <cvc4/base/configuration.h>
#include <cvc4/base/exception.h>
#include <cvc4/expr/datatype.h>
#include <cvc4/expr/expr.h>
#include <cvc4/parser/parser_builder.h>
#include <cvc4/smt/smt_engine.h>
#include <cvc4/smt_util/command.h>
-#include <cvc4/util/configuration.h>
#include <cvc4/util/integer.h>
#include <cvc4/util/rational.h>
#define __CVC4_PRIVATE_H
#if ! (defined(__BUILDING_CVC4LIB) || defined(__BUILDING_CVC4LIB_UNIT_TEST))
-# warning A private CVC4 header was included when not building the library or private unit test code.
+# error A private CVC4 header was included when not building the library or private unit test code.
#endif /* ! (__BUILDING_CVC4LIB || __BUILDING_CVC4LIB_UNIT_TEST) */
-#ifdef __BUILDING_STATISTICS_FOR_EXPORT
-# warning A private CVC4 header was included when building a library for export.
-#endif /* __BUILDING_STATISTICS_FOR_EXPORT */
#include "cvc4_public.h"
#include "cvc4autoconfig.h"
#define __CVC4_PRIVATE_LIBRARY_H
#if ! (defined(__BUILDING_CVC4LIB) || defined(__BUILDING_CVC4LIB_UNIT_TEST) || defined(__BUILDING_CVC4PARSERLIB) || defined(__BUILDING_CVC4PARSERLIB_UNIT_TEST) || defined(__BUILDING_CVC4COMPATLIB) || defined(__BUILDING_CVC4DRIVER))
-# warning A "private library" CVC4 header was included when not building the library, driver, or private unit test code.
+# error A "private library" CVC4 header was included when not building the library, driver, or private unit test code.
#endif /* ! (__BUILDING_CVC4LIB || __BUILDING_CVC4LIB_UNIT_TEST || __BUILDING_CVC4PARSERLIB || __BUILDING_CVC4PARSERLIB_UNIT_TEST || __BUILDING_CVC4DRIVER) */
#include "cvc4_public.h"
#define __CVC4PARSER_PRIVATE_H
#if ! (defined(__BUILDING_CVC4PARSERLIB) || defined(__BUILDING_CVC4PARSERLIB_UNIT_TEST))
-# warning A private CVC4 parser header was included when not building the parser library or private unit test code.
+# error A private CVC4 parser header was included when not building the parser library or private unit test code.
#endif /* ! (__BUILDING_CVC4PARSERLIB || __BUILDING_CVC4PARSERLIB_UNIT_TEST) */
#include "cvc4parser_public.h"
-// It would be nice to #include this here, but there are conflicts with
-// antlr3's autoheader stuff, which they export :(
+// It would be nice to #include "cvc4autoconfig.h" here, but there are conflicts
+// with antlr3's autoheader stuff, which they export :(
//
// #include "cvc4autoconfig.h"
** OS X).
**/
-#include "cvc4_private.h"
+#warning "TODO: make lib/clock_gettime.h cvc4_private.h again."
#include "lib/clock_gettime.h"
** Replacement for clock_gettime() for systems without it (like Mac OS X).
**/
-#include "cvc4_private.h"
+#include "cvc4_private_library.h"
#ifndef __CVC4__LIB__CLOCK_GETTIME_H
#define __CVC4__LIB__CLOCK_GETTIME_H
#include <string>
#include "main/main.h"
-#include "options/base_options.h"
-#include "options/main_options.h"
-#include "options/printer_options.h"
-#include "options/smt_options.h"
#include "smt_util/command.h"
d_smtEngine(new SmtEngine(&exprMgr)),
d_options(options),
d_stats("driver"),
- d_result() {
+ d_result(),
+ d_replayStream(NULL)
+{}
+
+void CommandExecutor::setReplayStream(ExprStream* replayStream) {
+ assert(d_replayStream == NULL);
+ d_replayStream = replayStream;
+ d_smtEngine->setReplayStream(d_replayStream);
}
bool CommandExecutor::doCommand(Command* cmd)
{
- if( d_options[options::parseOnly] ) {
+ if( d_options.getParseOnly() ) {
return true;
}
bool status = true;
for(CommandSequence::iterator subcmd = seq->begin();
- (status || d_options[options::continuedExecution]) && subcmd != seq->end();
+ (status || d_options.getContinuedExecution()) && subcmd != seq->end();
++subcmd) {
status = doCommand(*subcmd);
}
return status;
} else {
- if(d_options[options::verbosity] > 2) {
- *d_options[options::out] << "Invoking: " << *cmd << std::endl;
+ if(d_options.getVerbosity() > 2) {
+ *d_options.getOut() << "Invoking: " << *cmd << std::endl;
}
return doCommandSingleton(cmd);
void CommandExecutor::reset()
{
- if(d_options[options::statistics]) {
- flushStatistics(*d_options[options::err]);
+ if(d_options.getStatistics()) {
+ flushStatistics(*d_options.getErr());
}
delete d_smtEngine;
d_smtEngine = new SmtEngine(&d_exprMgr);
bool CommandExecutor::doCommandSingleton(Command* cmd)
{
bool status = true;
- if(d_options[options::verbosity] >= -1) {
- status = smtEngineInvoke(d_smtEngine, cmd, d_options[options::out]);
+ if(d_options.getVerbosity() >= -1) {
+ status = smtEngineInvoke(d_smtEngine, cmd, d_options.getOut());
} else {
status = smtEngineInvoke(d_smtEngine, cmd, NULL);
}
d_result = res = q->getResult();
}
- if((cs != NULL || q != NULL) && d_options[options::statsEveryQuery]) {
+ if((cs != NULL || q != NULL) && d_options.getStatsEveryQuery()) {
std::ostringstream ossCurStats;
flushStatistics(ossCurStats);
- printStatsIncremental(*d_options[options::err], d_lastStatistics, ossCurStats.str());
+ std::ostream& err = *d_options.getErr();
+ printStatsIncremental(err, d_lastStatistics, ossCurStats.str());
d_lastStatistics = ossCurStats.str();
}
// dump the model/proof/unsat core if option is set
if(status) {
Command* g = NULL;
- if( d_options[options::produceModels] &&
- d_options[options::dumpModels] &&
+ if( d_options.getProduceModels() &&
+ d_options.getDumpModels() &&
( res.asSatisfiabilityResult() == Result::SAT ||
(res.isUnknown() && res.whyUnknown() == Result::INCOMPLETE) ) ) {
g = new GetModelCommand();
}
- if( d_options[options::proof] &&
- d_options[options::dumpProofs] &&
+ if( d_options.getProof() &&
+ d_options.getDumpProofs() &&
res.asSatisfiabilityResult() == Result::UNSAT ) {
g = new GetProofCommand();
}
- if( d_options[options::dumpInstantiations] &&
- ( ( d_options[options::instFormatMode] != INST_FORMAT_MODE_SZS &&
- ( res.asSatisfiabilityResult() == Result::SAT || (res.isUnknown() && res.whyUnknown() == Result::INCOMPLETE) ) ) ||
- res.asSatisfiabilityResult() == Result::UNSAT ) ) {
+
+ if( d_options.getDumpInstantiations() &&
+ ( ( d_options.getInstFormatMode() != INST_FORMAT_MODE_SZS &&
+ ( res.asSatisfiabilityResult() == Result::SAT ||
+ (res.isUnknown() && res.whyUnknown() == Result::INCOMPLETE) ) ) ||
+ res.asSatisfiabilityResult() == Result::UNSAT ) )
+ {
g = new GetInstantiationsCommand();
}
- if( d_options[options::dumpSynth] && res.asSatisfiabilityResult() == Result::UNSAT ){
+
+ if( d_options.getDumpSynth() &&
+ res.asSatisfiabilityResult() == Result::UNSAT )
+ {
g = new GetSynthSolutionCommand();
}
- if( d_options[options::dumpUnsatCores] && res.asSatisfiabilityResult() == Result::UNSAT ) {
+
+ if( d_options.getDumpUnsatCores() &&
+ res.asSatisfiabilityResult() == Result::UNSAT )
+ {
g = new GetUnsatCoreCommand();
}
+
if(g != NULL) {
// set no time limit during dumping if applicable
- if( d_options[options::forceNoLimitCpuWhileDump] ){
+ if( d_options.getForceNoLimitCpuWhileDump() ){
setNoLimitCPU();
}
status = doCommandSingleton(g);
cmd->invoke(smt, *out);
}
// ignore the error if the command-verbosity is 0 for this command
- if(smt->getOption(std::string("command-verbosity:") + cmd->getCommandName()).getIntegerValue() == 0) {
+ std::string commandName =
+ std::string("command-verbosity:") + cmd->getCommandName();
+ if(smt->getOption(commandName).getIntegerValue() == 0) {
return true;
}
return !cmd->fail();
}
}
+void CommandExecutor::printStatsFilterZeros(std::ostream& out,
+ const std::string& statsString) {
+ // read each line, if a number, check zero and skip if so
+ // Stat are assumed to one-per line: "<statName>, <statValue>"
+
+ std::istringstream iss(statsString);
+ std::string statName, statValue;
+
+ std::getline(iss, statName, ',');
+
+ while( !iss.eof() ) {
+
+ std::getline(iss, statValue, '\n');
+
+ double curFloat;
+ bool isFloat = (std::istringstream(statValue) >> curFloat);
+
+ if( (isFloat && curFloat == 0) ||
+ statValue == " \"0\"" ||
+ statValue == " \"[]\"") {
+ // skip
+ } else {
+ out << statName << "," << statValue << std::endl;
+ }
+
+ std::getline(iss, statName, ',');
+ }
+
+}
+
+void CommandExecutor::flushOutputStreams() {
+ if(d_options.getStatistics()) {
+ if(d_options.getStatsHideZeros() == false) {
+ flushStatistics(*(d_options.getErr()));
+ } else {
+ std::ostringstream ossStats;
+ flushStatistics(ossStats);
+ printStatsFilterZeros(*(d_options.getErr()), ossStats.str());
+ }
+ }
+
+ // make sure out and err streams are flushed too
+ d_options.flushOut();
+ d_options.flushErr();
+}
+
}/* CVC4::main namespace */
}/* CVC4 namespace */
Options& d_options;
StatisticsRegistry d_stats;
Result d_result;
+ ExprStream* d_replayStream;
public:
CommandExecutor(ExprManager &exprMgr, Options &options);
virtual ~CommandExecutor() {
delete d_smtEngine;
+ if(d_replayStream != NULL){
+ delete d_replayStream;
+ }
}
/**
d_stats.flushInformation(out);
}
- SmtGlobals* globals() { return d_smtEngine->globals(); }
+ static void printStatsFilterZeros(std::ostream& out,
+ const std::string& statsString);
+
+ LemmaChannels* channels() { return d_smtEngine->channels(); }
+ void flushOutputStreams();
+
+ void setReplayStream(ExprStream* replayStream);
protected:
/** Executes treating cmd as a singleton */
#include "expr/pickler.h"
#include "main/main.h"
#include "main/portfolio.h"
-#include "options/base_options.h"
-#include "options/main_options.h"
#include "options/options.h"
-#include "options/printer_options.h"
#include "options/set_language.h"
-#include "options/smt_options.h"
#include "smt_util/command.h"
namespace CVC4 {
namespace main {
-CommandExecutorPortfolio::CommandExecutorPortfolio
-(ExprManager &exprMgr, Options &options, vector<Options>& tOpts):
- CommandExecutor(exprMgr, options),
- d_numThreads(options[options::threads]),
- d_smts(),
- d_seq(new CommandSequence()),
- d_threadOptions(tOpts),
- d_vmaps(),
- d_lastWinner(0),
- d_channelsOut(),
- d_channelsIn(),
- d_ostringstreams(),
- d_statLastWinner("portfolio::lastWinner"),
- d_statWaitTime("portfolio::waitTime")
+CommandExecutorPortfolio::CommandExecutorPortfolio(
+ ExprManager &exprMgr, Options &options, OptionsList& tOpts)
+ : CommandExecutor(exprMgr, options),
+ d_numThreads(options.getThreads()),
+ d_smts(),
+ d_seq(new CommandSequence()),
+ d_threadOptions(tOpts),
+ d_vmaps(),
+ d_lastWinner(0),
+ d_channelsOut(),
+ d_channelsIn(),
+ d_ostringstreams(),
+ d_statLastWinner("portfolio::lastWinner"),
+ d_statWaitTime("portfolio::waitTime")
{
assert(d_threadOptions.size() == d_numThreads);
d_statLastWinner.setData(d_lastWinner);
d_stats.registerStat(&d_statLastWinner);
+
d_stats.registerStat(&d_statWaitTime);
/* Duplication, individualization */
if(d_numThreads == 1) {
// Disable sharing
- d_threadOptions[0].set(options::sharingFilterByLength, 0);
+ d_threadOptions[0].setSharingFilterByLength(0);
} else {
// Setup sharing channels
const unsigned int sharingChannelSize = 1000000;
/* Lemma I/O channels */
for(unsigned i = 0; i < d_numThreads; ++i) {
- string tag = "thread #" +
- boost::lexical_cast<string>(d_threadOptions[i][options::thread_id]);
+ int thread_id = d_threadOptions[i].getThreadId();
+ string tag = "thread #" + boost::lexical_cast<string>(thread_id);
LemmaOutputChannel* outputChannel =
new PortfolioLemmaOutputChannel(tag, d_channelsOut[i], d_exprMgrs[i],
d_vmaps[i]->d_from, d_vmaps[i]->d_to);
LemmaInputChannel* inputChannel =
new PortfolioLemmaInputChannel(tag, d_channelsIn[i], d_exprMgrs[i],
d_vmaps[i]->d_from, d_vmaps[i]->d_to);
- d_smts[i]->globals()->setLemmaInputChannel(inputChannel);
- d_smts[i]->globals()->setLemmaOutputChannel(outputChannel);
+ d_smts[i]->channels()->setLemmaInputChannel(inputChannel);
+ d_smts[i]->channels()->setLemmaOutputChannel(outputChannel);
}
/* Output to string stream */
assert(d_ostringstreams.size() == 0);
for(unsigned i = 0; i < d_numThreads; ++i) {
d_ostringstreams.push_back(new ostringstream);
- d_threadOptions[i].set(options::out, d_ostringstreams[i]);
+ d_threadOptions[i].setOut(d_ostringstreams[i]);
+ OutputLanguage outputLanguage = d_threadOptions[i].getOutputLanguage();
// important even for muzzled builds (to get result output right)
- *d_threadOptions[i][options::out]
- << language::SetLanguage(d_threadOptions[i][options::outputLanguage]);
+ *(d_threadOptions[i].getOut()) << language::SetLanguage(outputLanguage);
}
}
}/* CommandExecutorPortfolio::lemmaSharingInit() */
void CommandExecutorPortfolio::lemmaSharingCleanup()
{
- assert(d_numThreads == d_options[options::threads]);
+ assert(d_numThreads == d_options.getThreads());
if(d_numThreads == 1)
return;
for(unsigned i = 0; i < d_numThreads; ++i) {
delete d_channelsIn[i];
delete d_channelsOut[i];
- delete d_smts[i]->globals()->getLemmaInputChannel();
- d_smts[i]->globals()->setLemmaInputChannel(NULL);
- delete d_smts[i]->globals()->getLemmaOutputChannel();
- d_smts[i]->globals()->setLemmaOutputChannel(NULL);
+ delete d_smts[i]->channels()->getLemmaInputChannel();
+ d_smts[i]->channels()->setLemmaInputChannel(NULL);
+ delete d_smts[i]->channels()->getLemmaOutputChannel();
+ d_smts[i]->channels()->setLemmaOutputChannel(NULL);
}
d_channelsIn.clear();
d_channelsOut.clear();
if(d_ostringstreams.size() != 0) {
assert(d_ostringstreams.size() == d_numThreads);
for(unsigned i = 0; i < d_numThreads; ++i) {
- d_threadOptions[i].set(options::out, d_options[options::out]);
+ d_threadOptions[i].setOut(d_options.getOut());
delete d_ostringstreams[i];
}
d_ostringstreams.clear();
Command* cmdExported =
d_lastWinner == 0 ?
cmd : cmd->exportTo(d_exprMgrs[d_lastWinner], *(d_vmaps[d_lastWinner]) );
- bool ret = smtEngineInvoke(d_smts[d_lastWinner],
- cmdExported,
- d_options[options::verbosity] >= -1 ? d_threadOptions[d_lastWinner][options::out] : NULL);
+ std::ostream* winnersOut = d_options.getVerbosity() >= -1 ?
+ (d_threadOptions[d_lastWinner]).getOut() : NULL;
+ bool ret = smtEngineInvoke(d_smts[d_lastWinner], cmdExported, winnersOut);
if(d_lastWinner != 0) delete cmdExported;
return ret;
} else if(mode == 1) { // portfolio
cmd->exportTo(d_exprMgrs[i], *(d_vmaps[i])) :
d_seq->exportTo(d_exprMgrs[i], *(d_vmaps[i]) );
} catch(ExportUnsupportedException& e) {
- if(d_options[options::fallbackSequential]) {
- Notice() << "Unsupported theory encountered, switching to sequential mode.";
+ if(d_options.getFallbackSequential()) {
+ Notice() << "Unsupported theory encountered."
+ << "Switching to sequential mode.";
return CommandExecutor::doCommandSingleton(cmd);
}
else
- throw Exception("Certain theories (e.g., datatypes) are (currently) unsupported in portfolio\n"
- "mode. Please see option --fallback-sequential to make this a soft error.");
+ throw Exception("Certain theories (e.g., datatypes) are (currently)"
+ " unsupported in portfolio\n mode. Please see option"
+ " --fallback-sequential to make this a soft error.");
}
}
/* Portfolio */
boost::function<bool()>* fns = new boost::function<bool()>[d_numThreads];
for(unsigned i = 0; i < d_numThreads; ++i) {
- fns[i] = boost::bind(smtEngineInvoke,
- d_smts[i],
- seqs[i],
- d_options[options::verbosity] >= -1 ? d_threadOptions[i][options::out] : NULL
- );
+ std::ostream* current_out_or_null = d_options.getVerbosity() >= -1 ?
+ d_threadOptions[i].getOut() : NULL;
+
+ fns[i] = boost::bind(smtEngineInvoke, d_smts[i], seqs[i],
+ current_out_or_null);
}
assert(d_channelsIn.size() == d_numThreads
&d_channelsIn[0],
&d_smts[0]);
- size_t threadStackSize = d_options[options::threadStackSize];
+ size_t threadStackSize = d_options.getThreadStackSize();
threadStackSize *= 1024 * 1024;
pair<int, bool> portfolioReturn =
runPortfolio(d_numThreads, smFn, fns, threadStackSize,
- d_options[options::waitToJoin], d_statWaitTime);
+ d_options.getWaitToJoin(), d_statWaitTime);
#ifdef CVC4_STATISTICS_ON
assert( d_statWaitTime.running() );
d_result = d_smts[d_lastWinner]->getStatusOfLastCommand();
if(d_ostringstreams.size() != 0) {
- assert(d_numThreads == d_options[options::threads]);
+ assert(d_numThreads == d_options.getThreads());
assert(portfolioReturn.first >= 0);
assert(unsigned(portfolioReturn.first) < d_numThreads);
+ std::ostream& out = *d_options.getOut();
if(Debug.isOn("treat-unknown-error")) {
if(d_ostringstreams[portfolioReturn.first]->str() == "unknown\n") {
- *d_options[options::out]
- << "portfolioReturn = (" << portfolioReturn.first << ", " << portfolioReturn.second
- << ")\n";
+ out << "portfolioReturn = (" << portfolioReturn.first << ", "
+ << portfolioReturn.second << ")\n";
for(unsigned i = 0; i < d_numThreads; ++i)
- *d_options[options::out]
- << "thread " << i << ": " << d_ostringstreams[i]->str() << std::endl;
+ out << "thread " << i << ": " << d_ostringstreams[i]->str()
+ << std::endl;
throw Exception("unknown encountered");
}
}
- *d_options[options::out]
- << d_ostringstreams[portfolioReturn.first]->str()
- << std::flush;
+ out << d_ostringstreams[portfolioReturn.first]->str()
+ << std::flush;
#ifdef CVC4_COMPETITION_MODE
// We use CVC4 in competition with --no-wait-to-join. If
// dump the model/proof/unsat core if option is set
if(status) {
- if( d_options[options::produceModels] &&
- d_options[options::dumpModels] &&
+ if( d_options.getProduceModels() &&
+ d_options.getDumpModels() &&
( d_result.asSatisfiabilityResult() == Result::SAT ||
- (d_result.isUnknown() && d_result.whyUnknown() == Result::INCOMPLETE) ) ) {
+ (d_result.isUnknown() &&
+ d_result.whyUnknown() == Result::INCOMPLETE) ) )
+ {
Command* gm = new GetModelCommand();
status = doCommandSingleton(gm);
- } else if( d_options[options::proof] &&
- d_options[options::dumpProofs] &&
+ } else if( d_options.getProof() &&
+ d_options.getDumpProofs() &&
d_result.asSatisfiabilityResult() == Result::UNSAT ) {
Command* gp = new GetProofCommand();
status = doCommandSingleton(gp);
- } else if( d_options[options::dumpInstantiations] &&
- ( ( d_options[options::instFormatMode]!=INST_FORMAT_MODE_SZS &&
- ( d_result.asSatisfiabilityResult() == Result::SAT || (d_result.isUnknown() && d_result.whyUnknown() == Result::INCOMPLETE) ) ) ||
- d_result.asSatisfiabilityResult() == Result::UNSAT ) ) {
+ } else if( d_options.getDumpInstantiations() &&
+ ( ( d_options.getInstFormatMode() != INST_FORMAT_MODE_SZS &&
+ ( d_result.asSatisfiabilityResult() == Result::SAT ||
+ (d_result.isUnknown() &&
+ d_result.whyUnknown() == Result::INCOMPLETE) ) ) ||
+ d_result.asSatisfiabilityResult() == Result::UNSAT ) ) {
Command* gi = new GetInstantiationsCommand();
status = doCommandSingleton(gi);
- } else if( d_options[options::dumpSynth] && d_result.asSatisfiabilityResult() == Result::UNSAT ){
+ } else if( d_options.getDumpSynth() &&
+ d_result.asSatisfiabilityResult() == Result::UNSAT ){
Command* gi = new GetSynthSolutionCommand();
status = doCommandSingleton(gi);
- } else if( d_options[options::dumpUnsatCores] &&
+ } else if( d_options.getDumpUnsatCores() &&
d_result.asSatisfiabilityResult() == Result::UNSAT ) {
Command* guc = new GetUnsatCoreCommand();
status = doCommandSingleton(guc);
return status;
} else if(mode == 2) {
- Command* cmdExported =
- d_lastWinner == 0 ?
- cmd : cmd->exportTo(d_exprMgrs[d_lastWinner], *(d_vmaps[d_lastWinner]) );
- bool ret = smtEngineInvoke(d_smts[d_lastWinner],
- cmdExported,
- d_options[options::verbosity] >= -1 ? d_threadOptions[d_lastWinner][options::out] : NULL);
- if(d_lastWinner != 0) delete cmdExported;
+ Command* cmdExported = d_lastWinner == 0 ?
+ cmd : cmd->exportTo(d_exprMgrs[d_lastWinner], *(d_vmaps[d_lastWinner]));
+ std::ostream* winner_out_if_verbose = d_options.getVerbosity() >= -1 ?
+ d_threadOptions[d_lastWinner].getOut() : NULL;
+ bool ret = smtEngineInvoke(d_smts[d_lastWinner], cmdExported,
+ winner_out_if_verbose);
+ if(d_lastWinner != 0){
+ delete cmdExported;
+ }
return ret;
} else {
// Unreachable();
}/* CommandExecutorPortfolio::doCommandSingleton() */
void CommandExecutorPortfolio::flushStatistics(std::ostream& out) const {
- assert(d_numThreads == d_exprMgrs.size() && d_exprMgrs.size() == d_smts.size());
+ assert(d_numThreads == d_exprMgrs.size() &&
+ d_exprMgrs.size() == d_smts.size());
for(size_t i = 0; i < d_numThreads; ++i) {
string emTag = "thread#"
- + boost::lexical_cast<string>(d_threadOptions[i][options::thread_id]);
+ + boost::lexical_cast<string>(d_threadOptions[i].getThreadId());
Statistics stats = d_exprMgrs[i]->getStatistics();
stats.setPrefix(emTag);
stats.flushInformation(out);
string smtTag = "thread#"
- + boost::lexical_cast<string>(d_threadOptions[i][options::thread_id]);
+ + boost::lexical_cast<string>(d_threadOptions[i].getThreadId());
stats = d_smts[i]->getStatistics();
stats.setPrefix(smtTag);
stats.flushInformation(out);
// not too hard to support this changing
std::vector<SmtEngine*> d_smts;
CommandSequence* d_seq;
- std::vector<Options>& d_threadOptions;
+ OptionsList& d_threadOptions;
std::vector<ExprManagerMapCollection*> d_vmaps;
int d_lastWinner;
public:
CommandExecutorPortfolio(ExprManager &exprMgr,
Options &options,
- std::vector<Options>& tOpts);
+ OptionsList& tOpts);
~CommandExecutorPortfolio();
// This must come before PORTFOLIO_BUILD.
#include "cvc4autoconfig.h"
+#include "base/configuration.h"
#include "base/output.h"
#include "expr/expr_iomanip.h"
#include "expr/expr_manager.h"
#include "main/interactive_shell.h"
#include "main/main.h"
-#include "options/base_options.h"
-#include "options/main_options.h"
#include "options/options.h"
-#include "options/quantifiers_options.h"
#include "options/set_language.h"
-#include "options/smt_options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
#include "parser/parser_exception.h"
-#include "smt/smt_options_handler.h"
#include "smt_util/command.h"
-#include "util/configuration.h"
#include "util/result.h"
#include "util/statistics_registry.h"
void printUsage(Options& opts, bool full) {
stringstream ss;
- ss << "usage: " << opts[options::binary_name] << " [options] [input-file]" << endl
- << endl
- << "Without an input file, or with `-', CVC4 reads from standard input." << endl
- << endl
- << "CVC4 options:" << endl;
+ ss << "usage: " << opts.getBinaryName() << " [options] [input-file]"
+ << endl << endl
+ << "Without an input file, or with `-', CVC4 reads from standard input."
+ << endl << endl
+ << "CVC4 options:" << endl;
if(full) {
- Options::printUsage( ss.str(), *opts[options::out] );
+ Options::printUsage( ss.str(), *(opts.getOut()) );
} else {
- Options::printShortUsage( ss.str(), *opts[options::out] );
+ Options::printShortUsage( ss.str(), *(opts.getOut()) );
}
}
-void printStatsFilterZeros(std::ostream& out, const std::string& statsString) {
- // read each line, if a number, check zero and skip if so
- // Stat are assumed to one-per line: "<statName>, <statValue>"
-
- std::istringstream iss(statsString);
- std::string statName, statValue;
-
- std::getline(iss, statName, ',');
-
- while( !iss.eof() ) {
-
- std::getline(iss, statValue, '\n');
-
- double curFloat;
- bool isFloat = (std::istringstream(statValue) >> curFloat);
-
- if( (isFloat && curFloat == 0) ||
- statValue == " \"0\"" ||
- statValue == " \"[]\"") {
- // skip
- } else {
- out << statName << "," << statValue << std::endl;
- }
-
- std::getline(iss, statName, ',');
- }
-
-}
-
int runCvc4(int argc, char* argv[], Options& opts) {
// Timer statistic
progPath = argv[0];
-#warning "TODO: Check that the SmtEngine pointer should be NULL with Kshitij."
- smt::SmtOptionsHandler optionsHandler(NULL);
-
// Parse the options
- vector<string> filenames = opts.parseOptions(argc, argv, &optionsHandler);
+ vector<string> filenames = opts.parseOptions(argc, argv);
# ifndef PORTFOLIO_BUILD
- if( opts.wasSetByUser(options::threads) ||
- opts.wasSetByUser(options::threadStackSize) ||
- ! opts[options::threadArgv].empty() ) {
+ if( opts.wasSetByUserThreads() ||
+ opts.wasSetByUserThreadStackSize() ||
+ (! opts.getThreadArgv().empty()) ) {
throw OptionException("Thread options cannot be used with sequential CVC4. Please build and use the portfolio binary `pcvc4'.");
}
# endif
- progName = opts[options::binary_name].c_str();
+ progName = opts.getBinaryName().c_str();
- if( opts[options::help] ) {
+ if( opts.getHelp() ) {
printUsage(opts, true);
exit(1);
- } else if( opts[options::languageHelp] ) {
- Options::printLanguageHelp(*opts[options::out]);
+ } else if( opts.getLanguageHelp() ) {
+ Options::printLanguageHelp(*(opts.getOut()));
exit(1);
- } else if( opts[options::version] ) {
- *opts[options::out] << Configuration::about().c_str() << flush;
+ } else if( opts.getVersion() ) {
+ *(opts.getOut()) << Configuration::about().c_str() << flush;
exit(0);
}
- segvSpin = opts[options::segvSpin];
+ segvSpin = opts.getSegvSpin();
// If in competition mode, set output stream option to flush immediately
#ifdef CVC4_COMPETITION_MODE
- *opts[options::out] << unitbuf;
+ *(opts.getOut()) << unitbuf;
#endif /* CVC4_COMPETITION_MODE */
// We only accept one input file
const bool inputFromStdin = filenames.empty() || filenames[0] == "-";
// if we're reading from stdin on a TTY, default to interactive mode
- if(!opts.wasSetByUser(options::interactive)) {
- opts.set(options::interactive, inputFromStdin && isatty(fileno(stdin)));
+ if(!opts.wasSetByUserInteractive()) {
+ opts.setInteractive(inputFromStdin && isatty(fileno(stdin)));
}
// Auto-detect input language by filename extension
const char* filename = inputFromStdin ? "<stdin>" : filenames[0].c_str();
- if(opts[options::inputLanguage] == language::input::LANG_AUTO) {
+ if(opts.getInputLanguage() == language::input::LANG_AUTO) {
if( inputFromStdin ) {
// We can't do any fancy detection on stdin
- opts.set(options::inputLanguage, language::input::LANG_CVC4);
+ opts.setInputLanguage(language::input::LANG_CVC4);
} else {
unsigned len = strlen(filename);
if(len >= 5 && !strcmp(".smt2", filename + len - 5)) {
- opts.set(options::inputLanguage, language::input::LANG_SMTLIB_V2_0);
+ opts.setInputLanguage(language::input::LANG_SMTLIB_V2_0);
} else if(len >= 4 && !strcmp(".smt", filename + len - 4)) {
- opts.set(options::inputLanguage, language::input::LANG_SMTLIB_V1);
+ opts.setInputLanguage(language::input::LANG_SMTLIB_V1);
} else if(len >= 5 && !strcmp(".smt1", filename + len - 5)) {
- opts.set(options::inputLanguage, language::input::LANG_SMTLIB_V1);
+ opts.setInputLanguage(language::input::LANG_SMTLIB_V1);
} else if((len >= 2 && !strcmp(".p", filename + len - 2))
|| (len >= 5 && !strcmp(".tptp", filename + len - 5))) {
- opts.set(options::inputLanguage, language::input::LANG_TPTP);
+ opts.setInputLanguage(language::input::LANG_TPTP);
} else if(( len >= 4 && !strcmp(".cvc", filename + len - 4) )
|| ( len >= 5 && !strcmp(".cvc4", filename + len - 5) )) {
- opts.set(options::inputLanguage, language::input::LANG_CVC4);
+ opts.setInputLanguage(language::input::LANG_CVC4);
} else if((len >= 3 && !strcmp(".sy", filename + len - 3))
|| (len >= 3 && !strcmp(".sl", filename + len - 3))) {
- opts.set(options::inputLanguage, language::input::LANG_SYGUS);
+ opts.setInputLanguage(language::input::LANG_SYGUS);
//since there is no sygus output language, set this to SMT lib 2
- //opts.set(options::outputLanguage, language::output::LANG_SMTLIB_V2_0);
+ //opts.setOutputLanguage(language::output::LANG_SMTLIB_V2_0);
}
}
}
- if(opts[options::outputLanguage] == language::output::LANG_AUTO) {
- opts.set(options::outputLanguage, language::toOutputLanguage(opts[options::inputLanguage]));
+ if(opts.getOutputLanguage() == language::output::LANG_AUTO) {
+ opts.setOutputLanguage(language::toOutputLanguage(opts.getInputLanguage()));
}
// if doing sygus, turn on CEGQI by default
- if(opts[options::inputLanguage] == language::input::LANG_SYGUS ){
- if( !opts.wasSetByUser(options::ceGuidedInst)) {
- opts.set(options::ceGuidedInst, true);
+ if(opts.getInputLanguage() == language::input::LANG_SYGUS ){
+ if( !opts.wasSetByUserCeGuidedInst()) {
+ opts.setCeGuidedInst(true);
}
- if( !opts.wasSetByUser(options::dumpSynth)) {
- opts.set(options::dumpSynth, true);
+ if( !opts.wasSetByUserDumpSynth()) {
+ opts.setDumpSynth(true);
}
}
// Determine which messages to show based on smtcomp_mode and verbosity
if(Configuration::isMuzzledBuild()) {
- DebugChannel.setStream(CVC4::null_os);
- TraceChannel.setStream(CVC4::null_os);
- NoticeChannel.setStream(CVC4::null_os);
- ChatChannel.setStream(CVC4::null_os);
- MessageChannel.setStream(CVC4::null_os);
- WarningChannel.setStream(CVC4::null_os);
+ DebugChannel.setStream(&CVC4::null_os);
+ TraceChannel.setStream(&CVC4::null_os);
+ NoticeChannel.setStream(&CVC4::null_os);
+ ChatChannel.setStream(&CVC4::null_os);
+ MessageChannel.setStream(&CVC4::null_os);
+ WarningChannel.setStream(&CVC4::null_os);
}
// important even for muzzled builds (to get result output right)
- *opts[options::out] << language::SetLanguage(opts[options::outputLanguage]);
+ (*(opts.getOut())) << language::SetLanguage(opts.getOutputLanguage());
// Create the expression manager using appropriate options
ExprManager* exprMgr;
exprMgr = new ExprManager(opts);
pExecutor = new CommandExecutor(*exprMgr, opts);
# else
- vector<Options> threadOpts = parseThreadSpecificOptions(opts);
+ OptionsList threadOpts;
+ parseThreadSpecificOptions(threadOpts, opts);
+
bool useParallelExecutor = true;
// incremental?
- if(opts.wasSetByUser(options::incrementalSolving) &&
- opts[options::incrementalSolving] &&
- !opts[options::incrementalParallel]) {
- Notice() << "Notice: In --incremental mode, using the sequential solver unless forced by...\n"
+ if(opts.wasSetByUserIncrementalSolving() &&
+ opts.getIncrementalSolving() &&
+ (! opts.getIncrementalParallel()) ) {
+ Notice() << "Notice: In --incremental mode, using the sequential solver"
+ << " unless forced by...\n"
<< "Notice: ...the experimental --incremental-parallel option.\n";
useParallelExecutor = false;
}
// proofs?
- if(opts[options::checkProofs]) {
- if(opts[options::fallbackSequential]) {
- Warning() << "Warning: Falling back to sequential mode, as cannot run portfolio in check-proofs mode.\n";
+ if(opts.getCheckProofs()) {
+ if(opts.getFallbackSequential()) {
+ Warning() << "Warning: Falling back to sequential mode, as cannot run"
+ << " portfolio in check-proofs mode.\n";
useParallelExecutor = false;
}
else {
# endif
Parser* replayParser = NULL;
- if( opts[options::replayFilename] != "" ) {
- ParserBuilder replayParserBuilder(exprMgr, opts[options::replayFilename], opts);
+ if( opts.getReplayInputFilename() != "" ) {
+ std::string replayFilename = opts.getReplayInputFilename();
+ ParserBuilder replayParserBuilder(exprMgr, replayFilename, opts);
- if( opts[options::replayFilename] == "-") {
+ if( replayFilename == "-") {
if( inputFromStdin ) {
throw OptionException("Replay file and input file can't both be stdin.");
}
replayParserBuilder.withStreamInput(cin);
}
replayParser = replayParserBuilder.build();
- pExecutor->globals()->setReplayStream(new Parser::ExprStream(replayParser));
- }
- if( pExecutor->globals()->getReplayLog() != NULL ) {
- *(pExecutor->globals()->getReplayLog()) <<
- language::SetLanguage(opts[options::outputLanguage]) << expr::ExprSetDepth(-1);
+ pExecutor->setReplayStream(new Parser::ExprStream(replayParser));
}
int returnValue = 0;
{
// Timer statistic
- RegisterStatistic statTotalTime(&pExecutor->getStatisticsRegistry(), pTotalTime);
+ RegisterStatistic statTotalTime(&pExecutor->getStatisticsRegistry(),
+ pTotalTime);
// Filename statistics
ReferenceStat< const char* > s_statFilename("filename", filename);
- RegisterStatistic statFilenameReg(&pExecutor->getStatisticsRegistry(), &s_statFilename);
+ RegisterStatistic statFilenameReg(&pExecutor->getStatisticsRegistry(),
+ &s_statFilename);
// Parse and execute commands until we are done
Command* cmd;
bool status = true;
- if(opts[options::interactive] && inputFromStdin) {
- if(opts[options::tearDownIncremental] > 0) {
- throw OptionException("--tear-down-incremental doesn't work in interactive mode");
+ if(opts.getInteractive() && inputFromStdin) {
+ if(opts.getTearDownIncremental() > 0) {
+ throw OptionException(
+ "--tear-down-incremental doesn't work in interactive mode");
}
#ifndef PORTFOLIO_BUILD
- if(!opts.wasSetByUser(options::incrementalSolving)) {
+ if(!opts.wasSetByUserIncrementalSolving()) {
cmd = new SetOptionCommand("incremental", SExpr(true));
cmd->setMuted(true);
pExecutor->doCommand(cmd);
}
#endif /* PORTFOLIO_BUILD */
InteractiveShell shell(*exprMgr, opts);
- if(opts[options::interactivePrompt]) {
+ if(opts.getInteractivePrompt()) {
Message() << Configuration::getPackageName()
<< " " << Configuration::getVersionString();
if(Configuration::isGitBuild()) {
try {
cmd = shell.readCommand();
} catch(UnsafeInterruptException& e) {
- *opts[options::out] << CommandInterrupted();
+ (*opts.getOut()) << CommandInterrupted();
break;
}
if (cmd == NULL)
}
delete cmd;
}
- } else if(opts[options::tearDownIncremental] > 0) {
- if(!opts[options::incrementalSolving]) {
+ } else if( opts.getTearDownIncremental() > 0) {
+ if(!opts.getIncrementalSolving()) {
cmd = new SetOptionCommand("incremental", SExpr(true));
cmd->setMuted(true);
pExecutor->doCommand(cmd);
delete cmd;
- // if(opts.wasSetByUser(options::incrementalSolving)) {
- // throw OptionException("--tear-down-incremental incompatible with --incremental");
+ // if(opts.wasSetByUserIncrementalSolving()) {
+ // throw OptionException(
+ // "--tear-down-incremental incompatible with --incremental");
// }
// cmd = new SetOptionCommand("incremental", SExpr(false));
int needReset = 0;
// true if one of the commands was interrupted
bool interrupted = false;
- while (status || opts[options::continuedExecution]) {
+ while (status || opts.getContinuedExecution()) {
if (interrupted) {
- *opts[options::out] << CommandInterrupted();
+ (*opts.getOut()) << CommandInterrupted();
break;
}
}
if(dynamic_cast<PushCommand*>(cmd) != NULL) {
- if(needReset >= opts[options::tearDownIncremental]) {
+ if(needReset >= opts.getTearDownIncremental()) {
pExecutor->reset();
for(size_t i = 0; i < allCommands.size() && !interrupted; ++i) {
if (interrupted) break;
- for(size_t j = 0; j < allCommands[i].size() && !interrupted; ++j) {
+ for(size_t j = 0; j < allCommands[i].size() && !interrupted; ++j)
+ {
Command* cmd = allCommands[i][j]->clone();
cmd->setMuted(true);
pExecutor->doCommand(cmd);
}
} else if(dynamic_cast<PopCommand*>(cmd) != NULL) {
allCommands.pop_back(); // fixme leaks cmds here
- if (needReset >= opts[options::tearDownIncremental]) {
+ if (needReset >= opts.getTearDownIncremental()) {
pExecutor->reset();
for(size_t i = 0; i < allCommands.size() && !interrupted; ++i) {
- for(size_t j = 0; j < allCommands[i].size() && !interrupted; ++j) {
+ for(size_t j = 0; j < allCommands[i].size() && !interrupted; ++j)
+ {
Command* cmd = allCommands[i][j]->clone();
cmd->setMuted(true);
pExecutor->doCommand(cmd);
}
}
if (interrupted) continue;
- *opts[options::out] << CommandSuccess();
+ (*opts.getOut()) << CommandSuccess();
needReset = 0;
} else {
status = pExecutor->doCommand(cmd);
}
} else if(dynamic_cast<CheckSatCommand*>(cmd) != NULL ||
dynamic_cast<QueryCommand*>(cmd) != NULL) {
- if(needReset >= opts[options::tearDownIncremental]) {
+ if(needReset >= opts.getTearDownIncremental()) {
pExecutor->reset();
for(size_t i = 0; i < allCommands.size() && !interrupted; ++i) {
- for(size_t j = 0; j < allCommands[i].size() && !interrupted; ++j) {
+ for(size_t j = 0; j < allCommands[i].size() && !interrupted; ++j)
+ {
Command* cmd = allCommands[i][j]->clone();
cmd->setMuted(true);
pExecutor->doCommand(cmd);
// Remove the parser
delete parser;
} else {
- if(!opts.wasSetByUser(options::incrementalSolving)) {
+ if(!opts.wasSetByUserIncrementalSolving()) {
cmd = new SetOptionCommand("incremental", SExpr(false));
cmd->setMuted(true);
pExecutor->doCommand(cmd);
replayParser->useDeclarationsFrom(parser);
}
bool interrupted = false;
- while(status || opts[options::continuedExecution]) {
+ while(status || opts.getContinuedExecution()) {
if (interrupted) {
- *opts[options::out] << CommandInterrupted();
+ (*opts.getOut()) << CommandInterrupted();
pExecutor->reset();
break;
}
delete parser;
}
- if( pExecutor->globals()->getReplayStream() != NULL ) {
- ExprStream* replayStream = pExecutor->globals()->getReplayStream();
- pExecutor->globals()->setReplayStream(NULL);
- // this deletes the expression parser too
- delete replayStream;
- }
-
Result result;
if(status) {
result = pExecutor->getResult();
}
#ifdef CVC4_COMPETITION_MODE
- *opts[options::out] << flush;
+ opts.flushOut();
// exit, don't return (don't want destructors to run)
// _exit() from unistd.h doesn't run global destructors
// or other on_exit/atexit stuff.
#endif /* CVC4_COMPETITION_MODE */
ReferenceStat< Result > s_statSatResult("sat/unsat", result);
- RegisterStatistic statSatResultReg(&pExecutor->getStatisticsRegistry(), &s_statSatResult);
+ RegisterStatistic statSatResultReg(&pExecutor->getStatisticsRegistry(),
+ &s_statSatResult);
pTotalTime->stop();
+ // Tim: I think that following comment is out of date?
// Set the global executor pointer to NULL first. If we get a
// signal while dumping statistics, we don't want to try again.
- if(opts[options::statistics]) {
- if(opts[options::statsHideZeros] == false) {
- pExecutor->flushStatistics(*opts[options::err]);
- } else {
- std::ostringstream ossStats;
- pExecutor->flushStatistics(ossStats);
- printStatsFilterZeros(*opts[options::err], ossStats.str());
- }
- }
-
- // make sure to flush replay output log before early-exit
- if( pExecutor->globals()->getReplayLog() != NULL ) {
- *(pExecutor->globals()->getReplayLog()) << flush;
- }
-
- // make sure out and err streams are flushed too
- *opts[options::out] << flush;
- *opts[options::err] << flush;
+ pExecutor->flushOutputStreams();
#ifdef CVC4_DEBUG
- if(opts[options::earlyExit] && opts.wasSetByUser(options::earlyExit)) {
+ if(opts.getEarlyExit() && opts.wasSetByUserEarlyExit()) {
_exit(returnValue);
}
#else /* CVC4_DEBUG */
- if(opts[options::earlyExit]) {
+ if(opts.getEarlyExit()) {
_exit(returnValue);
}
#endif /* CVC4_DEBUG */
#include "base/output.h"
#include "options/language.h"
-#include "options/base_options.h"
-#include "options/main_options.h"
#include "options/options.h"
-#include "options/smt_options.h"
#include "parser/input.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
#endif /* HAVE_LIBREADLINE */
InteractiveShell::InteractiveShell(ExprManager& exprManager,
- const Options& options) :
- d_in(*options[options::in]),
- d_out(*options[options::out]),
- d_options(options),
- d_quit(false) {
+ const Options& options)
+ : d_in(*options.getIn()),
+ d_out(*options.getOutConst()),
+ d_options(options),
+ d_quit(false)
+{
ParserBuilder parserBuilder(&exprManager, INPUT_FILENAME, options);
/* Create parser with bogus input. */
d_parser = parserBuilder.withStringInput("").build();
- if(d_options.wasSetByUser(options::forceLogic)) {
- d_parser->forceLogic(d_options[options::forceLogic]->getLogicString());
+ if(d_options.wasSetByUserForceLogicString()) {
+ LogicInfo tmp(d_options.getForceLogicString());
+ d_parser->forceLogic(tmp.getLogicString());
}
#if HAVE_LIBREADLINE
#endif /* READLINE_COMPENTRY_FUNC_RETURNS_CHARP */
::using_history();
- switch(OutputLanguage lang = toOutputLanguage(d_options[options::inputLanguage])) {
+ OutputLanguage lang = toOutputLanguage(d_options.getInputLanguage());
+ switch(lang) {
case output::LANG_CVC4:
d_historyFilename = string(getenv("HOME")) + "/.cvc4_history";
commandsBegin = cvc_commands;
/* Prompt the user for input. */
if(d_usingReadline) {
#if HAVE_LIBREADLINE
- lineBuf = ::readline(d_options[options::interactivePrompt] ? (line == "" ? "CVC4> " : "... > ") : "");
+ lineBuf = ::readline(d_options.getInteractivePrompt()
+ ? (line == "" ? "CVC4> " : "... > ") : "");
if(lineBuf != NULL && lineBuf[0] != '\0') {
::add_history(lineBuf);
}
free(lineBuf);
#endif /* HAVE_LIBREADLINE */
} else {
- if(d_options[options::interactivePrompt]) {
+ if(d_options.getInteractivePrompt()) {
if(line == "") {
d_out << "CVC4> " << flush;
} else {
string input = "";
while(true) {
- Debug("interactive") << "Input now '" << input << line << "'" << endl << flush;
+ Debug("interactive") << "Input now '" << input << line << "'" << endl
+ << flush;
assert( !(d_in.fail() && !d_in.eof()) || line.empty() );
/* Extract the newline delimiter from the stream too */
int c CVC4_UNUSED = d_in.get();
assert(c == '\n');
- Debug("interactive") << "Next char is '" << (char)c << "'" << endl << flush;
+ Debug("interactive") << "Next char is '" << (char)c << "'" << endl
+ << flush;
}
input += line;
input[n] = '\n';
if(d_usingReadline) {
#if HAVE_LIBREADLINE
- lineBuf = ::readline(d_options[options::interactivePrompt] ? "... > " : "");
+ lineBuf = ::readline(d_options.getInteractivePrompt() ? "... > " : "");
if(lineBuf != NULL && lineBuf[0] != '\0') {
::add_history(lineBuf);
}
free(lineBuf);
#endif /* HAVE_LIBREADLINE */
} else {
- if(d_options[options::interactivePrompt]) {
+ if(d_options.getInteractivePrompt()) {
d_out << "... > " << flush;
}
}
}
- d_parser->setInput(Input::newStringInput(d_options[options::inputLanguage], input, INPUT_FILENAME));
+ d_parser->setInput(Input::newStringInput(d_options.getInputLanguage(),
+ input, INPUT_FILENAME));
/* There may be more than one command in the input. Build up a
sequence. */
line += "\n";
goto restart;
} catch(ParserException& pe) {
- if(d_options[options::outputLanguage] == output::LANG_SMTLIB_V2_0 ||
- d_options[options::outputLanguage] == output::LANG_SMTLIB_V2_5) {
+ if(d_options.getOutputLanguage() == output::LANG_SMTLIB_V2_0 ||
+ d_options.getOutputLanguage() == output::LANG_SMTLIB_V2_5) {
d_out << "(error \"" << pe << "\")" << endl;
} else {
d_out << pe << endl;
#include <stdio.h>
#include <unistd.h>
+#include "base/configuration.h"
#include "base/output.h"
#include "expr/expr_manager.h"
#include "main/command_executor.h"
#include "main/interactive_shell.h"
-#include "options/base_options.h"
#include "options/language.h"
-#include "options/main_options.h"
+#include "options/options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
#include "parser/parser_exception.h"
#include "smt/smt_engine.h"
#include "smt_util/command.h"
-#include "util/configuration.h"
#include "util/result.h"
#include "util/statistics.h"
return runCvc4(argc, argv, opts);
} catch(OptionException& e) {
#ifdef CVC4_COMPETITION_MODE
- *opts[options::out] << "unknown" << endl;
+ *opts.getOut() << "unknown" << endl;
#endif
cerr << "CVC4 Error:" << endl << e << endl << endl
<< "Please use --help to get help on command-line options."
<< endl;
} catch(Exception& e) {
#ifdef CVC4_COMPETITION_MODE
- *opts[options::out] << "unknown" << endl;
+ *opts.getOut() << "unknown" << endl;
#endif
- if(opts[options::outputLanguage] == output::LANG_SMTLIB_V2_0 ||
- opts[options::outputLanguage] == output::LANG_SMTLIB_V2_5) {
- *opts[options::out] << "(error \"" << e << "\")" << endl;
+ if(opts.getOutputLanguage() == output::LANG_SMTLIB_V2_0 ||
+ opts.getOutputLanguage() == output::LANG_SMTLIB_V2_5) {
+ *opts.getOut() << "(error \"" << e << "\")" << endl;
} else {
- *opts[options::err] << "CVC4 Error:" << endl << e << endl;
+ *opts.getErr() << "CVC4 Error:" << endl << e << endl;
}
- if(opts[options::statistics] && pExecutor != NULL) {
+ if(opts.getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
- pExecutor->flushStatistics(*opts[options::err]);
+ pExecutor->flushStatistics(*opts.getErr());
}
}
exit(1);
#include <cassert>
#include <vector>
-#include "options/base_options.h"
-#include "options/main_options.h"
#include "options/options.h"
-#include "options/prop_options.h"
-#include "options/smt_options.h"
-#include "smt/smt_options_handler.h"
using namespace std;
namespace CVC4 {
-vector<Options> parseThreadSpecificOptions(Options opts)
-{
- vector<Options> threadOptions;
+OptionsList::OptionsList() : d_options() {}
+
+OptionsList::~OptionsList(){
+ for(std::vector<Options*>::iterator i = d_options.begin(),
+ iend = d_options.end(); i != iend; ++i)
+ {
+ Options* current = *i;
+ delete current;
+ }
+ d_options.clear();
+}
+
+void OptionsList::push_back_copy(const Options& opts) {
+ Options* copy = new Options;
+ copy->copyValues(opts);
+ d_options.push_back(copy);
+}
+
+Options& OptionsList::operator[](size_t position){
+ return *(d_options[position]);
+}
+
+const Options& OptionsList::operator[](size_t position) const {
+ return *(d_options[position]);
+}
-#warning "TODO: Check that the SmtEngine pointer should be NULL with Kshitij."
- smt::SmtOptionsHandler optionsHandler(NULL);
+Options& OptionsList::back() {
+ return *(d_options.back());
+}
- unsigned numThreads = opts[options::threads];
+size_t OptionsList::size() const {
+ return d_options.size();
+}
+
+void parseThreadSpecificOptions(OptionsList& threadOptions, const Options& opts)
+{
+
+ unsigned numThreads = opts.getThreads();
for(unsigned i = 0; i < numThreads; ++i) {
- threadOptions.push_back(opts);
+ threadOptions.push_back_copy(opts);
Options& tOpts = threadOptions.back();
// Set thread identifier
- tOpts.set(options::thread_id, i);
-
- if(i < opts[options::threadArgv].size() &&
- !opts[options::threadArgv][i].empty()) {
-
+ tOpts.setThreadId(i);
+ const std::vector<std::string>& optThreadArgvs = opts.getThreadArgv();
+ if(i < optThreadArgvs.size() && (! optThreadArgvs[i].empty())) {
// separate out the thread's individual configuration string
stringstream optidss;
optidss << "--thread" << i;
string optid = optidss.str();
int targc = 1;
- char* tbuf = strdup(opts[options::threadArgv][i].c_str());
+ char* tbuf = strdup(optThreadArgvs[i].c_str());
char* p = tbuf;
// string length is certainly an upper bound on size needed
- char** targv = new char*[opts[options::threadArgv][i].size()];
+ char** targv = new char*[optThreadArgvs[i].size()];
char** vp = targv;
*vp++ = strdup(optid.c_str());
p = strtok(p, " ");
*vp++ = NULL;
if(targc > 1) { // this is necessary in case you do e.g. --thread0=" "
try {
- tOpts.parseOptions(targc, targv, &optionsHandler);
+ tOpts.parseOptions(targc, targv);
} catch(OptionException& e) {
stringstream ss;
ss << optid << ": " << e.getMessage();
<< "' in thread configuration " << optid << " !";
throw OptionException(ss.str());
}
- if(tOpts[options::threads] != numThreads
- || tOpts[options::threadArgv] != opts[options::threadArgv]) {
+ if(tOpts.getThreads() != numThreads ||
+ tOpts.getThreadArgv() != opts.getThreadArgv()) {
stringstream ss;
ss << "not allowed to set thread options in " << optid << " !";
throw OptionException(ss.str());
}
assert(numThreads >= 1); //do we need this?
-
- return threadOptions;
}
void PortfolioLemmaOutputChannel::notifyNewLemma(Expr lemma) {
- if(int(lemma.getNumChildren()) > options::sharingFilterByLength()) {
+ if(int(lemma.getNumChildren()) > Options::currentGetSharingFilterByLength()) {
return;
}
++cnt;
try {
d_pickler.toPickle(lemma, pkl);
d_sharedChannel->push(pkl);
- if(Trace.isOn("showSharing") && options::thread_id() == 0) {
- *options::out() << "thread #0: notifyNewLemma: " << lemma
- << std::endl;
+ if(Trace.isOn("showSharing") && Options::currentGetThreadId() == 0) {
+ (*(Options::currentGetOut()))
+ << "thread #0: notifyNewLemma: " << lemma << std::endl;
}
} catch(expr::pickle::PicklingException& p){
Trace("sharing::blocked") << lemma << std::endl;
expr::pickle::Pickle pkl = d_sharedChannel->pop();
Expr e = d_pickler.fromPickle(pkl);
- if(Trace.isOn("showSharing") && options::thread_id() == 0) {
- *options::out() << "thread #0: getNewLemma: " << e << std::endl;
+ if(Trace.isOn("showSharing") && Options::currentGetThreadId() == 0) {
+ (*Options::currentGetOut()) << "thread #0: getNewLemma: " << e << std::endl;
}
return e;
}
#include "base/output.h"
#include "expr/pickler.h"
-#include "options/main_options.h"
#include "smt/smt_engine.h"
#include "smt_util/lemma_input_channel.h"
#include "smt_util/lemma_output_channel.h"
};/* class PortfolioLemmaInputChannel */
-std::vector<Options> parseThreadSpecificOptions(Options opts);
+class OptionsList {
+ public:
+ OptionsList();
+ ~OptionsList();
+
+ void push_back_copy(const Options& options);
+
+ Options& operator[](size_t position);
+ const Options& operator[](size_t position) const;
+
+ Options& back();
+
+ size_t size() const;
+ private:
+ OptionsList(const OptionsList&) CVC4_UNDEFINED;
+ OptionsList& operator=(const OptionsList&) CVC4_UNDEFINED;
+ std::vector<Options*> d_options;
+};
+
+void parseThreadSpecificOptions(OptionsList& list, const Options& opts);
template<typename T>
void sharingManager(unsigned numThreads,
#include "cvc4autoconfig.h"
#include "main/command_executor.h"
#include "main/main.h"
-#include "options/base_options.h"
#include "options/options.h"
#include "smt/smt_engine.h"
#include "util/statistics.h"
using namespace std;
namespace CVC4 {
-
-#ifdef CVC4_DEBUG
-//extern CVC4_THREADLOCAL(const char*) s_debugLastException;
-#endif /* CVC4_DEBUG */
-
namespace main {
/**
/** Handler for SIGXCPU, i.e., timeout. */
void timeout_handler(int sig, siginfo_t* info, void*) {
fprintf(stderr, "CVC4 interrupted by timeout.\n");
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
/** Handler for SIGINT, i.e., when the user hits control C. */
void sigint_handler(int sig, siginfo_t* info, void*) {
fprintf(stderr, "CVC4 interrupted by user.\n");
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
}
if(!segvSpin) {
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
} else if(addr < 10*1024) {
cerr << "Looks like a NULL pointer was dereferenced." << endl;
}
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
#ifdef CVC4_DEBUG
fprintf(stderr, "CVC4 executed an illegal instruction in DEBUG mode.\n");
if(!segvSpin) {
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
}
#else /* CVC4_DEBUG */
fprintf(stderr, "CVC4 executed an illegal instruction.\n");
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
fprintf(stderr, "The exception is:\n%s\n\n", lastContents);
}
if(!segvSpin) {
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
}
#else /* CVC4_DEBUG */
fprintf(stderr, "CVC4 threw an \"unexpected\" exception.\n");
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
"CVC4 was terminated by the C++ runtime.\n"
"Perhaps an exception was thrown during stack unwinding. "
"(Don't do that.)\n");
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
fprintf(stderr,
"CVC4 was terminated by the C++ runtime.\n"
"Perhaps an exception was thrown during stack unwinding.\n");
- if((*pOptions)[options::statistics] && pExecutor != NULL) {
+ if(pOptions->getStatistics() && pExecutor != NULL) {
pTotalTime->stop();
pExecutor->flushStatistics(cerr);
}
base_options_template.cpp \
options_holder_template.h \
options_template.cpp \
- options_handler_get_option_template.cpp \
- options_handler_set_option_template.cpp
+ options_get_option_template.cpp \
+ options_set_option_template.cpp
CPP_TEMPLATE_SEDS = \
base_options_template.h.sed \
base_options_template.cpp.sed \
options_holder_template.h.sed \
options_template.cpp.sed \
- options_handler_get_option_template.cpp.sed \
- options_handler_set_option_template.cpp.sed
+ options_get_option_template.cpp.sed \
+ options_set_option_template.cpp.sed
DOCUMENTATION_FILES = \
arith_propagation_mode.h \
arith_unate_lemma_mode.cpp \
arith_unate_lemma_mode.h \
+ argument_extender.cpp \
+ argument_extender.h \
base_handlers.h \
boolean_term_conversion_mode.cpp \
boolean_term_conversion_mode.h \
didyoumean.h \
language.cpp \
language.h \
- logic_info_forward.h \
+ open_ostream.cpp \
+ open_ostream.h \
option_exception.h \
options.h \
- options_handler_interface.cpp \
- options_handler_interface.h \
+ options_handler.cpp \
+ options_handler.h \
+ options_public_functions.cpp \
printer_modes.cpp \
printer_modes.h \
quantifiers_modes.cpp \
options_holder.h \
$(OPTIONS_HEADS) \
$(OPTIONS_CPPS) \
- options_handler_get_option.cpp \
- options_handler_set_option.cpp
+ options_get_option.cpp \
+ options_set_option.cpp
BUILT_SOURCES = \
$(OPTIONS_OPTIONS_FILES) \
$(OPTIONS_SEDS) \
options.cpp \
- options_handler_get_option.cpp \
- options_handler_set_option.cpp \
+ options_get_option.cpp \
+ options_set_option.cpp \
options_holder.h \
summary.sed
-# listing {Debug,Trace}_tags too ensures that make doesn't auto-remove it
-# after building (if it does, we don't get the "cached" effect with
-# the .tmp files below, and we have to re-compile and re-link each
-# time, even when there are no changes).
-BUILT_SOURCES += \
- Debug_tags.h \
- Debug_tags \
- Trace_tags.h \
- Trace_tags
CLEANFILES = \
$(BUILT_SOURCES) \
base_options_template.h \
language.i \
mkoptions \
- mktagheaders \
- mktags \
option_exception.i \
options.i \
- options_handler_get_option_template.cpp \
- options_handler_interface.i \
- options_handler_set_option_template.cpp \
+ options_get_option_template.cpp \
options_holder_template.h \
+ options_set_option_template.cpp \
options_template.cpp
-%_tags.h: %_tags mktagheaders
- $(AM_V_at)chmod +x @srcdir@/mktagheaders
- $(AM_V_GEN)( @srcdir@/mktagheaders "$<" "$<" ) >"$@"
-# This .tmp business is to keep from having to re-compile options.cpp
-# (and then re-link the libraries) if nothing has changed.
-%_tags: %_tags.tmp
- $(AM_V_GEN)\
- diff -q "$^" "$@" &>/dev/null || mv "$^" "$@" || true
-# .PHONY ensures the .tmp version is always rebuilt (to check for any changes)
-.PHONY: Debug_tags.tmp Trace_tags.tmp
-# The "sed" invocation below is particularly obnoxious, but it works around
-# inconsistencies in REs on different platforms, using only a basic regular
-# expression (no |, no \<, ...).
-Debug_tags.tmp Trace_tags.tmp: mktags
- $(AM_V_at)chmod +x @srcdir@/mktags
- $(AM_V_GEN)(@srcdir@/mktags \
- '$(@:_tags.tmp=)' \
- "$$(find @srcdir@/../ -name '*.cpp' -o -name '*.h' -o -name '*.cc' -o -name '*.g')") >"$@"
-
-MOSTLYCLEANFILES = \
- Debug_tags \
- Trace_tags \
- Debug_tags.tmp \
- Trace_tags.tmp \
- Debug_tags.h \
- Trace_tags.h
+
# Make sure the implicit rules never mistake a _template.cpp or _template.h file for source file.
-options_holder_template.h options_template.cpp options_handler_get_option_template.cpp options_handler_set_option_template.cpp base_options_template.h base_options_template.cpp :;
+options_holder_template.h options_template.cpp options_get_option_template.cpp options_set_option_template.cpp base_options_template.h base_options_template.cpp :;
# Make sure the implicit rules never mistake X_options for the -o file for a
# CPP file.
# mkoptions apply-sed-to-template sed-file template-file
-options_handler_get_option.cpp : options_handler_get_option_template.cpp options_handler_get_option_template.cpp.sed mkoptions summary.sed $(OPTIONS_HEADS)
+options_get_option.cpp : options_get_option_template.cpp options_get_option_template.cpp.sed mkoptions summary.sed $(OPTIONS_HEADS)
$(AM_V_at)chmod +x @srcdir@/mkoptions
$(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \
- @srcdir@/options_handler_get_option_template.cpp \
- @builddir@/options_handler_get_option_template.cpp.sed \
+ @srcdir@/options_get_option_template.cpp \
+ @builddir@/options_get_option_template.cpp.sed \
summary.sed \
) > "$@"
-options_handler_set_option.cpp : options_handler_set_option_template.cpp options_handler_set_option_template.cpp.sed mkoptions summary.sed $(OPTIONS_HEADS)
+options_set_option.cpp : options_set_option_template.cpp options_set_option_template.cpp.sed mkoptions summary.sed $(OPTIONS_HEADS)
$(AM_V_at)chmod +x @srcdir@/mkoptions
$(AM_V_GEN)(@srcdir@/mkoptions apply-sed-files-to-template \
- @srcdir@/options_handler_set_option_template.cpp \
- @builddir@/options_handler_set_option_template.cpp.sed \
+ @srcdir@/options_set_option_template.cpp \
+ @builddir@/options_set_option_template.cpp.sed \
summary.sed \
) > "$@"
--- /dev/null
+/********************* */
+/*! \file preempt_get_option.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Utility function for parsing commandline options.
+ **
+ ** Utility function for parsing commandline options.
+ **/
+
+#include "options/argument_extender.h"
+
+#include <cstdlib>
+#include <cstring>
+#include <vector>
+
+#include "base/cvc4_assert.h"
+#include "base/output.h"
+
+namespace CVC4 {
+namespace options {
+
+ArgumentExtender::ArgumentExtender(unsigned additional, size_t length)
+ : d_additional(additional)
+ , d_length(length)
+{
+ AlwaysAssert(d_additional >= 1);
+ AlwaysAssert(d_length >= 1);
+}
+
+ArgumentExtender::~ArgumentExtender(){}
+
+unsigned ArgumentExtender::getIncrease() const { return d_additional; }
+size_t ArgumentExtender::getLength() const { return d_length; }
+
+void ArgumentExtender::extend(int& argc, char**& argv, const char* opt,
+ std::vector<char*>& allocated)
+{
+
+ Debug("preemptGetopt") << "preempting getopt() with " << opt << std::endl;
+
+ AlwaysAssert(opt != NULL && *opt != '\0');
+ AlwaysAssert(strlen(opt) <= getLength());
+
+ ++argc;
+ unsigned i = 1;
+ while(argv[i] != NULL && argv[i][0] != '\0') {
+ ++i;
+ }
+
+ if(argv[i] == NULL) {
+ unsigned newSize = i + getIncrease();
+ argv = (char**) realloc(argv, newSize * sizeof(char*));
+ for(unsigned j = i; j < newSize-1; ++j) {
+ char* newString = (char*) malloc(sizeof(char) * getLength());
+ newString[0] = '\0';
+ argv[j] = newString;
+ allocated.push_back(newString);
+ }
+ argv[newSize - 1] = NULL;
+ }
+
+ strncpy(argv[i], opt, getLength() - 1);
+ argv[i][getLength() - 1] = '\0'; // ensure NULL-termination even on overflow
+}
+
+}/* CVC4::options namespace */
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file preempt_get_option.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Utility function for extending commandline options.
+ **
+ ** Utility function for extending commandline options.
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__OPTIONS__PREMPT_GET_OPTION_H
+#define __CVC4__OPTIONS__PREMPT_GET_OPTION_H
+
+#include <cstddef>
+#include <vector>
+
+namespace CVC4 {
+namespace options {
+
+
+class ArgumentExtender {
+ public:
+ /**
+ * Preconditions:
+ * additional >= 1
+ * length >= 1
+ */
+ ArgumentExtender(unsigned additional, size_t length);
+ ~ArgumentExtender();
+
+ /**
+ * This purpose of this function is to massage argc and argv upon the event
+ * of parsing during Options::parseOptions of an option with the :link or
+ * :link-alternative attributes. The purpose of the function is to extend argv
+ * with another commandline argument.
+ *
+ * Preconditions:
+ * opt is '\0' terminated, non-null and non-empty c-string.
+ * strlen(opt) <= getLength()
+ *
+ * Let P be the first position in argv that is >= 1 and is either NULL or
+ * empty:
+ * argv[P] == NULL || argv[P] == '\0'
+ *
+ * This has a very specific set of side effects:
+ * - argc is incremented by one.
+ * - If argv[P] == NULL, this reallocates argv to have (P+additional)
+ * elements.
+ * - The 0 through P-1 elements of argv are the same.
+ * - The P element of argv is a copy of the first len-1 characters of opt.
+ * This is a newly allocated '\0' terminated c string of length len.
+ * - The P+1 through (P+additional-2) elements of argv are newly allocated
+ * empty '\0' terminated c strings of size len.
+ * - The last element at (P+additional-1) of argv is NULL.
+ * - All allocations are pushed back onto allocated.
+ */
+ void extend(int& argc, char**& argv, const char* opt,
+ std::vector<char*>& allocated);
+
+ unsigned getIncrease() const;
+ size_t getLength() const;
+
+ private:
+ unsigned d_additional;
+ size_t d_length;
+};
+
+}/* CVC4::options namespace */
+}/* CVC4 namespace */
+
+#endif /* __CVC4__OPTIONS__PREMPT_GET_OPTION_H */
module ARITH "options/arith_options.h" Arithmetic theory
-option arithUnateLemmaMode --unate-lemmas=MODE ArithUnateLemmaMode :handler CVC4::options::stringToArithUnateLemmaMode :default ALL_PRESOLVE_LEMMAS :handler-include "options/options_handler_interface.h" :include "options/arith_unate_lemma_mode.h"
+option arithUnateLemmaMode --unate-lemmas=MODE ArithUnateLemmaMode :handler stringToArithUnateLemmaMode :default ALL_PRESOLVE_LEMMAS :include "options/arith_unate_lemma_mode.h"
determines which lemmas to add before solving (default is 'all', see --unate-lemmas=help)
-option arithPropagationMode --arith-prop=MODE ArithPropagationMode :handler CVC4::options::stringToArithPropagationMode :default BOTH_PROP :handler-include "options/options_handler_interface.h" :include "options/arith_propagation_mode.h"
+option arithPropagationMode --arith-prop=MODE ArithPropagationMode :handler stringToArithPropagationMode :default BOTH_PROP :include "options/arith_propagation_mode.h"
turns on arithmetic propagation (default is 'old', see --arith-prop=help)
# The maximum number of difference pivots to do per invocation of simplex.
expert-option arithStandardCheckVarOrderPivots --standard-effort-variable-order-pivots=N int16_t :default -1 :read-write
limits the number of pivots in a single invocation of check() at a non-full effort level using Bland's pivot rule
-option arithErrorSelectionRule --error-selection-rule=RULE ErrorSelectionRule :handler CVC4::options::stringToErrorSelectionRule :default MINIMUM_AMOUNT :handler-include "options/options_handler_interface.h" :include "options/arith_heuristic_pivot_rule.h"
+option arithErrorSelectionRule --error-selection-rule=RULE ErrorSelectionRule :handler stringToErrorSelectionRule :default MINIMUM_AMOUNT :include "options/arith_heuristic_pivot_rule.h"
change the pivot rule for the basic variable (default is 'min', see --pivot-rule help)
# The number of pivots before simplex rechecks every basic variable for a conflict
option arithPropagateMaxLength --prop-row-length=N uint16_t :default 16
sets the maximum row length to be used in propagation
-option arithDioSolver /--disable-dio-solver bool :default true
- turns off Linear Diophantine Equation solver (Griggio, JSAT 2012)
+option arithDioSolver --enable-dio-solver/--disable-dio-solver bool :default true
+ turns on Linear Diophantine Equation solver (Griggio, JSAT 2012)
+/turns off Linear Diophantine Equation solver (Griggio, JSAT 2012)
# Whether to split (= x y) into (and (<= x y) (>= x y)) in
# arithmetic preprocessing.
#include <string>
#include <sstream>
+#include "options/option_exception.h"
+
namespace CVC4 {
namespace options {
comparator(double d) throw() : d_lbound(0), d_dbound(d), d_hasLbound(false) {}
template <class T>
- void operator()(std::string option, const T& value, OptionsHandler* handler) {
+ void operator()(std::string option, const T& value) {
if((d_hasLbound && !(Cmp<T>()(value, T(d_lbound)))) ||
(!d_hasLbound && !(Cmp<T>()(value, T(d_dbound))))) {
std::stringstream ss;
#
# This is essentially a shell script interpreted with special commands.
#
-# Lines starting with whitespace are special. They are passed in their entirety (minus
-# the first whitespace char) to the "doc" command. Lines starting with a single slash
-# are stripped of this initial character and interpreted by the "doc-alt" command. A period
-# "." in the first column of a line, followed optionally by whitespace but without any other
-# content on the line, is interpreted as an empty string passed to doc. (This allows
-# multi-paragraph documentation for options.) Lines may be continued with a backslash (\)
-# at the end of a line.
+# Lines starting with whitespace are special. They are passed in their entirety
+# (minus the first whitespace char) to the "doc" command. Lines starting with a
+# single slash are stripped of this initial character and interpreted by the
+# "doc-alt" command. A period "." in the first column of a line, followed
+# optionally by whitespace but without any other content on the line, is
+# interpreted as an empty string passed to doc. (This allows multi-paragraph
+# documentation for options.) Lines may be continued with a backslash (\) at the
+# end of a line.
#
# commands are:
#
# module ID "include-file" name
#
-# Identifies the module. Must be the first command in the file. ID is a suitable
-# identifier for a preprocessor definition, and should be unique; name is a "pretty"
-# name used for the benefit of the end CVC4 user in, e.g., option listings.
+# Identifies the module. Must be the first command in the file. ID is a
+# suitable identifier for a preprocessor definition, and should be unique;
+# name is a "pretty" name used for the benefit of the end CVC4 user in, e.g.,
+# option listings.
#
# common-option SPECIFICATION
# option SPECIFICATION
# expert-option SPECIFICATION
# undocumented-option SPECIFICATION
#
-# These commands declare (respectively) common options presented first to the user,
-# standard options that the user might want to see with "--help" documentation,
-# expert options that should be marked as expert-only, and options that should not
-# appear in normal option documentation (even if documentation is included here).
+# These commands declare (respectively) common options presented first to the
+# user, standard options that the user might want to see with "--help"
+# documentation, expert options that should be marked as expert-only, and
+# options that should not appear in normal option documentation (even if
+# documentation is included here).
#
# SPECIFICATIONs take this form:
#
# | :default C++-expression
# | :handler custom-option-handlers..
# | :handler-include include-files..
+# | :predicate custom-option-handlers..
+# | :predicate-include include-files..
+# | :notify custom-option-notifications..
# | :read-only
# | :read-write
# | :link linked-options..
+# | :link-smt linked-option [value]
#
# common-alias ALIAS_SPECIFICATION
# alias ALIAS_SPECIFICATION
#
# endmodule
#
-# This file should end with the "endmodule" command, and nothing should follow it.
+# This file should end with the "endmodule" command, and nothing should
+# follow it.
+#
+#
+# The options/ package supports a wide range of operations for responding to
+# an option being set. Roughly the three major concepts are:
+# - :handler is to parse an option before setting its value.
+# - :predicate is to reject bad values for the option.
+# - :notify is used for dynamic dispatch after an option is assigned.
+#
+# More details on each class of custom handlers.
+# :handler custom-option-handler
+# Handlers provide support for parsing custom types and parsing for options.
+# The signature for a handler call is:
+# T custom-option-handler(std::string option, std::string optarg,
+# OptionsHandler* handler);
+# where T is the type of the option. The suggested implementation is to
+# implement custom-handler as a dispatch into a function on handler with the
+# signature:
+# T OptionsHandler::custom-option-handler(std::string option,
+# std::string optarg);
+# The handlers are run before predicates and notifications.
+# Having multiple handlers is considered bad practice and is unsupported.
+# Handlers may have arbitrary side effects, but should call no code
+# inaccessible to liboptions. For side effects that are not required in order
+# to parse the option, using :predicate is recommended. Use :notify to
+# achieve dynamic dispatch outside of base/, lib/, and options/. Memory
+# management done by a handler needs to either be encapsulated by the type
+# and the destructor for the type or should *always* be owned by handler. More
+# elaborate memory management schemes are not currently supported.
+#
+# :predicate custom-predicate
+# Predicates provide support for checking whether or not the value of an
+# is acceptable. Predicates are run after handlers and before notifications.
+# The signature for a predicate call is:
+# void custom-predicate(std::string option, T value,
+# OptionsHandler* handler);
+# where T is the type of the option. The suggested implementation is to
+# implement custom-predicate as a dispatch into a function on handler with the
+# signature:
+# void OptionsHandler::custom-predicate(std::string option, T value);
+# The predicates are run after handlers and before notifications. Multiple
+# predicates may be defined for the same option, but the order they are run
+# is not guaranteed. Predicates may have arbitrary side effects, but should
+# call no code inaccessible to liboptions. Use :notify to
+# achieve dynamic dispatch outside of base/, lib/, and options/.
+# Predicates are expected to reject bad value for the option by throwing an
+# OptionsException.
+#
+# :notify custom-notification
+# This allows for the installation of custom post-processing callbacks using
+# the Listener infrastructure. custom-option-notification is a C++ function
+# that is called after the assignment of the option is updated.
+# The normal usage of an notify is to call a Listener that is registered for
+# this specific option. This is how dynamic dispatch outside of the
+# liboptions package should always be done.
+# The signature of custom-option-notification should take an option name as
+# well as an OptionsHandler*.
+# void custom-notification(
+# const std::string& option, CVC4::options::OptionsHandler* handler);
+# The name is provided so multiple options can use the same notification
+# implementation.
+# This is called after all handlers and predicates have been run.
+# Formally, this is always placed at the end of either the generated
+# Options::assign or Options::assignBool function for the option.
+# Because of this :notify cannot be used with void type options.
+# Users of this feature should *always* check the code generated in
+# builds/src/options/options.cpp for the correctness of the placement of the
+# generated code. The Listener notify() function is allowed to throw
+# an arbitrary std::exception.
#
module BASE "options/base_options.h" Base
option out std::ostream* :default &std::cout :include <iosfwd>
option err std::ostream* :default &std::cerr :include <iosfwd>
-common-option inputLanguage input-language -L --lang=LANG InputLanguage :handler CVC4::options::stringToInputLanguage :include "options/language.h" :default language::input::LANG_AUTO :read-write
+common-option inputLanguage input-language -L --lang=LANG InputLanguage :handler stringToInputLanguage :include "options/language.h" :default language::input::LANG_AUTO :read-write
force input language (default is "auto"; see --lang help)
-common-option outputLanguage output-language --output-lang=LANG OutputLanguage :handler CVC4::options::stringToOutputLanguage :include "options/language.h" :default language::output::LANG_AUTO :read-write
+common-option outputLanguage output-language --output-lang=LANG OutputLanguage :handler stringToOutputLanguage :include "options/language.h" :default language::output::LANG_AUTO :read-write
force output language (default is "auto"; see --output-lang help)
option languageHelp bool
undocumented-alias --language=L = --lang=L
undocumented-alias --output-language=L = --output-lang=L
-option verbosity verbosity int :read-write :default 0 :predicate CVC4::options::setVerbosity :predicate-include "options/base_handlers.h"
+option verbosity verbosity int :read-write :default 0 :predicate setVerbosity
the verbosity level of CVC4
-common-option - -v --verbose void :handler CVC4::options::increaseVerbosity
+common-option - -v --verbose void :handler increaseVerbosity
increase verbosity (may be repeated)
-common-option - -q --quiet void :handler CVC4::options::decreaseVerbosity
+common-option - -q --quiet void :handler decreaseVerbosity
decrease verbosity (may be repeated)
-common-option statistics statistics --stats bool :predicate CVC4::options::statsEnabledBuild :predicate-include "options/options_handler_interface.h"
+common-option statistics statistics --stats bool :predicate statsEnabledBuild
give statistics on exit
undocumented-alias --statistics = --stats
undocumented-alias --no-statistics = --no-stats
-option statsEveryQuery --stats-every-query bool :default false :link --stats
+option statsEveryQuery --stats-every-query bool :default false :link --stats :link-smt statistics
in incremental mode, print stats after every satisfiability or validity query
undocumented-alias --statistics-every-query = --stats-every-query
undocumented-alias --no-statistics-every-query = --no-stats-every-query
option preprocessOnly preprocess-only --preprocess-only bool
exit after preprocessing input
-option - trace -t --trace=TAG argument :handler CVC4::options::addTraceTag
+option - trace -t --trace=TAG argument :handler addTraceTag
trace something (e.g. -t pushpop), can repeat
-option - debug -d --debug=TAG argument :handler CVC4::options::addDebugTag
+option - debug -d --debug=TAG argument :handler addDebugTag
debug something (e.g. -d arith), can repeat
-option printSuccess print-success --print-success bool :predicate CVC4::options::setPrintSuccess :predicate-include "options/options_handler_interface.h"
+option printSuccess print-success --print-success bool :notify notifyPrintSuccess
print the "success" output required of SMT-LIBv2
alias --smtlib-strict = --lang=smt2 --output-lang=smt2 --strict-parsing --default-expr-depth=-1 --print-success --incremental --abstract-values
module BOOLEANS "options/booleans_options.h" Boolean theory
-option booleanTermConversionMode boolean-term-conversion-mode --boolean-term-conversion-mode=MODE CVC4::theory::booleans::BooleanTermConversionMode :default CVC4::theory::booleans::BOOLEAN_TERM_CONVERT_TO_BITVECTORS :include "options/boolean_term_conversion_mode.h" :handler CVC4::options::stringToBooleanTermConversionMode :handler-include "options/options_handler_interface.h"
+option booleanTermConversionMode boolean-term-conversion-mode --boolean-term-conversion-mode=MODE CVC4::theory::booleans::BooleanTermConversionMode :default CVC4::theory::booleans::BOOLEAN_TERM_CONVERT_TO_BITVECTORS :include "options/boolean_term_conversion_mode.h" :handler stringToBooleanTermConversionMode
policy for converting Boolean terms
endmodule
# Option to set the bit-blasting mode (lazy, eager)
-option bitblastMode bitblast --bitblast=MODE CVC4::theory::bv::BitblastMode :handler CVC4::options::stringToBitblastMode :default CVC4::theory::bv::BITBLAST_MODE_LAZY :read-write :include "options/bv_bitblast_mode.h" :handler-include "options/options_handler_interface.h"
+option bitblastMode bitblast --bitblast=MODE CVC4::theory::bv::BitblastMode :handler stringToBitblastMode :default CVC4::theory::bv::BITBLAST_MODE_LAZY :read-write :include "options/bv_bitblast_mode.h"
choose bitblasting mode, see --bitblast=help
# Options for eager bit-blasting
-option bitvectorAig --bitblast-aig bool :default false :predicate CVC4::options::abcEnabledBuild CVC4::options::setBitblastAig :predicate-include "options/options_handler_interface.h" :read-write
+option bitvectorAig --bitblast-aig bool :default false :predicate abcEnabledBuild setBitblastAig :read-write
bitblast by first converting to AIG (implies --bitblast=eager)
-expert-option bitvectorAigSimplifications --bv-aig-simp=COMMAND std::string :default "" :predicate CVC4::options::abcEnabledBuild :read-write :link --bitblast-aig :link-smt bitblast-aig
+expert-option bitvectorAigSimplifications --bv-aig-simp=COMMAND std::string :default "" :predicate abcEnabledBuild :read-write :link --bitblast-aig :link-smt bitblast-aig
abc command to run AIG simplifications (implies --bitblast-aig, default is "balance;drw")
# Options for lazy bit-blasting
-
option bitvectorPropagate --bv-propagate bool :default true :read-write
use bit-vector propagation in the bit-blaster
-option bitvectorEqualitySolver --bv-eq-solver bool :default true :read-write
+option bitvectorEqualitySolver --bv-eq-solver bool :default true :read-write
use the equality engine for the bit-vector theory (only if --bitblast=lazy)
-option bitvectorEqualitySlicer --bv-eq-slicer=MODE CVC4::theory::bv::BvSlicerMode :handler CVC4::options::stringToBvSlicerMode :default CVC4::theory::bv::BITVECTOR_SLICER_OFF :read-write :include "options/bv_bitblast_mode.h" :handler-include "options/options_handler_interface.h" :read-write :link --bv-eq-solver
+option bitvectorEqualitySlicer --bv-eq-slicer=MODE CVC4::theory::bv::BvSlicerMode :handler stringToBvSlicerMode :default CVC4::theory::bv::BITVECTOR_SLICER_OFF :read-write :include "options/bv_bitblast_mode.h" :read-write :link --bv-eq-solver :link-smt bv-eq-solver
turn on the slicing equality solver for the bit-vector theory (only if --bitblast=lazy)
+
option bitvectorInequalitySolver --bv-inequality-solver bool :default true :read-write
turn on the inequality solver for the bit-vector theory (only if --bitblast=lazy)
-option bitvectorAlgebraicSolver --bv-algebraic-solver bool :default true :read-write
+option bitvectorAlgebraicSolver --bv-algebraic-solver bool :default true :read-write
turn on the algebraic solver for the bit-vector theory (only if --bitblast=lazy)
-expert-option bitvectorAlgebraicBudget --bv-algebraic-budget unsigned :default 1500 :read-write :link --bv-algebraic-solver
+expert-option bitvectorAlgebraicBudget --bv-algebraic-budget unsigned :default 1500 :read-write :link --bv-algebraic-solver :link-smt bv-algebraic-solver
the budget allowed for the algebraic solver in number of SAT conflicts
# General options
module DECISION "options/decision_options.h" Decision heuristics
# When/whether to use any decision strategies
-option decisionMode decision-mode --decision=MODE decision::DecisionMode :handler CVC4::options::stringToDecisionMode :default decision::DECISION_STRATEGY_INTERNAL :read-write :include "options/decision_mode.h" :handler-include "options/options_handler_interface.h"
+option decisionMode decision-mode --decision=MODE decision::DecisionMode :handler stringToDecisionMode :default decision::DECISION_STRATEGY_INTERNAL :read-write :include "options/decision_mode.h"
choose decision mode, see --decision=help
# only use DE to determine when to stop, not to make decisions
expert-option decisionRandomWeight --decision-random-weight=N int :default 0
assign random weights to nodes between 0 and N-1 (0: disable)
-expert-option decisionWeightInternal --decision-weight-internal=HOW decision::DecisionWeightInternal :handler CVC4::options::stringToDecisionWeightInternal :default decision::DECISION_WEIGHT_INTERNAL_OFF :handler-include "options/options_handler_interface.h"
+expert-option decisionWeightInternal --decision-weight-internal=HOW decision::DecisionWeightInternal :handler stringToDecisionWeightInternal :default decision::DECISION_WEIGHT_INTERNAL_OFF
computer weights of internal nodes using children: off, max, sum, usr1 (meaning evolving)
endmodule
module EXPR "options/expr_options.h" Expression package
-option defaultExprDepth --default-expr-depth=N int :default 0 :predicate CVC4::options::setDefaultExprDepth :predicate-include "options/options_handler_interface.h"
+option defaultExprDepth --default-expr-depth=N int :default 0 :predicate setDefaultExprDepthPredicate :notify notifySetDefaultExprDepth
print exprs to depth N (0 == default, -1 == no limit)
undocumented-alias --expr-depth=N = --default-expr-depth=N
-option defaultDagThresh default-dag-thresh --default-dag-thresh=N int :default 1 :predicate CVC4::options::setDefaultDagThresh :predicate-include "options/options_handler_interface.h"
+option defaultDagThresh default-dag-thresh --default-dag-thresh=N int :default 1 :predicate setDefaultDagThreshPredicate :notify notifySetDefaultDagThresh
dagify common subexprs appearing > N times (1 == default, 0 == don't dagify)
undocumented-alias --dag-thresh=N = --default-dag-thresh=N
undocumented-alias --dag-threshold=N = --default-dag-thresh=N
-option - --print-expr-types void :handler CVC4::options::setPrintExprTypes :handler-include "options/options_handler_interface.h"
+option printExprTypes --print-expr-types bool :default false :notify notifySetPrintExprTypes
print types with variables when printing exprs
option earlyTypeChecking --eager-type-checking/--lazy-type-checking bool :default USE_EARLY_TYPE_CHECKING_BY_DEFAULT
# --no-type-checking will override any --early-type-checking or --lazy-type-checking option
# --lazy-type-checking is linked because earlyTypeChecking should be set false too
-option typeChecking /--no-type-checking bool :default DO_SEMANTIC_CHECKS_BY_DEFAULT :link /--lazy-type-checking
+option typeChecking type-checking /--no-type-checking bool :default DO_SEMANTIC_CHECKS_BY_DEFAULT :link /--lazy-type-checking
never type check expressions
option biasedITERemoval --biased-ites bool :default false
+++ /dev/null
-/*! \file logic_info_forward.h
- ** \verbatim
- ** Original author: Tim King
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief A temporary forward delcaration file for LogicInfo.
- **
- ** A temporary forward delcaration file for LogicInfo.
- **/
-
-
-#include "cvc4_public.h"
-
-#ifndef __CVC4__OPTIONS_LOGIC_INFO_FORWARD_H
-#define __CVC4__OPTIONS_LOGIC_INFO_FORWARD_H
-
-namespace CVC4 {
-class LogicInfo;
-}/* CVC4 namespace */
-
-#endif /* __CVC4__OPTIONS_LOGIC_INFO_FORWARD_H */
common-option help -h --help/ bool
full command line reference
-common-option - --show-config void :handler CVC4::options::showConfiguration :handler-include "options/options_handler_interface.h"
+common-option - --show-config void :handler showConfiguration
show CVC4 static configuration
-option - --show-debug-tags void :handler CVC4::options::showDebugTags :handler-include "options/options_handler_interface.h"
+option - --show-debug-tags void :handler showDebugTags
show all available tags for debugging
-option - --show-trace-tags void :handler CVC4::options::showTraceTags :handler-include "options/options_handler_interface.h"
+option - --show-trace-tags void :handler showTraceTags
show all available tags for tracing
expert-option earlyExit --early-exit bool :default true
do not run destructors at exit; default on except in debug builds
# portfolio options
-option threads --threads=N unsigned :default 2 :predicate options::greater(0)
+option threads --threads=N unsigned :default 2 :predicate unsignedGreater0
Total number of threads for portfolio
-option - --threadN=string void :handler CVC4::options::threadN :handler-include "options/options_handler_interface.h"
+option - --threadN=string void :handler threadN
configures portfolio thread N (0..#threads-1)
option threadStackSize --thread-stack=N unsigned :default 0
stack size for worker threads in MB (0 means use Boost/thread lib default)
don't share (among portfolio threads) lemmas strictly longer than N
option fallbackSequential --fallback-sequential bool :default false
Switch to sequential mode (instead of printing an error) if it can't be solved in portfolio mode
-option incrementalParallel --incremental-parallel bool :default false :link --incremental
+option incrementalParallel --incremental-parallel bool :default false :link --incremental :link-smt incremental
Use parallel solver even in incremental mode (may print 'unknown's at times)
option interactive : --interactive bool :read-write
force interactive/non-interactive mode
-undocumented-option interactivePrompt /--no-interactive-prompt bool :default true
- turn off interactive prompting while in interactive mode
+undocumented-option interactivePrompt --interactive-prompt bool :default true
+ interactive prompting while in interactive mode
# error behaviors (--immediate-exit is default in cases we support, thus no options)
-option continuedExecution --continued-execution/ bool :default false :link "--interactive --no-interactive-prompt"/
+option continuedExecution --continued-execution/ bool :default false :link "--interactive --no-interactive-prompt"/ :link-smt interactive :link-smt interactivePrompt \"false\"
continue executing commands, even on error
option segvSpin --segv-spin bool :default false
long_option_alternate_set=
type=
predicates=
+notifications=
# just for duplicates-checking
all_declared_internal_options=
default_value=
handlers=
predicates=
+ notifications=
links=
links_alternate=
smt_links=
predicates="${predicates} ${args[$i]}"
done
;;
+ :notify)
+ while [ $(($i+1)) -lt ${#args[@]} ] && ! expr "${args[$(($i+1))]}" : '\:' &>/dev/null; do
+ let ++i
+ notifications="${notifications} ${args[$i]}"
+ done
+ ;;
:link)
while [ $(($i+1)) -lt ${#args[@]} ] && ! expr "${args[$(($i+1))]}" : '\:' &>/dev/null; do
let ++i
if [ "$type" = bool ]; then
module_specializations="${module_specializations}
#line $lineno \"$kf\"
-template <> void Options::assignBool(options::${internal}__option_t, std::string option, bool value, options::OptionsHandler* handler);"
+template <> void Options::assignBool(options::${internal}__option_t, std::string option, bool value);"
elif [ "$internal" != - ]; then
module_specializations="${module_specializations}
#line $lineno \"$kf\"
-template <> void Options::assign(options::${internal}__option_t, std::string option, std::string value, options::OptionsHandler* handler);"
+template <> void Options::assign(options::${internal}__option_t, std::string option, std::string value);"
fi
module_accessors="${module_accessors}
run_links=
run_links_alternate=
run_smt_links=
+ run_notifications=
if [ -n "$links" -a -z "$smt_links" -a -n "$smtname" ]; then
WARN "$smtname has no :link-smt, but equivalent command-line has :link"
elif [ -n "$smt_links" -a -z "$links" ] && [ -n "$short_option" -o -n "$short_option_alternate" -o -n "$long_option" -o "$long_option_alternate" ]; then
for link in $links; do
run_links="$run_links
#line $lineno \"$kf\"
- preemptGetopt(extra_argc, extra_argv, \"$link\");"
+ argumentExtender.extend(extra_argc, extra_argv, \"$link\", allocated);"
done
fi
if [ -n "$smt_links" ]; then
while [ $i -lt ${#smt_links[@]} ]; do
run_smt_links="$run_smt_links
#line $lineno \"$kf\"
- handler->setOption(std::string(\"${smt_links[$i]}\"), (${smt_links[$(($i+1))]}));"
+ setOption(std::string(\"${smt_links[$i]}\"), (${smt_links[$(($i+1))]}));"
i=$((i+2))
done
fi
for link in $links_alternate; do
run_links_alternate="$run_links_alternate
#line $lineno \"$kf\"
- preemptGetopt(extra_argc, extra_argv, \"$link\");"
+ argumentExtender.extend(extra_argc, extra_argv, \"$link\", allocated);"
+ done
+ fi
+ if [ -n "$notifications" ]; then
+ for notification in $notifications; do
+ run_notifications="$run_notifications
+#line $lineno \"$kf\"
+ d_handler->$notification(option);"
done
fi
if [ "$type" = bool ] && [ -n "$cases" -o -n "$cases_alternate" -o -n "$smtname" ]; then
for predicate in $predicates; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $predicate(option, b, handler);"
+ handler->$predicate(option, b);"
done
fi
if [ -n "$run_handlers" ]; then
if [ "$type" = bool ]; then
all_modules_option_handlers="${all_modules_option_handlers}${cases}
#line $lineno \"$kf\"
- assignBool(options::$internal, option, true, handler);$run_links
+ assignBool(options::$internal, option, true);$run_links
break;
"
elif [ -n "$expect_arg" -a "$internal" != - ]; then
for handler in $handlers; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $handler(option, optionarg, handler);"
+ handler->$handler(option, optionarg);"
done
else
run_handlers="
for predicate in $predicates; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $predicate(option, retval, handler);"
+ handler->$predicate(option, retval);"
done
fi
all_custom_handlers="${all_custom_handlers}
}"
all_modules_option_handlers="${all_modules_option_handlers}${cases}
#line $lineno \"$kf\"
- assign(options::$internal, option, optionarg, handler);$run_links
+ assign(options::$internal, option, optionarg);$run_links
break;
"
elif [ -n "$expect_arg" ]; then
for handler in $handlers; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $handler(option, optionarg, handler);"
+ handler->$handler(option, optionarg);"
done
fi
all_modules_option_handlers="${all_modules_option_handlers}${cases}
for handler in $handlers; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $handler(option, handler);"
+ handler->$handler(option);"
done
fi
all_modules_option_handlers="${all_modules_option_handlers}${cases}
break;
"
fi
- fi
+ fi # ends if [ -n "$cases" ];
if [ -n "$cases_alternate" ]; then
if [ "$type" = bool ]; then
all_modules_option_handlers="${all_modules_option_handlers}${cases_alternate}
#line $lineno \"$kf\"
- assignBool(options::$internal, option, false, handler);$run_links_alternate
+ assignBool(options::$internal, option, false);$run_links_alternate
break;
"
else
#line $lineno \"$kf\"
if(key == \"$smtname\") {
#line $lineno \"$kf\"
- Options::current()->assignBool(options::$internal, \"$smtname\", optionarg == \"true\", handler);$run_smt_links
+ Options::current()->assignBool(options::$internal, \"$smtname\", optionarg == \"true\");$run_smt_links
return;
}"
elif [ -n "$expect_arg" -a "$internal" != - ]; then
for handler in $handlers; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $handler(\"$smtname\", optionarg, handler);
+ handler->$handler(\"$smtname\", optionarg);
"
done
fi
#line $lineno \"$kf\"
if(key == \"$smtname\") {
#line $lineno \"$kf\"
- Options::current()->assign(options::$internal, \"$smtname\", optionarg, handler);$run_smt_links
+ Options::current()->assign(options::$internal, \"$smtname\", optionarg);$run_smt_links
return;
}"
elif [ -n "$expect_arg" ]; then
for handler in $handlers; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $handler(\"$smtname\", optionarg, handler);
+ handler->$handler(\"$smtname\", optionarg);
"
done
smt_setoption_handlers="${smt_setoption_handlers}
for handler in $handlers; do
run_handlers="$run_handlers
#line $lineno \"$kf\"
- $handler(\"$smtname\", handler);
+ handler->$handler(\"$smtname\");
"
done
smt_setoption_handlers="${smt_setoption_handlers}
# emit assignBool/assign
all_custom_handlers="${all_custom_handlers}
#line $lineno \"$kf\"
-template <> void Options::assignBool(options::${internal}__option_t, std::string option, bool value, options::OptionsHandler* handler) {
+template <> void Options::assignBool(options::${internal}__option_t, std::string option, bool value) {
#line $lineno \"$kf\"
- runBoolPredicates(options::$internal, option, value, handler);
+ runBoolPredicates(options::$internal, option, value, d_handler);
#line $lineno \"$kf\"
d_holder->$internal = value;
#line $lineno \"$kf\"
d_holder->${internal}__setByUser__ = true;
#line $lineno \"$kf\"
- Trace(\"options\") << \"user assigned option $internal\" << std::endl;
+ Trace(\"options\") << \"user assigned option $internal\" << std::endl;$run_notifications
}"
elif [ -n "$expect_arg" -a "$internal" != - ] && [ -n "$cases" -o -n "$cases_alternate" -o -n "$smtname" ]; then
all_custom_handlers="${all_custom_handlers}
#line $lineno \"$kf\"
-template <> void Options::assign(options::${internal}__option_t, std::string option, std::string value, options::OptionsHandler* handler) {
+template <> void Options::assign(options::${internal}__option_t, std::string option, std::string value) {
#line $lineno \"$kf\"
- d_holder->$internal = runHandlerAndPredicates(options::$internal, option, value, handler);
+ d_holder->$internal = runHandlerAndPredicates(options::$internal, option, value, d_handler);
#line $lineno \"$kf\"
d_holder->${internal}__setByUser__ = true;
#line $lineno \"$kf\"
- Trace(\"options\") << \"user assigned option $internal\" << std::endl;
+ Trace(\"options\") << \"user assigned option $internal\" << std::endl;$run_notifications
}"
fi
}
readOnly=true
required_argument=false
default_value=
- handlers=
- predicates=
links=
links_alternate=
fi
links="$links
#line $lineno \"$kf\"
- preemptGetopt(extra_argc, extra_argv, \"$linkopt\");"
+ argumentExtender.extend(extra_argc, extra_argv, \"$linkopt\", allocated);"
if [ "$linkarg" ]; then
# include also the arg
links="$links
#line $lineno \"$kf\"
- preemptGetopt(extra_argc, extra_argv, optionarg.c_str());"
+ argumentExtender.extend(extra_argc, extra_argv, optionarg.c_str(), allocated);"
fi
shift
done
+++ /dev/null
-#!/bin/bash
-#
-# mktagheaders
-#
-# The purpose of this script is to generate the *_tag.h header file from the
-# *_tags file.
-#
-# Invocation:
-#
-# mktagheaders <tag-name> <tag-file>
-#
-# <tag-name> will be the name of the generated array.
-# <tag-file> each line of this file is turned into a string in the generated
-# array.
-
-TAG_NAME=$1
-TAG_FILE=$2
-
-echo 'static char const* const '$TAG_NAME'[] = {';
-for tag in `cat $TAG_FILE`; do
- echo "\"$tag\",";
-done;
-echo 'NULL';
-echo '};'
+++ /dev/null
-#!/bin/bash
-#
-# mktags
-#
-# The purpose of this script is to create Debug_tags and Trace_tags files.
-# Note that in the Makefile workflow these are first stored in a *_tags.tmp
-# file. This file contains a list of all of the strings that occur in things
-# like Debug("foo") or Debug.isOn("bar") in a given directory. The list is
-# seperated by newlines. The expected Debug_tags file for the previous two
-# tags would be:
-# bar
-# foo
-#
-# Invocation:
-#
-# mktags {Debug,Trace} <input-files>
-#
-# <input-files> is expected to be passed a single space separated list of files.
-# One can use quotes to achieve this. This is one reason to use "$(...)"
-# instead of back ticks `...`.
-
-DebugOrTrace=$1
-InputFiles=$2
-
-grep -h '\<'$DebugOrTrace'\(\.isOn\)* *( *\".*\" *)' \
- $InputFiles | \
- sed 's/\/\/.*//;s/^'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]'$DebugOrTrace'\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | \
- LC_ALL=C sort | \
- uniq
-
-
-# Reference copy of what this is replacing.
-# grep -h '\<$(@:_tags.tmp=)\(\.isOn\)* *( *\".*\" *)' \
-# `find @srcdir@/../ -name "*.cpp" -o -name "*.h" -o -name "*.cc" -o -name "*.g"` | \
-# sed 's/\/\/.*//;s/^$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/;s/.*[^a-zA-Z0-9_]$(@:_tags.tmp=)\(\.isOn\)* *( *\"\([^"]*\)\".*/\2/' | LC_ALL=C sort | uniq
--- /dev/null
+/********************* */
+/*! \file open_ostream.cpp
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief [[ Add one-line brief description here ]]
+ **
+ ** [[ Add lengthier description here ]]
+ ** \todo document this file
+ **/
+
+#include "options/open_ostream.h"
+
+
+#include <cerrno>
+#include <iostream>
+#include <ostream>
+#include <sstream>
+#include <string>
+#include <utility>
+
+#include "lib/strtok_r.h"
+#include "options/parser_options.h"
+
+namespace CVC4 {
+
+OstreamOpener::OstreamOpener(const char* channelName)
+ : d_channelName(channelName)
+ , d_specialCases()
+{}
+
+void OstreamOpener::addSpecialCase(const std::string& name, std::ostream* out){
+ d_specialCases[name] = out;
+}
+
+
+
+std::pair< bool, std::ostream* > OstreamOpener::open(const std::string& optarg) const
+ throw(OptionException)
+{
+ if(optarg == "") {
+ std::stringstream ss;
+ ss << "Bad file name setting for " << d_channelName;
+ throw OptionException(ss.str());
+ }
+ if(d_specialCases.find(optarg) != d_specialCases.end()){
+ return std::make_pair(false, (*d_specialCases.find(optarg)).second);
+ } else if(!options::filesystemAccess()) {
+ throw OptionException(std::string("Filesystem access not permitted"));
+ } else {
+ errno = 0;
+ std::ostream* outStream;
+ outStream = new std::ofstream(optarg.c_str(),
+ std::ofstream::out | std::ofstream::trunc);
+ if(outStream == NULL || !*outStream) {
+ std::stringstream ss;
+ ss << "Cannot open " << d_channelName << " file: `"
+ << optarg << "': " << cvc4_errno_failreason();
+ throw OptionException(ss.str());
+ }
+ return make_pair(true, outStream);
+ }
+}
+
+std::string cvc4_errno_failreason() {
+#if HAVE_STRERROR_R
+#if STRERROR_R_CHAR_P
+ if(errno != 0) {
+ // GNU version of strerror_r: *might* use the given buffer,
+ // or might not. It returns a pointer to buf, or not.
+ char buf[80];
+ return std::string(strerror_r(errno, buf, sizeof buf));
+ } else {
+ return "unknown reason";
+ }
+#else /* STRERROR_R_CHAR_P */
+ if(errno != 0) {
+ // XSI version of strerror_r: always uses the given buffer.
+ // Returns an error code.
+ char buf[80];
+ if(strerror_r(errno, buf, sizeof buf) == 0) {
+ return std::string(buf);
+ } else {
+ // some error occurred while getting the error string
+ return "unknown reason";
+ }
+ } else {
+ return "unknown reason";
+ }
+#endif /* STRERROR_R_CHAR_P */
+#else /* HAVE_STRERROR_R */
+ return "unknown reason";
+#endif /* HAVE_STRERROR_R */
+}
+
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file open_stream.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2016 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief [[ Add one-line brief description here ]]
+ **
+ ** [[ Add lengthier description here ]]
+ ** \todo document this file
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__OPEN_OSTREAM_H
+#define __CVC4__OPEN_OSTREAM_H
+
+#include <map>
+#include <ostream>
+#include <string>
+#include <utility>
+
+#include "options/option_exception.h"
+
+namespace CVC4 {
+
+class OstreamOpener {
+ public:
+ OstreamOpener(const char* channelName);
+
+ void addSpecialCase(const std::string& name, std::ostream* out);
+
+ /**
+ * If name == "", this throws OptionException with the message, messageIfEmpty.
+ * If name is a special case, this return <false, out> where out is the
+ * special case that was added.
+ * If name == "std::cerr", this return <false, &cerr>.
+ * If none of the previous conditions hold and !options::filesystemAccess(),
+ * this throws an OptionException.
+ * Otherwise, this attempts to open a ofstream using the filename, name.
+ * If this fails, this throws and OptionException. If this succeeds, this
+ * returns <true, stream> where stream is a ostream allocated by new.
+ * The caller is in this case the owner of the allocated memory.
+ */
+ std::pair<bool, std::ostream*> open(const std::string& name) const
+ throw(OptionException);
+
+ private:
+ const char* d_channelName;
+ std::map< std::string, std::ostream* > d_specialCases;
+
+}; /* class OstreamOpener */
+
+std::string cvc4_errno_failreason();
+
+}/* CVC4 namespace */
+
+#endif /* __CVC4__OPEN_OSTREAM_H */
#ifndef __CVC4__OPTIONS__OPTIONS_H
#define __CVC4__OPTIONS__OPTIONS_H
-#include <iostream>
#include <fstream>
+#include <ostream>
#include <string>
#include <vector>
+#include "base/listener.h"
+#include "base/modal_exception.h"
#include "base/tls.h"
+#include "options/language.h"
+#include "options/printer_modes.h"
#include "options/option_exception.h"
namespace CVC4 {
/** The struct that holds all option values. */
options::OptionsHolder* d_holder;
+ /** The handler for the options of the theory. */
+ options::OptionsHandler* d_handler;
+
/** The current Options in effect */
static CVC4_THREADLOCAL(Options*) s_current;
+ /** Listeners for options::forceLogicString being set. */
+ ListenerCollection d_forceLogicListeners;
+
+ /** Listeners for notifyBeforeSearch. */
+ ListenerCollection d_beforeSearchListeners;
+
+ /** Listeners for options::tlimit. */
+ ListenerCollection d_tlimitListeners;
+
+ /** Listeners for options::tlimit-per. */
+ ListenerCollection d_tlimitPerListeners;
+
+ /** Listeners for options::rlimit. */
+ ListenerCollection d_rlimitListeners;
+
+ /** Listeners for options::tlimit-per. */
+ ListenerCollection d_rlimitPerListeners;
+
+ /** Listeners for options::useTheoryList. */
+ ListenerCollection d_useTheoryListListeners;
+
+ /** Listeners for options::defaultExprDepth. */
+ ListenerCollection d_setDefaultExprDepthListeners;
+
+ /** Listeners for options::defaultDagThresh. */
+ ListenerCollection d_setDefaultDagThreshListeners;
+
+ /** Listeners for options::printExprTypes. */
+ ListenerCollection d_setPrintExprTypesListeners;
+
+ /** Listeners for options::dumpModeString. */
+ ListenerCollection d_setDumpModeListeners;
+
+ /** Listeners for options::printSuccess. */
+ ListenerCollection d_setPrintSuccessListeners;
+
+ /** Listeners for options::dumpToFileName. */
+ ListenerCollection d_dumpToFileListeners;
+
+ /** Listeners for options::regularChannelName. */
+ ListenerCollection d_setRegularChannelListeners;
+
+ /** Listeners for options::diagnosticChannelName. */
+ ListenerCollection d_setDiagnosticChannelListeners;
+
+ /** Listeners for options::replayFilename. */
+ ListenerCollection d_setReplayFilenameListeners;
+
+
+ static ListenerCollection::Registration* registerAndNotify(
+ ListenerCollection& collection, Listener* listener, bool notify);
+
/** Low-level assignment function for options */
template <class T>
- void assign(T, std::string option, std::string value, options::OptionsHandler* handler);
+ void assign(T, std::string option, std::string value);
/** Low-level assignment function for bool-valued options */
template <class T>
- void assignBool(T, std::string option, bool value, options::OptionsHandler* handler);
+ void assignBool(T, std::string option, bool value);
friend class options::OptionsHandler;
+ /**
+ * Options cannot be copied as they are given an explicit list of
+ * Listeners to respond to.
+ */
+ Options(const Options& options) CVC4_UNDEFINED;
+
+ /**
+ * Options cannot be assigned as they are given an explicit list of
+ * Listeners to respond to.
+ */
+ Options& operator=(const Options& options) CVC4_UNDEFINED;
+
+ static std::string formatThreadOptionException(const std::string& option);
+
+ static const size_t s_maxoptlen = 128;
+ static const unsigned s_preemptAdditional = 6;
+
public:
class CVC4_PUBLIC OptionsScope {
private:
}
Options();
- Options(const Options& options);
~Options();
- Options& operator=(const Options& options);
+ /**
+ * Copies the value of the options stored in OptionsHolder into the current
+ * Options object.
+ * This does not copy the listeners in the Options object.
+ */
+ void copyValues(const Options& options);
/**
* Set the value of the given option. Use of this default
T::you_are_trying_to_assign_to_a_read_only_option;
}
+ /**
+ * Set the value of the given option by key.
+ */
+ void setOption(const std::string& key, const std::string& optionarg)
+ throw(OptionException, ModalException);
+
+
/** Get the value of the given option. Const access only. */
template <class T>
const typename T::type& operator[](T) const;
+ /**
+ * Gets the value of the given option by key and returns value as a string.
+ */
+ std::string getOption(const std::string& key) const
+ throw(OptionException);
+
+ // Get accessor functions.
+ InputLanguage getInputLanguage() const;
+ InstFormatMode getInstFormatMode() const;
+ OutputLanguage getOutputLanguage() const;
+ bool getCheckProofs() const;
+ bool getContinuedExecution() const;
+ bool getDumpInstantiations() const;
+ bool getDumpModels() const;
+ bool getDumpProofs() const;
+ bool getDumpSynth() const;
+ bool getDumpUnsatCores() const;
+ bool getEarlyExit() const;
+ bool getFallbackSequential() const;
+ bool getFilesystemAccess() const;
+ bool getForceNoLimitCpuWhileDump() const;
+ bool getHelp() const;
+ bool getIncrementalParallel() const;
+ bool getIncrementalSolving() const;
+ bool getInteractive() const;
+ bool getInteractivePrompt() const;
+ bool getLanguageHelp() const;
+ bool getMemoryMap() const;
+ bool getParseOnly() const;
+ bool getProduceModels() const;
+ bool getProof() const;
+ bool getSegvSpin() const;
+ bool getSemanticChecks() const;
+ bool getStatistics() const;
+ bool getStatsEveryQuery() const;
+ bool getStatsHideZeros() const;
+ bool getStrictParsing() const;
+ bool getTearDownIncremental() const;
+ bool getVersion() const;
+ bool getWaitToJoin() const;
+ const std::string& getForceLogicString() const;
+ const std::vector<std::string>& getThreadArgv() const;
+ int getSharingFilterByLength() const;
+ int getThreadId() const;
+ int getVerbosity() const;
+ std::istream* getIn() const;
+ std::ostream* getErr();
+ std::ostream* getOut();
+ std::ostream* getOutConst() const; // TODO: Remove this.
+ std::string getBinaryName() const;
+ std::string getReplayInputFilename() const;
+ unsigned getParseStep() const;
+ unsigned getThreadStackSize() const;
+ unsigned getThreads() const;
+
+
+ // TODO: Document these.
+ void setCeGuidedInst(bool);
+ void setDumpSynth(bool);
+ void setInputLanguage(InputLanguage);
+ void setInteractive(bool);
+ void setOut(std::ostream*);
+ void setOutputLanguage(OutputLanguage);
+ void setSharingFilterByLength(int length);
+ void setThreadId(int);
+
+ bool wasSetByUserCeGuidedInst() const;
+ bool wasSetByUserDumpSynth() const;
+ bool wasSetByUserEarlyExit() const;
+ bool wasSetByUserForceLogicString() const;
+ bool wasSetByUserIncrementalSolving() const;
+ bool wasSetByUserInteractive() const;
+ bool wasSetByUserThreadStackSize() const;
+ bool wasSetByUserThreads() const;
+
+ // Static accessor functions.
+ // TODO: Document these.
+ static int currentGetSharingFilterByLength();
+ static int currentGetThreadId();
+ static std::ostream* currentGetOut();
+
/**
* Returns true iff the value of the given option was set
* by the user via a command-line option or SmtEngine::setOption().
* The return value is what's left of the command line (that is, the
* non-option arguments).
*/
- std::vector<std::string> parseOptions(int argc, char* argv[], options::OptionsHandler* handler) throw(OptionException);
+ std::vector<std::string> parseOptions(int argc, char* argv[])
+ throw(OptionException);
/**
* Get the setting for all options.
*/
std::vector< std::vector<std::string> > getOptions() const throw();
+
+ /**
+ * Registers a listener for the notification, notifyBeforeSearch.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ *
+ * This has multiple usages so having a notifyIfSet flag does not add
+ * clarity. Users should check the relevant flags before registering this.
+ */
+ ListenerCollection::Registration* registerBeforeSearchListener(
+ Listener* listener);
+
+
+ /**
+ * Registers a listener for options::forceLogic being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerForceLogicListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::tlimit being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerTlimitListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::tlimit-per being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerTlimitPerListener(
+ Listener* listener, bool notifyIfSet);
+
+
+ /**
+ * Registers a listener for options::rlimit being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerRlimitListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::rlimit-per being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerRlimitPerListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::useTheoryList being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerUseTheoryListListener(
+ Listener* listener, bool notifyIfSet);
+
+
+ /**
+ * Registers a listener for options::defaultExprDepth being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetDefaultExprDepthListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::defaultDagThresh being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetDefaultExprDagListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::printExprTypes being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetPrintExprTypesListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::dumpModeString being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetDumpModeListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::printSuccess being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetPrintSuccessListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::dumpToFileName being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerDumpToFileNameListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::regularChannelName being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetRegularOutputChannelListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::diagnosticChannelName being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetDiagnosticOutputChannelListener(
+ Listener* listener, bool notifyIfSet);
+
+ /**
+ * Registers a listener for options::replayLogFilename being set.
+ *
+ * If notifyIfSet is true, this calls notify on the listener
+ * if the option was set by the user.
+ *
+ * The memory for the Registration is controlled by the user and must
+ * be destroyed before the Options object is.
+ */
+ ListenerCollection::Registration* registerSetReplayLogFilename(
+ Listener* listener, bool notifyIfSet);
+
+ /** Sends a std::flush to getErr(). */
+ void flushErr();
+
+ /** Sends a std::flush to getOut(). */
+ void flushOut();
+
};/* class Options */
}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file option_handler_get_option_template.cpp
+ ** \verbatim
+ ** Original author: Morgan Deters
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Implementation of OptionsHandler::getOption.
+ **
+ ** This template file is expanded into the cpp implementation of
+ ** OptionsHandler::setOption. The file is essentially the contents
+ ** of the ${smt_getoption_handlers} variable in the options/mkoptions
+ ** script. This variable depends on all options files. To generate this file,
+ ** first generate options/summary.sed.
+ **/
+
+#include <iomanip>
+#include <string>
+#include <sstream>
+
+
+#include "base/output.h"
+#include "base/modal_exception.h"
+#include "options/option_exception.h"
+#include "options/options.h"
+#include "options/options_handler.h"
+
+
+${include_all_option_headers}
+${option_handler_includes}
+
+#line 37 "${template}"
+
+using namespace std;
+
+namespace CVC4 {
+
+std::string Options::getOption(const std::string& key) const
+ throw(OptionException) {
+ Trace("options") << "SMT getOption(" << key << ")" << endl;
+
+ ${smt_getoption_handlers}
+
+#line 49 "${template}"
+
+ throw UnrecognizedOptionException(key);
+}
+
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file options_handler.cpp
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Interface for custom handlers and predicates options.
+ **
+ ** Interface for custom handlers and predicates options.
+ **/
+
+#include "options/options_handler.h"
+
+#include <ostream>
+#include <string>
+#include <cerrno>
+
+#include "cvc4autoconfig.h"
+
+#include "base/configuration.h"
+#include "base/cvc4_assert.h"
+#include "base/exception.h"
+#include "base/modal_exception.h"
+#include "base/output.h"
+#include "lib/strtok_r.h"
+#include "options/arith_heuristic_pivot_rule.h"
+#include "options/arith_propagation_mode.h"
+#include "options/arith_unate_lemma_mode.h"
+#include "options/base_options.h"
+#include "options/boolean_term_conversion_mode.h"
+#include "options/bv_bitblast_mode.h"
+#include "options/bv_options.h"
+#include "options/decision_mode.h"
+#include "options/decision_options.h"
+#include "options/didyoumean.h"
+#include "options/language.h"
+#include "options/option_exception.h"
+#include "options/printer_modes.h"
+#include "options/quantifiers_modes.h"
+#include "options/simplification_mode.h"
+#include "options/smt_options.h"
+#include "options/theory_options.h"
+#include "options/theoryof_mode.h"
+#include "options/ufss_mode.h"
+
+namespace CVC4 {
+namespace options {
+
+OptionsHandler::OptionsHandler(Options* options) : d_options(options) { }
+
+void OptionsHandler::notifyForceLogic(const std::string& option){
+ d_options->d_forceLogicListeners.notify();
+}
+
+void OptionsHandler::notifyBeforeSearch(const std::string& option)
+ throw(ModalException)
+{
+ try{
+ d_options->d_beforeSearchListeners.notify();
+ } catch (ModalException&){
+ std::stringstream ss;
+ ss << "cannot change option `" << option
+ << "' after final initialization (i.e., after logic has been set)";
+ throw ModalException(ss.str());
+ }
+}
+
+
+void OptionsHandler::notifyTlimit(const std::string& option) {
+ d_options->d_tlimitListeners.notify();
+}
+
+void OptionsHandler::notifyTlimitPer(const std::string& option) {
+ d_options->d_tlimitPerListeners.notify();
+}
+
+void OptionsHandler::notifyRlimit(const std::string& option) {
+ d_options->d_rlimitListeners.notify();
+}
+
+void OptionsHandler::notifyRlimitPer(const std::string& option) {
+ d_options->d_rlimitPerListeners.notify();
+}
+
+
+unsigned long OptionsHandler::tlimitHandler(std::string option, std::string optarg) throw(OptionException) {
+ unsigned long ms;
+ std::istringstream convert(optarg);
+ if (!(convert >> ms)) {
+ throw OptionException("option `"+option+"` requires a number as an argument");
+ }
+ return ms;
+}
+
+unsigned long OptionsHandler::tlimitPerHandler(std::string option, std::string optarg) throw(OptionException) {
+ unsigned long ms;
+
+ std::istringstream convert(optarg);
+ if (!(convert >> ms)) {
+ throw OptionException("option `"+option+"` requires a number as an argument");
+ }
+ return ms;
+}
+
+unsigned long OptionsHandler::rlimitHandler(std::string option, std::string optarg) throw(OptionException) {
+ unsigned long ms;
+
+ std::istringstream convert(optarg);
+ if (!(convert >> ms)) {
+ throw OptionException("option `"+option+"` requires a number as an argument");
+ }
+ return ms;
+}
+
+
+unsigned long OptionsHandler::rlimitPerHandler(std::string option, std::string optarg) throw(OptionException) {
+ unsigned long ms;
+
+ std::istringstream convert(optarg);
+ if (!(convert >> ms)) {
+ throw OptionException("option `"+option+"` requires a number as an argument");
+ }
+
+ return ms;
+}
+
+
+/* options/base_options_handlers.h */
+void OptionsHandler::notifyPrintSuccess(std::string option) {
+ d_options->d_setPrintSuccessListeners.notify();
+}
+
+// theory/arith/options_handlers.h
+const std::string OptionsHandler::s_arithUnateLemmasHelp = "\
+Unate lemmas are generated before SAT search begins using the relationship\n\
+of constant terms and polynomials.\n\
+Modes currently supported by the --unate-lemmas option:\n\
++ none \n\
++ ineqs \n\
+ Outputs lemmas of the general form (<= p c) implies (<= p d) for c < d.\n\
++ eqs \n\
+ Outputs lemmas of the general forms\n\
+ (= p c) implies (<= p d) for c < d, or\n\
+ (= p c) implies (not (= p d)) for c != d.\n\
++ all \n\
+ A combination of inequalities and equalities.\n\
+";
+
+const std::string OptionsHandler::s_arithPropagationModeHelp = "\
+This decides on kind of propagation arithmetic attempts to do during the search.\n\
++ none\n\
++ unate\n\
+ use constraints to do unate propagation\n\
++ bi (Bounds Inference)\n\
+ infers bounds on basic variables using the upper and lower bounds of the\n\
+ non-basic variables in the tableau.\n\
++both\n\
+";
+
+const std::string OptionsHandler::s_errorSelectionRulesHelp = "\
+This decides on the rule used by simplex during heuristic rounds\n\
+for deciding the next basic variable to select.\n\
+Heuristic pivot rules available:\n\
++min\n\
+ The minimum abs() value of the variable's violation of its bound. (default)\n\
++max\n\
+ The maximum violation the bound\n\
++varord\n\
+ The variable order\n\
+";
+
+ArithUnateLemmaMode OptionsHandler::stringToArithUnateLemmaMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "all") {
+ return ALL_PRESOLVE_LEMMAS;
+ } else if(optarg == "none") {
+ return NO_PRESOLVE_LEMMAS;
+ } else if(optarg == "ineqs") {
+ return INEQUALITY_PRESOLVE_LEMMAS;
+ } else if(optarg == "eqs") {
+ return EQUALITY_PRESOLVE_LEMMAS;
+ } else if(optarg == "help") {
+ puts(s_arithUnateLemmasHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --unate-lemmas: `") +
+ optarg + "'. Try --unate-lemmas help.");
+ }
+}
+
+ArithPropagationMode OptionsHandler::stringToArithPropagationMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "none") {
+ return NO_PROP;
+ } else if(optarg == "unate") {
+ return UNATE_PROP;
+ } else if(optarg == "bi") {
+ return BOUND_INFERENCE_PROP;
+ } else if(optarg == "both") {
+ return BOTH_PROP;
+ } else if(optarg == "help") {
+ puts(s_arithPropagationModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --arith-prop: `") +
+ optarg + "'. Try --arith-prop help.");
+ }
+}
+
+ErrorSelectionRule OptionsHandler::stringToErrorSelectionRule(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "min") {
+ return MINIMUM_AMOUNT;
+ } else if(optarg == "varord") {
+ return VAR_ORDER;
+ } else if(optarg == "max") {
+ return MAXIMUM_AMOUNT;
+ } else if(optarg == "help") {
+ puts(s_errorSelectionRulesHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --heuristic-pivot-rule: `") +
+ optarg + "'. Try --heuristic-pivot-rule help.");
+ }
+}
+// theory/quantifiers/options_handlers.h
+
+const std::string OptionsHandler::s_instWhenHelp = "\
+Modes currently supported by the --inst-when option:\n\
+\n\
+full-last-call (default)\n\
++ Alternate running instantiation rounds at full effort and last\n\
+ call. In other words, interleave instantiation and theory combination.\n\
+\n\
+full\n\
++ Run instantiation round at full effort, before theory combination.\n\
+\n\
+full-delay \n\
++ Run instantiation round at full effort, before theory combination, after\n\
+ all other theories have finished.\n\
+\n\
+full-delay-last-call \n\
++ Alternate running instantiation rounds at full effort after all other\n\
+ theories have finished, and last call. \n\
+\n\
+last-call\n\
++ Run instantiation at last call effort, after theory combination and\n\
+ and theories report sat.\n\
+\n\
+";
+
+const std::string OptionsHandler::s_literalMatchHelp = "\
+Literal match modes currently supported by the --literal-match option:\n\
+\n\
+none (default)\n\
++ Do not use literal matching.\n\
+\n\
+predicate\n\
++ Consider the phase requirements of predicate literals when applying heuristic\n\
+ quantifier instantiation. For example, the trigger P( x ) in the quantified \n\
+ formula forall( x ). ( P( x ) V ~Q( x ) ) will only be matched with ground\n\
+ terms P( t ) where P( t ) is in the equivalence class of false, and likewise\n\
+ Q( x ) with Q( s ) where Q( s ) is in the equivalence class of true.\n\
+\n\
+";
+
+const std::string OptionsHandler::s_mbqiModeHelp = "\
+Model-based quantifier instantiation modes currently supported by the --mbqi option:\n\
+\n\
+default \n\
++ Use algorithm from Section 5.4.2 of thesis Finite Model Finding in Satisfiability \n\
+ Modulo Theories.\n\
+\n\
+none \n\
++ Disable model-based quantifier instantiation.\n\
+\n\
+gen-ev \n\
++ Use model-based quantifier instantiation algorithm from CADE 24 finite\n\
+ model finding paper based on generalizing evaluations.\n\
+\n\
+fmc-interval \n\
++ Same as default, but with intervals for models of integer functions.\n\
+\n\
+abs \n\
++ Use abstract MBQI algorithm (uses disjoint sets). \n\
+\n\
+";
+
+const std::string OptionsHandler::s_qcfWhenModeHelp = "\
+Quantifier conflict find modes currently supported by the --quant-cf-when option:\n\
+\n\
+default \n\
++ Default, apply conflict finding at full effort.\n\
+\n\
+last-call \n\
++ Apply conflict finding at last call, after theory combination and \n\
+ and all theories report sat. \n\
+\n\
+std \n\
++ Apply conflict finding at standard effort.\n\
+\n\
+std-h \n\
++ Apply conflict finding at standard effort when heuristic says to. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_qcfModeHelp = "\
+Quantifier conflict find modes currently supported by the --quant-cf option:\n\
+\n\
+prop-eq \n\
++ Default, apply QCF algorithm to propagate equalities as well as conflicts. \n\
+\n\
+conflict \n\
++ Apply QCF algorithm to find conflicts only.\n\
+\n\
+partial \n\
++ Apply QCF algorithm to instantiate heuristically as well. \n\
+\n\
+mc \n\
++ Apply QCF algorithm in a complete way, so that a model is ensured when it fails. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_userPatModeHelp = "\
+User pattern modes currently supported by the --user-pat option:\n\
+\n\
+trust \n\
++ When provided, use only user-provided patterns for a quantified formula.\n\
+\n\
+use \n\
++ Use both user-provided and auto-generated patterns when patterns\n\
+ are provided for a quantified formula.\n\
+\n\
+resort \n\
++ Use user-provided patterns only after auto-generated patterns saturate.\n\
+\n\
+ignore \n\
++ Ignore user-provided patterns. \n\
+\n\
+interleave \n\
++ Alternate between use/resort. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_triggerSelModeHelp = "\
+Trigger selection modes currently supported by the --trigger-sel option:\n\
+\n\
+default \n\
++ Default, consider all subterms of quantified formulas for trigger selection.\n\
+\n\
+min \n\
++ Consider only minimal subterms that meet criteria for triggers.\n\
+\n\
+max \n\
++ Consider only maximal subterms that meet criteria for triggers. \n\
+\n\
+";
+const std::string OptionsHandler::s_prenexQuantModeHelp = "\
+Prenex quantifiers modes currently supported by the --prenex-quant option:\n\
+\n\
+default \n\
++ Default, prenex all nested quantifiers except those with user patterns.\n\
+\n\
+all \n\
++ Prenex all nested quantifiers.\n\
+\n\
+none \n\
++ Do no prenex nested quantifiers. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_cegqiFairModeHelp = "\
+Modes for enforcing fairness for counterexample guided quantifier instantion, supported by --cegqi-fair:\n\
+\n\
+uf-dt-size \n\
++ Enforce fairness using an uninterpreted function for datatypes size.\n\
+\n\
+default | dt-size \n\
++ Default, enforce fairness using size theory operator.\n\
+\n\
+dt-height-bound \n\
++ Enforce fairness by height bound predicate.\n\
+\n\
+none \n\
++ Do not enforce fairness. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_termDbModeHelp = "\
+Modes for term database, supported by --term-db-mode:\n\
+\n\
+all \n\
++ Quantifiers module considers all ground terms.\n\
+\n\
+relevant \n\
++ Quantifiers module considers only ground terms connected to current assertions. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_iteLiftQuantHelp = "\
+Modes for term database, supported by --ite-lift-quant:\n\
+\n\
+none \n\
++ Do not lift if-then-else in quantified formulas.\n\
+\n\
+simple \n\
++ Lift if-then-else in quantified formulas if results in smaller term size.\n\
+\n\
+all \n\
++ Lift if-then-else in quantified formulas. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_sygusInvTemplHelp = "\
+Template modes for sygus invariant synthesis, supported by --sygus-inv-templ:\n\
+\n\
+none \n\
++ Synthesize invariant directly.\n\
+\n\
+pre \n\
++ Synthesize invariant based on weakening of precondition .\n\
+\n\
+post \n\
++ Synthesize invariant based on strengthening of postcondition. \n\
+\n\
+";
+
+const std::string OptionsHandler::s_macrosQuantHelp = "\
+Template modes for quantifiers macro expansion, supported by --macros-quant-mode:\n\
+\n\
+all \n\
++ Infer definitions for functions, including those containing quantified formulas.\n\
+\n\
+ground (default) \n\
++ Only infer ground definitions for functions.\n\
+\n\
+ground-uf \n\
++ Only infer ground definitions for functions that result in triggers for all free variables.\n\
+\n\
+";
+
+theory::quantifiers::InstWhenMode OptionsHandler::stringToInstWhenMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "pre-full") {
+ return theory::quantifiers::INST_WHEN_PRE_FULL;
+ } else if(optarg == "full") {
+ return theory::quantifiers::INST_WHEN_FULL;
+ } else if(optarg == "full-delay") {
+ return theory::quantifiers::INST_WHEN_FULL_DELAY;
+ } else if(optarg == "full-last-call") {
+ return theory::quantifiers::INST_WHEN_FULL_LAST_CALL;
+ } else if(optarg == "full-delay-last-call") {
+ return theory::quantifiers::INST_WHEN_FULL_DELAY_LAST_CALL;
+ } else if(optarg == "last-call") {
+ return theory::quantifiers::INST_WHEN_LAST_CALL;
+ } else if(optarg == "help") {
+ puts(s_instWhenHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --inst-when: `") +
+ optarg + "'. Try --inst-when help.");
+ }
+}
+
+void OptionsHandler::checkInstWhenMode(std::string option, theory::quantifiers::InstWhenMode mode) throw(OptionException) {
+ if(mode == theory::quantifiers::INST_WHEN_PRE_FULL) {
+ throw OptionException(std::string("Mode pre-full for ") + option + " is not supported in this release.");
+ }
+}
+
+theory::quantifiers::LiteralMatchMode OptionsHandler::stringToLiteralMatchMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "none") {
+ return theory::quantifiers::LITERAL_MATCH_NONE;
+ } else if(optarg == "predicate") {
+ return theory::quantifiers::LITERAL_MATCH_PREDICATE;
+ } else if(optarg == "equality") {
+ return theory::quantifiers::LITERAL_MATCH_EQUALITY;
+ } else if(optarg == "help") {
+ puts(s_literalMatchHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --literal-matching: `") +
+ optarg + "'. Try --literal-matching help.");
+ }
+}
+
+void OptionsHandler::checkLiteralMatchMode(std::string option, theory::quantifiers::LiteralMatchMode mode) throw(OptionException) {
+ if(mode == theory::quantifiers::LITERAL_MATCH_EQUALITY) {
+ throw OptionException(std::string("Mode equality for ") + option + " is not supported in this release.");
+ }
+}
+
+theory::quantifiers::MbqiMode OptionsHandler::stringToMbqiMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "gen-ev") {
+ return theory::quantifiers::MBQI_GEN_EVAL;
+ } else if(optarg == "none") {
+ return theory::quantifiers::MBQI_NONE;
+ } else if(optarg == "default" || optarg == "fmc") {
+ return theory::quantifiers::MBQI_FMC;
+ } else if(optarg == "fmc-interval") {
+ return theory::quantifiers::MBQI_FMC_INTERVAL;
+ } else if(optarg == "abs") {
+ return theory::quantifiers::MBQI_ABS;
+ } else if(optarg == "trust") {
+ return theory::quantifiers::MBQI_TRUST;
+ } else if(optarg == "help") {
+ puts(s_mbqiModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --mbqi: `") +
+ optarg + "'. Try --mbqi help.");
+ }
+}
+
+
+void OptionsHandler::checkMbqiMode(std::string option, theory::quantifiers::MbqiMode mode) throw(OptionException) {}
+
+
+theory::quantifiers::QcfWhenMode OptionsHandler::stringToQcfWhenMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "default") {
+ return theory::quantifiers::QCF_WHEN_MODE_DEFAULT;
+ } else if(optarg == "last-call") {
+ return theory::quantifiers::QCF_WHEN_MODE_LAST_CALL;
+ } else if(optarg == "std") {
+ return theory::quantifiers::QCF_WHEN_MODE_STD;
+ } else if(optarg == "std-h") {
+ return theory::quantifiers::QCF_WHEN_MODE_STD_H;
+ } else if(optarg == "help") {
+ puts(s_qcfWhenModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --quant-cf-when: `") +
+ optarg + "'. Try --quant-cf-when help.");
+ }
+}
+
+theory::quantifiers::QcfMode OptionsHandler::stringToQcfMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "conflict") {
+ return theory::quantifiers::QCF_CONFLICT_ONLY;
+ } else if(optarg == "default" || optarg == "prop-eq") {
+ return theory::quantifiers::QCF_PROP_EQ;
+ } else if(optarg == "partial") {
+ return theory::quantifiers::QCF_PARTIAL;
+ } else if(optarg == "mc" ) {
+ return theory::quantifiers::QCF_MC;
+ } else if(optarg == "help") {
+ puts(s_qcfModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --quant-cf-mode: `") +
+ optarg + "'. Try --quant-cf-mode help.");
+ }
+}
+
+theory::quantifiers::UserPatMode OptionsHandler::stringToUserPatMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "use") {
+ return theory::quantifiers::USER_PAT_MODE_USE;
+ } else if(optarg == "default" || optarg == "trust") {
+ return theory::quantifiers::USER_PAT_MODE_TRUST;
+ } else if(optarg == "resort") {
+ return theory::quantifiers::USER_PAT_MODE_RESORT;
+ } else if(optarg == "ignore") {
+ return theory::quantifiers::USER_PAT_MODE_IGNORE;
+ } else if(optarg == "interleave") {
+ return theory::quantifiers::USER_PAT_MODE_INTERLEAVE;
+ } else if(optarg == "help") {
+ puts(s_userPatModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --user-pat: `") +
+ optarg + "'. Try --user-pat help.");
+ }
+}
+
+theory::quantifiers::TriggerSelMode OptionsHandler::stringToTriggerSelMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "default" || optarg == "all" ) {
+ return theory::quantifiers::TRIGGER_SEL_DEFAULT;
+ } else if(optarg == "min") {
+ return theory::quantifiers::TRIGGER_SEL_MIN;
+ } else if(optarg == "max") {
+ return theory::quantifiers::TRIGGER_SEL_MAX;
+ } else if(optarg == "help") {
+ puts(s_triggerSelModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --trigger-sel: `") +
+ optarg + "'. Try --trigger-sel help.");
+ }
+}
+
+
+theory::quantifiers::PrenexQuantMode OptionsHandler::stringToPrenexQuantMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "default" ) {
+ return theory::quantifiers::PRENEX_NO_USER_PAT;
+ } else if(optarg == "all") {
+ return theory::quantifiers::PRENEX_ALL;
+ } else if(optarg == "none") {
+ return theory::quantifiers::PRENEX_NONE;
+ } else if(optarg == "help") {
+ puts(s_prenexQuantModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --prenex-quant: `") +
+ optarg + "'. Try --prenex-quant help.");
+ }
+}
+
+theory::quantifiers::CegqiFairMode OptionsHandler::stringToCegqiFairMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "uf-dt-size" ) {
+ return theory::quantifiers::CEGQI_FAIR_UF_DT_SIZE;
+ } else if(optarg == "default" || optarg == "dt-size") {
+ return theory::quantifiers::CEGQI_FAIR_DT_SIZE;
+ } else if(optarg == "dt-height-bound" ){
+ return theory::quantifiers::CEGQI_FAIR_DT_HEIGHT_PRED;
+ } else if(optarg == "none") {
+ return theory::quantifiers::CEGQI_FAIR_NONE;
+ } else if(optarg == "help") {
+ puts(s_cegqiFairModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --cegqi-fair: `") +
+ optarg + "'. Try --cegqi-fair help.");
+ }
+}
+
+theory::quantifiers::TermDbMode OptionsHandler::stringToTermDbMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "all" ) {
+ return theory::quantifiers::TERM_DB_ALL;
+ } else if(optarg == "relevant") {
+ return theory::quantifiers::TERM_DB_RELEVANT;
+ } else if(optarg == "help") {
+ puts(s_termDbModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --term-db-mode: `") +
+ optarg + "'. Try --term-db-mode help.");
+ }
+}
+
+theory::quantifiers::IteLiftQuantMode OptionsHandler::stringToIteLiftQuantMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "all" ) {
+ return theory::quantifiers::ITE_LIFT_QUANT_MODE_ALL;
+ } else if(optarg == "simple") {
+ return theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE;
+ } else if(optarg == "none") {
+ return theory::quantifiers::ITE_LIFT_QUANT_MODE_NONE;
+ } else if(optarg == "help") {
+ puts(s_iteLiftQuantHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --ite-lift-quant: `") +
+ optarg + "'. Try --ite-lift-quant help.");
+ }
+}
+
+theory::quantifiers::SygusInvTemplMode OptionsHandler::stringToSygusInvTemplMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "none" ) {
+ return theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE;
+ } else if(optarg == "pre") {
+ return theory::quantifiers::SYGUS_INV_TEMPL_MODE_PRE;
+ } else if(optarg == "post") {
+ return theory::quantifiers::SYGUS_INV_TEMPL_MODE_POST;
+ } else if(optarg == "help") {
+ puts(s_sygusInvTemplHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --sygus-inv-templ: `") +
+ optarg + "'. Try --sygus-inv-templ help.");
+ }
+}
+
+theory::quantifiers::MacrosQuantMode OptionsHandler::stringToMacrosQuantMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "all" ) {
+ return theory::quantifiers::MACROS_QUANT_MODE_ALL;
+ } else if(optarg == "ground") {
+ return theory::quantifiers::MACROS_QUANT_MODE_GROUND;
+ } else if(optarg == "ground-uf") {
+ return theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF;
+ } else if(optarg == "help") {
+ puts(s_macrosQuantHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --macros-quant-mode: `") +
+ optarg + "'. Try --macros-quant-mode help.");
+ }
+}
+
+
+// theory/bv/options_handlers.h
+void OptionsHandler::abcEnabledBuild(std::string option, bool value) throw(OptionException) {
+#ifndef CVC4_USE_ABC
+ if(value) {
+ std::stringstream ss;
+ ss << "option `" << option << "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
+ throw OptionException(ss.str());
+ }
+#endif /* CVC4_USE_ABC */
+}
+
+void OptionsHandler::abcEnabledBuild(std::string option, std::string value) throw(OptionException) {
+#ifndef CVC4_USE_ABC
+ if(!value.empty()) {
+ std::stringstream ss;
+ ss << "option `" << option << "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
+ throw OptionException(ss.str());
+ }
+#endif /* CVC4_USE_ABC */
+}
+
+const std::string OptionsHandler::s_bitblastingModeHelp = "\
+Bit-blasting modes currently supported by the --bitblast option:\n\
+\n\
+lazy (default)\n\
++ Separate boolean structure and term reasoning betwen the core\n\
+ SAT solver and the bv SAT solver\n\
+\n\
+eager\n\
++ Bitblast eagerly to bv SAT solver\n\
+";
+
+theory::bv::BitblastMode OptionsHandler::stringToBitblastMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "lazy") {
+ if (!options::bitvectorPropagate.wasSetByUser()) {
+ options::bitvectorPropagate.set(true);
+ }
+ if (!options::bitvectorEqualitySolver.wasSetByUser()) {
+ options::bitvectorEqualitySolver.set(true);
+ }
+ if (!options::bitvectorEqualitySlicer.wasSetByUser()) {
+ if (options::incrementalSolving() ||
+ options::produceModels()) {
+ options::bitvectorEqualitySlicer.set(theory::bv::BITVECTOR_SLICER_OFF);
+ } else {
+ options::bitvectorEqualitySlicer.set(theory::bv::BITVECTOR_SLICER_AUTO);
+ }
+ }
+
+ if (!options::bitvectorInequalitySolver.wasSetByUser()) {
+ options::bitvectorInequalitySolver.set(true);
+ }
+ if (!options::bitvectorAlgebraicSolver.wasSetByUser()) {
+ options::bitvectorAlgebraicSolver.set(true);
+ }
+ return theory::bv::BITBLAST_MODE_LAZY;
+ } else if(optarg == "eager") {
+
+ if (options::incrementalSolving() &&
+ options::incrementalSolving.wasSetByUser()) {
+ throw OptionException(std::string("Eager bit-blasting does not currently support incremental mode. \n\
+ Try --bitblast=lazy"));
+ }
+ if (!options::bitvectorToBool.wasSetByUser()) {
+ options::bitvectorToBool.set(true);
+ }
+
+ if (!options::bvAbstraction.wasSetByUser() &&
+ !options::skolemizeArguments.wasSetByUser()) {
+ options::bvAbstraction.set(true);
+ options::skolemizeArguments.set(true);
+ }
+ return theory::bv::BITBLAST_MODE_EAGER;
+ } else if(optarg == "help") {
+ puts(s_bitblastingModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --bitblast: `") +
+ optarg + "'. Try --bitblast=help.");
+ }
+}
+
+const std::string OptionsHandler::s_bvSlicerModeHelp = "\
+Bit-vector equality slicer modes supported by the --bv-eq-slicer option:\n\
+\n\
+auto (default)\n\
++ Turn slicer on if input has only equalities over core symbols\n\
+\n\
+on\n\
++ Turn slicer on\n\
+\n\
+off\n\
++ Turn slicer off\n\
+";
+
+theory::bv::BvSlicerMode OptionsHandler::stringToBvSlicerMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "auto") {
+ return theory::bv::BITVECTOR_SLICER_AUTO;
+ } else if(optarg == "on") {
+ return theory::bv::BITVECTOR_SLICER_ON;
+ } else if(optarg == "off") {
+ return theory::bv::BITVECTOR_SLICER_OFF;
+ } else if(optarg == "help") {
+ puts(s_bitblastingModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --bv-eq-slicer: `") +
+ optarg + "'. Try --bv-eq-slicer=help.");
+ }
+}
+
+void OptionsHandler::setBitblastAig(std::string option, bool arg) throw(OptionException) {
+ if(arg) {
+ if(options::bitblastMode.wasSetByUser()) {
+ if(options::bitblastMode() != theory::bv::BITBLAST_MODE_EAGER) {
+ throw OptionException("bitblast-aig must be used with eager bitblaster");
+ }
+ } else {
+ theory::bv::BitblastMode mode = stringToBitblastMode("", "eager");
+ options::bitblastMode.set(mode);
+ }
+ if(!options::bitvectorAigSimplifications.wasSetByUser()) {
+ options::bitvectorAigSimplifications.set("balance;drw");
+ }
+ }
+}
+
+
+// theory/booleans/options_handlers.h
+const std::string OptionsHandler::s_booleanTermConversionModeHelp = "\
+Boolean term conversion modes currently supported by the\n\
+--boolean-term-conversion-mode option:\n\
+\n\
+bitvectors [default]\n\
++ Boolean terms are converted to bitvectors of size 1.\n\
+\n\
+datatypes\n\
++ Boolean terms are converted to enumerations in the Datatype theory.\n\
+\n\
+native\n\
++ Boolean terms are converted in a \"natural\" way depending on where they\n\
+ are used. If in a datatype context, they are converted to an enumeration.\n\
+ Elsewhere, they are converted to a bitvector of size 1.\n\
+";
+
+theory::booleans::BooleanTermConversionMode OptionsHandler::stringToBooleanTermConversionMode(std::string option, std::string optarg) throw(OptionException){
+ if(optarg == "bitvectors") {
+ return theory::booleans::BOOLEAN_TERM_CONVERT_TO_BITVECTORS;
+ } else if(optarg == "datatypes") {
+ return theory::booleans::BOOLEAN_TERM_CONVERT_TO_DATATYPES;
+ } else if(optarg == "native") {
+ return theory::booleans::BOOLEAN_TERM_CONVERT_NATIVE;
+ } else if(optarg == "help") {
+ puts(s_booleanTermConversionModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --boolean-term-conversion-mode: `") +
+ optarg + "'. Try --boolean-term-conversion-mode help.");
+ }
+}
+
+
+// theory/uf/options_handlers.h
+const std::string OptionsHandler::s_ufssModeHelp = "\
+UF strong solver options currently supported by the --uf-ss option:\n\
+\n\
+full \n\
++ Default, use uf strong solver to find minimal models for uninterpreted sorts.\n\
+\n\
+no-minimal \n\
++ Use uf strong solver to shrink model sizes, but do no enforce minimality.\n\
+\n\
+none \n\
++ Do not use uf strong solver to shrink model sizes. \n\
+\n\
+";
+
+theory::uf::UfssMode OptionsHandler::stringToUfssMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "default" || optarg == "full" ) {
+ return theory::uf::UF_SS_FULL;
+ } else if(optarg == "no-minimal") {
+ return theory::uf::UF_SS_NO_MINIMAL;
+ } else if(optarg == "none") {
+ return theory::uf::UF_SS_NONE;
+ } else if(optarg == "help") {
+ puts(s_ufssModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --uf-ss: `") +
+ optarg + "'. Try --uf-ss help.");
+ }
+}
+
+
+
+// theory/options_handlers.h
+const std::string OptionsHandler::s_theoryOfModeHelp = "\
+TheoryOf modes currently supported by the --theoryof-mode option:\n\
+\n\
+type (default) \n\
++ type variables, constants and equalities by type\n\
+\n\
+term \n\
++ type variables as uninterpreted, equalities by the parametric theory\n\
+";
+
+theory::TheoryOfMode OptionsHandler::stringToTheoryOfMode(std::string option, std::string optarg) {
+ if(optarg == "type") {
+ return theory::THEORY_OF_TYPE_BASED;
+ } else if(optarg == "term") {
+ return theory::THEORY_OF_TERM_BASED;
+ } else if(optarg == "help") {
+ puts(s_theoryOfModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --theoryof-mode: `") +
+ optarg + "'. Try --theoryof-mode help.");
+ }
+}
+
+// theory/options_handlers.h
+std::string OptionsHandler::handleUseTheoryList(std::string option, std::string optarg) {
+ std::string currentList = options::useTheoryList();
+ if(currentList.empty()){
+ return optarg;
+ } else {
+ return currentList +','+ optarg;
+ }
+}
+
+void OptionsHandler::notifyUseTheoryList(std::string option) {
+ d_options->d_useTheoryListListeners.notify();
+}
+
+
+
+// printer/options_handlers.h
+const std::string OptionsHandler::s_modelFormatHelp = "\
+Model format modes currently supported by the --model-format option:\n\
+\n\
+default \n\
++ Print model as expressions in the output language format.\n\
+\n\
+table\n\
++ Print functional expressions over finite domains in a table format.\n\
+";
+
+const std::string OptionsHandler::s_instFormatHelp = "\
+Inst format modes currently supported by the --model-format option:\n\
+\n\
+default \n\
++ Print instantiations as a list in the output language format.\n\
+\n\
+szs\n\
++ Print instantiations as SZS compliant proof.\n\
+";
+
+ModelFormatMode OptionsHandler::stringToModelFormatMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "default") {
+ return MODEL_FORMAT_MODE_DEFAULT;
+ } else if(optarg == "table") {
+ return MODEL_FORMAT_MODE_TABLE;
+ } else if(optarg == "help") {
+ puts(s_modelFormatHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --model-format: `") +
+ optarg + "'. Try --model-format help.");
+ }
+}
+
+InstFormatMode OptionsHandler::stringToInstFormatMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "default") {
+ return INST_FORMAT_MODE_DEFAULT;
+ } else if(optarg == "szs") {
+ return INST_FORMAT_MODE_SZS;
+ } else if(optarg == "help") {
+ puts(s_instFormatHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --inst-format: `") +
+ optarg + "'. Try --inst-format help.");
+ }
+}
+
+
+// decision/options_handlers.h
+const std::string OptionsHandler::s_decisionModeHelp = "\
+Decision modes currently supported by the --decision option:\n\
+\n\
+internal (default)\n\
++ Use the internal decision heuristics of the SAT solver\n\
+\n\
+justification\n\
++ An ATGP-inspired justification heuristic\n\
+\n\
+justification-stoponly\n\
++ Use the justification heuristic only to stop early, not for decisions\n\
+";
+
+decision::DecisionMode OptionsHandler::stringToDecisionMode(std::string option, std::string optarg) throw(OptionException) {
+ options::decisionStopOnly.set(false);
+
+ if(optarg == "internal") {
+ return decision::DECISION_STRATEGY_INTERNAL;
+ } else if(optarg == "justification") {
+ return decision::DECISION_STRATEGY_JUSTIFICATION;
+ } else if(optarg == "justification-stoponly") {
+ options::decisionStopOnly.set(true);
+ return decision::DECISION_STRATEGY_JUSTIFICATION;
+ } else if(optarg == "help") {
+ puts(s_decisionModeHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --decision: `") +
+ optarg + "'. Try --decision help.");
+ }
+}
+
+decision::DecisionWeightInternal OptionsHandler::stringToDecisionWeightInternal(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "off")
+ return decision::DECISION_WEIGHT_INTERNAL_OFF;
+ else if(optarg == "max")
+ return decision::DECISION_WEIGHT_INTERNAL_MAX;
+ else if(optarg == "sum")
+ return decision::DECISION_WEIGHT_INTERNAL_SUM;
+ else if(optarg == "usr1")
+ return decision::DECISION_WEIGHT_INTERNAL_USR1;
+ else
+ throw OptionException(std::string("--decision-weight-internal must be off, max or sum."));
+}
+
+
+// smt/options_handlers.h
+const std::string OptionsHandler::s_simplificationHelp = "\
+Simplification modes currently supported by the --simplification option:\n\
+\n\
+batch (default) \n\
++ save up all ASSERTions; run nonclausal simplification and clausal\n\
+ (MiniSat) propagation for all of them only after reaching a querying command\n\
+ (CHECKSAT or QUERY or predicate SUBTYPE declaration)\n\
+\n\
+none\n\
++ do not perform nonclausal simplification\n\
+";
+
+
+
+SimplificationMode OptionsHandler::stringToSimplificationMode(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "batch") {
+ return SIMPLIFICATION_MODE_BATCH;
+ } else if(optarg == "none") {
+ return SIMPLIFICATION_MODE_NONE;
+ } else if(optarg == "help") {
+ puts(s_simplificationHelp.c_str());
+ exit(1);
+ } else {
+ throw OptionException(std::string("unknown option for --simplification: `") +
+ optarg + "'. Try --simplification help.");
+ }
+}
+
+
+void OptionsHandler::setProduceAssertions(std::string option, bool value) throw() {
+ options::produceAssertions.set(value);
+ options::interactiveMode.set(value);
+}
+
+
+void OptionsHandler::proofEnabledBuild(std::string option, bool value) throw(OptionException) {
+#ifndef CVC4_PROOF
+ if(value) {
+ std::stringstream ss;
+ ss << "option `" << option << "' requires a proofs-enabled build of CVC4; this binary was not built with proof support";
+ throw OptionException(ss.str());
+ }
+#endif /* CVC4_PROOF */
+}
+
+void OptionsHandler::notifyDumpToFile(std::string option) {
+ d_options->d_dumpToFileListeners.notify();
+}
+
+
+void OptionsHandler::notifySetRegularOutputChannel(std::string option) {
+ d_options->d_setRegularChannelListeners.notify();
+}
+
+void OptionsHandler::notifySetDiagnosticOutputChannel(std::string option) {
+ d_options->d_setDiagnosticChannelListeners.notify();
+}
+
+
+std::string OptionsHandler::checkReplayFilename(std::string option, std::string optarg) {
+#ifdef CVC4_REPLAY
+ if(optarg == "") {
+ throw OptionException (std::string("Bad file name for --replay"));
+ } else {
+ return optarg;
+ }
+#else /* CVC4_REPLAY */
+ throw OptionException("The replay feature was disabled in this build of CVC4.");
+#endif /* CVC4_REPLAY */
+}
+
+void OptionsHandler::notifySetReplayLogFilename(std::string option) {
+ d_options->d_setReplayFilenameListeners.notify();
+}
+
+void OptionsHandler::statsEnabledBuild(std::string option, bool value) throw(OptionException) {
+#ifndef CVC4_STATISTICS_ON
+ if(value) {
+ std::stringstream ss;
+ ss << "option `" << option << "' requires a statistics-enabled build of CVC4; this binary was not built with statistics support";
+ throw OptionException(ss.str());
+ }
+#endif /* CVC4_STATISTICS_ON */
+}
+
+void OptionsHandler::threadN(std::string option) {
+ throw OptionException(option + " is not a real option by itself. Use e.g. --thread0=\"--random-seed=10 --random-freq=0.02\" --thread1=\"--random-seed=20 --random-freq=0.05\"");
+}
+
+void OptionsHandler::notifyDumpMode(std::string option) throw(OptionException) {
+ d_options->d_setDumpModeListeners.notify();
+}
+
+
+// expr/options_handlers.h
+void OptionsHandler::setDefaultExprDepthPredicate(std::string option, int depth) {
+ if(depth < -1) {
+ throw OptionException("--default-expr-depth requires a positive argument, or -1.");
+ }
+}
+
+void OptionsHandler::setDefaultDagThreshPredicate(std::string option, int dag) {
+ if(dag < 0) {
+ throw OptionException("--default-dag-thresh requires a nonnegative argument.");
+ }
+}
+
+void OptionsHandler::notifySetDefaultExprDepth(std::string option) {
+ d_options->d_setDefaultExprDepthListeners.notify();
+}
+
+void OptionsHandler::notifySetDefaultDagThresh(std::string option) {
+ d_options->d_setDefaultDagThreshListeners.notify();
+}
+
+void OptionsHandler::notifySetPrintExprTypes(std::string option) {
+ d_options->d_setPrintExprTypesListeners.notify();
+}
+
+
+// main/options_handlers.h
+void OptionsHandler::showConfiguration(std::string option) {
+ fputs(Configuration::about().c_str(), stdout);
+ printf("\n");
+ printf("version : %s\n", Configuration::getVersionString().c_str());
+ if(Configuration::isGitBuild()) {
+ const char* branchName = Configuration::getGitBranchName();
+ if(*branchName == '\0') {
+ branchName = "-";
+ }
+ printf("scm : git [%s %s%s]\n",
+ branchName,
+ std::string(Configuration::getGitCommit()).substr(0, 8).c_str(),
+ Configuration::hasGitModifications() ?
+ " (with modifications)" : "");
+ } else if(Configuration::isSubversionBuild()) {
+ printf("scm : svn [%s r%u%s]\n",
+ Configuration::getSubversionBranchName(),
+ Configuration::getSubversionRevision(),
+ Configuration::hasSubversionModifications() ?
+ " (with modifications)" : "");
+ } else {
+ printf("scm : no\n");
+ }
+ printf("\n");
+ printf("library : %u.%u.%u\n",
+ Configuration::getVersionMajor(),
+ Configuration::getVersionMinor(),
+ Configuration::getVersionRelease());
+ printf("\n");
+ printf("debug code : %s\n", Configuration::isDebugBuild() ? "yes" : "no");
+ printf("statistics : %s\n", Configuration::isStatisticsBuild() ? "yes" : "no");
+ printf("replay : %s\n", Configuration::isReplayBuild() ? "yes" : "no");
+ printf("tracing : %s\n", Configuration::isTracingBuild() ? "yes" : "no");
+ printf("dumping : %s\n", Configuration::isDumpingBuild() ? "yes" : "no");
+ printf("muzzled : %s\n", Configuration::isMuzzledBuild() ? "yes" : "no");
+ printf("assertions : %s\n", Configuration::isAssertionBuild() ? "yes" : "no");
+ printf("proof : %s\n", Configuration::isProofBuild() ? "yes" : "no");
+ printf("coverage : %s\n", Configuration::isCoverageBuild() ? "yes" : "no");
+ printf("profiling : %s\n", Configuration::isProfilingBuild() ? "yes" : "no");
+ printf("competition: %s\n", Configuration::isCompetitionBuild() ? "yes" : "no");
+ printf("\n");
+ printf("cudd : %s\n", Configuration::isBuiltWithCudd() ? "yes" : "no");
+ printf("cln : %s\n", Configuration::isBuiltWithCln() ? "yes" : "no");
+ printf("gmp : %s\n", Configuration::isBuiltWithGmp() ? "yes" : "no");
+ printf("glpk : %s\n", Configuration::isBuiltWithGlpk() ? "yes" : "no");
+ printf("abc : %s\n", Configuration::isBuiltWithAbc() ? "yes" : "no");
+ printf("readline : %s\n", Configuration::isBuiltWithReadline() ? "yes" : "no");
+ printf("tls : %s\n", Configuration::isBuiltWithTlsSupport() ? "yes" : "no");
+ exit(0);
+}
+
+void OptionsHandler::showDebugTags(std::string option) {
+ if(Configuration::isDebugBuild() && Configuration::isTracingBuild()) {
+ printf("available tags:");
+ unsigned ntags = Configuration::getNumDebugTags();
+ char const* const* tags = Configuration::getDebugTags();
+ for(unsigned i = 0; i < ntags; ++ i) {
+ printf(" %s", tags[i]);
+ }
+ printf("\n");
+ } else if(! Configuration::isDebugBuild()) {
+ throw OptionException("debug tags not available in non-debug builds");
+ } else {
+ throw OptionException("debug tags not available in non-tracing builds");
+ }
+ exit(0);
+}
+
+void OptionsHandler::showTraceTags(std::string option) {
+ if(Configuration::isTracingBuild()) {
+ printf("available tags:");
+ unsigned ntags = Configuration::getNumTraceTags();
+ char const* const* tags = Configuration::getTraceTags();
+ for (unsigned i = 0; i < ntags; ++ i) {
+ printf(" %s", tags[i]);
+ }
+ printf("\n");
+ } else {
+ throw OptionException("trace tags not available in non-tracing build");
+ }
+ exit(0);
+}
+
+
+OutputLanguage OptionsHandler::stringToOutputLanguage(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "help") {
+ options::languageHelp.set(true);
+ return language::output::LANG_AUTO;
+ }
+
+ try {
+ return language::toOutputLanguage(optarg);
+ } catch(OptionException& oe) {
+ throw OptionException("Error in " + option + ": " + oe.getMessage() +
+ "\nTry --output-language help");
+ }
+
+ Unreachable();
+}
+
+InputLanguage OptionsHandler::stringToInputLanguage(std::string option, std::string optarg) throw(OptionException) {
+ if(optarg == "help") {
+ options::languageHelp.set(true);
+ return language::input::LANG_AUTO;
+ }
+
+ try {
+ return language::toInputLanguage(optarg);
+ } catch(OptionException& oe) {
+ throw OptionException("Error in " + option + ": " + oe.getMessage() + "\nTry --language help");
+ }
+
+ Unreachable();
+}
+
+/* options/base_options_handlers.h */
+void OptionsHandler::setVerbosity(std::string option, int value) throw(OptionException) {
+ if(Configuration::isMuzzledBuild()) {
+ DebugChannel.setStream(&CVC4::null_os);
+ TraceChannel.setStream(&CVC4::null_os);
+ NoticeChannel.setStream(&CVC4::null_os);
+ ChatChannel.setStream(&CVC4::null_os);
+ MessageChannel.setStream(&CVC4::null_os);
+ WarningChannel.setStream(&CVC4::null_os);
+ } else {
+ if(value < 2) {
+ ChatChannel.setStream(&CVC4::null_os);
+ } else {
+ ChatChannel.setStream(&std::cout);
+ }
+ if(value < 1) {
+ NoticeChannel.setStream(&CVC4::null_os);
+ } else {
+ NoticeChannel.setStream(&std::cout);
+ }
+ if(value < 0) {
+ MessageChannel.setStream(&CVC4::null_os);
+ WarningChannel.setStream(&CVC4::null_os);
+ } else {
+ MessageChannel.setStream(&std::cout);
+ WarningChannel.setStream(&std::cerr);
+ }
+ }
+}
+
+void OptionsHandler::increaseVerbosity(std::string option) {
+ options::verbosity.set(options::verbosity() + 1);
+ setVerbosity(option, options::verbosity());
+}
+
+void OptionsHandler::decreaseVerbosity(std::string option) {
+ options::verbosity.set(options::verbosity() - 1);
+ setVerbosity(option, options::verbosity());
+}
+
+
+void OptionsHandler::addTraceTag(std::string option, std::string optarg) {
+ if(Configuration::isTracingBuild()) {
+ if(!Configuration::isTraceTag(optarg.c_str())) {
+
+ if(optarg == "help") {
+ printf("available tags:");
+ unsigned ntags = Configuration::getNumTraceTags();
+ char const* const* tags = Configuration::getTraceTags();
+ for(unsigned i = 0; i < ntags; ++ i) {
+ printf(" %s", tags[i]);
+ }
+ printf("\n");
+ exit(0);
+ }
+
+ throw OptionException(std::string("trace tag ") + optarg +
+ std::string(" not available.") +
+ suggestTags(Configuration::getTraceTags(), optarg) );
+ }
+ } else {
+ throw OptionException("trace tags not available in non-tracing builds");
+ }
+ Trace.on(optarg);
+}
+
+void OptionsHandler::addDebugTag(std::string option, std::string optarg) {
+ if(Configuration::isDebugBuild() && Configuration::isTracingBuild()) {
+ if(!Configuration::isDebugTag(optarg.c_str()) &&
+ !Configuration::isTraceTag(optarg.c_str())) {
+
+ if(optarg == "help") {
+ printf("available tags:");
+ unsigned ntags = Configuration::getNumDebugTags();
+ char const* const* tags = Configuration::getDebugTags();
+ for(unsigned i = 0; i < ntags; ++ i) {
+ printf(" %s", tags[i]);
+ }
+ printf("\n");
+ exit(0);
+ }
+
+ throw OptionException(std::string("debug tag ") + optarg +
+ std::string(" not available.") +
+ suggestTags(Configuration::getDebugTags(), optarg, Configuration::getTraceTags()) );
+ }
+ } else if(! Configuration::isDebugBuild()) {
+ throw OptionException("debug tags not available in non-debug builds");
+ } else {
+ throw OptionException("debug tags not available in non-tracing builds");
+ }
+ Debug.on(optarg);
+ Trace.on(optarg);
+}
+
+
+
+
+std::string OptionsHandler::suggestTags(char const* const* validTags, std::string inputTag,
+ char const* const* additionalTags)
+{
+ DidYouMean didYouMean;
+
+ const char* opt;
+ for(size_t i = 0; (opt = validTags[i]) != NULL; ++i) {
+ didYouMean.addWord(validTags[i]);
+ }
+ if(additionalTags != NULL) {
+ for(size_t i = 0; (opt = additionalTags[i]) != NULL; ++i) {
+ didYouMean.addWord(additionalTags[i]);
+ }
+ }
+
+ return didYouMean.getMatchAsString(inputTag);
+}
+
+
+
+
+}/* CVC4::options namespace */
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file options_handler.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Interface for custom handlers and predicates options.
+ **
+ ** Interface for custom handlers and predicates options.
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__OPTIONS__OPTIONS_HANDLER_H
+#define __CVC4__OPTIONS__OPTIONS_HANDLER_H
+
+#include <ostream>
+#include <string>
+
+#include "base/modal_exception.h"
+#include "options/arith_heuristic_pivot_rule.h"
+#include "options/arith_propagation_mode.h"
+#include "options/arith_unate_lemma_mode.h"
+#include "options/base_handlers.h"
+#include "options/boolean_term_conversion_mode.h"
+#include "options/bv_bitblast_mode.h"
+#include "options/decision_mode.h"
+#include "options/language.h"
+#include "options/option_exception.h"
+#include "options/options.h"
+#include "options/printer_modes.h"
+#include "options/quantifiers_modes.h"
+#include "options/simplification_mode.h"
+#include "options/theoryof_mode.h"
+#include "options/ufss_mode.h"
+
+namespace CVC4 {
+namespace options {
+
+class OptionsHandler {
+public:
+ OptionsHandler(Options* options);
+ virtual ~OptionsHandler() {}
+
+ void unsignedGreater0(const std::string& option, unsigned value) {
+ options::greater(0)(option, value);
+ }
+
+ void unsignedLessEqual2(const std::string& option, unsigned value) {
+ options::less_equal(2)(option, value);
+ }
+
+ void doubleGreaterOrEqual0(const std::string& option, double value) {
+ options::greater_equal(0.0)(option, value);
+ }
+
+ void doubleLessOrEqual1(const std::string& option, double value) {
+ options::less_equal(1.0)(option, value);
+ }
+
+ // DONE
+ // decision/options_handlers.h
+ // expr/options_handlers.h
+ // main/options_handlers.h
+ // options/base_options_handlers.h
+ // printer/options_handlers.h
+ // smt/options_handlers.h
+ // theory/options_handlers.h
+ // theory/booleans/options_handlers.h
+ // theory/uf/options_handlers.h
+ // theory/bv/options_handlers.h
+ // theory/quantifiers/options_handlers.h
+ // theory/arith/options_handlers.h
+
+
+ // theory/arith/options_handlers.h
+ ArithUnateLemmaMode stringToArithUnateLemmaMode(std::string option, std::string optarg) throw(OptionException);
+ ArithPropagationMode stringToArithPropagationMode(std::string option, std::string optarg) throw(OptionException);
+ ErrorSelectionRule stringToErrorSelectionRule(std::string option, std::string optarg) throw(OptionException);
+
+ // theory/quantifiers/options_handlers.h
+ theory::quantifiers::InstWhenMode stringToInstWhenMode(std::string option, std::string optarg) throw(OptionException);
+ void checkInstWhenMode(std::string option, theory::quantifiers::InstWhenMode mode) throw(OptionException);
+ theory::quantifiers::LiteralMatchMode stringToLiteralMatchMode(std::string option, std::string optarg) throw(OptionException);
+ void checkLiteralMatchMode(std::string option, theory::quantifiers::LiteralMatchMode mode) throw(OptionException);
+ theory::quantifiers::MbqiMode stringToMbqiMode(std::string option, std::string optarg) throw(OptionException);
+ void checkMbqiMode(std::string option, theory::quantifiers::MbqiMode mode) throw(OptionException);
+ theory::quantifiers::QcfWhenMode stringToQcfWhenMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::QcfMode stringToQcfMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::UserPatMode stringToUserPatMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::TriggerSelMode stringToTriggerSelMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::PrenexQuantMode stringToPrenexQuantMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::CegqiFairMode stringToCegqiFairMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::TermDbMode stringToTermDbMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::IteLiftQuantMode stringToIteLiftQuantMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::SygusInvTemplMode stringToSygusInvTemplMode(std::string option, std::string optarg) throw(OptionException);
+ theory::quantifiers::MacrosQuantMode stringToMacrosQuantMode(std::string option, std::string optarg) throw(OptionException);
+
+ // theory/bv/options_handlers.h
+ void abcEnabledBuild(std::string option, bool value) throw(OptionException);
+ void abcEnabledBuild(std::string option, std::string value) throw(OptionException);
+ theory::bv::BitblastMode stringToBitblastMode(std::string option, std::string optarg) throw(OptionException);
+ theory::bv::BvSlicerMode stringToBvSlicerMode(std::string option, std::string optarg) throw(OptionException);
+ void setBitblastAig(std::string option, bool arg) throw(OptionException);
+
+
+ // theory/booleans/options_handlers.h
+ theory::booleans::BooleanTermConversionMode stringToBooleanTermConversionMode(std::string option, std::string optarg) throw(OptionException);
+
+ // theory/uf/options_handlers.h
+ theory::uf::UfssMode stringToUfssMode(std::string option, std::string optarg) throw(OptionException);
+
+ // theory/options_handlers.h
+ theory::TheoryOfMode stringToTheoryOfMode(std::string option, std::string optarg);
+ void notifyUseTheoryList(std::string option);
+ std::string handleUseTheoryList(std::string option, std::string optarg);
+
+
+ // printer/options_handlers.h
+ ModelFormatMode stringToModelFormatMode(std::string option, std::string optarg) throw(OptionException);
+ InstFormatMode stringToInstFormatMode(std::string option, std::string optarg) throw(OptionException);
+
+ // decision/options_handlers.h
+ decision::DecisionMode stringToDecisionMode(std::string option, std::string optarg) throw(OptionException);
+ decision::DecisionWeightInternal stringToDecisionWeightInternal(std::string option, std::string optarg) throw(OptionException);
+
+
+ /* smt/options_handlers.h */
+ void notifyForceLogic(const std::string& option);
+ void notifyBeforeSearch(const std::string& option) throw(ModalException);
+ void notifyDumpMode(std::string option) throw(OptionException);
+ SimplificationMode stringToSimplificationMode(std::string option, std::string optarg) throw(OptionException);
+ void setProduceAssertions(std::string option, bool value) throw();
+ void proofEnabledBuild(std::string option, bool value) throw(OptionException);
+ void notifyDumpToFile(std::string option);
+ void notifySetRegularOutputChannel(std::string option);
+ void notifySetDiagnosticOutputChannel(std::string option);
+ std::string checkReplayFilename(std::string option, std::string optarg);
+ void notifySetReplayLogFilename(std::string option);
+
+ void statsEnabledBuild(std::string option, bool value) throw(OptionException);
+
+ unsigned long tlimitHandler(std::string option, std::string optarg) throw(OptionException);
+ unsigned long tlimitPerHandler(std::string option, std::string optarg) throw(OptionException);
+ unsigned long rlimitHandler(std::string option, std::string optarg) throw(OptionException);
+ unsigned long rlimitPerHandler(std::string option, std::string optarg) throw(OptionException);
+
+ void notifyTlimit(const std::string& option);
+ void notifyTlimitPer(const std::string& option);
+ void notifyRlimit(const std::string& option);
+ void notifyRlimitPer(const std::string& option);
+
+
+ /* expr/options_handlers.h */
+ void setDefaultExprDepthPredicate(std::string option, int depth);
+ void setDefaultDagThreshPredicate(std::string option, int dag);
+ void notifySetDefaultExprDepth(std::string option);
+ void notifySetDefaultDagThresh(std::string option);
+ void notifySetPrintExprTypes(std::string option);
+
+ /* main/options_handlers.h */
+ void showConfiguration(std::string option);
+ void showDebugTags(std::string option);
+ void showTraceTags(std::string option);
+ void threadN(std::string option);
+
+ /* options/base_options_handlers.h */
+ void setVerbosity(std::string option, int value) throw(OptionException);
+ void increaseVerbosity(std::string option);
+ void decreaseVerbosity(std::string option);
+ OutputLanguage stringToOutputLanguage(std::string option, std::string optarg) throw(OptionException);
+ InputLanguage stringToInputLanguage(std::string option, std::string optarg) throw(OptionException);
+ void addTraceTag(std::string option, std::string optarg);
+ void addDebugTag(std::string option, std::string optarg);
+ void notifyPrintSuccess(std::string option);
+
+ private:
+
+ /* Helper utilities */
+ static std::string suggestTags(char const* const* validTags, std::string inputTag,
+ char const* const* additionalTags = NULL);
+
+ /** Pointer to the containing Options object.*/
+ Options* d_options;
+
+ /* Help strings */
+ static const std::string s_bitblastingModeHelp;
+ static const std::string s_booleanTermConversionModeHelp;
+ static const std::string s_bvSlicerModeHelp;
+ static const std::string s_cegqiFairModeHelp;
+ static const std::string s_decisionModeHelp;
+ static const std::string s_instFormatHelp ;
+ static const std::string s_instWhenHelp;
+ static const std::string s_iteLiftQuantHelp;
+ static const std::string s_literalMatchHelp;
+ static const std::string s_macrosQuantHelp;
+ static const std::string s_mbqiModeHelp;
+ static const std::string s_modelFormatHelp;
+ static const std::string s_prenexQuantModeHelp;
+ static const std::string s_qcfModeHelp;
+ static const std::string s_qcfWhenModeHelp;
+ static const std::string s_simplificationHelp;
+ static const std::string s_sygusInvTemplHelp;
+ static const std::string s_termDbModeHelp;
+ static const std::string s_theoryOfModeHelp;
+ static const std::string s_triggerSelModeHelp;
+ static const std::string s_ufssModeHelp;
+ static const std::string s_userPatModeHelp;
+ static const std::string s_errorSelectionRulesHelp;
+ static const std::string s_arithPropagationModeHelp;
+ static const std::string s_arithUnateLemmasHelp;
+
+}; /* class OptionHandler */
+
+
+}/* CVC4::options namespace */
+}/* CVC4 namespace */
+
+#endif /* __CVC4__OPTIONS__OPTIONS_HANDLER_H */
+++ /dev/null
-/********************* */
-/*! \file option_handler_get_option_template.cpp
- ** \verbatim
- ** Original author: Morgan Deters
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Implementation of OptionsHandler::getOption.
- **
- ** This template file is expanded into the cpp implementation of
- ** OptionsHandler::setOption. The file is essentially the contents
- ** of the ${smt_getoption_handlers} variable in the options/mkoptions
- ** script. This variable depends on all options files. To generate this file,
- ** first generate options/summary.sed.
- **/
-
-#include <iomanip>
-#include <string>
-#include <sstream>
-
-
-#include "base/output.h"
-#include "base/modal_exception.h"
-#include "options/option_exception.h"
-#include "options/options_handler_interface.h"
-
-
-${include_all_option_headers}
-${option_handler_includes}
-
-#line 31 "${template}"
-
-using namespace std;
-
-namespace CVC4 {
-namespace options {
-
-std::string OptionsHandler::getOption(const std::string& key) const
- throw(OptionException) {
- Trace("options") << "SMT getOption(" << key << ")" << endl;
-
- ${smt_getoption_handlers}
-
-#line 57 "${template}"
-
- throw UnrecognizedOptionException(key);
-}
-
-}/* options namespace */
-}/* CVC4 namespace */
+++ /dev/null
-/********************* */
-/*! \file options_handler_interface.cpp
- ** \verbatim
- ** Original author: Tim King
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Interface for custom handlers and predicates options.
- **
- ** Interface for custom handlers and predicates options.
- **/
-
-#include "options/options_handler_interface.h"
-
-#include <ostream>
-#include <string>
-
-#include "base/cvc4_assert.h"
-#include "base/exception.h"
-#include "base/modal_exception.h"
-#include "options/arith_heuristic_pivot_rule.h"
-#include "options/arith_propagation_mode.h"
-#include "options/arith_unate_lemma_mode.h"
-#include "options/boolean_term_conversion_mode.h"
-#include "options/bv_bitblast_mode.h"
-#include "options/decision_mode.h"
-#include "options/language.h"
-#include "options/option_exception.h"
-#include "options/printer_modes.h"
-#include "options/quantifiers_modes.h"
-#include "options/simplification_mode.h"
-#include "options/theoryof_mode.h"
-#include "options/ufss_mode.h"
-
-namespace CVC4 {
-namespace options {
-
-static const char* s_third_argument_warning =
- "We no longer support passing the third argument to the setting an option as NULL.";
-
-// theory/arith/options_handlers.h
-ArithUnateLemmaMode stringToArithUnateLemmaMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToArithUnateLemmaMode(option, optarg);
-}
-ArithPropagationMode stringToArithPropagationMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToArithPropagationMode(option, optarg);
-}
-ErrorSelectionRule stringToErrorSelectionRule(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToErrorSelectionRule(option, optarg);
-}
-
-// theory/quantifiers/options_handlers.h
-theory::quantifiers::InstWhenMode stringToInstWhenMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToInstWhenMode(option, optarg);
-}
-void checkInstWhenMode(std::string option, theory::quantifiers::InstWhenMode mode, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->checkInstWhenMode(option, mode);
-}
-theory::quantifiers::LiteralMatchMode stringToLiteralMatchMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToLiteralMatchMode(option, optarg);
-}
-void checkLiteralMatchMode(std::string option, theory::quantifiers::LiteralMatchMode mode, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->checkLiteralMatchMode(option, mode);
-}
-theory::quantifiers::MbqiMode stringToMbqiMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToMbqiMode(option, optarg);
-}
-void checkMbqiMode(std::string option, theory::quantifiers::MbqiMode mode, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->checkMbqiMode(option, mode);
-}
-theory::quantifiers::QcfWhenMode stringToQcfWhenMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToQcfWhenMode(option, optarg);
-}
-theory::quantifiers::QcfMode stringToQcfMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToQcfMode(option, optarg);
-}
-theory::quantifiers::UserPatMode stringToUserPatMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToUserPatMode(option, optarg);
-}
-theory::quantifiers::TriggerSelMode stringToTriggerSelMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToTriggerSelMode(option, optarg);
-}
-theory::quantifiers::PrenexQuantMode stringToPrenexQuantMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToPrenexQuantMode(option, optarg);
-}
-theory::quantifiers::CegqiFairMode stringToCegqiFairMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToCegqiFairMode(option, optarg);
-}
-theory::quantifiers::TermDbMode stringToTermDbMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler-> stringToTermDbMode(option, optarg);
-}
-theory::quantifiers::IteLiftQuantMode stringToIteLiftQuantMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToIteLiftQuantMode(option, optarg);
-}
-theory::quantifiers::SygusInvTemplMode stringToSygusInvTemplMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToSygusInvTemplMode(option, optarg);
-}
-theory::quantifiers::MacrosQuantMode stringToMacrosQuantMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToMacrosQuantMode(option, optarg);
-}
-
-
-// theory/bv/options_handlers.h
-void abcEnabledBuild(std::string option, bool value, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->abcEnabledBuild(option, value);
-}
-void abcEnabledBuild(std::string option, std::string value, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->abcEnabledBuild(option, value);
-}
-theory::bv::BitblastMode stringToBitblastMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToBitblastMode(option, optarg);
-}
-theory::bv::BvSlicerMode stringToBvSlicerMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToBvSlicerMode(option, optarg);
-}
-void setBitblastAig(std::string option, bool arg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setBitblastAig(option, arg);
-}
-
-
-// theory/booleans/options_handlers.h
-theory::booleans::BooleanTermConversionMode stringToBooleanTermConversionMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToBooleanTermConversionMode( option, optarg);
-}
-
-// theory/uf/options_handlers.h
-theory::uf::UfssMode stringToUfssMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToUfssMode(option, optarg);
-}
-
-// theory/options_handlers.h
-theory::TheoryOfMode stringToTheoryOfMode(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToTheoryOfMode(option, optarg);
-}
-void useTheory(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->useTheory(option, optarg);
-}
-
-// printer/options_handlers.h
-ModelFormatMode stringToModelFormatMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToModelFormatMode(option, optarg);
-}
-
-InstFormatMode stringToInstFormatMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToInstFormatMode(option, optarg);
-}
-
-
-// decision/options_handlers.h
-decision::DecisionMode stringToDecisionMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToDecisionMode(option, optarg);
-}
-
-decision::DecisionWeightInternal stringToDecisionWeightInternal(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToDecisionWeightInternal(option, optarg);
-}
-
-
-/* options/base_options_handlers.h */
-void setVerbosity(std::string option, int value, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setVerbosity(option, value);
-}
-void increaseVerbosity(std::string option, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->increaseVerbosity(option);
-}
-void decreaseVerbosity(std::string option, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->decreaseVerbosity(option);
-}
-
-OutputLanguage stringToOutputLanguage(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToOutputLanguage(option, optarg);
-}
-
-InputLanguage stringToInputLanguage(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToInputLanguage(option, optarg);
-}
-
-void addTraceTag(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->addTraceTag(option, optarg);
-}
-
-void addDebugTag(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->addDebugTag(option, optarg);
-}
-
-void setPrintSuccess(std::string option, bool value, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setPrintSuccess(option, value);
-}
-
-
-/* main/options_handlers.h */
-void showConfiguration(std::string option, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->showConfiguration(option);
-}
-
-void showDebugTags(std::string option, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->showDebugTags(option);
-}
-
-void showTraceTags(std::string option, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->showTraceTags(option);
-}
-
-void threadN(std::string option, OptionsHandler* handler){
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->threadN(option);
-}
-
-/* expr/options_handlers.h */
-void setDefaultExprDepth(std::string option, int depth, OptionsHandler* handler){
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setDefaultExprDepth(option, depth);
-}
-
-void setDefaultDagThresh(std::string option, int dag, OptionsHandler* handler){
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setDefaultDagThresh(option, dag);
-}
-
-void setPrintExprTypes(std::string option, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setPrintExprTypes(option);
-}
-
-
-/* smt/options_handlers.h */
-void dumpMode(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->dumpMode(option, optarg);
-}
-
-LogicInfo* stringToLogicInfo(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException){
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToLogicInfo(option, optarg);
-}
-
-SimplificationMode stringToSimplificationMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException){
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->stringToSimplificationMode(option, optarg);
-}
-
-// ensure we haven't started search yet
-void beforeSearch(std::string option, bool value, OptionsHandler* handler) throw(ModalException){
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->beforeSearch(option, value);
-}
-
-void setProduceAssertions(std::string option, bool value, OptionsHandler* handler) throw() {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setProduceAssertions(option, value);
-}
-
-// ensure we are a proof-enabled build of CVC4
-void proofEnabledBuild(std::string option, bool value, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->proofEnabledBuild(option, value);
-}
-
-void dumpToFile(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->dumpToFile(option, optarg);
-}
-
-void setRegularOutputChannel(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setRegularOutputChannel(option, optarg);
-}
-
-void setDiagnosticOutputChannel(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- handler->setDiagnosticOutputChannel(option, optarg);
-}
-
-std::string checkReplayFilename(std::string option, std::string optarg, OptionsHandler* handler) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->checkReplayFilename(option, optarg);
-}
-
-
-// ensure we are a stats-enabled build of CVC4
-void statsEnabledBuild(std::string option, bool value, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->statsEnabledBuild(option, value);
-}
-
-unsigned long tlimitHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->tlimitHandler(option, optarg);
-}
-
-unsigned long tlimitPerHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler-> tlimitPerHandler(option, optarg);
-}
-
-unsigned long rlimitHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->rlimitHandler(option, optarg);
-}
-
-unsigned long rlimitPerHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException) {
- PrettyCheckArgument(handler != NULL, handler, s_third_argument_warning);
- return handler->rlimitPerHandler(option, optarg);
-}
-
-
-
-OptionsHandler::OptionsHandler() { }
-
-}/* CVC4::options namespace */
-}/* CVC4 namespace */
+++ /dev/null
-/********************* */
-/*! \file options_handler_interface.h
- ** \verbatim
- ** Original author: Tim King
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Interface for custom handlers and predicates options.
- **
- ** Interface for custom handlers and predicates options.
- **/
-
-#include "cvc4_private.h"
-
-#ifndef __CVC4__OPTIONS__OPTIONS_HANDLER_INTERFACE_H
-#define __CVC4__OPTIONS__OPTIONS_HANDLER_INTERFACE_H
-
-#include <ostream>
-#include <string>
-
-#include "base/modal_exception.h"
-#include "options/arith_heuristic_pivot_rule.h"
-#include "options/arith_propagation_mode.h"
-#include "options/arith_unate_lemma_mode.h"
-#include "options/boolean_term_conversion_mode.h"
-#include "options/bv_bitblast_mode.h"
-#include "options/decision_mode.h"
-#include "options/language.h"
-#include "options/option_exception.h"
-#include "options/printer_modes.h"
-#include "options/quantifiers_modes.h"
-#include "options/simplification_mode.h"
-#include "options/theoryof_mode.h"
-#include "options/ufss_mode.h"
-
-namespace CVC4 {
-class LogicInfo;
-}/* CVC4 namespace */
-
-namespace CVC4 {
-namespace options {
-
-class OptionsHandler {
-public:
- OptionsHandler();
- virtual ~OptionsHandler() {}
-
- void setOption(const std::string& key, const std::string& optionarg) throw(OptionException, ModalException);
-
- std::string getOption(const std::string& key) const throw(OptionException);
-
- // DONE
- // decision/options_handlers.h
- // expr/options_handlers.h
- // main/options_handlers.h
- // options/base_options_handlers.h
- // printer/options_handlers.h
- // smt/options_handlers.h
- // theory/options_handlers.h
- // theory/booleans/options_handlers.h
- // theory/uf/options_handlers.h
- // theory/bv/options_handlers.h
- // theory/quantifiers/options_handlers.h
- // theory/arith/options_handlers.h
-
-
- // theory/arith/options_handlers.h
- virtual ArithUnateLemmaMode stringToArithUnateLemmaMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual ArithPropagationMode stringToArithPropagationMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual ErrorSelectionRule stringToErrorSelectionRule(std::string option, std::string optarg) throw(OptionException) = 0;
-
- // theory/quantifiers/options_handlers.h
- virtual theory::quantifiers::InstWhenMode stringToInstWhenMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual void checkInstWhenMode(std::string option, theory::quantifiers::InstWhenMode mode) throw(OptionException) = 0;
- virtual theory::quantifiers::LiteralMatchMode stringToLiteralMatchMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual void checkLiteralMatchMode(std::string option, theory::quantifiers::LiteralMatchMode mode) throw(OptionException) = 0;
- virtual theory::quantifiers::MbqiMode stringToMbqiMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual void checkMbqiMode(std::string option, theory::quantifiers::MbqiMode mode) throw(OptionException) = 0;
- virtual theory::quantifiers::QcfWhenMode stringToQcfWhenMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::QcfMode stringToQcfMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::UserPatMode stringToUserPatMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::TriggerSelMode stringToTriggerSelMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::PrenexQuantMode stringToPrenexQuantMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::CegqiFairMode stringToCegqiFairMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::TermDbMode stringToTermDbMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::IteLiftQuantMode stringToIteLiftQuantMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::SygusInvTemplMode stringToSygusInvTemplMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::quantifiers::MacrosQuantMode stringToMacrosQuantMode(std::string option, std::string optarg) throw(OptionException) = 0;
-
- // theory/bv/options_handlers.h
- virtual void abcEnabledBuild(std::string option, bool value) throw(OptionException) = 0;
- virtual void abcEnabledBuild(std::string option, std::string value) throw(OptionException) = 0;
- virtual theory::bv::BitblastMode stringToBitblastMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual theory::bv::BvSlicerMode stringToBvSlicerMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual void setBitblastAig(std::string option, bool arg) throw(OptionException) = 0;
-
-
- // theory/booleans/options_handlers.h
- virtual theory::booleans::BooleanTermConversionMode stringToBooleanTermConversionMode(std::string option, std::string optarg) throw(OptionException) = 0;
-
- // theory/uf/options_handlers.h
- virtual theory::uf::UfssMode stringToUfssMode(std::string option, std::string optarg) throw(OptionException) = 0;
-
- // theory/options_handlers.h
- virtual theory::TheoryOfMode stringToTheoryOfMode(std::string option, std::string optarg) = 0;
- virtual void useTheory(std::string option, std::string optarg) = 0;
-
-
- // printer/options_handlers.h
- virtual ModelFormatMode stringToModelFormatMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual InstFormatMode stringToInstFormatMode(std::string option, std::string optarg) throw(OptionException) = 0;
-
- // decision/options_handlers.h
- virtual decision::DecisionMode stringToDecisionMode(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual decision::DecisionWeightInternal stringToDecisionWeightInternal(std::string option, std::string optarg) throw(OptionException) = 0;
-
-
- /* smt/options_handlers.h */
- virtual void dumpMode(std::string option, std::string optarg) = 0;
- virtual LogicInfo* stringToLogicInfo(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual SimplificationMode stringToSimplificationMode(std::string option, std::string optarg) throw(OptionException) = 0;
-
- virtual void beforeSearch(std::string option, bool value) throw(ModalException) = 0;
- virtual void setProduceAssertions(std::string option, bool value) throw() = 0;
- virtual void proofEnabledBuild(std::string option, bool value) throw(OptionException) = 0;
- virtual void dumpToFile(std::string option, std::string optarg) = 0;
- virtual void setRegularOutputChannel(std::string option, std::string optarg) = 0;
- virtual void setDiagnosticOutputChannel(std::string option, std::string optarg) = 0;
- virtual std::string checkReplayFilename(std::string option, std::string optarg) = 0;
- virtual void statsEnabledBuild(std::string option, bool value) throw(OptionException) = 0;
- virtual unsigned long tlimitHandler(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual unsigned long tlimitPerHandler(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual unsigned long rlimitHandler(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual unsigned long rlimitPerHandler(std::string option, std::string optarg) throw(OptionException) = 0;
-
- /* expr/options_handlers.h */
- virtual void setDefaultExprDepth(std::string option, int depth) = 0;
- virtual void setDefaultDagThresh(std::string option, int dag) = 0;
- virtual void setPrintExprTypes(std::string option) = 0;
-
- /* main/options_handlers.h */
- virtual void showConfiguration(std::string option) = 0;
- virtual void showDebugTags(std::string option) = 0;
- virtual void showTraceTags(std::string option) = 0;
- virtual void threadN(std::string option) = 0;
-
- /* options/base_options_handlers.h */
- virtual void setVerbosity(std::string option, int value) throw(OptionException) = 0;
- virtual void increaseVerbosity(std::string option) = 0;
- virtual void decreaseVerbosity(std::string option) = 0;
- virtual OutputLanguage stringToOutputLanguage(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual InputLanguage stringToInputLanguage(std::string option, std::string optarg) throw(OptionException) = 0;
- virtual void addTraceTag(std::string option, std::string optarg) = 0;
- virtual void addDebugTag(std::string option, std::string optarg) = 0;
- virtual void setPrintSuccess(std::string option, bool value) = 0;
-}; /* class OptionHandler */
-
-// theory/arith/options_handlers.h
-ArithUnateLemmaMode stringToArithUnateLemmaMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-ArithPropagationMode stringToArithPropagationMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-ErrorSelectionRule stringToErrorSelectionRule(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-// theory/quantifiers/options_handlers.h
-theory::quantifiers::InstWhenMode stringToInstWhenMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-void checkInstWhenMode(std::string option, theory::quantifiers::InstWhenMode mode, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::LiteralMatchMode stringToLiteralMatchMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-void checkLiteralMatchMode(std::string option, theory::quantifiers::LiteralMatchMode mode, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::MbqiMode stringToMbqiMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-void checkMbqiMode(std::string option, theory::quantifiers::MbqiMode mode, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::QcfWhenMode stringToQcfWhenMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::QcfMode stringToQcfMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::UserPatMode stringToUserPatMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::TriggerSelMode stringToTriggerSelMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::PrenexQuantMode stringToPrenexQuantMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::CegqiFairMode stringToCegqiFairMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::TermDbMode stringToTermDbMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::IteLiftQuantMode stringToIteLiftQuantMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::SygusInvTemplMode stringToSygusInvTemplMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::quantifiers::MacrosQuantMode stringToMacrosQuantMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-
-// theory/bv/options_handlers.h
-void abcEnabledBuild(std::string option, bool value, OptionsHandler* handler) throw(OptionException);
-void abcEnabledBuild(std::string option, std::string value, OptionsHandler* handler) throw(OptionException);
-theory::bv::BitblastMode stringToBitblastMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-theory::bv::BvSlicerMode stringToBvSlicerMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-void setBitblastAig(std::string option, bool arg, OptionsHandler* handler) throw(OptionException);
-
-// theory/booleans/options_handlers.h
-theory::booleans::BooleanTermConversionMode stringToBooleanTermConversionMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-// theory/uf/options_handlers.h
-theory::uf::UfssMode stringToUfssMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-
-// theory/options_handlers.h
-theory::TheoryOfMode stringToTheoryOfMode(std::string option, std::string optarg, OptionsHandler* handler);
-void useTheory(std::string option, std::string optarg, OptionsHandler* handler);
-
-// printer/options_handlers.h
-ModelFormatMode stringToModelFormatMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-InstFormatMode stringToInstFormatMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-// decision/options_handlers.h
-decision::DecisionMode stringToDecisionMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-decision::DecisionWeightInternal stringToDecisionWeightInternal(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-
-/* options/base_options_handlers.h */
-void setVerbosity(std::string option, int value, OptionsHandler* handler) throw(OptionException);
-void increaseVerbosity(std::string option, OptionsHandler* handler);
-void decreaseVerbosity(std::string option, OptionsHandler* handler);
-OutputLanguage stringToOutputLanguage(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-InputLanguage stringToInputLanguage(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-void addTraceTag(std::string option, std::string optarg, OptionsHandler* handler);
-void addDebugTag(std::string option, std::string optarg, OptionsHandler* handler);
-void setPrintSuccess(std::string option, bool value, OptionsHandler* handler);
-
-/* main/options_handlers.h */
-void showConfiguration(std::string option, OptionsHandler* handler);
-void showDebugTags(std::string option, OptionsHandler* handler);
-void showTraceTags(std::string option, OptionsHandler* handler);
-void threadN(std::string option, OptionsHandler* handler);
-
-/* expr/options_handlers.h */
-void setDefaultExprDepth(std::string option, int depth, OptionsHandler* handler);
-void setDefaultDagThresh(std::string option, int dag, OptionsHandler* handler);
-void setPrintExprTypes(std::string option, OptionsHandler* handler);
-
-/* smt/options_handlers.h */
-void dumpMode(std::string option, std::string optarg, OptionsHandler* handler);
-
-LogicInfo* stringToLogicInfo(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-SimplificationMode stringToSimplificationMode(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-// ensure we haven't started search yet
-void beforeSearch(std::string option, bool value, OptionsHandler* handler) throw(ModalException);
-
-void setProduceAssertions(std::string option, bool value, OptionsHandler* handler) throw();
-
-// ensure we are a proof-enabled build of CVC4
-void proofEnabledBuild(std::string option, bool value, OptionsHandler* handler) throw(OptionException);
-
-void dumpToFile(std::string option, std::string optarg, OptionsHandler* handler);
-
-void setRegularOutputChannel(std::string option, std::string optarg, OptionsHandler* handler);
-
-void setDiagnosticOutputChannel(std::string option, std::string optarg, OptionsHandler* handler);
-
-std::string checkReplayFilename(std::string option, std::string optarg, OptionsHandler* handler);
-
-// ensure we are a stats-enabled build of CVC4
-void statsEnabledBuild(std::string option, bool value, OptionsHandler* handler) throw(OptionException);
-
-unsigned long tlimitHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-unsigned long tlimitPerHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-unsigned long rlimitHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-unsigned long rlimitPerHandler(std::string option, std::string optarg, OptionsHandler* handler) throw(OptionException);
-
-
-}/* CVC4::options namespace */
-}/* CVC4 namespace */
-
-#endif /* __CVC4__OPTIONS__OPTIONS_HANDLER_INTERFACE_H */
+++ /dev/null
-%{
-#include "options/options_handler_interface.h"
-%}
-
-%include "options/options_handler_interface.h"
+++ /dev/null
-/********************* */
-/*! \file option_handler_set_option_template.cpp
- ** \verbatim
- ** Original author: Morgan Deters
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Implementation of OptionsHandler::setOption.
- **
- ** This template file is expanded into the cpp implementation of
- ** OptionsHandler::setOption. The file is essentially the contents
- ** of the ${smt_setoption_handlers} variable in the options/mkoptions
- ** script. This variable depends on all options files. To generate this file,
- ** first generate options/summary.sed.
- **/
-
-#include <string>
-#include <sstream>
-
-#include "base/output.h"
-#include "base/modal_exception.h"
-#include "options/option_exception.h"
-#include "options/options_handler_interface.h"
-
-
-${include_all_option_headers}
-${option_handler_includes}
-
-#line 31 "${template}"
-
-using namespace std;
-
-namespace CVC4 {
-namespace options {
-
-void OptionsHandler::setOption(const std::string& key, const std::string& optionarg)
- throw(OptionException, ModalException) {
- options::OptionsHandler* const handler = this;
- Trace("options") << "SMT setOption(" << key << ", " << optionarg << ")" << endl;
-
- ${smt_setoption_handlers}
-
-#line 44 "${template}"
-
- throw UnrecognizedOptionException(key);
-}
-
-}/* options namespace */
-}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file options_public_functions.cpp
+ ** \verbatim
+ ** Original author: Morgan Deters
+ ** Major contributors: none
+ ** Minor contributors (to current version): Kshitij Bansal
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Definitions of public facing interface functions for Options.
+ **
+ ** Definitions of public facing interface functions for Options. These are
+ ** all 1 line wrappers for Options::get<T>, Options::set<T>, and
+ ** Options::wasSetByUser<T> for different option types T.
+ **/
+
+#include "options.h"
+
+#include <fstream>
+#include <ostream>
+#include <string>
+#include <vector>
+
+#include "base/listener.h"
+#include "base/modal_exception.h"
+#include "base/tls.h"
+#include "options/base_options.h"
+#include "options/language.h"
+#include "options/main_options.h"
+#include "options/parser_options.h"
+#include "options/printer_modes.h"
+#include "options/printer_options.h"
+#include "options/option_exception.h"
+#include "options/smt_options.h"
+#include "options/quantifiers_options.h"
+
+namespace CVC4 {
+
+// Get accessor functions.
+InputLanguage Options::getInputLanguage() const {
+ return (*this)[options::inputLanguage];
+}
+
+InstFormatMode Options::getInstFormatMode() const {
+ return (*this)[options::instFormatMode];
+}
+
+OutputLanguage Options::getOutputLanguage() const {
+ return (*this)[options::outputLanguage];
+}
+
+bool Options::getCheckProofs() const{
+ return (*this)[options::checkProofs];
+}
+
+bool Options::getContinuedExecution() const{
+ return (*this)[options::continuedExecution];
+}
+
+bool Options::getDumpInstantiations() const{
+ return (*this)[options::dumpInstantiations];
+}
+
+bool Options::getDumpModels() const{
+ return (*this)[options::dumpModels];
+}
+
+bool Options::getDumpProofs() const{
+ return (*this)[options::dumpProofs];
+}
+
+bool Options::getDumpSynth() const{
+ return (*this)[options::dumpSynth];
+}
+
+bool Options::getDumpUnsatCores() const{
+ return (*this)[options::dumpUnsatCores];
+}
+
+bool Options::getEarlyExit() const{
+ return (*this)[options::earlyExit];
+}
+
+bool Options::getFallbackSequential() const{
+ return (*this)[options::fallbackSequential];
+}
+
+bool Options::getFilesystemAccess() const{
+ return (*this)[options::filesystemAccess];
+}
+
+bool Options::getForceNoLimitCpuWhileDump() const{
+ return (*this)[options::forceNoLimitCpuWhileDump];
+}
+
+bool Options::getHelp() const{
+ return (*this)[options::help];
+}
+
+bool Options::getIncrementalParallel() const{
+ return (*this)[options::incrementalParallel];
+}
+
+bool Options::getIncrementalSolving() const{
+ return (*this)[options::incrementalSolving];
+}
+
+bool Options::getInteractive() const{
+ return (*this)[options::interactive];
+}
+
+bool Options::getInteractivePrompt() const{
+ return (*this)[options::interactivePrompt];
+}
+
+bool Options::getLanguageHelp() const{
+ return (*this)[options::languageHelp];
+}
+
+bool Options::getMemoryMap() const{
+ return (*this)[options::memoryMap];
+}
+
+bool Options::getParseOnly() const{
+ return (*this)[options::parseOnly];
+}
+
+bool Options::getProduceModels() const{
+ return (*this)[options::produceModels];
+}
+
+bool Options::getProof() const{
+ return (*this)[options::proof];
+}
+
+bool Options::getSegvSpin() const{
+ return (*this)[options::segvSpin];
+}
+
+bool Options::getSemanticChecks() const{
+ return (*this)[options::semanticChecks];
+}
+
+bool Options::getStatistics() const{
+ return (*this)[options::statistics];
+}
+
+bool Options::getStatsEveryQuery() const{
+ return (*this)[options::statsEveryQuery];
+}
+
+bool Options::getStatsHideZeros() const{
+ return (*this)[options::statsHideZeros];
+}
+
+bool Options::getStrictParsing() const{
+ return (*this)[options::strictParsing];
+}
+
+bool Options::getTearDownIncremental() const{
+ return (*this)[options::tearDownIncremental];
+}
+
+bool Options::getVersion() const{
+ return (*this)[options::version];
+}
+
+bool Options::getWaitToJoin() const{
+ return (*this)[options::waitToJoin];
+}
+
+const std::string& Options::getForceLogicString() const{
+ return (*this)[options::forceLogicString];
+}
+
+const std::vector<std::string>& Options::getThreadArgv() const{
+ return (*this)[options::threadArgv];
+}
+
+int Options::getSharingFilterByLength() const{
+ return (*this)[options::sharingFilterByLength];
+}
+
+int Options::getThreadId() const{
+ return (*this)[options::thread_id];
+}
+
+int Options::getVerbosity() const{
+ return (*this)[options::verbosity];
+}
+
+std::istream* Options::getIn() const{
+ return (*this)[options::in];
+}
+
+std::ostream* Options::getErr(){
+ return (*this)[options::err];
+}
+
+std::ostream* Options::getOut(){
+ return (*this)[options::out];
+}
+
+std::ostream* Options::getOutConst() const{
+#warning "Remove Options::getOutConst"
+ return (*this)[options::out];
+}
+
+std::string Options::getBinaryName() const{
+ return (*this)[options::binary_name];
+}
+
+std::string Options::getReplayInputFilename() const{
+ return (*this)[options::replayInputFilename];
+}
+
+unsigned Options::getParseStep() const{
+ return (*this)[options::parseStep];
+}
+
+unsigned Options::getThreadStackSize() const{
+ return (*this)[options::threadStackSize];
+}
+
+unsigned Options::getThreads() const{
+ return (*this)[options::threads];
+}
+
+int Options::currentGetSharingFilterByLength() {
+ return current()->getSharingFilterByLength();
+}
+
+int Options::currentGetThreadId() {
+ return current()->getThreadId();
+}
+
+std::ostream* Options::currentGetOut() {
+ return current()->getOut();
+}
+
+
+// TODO: Document these.
+void Options::setCeGuidedInst(bool value) {
+ set(options::ceGuidedInst, value);
+}
+
+void Options::setDumpSynth(bool value) {
+ set(options::dumpSynth, value);
+}
+
+void Options::setInputLanguage(InputLanguage value) {
+ set(options::inputLanguage, value);
+}
+
+void Options::setInteractive(bool value) {
+ set(options::interactive, value);
+}
+
+void Options::setOut(std::ostream* value) {
+ set(options::out, value);
+}
+
+void Options::setOutputLanguage(OutputLanguage value) {
+ set(options::outputLanguage, value);
+}
+
+void Options::setSharingFilterByLength(int length) {
+ set(options::sharingFilterByLength, length);
+}
+
+void Options::setThreadId(int value) {
+ set(options::thread_id, value);
+}
+
+bool Options::wasSetByUserCeGuidedInst() const {
+ return wasSetByUser(options::ceGuidedInst);
+}
+
+bool Options::wasSetByUserDumpSynth() const {
+ return wasSetByUser(options::dumpSynth);
+}
+
+bool Options::wasSetByUserEarlyExit() const {
+ return wasSetByUser(options::earlyExit);
+}
+
+bool Options::wasSetByUserForceLogicString() const {
+ return wasSetByUser(options::forceLogicString);
+}
+
+bool Options::wasSetByUserIncrementalSolving() const {
+ return wasSetByUser(options::incrementalSolving);
+}
+
+bool Options::wasSetByUserInteractive() const {
+ return wasSetByUser(options::interactive);
+}
+
+bool Options::wasSetByUserThreadStackSize() const {
+ return wasSetByUser(options::threadStackSize);
+}
+
+bool Options::wasSetByUserThreads() const {
+ return wasSetByUser(options::threads);
+}
+
+
+void Options::flushErr() {
+ if(getErr() != NULL) {
+ *(getErr()) << std::flush;
+ }
+}
+
+void Options::flushOut() {
+ if(getOut() != NULL) {
+ *(getOut()) << std::flush;
+ }
+}
+
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file option_handler_set_option_template.cpp
+ ** \verbatim
+ ** Original author: Morgan Deters
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2014 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Implementation of OptionsHandler::setOption.
+ **
+ ** This template file is expanded into the cpp implementation of
+ ** OptionsHandler::setOption. The file is essentially the contents
+ ** of the ${smt_setoption_handlers} variable in the options/mkoptions
+ ** script. This variable depends on all options files. To generate this file,
+ ** first generate options/summary.sed.
+ **/
+
+
+#include <string>
+#include <sstream>
+
+#include "base/modal_exception.h"
+#include "base/output.h"
+#include "options/option_exception.h"
+#include "options/options.h"
+#include "options/options_handler.h"
+
+${include_all_option_headers}
+${option_handler_includes}
+
+#line 35 "${template}"
+
+using namespace std;
+
+namespace CVC4 {
+
+void Options::setOption(const std::string& key, const std::string& optionarg)
+ throw(OptionException, ModalException) {
+ options::OptionsHandler* handler = d_handler;
+ Trace("options") << "SMT setOption(" << key << ", " << optionarg << ")" << endl;
+
+ ${smt_setoption_handlers}
+
+#line 48 "${template}"
+
+ throw UnrecognizedOptionException(key);
+}
+
+}/* CVC4 namespace */
#include "base/exception.h"
#include "base/output.h"
#include "base/tls.h"
+#include "options/argument_extender.h"
#include "options/didyoumean.h"
#include "options/language.h"
-#include "options/options_handler_interface.h"
+#include "options/options_handler.h"
${include_all_option_headers}
-#line 58 "${template}"
+#line 63 "${template}"
#include "options/options_holder.h"
#include "cvc4autoconfig.h"
${option_handler_includes}
-#line 67 "${template}"
+#line 71 "${template}"
using namespace CVC4;
using namespace CVC4::options;
CVC4_THREADLOCAL(Options*) Options::s_current = NULL;
+
+
/**
* This is a default handler for options of built-in C++ type. This
* template is really just a helper for the handleOption() template,
bool success = stringToInt(i, optionarg);
if(!success){
- throw OptionException(option + ": failed to parse "+ optionarg +" as an integer of the appropraite type.");
+ throw OptionException(option + ": failed to parse "+ optionarg +
+ " as an integer of the appropraite type.");
}
// Depending in the platform unsigned numbers with '-' signs may parse.
} else if(i < std::numeric_limits<T>::min()) {
// negative overflow for type
std::stringstream ss;
- ss << option << " requires an argument >= " << std::numeric_limits<T>::min();
+ ss << option << " requires an argument >= "
+ << std::numeric_limits<T>::min();
throw OptionException(ss.str());
} else if(i > std::numeric_limits<T>::max()) {
// positive overflow for type
std::stringstream ss;
- ss << option << " requires an argument <= " << std::numeric_limits<T>::max();
+ ss << option << " requires an argument <= "
+ << std::numeric_limits<T>::max();
throw OptionException(ss.str());
}
} else if(r < -std::numeric_limits<T>::max()) {
// negative overflow for type
std::stringstream ss;
- ss << option << " requires an argument >= " << -std::numeric_limits<T>::max();
+ ss << option << " requires an argument >= "
+ << -std::numeric_limits<T>::max();
throw OptionException(ss.str());
} else if(r > std::numeric_limits<T>::max()) {
// positive overflow for type
std::stringstream ss;
- ss << option << " requires an argument <= " << std::numeric_limits<T>::max();
+ ss << option << " requires an argument <= "
+ << std::numeric_limits<T>::max();
throw OptionException(ss.str());
}
// that can throw exceptions.
}
+
+Options::Options()
+ : d_holder(new options::OptionsHolder())
+ , d_handler(new options::OptionsHandler(this))
+ , d_forceLogicListeners()
+ , d_beforeSearchListeners()
+ , d_tlimitListeners()
+ , d_tlimitPerListeners()
+ , d_rlimitListeners()
+ , d_rlimitPerListeners()
+{}
+
+Options::~Options() {
+ delete d_handler;
+ delete d_holder;
+}
+
+void Options::copyValues(const Options& options){
+ if(this != &options) {
+ delete d_holder;
+ d_holder = new options::OptionsHolder(*options.d_holder);
+ }
+}
+
+std::string Options::formatThreadOptionException(const std::string& option) {
+ std::stringstream ss;
+ ss << "can't understand option `" << option
+ << "': expected something like --threadN=\"--option1 --option2\","
+ << " where N is a nonnegative integer";
+ return ss.str();
+}
+
+ListenerCollection::Registration* Options::registerAndNotify(
+ ListenerCollection& collection, Listener* listener, bool notify)
+{
+ ListenerCollection::Registration* registration =
+ collection.registerListener(listener);
+ if(notify) {
+ listener->notify();
+ }
+ return registration;
+}
+
+ListenerCollection::Registration* Options::registerForceLogicListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::forceLogicString);
+ return registerAndNotify(d_forceLogicListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerBeforeSearchListener(
+ Listener* listener)
+{
+ return d_beforeSearchListeners.registerListener(listener);
+}
+
+ListenerCollection::Registration* Options::registerTlimitListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet &&
+ wasSetByUser(options::cumulativeMillisecondLimit);
+ return registerAndNotify(d_tlimitListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerTlimitPerListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::perCallMillisecondLimit);
+ return registerAndNotify(d_tlimitPerListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerRlimitListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::cumulativeResourceLimit);
+ return registerAndNotify(d_rlimitListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerRlimitPerListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::perCallResourceLimit);
+ return registerAndNotify(d_rlimitPerListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerUseTheoryListListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::useTheoryList);
+ return registerAndNotify(d_useTheoryListListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerSetDefaultExprDepthListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::defaultExprDepth);
+ return registerAndNotify(d_setDefaultExprDepthListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerSetDefaultExprDagListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::defaultDagThresh);
+ return registerAndNotify(d_setDefaultDagThreshListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerSetPrintExprTypesListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::printExprTypes);
+ return registerAndNotify(d_setPrintExprTypesListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerSetDumpModeListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::dumpModeString);
+ return registerAndNotify(d_setDumpModeListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerSetPrintSuccessListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::printSuccess);
+ return registerAndNotify(d_setPrintSuccessListeners, listener, notify);
+}
+
+ListenerCollection::Registration* Options::registerDumpToFileNameListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::dumpToFileName);
+ return registerAndNotify(d_dumpToFileListeners, listener, notify);
+}
+
+ListenerCollection::Registration*
+Options::registerSetRegularOutputChannelListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::regularChannelName);
+ return registerAndNotify(d_setRegularChannelListeners, listener, notify);
+}
+
+ListenerCollection::Registration*
+Options::registerSetDiagnosticOutputChannelListener(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::diagnosticChannelName);
+ return registerAndNotify(d_setDiagnosticChannelListeners, listener, notify);
+}
+
+ListenerCollection::Registration*
+Options::registerSetReplayLogFilename(
+ Listener* listener, bool notifyIfSet)
+{
+ bool notify = notifyIfSet && wasSetByUser(options::replayLogFilename);
+ return registerAndNotify(d_setReplayFilenameListeners, listener, notify);
+}
+
${all_custom_handlers}
-#line 204 "${template}"
+#line 393 "${template}"
#ifdef CVC4_DEBUG
# define USE_EARLY_TYPE_CHECKING_BY_DEFAULT true
# define DO_SEMANTIC_CHECKS_BY_DEFAULT true
#endif /* CVC4_MUZZLED || CVC4_COMPETITION_MODE */
-Options::Options() :
- d_holder(new options::OptionsHolder()) {
-}
-
-Options::Options(const Options& options) :
- d_holder(new options::OptionsHolder(*options.d_holder)) {
-}
-
-Options::~Options() {
- delete d_holder;
-}
-
-Options& Options::operator=(const Options& options) {
- if(this != &options) {
- delete d_holder;
- d_holder = new options::OptionsHolder(*options.d_holder);
- }
- return *this;
-}
-
options::OptionsHolder::OptionsHolder() : ${all_modules_defaults}
{
}
-#line 242 "${template}"
+#line 411 "${template}"
static const std::string mostCommonOptionsDescription = "\
Most commonly-used CVC4 options:${common_documentation}";
-#line 247 "${template}"
+#line 416 "${template}"
static const std::string optionsDescription = mostCommonOptionsDescription + "\n\
\n\
Additional CVC4 options:${remaining_documentation}";
-#line 253 "${template}"
+#line 422 "${template}"
static const std::string optionsFootnote = "\n\
[*] Each of these options has a --no-OPTIONNAME variant, which reverses the\n\
void Options::printShortUsage(const std::string msg, std::ostream& out) {
out << msg << mostCommonOptionsDescription << std::endl
<< optionsFootnote << std::endl
- << "For full usage, please use --help." << std::endl << std::endl << std::flush;
+ << "For full usage, please use --help."
+ << std::endl << std::endl << std::flush;
}
void Options::printLanguageHelp(std::ostream& out) {
{ NULL, no_argument, NULL, '\0' }
};/* cmdlineOptions */
-#line 330 "${template}"
+#line 501 "${template}"
-static void preemptGetopt(int& argc, char**& argv, const char* opt) {
- const size_t maxoptlen = 128;
+// static void preemptGetopt(int& argc, char**& argv, const char* opt) {
- Debug("preemptGetopt") << "preempting getopt() with " << opt << std::endl;
+// Debug("preemptGetopt") << "preempting getopt() with " << opt << std::endl;
- AlwaysAssert(opt != NULL && *opt != '\0');
- AlwaysAssert(strlen(opt) <= maxoptlen);
+// AlwaysAssert(opt != NULL && *opt != '\0');
+// AlwaysAssert(strlen(opt) <= maxoptlen);
- ++argc;
- unsigned i = 1;
- while(argv[i] != NULL && argv[i][0] != '\0') {
- ++i;
- }
+// ++argc;
+// unsigned i = 1;
+// while(argv[i] != NULL && argv[i][0] != '\0') {
+// ++i;
+// }
- if(argv[i] == NULL) {
- argv = (char**) realloc(argv, (i + 6) * sizeof(char*));
- for(unsigned j = i; j < i + 5; ++j) {
- argv[j] = (char*) malloc(sizeof(char) * maxoptlen);
- argv[j][0] = '\0';
- }
- argv[i + 5] = NULL;
- }
+// if(argv[i] == NULL) {
+// argv = (char**) realloc(argv, (i + 6) * sizeof(char*));
+// for(unsigned j = i; j < i + 5; ++j) {
+// argv[j] = (char*) malloc(sizeof(char) * maxoptlen);
+// argv[j][0] = '\0';
+// }
+// argv[i + 5] = NULL;
+// }
- strncpy(argv[i], opt, maxoptlen - 1);
- argv[i][maxoptlen - 1] = '\0'; // ensure NUL-termination even on overflow
-}
+// strncpy(argv[i], opt, maxoptlen - 1);
+// argv[i][maxoptlen - 1] = '\0'; // ensure NUL-termination even on overflow
+// }
namespace options {
* The return value is what's left of the command line (that is, the
* non-option arguments).
*/
-std::vector<std::string> Options::parseOptions(int argc, char* main_argv[], options::OptionsHandler* const handler) throw(OptionException) {
+std::vector<std::string> Options::parseOptions(int argc, char* main_argv[]) throw(OptionException) {
options::OptionsGuard guard(&s_current, this);
+ // Having this synonym simplifies the generation code in mkoptions.
+ options::OptionsHandler* handler = d_handler;
+
const char *progName = main_argv[0];
+ ArgumentExtender argumentExtender(s_preemptAdditional, s_maxoptlen);
+ std::vector<char*> allocated;
+
Debug("options") << "main_argv == " << main_argv << std::endl;
// Reset getopt(), in the case of multiple calls to parseOptions().
int c = -1;
optopt = 0;
std::string option, optionarg;
- Debug("preemptGetopt") << "top of loop, extra_optind == " << extra_optind << ", extra_argc == " << extra_argc << std::endl;
+ Debug("preemptGetopt") << "top of loop, extra_optind == " << extra_optind
+ << ", extra_argc == " << extra_argc << std::endl;
if((extra_optind == 0 ? 1 : extra_optind) < extra_argc) {
#if HAVE_DECL_OPTRESET
if(optind_ref != &extra_optind) {
old_optind = optind = extra_optind;
optind_ref = &extra_optind;
argv = extra_argv;
- Debug("preemptGetopt") << "in preempt code, next arg is " << extra_argv[optind == 0 ? 1 : optind] << std::endl;
+ Debug("preemptGetopt") << "in preempt code, next arg is "
+ << extra_argv[optind == 0 ? 1 : optind]
+ << std::endl;
if(extra_argv[extra_optind == 0 ? 1 : extra_optind][0] != '-') {
- InternalError("preempted args cannot give non-options command-line args (found `%s')", extra_argv[extra_optind == 0 ? 1 : extra_optind]);
+ InternalError(
+ "preempted args cannot give non-options command-line args (found `%s')",
+ extra_argv[extra_optind == 0 ? 1 : extra_optind]);
}
c = getopt_long(extra_argc, extra_argv,
"+:${all_modules_short_options}",
cmdlineOptions, NULL);
- Debug("preemptGetopt") << "in preempt code, c == " << c << " (`" << char(c) << "') optind == " << optind << std::endl;
+ Debug("preemptGetopt") << "in preempt code"
+ << ", c == " << c << " (`" << char(c) << "')"
+ << " optind == " << optind << std::endl;
if(optopt == 0 ||
( optopt >= ${long_option_value_begin} && optopt <= ${long_option_value_end} )) {
// long option
Debug("options") << "I restored optind to " << optind << std::endl;*/
}
#endif /* __MINGW32__ || __MINGW64__ */
- Debug("options") << "[ argc == " << argc << ", main_argv == " << main_argv << " ]" << std::endl;
+ Debug("options") << "[ argc == " << argc
+ << ", main_argv == " << main_argv << " ]" << std::endl;
c = getopt_long(argc, main_argv,
"+:${all_modules_short_options}",
cmdlineOptions, NULL);
main_optind = optind;
- Debug("options") << "[ got " << int(c) << " (" << char(c) << ") ]" << std::endl;
- Debug("options") << "[ next option will be at pos: " << optind << " ]" << std::endl;
+ Debug("options") << "[ got " << int(c) << " (" << char(c) << ") ]"
+ << std::endl;
+ Debug("options") << "[ next option will be at pos: " << optind << " ]"
+ << std::endl;
if(c == -1) {
Debug("options") << "done with option parsing" << std::endl;
break;
optionarg = (optarg == NULL) ? "" : optarg;
}
- Debug("preemptGetopt") << "processing option " << c << " (`" << char(c) << "'), " << option << std::endl;
+ Debug("preemptGetopt") << "processing option " << c
+ << " (`" << char(c) << "'), " << option << std::endl;
switch(c) {
${all_modules_option_handlers}
-#line 523 "${template}"
+#line 709 "${template}"
case ':':
// This can be a long or short option, and the way to get at the
!strncmp(argv[optind - 1], "--thread", 8) &&
strlen(argv[optind - 1]) > 8 ) {
if(! isdigit(argv[optind - 1][8])) {
- throw OptionException(std::string("can't understand option `") + option + "': expected something like --threadN=\"--option1 --option2\", where N is a nonnegative integer");
+ throw OptionException(formatThreadOptionException(option));
}
std::vector<std::string>& threadArgv = d_holder->threadArgv;
char *end;
long tnum = strtol(argv[optind - 1] + 8, &end, 10);
if(tnum < 0 || (*end != '\0' && *end != '=')) {
- throw OptionException(std::string("can't understand option `") + option + "': expected something like --threadN=\"--option1 --option2\", where N is a nonnegative integer");
+ throw OptionException(formatThreadOptionException(option));
}
if(threadArgv.size() <= size_t(tnum)) {
threadArgv.resize(tnum + 1);
}
if(*end == '\0') { // e.g., we have --thread0 "foo"
if(argc <= optind) {
- throw OptionException(std::string("option `") + option + "' missing its required argument");
+ throw OptionException(std::string("option `") + option
+ + "' missing its required argument");
}
- Debug("options") << "thread " << tnum << " gets option " << argv[optind] << std::endl;
+ Debug("options") << "thread " << tnum << " gets option "
+ << argv[optind] << std::endl;
threadArgv[tnum] += argv[(*optind_ref)++];
} else { // e.g., we have --thread0="foo"
if(end[1] == '\0') {
- throw OptionException(std::string("option `") + option + "' missing its required argument");
+ throw OptionException(std::string("option `") + option +
+ "' missing its required argument");
}
- Debug("options") << "thread " << tnum << " gets option " << (end + 1) << std::endl;
+ Debug("options") << "thread " << tnum << " gets option " << (end + 1)
+ << std::endl;
threadArgv[tnum] += end + 1;
}
- Debug("options") << "thread " << tnum << " now has " << threadArgv[tnum] << std::endl;
+ Debug("options") << "thread " << tnum << " now has " << threadArgv[tnum]
+ << std::endl;
break;
}
- throw OptionException(std::string("can't understand option `") + option + "'"
- + suggestCommandLineOptions(option));
+ throw OptionException(std::string("can't understand option `") + option +
+ "'" + suggestCommandLineOptions(option));
}
}
Debug("options") << "returning " << nonOptions.size() << " non-option arguments." << std::endl;
free(extra_argv);
+ for(std::vector<char*>::iterator i = allocated.begin(), iend = allocated.end();
+ i != iend; ++i)
+ {
+ char* current = *i;
+ #warning "TODO: Unit tests fail if garbage collection is done here."
+ //free(current);
+ }
+ allocated.clear();
return nonOptions;
}
static const char* smtOptions[] = {
${all_modules_smt_options},
-#line 592 "${template}"
+#line 790 "${template}"
NULL
};/* smtOptions[] */
${all_modules_get_options}
-#line 614 "${template}"
+#line 813 "${template}"
return opts;
}
+
#undef USE_EARLY_TYPE_CHECKING_BY_DEFAULT
#undef DO_SEMANTIC_CHECKS_BY_DEFAULT
option memoryMap --mmap bool
memory map file input
-option semanticChecks /--no-checking bool :default DO_SEMANTIC_CHECKS_BY_DEFAULT :link /--no-type-checking
+option semanticChecks semantic-checks /--no-checking bool :default DO_SEMANTIC_CHECKS_BY_DEFAULT :link /--no-type-checking
disable ALL semantic checks, including type checks
option globalDeclarations global-declarations bool :default false
force all declarations and definitions to be global
-# this is to support security in the online version, and in other similar contexts
-# (--no-include-file disables filesystem access in TPTP and SMT2 parsers)
-# the name --no-include-file is legacy: it also now limits any filesystem access
-# (read or write) for example by using --dump-to (or the equivalent set-option) or
-# set-option :regular-output-channel/:diagnostic-output-channel. However, the main
-# driver is still permitted to read the input file given on the command-line if any.
-# creation/use of temp files are still permitted (but the paths aren't given by the
-# user). Also note this is only safe for the version invoked through the main driver,
-# there are ways via the API to get the CVC4 library to open a file for reading or
-# writing and thus leak information from an existing file, or overwrite an existing
-# file with malicious content.
-undocumented-option filesystemAccess /--no-filesystem-access bool :default true
+# this is to support security in the online version, and in other similar
+# contexts (--no-include-file disables filesystem access in TPTP and SMT2
+# parsers) the name --no-include-file is legacy: it also now limits any
+# filesystem access (read or write) for example by using --dump-to (or the
+# equivalent set-option) or set-option
+# :regular-output-channel/:diagnostic-output-channel. However, the main driver
+# is still permitted to read the input file given on the command-line if any.
+# creation/use of temp files are still permitted (but the paths aren't given by
+# the user). Also note this is only safe for the version invoked through the
+# main driver, there are ways via the API to get the CVC4 library to open a file
+# for reading or writing and thus leak information from an existing file, or
+# overwrite an existing file with malicious content.
+undocumented-option filesystemAccess filesystem-access /--no-filesystem-access bool :default true
undocumented-alias --no-include-file = --no-filesystem-access
endmodule
namespace CVC4 {
/** Enumeration of model_format modes (how to print models from get-model command). */
-typedef enum {
+enum CVC4_PUBLIC ModelFormatMode {
/** default mode (print expressions in the output language format) */
MODEL_FORMAT_MODE_DEFAULT,
/** print functional values in a table format */
MODEL_FORMAT_MODE_TABLE,
-} ModelFormatMode;
+};
/** Enumeration of inst_format modes (how to print models from get-model command). */
-typedef enum {
+enum CVC4_PUBLIC InstFormatMode {
/** default mode (print expressions in the output language format) */
INST_FORMAT_MODE_DEFAULT,
/** print as SZS proof */
INST_FORMAT_MODE_SZS,
-} InstFormatMode;
+};
std::ostream& operator<<(std::ostream& out, ModelFormatMode mode) CVC4_PUBLIC;
std::ostream& operator<<(std::ostream& out, InstFormatMode mode) CVC4_PUBLIC;
module PRINTER "options/printer_options.h" Printing
-option modelFormatMode --model-format=MODE ModelFormatMode :handler CVC4::options::stringToModelFormatMode :default MODEL_FORMAT_MODE_DEFAULT :read-write :include "options/printer_modes.h" :handler-include "options/options_handler_interface.h"
+option modelFormatMode --model-format=MODE ModelFormatMode :handler stringToModelFormatMode :default MODEL_FORMAT_MODE_DEFAULT :read-write :include "options/printer_modes.h"
print format mode for models, see --model-format=help
-option instFormatMode --inst-format=MODE InstFormatMode :handler CVC4::options::stringToInstFormatMode :default INST_FORMAT_MODE_DEFAULT :read-write :include "options/printer_modes.h" :handler-include "options/options_handler_interface.h"
+option instFormatMode --inst-format=MODE InstFormatMode :handler stringToInstFormatMode :default INST_FORMAT_MODE_DEFAULT :read-write :include "options/printer_modes.h"
print format mode for instantiations, see --inst-format=help
endmodule
module PROP "options/prop_options.h" SAT layer
-option satRandomFreq random-frequency --random-freq=P double :default 0.0 :predicate options::greater_equal(0.0) options::less_equal(1.0)
+option satRandomFreq random-frequency --random-freq=P double :default 0.0 :predicate doubleGreaterOrEqual0 doubleLessOrEqual1
sets the frequency of random decisions in the sat solver (P=0.0 by default)
option satRandomSeed random-seed --random-seed=S uint32_t :default 0 :read-write
sets the random seed for the sat solver
-option satVarDecay double :default 0.95 :predicate options::less_equal(1.0) options::greater_equal(0.0)
+option satVarDecay double :default 0.95 :predicate doubleGreaterOrEqual0 doubleLessOrEqual1
variable activity decay factor for Minisat
-option satClauseDecay double :default 0.999 :predicate options::less_equal(1.0) options::greater_equal(0.0)
+option satClauseDecay double :default 0.999 :predicate doubleGreaterOrEqual0 doubleLessOrEqual1
clause activity decay factor for Minisat
option satRestartFirst --restart-int-base=N unsigned :default 25
sets the base restart interval for the sat solver (N=25 by default)
-option satRestartInc --restart-int-inc=F double :default 3.0 :predicate options::greater_equal(0.0)
+option satRestartInc --restart-int-inc=F double :default 3.0 :predicate doubleGreaterOrEqual0
sets the restart interval increase factor for the sat solver (F=3.0 by default)
option sat_refine_conflicts --refine-conflicts bool :default false
miniscope quantifiers for ground subformulas
option quantSplit --quant-split bool :default true
apply splitting to quantified formulas based on variable disjoint disjuncts
-option prenexQuant --prenex-quant=MODE CVC4::theory::quantifiers::PrenexQuantMode :default CVC4::theory::quantifiers::PRENEX_NO_USER_PAT :include "options/quantifiers_modes.h" :read-write :handler CVC4::options::stringToPrenexQuantMode :handler-include "options/options_handler_interface.h"
+option prenexQuant --prenex-quant=MODE CVC4::theory::quantifiers::PrenexQuantMode :default CVC4::theory::quantifiers::PRENEX_NO_USER_PAT :include "options/quantifiers_modes.h" :read-write :handler stringToPrenexQuantMode
prenex mode for quantified formulas
# Whether to variable-eliminate quantifiers.
# For example, forall x y. ( P( x, y ) V x != c ) will be rewritten to
option dtVarExpandQuant --dt-var-exp-quant bool :default true
expand datatype variables bound to one constructor in quantifiers
#ite lift mode for quantified formulas
-option iteLiftQuant --ite-lift-quant=MODE CVC4::theory::quantifiers::IteLiftQuantMode :default CVC4::theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE :include "options/quantifiers_modes.h" :read-write :handler CVC4::options::stringToIteLiftQuantMode :handler-include "options/options_handler_interface.h"
+option iteLiftQuant --ite-lift-quant=MODE CVC4::theory::quantifiers::IteLiftQuantMode :default CVC4::theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE :include "options/quantifiers_modes.h" :read-write :handler stringToIteLiftQuantMode
ite lifting mode for quantified formulas
option condVarSplitQuant --cond-var-split-quant bool :default true
split quantified formulas that lead to variable eliminations
option eMatching --e-matching bool :read-write :default true
whether to do heuristic E-matching
-option termDbMode --term-db-mode CVC4::theory::quantifiers::TermDbMode :default CVC4::theory::quantifiers::TERM_DB_ALL :read-write :include "options/quantifiers_modes.h" :handler CVC4::options::stringToTermDbMode :handler-include "options/options_handler_interface.h"
+option termDbMode --term-db-mode CVC4::theory::quantifiers::TermDbMode :default CVC4::theory::quantifiers::TERM_DB_ALL :read-write :include "options/quantifiers_modes.h" :handler stringToTermDbMode
which ground terms to consider for instantiation
option registerQuantBodyTerms --register-quant-body-terms bool :default false
consider ground terms within bodies of quantified formulas for matching
select multi triggers when single triggers exist
option multiTriggerPriority --multi-trigger-priority bool :default false
only try multi triggers if single triggers give no instantiations
-option triggerSelMode --trigger-sel CVC4::theory::quantifiers::TriggerSelMode :default CVC4::theory::quantifiers::TRIGGER_SEL_DEFAULT :read-write :include "options/quantifiers_modes.h" :handler CVC4::options::stringToTriggerSelMode :handler-include "options/options_handler_interface.h"
+option triggerSelMode --trigger-sel CVC4::theory::quantifiers::TriggerSelMode :default CVC4::theory::quantifiers::TRIGGER_SEL_DEFAULT :read-write :include "options/quantifiers_modes.h" :handler stringToTriggerSelMode
selection mode for triggers
-option userPatternsQuant --user-pat=MODE CVC4::theory::quantifiers::UserPatMode :default CVC4::theory::quantifiers::USER_PAT_MODE_TRUST :include "options/quantifiers_modes.h" :handler CVC4::options::stringToUserPatMode :handler-include "options/options_handler_interface.h"
+option userPatternsQuant --user-pat=MODE CVC4::theory::quantifiers::UserPatMode :default CVC4::theory::quantifiers::USER_PAT_MODE_TRUST :include "options/quantifiers_modes.h" :handler stringToUserPatMode
policy for handling user-provided patterns for quantifier instantiation
option incrementTriggers --increment-triggers bool :default true
generate additional triggers as needed during search
-option instWhenMode --inst-when=MODE CVC4::theory::quantifiers::InstWhenMode :default CVC4::theory::quantifiers::INST_WHEN_FULL_LAST_CALL :read-write :include "options/quantifiers_modes.h" :handler CVC4::options::stringToInstWhenMode :handler-include "options/options_handler_interface.h" :predicate CVC4::options::checkInstWhenMode :predicate-include "options/options_handler_interface.h"
+option instWhenMode --inst-when=MODE CVC4::theory::quantifiers::InstWhenMode :default CVC4::theory::quantifiers::INST_WHEN_FULL_LAST_CALL :read-write :include "options/quantifiers_modes.h" :handler stringToInstWhenMode :predicate checkInstWhenMode
when to apply instantiation
option instMaxLevel --inst-max-level=N int :read-write :default -1
option fullSaturateInst --fs-inst bool :default false
interleave full saturate instantiation with other techniques
-option literalMatchMode --literal-matching=MODE CVC4::theory::quantifiers::LiteralMatchMode :default CVC4::theory::quantifiers::LITERAL_MATCH_NONE :include "options/quantifiers_modes.h" :handler CVC4::options::stringToLiteralMatchMode :handler-include "options/options_handler_interface.h" :predicate CVC4::options::checkLiteralMatchMode :predicate-include "options/options_handler_interface.h"
+option literalMatchMode --literal-matching=MODE CVC4::theory::quantifiers::LiteralMatchMode :default CVC4::theory::quantifiers::LITERAL_MATCH_NONE :include "options/quantifiers_modes.h" :handler stringToLiteralMatchMode :predicate checkLiteralMatchMode
choose literal matching mode
### finite model finding options
option fmfEmptySorts --fmf-empty-sorts bool :default false
allow finite model finding to assume sorts that do not occur in ground assertions are empty
-option mbqiMode --mbqi=MODE CVC4::theory::quantifiers::MbqiMode :read-write :default CVC4::theory::quantifiers::MBQI_FMC :include "options/quantifiers_modes.h" :handler CVC4::options::stringToMbqiMode :handler-include "options/options_handler_interface.h" :predicate CVC4::options::checkMbqiMode :predicate-include "options/options_handler_interface.h"
+option mbqiMode --mbqi=MODE CVC4::theory::quantifiers::MbqiMode :read-write :default CVC4::theory::quantifiers::MBQI_FMC :include "options/quantifiers_modes.h" :handler stringToMbqiMode :predicate checkMbqiMode
choose mode for model-based quantifier instantiation
option fmfOneInstPerRound --mbqi-one-inst-per-round bool :read-write :default false
only add one instantiation per quantifier per round for mbqi
option quantConflictFind --quant-cf bool :read-write :default true
enable conflict find mechanism for quantifiers
-option qcfMode --quant-cf-mode=MODE CVC4::theory::quantifiers::QcfMode :default CVC4::theory::quantifiers::QCF_PROP_EQ :include "options/quantifiers_modes.h" :handler CVC4::options::stringToQcfMode :handler-include "options/options_handler_interface.h"
+option qcfMode --quant-cf-mode=MODE CVC4::theory::quantifiers::QcfMode :default CVC4::theory::quantifiers::QCF_PROP_EQ :include "options/quantifiers_modes.h" :handler stringToQcfMode
what effort to apply conflict find mechanism
-option qcfWhenMode --quant-cf-when=MODE CVC4::theory::quantifiers::QcfWhenMode :default CVC4::theory::quantifiers::QCF_WHEN_MODE_DEFAULT :include "options/quantifiers_modes.h" :handler CVC4::options::stringToQcfWhenMode :handler-include "options/options_handler_interface.h"
+option qcfWhenMode --quant-cf-when=MODE CVC4::theory::quantifiers::QcfWhenMode :default CVC4::theory::quantifiers::QCF_WHEN_MODE_DEFAULT :include "options/quantifiers_modes.h" :handler stringToQcfWhenMode
when to invoke conflict find mechanism for quantifiers
option qcfTConstraint --qcf-tconstraint bool :read-write :default false
enable entailment checks for t-constraints in qcf algorithm
option ceGuidedInst --cegqi bool :default false :read-write
counterexample-guided quantifier instantiation
-option ceGuidedInstFair --cegqi-fair=MODE CVC4::theory::quantifiers::CegqiFairMode :default CVC4::theory::quantifiers::CEGQI_FAIR_DT_SIZE :include "options/quantifiers_modes.h" :handler CVC4::options::stringToCegqiFairMode :handler-include "options/options_handler_interface.h"
+option ceGuidedInstFair --cegqi-fair=MODE CVC4::theory::quantifiers::CegqiFairMode :default CVC4::theory::quantifiers::CEGQI_FAIR_DT_SIZE :include "options/quantifiers_modes.h" :handler stringToCegqiFairMode
if and how to apply fairness for cegqi
option cegqiSingleInv --cegqi-si bool :default false :read-write
process single invocation synthesis conjectures
option sygusNormalFormGlobalContent --sygus-nf-sym-content bool :default true
generalize based on content in global search space narrowing
-option sygusInvTemplMode --sygus-inv-templ=MODE CVC4::theory::quantifiers::SygusInvTemplMode :default CVC4::theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE :include "options/quantifiers_modes.h" :handler CVC4::options::stringToSygusInvTemplMode :handler-include "options/options_handler_interface.h"
+option sygusInvTemplMode --sygus-inv-templ=MODE CVC4::theory::quantifiers::SygusInvTemplMode :default CVC4::theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE :include "options/quantifiers_modes.h" :handler stringToSygusInvTemplMode
template mode for sygus invariant synthesis
# approach applied to general quantified formulas
infer alpha equivalence between quantified formulas
option macrosQuant --macros-quant bool :read-write :default false
perform quantifiers macro expansion
-option macrosQuantMode --macros-quant-mode=MODE CVC4::theory::quantifiers::MacrosQuantMode :default CVC4::theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF :include "options/quantifiers_modes.h" :handler CVC4::options::stringToMacrosQuantMode :handler-include "options/options_handler_interface.h"
+option macrosQuantMode --macros-quant-mode=MODE CVC4::theory::quantifiers::MacrosQuantMode :default CVC4::theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF :include "options/quantifiers_modes.h" :handler stringToMacrosQuantMode
mode for quantifiers macro expansion
### recursive function options
module SMT "options/smt_options.h" SMT layer
-common-option - dump --dump=MODE argument :handler CVC4::options::dumpMode :handler-include "options/options_handler_interface.h"
+common-option dumpModeString dump --dump=MODE std::string :default "" :notify notifyDumpMode
dump preprocessed assertions, etc., see --dump=help
-common-option - dump-to --dump-to=FILE argument :handler CVC4::options::dumpToFile :handler-include "options/options_handler_interface.h"
+common-option dumpToFileName dump-to --dump-to=FILE std::string :notify notifyDumpToFile
all dumping goes to FILE (instead of stdout)
-expert-option forceLogic force-logic --force-logic=LOGIC LogicInfo* :include "options/logic_info_forward.h" :handler CVC4::options::stringToLogicInfo :handler-include "options/options_handler_interface.h" :default NULL
+expert-option forceLogicString force-logic --force-logic=LOGIC std::string :default "" :notify notifyForceLogic
set the logic, and override all further user attempts to change it
-option simplificationMode simplification-mode --simplification=MODE SimplificationMode :handler CVC4::options::stringToSimplificationMode :default SIMPLIFICATION_MODE_BATCH :read-write :include "options/simplification_mode.h" :handler-include "options/options_handler_interface.h"
+option simplificationMode simplification-mode --simplification=MODE SimplificationMode :handler stringToSimplificationMode :default SIMPLIFICATION_MODE_BATCH :read-write :include "options/simplification_mode.h"
choose simplification mode, see --simplification=help
alias --no-simplification = --simplification=none
turn off all simplification (same as --simplification=none)
option expandDefinitions expand-definitions bool :default false
always expand symbol definitions in output
-common-option produceModels produce-models -m --produce-models bool :default false :predicate CVC4::options::beforeSearch :predicate-include "options/options_handler_interface.h"
+common-option produceModels produce-models -m --produce-models bool :default false :notify notifyBeforeSearch
support the get-value and get-model commands
-option checkModels check-models --check-models bool :link --produce-models --produce-assertions :link-smt produce-models :link-smt produce-assertions :predicate CVC4::options::beforeSearch :predicate-include "options/options_handler_interface.h"
+option checkModels check-models --check-models bool :link --produce-models --produce-assertions :link-smt produce-models :link-smt produce-assertions :notify notifyBeforeSearch
after SAT/INVALID/UNKNOWN, check that the generated model satisfies user assertions
-option dumpModels --dump-models bool :default false :link --produce-models
+option dumpModels --dump-models bool :default false :link --produce-models :link-smt produce-models
output models after every SAT/INVALID/UNKNOWN response
-option proof produce-proofs --proof bool :default false :predicate CVC4::options::proofEnabledBuild CVC4::options::beforeSearch :predicate-include "options/options_handler_interface.h"
+option proof produce-proofs --proof bool :default false :predicate proofEnabledBuild :notify notifyBeforeSearch
turn on proof generation
-option checkProofs check-proofs --check-proofs bool :link --proof :link-smt produce-proofs :predicate CVC4::options::beforeSearch :predicate-include "options/options_handler_interface.h" :read-write
+option checkProofs check-proofs --check-proofs bool :link --proof :link-smt produce-proofs :notify notifyBeforeSearch :read-write
after UNSAT/VALID, machine-check the generated proof
-option dumpProofs --dump-proofs bool :default false :link --proof
+option dumpProofs --dump-proofs bool :default false :link --proof :link-smt produce-proofs
output proofs after every UNSAT/VALID response
option dumpInstantiations --dump-instantiations bool :default false
output instantiations of quantified formulas after every UNSAT/VALID response
option dumpSynth --dump-synth bool :read-write :default false
output solution for synthesis conjectures after every UNSAT/VALID response
-option unsatCores produce-unsat-cores --produce-unsat-cores bool :predicate CVC4::options::proofEnabledBuild CVC4::options::beforeSearch :predicate-include "options/options_handler_interface.h"
+option unsatCores produce-unsat-cores --produce-unsat-cores bool :predicate proofEnabledBuild :notify :notify notifyBeforeSearch
turn on unsat core generation
option checkUnsatCores check-unsat-cores --check-unsat-cores bool :link --produce-unsat-cores :link-smt produce-unsat-cores :read-write
after UNSAT/VALID, produce and check an unsat core (expensive)
-option dumpUnsatCores --dump-unsat-cores bool :default false :link --produce-unsat-cores :link-smt produce-unsat-cores :predicate CVC4::options::beforeSearch :predicate-include "options/options_handler_interface.h"
+option dumpUnsatCores --dump-unsat-cores bool :default false :link --produce-unsat-cores :link-smt produce-unsat-cores :notify notifyBeforeSearch
output unsat cores after every UNSAT/VALID response
-option produceAssignments produce-assignments --produce-assignments bool :default false :predicate CVC4::options::beforeSearch :predicate-include "options/options_handler_interface.h"
+option produceAssignments produce-assignments --produce-assignments bool :default false :notify notifyBeforeSearch
support the get-assignment command
-undocumented-option interactiveMode interactive-mode bool :predicate CVC4::options::beforeSearch CVC4::options::setProduceAssertions :predicate-include "options/options_handler_interface.h" :read-write
+undocumented-option interactiveMode interactive-mode bool :predicate setProduceAssertions :read-write :notify notifyBeforeSearch
deprecated name for produce-assertions
-common-option produceAssertions produce-assertions --produce-assertions bool :predicate CVC4::options::beforeSearch CVC4::options::setProduceAssertions :predicate-include "options/options_handler_interface.h" :read-write
+common-option produceAssertions produce-assertions --produce-assertions bool :predicate setProduceAssertions :read-write :notify notifyBeforeSearch
keep an assertions list (enables get-assertions command)
option doITESimp --ite-simp bool :read-write
option modelUninterpDtEnum --model-u-dt-enum bool :default false
in models, output uninterpreted sorts as datatype enumerations
-option - regular-output-channel argument :handler CVC4::options::setRegularOutputChannel :handler-include "options/options_handler_interface.h"
+option regularChannelName regular-output-channel std::string :notify notifySetRegularOutputChannel
set the regular output channel of the solver
-option - diagnostic-output-channel argument :handler CVC4::options::setDiagnosticOutputChannel :handler-include "options/options_handler_interface.h"
+option diagnosticChannelName diagnostic-output-channel std::string :notify notifySetDiagnosticOutputChannel
set the diagnostic output channel of the solver
-common-option cumulativeMillisecondLimit tlimit --tlimit=MS "unsigned long" :handler CVC4::options::tlimitHandler :handler-include "options/options_handler_interface.h"
+common-option cumulativeMillisecondLimit tlimit --tlimit=MS "unsigned long" :handler tlimitHandler :notify notifyTlimit
enable time limiting (give milliseconds)
-common-option perCallMillisecondLimit tlimit-per --tlimit-per=MS "unsigned long" :handler CVC4::options::tlimitPerHandler :handler-include "options/options_handler_interface.h"
+common-option perCallMillisecondLimit tlimit-per --tlimit-per=MS "unsigned long" :handler tlimitPerHandler :notify notifyTlimitPer
enable time limiting per query (give milliseconds)
-common-option cumulativeResourceLimit rlimit --rlimit=N "unsigned long" :handler CVC4::options::rlimitHandler :handler-include "options/options_handler_interface.h"
+common-option cumulativeResourceLimit rlimit --rlimit=N "unsigned long" :handler rlimitHandler :notify notifyRlimit
enable resource limiting (currently, roughly the number of SAT conflicts)
-common-option perCallResourceLimit reproducible-resource-limit --rlimit-per=N "unsigned long" :handler CVC4::options::rlimitPerHandler :handler-include "options/options_handler_interface.h"
+common-option perCallResourceLimit reproducible-resource-limit --rlimit-per=N "unsigned long" :handler rlimitPerHandler :notify notifyRlimitPer
enable resource limiting per query
common-option hardLimit hard-limit --hard-limit bool :default false
the resource limit is hard potentially leaving the smtEngine in an unsafe state (should be destroyed and rebuild after resourcing out)
expert-option rewriteApplyToConst rewrite-apply-to-const --rewrite-apply-to-const bool :default false
eliminate function applications, rewriting e.g. f(5) to a new symbol f_5
+
# --replay is currently broken; don't document it for 1.0
-undocumented-option replayFilename --replay=FILE std::string :handler CVC4::options::checkReplayFilename :handler-include "options/options_handler_interface.h"
+undocumented-option replayInputFilename --replay=FILE std::string :handler checkReplayFilename
replay decisions from file
+# --replay is currently broken; don't document it for 1.0
+undocumented-option replayLogFilename --replay-log=FILE std::string :handler checkReplayFilename :notify notifySetReplayLogFilename :notify notifyBeforeSearch
+ replay decisions from file
option forceNoLimitCpuWhileDump --force-no-limit-cpu-while-dump bool :default false
Force no CPU limit when dumping models and proofs
-option solveIntAsBV --solve-int-as-bv uint32_t :default 0
+undocumented-option solveIntAsBV --solve-int-as-bv uint32_t :default 0
+ attempt to solve a pure integer satisfiable problem by bitblasting in sufficient bitwidth (experimental)
endmodule
experimental features in the theory of strings
# :predicate-include "smt/smt_engine.h"
-option stringLB strings-lb --strings-lb=N unsigned :default 0 :predicate options::less_equal(2) :predicate-include "options/base_handlers.h"
+option stringLB strings-lb --strings-lb=N unsigned :default 0 :predicate unsignedLessEqual2
the strategy of LB rule application: 0-lazy, 1-eager, 2-no
# :predicate-include "smt/smt_engine.h"
-option stdASCII strings-std-ascii --strings-std-ascii bool :default true :predicate options::less_equal(2) :predicate-include "options/base_handlers.h"
+option stdASCII strings-std-ascii --strings-std-ascii bool :default true :predicate unsignedLessEqual2
the alphabet contains only characters from the standard ASCII or the extended one
option stringFMF strings-fmf --strings-fmf bool :default false :read-write
module THEORY "options/theory_options.h" Theory layer
-expert-option theoryOfMode theoryof-mode --theoryof-mode=MODE CVC4::theory::TheoryOfMode :handler CVC4::options::stringToTheoryOfMode :handler-include "options/options_handler_interface.h" :default CVC4::theory::THEORY_OF_TYPE_BASED :include "options/theoryof_mode.h" :read-write
+expert-option theoryOfMode theoryof-mode --theoryof-mode=MODE CVC4::theory::TheoryOfMode :handler stringToTheoryOfMode :default CVC4::theory::THEORY_OF_TYPE_BASED :include "options/theoryof_mode.h" :read-write
mode for Theory::theoryof()
-option - use-theory --use-theory=NAME argument :handler CVC4::options::useTheory :handler-include "options/options_handler_interface.h"
- use alternate theory implementation NAME (--use-theory=help for a list)
-option theoryAlternates ::std::map<std::string,bool> :include <map> :read-write
+option useTheoryList use-theory --use-theory=NAME std::string :handler handleUseTheoryList :notify notifyUseTheoryList
+ use alternate theory implementation NAME (--use-theory=help for a list). This option may be repeated or a comma separated list.
endmodule
option condenseFunctionValues condense-function-values --condense-function-values bool :default true
condense models for functions rather than explicitly representing them
-option ufssRegions /--disable-uf-ss-regions bool :default true
+option ufssRegions --uf-ss-regions bool :default true
disable region-based method for discovering cliques and splits in uf strong solver
option ufssEagerSplits --uf-ss-eager-split bool :default false
add splits eagerly for uf strong solver
always use simple clique lemmas for uf strong solver
option ufssDiseqPropagation --uf-ss-deq-prop bool :default false
eagerly propagate disequalities for uf strong solver
-option ufssMode --uf-ss=MODE CVC4::theory::uf::UfssMode :default CVC4::theory::uf::UF_SS_FULL :include "options/options_handler_interface.h" :handler CVC4::options::stringToUfssMode :handler-include "options/options_handler_interface.h"
+option ufssMode --uf-ss=MODE CVC4::theory::uf::UfssMode :default CVC4::theory::uf::UF_SS_FULL :include "options/ufss_mode.h" :handler stringToUfssMode
mode of operation for uf strong solver.
option ufssCliqueSplits --uf-ss-clique-splits bool :default false
use cliques instead of splitting on demand to shrink model
namespace CVC4 {
namespace theory {
namespace uf {
-
+
enum UfssMode{
/** default, use uf strong solver to find minimal models for uninterpreted sorts */
UF_SS_FULL,
}/* CVC4 namespace */
#endif /* __CVC4__BASE__UFSS_MODE_H */
-
endif
libcvc4parser_la_SOURCES = \
- antlr_input.h \
antlr_input.cpp \
+ antlr_input.h \
antlr_input_imports.cpp \
- antlr_line_buffered_input.h \
antlr_line_buffered_input.cpp \
- bounded_token_buffer.h \
+ antlr_line_buffered_input.h \
+ antlr_tracing.h \
+ antlr_undefines.h \
bounded_token_buffer.cpp \
- bounded_token_factory.h \
+ bounded_token_buffer.h \
bounded_token_factory.cpp \
- input.h \
+ bounded_token_factory.h \
input.cpp \
- memory_mapped_input_buffer.h \
+ input.h \
memory_mapped_input_buffer.cpp \
- parser.h \
+ memory_mapped_input_buffer.h \
parser.cpp \
- parser_builder.h \
+ parser.h \
parser_builder.cpp \
- parser_exception.h \
- antlr_tracing.h
+ parser_builder.h \
+ parser_exception.h
EXTRA_DIST = \
Makefile.antlr_tracing \
** A super-class for ANTLR-generated input language parsers
**/
+#include "parser/antlr_input.h"
+// We rely on the inclusion of #include <antlr3.h> in "parser/antlr_input.h".
+// This is avoid having to undefine the symbols in <antlr3.h>.
+// See the documentation in "parser/antlr_undefines.h" for more
+// details.
+
#include <limits.h>
-#include <antlr3.h>
#include <stdint.h>
#include "base/output.h"
#include "expr/type.h"
-#include "parser/antlr_input.h"
#include "parser/antlr_line_buffered_input.h"
#include "parser/bounded_token_buffer.h"
#include "parser/bounded_token_factory.h"
** Base for ANTLR parser classes.
**/
-#include <antlr3.h>
+#ifndef __CVC4__PARSER__ANTLR_INPUT_H
+#define __CVC4__PARSER__ANTLR_INPUT_H
-// ANTLR3 headers define these in our space :(
-// undef them so that we don't get multiple-definition warnings
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
+// These headers must be included first. See the documentation
+// in parser/antlr_undefines.h for an explanation.
+// Also while unusual this must also be within the #ifdef guard.
+#include <antlr3.h>
+#include "parser/antlr_undefines.h"
#include "cvc4parser_private.h"
-#ifndef __CVC4__PARSER__ANTLR_INPUT_H
-#define __CVC4__PARSER__ANTLR_INPUT_H
-
#include <iostream>
#include <sstream>
#include <stdexcept>
pANTLR3_UINT8 inputString);
/* This is private and unimplemented, because you should never use it. */
- AntlrInputStream(const AntlrInputStream& inputStream) CVC4_UNUSED;
+ AntlrInputStream(const AntlrInputStream& inputStream) CVC4_UNDEFINED;
/* This is private and unimplemented, because you should never use it. */
- AntlrInputStream& operator=(const AntlrInputStream& inputStream) CVC4_UNUSED;
+ AntlrInputStream& operator=(const AntlrInputStream& inputStream)
+ CVC4_UNDEFINED;
public:
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+// These headers must be the first two included.
+// See the documentation in "parser/antlr_undefines.h" for more details.
#include <antlr3.h>
+#include "parser/antlr_undefines.h"
+
#include <sstream>
#include "parser/antlr_input.h"
** \todo document this file
**/
-#include <antlr3.h>
+// We rely on the inclusion of #include <antlr3.h> in
+// "parser/antlr_line_buffered_input.h".
+// This is avoid having to undefine the symbols in <antlr3.h>.
+// See the documentation in "parser/antlr_undefines.h" for more
+// details.
-// ANTLR3 headers define these in our space :(
-// undef them so that we don't get multiple-definition warnings
-#undef PACKAGE_BUGREPORT
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
+#include "parser/antlr_line_buffered_input.h"
#include <iostream>
#include <string>
#include <cassert>
#include "base/output.h"
-#include "parser/antlr_line_buffered_input.h"
namespace CVC4 {
namespace parser {
}/* CVC4::parser namespace */
}/* CVC4 namespace */
-
** \todo document this file
**/
+// These headers should be the first two included.
+// See the documentation in "parser/antlr_undefines.h" for more details.
+#include <antlr3.h>
+#include "parser/antlr_undefines.h"
+
#include "cvc4parser_private.h"
#ifndef __CVC4__PARSER__ANTLR_LINE_BUFFERED_INPUT_H
#define __CVC4__PARSER__ANTLR_LINE_BUFFERED_INPUT_H
-#include <antlr3.h>
+#include <istream>
namespace CVC4 {
namespace parser {
--- /dev/null
+/********************* */
+/*! \file antlr_undefines.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2016 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Every usage undefines standard autotools macro names.
+ **
+ ** This header is very sensitive and it should be understood *in full* before
+ ** it is used or *moved* in position relative to other headers.
+ **
+ ** Including this header runs #undef on the following identifiers:
+ ** - PACKAGE_BUGREPORT,
+ ** - PACKAGE_NAME
+ ** - PACKAGE_STRING
+ ** - PACKAGE_TARNAME
+ ** - PACKAGE_VERSION
+ **
+ ** This is to solves a problem caused by antlr and cvc4 both defining these
+ ** symbols. This has to do with both packages using autotools in a slightly
+ ** dicey way. This was reported by us a long time ago, but most versions
+ ** of libantlr are quite old (3.2).
+ ** http://www.antlr3.org/pipermail/antlr-interest/2010-March/037859.html
+ **
+ ** The source of both of these two definitions are given below.
+ **
+ ** From antlr, the autogenerated antlr lexers and parsers include antlr3.h.
+ ** The chain of inclusions is:
+ ** Lang{Lexer,Parser}.h -> <antlr3.h> -> <antlr3config.h> -> <antlr3defs.h>
+ **
+ ** where Lang is in {Smt1,Smt2,Tptp,Cvc}.
+ **
+ ** From CVC4, the parsers use Debug("...") and other features from
+ ** "base/output.h". This is a cvc4_private_library.h header file. This means
+ ** the files is usable while building the driver and parsers, but is otherwise
+ ** conceptually the same as a cvc4_private.h header. (If that sounds sketchy,
+ ** it is sure is! [See src/DESIGN.txt for more details].)
+ ** The include chain is then
+ ** "base/output.h" -> "cvc4_private_library.h" -> "cvc4_private.h" ->
+ ** "cvc4autoconfig.h".
+ ** The file cvc4autoconfig.h is autogenerated by autotools and can be found in
+ ** builds/<arch>/<target>/cvc4autoconfig.h
+ **
+ ** Thus a working solution is to include this header immediately after all
+ ** locations of #include <antlr3.h>. This includes all autogenerated files.
+ ** This potentially has to be repeated so this header should not be guarded.
+ **
+ ** To ensure that we do not remove cvc4's versions and use antlr's by mistake
+ ** #include <antlr3.h> needs to proceed any other includes like
+ ** #include "cvc4parser_private.h".
+ **
+ ** It is worth noting that future version of antlr can both not define these
+ ** macros and may generate different code. This is at best a stop gap
+ ** solution.
+ **
+ ** Every location this header is included needs to be documented.
+ ** When in doubt do not move this header!
+ **/
+
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
@lexer::includes {
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
/** This suppresses warnings about the redefinition of token symbols between different
* parsers. The redefinitions should be harmless as long as no client: (a) #include's
* the lexer headers for two grammars AND (b) uses the token symbol definitions. */
@parser::includes {
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
#include <stdint.h>
#include <cassert>
#include "options/set_language.h"
** [[ Add file-specific comments here ]]
**/
+// These headers should be the first two included.
+// See the documentation in "parser/antlr_undefines.h" for more details.
#include <antlr3.h>
+#include "parser/antlr_undefines.h"
+
+#include "parser/cvc/cvc_input.h"
#include "expr/expr_manager.h"
#include "parser/antlr_input.h"
#include "parser/parser_exception.h"
-#include "parser/cvc/cvc_input.h"
#include "parser/cvc/CvcLexer.h"
#include "parser/cvc/CvcParser.h"
** A super-class for input language parsers
**/
+// This must be included first.
+#include "parser/antlr_input.h"
+
#include "parser/input.h"
-#include "parser/parser_exception.h"
-#include "parser/parser.h"
#include "base/output.h"
-#include "smt_util/command.h"
#include "expr/type.h"
-#include "parser/antlr_input.h"
+#include "parser/parser.h"
+#include "parser/parser_exception.h"
+#include "smt_util/command.h"
using namespace std;
* copy construction and assignment. Mark them private and do not define
* them.
*/
- Input(const Input& input) CVC4_UNUSED;
- Input& operator=(const Input& input) CVC4_UNUSED;
+ Input(const Input& input) CVC4_UNDEFINED;
+ Input& operator=(const Input& input) CVC4_UNDEFINED;
public:
#include "expr/kind.h"
#include "expr/type.h"
#include "options/options.h"
-#include "options/smt_options.h"
#include "parser/input.h"
#include "parser/parser_exception.h"
#include "smt_util/command.h"
Debug("parser") << "nextCommand() => " << cmd << std::endl;
if (cmd != NULL &&
dynamic_cast<SetOptionCommand*>(cmd) == NULL &&
- dynamic_cast<QuitCommand*>(cmd) == NULL) {
+ dynamic_cast<QuitCommand*>(cmd) == NULL)
+ {
// don't count set-option commands as to not get stuck in an infinite
// loop of resourcing out
- d_resourceManager->spendResource(d_exprManager->getOptions()[options::parseStep]);
+ const Options& options = d_exprManager->getOptions();
+ d_resourceManager->spendResource(options.getParseStep());
}
return cmd;
}
Expr Parser::nextExpression() throw(ParserException, UnsafeInterruptException) {
Debug("parser") << "nextExpression()" << std::endl;
- d_resourceManager->spendResource(d_exprManager->getOptions()[options::parseStep]);
+ const Options& options = d_exprManager->getOptions();
+ d_resourceManager->spendResource(options.getParseStep());
Expr result;
if(!done()) {
try {
**
** A builder for parsers.
**/
+
+// This must be included first.
+#include "parser/antlr_input.h"
+
#include "parser/parser_builder.h"
#include <string>
#include "expr/expr_manager.h"
-#include "options/base_options.h"
-#include "options/parser_options.h"
-#include "options/smt_options.h"
#include "parser/input.h"
#include "parser/parser.h"
+#include "options/options.h"
#include "smt1/smt1.h"
#include "smt2/smt2.h"
#include "tptp/tptp.h"
ParserBuilder& ParserBuilder::withOptions(const Options& options) {
ParserBuilder& retval = *this;
retval =
- retval.withInputLanguage(options[options::inputLanguage])
- .withMmap(options[options::memoryMap])
- .withChecks(options[options::semanticChecks])
- .withStrictMode(options[options::strictParsing])
- .withParseOnly(options[options::parseOnly])
- .withIncludeFile(options[options::filesystemAccess]);
- if(options.wasSetByUser(options::forceLogic)) {
- retval = retval.withForcedLogic(options[options::forceLogic]->getLogicString());
+ retval.withInputLanguage(options.getInputLanguage())
+ .withMmap(options.getMemoryMap())
+ .withChecks(options.getSemanticChecks())
+ .withStrictMode(options.getStrictParsing())
+ .withParseOnly(options.getParseOnly())
+ .withIncludeFile(options.getFilesystemAccess());
+ if(options.wasSetByUserForceLogicString()) {
+ LogicInfo tmp(options.getForceLogicString());
+ retval = retval.withForcedLogic(tmp.getLogicString());
}
return retval;
}
}/* @header */
@lexer::includes {
+
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
/** This suppresses warnings about the redefinition of token symbols between
* different parsers. The redefinitions should be harmless as long as no
* client: (a) #include's the lexer headers for two grammars AND (b) uses the
@parser::includes {
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
#include <stdint.h>
#include "smt_util/command.h"
** [[ Add file-specific comments here ]]
**/
+// These headers must be the first two included.
+// See the documentation in "parser/antlr_undefines.h" for more details.
#include <antlr3.h>
+#include "parser/antlr_undefines.h"
#include "parser/smt1/smt1_input.h"
+
#include "expr/expr_manager.h"
#include "parser/input.h"
#include "parser/parser.h"
@lexer::includes {
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
/** This suppresses warnings about the redefinition of token symbols between
* different parsers. The redefinitions should be harmless as long as no
* client: (a) #include's the lexer headers for two grammars AND (b) uses the
}/* @lexer::postinclude */
@parser::includes {
+
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
#include "parser/parser.h"
#include "parser/antlr_tracing.h"
#include "smt_util/command.h"
#include "parser/antlr_input.h"
#include "parser/parser.h"
#include "parser/smt1/smt1.h"
+#include "parser/smt2/smt2_input.h"
#include "smt_util/command.h"
#include "util/bitvector.h"
}
}
+void Smt2::setLanguage(InputLanguage lang) {
+ ((Smt2Input*) getInput())->setLanguage(lang);
+}
+
void Smt2::addArithmeticOperators() {
Parser::addOperator(kind::PLUS);
Parser::addOperator(kind::MINUS);
#ifndef __CVC4__PARSER__SMT2_H
#define __CVC4__PARSER__SMT2_H
+#include <sstream>
+#include <stack>
+#include <string>
+#include <utility>
+
#include "parser/parser.h"
#include "parser/smt1/smt1.h"
#include "theory/logic_info.h"
#include "util/abstract_value.h"
-#include "parser/smt2/smt2_input.h"
-
-#include <string>
-#include <sstream>
-#include <utility>
-#include <stack>
namespace CVC4 {
return getInput()->getLanguage() == language::input::LANG_SYGUS;
}
- void setLanguage(InputLanguage lang) {
- ((Smt2Input*) getInput())->setLanguage(lang);
- }
+ void setLanguage(InputLanguage lang);
void setInfo(const std::string& flag, const SExpr& sexpr);
** [[ Add file-specific comments here ]]
**/
+// These headers should be the first two included.
+// See the documentation in "parser/antlr_undefines.h" for more details.
#include <antlr3.h>
+#include "parser/antlr_undefines.h"
+
#include "parser/smt2/smt2_input.h"
+
#include "expr/expr_manager.h"
#include "parser/input.h"
#include "parser/parser.h"
// extern void Smt2ParserSetAntlrParser(CVC4::parser::AntlrParser* newAntlrParser);
namespace CVC4 {
-
+
class Command;
class Expr;
class ExprManager;
** [[ Add file-specific comments here ]]
**/
+// These headers should be the first two included.
+// See the documentation in "parser/antlr_undefines.h" for more details.
#include <antlr3.h>
+#include "parser/antlr_undefines.h"
+
#include "parser/smt2/sygus_input.h"
+
#include "expr/expr_manager.h"
#include "parser/input.h"
#include "parser/parser.h"
@lexer::includes {
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
/** This suppresses warnings about the redefinition of token symbols between
* different parsers. The redefinitions should be harmless as long as no
* client: (a) #include's the lexer headers for two grammars AND (b) uses the
}/* @lexer::postinclude */
@parser::includes {
+
+// This should come immediately after #include <antlr3.h> in the generated
+// files. See the documentation in "parser/antlr_undefines.h" for more details.
+#include "parser/antlr_undefines.h"
+
#include "smt_util/command.h"
#include "parser/parser.h"
#include "parser/tptp/tptp.h"
** Definitions of TPTP constants.
**/
+// Do not #include "parser/antlr_input.h" directly. Rely on the header.
+#include "parser/tptp/tptp.h"
+
#include "expr/type.h"
#include "parser/parser.h"
-#include "parser/tptp/tptp.h"
-#include "parser/antlr_input.h"
// ANTLR defines these, which is really bad!
#undef true
** Definitions of TPTP constants.
**/
+#include "parser/antlr_input.h" // Needs to go first.
+
#include "cvc4parser_private.h"
#ifndef __CVC4__PARSER__TPTP_H
#include <cassert>
#include <ext/hash_set>
-#include "options/parser_options.h"
-#include "parser/antlr_input.h"
#include "parser/parser.h"
#include "smt_util/command.h"
#include "util/hash.h"
** [[ Add file-specific comments here ]]
**/
+// These headers should be the first two included.
+// See the documentation in "parser/antlr_undefines.h" for more details.
#include <antlr3.h>
+#include "parser/antlr_undefines.h"
+
#include "parser/tptp/tptp_input.h"
#include "expr/expr_manager.h"
static Printer* makePrinter(OutputLanguage lang) throw();
// disallow copy, assignment
- Printer(const Printer&) CVC4_UNUSED;
- Printer& operator=(const Printer&) CVC4_UNUSED;
+ Printer(const Printer&) CVC4_UNDEFINED;
+ Printer& operator=(const Printer&) CVC4_UNDEFINED;
protected:
// derived classes can construct, but no one else.
* ...
* #endif
*
- * The macro IS_PROOFS_BUILD is defined in util/configuration_private.h
+ * The macro IS_PROOFS_BUILD is defined in base/configuration_private.h
*
* This has the effect of forcing that location to have included this header
* *before* performing this test. This includes C preprocessing expansion.
* and should list the exceptions here:
* - Makefile.am
* - proof/proofs.h
- * - util/configuration_private.h
+ * - base/configuration_private.h
*/
#ifdef CVC4_PROOF
}
-void ProofManager::initTheoryProofEngine(SmtGlobals* globals) {
+void ProofManager::initTheoryProofEngine() {
Assert (currentPM()->d_theoryProof == NULL);
Assert (currentPM()->d_format == LFSC);
- currentPM()->d_theoryProof = new LFSCTheoryProofEngine(globals);
+ currentPM()->d_theoryProof = new LFSCTheoryProofEngine();
}
std::string ProofManager::getInputClauseName(ClauseId id,
const std::string& prefix) {
return append(prefix+".pb", id);
}
+
std::string ProofManager::getLemmaClauseName(ClauseId id,
const std::string& prefix) {
return append(prefix+".lemc", id);
}
- std::string ProofManager::getLemmaName(ClauseId id,
- const std::string& prefix) {
+
+std::string ProofManager::getLemmaName(ClauseId id, const std::string& prefix) {
return append(prefix+"lem", id);
}
namespace CVC4 {
-class SmtGlobals;
-
// forward declarations
namespace Minisat {
class Solver;
static void initSatProof(Minisat::Solver* solver);
static void initCnfProof(CVC4::prop::CnfStream* cnfStream,
context::Context* ctx);
- static void initTheoryProofEngine(SmtGlobals* globals);
+ static void initTheoryProofEngine();
// getting various proofs
static Proof* getProof(SmtEngine* smt);
static UFProof* getUfProof();
static BitVectorProof* getBitVectorProof();
static ArrayProof* getArrayProof();
-
+
// iterators over data shared by proofs
typedef ExprSet::const_iterator assertions_iterator;
// iterate over the assertions (these are arbitrary boolean formulas)
- assertions_iterator begin_assertions() const { return d_inputFormulas.begin(); }
+ assertions_iterator begin_assertions() const {
+ return d_inputFormulas.begin();
+ }
assertions_iterator end_assertions() const { return d_inputFormulas.end(); }
size_t num_assertions() const { return d_inputFormulas.size(); }
void done(TNode node) { }
}; /* class MyPreRegisterVisitor */
-TheoryProofEngine::TheoryProofEngine(SmtGlobals* globals)
+TheoryProofEngine::TheoryProofEngine()
: d_registrationCache()
, d_theoryProofTable()
- , d_globals(globals)
{
d_theoryProofTable[theory::THEORY_BOOL] = new LFSCBooleanProof(this);
}
if(d_theory->getId()==theory::THEORY_UF) {
th = new theory::uf::TheoryUF(&fakeContext, &fakeContext, oc, v,
ProofManager::currentPM()->getLogicInfo(),
- ProofManager::currentPM()->getTheoryProofEngine()->d_globals,
"replay::");
} else if(d_theory->getId()==theory::THEORY_ARRAY) {
th = new theory::arrays::TheoryArrays(&fakeContext, &fakeContext, oc, v,
ProofManager::currentPM()->getLogicInfo(),
- ProofManager::currentPM()->getTheoryProofEngine()->d_globals,
"replay::");
} else {
InternalError(std::string("can't generate theory-proof for ") + ProofManager::currentPM()->getLogic());
namespace CVC4 {
-class SmtGlobals;
-
namespace theory {
class Theory;
}
typedef __gnu_cxx::hash_map<Expr, LetCount, ExprHashFunction> LetMap;
typedef std::vector<LetOrderElement> Bindings;
-class TheoryProof;
+class TheoryProof;
typedef unsigned ClauseId;
typedef __gnu_cxx::hash_set<Expr, ExprHashFunction > ExprSet;
protected:
ExprSet d_registrationCache;
TheoryProofTable d_theoryProofTable;
-
+
/**
* Returns whether the theory is currently supported in proof
* production mode.
*/
bool supportedTheory(theory::TheoryId id);
public:
- SmtGlobals* d_globals;
-
- TheoryProofEngine(SmtGlobals* globals);
+
+ TheoryProofEngine();
virtual ~TheoryProofEngine();
- /**
- * Print the theory term (could be atom) by delegating to the
- * proper theory
- *
- * @param term
- * @param os
- *
- * @return
+
+ /**
+ * Print the theory term (could be an atom) by delegating to the proper theory.
+ *
+ * @param term
+ * @param os
*/
virtual void printLetTerm(Expr term, std::ostream& os) = 0;
- virtual void printBoundTerm(Expr term, std::ostream& os, const LetMap& map) = 0;
- /**
+ virtual void printBoundTerm(Expr term, std::ostream& os,
+ const LetMap& map) = 0;
+
+ /**
* Print the proof representation of the given sort.
- *
- * @param os
+ *
+ * @param os
*/
- virtual void printSort(Type type, std::ostream& os) = 0;
- /**
+ virtual void printSort(Type type, std::ostream& os) = 0;
+
+ /**
* Print the theory assertions (arbitrary formulas over
* theory atoms)
- *
- * @param os
+ *
+ * @param os
* @param paren closing parenthesis
*/
virtual void printAssertions(std::ostream& os, std::ostream& paren) = 0;
- /**
+
+ /**
* Print proofs of all the theory lemmas (must prove
* actual clause used in resolution proof).
- *
- * @param os
- * @param paren
+ *
+ * @param os
+ * @param paren
*/
- virtual void printTheoryLemmas(const IdToSatClause& lemmas,
- std::ostream& os,
+ virtual void printTheoryLemmas(const IdToSatClause& lemmas, std::ostream& os,
std::ostream& paren) = 0;
- /**
- * Register theory atom (ensures all terms and atoms are declared).
- *
- * @param atom
+
+ /**
+ * Register theory atom (ensures all terms and atoms are declared).
+ *
+ * @param atom
*/
void registerTerm(Expr atom);
- /**
- * Ensures that a theory proof class for the given theory
- * is created.
- *
- * @param theory
+
+ /**
+ * Ensures that a theory proof class for the given theory is created.
+ *
+ * @param theory
*/
void registerTheory(theory::Theory* theory);
+
theory::TheoryId getTheoryForLemma(ClauseId id);
- TheoryProof* getTheoryProof(theory::TheoryId id);
+ TheoryProof* getTheoryProof(theory::TheoryId id);
};
class LFSCTheoryProofEngine : public TheoryProofEngine {
void printTheoryTerm(Expr term, std::ostream& os, const LetMap& map);
void bind(Expr term, LetMap& map, Bindings& let_order);
public:
- LFSCTheoryProofEngine(SmtGlobals* globals)
- : TheoryProofEngine(globals) {}
-
+ LFSCTheoryProofEngine()
+ : TheoryProofEngine() {}
+
void printDeclarations(std::ostream& os, std::ostream& paren);
virtual void printCoreTerm(Expr term, std::ostream& os, const LetMap& map);
virtual void printLetTerm(Expr term, std::ostream& os);
virtual void printTheoryLemmas(const IdToSatClause& lemmas,
std::ostream& os,
std::ostream& paren);
- virtual void printSort(Type type, std::ostream& os);
+ virtual void printSort(Type type, std::ostream& os);
};
class TheoryProof {
private:
/* Disable the default constructor. */
- BVMinisatSatSolver() CVC4_UNUSED;
+ BVMinisatSatSolver() CVC4_UNDEFINED;
class Statistics {
public:
using namespace std;
using namespace CVC4::kind;
-#ifdef CVC4_REPLAY
-# define CVC4_USE_REPLAY true
-#else /* CVC4_REPLAY */
-# define CVC4_USE_REPLAY false
-#endif /* CVC4_REPLAY */
-
namespace CVC4 {
namespace prop {
CnfStream::CnfStream(SatSolver* satSolver, Registrar* registrar,
- context::Context* context, SmtGlobals* globals,
- bool fullLitToNodeMap, std::string name)
+ context::Context* context, bool fullLitToNodeMap,
+ std::string name)
: d_satSolver(satSolver),
d_booleanVariables(context),
d_nodeToLiteralMap(context),
d_registrar(registrar),
d_name(name),
d_cnfProof(NULL),
- d_globals(globals),
d_removable(false) {
}
TseitinCnfStream::TseitinCnfStream(SatSolver* satSolver, Registrar* registrar,
context::Context* context,
- SmtGlobals* globals, bool fullLitToNodeMap,
- std::string name)
- : CnfStream(satSolver, registrar, context, globals, fullLitToNodeMap, name)
+ bool fullLitToNodeMap, std::string name)
+ : CnfStream(satSolver, registrar, context, fullLitToNodeMap, name)
{}
void CnfStream::assertClause(TNode node, SatClause& c) {
}
// If it's a theory literal, need to store it for back queries
- if ( isTheoryAtom || d_fullLitToNodeMap ||
- ( CVC4_USE_REPLAY && d_globals->getReplayLog() != NULL ) ||
- (Dump.isOn("clauses")) ) {
-
+ if ( isTheoryAtom || d_fullLitToNodeMap || (Dump.isOn("clauses")) ) {
d_literalToNodeMap.insert_safe(lit, node);
d_literalToNodeMap.insert_safe(~lit, node.notNode());
}
#include "proof/proof_manager.h"
#include "prop/registrar.h"
#include "prop/theory_proxy.h"
-#include "smt/smt_globals.h"
+#include "smt_util/lemma_channels.h"
namespace CVC4 {
namespace prop {
/** Pointer to the proof corresponding to this CnfStream */
CnfProof* d_cnfProof;
- /** Container for misc. globals. */
- SmtGlobals* d_globals;
-
/**
* How many literals were already mapped at the top-level when we
* tried to convertAndAssert() something. This
CnfStream(SatSolver* satSolver,
Registrar* registrar,
context::Context* context,
- SmtGlobals* globals,
bool fullLitToNodeMap = false,
std::string name="");
* @param fullLitToNodeMap maintain a full SAT-literal-to-Node mapping,
* even for non-theory literals
*/
- TseitinCnfStream(SatSolver* satSolver, Registrar* registrar, context::Context* context, SmtGlobals* globals, bool fullLitToNodeMap = false, std::string name = "");
+ TseitinCnfStream(SatSolver* satSolver, Registrar* registrar,
+ context::Context* context, bool fullLitToNodeMap = false,
+ std::string name = "");
private:
using namespace std;
using namespace CVC4::context;
+
+#ifdef CVC4_REPLAY
+# define CVC4_USE_REPLAY true
+#else /* CVC4_REPLAY */
+# define CVC4_USE_REPLAY false
+#endif /* CVC4_REPLAY */
+
namespace CVC4 {
namespace prop {
}
};
-PropEngine::PropEngine(TheoryEngine* te, DecisionEngine *de, Context* satContext, Context* userContext, SmtGlobals* globals) :
+PropEngine::PropEngine(TheoryEngine* te, DecisionEngine *de, Context* satContext,
+ Context* userContext, std::ostream* replayLog,
+ ExprStream* replayStream, LemmaChannels* channels) :
d_inCheckSat(false),
d_theoryEngine(te),
d_decisionEngine(de),
d_registrar(NULL),
d_cnfStream(NULL),
d_interrupted(false),
- d_resourceManager(NodeManager::currentResourceManager()),
- d_globals(globals)
+ d_resourceManager(NodeManager::currentResourceManager())
{
Debug("prop") << "Constructing the PropEngine" << endl;
d_registrar = new theory::TheoryRegistrar(d_theoryEngine);
d_cnfStream = new CVC4::prop::TseitinCnfStream
- (d_satSolver, d_registrar, userContext, d_globals,
+ (d_satSolver, d_registrar, userContext,
// fullLitToNode Map =
options::threads() > 1 ||
- options::decisionMode() == decision::DECISION_STRATEGY_RELEVANCY
- );
+ options::decisionMode() == decision::DECISION_STRATEGY_RELEVANCY ||
+ ( CVC4_USE_REPLAY && replayLog != NULL ));
- d_theoryProxy = new TheoryProxy(this, d_theoryEngine, d_decisionEngine, d_context, d_cnfStream, d_globals);
+ d_theoryProxy = new TheoryProxy(
+ this, d_theoryEngine, d_decisionEngine, d_context, d_cnfStream, replayLog,
+ replayStream, channels);
d_satSolver->initialize(d_context, d_theoryProxy);
d_decisionEngine->setSatSolver(d_satSolver);
#include <sys/time.h>
#include "base/modal_exception.h"
+#include "expr/expr_stream.h"
#include "expr/node.h"
#include "options/options.h"
#include "proof/proof_manager.h"
-#include "smt/smt_globals.h"
-#include "util/unsafe_interrupt_exception.h"
+#include "smt_util/lemma_channels.h"
#include "util/result.h"
+#include "util/unsafe_interrupt_exception.h"
namespace CVC4 {
/** Dump out the satisfying assignment (after SAT result) */
void printSatisfyingAssignment();
- /** Container for misc. globals. */
- SmtGlobals* d_globals;
-
public:
/**
* Create a PropEngine with a particular decision and theory engine.
*/
- PropEngine(TheoryEngine*, DecisionEngine*, context::Context* satContext, context::Context* userContext, SmtGlobals* global);
+ PropEngine(TheoryEngine*, DecisionEngine*, context::Context* satContext,
+ context::Context* userContext, std::ostream* replayLog,
+ ExprStream* replayStream, LemmaChannels* channels);
/**
* Destructor.
DecisionEngine* decisionEngine,
context::Context* context,
CnfStream* cnfStream,
- SmtGlobals* globals)
+ std::ostream* replayLog,
+ ExprStream* replayStream,
+ LemmaChannels* channels)
: d_propEngine(propEngine),
d_cnfStream(cnfStream),
d_decisionEngine(decisionEngine),
d_theoryEngine(theoryEngine),
- d_globals(globals),
+ d_channels(channels),
+ d_replayLog(replayLog),
+ d_replayStream(replayStream),
d_queue(context),
d_replayedDecisions("prop::theoryproxy::replayedDecisions", 0)
{
/** The lemma input channel we are using. */
LemmaInputChannel* TheoryProxy::inputChannel() {
- return d_globals->getLemmaInputChannel();
+ return d_channels->getLemmaInputChannel();
}
/** The lemma output channel we are using. */
LemmaOutputChannel* TheoryProxy::outputChannel() {
- return d_globals->getLemmaOutputChannel();
-}
-
-std::ostream* TheoryProxy::replayLog() {
- return d_globals->getReplayLog();
-}
-
-ExprStream* TheoryProxy::replayStream() {
- return d_globals->getReplayStream();
+ return d_channels->getLemmaOutputChannel();
}
SatLiteral TheoryProxy::getNextReplayDecision() {
#ifdef CVC4_REPLAY
- if(replayStream() != NULL) {
- Expr e = replayStream()->nextExpr();
+ if(d_replayStream != NULL) {
+ Expr e = d_replayStream->nextExpr();
if(!e.isNull()) { // we get null node when out of decisions to replay
// convert & return
++d_replayedDecisions;
void TheoryProxy::logDecision(SatLiteral lit) {
#ifdef CVC4_REPLAY
- if(replayLog() != NULL) {
+ if(d_replayLog != NULL) {
Assert(lit != undefSatLiteral, "logging an `undef' decision ?!");
- (*replayLog()) << d_cnfStream->getNode(lit) << std::endl;
+ (*d_replayLog) << d_cnfStream->getNode(lit) << std::endl;
}
#endif /* CVC4_REPLAY */
}
#include <iosfwd>
#include "context/cdqueue.h"
+#include "expr/expr_stream.h"
#include "expr/node.h"
#include "prop/sat_solver.h"
-#include "smt/smt_globals.h"
-#include "smt_util/lemma_output_channel.h"
+#include "smt_util/lemma_channels.h"
#include "smt_util/lemma_input_channel.h"
+#include "smt_util/lemma_output_channel.h"
#include "theory/theory.h"
#include "util/statistics_registry.h"
DecisionEngine* decisionEngine,
context::Context* context,
CnfStream* cnfStream,
- SmtGlobals* globals);
+ std::ostream* replayLog,
+ ExprStream* replayStream,
+ LemmaChannels* globals);
~TheoryProxy();
TheoryEngine* d_theoryEngine;
- /**
- * Container for inputChannel, outputChannel, replayLog, and
- * replayStream.
- */
- SmtGlobals* d_globals;
+ /** Container for inputChannel() and outputChannel(). */
+ LemmaChannels* d_channels;
+
+ /** Stream on which to log replay events. */
+ std::ostream* d_replayLog;
+
+ /** Stream for replaying decisions. */
+ ExprStream* d_replayStream;
/** The lemma input channel we are using. */
LemmaInputChannel* inputChannel();
/** The lemma output channel we are using. */
LemmaOutputChannel* outputChannel();
- std::ostream* replayLog();
- ExprStream* replayStream();
-
/** Queue of asserted facts */
context::CDQueue<TNode> d_queue;
--- /dev/null
+/********************* */
+/*! \file managed_ostreams.cpp
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2016 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Wrappers to handle memory management of ostreams.
+ **
+ ** This file contains wrappers to handle special cases of managing memory
+ ** related to ostreams.
+ **/
+
+#include "smt/managed_ostreams.h"
+
+#include <ostream>
+
+#include "options/open_ostream.h"
+#include "options/smt_options.h"
+#include "smt/update_ostream.h"
+
+namespace CVC4 {
+
+ManagedOstream::ManagedOstream() : d_managed(NULL) {}
+
+ManagedOstream::~ManagedOstream() {
+ manage(NULL);
+ Assert(d_managed == NULL);
+}
+
+void ManagedOstream::set(const std::string& filename) {
+ std::pair<bool, std::ostream*> pair = open(filename);
+ initialize(pair.second);
+ manage(pair.first ? pair.second : NULL);
+}
+
+std::pair<bool, std::ostream*> ManagedOstream::open(const std::string& filename)
+ const {
+ OstreamOpener opener(getName());
+ addSpecialCases(&opener);
+ return opener.open(filename);
+}
+
+void ManagedOstream::manage(std::ostream* new_managed_value) {
+ if(d_managed == new_managed_value){
+ // This is a no-op.
+ } else {
+ Assert(d_managed != new_managed_value);
+ std::ostream* old_managed_value = d_managed;
+ d_managed = new_managed_value;
+ if(old_managed_value != NULL){
+ delete old_managed_value;
+ }
+ }
+}
+
+ManagedDumpOStream::~ManagedDumpOStream() {
+ if(Dump.getStreamPointer() == getManagedOstream()) {
+ Dump.setStream(&null_os);
+ }
+}
+
+std::string ManagedDumpOStream::defaultSource() const{
+ return options::dumpToFileName();
+}
+
+
+void ManagedDumpOStream::initialize(std::ostream* outStream) {
+#ifdef CVC4_DUMPING
+ DumpOstreamUpdate dumpGetStream;
+ dumpGetStream.apply(outStream);
+#else /* CVC4_DUMPING */
+ throw OptionException(
+ "The dumping feature was disabled in this build of CVC4.");
+#endif /* CVC4_DUMPING */
+}
+
+void ManagedDumpOStream::addSpecialCases(OstreamOpener* opener) const {
+ opener->addSpecialCase("-", &DumpOutC::dump_cout);
+}
+
+ManagedRegularOutputChannel::~ManagedRegularOutputChannel() {
+ // Set all ostream that may still be using the old value of this channel
+ // to null_os. Consult RegularOutputChannelListener for the list of
+ // channels.
+ if(options::err() == getManagedOstream()){
+ options::err.set(&null_os);
+ }
+}
+
+std::string ManagedRegularOutputChannel::defaultSource() const {
+ return options::regularChannelName();
+}
+
+void ManagedRegularOutputChannel::initialize(std::ostream* outStream) {
+ OptionsErrOstreamUpdate optionsErrOstreamUpdate;
+ optionsErrOstreamUpdate.apply(outStream);
+}
+
+void ManagedRegularOutputChannel::addSpecialCases(OstreamOpener* opener)
+ const {
+ opener->addSpecialCase("stdout", &std::cout);
+ opener->addSpecialCase("stderr", &std::cerr);
+}
+
+ManagedDiagnosticOutputChannel::~ManagedDiagnosticOutputChannel() {
+ // Set all ostreams that may still be using the old value of this channel
+ // to null_os. Consult DiagnosticOutputChannelListener for the list of
+ // channels.
+ if(options::err() == getManagedOstream()){
+ options::err.set(&null_os);
+ }
+
+ if(Debug.getStreamPointer() == getManagedOstream()) {
+ Debug.setStream(&null_os);
+ }
+ if(Warning.getStreamPointer() == getManagedOstream()){
+ Warning.setStream(&null_os);
+ }
+ if(Message.getStreamPointer() == getManagedOstream()){
+ Message.setStream(&null_os);
+ }
+ if(Notice.getStreamPointer() == getManagedOstream()){
+ Notice.setStream(&null_os);
+ }
+ if(Chat.getStreamPointer() == getManagedOstream()){
+ Chat.setStream(&null_os);
+ }
+ if(Trace.getStreamPointer() == getManagedOstream()){
+ Trace.setStream(&null_os);
+ }
+}
+
+
+std::string ManagedDiagnosticOutputChannel::defaultSource() const {
+ return options::diagnosticChannelName();
+}
+void ManagedDiagnosticOutputChannel::initialize(std::ostream* outStream) {
+ DebugOstreamUpdate debugOstreamUpdate;
+ debugOstreamUpdate.apply(outStream);
+ WarningOstreamUpdate warningOstreamUpdate;
+ warningOstreamUpdate.apply(outStream);
+ MessageOstreamUpdate messageOstreamUpdate;
+ messageOstreamUpdate.apply(outStream);
+ NoticeOstreamUpdate noticeOstreamUpdate;
+ noticeOstreamUpdate.apply(outStream);
+ ChatOstreamUpdate chatOstreamUpdate;
+ chatOstreamUpdate.apply(outStream);
+ TraceOstreamUpdate traceOstreamUpdate;
+ traceOstreamUpdate.apply(outStream);
+ OptionsErrOstreamUpdate optionsErrOstreamUpdate;
+ optionsErrOstreamUpdate.apply(outStream);
+}
+
+void ManagedDiagnosticOutputChannel::addSpecialCases(OstreamOpener* opener)
+ const {
+ opener->addSpecialCase("stdout", &std::cout);
+ opener->addSpecialCase("stderr", &std::cerr);
+}
+
+
+ManagedReplayLogOstream::ManagedReplayLogOstream() : d_replayLog(NULL) {}
+ManagedReplayLogOstream::~ManagedReplayLogOstream(){
+ if(d_replayLog != NULL) {
+ (*d_replayLog) << std::flush;
+ }
+}
+
+std::string ManagedReplayLogOstream::defaultSource() const {
+ return options::replayLogFilename();
+}
+
+void ManagedReplayLogOstream::initialize(std::ostream* outStream) {
+ if(outStream != NULL){
+ *outStream << language::SetLanguage(options::outputLanguage())
+ << expr::ExprSetDepth(-1);
+ }
+ /* Do this regardless of managing the memory. */
+ d_replayLog = outStream;
+}
+
+/** Adds special cases to an ostreamopener. */
+void ManagedReplayLogOstream::addSpecialCases(OstreamOpener* opener) const {
+ opener->addSpecialCase("-", &std::cout);
+}
+
+
+}/* CVC4 namespace */
--- /dev/null
+/********************* */
+/*! \file managed_ostreams.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2016 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief Wrappers to handle memory management of ostreams.
+ **
+ ** This file contains wrappers to handle special cases of managing memory
+ ** related to ostreams.
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__MANAGED_OSTREAMS_H
+#define __CVC4__MANAGED_OSTREAMS_H
+
+#include <ostream>
+
+#include "options/open_ostream.h"
+#include "smt/update_ostream.h"
+
+namespace CVC4 {
+
+/** This abstracts the management of ostream memory and initialization. */
+class ManagedOstream {
+ public:
+ /** Initially getManagedOstream() == NULL. */
+ ManagedOstream();
+ virtual ~ManagedOstream();
+
+ /** Returns the pointer to the managed ostream. */
+ std::ostream* getManagedOstream() const { return d_managed; }
+
+ /** Returns the name of the ostream geing managed. */
+ virtual const char* getName() const = 0;
+
+ /**
+ * Set opens a file with filename, initializes the stream.
+ * If the opened ostream is marked as managed, this calls manage(stream).
+ * If the opened ostream is not marked as managed, this calls manage(NULL).
+ */
+ void set(const std::string& filename);
+
+ /** If this is associated with an option, return the string value. */
+ virtual std::string defaultSource() { return ""; }
+
+ protected:
+
+ /**
+ * Opens an ostream using OstreamOpener with the name getName() with the
+ * special cases added by addSpecialCases().
+ */
+ std::pair<bool, std::ostream*> open(const std::string& filename) const;
+
+ /**
+ * Updates the value of managed pointer. Whenever this changes,
+ * beforeRelease() is called on the old value.
+ */
+ void manage(std::ostream* new_managed_value);
+
+ /** Initializes an output stream. Not necessarily managed. */
+ virtual void initialize(std::ostream* outStream) {}
+
+ /** Adds special cases to an ostreamopener. */
+ virtual void addSpecialCases(OstreamOpener* opener) const {}
+
+ private:
+ std::ostream* d_managed;
+}; /* class ManagedOstream */
+
+class SetToDefaultSourceListener : public Listener {
+ public:
+ SetToDefaultSourceListener(ManagedOstream* managedOstream)
+ : d_managedOstream(managedOstream){}
+
+ virtual void notify() {
+ d_managedOstream->set(d_managedOstream->defaultSource());
+ }
+
+ private:
+ ManagedOstream* d_managedOstream;
+};
+
+/**
+ * This controls the memory associated with --dump-to.
+ * This is is assumed to recieve a set whenever diagnosticChannelName
+ * is updated.
+ */
+class ManagedDumpOStream : public ManagedOstream {
+ public:
+ ManagedDumpOStream(){}
+ ~ManagedDumpOStream();
+
+ virtual const char* getName() const { return "dump-to"; }
+ virtual std::string defaultSource() const;
+
+ protected:
+ /** Initializes an output stream. Not necessarily managed. */
+ virtual void initialize(std::ostream* outStream);
+
+ /** Adds special cases to an ostreamopener. */
+ virtual void addSpecialCases(OstreamOpener* opener) const;
+};/* class ManagedDumpOStream */
+
+/**
+ * When d_managedRegularChannel is non-null, it owns the memory allocated
+ * with the regular-output-channel. This is set when
+ * options::regularChannelName is set.
+ */
+class ManagedRegularOutputChannel : public ManagedOstream {
+ public:
+ ManagedRegularOutputChannel(){}
+
+ /** Assumes Options are in scope. */
+ ~ManagedRegularOutputChannel();
+
+ virtual const char* getName() const { return "regular-output-channel"; }
+ virtual std::string defaultSource() const;
+
+ protected:
+ /** Initializes an output stream. Not necessarily managed. */
+ virtual void initialize(std::ostream* outStream);
+
+ /** Adds special cases to an ostreamopener. */
+ virtual void addSpecialCases(OstreamOpener* opener) const;
+};/* class ManagedRegularOutputChannel */
+
+
+/**
+ * This controls the memory associated with diagnostic-output-channel.
+ * This is is assumed to recieve a set whenever options::diagnosticChannelName
+ * is updated.
+ */
+class ManagedDiagnosticOutputChannel : public ManagedOstream {
+ public:
+ ManagedDiagnosticOutputChannel(){}
+
+ /** Assumes Options are in scope. */
+ ~ManagedDiagnosticOutputChannel();
+
+ virtual const char* getName() const { return "diagnostic-output-channel"; }
+ virtual std::string defaultSource() const;
+
+ protected:
+ /** Initializes an output stream. Not necessarily managed. */
+ virtual void initialize(std::ostream* outStream);
+
+ /** Adds special cases to an ostreamopener. */
+ virtual void addSpecialCases(OstreamOpener* opener) const;
+};/* class ManagedRegularOutputChannel */
+
+/** This controls the memory associated with replay-log. */
+class ManagedReplayLogOstream : public ManagedOstream {
+ public:
+ ManagedReplayLogOstream();
+ ~ManagedReplayLogOstream();
+
+ std::ostream* getReplayLog() const { return d_replayLog; }
+ virtual const char* getName() const { return "replay-log"; }
+ virtual std::string defaultSource() const;
+
+ protected:
+ /** Initializes an output stream. Not necessarily managed. */
+ virtual void initialize(std::ostream* outStream);
+
+ /** Adds special cases to an ostreamopener. */
+ virtual void addSpecialCases(OstreamOpener* opener) const;
+
+ private:
+ std::ostream* d_replayLog;
+};/* class ManagedRegularOutputChannel */
+
+}/* CVC4 namespace */
+
+#endif /* __CVC4__MANAGED_OSTREAMS_H */
#include <utility>
#include <vector>
+#include "base/configuration.h"
+#include "base/configuration_private.h"
#include "base/exception.h"
#include "base/listener.h"
#include "base/modal_exception.h"
#include "options/decision_mode.h"
#include "options/decision_options.h"
#include "options/main_options.h"
+#include "options/open_ostream.h"
#include "options/option_exception.h"
-#include "options/options_handler_interface.h"
#include "options/printer_options.h"
#include "options/prop_options.h"
#include "options/quantifiers_options.h"
#include "smt/boolean_terms.h"
#include "smt/command_list.h"
#include "smt/logic_request.h"
+#include "smt/managed_ostreams.h"
#include "smt/model_postprocessor.h"
#include "smt/smt_engine_scope.h"
-#include "smt/smt_options_handler.h"
+#include "smt/update_ostream.h"
#include "smt_util/boolean_simplification.h"
#include "smt_util/command.h"
#include "smt_util/ite_removal.h"
#include "theory/theory_engine.h"
#include "theory/theory_model.h"
#include "theory/theory_traits.h"
-#include "util/configuration.h"
-#include "util/configuration_private.h"
#include "util/hash.h"
#include "util/proof.h"
#include "util/resource_manager.h"
SmtEngine* d_smt;
}; /* class HardResourceOutListener */
+class SetLogicListener : public Listener {
+ public:
+ SetLogicListener(SmtEngine& smt) : d_smt(&smt) {}
+ virtual void notify() {
+ LogicInfo inOptions(options::forceLogicString());
+ d_smt->setLogic(inOptions);
+ }
+ private:
+ SmtEngine* d_smt;
+}; /* class SetLogicListener */
+
+class BeforeSearchListener : public Listener {
+ public:
+ BeforeSearchListener(SmtEngine& smt) : d_smt(&smt) {}
+ virtual void notify() {
+ d_smt->beforeSearch();
+ }
+ private:
+ SmtEngine* d_smt;
+}; /* class BeforeSearchListener */
+
+class UseTheoryListListener : public Listener {
+ public:
+ UseTheoryListListener(TheoryEngine* theoryEngine)
+ : d_theoryEngine(theoryEngine)
+ {}
+
+ void notify() {
+ std::stringstream commaList(options::useTheoryList());
+ std::string token;
+
+ Debug("UseTheoryListListener") << "UseTheoryListListener::notify() "
+ << options::useTheoryList() << std::endl;
+
+ while(std::getline(commaList, token, ',')){
+ if(token == "help") {
+ puts(theory::useTheoryHelp);
+ exit(1);
+ }
+ if(theory::useTheoryValidate(token)) {
+ d_theoryEngine->enableTheoryAlternative(token);
+ } else {
+ throw OptionException(
+ std::string("unknown option for --use-theory : `") + token +
+ "'. Try --use-theory=help.");
+ }
+ }
+ }
+
+ private:
+ TheoryEngine* d_theoryEngine;
+}; /* class UseTheoryListListener */
+
+
+class SetDefaultExprDepthListener : public Listener {
+ public:
+ virtual void notify() {
+ int depth = options::defaultExprDepth();
+ Debug.getStream() << expr::ExprSetDepth(depth);
+ Trace.getStream() << expr::ExprSetDepth(depth);
+ Notice.getStream() << expr::ExprSetDepth(depth);
+ Chat.getStream() << expr::ExprSetDepth(depth);
+ Message.getStream() << expr::ExprSetDepth(depth);
+ Warning.getStream() << expr::ExprSetDepth(depth);
+ // intentionally exclude Dump stream from this list
+ }
+};
+
+class SetDefaultExprDagListener : public Listener {
+ public:
+ virtual void notify() {
+ int dag = options::defaultDagThresh();
+ Debug.getStream() << expr::ExprDag(dag);
+ Trace.getStream() << expr::ExprDag(dag);
+ Notice.getStream() << expr::ExprDag(dag);
+ Chat.getStream() << expr::ExprDag(dag);
+ Message.getStream() << expr::ExprDag(dag);
+ Warning.getStream() << expr::ExprDag(dag);
+ Dump.getStream() << expr::ExprDag(dag);
+ }
+};
+
+class SetPrintExprTypesListener : public Listener {
+ public:
+ virtual void notify() {
+ bool value = options::printExprTypes();
+ Debug.getStream() << expr::ExprPrintTypes(value);
+ Trace.getStream() << expr::ExprPrintTypes(value);
+ Notice.getStream() << expr::ExprPrintTypes(value);
+ Chat.getStream() << expr::ExprPrintTypes(value);
+ Message.getStream() << expr::ExprPrintTypes(value);
+ Warning.getStream() << expr::ExprPrintTypes(value);
+ // intentionally exclude Dump stream from this list
+ }
+};
+
+class DumpModeListener : public Listener {
+ public:
+ virtual void notify() {
+ const std::string& value = options::dumpModeString();
+ Dump.setDumpFromString(value);
+ }
+};
+
+class PrintSuccessListener : public Listener {
+ public:
+ virtual void notify() {
+ bool value = options::printSuccess();
+ Debug.getStream() << Command::printsuccess(value);
+ Trace.getStream() << Command::printsuccess(value);
+ Notice.getStream() << Command::printsuccess(value);
+ Chat.getStream() << Command::printsuccess(value);
+ Message.getStream() << Command::printsuccess(value);
+ Warning.getStream() << Command::printsuccess(value);
+ *options::out() << Command::printsuccess(value);
+ }
+};
+
+
/**
* This is an inelegant solution, but for the present, it will work.
class SmtEnginePrivate : public NodeManagerListener {
SmtEngine& d_smt;
+ typedef hash_map<Node, Node, NodeHashFunction> NodeToNodeHashMap;
+ typedef hash_map<Node, bool, NodeHashFunction> NodeToBoolHashMap;
+
/**
* Manager for limiting time and abstract resource usage.
*/
ResourceManager* d_resourceManager;
- /**
- * Listener for the when a soft resource out occurs.
- */
- RegisterListener* d_softResourceOutListener;
+ /** Manager for the memory of regular-output-channel. */
+ ManagedRegularOutputChannel d_managedRegularChannel;
+
+ /** Manager for the memory of diagnostic-output-channel. */
+ ManagedDiagnosticOutputChannel d_managedDiagnosticChannel;
+
+ /** Manager for the memory of --dump-to. */
+ ManagedDumpOStream d_managedDumpChannel;
+
+ /** Manager for --replay-log. */
+ ManagedReplayLogOstream d_managedReplayLog;
/**
- * Listener for the when a hard resource out occurs.
+ * This list contains:
+ * softResourceOut
+ * hardResourceOut
+ * setForceLogic
+ * beforeSearchListener
+ * UseTheoryListListener
+ *
+ * This needs to be deleted before both NodeManager's Options,
+ * SmtEngine, d_resourceManager, and TheoryEngine.
*/
- RegisterListener* d_hardResourceOutListener;
+ ListenerRegistrationList* d_listenerRegistrations;
/** Learned literals */
vector<Node> d_nonClausalLearnedLiterals;
* same AbstractValues for the same real constants. Only used if
* options::abstractValues() is on.
*/
- hash_map<Node, Node, NodeHashFunction> d_abstractValues;
+ NodeToNodeHashMap d_abstractValues;
/** Number of calls of simplify assertions active.
*/
*/
void removeITEs();
- Node intToBV(TNode n, std::hash_map<Node, Node, NodeHashFunction>& cache);
- Node intToBVMakeBinary(TNode n, std::hash_map<Node, Node, NodeHashFunction>& cache);
+ Node intToBV(TNode n, NodeToNodeHashMap& cache);
+ Node intToBVMakeBinary(TNode n, NodeToNodeHashMap& cache);
/**
- * Helper function to fix up assertion list to restore invariants needed after ite removal
+ * Helper function to fix up assertion list to restore invariants needed after
+ * ite removal.
*/
- void collectSkolems(TNode n, set<TNode>& skolemSet, hash_map<Node, bool, NodeHashFunction>& cache);
+ void collectSkolems(TNode n, set<TNode>& skolemSet, NodeToBoolHashMap& cache);
/**
- * Helper function to fix up assertion list to restore invariants needed after ite removal
+ * Helper function to fix up assertion list to restore invariants needed after
+ * ite removal.
*/
- bool checkForBadSkolems(TNode n, TNode skolem, hash_map<Node, bool, NodeHashFunction>& cache);
+ bool checkForBadSkolems(TNode n, TNode skolem, NodeToBoolHashMap& cache);
// Lift bit-vectors of size 1 to booleans
void bvToBool();
// Simplify based on unconstrained values
void unconstrainedSimp();
- // Ensures the assertions asserted after before now
- // effectively come before d_realAssertionsEnd
+ /**
+ * Ensures the assertions asserted after before now effectively come before
+ * d_realAssertionsEnd.
+ */
void compressBeforeRealAssertions(size_t before);
/**
void constrainSubtypes(TNode n, AssertionPipeline& assertions)
throw();
- // trace nodes back to their assertions using CircuitPropagator's BackEdgesMap
- void traceBackToAssertions(const std::vector<Node>& nodes, std::vector<TNode>& assertions);
- // remove conjuncts in toRemove from conjunction n; return # of removed conjuncts
- size_t removeFromConjunction(Node& n, const std::hash_set<unsigned long>& toRemove);
+ /**
+ * Trace nodes back to their assertions using CircuitPropagator's
+ * BackEdgesMap.
+ */
+ void traceBackToAssertions(const std::vector<Node>& nodes,
+ std::vector<TNode>& assertions);
- // scrub miplib encodings
+ /**
+ * Remove conjuncts in toRemove from conjunction n. Return # of removed
+ * conjuncts.
+ */
+ size_t removeFromConjunction(Node& n,
+ const std::hash_set<unsigned long>& toRemove);
+
+ /** Scrub miplib encodings. */
void doMiplibTrick();
/**
*
* Returns false if the formula simplifies to "false"
*/
- bool simplifyAssertions() throw(TypeCheckingException, LogicException, UnsafeInterruptException);
+ bool simplifyAssertions() throw(TypeCheckingException, LogicException,
+ UnsafeInterruptException);
public:
SmtEnginePrivate(SmtEngine& smt) :
d_smt(smt),
- d_resourceManager(NULL),
- d_softResourceOutListener(NULL),
- d_hardResourceOutListener(NULL),
+ d_managedRegularChannel(),
+ d_managedDiagnosticChannel(),
+ d_managedDumpChannel(),
+ d_managedReplayLog(),
+ d_listenerRegistrations(new ListenerRegistrationList()),
d_nonClausalLearnedLiterals(),
d_realAssertionsEnd(0),
d_booleanTermConverter(NULL),
d_true = NodeManager::currentNM()->mkConst(true);
d_resourceManager = NodeManager::currentResourceManager();
- d_softResourceOutListener = new RegisterListener(
- d_resourceManager->getSoftListeners(),
- new SoftResourceOutListener(d_smt));
-
- d_hardResourceOutListener = new RegisterListener(
- d_resourceManager->getHardListeners(),
- new HardResourceOutListener(d_smt));
-
+ d_listenerRegistrations->add(d_resourceManager->registerSoftListener(
+ new SoftResourceOutListener(d_smt)));
+
+ d_listenerRegistrations->add(d_resourceManager->registerHardListener(
+ new HardResourceOutListener(d_smt)));
+
+ Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerForceLogicListener(
+ new SetLogicListener(d_smt), true));
+
+ // Multiple options reuse BeforeSearchListener so registration requires an
+ // extra bit of care.
+ // We can safely not call notify on this before search listener at
+ // registration time. This d_smt cannot be beforeSearch at construction
+ // time. Therefore the BeforeSearchListener is a no-op. Therefore it does
+ // not have to be called.
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerBeforeSearchListener(
+ new BeforeSearchListener(d_smt)));
+
+ // These do need registration calls.
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDefaultExprDepthListener(
+ new SetDefaultExprDepthListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDefaultExprDagListener(
+ new SetDefaultExprDagListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetPrintExprTypesListener(
+ new SetPrintExprTypesListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDumpModeListener(
+ new DumpModeListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetPrintSuccessListener(
+ new PrintSuccessListener(), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetRegularOutputChannelListener(
+ new SetToDefaultSourceListener(&d_managedRegularChannel), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetDiagnosticOutputChannelListener(
+ new SetToDefaultSourceListener(&d_managedDiagnosticChannel), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerDumpToFileNameListener(
+ new SetToDefaultSourceListener(&d_managedDumpChannel), true));
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerSetReplayLogFilename(
+ new SetToDefaultSourceListener(&d_managedReplayLog), true));
}
~SmtEnginePrivate() throw() {
- delete d_hardResourceOutListener;
- d_hardResourceOutListener = NULL;
- delete d_softResourceOutListener;
- d_softResourceOutListener = NULL;
+ delete d_listenerRegistrations;
if(d_propagatorNeedsFinish) {
d_propagator.finish();
void addFormula(TNode n, bool inUnsatCore, bool inInput = true)
throw(TypeCheckingException, LogicException);
- /**
- * Expand definitions in n.
- */
- Node expandDefinitions(TNode n, hash_map<Node, Node, NodeHashFunction>& cache, bool expandOnly = false)
- throw(TypeCheckingException, LogicException, UnsafeInterruptException);
+ /** Expand definitions in n. */
+ Node expandDefinitions(TNode n, NodeToNodeHashMap& cache,
+ bool expandOnly = false)
+ throw(TypeCheckingException, LogicException, UnsafeInterruptException);
/**
* Rewrite Boolean terms in a Node.
Node simplify(TNode in) {
// Substitute out any abstract values in ex.
// Expand definitions.
- hash_map<Node, Node, NodeHashFunction> cache;
+ NodeToNodeHashMap cache;
Node n = expandDefinitions(in, cache).toExpr();
// Make sure we've done all preprocessing, etc.
Assert(d_assertions.size() == 0);
d_abstractValueMap.addSubstitution(val, n);
}
// We are supposed to ascribe types to all abstract values that go out.
- Node retval = d_smt.d_nodeManager->mkNode(kind::APPLY_TYPE_ASCRIPTION, d_smt.d_nodeManager->mkConst(AscriptionType(n.getType().toType())), val);
+ NodeManager* current = d_smt.d_nodeManager;
+ Node ascription = current->mkConst(AscriptionType(n.getType().toType()));
+ Node retval = current->mkNode(kind::APPLY_TYPE_ASCRIPTION, ascription, val);
return retval;
}
- std::hash_map<Node, Node, NodeHashFunction> rewriteApplyToConstCache;
+ NodeToNodeHashMap d_rewriteApplyToConstCache;
Node rewriteApplyToConst(TNode n) {
Trace("rewriteApplyToConst") << "rewriteApplyToConst :: " << n << std::endl;
- if(n.getMetaKind() == kind::metakind::CONSTANT || n.getMetaKind() == kind::metakind::VARIABLE) {
+ if(n.getMetaKind() == kind::metakind::CONSTANT ||
+ n.getMetaKind() == kind::metakind::VARIABLE)
+ {
return n;
}
- if(rewriteApplyToConstCache.find(n) != rewriteApplyToConstCache.end()) {
- Trace("rewriteApplyToConst") << "in cache :: " << rewriteApplyToConstCache[n] << std::endl;
- return rewriteApplyToConstCache[n];
+ if(d_rewriteApplyToConstCache.find(n) != d_rewriteApplyToConstCache.end()) {
+ Trace("rewriteApplyToConst") << "in cache :: "
+ << d_rewriteApplyToConstCache[n]
+ << std::endl;
+ return d_rewriteApplyToConstCache[n];
}
+
if(n.getKind() == kind::APPLY_UF) {
- if(n.getNumChildren() == 1 && n[0].isConst() && n[0].getType().isInteger()) {
+ if(n.getNumChildren() == 1 && n[0].isConst() &&
+ n[0].getType().isInteger())
+ {
stringstream ss;
ss << n.getOperator() << "_";
if(n[0].getConst<Rational>() < 0) {
} else {
ss << n[0];
}
- Node newvar = NodeManager::currentNM()->mkSkolem(ss.str(), n.getType(), "rewriteApplyToConst skolem", NodeManager::SKOLEM_EXACT_NAME);
- rewriteApplyToConstCache[n] = newvar;
+ Node newvar = NodeManager::currentNM()->mkSkolem(
+ ss.str(), n.getType(), "rewriteApplyToConst skolem",
+ NodeManager::SKOLEM_EXACT_NAME);
+ d_rewriteApplyToConstCache[n] = newvar;
Trace("rewriteApplyToConst") << "made :: " << newvar << std::endl;
return newvar;
} else {
stringstream ss;
- ss << "The rewrite-apply-to-const preprocessor is currently limited;\n"
- << "it only works if all function symbols are unary and with Integer\n"
- << "domain, and all applications are to integer values.\n"
+ ss << "The rewrite-apply-to-const preprocessor is currently limited;"
+ << std::endl
+ << "it only works if all function symbols are unary and with Integer"
+ << std::endl
+ << "domain, and all applications are to integer values." << std::endl
<< "Found application: " << n;
Unhandled(ss.str());
}
builder << rewriteApplyToConst(n[i]);
}
Node rewr = builder;
- rewriteApplyToConstCache[n] = rewr;
+ d_rewriteApplyToConstCache[n] = rewr;
Trace("rewriteApplyToConst") << "built :: " << rewr << std::endl;
return rewr;
}
+ void addUseTheoryListListener(TheoryEngine* theoryEngine){
+ Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
+ d_listenerRegistrations->add(
+ nodeManagerOptions.registerUseTheoryListListener(
+ new UseTheoryListListener(theoryEngine), true));
+ }
+
+ std::ostream* getReplayLog() const {
+ return d_managedReplayLog.getReplayLog();
+ }
};/* class SmtEnginePrivate */
}/* namespace CVC4::smt */
d_dumpCommands(),
d_defineCommands(),
d_logic(),
- d_originalOptions(em->getOptions()),
+ d_originalOptions(),
d_pendingPops(0),
d_fullyInited(false),
d_problemExtended(false),
d_needPostsolve(false),
d_earlyTheoryPP(true),
d_status(),
- d_optionsHandler(new SmtOptionsHandler(this)),
+ d_replayStream(NULL),
d_private(NULL),
d_smtAttributes(NULL),
d_statisticsRegistry(NULL),
d_stats(NULL),
- d_globals(new SmtGlobals())
+ d_channels(new LemmaChannels())
{
-
SmtScope smts(this);
+ d_originalOptions.copyValues(em->getOptions());
d_smtAttributes = new expr::attr::SmtAttributes(d_context);
d_private = new smt::SmtEnginePrivate(*this);
d_statisticsRegistry = new StatisticsRegistry();
d_theoryEngine = new TheoryEngine(d_context, d_userContext,
d_private->d_iteRemover,
const_cast<const LogicInfo&>(d_logic),
- d_globals);
+ d_channels);
// Add the theories
for(TheoryId id = theory::THEORY_FIRST; id < theory::THEORY_LAST; ++id) {
THEORY_PROOF(ProofManager::currentPM()->getTheoryProofEngine()->registerTheory(d_theoryEngine->theoryOf(id)); );
}
+ d_private->addUseTheoryListListener(d_theoryEngine);
+
// global push/pop around everything, to ensure proper destruction
// of context-dependent data structures
d_userContext->push();
d_decisionEngine->init(); // enable appropriate strategies
d_propEngine = new PropEngine(d_theoryEngine, d_decisionEngine, d_context,
- d_userContext, d_globals);
+ d_userContext, d_private->getReplayLog(),
+ d_replayStream, d_channels);
d_theoryEngine->setPropEngine(d_propEngine);
d_theoryEngine->setDecisionEngine(d_decisionEngine);
delete d_statisticsRegistry;
d_statisticsRegistry = NULL;
- delete d_optionsHandler;
- d_optionsHandler = NULL;
-
delete d_private;
d_private = NULL;
delete d_context;
d_context = NULL;
- delete d_globals;
- d_globals = NULL;
+ delete d_channels;
+ d_channels = NULL;
} catch(Exception& e) {
Warning() << "CVC4 threw an exception during cleanup." << endl
void SmtEngine::setLogic(const LogicInfo& logic) throw(ModalException) {
SmtScope smts(this);
if(d_fullyInited) {
- throw ModalException("Cannot set logic in SmtEngine after the engine has finished initializing");
+ throw ModalException("Cannot set logic in SmtEngine after the engine has "
+ "finished initializing.");
}
d_logic = logic;
setLogicInternal();
}
-void SmtEngine::setLogic(const std::string& s) throw(ModalException, LogicException) {
+void SmtEngine::setLogic(const std::string& s)
+ throw(ModalException, LogicException) {
SmtScope smts(this);
try {
setLogic(LogicInfo(s));
}
}
-void SmtEngine::setLogic(const char* logic) throw(ModalException, LogicException) {
+void SmtEngine::setLogic(const char* logic)
+ throw(ModalException, LogicException) {
setLogic(string(logic));
}
}
void SmtEngine::setLogicInternal() throw() {
- Assert(!d_fullyInited, "setting logic in SmtEngine but the engine has already finished initializing for this run");
+ Assert(!d_fullyInited, "setting logic in SmtEngine but the engine has already"
+ " finished initializing for this run");
d_logic.lock();
}
void SmtEngine::setDefaults() {
- if(options::forceLogic.wasSetByUser()) {
- d_logic = *(options::forceLogic());
+ if(options::forceLogicString.wasSetByUser()) {
+ d_logic = LogicInfo(options::forceLogicString());
}
else if (options::solveIntAsBV() > 0) {
d_logic = LogicInfo("QF_BV");
d_logic = d_logic.getUnlockedCopy();
d_logic.enableQuantifiers();
d_logic.lock();
- Trace("smt") << "turning on quantifier logic, for strings-exp" << std::endl;
+ Trace("smt") << "turning on quantifier logic, for strings-exp"
+ << std::endl;
}
if(! options::finiteModelFind.wasSetByUser()) {
options::finiteModelFind.set( true );
- Trace("smt") << "turning on finite-model-find, for strings-exp" << std::endl;
+ Trace("smt") << "turning on finite-model-find, for strings-exp"
+ << std::endl;
}
if(! options::fmfBoundInt.wasSetByUser()) {
if(! options::fmfBoundIntLazy.wasSetByUser()) {
if(options::checkModels()) {
if(! options::produceAssertions()) {
- Notice() << "SmtEngine: turning on produce-assertions to support check-models" << endl;
+ Notice() << "SmtEngine: turning on produce-assertions to support "
+ << "check-models." << endl;
setOption("produce-assertions", SExpr("true"));
}
}
if(options::simplificationMode.wasSetByUser()) {
throw OptionException("simplification not supported with unsat cores");
}
- Notice() << "SmtEngine: turning off simplification to support unsat-cores" << endl;
+ Notice() << "SmtEngine: turning off simplification to support unsat-cores"
+ << endl;
options::simplificationMode.set(SIMPLIFICATION_MODE_NONE);
}
if(Dump.isOn("benchmark")) {
Dump("benchmark") << ResetCommand();
}
- Options opts = d_originalOptions;
+ Options opts;
+ opts.copyValues(d_originalOptions);
this->~SmtEngine();
- NodeManager::fromExprManager(em)->getOptions() = opts;
+ NodeManager::fromExprManager(em)->getOptions().copyValues(opts);
new(this) SmtEngine(em);
}
-void SmtEngine::beforeSearch(SmtEngine* smt, const std::string& option) throw(ModalException) {
- if(smt != NULL && smt->d_fullyInited) {
- std::stringstream ss;
- ss << "cannot change option `" << option << "' after final initialization (i.e., after logic has been set)";
- throw ModalException(ss.str());
+void SmtEngine::beforeSearch() throw(ModalException) {
+ if(d_fullyInited) {
+ throw ModalException(
+ "SmtEngine::beforeSearch called after initialization.");
}
}
}
string optionarg = value.getValue();
-
- d_optionsHandler->setOption(key, optionarg);
+ Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
+ nodeManagerOptions.setOption(key, optionarg);
}
CVC4::SExpr SmtEngine::getOption(const std::string& key) const
return SExpr(result);
}
- return SExpr::parseAtom(d_optionsHandler->getOption(key));
+ Options& nodeManagerOptions = NodeManager::currentNM()->getOptions();
+ return SExpr::parseAtom(nodeManagerOptions.getOption(key));
+}
+
+void SmtEngine::setReplayStream(ExprStream* replayStream) {
+ AlwaysAssert(!d_fullyInited,
+ "Cannot set replay stream once fully initialized");
+ d_replayStream = replayStream;
}
}/* CVC4 namespace */
#include "context/cdlist_forward.h"
#include "expr/expr.h"
#include "expr/expr_manager.h"
+#include "expr/expr_stream.h"
#include "options/options.h"
#include "proof/unsat_core.h"
#include "smt/logic_exception.h"
-#include "smt/smt_globals.h"
+#include "smt_util/lemma_channels.h"
#include "theory/logic_info.h"
#include "util/hash.h"
#include "util/proof.h"
class PropEngine;
}/* CVC4::prop namespace */
-namespace options {
- class OptionsHandler;
-}/* CVC4::prop namespace */
-
namespace expr {
namespace attr {
class AttributeManager;
*/
std::map<std::string, Integer> d_commandVerbosity;
- /**
- * This responds to requests to set options.
- */
- options::OptionsHandler* d_optionsHandler;
+ /** ReplayStream for the solver. */
+ ExprStream* d_replayStream;
/**
* A private utility class to SmtEngine.
smt::SmtEngineStatistics* d_stats;
- SmtGlobals* d_globals;
+ /** Container for the lemma input and output channels for this SmtEngine.*/
+ LemmaChannels* d_channels;
/**
* Add to Model command. This is used for recording a command
void setPrintFuncInModel(Expr f, bool p);
+ /** Throws a ModalException if the SmtEngine has been fully initialized. */
+ void beforeSearch() throw(ModalException);
+
+ LemmaChannels* channels() { return d_channels; }
+
+
/**
- * Throws a ModalException if smt is non-null and the SmtEngine has not been fully initialized.
+ * Expermintal feature: Sets the sequence of decisions.
+ * This currently requires very fine grained knowledge about literal
+ * translation.
*/
- static void beforeSearch(SmtEngine* smt, const std::string& option) throw(ModalException);
+ void setReplayStream(ExprStream* exprStream);
- SmtGlobals* globals() { return d_globals; }
};/* class SmtEngine */
}/* CVC4 namespace */
#warning "TODO: Why is lfsc's check.h being included like this?"
#include "check.h"
+#include "base/configuration_private.h"
#include "base/cvc4_assert.h"
#include "base/output.h"
#include "smt/smt_engine.h"
-#include "util/configuration_private.h"
#include "util/statistics_registry.h"
using namespace CVC4;
#pragma once
+#include "base/configuration_private.h"
#include "base/cvc4_assert.h"
#include "base/output.h"
#include "base/tls.h"
#include "proof/proof_manager.h"
#include "options/smt_options.h"
#include "smt/smt_engine.h"
-#include "util/configuration_private.h"
namespace CVC4 {
+++ /dev/null
-/********************* */
-/*! \file smt_globals.cpp
- ** \verbatim
- ** Original author: Tim King
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2015 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief This class is a light container for globals that used to live
- ** in options. This is NOT a good long term solution, but is a reasonable
- ** stop gap.
- **
- ** This class is a light container for globals that used to live
- ** in options. This is NOT a good long term solution, but is a reasonable
- ** stop gap.
- **/
-
-#include "smt/smt_globals.h"
-
-#include <cerrno>
-#include <iostream>
-#include <string>
-#include <utility>
-
-#include "cvc4autoconfig.h" // Needed for CVC4_REPLAY
-#include "expr/expr_stream.h"
-#include "options/option_exception.h"
-#include "options/parser_options.h"
-#include "smt_util/lemma_input_channel.h"
-#include "smt_util/lemma_output_channel.h"
-#include "smt/smt_options_handler.h"
-
-namespace CVC4 {
-
-SmtGlobals::SmtGlobals()
- : d_gcReplayLog(false)
- , d_replayLog(NULL)
- , d_replayStream(NULL)
- , d_lemmaInputChannel(NULL)
- , d_lemmaOutputChannel(NULL)
-{}
-
-SmtGlobals::~SmtGlobals(){
- if(d_gcReplayLog){
- delete d_replayLog;
- d_gcReplayLog = false;
- d_replayLog = NULL;
- }
-}
-
-void SmtGlobals::setReplayLog(std::ostream* log){
- d_replayLog = log;
-}
-
-void SmtGlobals::setReplayStream(ExprStream* stream) {
- d_replayStream = stream;
-}
-
-void SmtGlobals::setLemmaInputChannel(LemmaInputChannel* in) {
- d_lemmaInputChannel = in;
-}
-
-void SmtGlobals::setLemmaOutputChannel(LemmaOutputChannel* out) {
- d_lemmaOutputChannel = out;
-}
-
-void SmtGlobals::parseReplayLog(std::string optarg) throw (OptionException) {
- if(d_gcReplayLog){
- delete d_replayLog;
- d_gcReplayLog = false;
- d_replayLog = NULL;
- }
-
- std::pair<bool, std::ostream*> checkResult = checkReplayLogFilename(optarg);
- d_gcReplayLog = checkResult.first;
- d_replayLog = checkResult.second;
-}
-
-#warning "TODO: Move checkReplayLogFilename back into options and has calling setReplayLog as a side effect."
-std::pair<bool, std::ostream*> SmtGlobals::checkReplayLogFilename(std::string optarg)
- throw (OptionException)
-{
-#ifdef CVC4_REPLAY
- if(optarg == "") {
- throw OptionException(std::string("Bad file name for --replay-log"));
- } else if(optarg == "-") {
- return std::make_pair(false, &std::cout);
- } else if(!options::filesystemAccess()) {
- throw OptionException(std::string("Filesystem access not permitted"));
- } else {
- errno = 0;
- std::ios_base::openmode out_trunc = std::ofstream::out | std::ofstream::trunc;
- std::ostream* replayLog = new std::ofstream(optarg.c_str(), out_trunc);
- if(replayLog == NULL || !*replayLog) {
- std::stringstream ss;
- ss << "Cannot open replay-log file: `" << optarg << "': "
- << smt::SmtOptionsHandler::__cvc4_errno_failreason();
- throw OptionException(ss.str());
- }
- return std::make_pair(true, replayLog);
- }
-#else /* CVC4_REPLAY */
- throw OptionException("The replay feature was disabled in this build of CVC4.");
-#endif /* CVC4_REPLAY */
-}
-
-
-} /* namespace CVC4 */
+++ /dev/null
-/********************* */
-/*! \file smt_globals.h
- ** \verbatim
- ** Original author: Tim King
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2015 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief SmtGlobals is a light container for psuedo-global datastructures
- ** that are set by the user.
- **
- ** SmtGlobals is a light container for psuedo-global datastructures
- ** that are set by the user. These contain paramaters for infrequently
- ** used modes: Portfolio and Replay. There should be exactly one of these
- ** per SmtEngine with the same lifetime as the SmtEngine.
- ** A user directly passes these as pointers and is resonsible for cleaning up
- ** the memory.
- **
- ** Basically, the problem this class is solving is that previously these were
- ** using smt_options.h and the Options class as globals for these same
- ** datastructures.
- **
- ** This class is NOT a good long term solution, but is a reasonable stop gap.
- **/
-
-#include "cvc4_public.h"
-
-#ifndef __CVC4__SMT__SMT_GLOBALS_H
-#define __CVC4__SMT__SMT_GLOBALS_H
-
-#include <iosfwd>
-#include <string>
-#include <utility>
-
-#include "expr/expr_stream.h"
-#include "options/option_exception.h"
-#include "smt_util/lemma_input_channel.h"
-#include "smt_util/lemma_output_channel.h"
-
-namespace CVC4 {
-
-/**
- * SmtGlobals is a wrapper around 4 pointers:
- * - getReplayLog()
- * - getReplayStream()
- * - getLemmaInputChannel()
- * - getLemmaOutputChannel()
- *
- * The user can directly set these and is responsible for handling the
- * memory for these. These datastructures are used for the Replay and Portfolio
- * modes.
- */
-class CVC4_PUBLIC SmtGlobals {
- public:
- /** Creates an empty SmtGlobals with all 4 pointers initially NULL. */
- SmtGlobals();
- ~SmtGlobals();
-
- /** This setsReplayLog based on --replay-log */
- void parseReplayLog(std::string optarg) throw (OptionException);
- void setReplayLog(std::ostream*);
- std::ostream* getReplayLog() { return d_replayLog; }
-
- void setReplayStream(ExprStream* stream);
- ExprStream* getReplayStream() { return d_replayStream; }
-
- void setLemmaInputChannel(LemmaInputChannel* in);
- LemmaInputChannel* getLemmaInputChannel() { return d_lemmaInputChannel; }
-
- void setLemmaOutputChannel(LemmaOutputChannel* out);
- LemmaOutputChannel* getLemmaOutputChannel() { return d_lemmaOutputChannel; }
-
- private:
- // Disable copy constructor.
- SmtGlobals(const SmtGlobals&) CVC4_UNDEFINED;
-
- // Disable assignment operator.
- SmtGlobals& operator=(const SmtGlobals&) CVC4_UNDEFINED;
-
- static std::pair<bool, std::ostream*>
- checkReplayLogFilename(std::string optarg) throw (OptionException);
-
- /**
- * d_gcReplayLog is true iff d_replayLog was allocated by parseReplayLog.
- */
- bool d_gcReplayLog;
-
- /** This captures the old options::replayLog .*/
- std::ostream* d_replayLog;
-
- /** This captures the old options::replayStream .*/
- ExprStream* d_replayStream;
-
- /** This captures the old options::lemmaInputChannel .*/
- LemmaInputChannel* d_lemmaInputChannel;
-
- /** This captures the old options::lemmaOutputChannel .*/
- LemmaOutputChannel* d_lemmaOutputChannel;
-}; /* class SmtGlobals */
-
-} /* namespace CVC4 */
-
-#endif /* __CVC4__SMT__SMT_GLOBALS_H */
+++ /dev/null
-/********************* */
-/*! \file options_handler_interface.cpp
- ** \verbatim
- ** Original author: Tim King
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Interface for custom handlers and predicates options.
- **
- ** Interface for custom handlers and predicates options.
- **/
-
-#include "smt/smt_options_handler.h"
-
-#include <cerrno>
-#include <cstring>
-#include <ostream>
-#include <sstream>
-#include <string>
-
-#include "base/modal_exception.h"
-#include "base/output.h"
-#include "cvc4autoconfig.h"
-#include "expr/expr_iomanip.h"
-#include "expr/metakind.h"
-#include "expr/node_manager.h"
-#include "lib/strtok_r.h"
-#include "options/arith_heuristic_pivot_rule.h"
-#include "options/arith_propagation_mode.h"
-#include "options/arith_unate_lemma_mode.h"
-#include "options/base_options.h"
-#include "options/boolean_term_conversion_mode.h"
-#include "options/bv_bitblast_mode.h"
-#include "options/bv_options.h"
-#include "options/decision_mode.h"
-#include "options/decision_options.h"
-#include "options/didyoumean.h"
-#include "options/language.h"
-#include "options/main_options.h"
-#include "options/option_exception.h"
-#include "options/options_handler_interface.h"
-#include "options/parser_options.h"
-#include "options/printer_modes.h"
-#include "options/quantifiers_modes.h"
-#include "options/set_language.h"
-#include "options/simplification_mode.h"
-#include "options/smt_options.h"
-#include "options/theory_options.h"
-#include "options/theoryof_mode.h"
-#include "options/ufss_mode.h"
-#include "smt/smt_engine.h"
-#include "smt_util/command.h"
-#include "smt_util/dump.h"
-#include "theory/logic_info.h"
-#include "util/configuration.h"
-#include "util/configuration_private.h"
-#include "util/resource_manager.h"
-
-
-#warning "TODO: Make SmtOptionsHandler non-public and refactor driver unified."
-
-namespace CVC4 {
-namespace smt {
-
-SmtOptionsHandler::SmtOptionsHandler(SmtEngine* smt)
- : d_smtEngine(smt)
-{}
-
-SmtOptionsHandler::~SmtOptionsHandler(){}
-
-// theory/arith/options_handlers.h
-const std::string SmtOptionsHandler::s_arithUnateLemmasHelp = "\
-Unate lemmas are generated before SAT search begins using the relationship\n\
-of constant terms and polynomials.\n\
-Modes currently supported by the --unate-lemmas option:\n\
-+ none \n\
-+ ineqs \n\
- Outputs lemmas of the general form (<= p c) implies (<= p d) for c < d.\n\
-+ eqs \n\
- Outputs lemmas of the general forms\n\
- (= p c) implies (<= p d) for c < d, or\n\
- (= p c) implies (not (= p d)) for c != d.\n\
-+ all \n\
- A combination of inequalities and equalities.\n\
-";
-
-const std::string SmtOptionsHandler::s_arithPropagationModeHelp = "\
-This decides on kind of propagation arithmetic attempts to do during the search.\n\
-+ none\n\
-+ unate\n\
- use constraints to do unate propagation\n\
-+ bi (Bounds Inference)\n\
- infers bounds on basic variables using the upper and lower bounds of the\n\
- non-basic variables in the tableau.\n\
-+both\n\
-";
-
-const std::string SmtOptionsHandler::s_errorSelectionRulesHelp = "\
-This decides on the rule used by simplex during heuristic rounds\n\
-for deciding the next basic variable to select.\n\
-Heuristic pivot rules available:\n\
-+min\n\
- The minimum abs() value of the variable's violation of its bound. (default)\n\
-+max\n\
- The maximum violation the bound\n\
-+varord\n\
- The variable order\n\
-";
-
-ArithUnateLemmaMode SmtOptionsHandler::stringToArithUnateLemmaMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "all") {
- return ALL_PRESOLVE_LEMMAS;
- } else if(optarg == "none") {
- return NO_PRESOLVE_LEMMAS;
- } else if(optarg == "ineqs") {
- return INEQUALITY_PRESOLVE_LEMMAS;
- } else if(optarg == "eqs") {
- return EQUALITY_PRESOLVE_LEMMAS;
- } else if(optarg == "help") {
- puts(s_arithUnateLemmasHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --unate-lemmas: `") +
- optarg + "'. Try --unate-lemmas help.");
- }
-}
-
-ArithPropagationMode SmtOptionsHandler::stringToArithPropagationMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "none") {
- return NO_PROP;
- } else if(optarg == "unate") {
- return UNATE_PROP;
- } else if(optarg == "bi") {
- return BOUND_INFERENCE_PROP;
- } else if(optarg == "both") {
- return BOTH_PROP;
- } else if(optarg == "help") {
- puts(s_arithPropagationModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --arith-prop: `") +
- optarg + "'. Try --arith-prop help.");
- }
-}
-
-ErrorSelectionRule SmtOptionsHandler::stringToErrorSelectionRule(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "min") {
- return MINIMUM_AMOUNT;
- } else if(optarg == "varord") {
- return VAR_ORDER;
- } else if(optarg == "max") {
- return MAXIMUM_AMOUNT;
- } else if(optarg == "help") {
- puts(s_errorSelectionRulesHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --heuristic-pivot-rule: `") +
- optarg + "'. Try --heuristic-pivot-rule help.");
- }
-}
-
-// theory/quantifiers/options_handlers.h
-
-const std::string SmtOptionsHandler::s_instWhenHelp = "\
-Modes currently supported by the --inst-when option:\n\
-\n\
-full-last-call (default)\n\
-+ Alternate running instantiation rounds at full effort and last\n\
- call. In other words, interleave instantiation and theory combination.\n\
-\n\
-full\n\
-+ Run instantiation round at full effort, before theory combination.\n\
-\n\
-full-delay \n\
-+ Run instantiation round at full effort, before theory combination, after\n\
- all other theories have finished.\n\
-\n\
-full-delay-last-call \n\
-+ Alternate running instantiation rounds at full effort after all other\n\
- theories have finished, and last call. \n\
-\n\
-last-call\n\
-+ Run instantiation at last call effort, after theory combination and\n\
- and theories report sat.\n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_literalMatchHelp = "\
-Literal match modes currently supported by the --literal-match option:\n\
-\n\
-none (default)\n\
-+ Do not use literal matching.\n\
-\n\
-predicate\n\
-+ Consider the phase requirements of predicate literals when applying heuristic\n\
- quantifier instantiation. For example, the trigger P( x ) in the quantified \n\
- formula forall( x ). ( P( x ) V ~Q( x ) ) will only be matched with ground\n\
- terms P( t ) where P( t ) is in the equivalence class of false, and likewise\n\
- Q( x ) with Q( s ) where Q( s ) is in the equivalence class of true.\n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_mbqiModeHelp = "\
-Model-based quantifier instantiation modes currently supported by the --mbqi option:\n\
-\n\
-default \n\
-+ Use algorithm from Section 5.4.2 of thesis Finite Model Finding in Satisfiability \n\
- Modulo Theories.\n\
-\n\
-none \n\
-+ Disable model-based quantifier instantiation.\n\
-\n\
-gen-ev \n\
-+ Use model-based quantifier instantiation algorithm from CADE 24 finite\n\
- model finding paper based on generalizing evaluations.\n\
-\n\
-fmc-interval \n\
-+ Same as default, but with intervals for models of integer functions.\n\
-\n\
-abs \n\
-+ Use abstract MBQI algorithm (uses disjoint sets). \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_qcfWhenModeHelp = "\
-Quantifier conflict find modes currently supported by the --quant-cf-when option:\n\
-\n\
-default \n\
-+ Default, apply conflict finding at full effort.\n\
-\n\
-last-call \n\
-+ Apply conflict finding at last call, after theory combination and \n\
- and all theories report sat. \n\
-\n\
-std \n\
-+ Apply conflict finding at standard effort.\n\
-\n\
-std-h \n\
-+ Apply conflict finding at standard effort when heuristic says to. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_qcfModeHelp = "\
-Quantifier conflict find modes currently supported by the --quant-cf option:\n\
-\n\
-prop-eq \n\
-+ Default, apply QCF algorithm to propagate equalities as well as conflicts. \n\
-\n\
-conflict \n\
-+ Apply QCF algorithm to find conflicts only.\n\
-\n\
-partial \n\
-+ Apply QCF algorithm to instantiate heuristically as well. \n\
-\n\
-mc \n\
-+ Apply QCF algorithm in a complete way, so that a model is ensured when it fails. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_userPatModeHelp = "\
-User pattern modes currently supported by the --user-pat option:\n\
-\n\
-trust \n\
-+ When provided, use only user-provided patterns for a quantified formula.\n\
-\n\
-use \n\
-+ Use both user-provided and auto-generated patterns when patterns\n\
- are provided for a quantified formula.\n\
-\n\
-resort \n\
-+ Use user-provided patterns only after auto-generated patterns saturate.\n\
-\n\
-ignore \n\
-+ Ignore user-provided patterns. \n\
-\n\
-interleave \n\
-+ Alternate between use/resort. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_triggerSelModeHelp = "\
-Trigger selection modes currently supported by the --trigger-sel option:\n\
-\n\
-default \n\
-+ Default, consider all subterms of quantified formulas for trigger selection.\n\
-\n\
-min \n\
-+ Consider only minimal subterms that meet criteria for triggers.\n\
-\n\
-max \n\
-+ Consider only maximal subterms that meet criteria for triggers. \n\
-\n\
-";
-const std::string SmtOptionsHandler::s_prenexQuantModeHelp = "\
-Prenex quantifiers modes currently supported by the --prenex-quant option:\n\
-\n\
-default \n\
-+ Default, prenex all nested quantifiers except those with user patterns.\n\
-\n\
-all \n\
-+ Prenex all nested quantifiers.\n\
-\n\
-none \n\
-+ Do no prenex nested quantifiers. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_cegqiFairModeHelp = "\
-Modes for enforcing fairness for counterexample guided quantifier instantion, supported by --cegqi-fair:\n\
-\n\
-uf-dt-size \n\
-+ Enforce fairness using an uninterpreted function for datatypes size.\n\
-\n\
-default | dt-size \n\
-+ Default, enforce fairness using size theory operator.\n\
-\n\
-dt-height-bound \n\
-+ Enforce fairness by height bound predicate.\n\
-\n\
-none \n\
-+ Do not enforce fairness. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_termDbModeHelp = "\
-Modes for term database, supported by --term-db-mode:\n\
-\n\
-all \n\
-+ Quantifiers module considers all ground terms.\n\
-\n\
-relevant \n\
-+ Quantifiers module considers only ground terms connected to current assertions. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_iteLiftQuantHelp = "\
-Modes for term database, supported by --ite-lift-quant:\n\
-\n\
-none \n\
-+ Do not lift if-then-else in quantified formulas.\n\
-\n\
-simple \n\
-+ Lift if-then-else in quantified formulas if results in smaller term size.\n\
-\n\
-all \n\
-+ Lift if-then-else in quantified formulas. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_sygusInvTemplHelp = "\
-Template modes for sygus invariant synthesis, supported by --sygus-inv-templ:\n\
-\n\
-none \n\
-+ Synthesize invariant directly.\n\
-\n\
-pre \n\
-+ Synthesize invariant based on weakening of precondition .\n\
-\n\
-post \n\
-+ Synthesize invariant based on strengthening of postcondition. \n\
-\n\
-";
-
-const std::string SmtOptionsHandler::s_macrosQuantHelp = "\
-Template modes for quantifiers macro expansion, supported by --macros-quant-mode:\n\
-\n\
-all \n\
-+ Infer definitions for functions, including those containing quantified formulas.\n\
-\n\
-ground (default) \n\
-+ Only infer ground definitions for functions.\n\
-\n\
-ground-uf \n\
-+ Only infer ground definitions for functions that result in triggers for all free variables.\n\
-\n\
-";
-
-theory::quantifiers::InstWhenMode SmtOptionsHandler::stringToInstWhenMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "pre-full") {
- return theory::quantifiers::INST_WHEN_PRE_FULL;
- } else if(optarg == "full") {
- return theory::quantifiers::INST_WHEN_FULL;
- } else if(optarg == "full-delay") {
- return theory::quantifiers::INST_WHEN_FULL_DELAY;
- } else if(optarg == "full-last-call") {
- return theory::quantifiers::INST_WHEN_FULL_LAST_CALL;
- } else if(optarg == "full-delay-last-call") {
- return theory::quantifiers::INST_WHEN_FULL_DELAY_LAST_CALL;
- } else if(optarg == "last-call") {
- return theory::quantifiers::INST_WHEN_LAST_CALL;
- } else if(optarg == "help") {
- puts(s_instWhenHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --inst-when: `") +
- optarg + "'. Try --inst-when help.");
- }
-}
-
-void SmtOptionsHandler::checkInstWhenMode(std::string option, theory::quantifiers::InstWhenMode mode) throw(OptionException) {
- if(mode == theory::quantifiers::INST_WHEN_PRE_FULL) {
- throw OptionException(std::string("Mode pre-full for ") + option + " is not supported in this release.");
- }
-}
-
-theory::quantifiers::LiteralMatchMode SmtOptionsHandler::stringToLiteralMatchMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "none") {
- return theory::quantifiers::LITERAL_MATCH_NONE;
- } else if(optarg == "predicate") {
- return theory::quantifiers::LITERAL_MATCH_PREDICATE;
- } else if(optarg == "equality") {
- return theory::quantifiers::LITERAL_MATCH_EQUALITY;
- } else if(optarg == "help") {
- puts(s_literalMatchHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --literal-matching: `") +
- optarg + "'. Try --literal-matching help.");
- }
-}
-
-void SmtOptionsHandler::checkLiteralMatchMode(std::string option, theory::quantifiers::LiteralMatchMode mode) throw(OptionException) {
- if(mode == theory::quantifiers::LITERAL_MATCH_EQUALITY) {
- throw OptionException(std::string("Mode equality for ") + option + " is not supported in this release.");
- }
-}
-
-theory::quantifiers::MbqiMode SmtOptionsHandler::stringToMbqiMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "gen-ev") {
- return theory::quantifiers::MBQI_GEN_EVAL;
- } else if(optarg == "none") {
- return theory::quantifiers::MBQI_NONE;
- } else if(optarg == "default" || optarg == "fmc") {
- return theory::quantifiers::MBQI_FMC;
- } else if(optarg == "fmc-interval") {
- return theory::quantifiers::MBQI_FMC_INTERVAL;
- } else if(optarg == "abs") {
- return theory::quantifiers::MBQI_ABS;
- } else if(optarg == "trust") {
- return theory::quantifiers::MBQI_TRUST;
- } else if(optarg == "help") {
- puts(s_mbqiModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --mbqi: `") +
- optarg + "'. Try --mbqi help.");
- }
-}
-
-
-void SmtOptionsHandler::checkMbqiMode(std::string option, theory::quantifiers::MbqiMode mode) throw(OptionException) {}
-
-
-theory::quantifiers::QcfWhenMode SmtOptionsHandler::stringToQcfWhenMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "default") {
- return theory::quantifiers::QCF_WHEN_MODE_DEFAULT;
- } else if(optarg == "last-call") {
- return theory::quantifiers::QCF_WHEN_MODE_LAST_CALL;
- } else if(optarg == "std") {
- return theory::quantifiers::QCF_WHEN_MODE_STD;
- } else if(optarg == "std-h") {
- return theory::quantifiers::QCF_WHEN_MODE_STD_H;
- } else if(optarg == "help") {
- puts(s_qcfWhenModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --quant-cf-when: `") +
- optarg + "'. Try --quant-cf-when help.");
- }
-}
-
-theory::quantifiers::QcfMode SmtOptionsHandler::stringToQcfMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "conflict") {
- return theory::quantifiers::QCF_CONFLICT_ONLY;
- } else if(optarg == "default" || optarg == "prop-eq") {
- return theory::quantifiers::QCF_PROP_EQ;
- } else if(optarg == "partial") {
- return theory::quantifiers::QCF_PARTIAL;
- } else if(optarg == "mc" ) {
- return theory::quantifiers::QCF_MC;
- } else if(optarg == "help") {
- puts(s_qcfModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --quant-cf-mode: `") +
- optarg + "'. Try --quant-cf-mode help.");
- }
-}
-
-theory::quantifiers::UserPatMode SmtOptionsHandler::stringToUserPatMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "use") {
- return theory::quantifiers::USER_PAT_MODE_USE;
- } else if(optarg == "default" || optarg == "trust") {
- return theory::quantifiers::USER_PAT_MODE_TRUST;
- } else if(optarg == "resort") {
- return theory::quantifiers::USER_PAT_MODE_RESORT;
- } else if(optarg == "ignore") {
- return theory::quantifiers::USER_PAT_MODE_IGNORE;
- } else if(optarg == "interleave") {
- return theory::quantifiers::USER_PAT_MODE_INTERLEAVE;
- } else if(optarg == "help") {
- puts(s_userPatModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --user-pat: `") +
- optarg + "'. Try --user-pat help.");
- }
-}
-
-theory::quantifiers::TriggerSelMode SmtOptionsHandler::stringToTriggerSelMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "default" || optarg == "all" ) {
- return theory::quantifiers::TRIGGER_SEL_DEFAULT;
- } else if(optarg == "min") {
- return theory::quantifiers::TRIGGER_SEL_MIN;
- } else if(optarg == "max") {
- return theory::quantifiers::TRIGGER_SEL_MAX;
- } else if(optarg == "help") {
- puts(s_triggerSelModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --trigger-sel: `") +
- optarg + "'. Try --trigger-sel help.");
- }
-}
-
-
-theory::quantifiers::PrenexQuantMode SmtOptionsHandler::stringToPrenexQuantMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "default" ) {
- return theory::quantifiers::PRENEX_NO_USER_PAT;
- } else if(optarg == "all") {
- return theory::quantifiers::PRENEX_ALL;
- } else if(optarg == "none") {
- return theory::quantifiers::PRENEX_NONE;
- } else if(optarg == "help") {
- puts(s_prenexQuantModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --prenex-quant: `") +
- optarg + "'. Try --prenex-quant help.");
- }
-}
-
-theory::quantifiers::CegqiFairMode SmtOptionsHandler::stringToCegqiFairMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "uf-dt-size" ) {
- return theory::quantifiers::CEGQI_FAIR_UF_DT_SIZE;
- } else if(optarg == "default" || optarg == "dt-size") {
- return theory::quantifiers::CEGQI_FAIR_DT_SIZE;
- } else if(optarg == "dt-height-bound" ){
- return theory::quantifiers::CEGQI_FAIR_DT_HEIGHT_PRED;
- } else if(optarg == "none") {
- return theory::quantifiers::CEGQI_FAIR_NONE;
- } else if(optarg == "help") {
- puts(s_cegqiFairModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --cegqi-fair: `") +
- optarg + "'. Try --cegqi-fair help.");
- }
-}
-
-theory::quantifiers::TermDbMode SmtOptionsHandler::stringToTermDbMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "all" ) {
- return theory::quantifiers::TERM_DB_ALL;
- } else if(optarg == "relevant") {
- return theory::quantifiers::TERM_DB_RELEVANT;
- } else if(optarg == "help") {
- puts(s_termDbModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --term-db-mode: `") +
- optarg + "'. Try --term-db-mode help.");
- }
-}
-
-theory::quantifiers::IteLiftQuantMode SmtOptionsHandler::stringToIteLiftQuantMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "all" ) {
- return theory::quantifiers::ITE_LIFT_QUANT_MODE_ALL;
- } else if(optarg == "simple") {
- return theory::quantifiers::ITE_LIFT_QUANT_MODE_SIMPLE;
- } else if(optarg == "none") {
- return theory::quantifiers::ITE_LIFT_QUANT_MODE_NONE;
- } else if(optarg == "help") {
- puts(s_iteLiftQuantHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --ite-lift-quant: `") +
- optarg + "'. Try --ite-lift-quant help.");
- }
-}
-
-theory::quantifiers::SygusInvTemplMode SmtOptionsHandler::stringToSygusInvTemplMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "none" ) {
- return theory::quantifiers::SYGUS_INV_TEMPL_MODE_NONE;
- } else if(optarg == "pre") {
- return theory::quantifiers::SYGUS_INV_TEMPL_MODE_PRE;
- } else if(optarg == "post") {
- return theory::quantifiers::SYGUS_INV_TEMPL_MODE_POST;
- } else if(optarg == "help") {
- puts(s_sygusInvTemplHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --sygus-inv-templ: `") +
- optarg + "'. Try --sygus-inv-templ help.");
- }
-}
-
-theory::quantifiers::MacrosQuantMode SmtOptionsHandler::stringToMacrosQuantMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "all" ) {
- return theory::quantifiers::MACROS_QUANT_MODE_ALL;
- } else if(optarg == "ground") {
- return theory::quantifiers::MACROS_QUANT_MODE_GROUND;
- } else if(optarg == "ground-uf") {
- return theory::quantifiers::MACROS_QUANT_MODE_GROUND_UF;
- } else if(optarg == "help") {
- puts(s_macrosQuantHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --macros-quant-mode: `") +
- optarg + "'. Try --macros-quant-mode help.");
- }
-}
-
-
-
-// theory/bv/options_handlers.h
-void SmtOptionsHandler::abcEnabledBuild(std::string option, bool value) throw(OptionException) {
-#ifndef CVC4_USE_ABC
- if(value) {
- std::stringstream ss;
- ss << "option `" << option << "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
- throw OptionException(ss.str());
- }
-#endif /* CVC4_USE_ABC */
-}
-
-void SmtOptionsHandler::abcEnabledBuild(std::string option, std::string value) throw(OptionException) {
-#ifndef CVC4_USE_ABC
- if(!value.empty()) {
- std::stringstream ss;
- ss << "option `" << option << "' requires an abc-enabled build of CVC4; this binary was not built with abc support";
- throw OptionException(ss.str());
- }
-#endif /* CVC4_USE_ABC */
-}
-
-const std::string SmtOptionsHandler::s_bitblastingModeHelp = "\
-Bit-blasting modes currently supported by the --bitblast option:\n\
-\n\
-lazy (default)\n\
-+ Separate boolean structure and term reasoning betwen the core\n\
- SAT solver and the bv SAT solver\n\
-\n\
-eager\n\
-+ Bitblast eagerly to bv SAT solver\n\
-";
-
-theory::bv::BitblastMode SmtOptionsHandler::stringToBitblastMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "lazy") {
- if (!options::bitvectorPropagate.wasSetByUser()) {
- options::bitvectorPropagate.set(true);
- }
- if (!options::bitvectorEqualitySolver.wasSetByUser()) {
- options::bitvectorEqualitySolver.set(true);
- }
- if (!options::bitvectorEqualitySlicer.wasSetByUser()) {
- if (options::incrementalSolving() ||
- options::produceModels()) {
- options::bitvectorEqualitySlicer.set(theory::bv::BITVECTOR_SLICER_OFF);
- } else {
- options::bitvectorEqualitySlicer.set(theory::bv::BITVECTOR_SLICER_AUTO);
- }
- }
-
- if (!options::bitvectorInequalitySolver.wasSetByUser()) {
- options::bitvectorInequalitySolver.set(true);
- }
- if (!options::bitvectorAlgebraicSolver.wasSetByUser()) {
- options::bitvectorAlgebraicSolver.set(true);
- }
- return theory::bv::BITBLAST_MODE_LAZY;
- } else if(optarg == "eager") {
-
- if (options::incrementalSolving() &&
- options::incrementalSolving.wasSetByUser()) {
- throw OptionException(std::string("Eager bit-blasting does not currently support incremental mode. \n\
- Try --bitblast=lazy"));
- }
- if (!options::bitvectorToBool.wasSetByUser()) {
- options::bitvectorToBool.set(true);
- }
-
- if (!options::bvAbstraction.wasSetByUser() &&
- !options::skolemizeArguments.wasSetByUser()) {
- options::bvAbstraction.set(true);
- options::skolemizeArguments.set(true);
- }
- return theory::bv::BITBLAST_MODE_EAGER;
- } else if(optarg == "help") {
- puts(s_bitblastingModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --bitblast: `") +
- optarg + "'. Try --bitblast=help.");
- }
-}
-
-const std::string SmtOptionsHandler::s_bvSlicerModeHelp = "\
-Bit-vector equality slicer modes supported by the --bv-eq-slicer option:\n\
-\n\
-auto (default)\n\
-+ Turn slicer on if input has only equalities over core symbols\n\
-\n\
-on\n\
-+ Turn slicer on\n\
-\n\
-off\n\
-+ Turn slicer off\n\
-";
-
-theory::bv::BvSlicerMode SmtOptionsHandler::stringToBvSlicerMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "auto") {
- return theory::bv::BITVECTOR_SLICER_AUTO;
- } else if(optarg == "on") {
- return theory::bv::BITVECTOR_SLICER_ON;
- } else if(optarg == "off") {
- return theory::bv::BITVECTOR_SLICER_OFF;
- } else if(optarg == "help") {
- puts(s_bitblastingModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --bv-eq-slicer: `") +
- optarg + "'. Try --bv-eq-slicer=help.");
- }
-}
-
-void SmtOptionsHandler::setBitblastAig(std::string option, bool arg) throw(OptionException) {
- if(arg) {
- if(options::bitblastMode.wasSetByUser()) {
- if(options::bitblastMode() != theory::bv::BITBLAST_MODE_EAGER) {
- throw OptionException("bitblast-aig must be used with eager bitblaster");
- }
- } else {
- theory::bv::BitblastMode mode = stringToBitblastMode("", "eager");
- options::bitblastMode.set(mode);
- }
- if(!options::bitvectorAigSimplifications.wasSetByUser()) {
- options::bitvectorAigSimplifications.set("balance;drw");
- }
- }
-}
-
-
-// theory/booleans/options_handlers.h
-const std::string SmtOptionsHandler::s_booleanTermConversionModeHelp = "\
-Boolean term conversion modes currently supported by the\n\
---boolean-term-conversion-mode option:\n\
-\n\
-bitvectors [default]\n\
-+ Boolean terms are converted to bitvectors of size 1.\n\
-\n\
-datatypes\n\
-+ Boolean terms are converted to enumerations in the Datatype theory.\n\
-\n\
-native\n\
-+ Boolean terms are converted in a \"natural\" way depending on where they\n\
- are used. If in a datatype context, they are converted to an enumeration.\n\
- Elsewhere, they are converted to a bitvector of size 1.\n\
-";
-
-theory::booleans::BooleanTermConversionMode SmtOptionsHandler::stringToBooleanTermConversionMode(std::string option, std::string optarg) throw(OptionException){
- if(optarg == "bitvectors") {
- return theory::booleans::BOOLEAN_TERM_CONVERT_TO_BITVECTORS;
- } else if(optarg == "datatypes") {
- return theory::booleans::BOOLEAN_TERM_CONVERT_TO_DATATYPES;
- } else if(optarg == "native") {
- return theory::booleans::BOOLEAN_TERM_CONVERT_NATIVE;
- } else if(optarg == "help") {
- puts(s_booleanTermConversionModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --boolean-term-conversion-mode: `") +
- optarg + "'. Try --boolean-term-conversion-mode help.");
- }
-}
-
-// theory/uf/options_handlers.h
-const std::string SmtOptionsHandler::s_ufssModeHelp = "\
-UF strong solver options currently supported by the --uf-ss option:\n\
-\n\
-full \n\
-+ Default, use uf strong solver to find minimal models for uninterpreted sorts.\n\
-\n\
-no-minimal \n\
-+ Use uf strong solver to shrink model sizes, but do no enforce minimality.\n\
-\n\
-none \n\
-+ Do not use uf strong solver to shrink model sizes. \n\
-\n\
-";
-
-theory::uf::UfssMode SmtOptionsHandler::stringToUfssMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "default" || optarg == "full" ) {
- return theory::uf::UF_SS_FULL;
- } else if(optarg == "no-minimal") {
- return theory::uf::UF_SS_NO_MINIMAL;
- } else if(optarg == "none") {
- return theory::uf::UF_SS_NONE;
- } else if(optarg == "help") {
- puts(s_ufssModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --uf-ss: `") +
- optarg + "'. Try --uf-ss help.");
- }
-}
-
-
-
-// theory/options_handlers.h
-const std::string SmtOptionsHandler::s_theoryOfModeHelp = "\
-TheoryOf modes currently supported by the --theoryof-mode option:\n\
-\n\
-type (default) \n\
-+ type variables, constants and equalities by type\n\
-\n\
-term \n\
-+ type variables as uninterpreted, equalities by the parametric theory\n\
-";
-
-theory::TheoryOfMode SmtOptionsHandler::stringToTheoryOfMode(std::string option, std::string optarg) {
- if(optarg == "type") {
- return theory::THEORY_OF_TYPE_BASED;
- } else if(optarg == "term") {
- return theory::THEORY_OF_TERM_BASED;
- } else if(optarg == "help") {
- puts(s_theoryOfModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --theoryof-mode: `") +
- optarg + "'. Try --theoryof-mode help.");
- }
-}
-
-void SmtOptionsHandler::useTheory(std::string option, std::string optarg) {
- if(optarg == "help") {
- puts(theory::useTheoryHelp);
- exit(1);
- }
- if(theory::useTheoryValidate(optarg)) {
- std::map<std::string, bool> m = options::theoryAlternates();
- m[optarg] = true;
- options::theoryAlternates.set(m);
- } else {
- throw OptionException(std::string("unknown option for ") + option + ": `" +
- optarg + "'. Try --use-theory help.");
- }
-}
-
-
-
-// printer/options_handlers.h
-const std::string SmtOptionsHandler::s_modelFormatHelp = "\
-Model format modes currently supported by the --model-format option:\n\
-\n\
-default \n\
-+ Print model as expressions in the output language format.\n\
-\n\
-table\n\
-+ Print functional expressions over finite domains in a table format.\n\
-";
-
-const std::string SmtOptionsHandler::s_instFormatHelp = "\
-Inst format modes currently supported by the --model-format option:\n\
-\n\
-default \n\
-+ Print instantiations as a list in the output language format.\n\
-\n\
-szs\n\
-+ Print instantiations as SZS compliant proof.\n\
-";
-
-ModelFormatMode SmtOptionsHandler::stringToModelFormatMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "default") {
- return MODEL_FORMAT_MODE_DEFAULT;
- } else if(optarg == "table") {
- return MODEL_FORMAT_MODE_TABLE;
- } else if(optarg == "help") {
- puts(s_modelFormatHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --model-format: `") +
- optarg + "'. Try --model-format help.");
- }
-}
-
-InstFormatMode SmtOptionsHandler::stringToInstFormatMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "default") {
- return INST_FORMAT_MODE_DEFAULT;
- } else if(optarg == "szs") {
- return INST_FORMAT_MODE_SZS;
- } else if(optarg == "help") {
- puts(s_instFormatHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --inst-format: `") +
- optarg + "'. Try --inst-format help.");
- }
-}
-
-
-
-// decision/options_handlers.h
-const std::string SmtOptionsHandler::s_decisionModeHelp = "\
-Decision modes currently supported by the --decision option:\n\
-\n\
-internal (default)\n\
-+ Use the internal decision heuristics of the SAT solver\n\
-\n\
-justification\n\
-+ An ATGP-inspired justification heuristic\n\
-\n\
-justification-stoponly\n\
-+ Use the justification heuristic only to stop early, not for decisions\n\
-";
-
-decision::DecisionMode SmtOptionsHandler::stringToDecisionMode(std::string option, std::string optarg) throw(OptionException) {
- options::decisionStopOnly.set(false);
-
- if(optarg == "internal") {
- return decision::DECISION_STRATEGY_INTERNAL;
- } else if(optarg == "justification") {
- return decision::DECISION_STRATEGY_JUSTIFICATION;
- } else if(optarg == "justification-stoponly") {
- options::decisionStopOnly.set(true);
- return decision::DECISION_STRATEGY_JUSTIFICATION;
- } else if(optarg == "help") {
- puts(s_decisionModeHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --decision: `") +
- optarg + "'. Try --decision help.");
- }
-}
-
-decision::DecisionWeightInternal SmtOptionsHandler::stringToDecisionWeightInternal(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "off")
- return decision::DECISION_WEIGHT_INTERNAL_OFF;
- else if(optarg == "max")
- return decision::DECISION_WEIGHT_INTERNAL_MAX;
- else if(optarg == "sum")
- return decision::DECISION_WEIGHT_INTERNAL_SUM;
- else if(optarg == "usr1")
- return decision::DECISION_WEIGHT_INTERNAL_USR1;
- else
- throw OptionException(std::string("--decision-weight-internal must be off, max or sum."));
-}
-
-
-
-// smt/options_handlers.h
-const std::string SmtOptionsHandler::SmtOptionsHandler::s_dumpHelp = "\
-Dump modes currently supported by the --dump option:\n\
-\n\
-benchmark\n\
-+ Dump the benchmark structure (set-logic, push/pop, queries, etc.), but\n\
- does not include any declarations or assertions. Implied by all following\n\
- modes.\n\
-\n\
-declarations\n\
-+ Dump user declarations. Implied by all following modes.\n\
-\n\
-skolems\n\
-+ Dump internally-created skolem variable declarations. These can\n\
- arise from preprocessing simplifications, existential elimination,\n\
- and a number of other things. Implied by all following modes.\n\
-\n\
-assertions\n\
-+ Output the assertions after preprocessing and before clausification.\n\
- Can also specify \"assertions:pre-PASS\" or \"assertions:post-PASS\",\n\
- where PASS is one of the preprocessing passes: definition-expansion\n\
- boolean-terms constrain-subtypes substitution strings-pp skolem-quant\n\
- simplify static-learning ite-removal repeat-simplify\n\
- rewrite-apply-to-const theory-preprocessing.\n\
- PASS can also be the special value \"everything\", in which case the\n\
- assertions are printed before any preprocessing (with\n\
- \"assertions:pre-everything\") or after all preprocessing completes\n\
- (with \"assertions:post-everything\").\n\
-\n\
-clauses\n\
-+ Do all the preprocessing outlined above, and dump the CNF-converted\n\
- output\n\
-\n\
-state\n\
-+ Dump all contextual assertions (e.g., SAT decisions, propagations..).\n\
- Implied by all \"stateful\" modes below and conflicts with all\n\
- non-stateful modes below.\n\
-\n\
-t-conflicts [non-stateful]\n\
-+ Output correctness queries for all theory conflicts\n\
-\n\
-missed-t-conflicts [stateful]\n\
-+ Output completeness queries for theory conflicts\n\
-\n\
-t-propagations [stateful]\n\
-+ Output correctness queries for all theory propagations\n\
-\n\
-missed-t-propagations [stateful]\n\
-+ Output completeness queries for theory propagations (LARGE and EXPENSIVE)\n\
-\n\
-t-lemmas [non-stateful]\n\
-+ Output correctness queries for all theory lemmas\n\
-\n\
-t-explanations [non-stateful]\n\
-+ Output correctness queries for all theory explanations\n\
-\n\
-bv-rewrites [non-stateful]\n\
-+ Output correctness queries for all bitvector rewrites\n\
-\n\
-bv-abstraction [non-stateful]\n\
-+ Output correctness queries for all bv abstraction \n\
-\n\
-bv-algebraic [non-stateful]\n\
-+ Output correctness queries for bv algebraic solver. \n\
-\n\
-theory::fullcheck [non-stateful]\n \
-+ Output completeness queries for all full-check effort-level theory checks\n\
-\n\
-Dump modes can be combined with multiple uses of --dump. Generally you want\n\
-one from the assertions category (either assertions or clauses), and\n\
-perhaps one or more stateful or non-stateful modes for checking correctness\n\
-and completeness of decision procedure implementations. Stateful modes dump\n\
-the contextual assertions made by the core solver (all decisions and\n\
-propagations as assertions; that affects the validity of the resulting\n\
-correctness and completeness queries, so of course stateful and non-stateful\n\
-modes cannot be mixed in the same run.\n\
-\n\
-The --output-language option controls the language used for dumping, and\n\
-this allows you to connect CVC4 to another solver implementation via a UNIX\n\
-pipe to perform on-line checking. The --dump-to option can be used to dump\n\
-to a file.\n\
-";
-
-const std::string SmtOptionsHandler::s_simplificationHelp = "\
-Simplification modes currently supported by the --simplification option:\n\
-\n\
-batch (default) \n\
-+ save up all ASSERTions; run nonclausal simplification and clausal\n\
- (MiniSat) propagation for all of them only after reaching a querying command\n\
- (CHECKSAT or QUERY or predicate SUBTYPE declaration)\n\
-\n\
-none\n\
-+ do not perform nonclausal simplification\n\
-";
-
-void SmtOptionsHandler::dumpMode(std::string option, std::string optarg) {
-#ifdef CVC4_DUMPING
- char* optargPtr = strdup(optarg.c_str());
- char* tokstr = optargPtr;
- char* toksave;
- while((optargPtr = strtok_r(tokstr, ",", &toksave)) != NULL) {
- tokstr = NULL;
- if(!strcmp(optargPtr, "benchmark")) {
- } else if(!strcmp(optargPtr, "declarations")) {
- } else if(!strcmp(optargPtr, "assertions")) {
- Dump.on("assertions:post-everything");
- } else if(!strncmp(optargPtr, "assertions:", 11)) {
- const char* p = optargPtr + 11;
- if(!strncmp(p, "pre-", 4)) {
- p += 4;
- } else if(!strncmp(p, "post-", 5)) {
- p += 5;
- } else {
- throw OptionException(std::string("don't know how to dump `") +
- optargPtr + "'. Please consult --dump help.");
- }
- if(!strcmp(p, "everything")) {
- } else if(!strcmp(p, "definition-expansion")) {
- } else if(!strcmp(p, "boolean-terms")) {
- } else if(!strcmp(p, "constrain-subtypes")) {
- } else if(!strcmp(p, "substitution")) {
- } else if(!strcmp(p, "strings-pp")) {
- } else if(!strcmp(p, "skolem-quant")) {
- } else if(!strcmp(p, "simplify")) {
- } else if(!strcmp(p, "static-learning")) {
- } else if(!strcmp(p, "ite-removal")) {
- } else if(!strcmp(p, "repeat-simplify")) {
- } else if(!strcmp(p, "rewrite-apply-to-const")) {
- } else if(!strcmp(p, "theory-preprocessing")) {
- } else if(!strcmp(p, "nonclausal")) {
- } else if(!strcmp(p, "theorypp")) {
- } else if(!strcmp(p, "itesimp")) {
- } else if(!strcmp(p, "unconstrained")) {
- } else if(!strcmp(p, "repeatsimp")) {
- } else {
- throw OptionException(std::string("don't know how to dump `") +
- optargPtr + "'. Please consult --dump help.");
- }
- Dump.on("assertions");
- } else if(!strcmp(optargPtr, "skolems")) {
- } else if(!strcmp(optargPtr, "clauses")) {
- } else if(!strcmp(optargPtr, "t-conflicts") ||
- !strcmp(optargPtr, "t-lemmas") ||
- !strcmp(optargPtr, "t-explanations") ||
- !strcmp(optargPtr, "bv-rewrites") ||
- !strcmp(optargPtr, "theory::fullcheck")) {
- // These are "non-state-dumping" modes. If state (SAT decisions,
- // propagations, etc.) is dumped, it will interfere with the validity
- // of these generated queries.
- if(Dump.isOn("state")) {
- throw OptionException(std::string("dump option `") + optargPtr +
- "' conflicts with a previous, "
- "state-dumping dump option. You cannot "
- "mix stateful and non-stateful dumping modes; "
- "see --dump help.");
- } else {
- Dump.on("no-permit-state");
- }
- } else if(!strcmp(optargPtr, "state") ||
- !strcmp(optargPtr, "missed-t-conflicts") ||
- !strcmp(optargPtr, "t-propagations") ||
- !strcmp(optargPtr, "missed-t-propagations")) {
- // These are "state-dumping" modes. If state (SAT decisions,
- // propagations, etc.) is not dumped, it will interfere with the
- // validity of these generated queries.
- if(Dump.isOn("no-permit-state")) {
- throw OptionException(std::string("dump option `") + optargPtr +
- "' conflicts with a previous, "
- "non-state-dumping dump option. You cannot "
- "mix stateful and non-stateful dumping modes; "
- "see --dump help.");
- } else {
- Dump.on("state");
- }
- } else if(!strcmp(optargPtr, "help")) {
- puts(s_dumpHelp.c_str());
- exit(1);
- } else if(!strcmp(optargPtr, "bv-abstraction")) {
- Dump.on("bv-abstraction");
- } else if(!strcmp(optargPtr, "bv-algebraic")) {
- Dump.on("bv-algebraic");
- } else {
- throw OptionException(std::string("unknown option for --dump: `") +
- optargPtr + "'. Try --dump help.");
- }
-
- Dump.on(optargPtr);
- Dump.on("benchmark");
- if(strcmp(optargPtr, "benchmark")) {
- Dump.on("declarations");
- if(strcmp(optargPtr, "declarations")) {
- Dump.on("skolems");
- }
- }
- }
- free(optargPtr);
-#else /* CVC4_DUMPING */
- throw OptionException("The dumping feature was disabled in this build of CVC4.");
-#endif /* CVC4_DUMPING */
-}
-
-LogicInfo* SmtOptionsHandler::stringToLogicInfo(std::string option, std::string optarg) throw(OptionException) {
- try {
-#warning "TODO: Fix the blatant memory leak here."
- LogicInfo* logic = new LogicInfo(optarg);
- if(d_smtEngine != NULL) {
- d_smtEngine->setLogic(*logic);
- }
- return logic;
- } catch(IllegalArgumentException& e) {
- throw OptionException(std::string("invalid logic specification for --force-logic: `") +
- optarg + "':\n" + e.what());
- }
-}
-
-SimplificationMode SmtOptionsHandler::stringToSimplificationMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "batch") {
- return SIMPLIFICATION_MODE_BATCH;
- } else if(optarg == "none") {
- return SIMPLIFICATION_MODE_NONE;
- } else if(optarg == "help") {
- puts(s_simplificationHelp.c_str());
- exit(1);
- } else {
- throw OptionException(std::string("unknown option for --simplification: `") +
- optarg + "'. Try --simplification help.");
- }
-}
-
-
-void SmtOptionsHandler::beforeSearch(std::string option, bool value) throw(ModalException) {
- SmtEngine::beforeSearch(d_smtEngine, option);
-}
-
-void SmtOptionsHandler::setProduceAssertions(std::string option, bool value) throw() {
- options::produceAssertions.set(value);
- options::interactiveMode.set(value);
-}
-
-
-void SmtOptionsHandler::proofEnabledBuild(std::string option, bool value) throw(OptionException) {
-#if !(IS_PROOFS_BUILD)
- if(value) {
- std::stringstream ss;
- ss << "option `" << option << "' requires a proofs-enabled build of CVC4; this binary was not built with proof support";
- throw OptionException(ss.str());
- }
-#endif /* IS_PROOFS_BUILD */
-}
-
-
-// This macro is used for setting :regular-output-channel and :diagnostic-output-channel
-// to redirect a stream. It maintains all attributes set on the stream.
-#define __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(__channel_get, __channel_set) \
- { \
- int dagSetting = expr::ExprDag::getDag(__channel_get); \
- size_t exprDepthSetting = expr::ExprSetDepth::getDepth(__channel_get); \
- bool printtypesSetting = expr::ExprPrintTypes::getPrintTypes(__channel_get); \
- OutputLanguage languageSetting = language::SetLanguage::getLanguage(__channel_get); \
- __channel_set; \
- __channel_get << expr::ExprDag(dagSetting); \
- __channel_get << expr::ExprSetDepth(exprDepthSetting); \
- __channel_get << expr::ExprPrintTypes(printtypesSetting); \
- __channel_get << language::SetLanguage(languageSetting); \
- }
-
-void SmtOptionsHandler::dumpToFile(std::string option, std::string optarg) {
-#ifdef CVC4_DUMPING
- std::ostream* outStream = NULL;
- if(optarg == "") {
- throw OptionException(std::string("Bad file name for --dump-to"));
- } else if(optarg == "-") {
- outStream = &DumpOutC::dump_cout;
- } else if(!options::filesystemAccess()) {
- throw OptionException(std::string("Filesystem access not permitted"));
- } else {
- errno = 0;
- outStream = new std::ofstream(optarg.c_str(), std::ofstream::out | std::ofstream::trunc);
- if(outStream == NULL || !*outStream) {
- std::stringstream ss;
- ss << "Cannot open dump-to file: `" << optarg << "': " << __cvc4_errno_failreason();
- throw OptionException(ss.str());
- }
- }
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(Dump.getStream(), Dump.setStream(*outStream));
-#else /* CVC4_DUMPING */
- throw OptionException("The dumping feature was disabled in this build of CVC4.");
-#endif /* CVC4_DUMPING */
-}
-
-void SmtOptionsHandler::setRegularOutputChannel(std::string option, std::string optarg) {
- std::ostream* outStream = NULL;
- if(optarg == "") {
- throw OptionException(std::string("Bad file name setting for regular output channel"));
- } else if(optarg == "stdout") {
- outStream = &std::cout;
- } else if(optarg == "stderr") {
- outStream = &std::cerr;
- } else if(!options::filesystemAccess()) {
- throw OptionException(std::string("Filesystem access not permitted"));
- } else {
- errno = 0;
- outStream = new std::ofstream(optarg.c_str(), std::ofstream::out | std::ofstream::trunc);
- if(outStream == NULL || !*outStream) {
- std::stringstream ss;
- ss << "Cannot open regular-output-channel file: `" << optarg << "': " << __cvc4_errno_failreason();
- throw OptionException(ss.str());
- }
- }
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(*options::err(), options::err.set(outStream));
-}
-
-void SmtOptionsHandler::setDiagnosticOutputChannel(std::string option, std::string optarg) {
- std::ostream* outStream = NULL;
- if(optarg == "") {
- throw OptionException(std::string("Bad file name setting for diagnostic output channel"));
- } else if(optarg == "stdout") {
- outStream = &std::cout;
- } else if(optarg == "stderr") {
- outStream = &std::cerr;
- } else if(!options::filesystemAccess()) {
- throw OptionException(std::string("Filesystem access not permitted"));
- } else {
- errno = 0;
- outStream = new std::ofstream(optarg.c_str(), std::ofstream::out | std::ofstream::trunc);
- if(outStream == NULL || !*outStream) {
- std::stringstream ss;
- ss << "Cannot open diagnostic-output-channel file: `" << optarg << "': " << __cvc4_errno_failreason();
- throw OptionException(ss.str());
- }
- }
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(Debug.getStream(), Debug.setStream(*outStream));
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(Warning.getStream(), Warning.setStream(*outStream));
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(Message.getStream(), Message.setStream(*outStream));
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(Notice.getStream(), Notice.setStream(*outStream));
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(Chat.getStream(), Chat.setStream(*outStream));
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(Trace.getStream(), Trace.setStream(*outStream));
- __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM__(*options::err(), options::err.set(outStream));
-}
-
-#undef __CVC4__SMT__OUTPUTCHANNELS__SETSTREAM
-
-
-
-std::string SmtOptionsHandler::checkReplayFilename(std::string option, std::string optarg) {
-#ifdef CVC4_REPLAY
- if(optarg == "") {
- throw OptionException (std::string("Bad file name for --replay"));
- } else {
- return optarg;
- }
-#else /* CVC4_REPLAY */
- throw OptionException("The replay feature was disabled in this build of CVC4.");
-#endif /* CVC4_REPLAY */
-}
-
-
-void SmtOptionsHandler::statsEnabledBuild(std::string option, bool value) throw(OptionException) {
-#ifndef CVC4_STATISTICS_ON
- if(value) {
- std::stringstream ss;
- ss << "option `" << option << "' requires a statistics-enabled build of CVC4; this binary was not built with statistics support";
- throw OptionException(ss.str());
- }
-#endif /* CVC4_STATISTICS_ON */
-}
-
-unsigned long SmtOptionsHandler::tlimitHandler(std::string option, std::string optarg) throw(OptionException) {
- unsigned long ms;
- std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
- }
-
- // make sure the resource is set if the option is updated
- // if the smt engine is null the resource will be set in the
- if (d_smtEngine != NULL) {
- ResourceManager* rm = NodeManager::fromExprManager(d_smtEngine->getExprManager())->getResourceManager();
- rm->setTimeLimit(ms, true);
- }
- return ms;
-}
-
-unsigned long SmtOptionsHandler::tlimitPerHandler(std::string option, std::string optarg) throw(OptionException) {
- unsigned long ms;
-
- std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
- }
-
- if (d_smtEngine != NULL) {
- ResourceManager* rm = NodeManager::fromExprManager(d_smtEngine->getExprManager())->getResourceManager();
- rm->setTimeLimit(ms, false);
- }
- return ms;
-}
-
-unsigned long SmtOptionsHandler::rlimitHandler(std::string option, std::string optarg) throw(OptionException) {
- unsigned long ms;
-
- std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
- }
-
- if (d_smtEngine != NULL) {
- ResourceManager* rm = NodeManager::fromExprManager(d_smtEngine->getExprManager())->getResourceManager();
- rm->setResourceLimit(ms, true);
- }
- return ms;
-}
-
-unsigned long SmtOptionsHandler::rlimitPerHandler(std::string option, std::string optarg) throw(OptionException) {
- unsigned long ms;
-
- std::istringstream convert(optarg);
- if (!(convert >> ms)) {
- throw OptionException("option `"+option+"` requires a number as an argument");
- }
-
- // TODO: Remove check?
- if (d_smtEngine != NULL) {
- ResourceManager* rm = NodeManager::fromExprManager(d_smtEngine->getExprManager())->getResourceManager();
- rm->setResourceLimit(ms, false);
- }
- return ms;
-}
-
-
-
-// expr/options_handlers.h
-void SmtOptionsHandler::setDefaultExprDepth(std::string option, int depth) {
- if(depth < -1) {
- throw OptionException("--default-expr-depth requires a positive argument, or -1.");
- }
-
- Debug.getStream() << expr::ExprSetDepth(depth);
- Trace.getStream() << expr::ExprSetDepth(depth);
- Notice.getStream() << expr::ExprSetDepth(depth);
- Chat.getStream() << expr::ExprSetDepth(depth);
- Message.getStream() << expr::ExprSetDepth(depth);
- Warning.getStream() << expr::ExprSetDepth(depth);
- // intentionally exclude Dump stream from this list
-}
-
-void SmtOptionsHandler::setDefaultDagThresh(std::string option, int dag) {
- if(dag < 0) {
- throw OptionException("--default-dag-thresh requires a nonnegative argument.");
- }
-
- Debug.getStream() << expr::ExprDag(dag);
- Trace.getStream() << expr::ExprDag(dag);
- Notice.getStream() << expr::ExprDag(dag);
- Chat.getStream() << expr::ExprDag(dag);
- Message.getStream() << expr::ExprDag(dag);
- Warning.getStream() << expr::ExprDag(dag);
- Dump.getStream() << expr::ExprDag(dag);
-}
-
-void SmtOptionsHandler::setPrintExprTypes(std::string option) {
- Debug.getStream() << expr::ExprPrintTypes(true);
- Trace.getStream() << expr::ExprPrintTypes(true);
- Notice.getStream() << expr::ExprPrintTypes(true);
- Chat.getStream() << expr::ExprPrintTypes(true);
- Message.getStream() << expr::ExprPrintTypes(true);
- Warning.getStream() << expr::ExprPrintTypes(true);
- // intentionally exclude Dump stream from this list
-}
-
-
-// main/options_handlers.h
-void SmtOptionsHandler::showConfiguration(std::string option) {
- fputs(Configuration::about().c_str(), stdout);
- printf("\n");
- printf("version : %s\n", Configuration::getVersionString().c_str());
- if(Configuration::isGitBuild()) {
- const char* branchName = Configuration::getGitBranchName();
- if(*branchName == '\0') {
- branchName = "-";
- }
- printf("scm : git [%s %s%s]\n",
- branchName,
- std::string(Configuration::getGitCommit()).substr(0, 8).c_str(),
- Configuration::hasGitModifications() ?
- " (with modifications)" : "");
- } else if(Configuration::isSubversionBuild()) {
- printf("scm : svn [%s r%u%s]\n",
- Configuration::getSubversionBranchName(),
- Configuration::getSubversionRevision(),
- Configuration::hasSubversionModifications() ?
- " (with modifications)" : "");
- } else {
- printf("scm : no\n");
- }
- printf("\n");
- printf("library : %u.%u.%u\n",
- Configuration::getVersionMajor(),
- Configuration::getVersionMinor(),
- Configuration::getVersionRelease());
- printf("\n");
- printf("debug code : %s\n", Configuration::isDebugBuild() ? "yes" : "no");
- printf("statistics : %s\n", Configuration::isStatisticsBuild() ? "yes" : "no");
- printf("replay : %s\n", Configuration::isReplayBuild() ? "yes" : "no");
- printf("tracing : %s\n", Configuration::isTracingBuild() ? "yes" : "no");
- printf("dumping : %s\n", Configuration::isDumpingBuild() ? "yes" : "no");
- printf("muzzled : %s\n", Configuration::isMuzzledBuild() ? "yes" : "no");
- printf("assertions : %s\n", Configuration::isAssertionBuild() ? "yes" : "no");
- printf("proof : %s\n", Configuration::isProofBuild() ? "yes" : "no");
- printf("coverage : %s\n", Configuration::isCoverageBuild() ? "yes" : "no");
- printf("profiling : %s\n", Configuration::isProfilingBuild() ? "yes" : "no");
- printf("competition: %s\n", Configuration::isCompetitionBuild() ? "yes" : "no");
- printf("\n");
- printf("cudd : %s\n", Configuration::isBuiltWithCudd() ? "yes" : "no");
- printf("cln : %s\n", Configuration::isBuiltWithCln() ? "yes" : "no");
- printf("gmp : %s\n", Configuration::isBuiltWithGmp() ? "yes" : "no");
- printf("glpk : %s\n", Configuration::isBuiltWithGlpk() ? "yes" : "no");
- printf("abc : %s\n", Configuration::isBuiltWithAbc() ? "yes" : "no");
- printf("readline : %s\n", Configuration::isBuiltWithReadline() ? "yes" : "no");
- printf("tls : %s\n", Configuration::isBuiltWithTlsSupport() ? "yes" : "no");
- exit(0);
-}
-
-void SmtOptionsHandler::showDebugTags(std::string option) {
- if(Configuration::isDebugBuild() && Configuration::isTracingBuild()) {
- printf("available tags:");
- unsigned ntags = Configuration::getNumDebugTags();
- char const* const* tags = Configuration::getDebugTags();
- for(unsigned i = 0; i < ntags; ++ i) {
- printf(" %s", tags[i]);
- }
- printf("\n");
- } else if(! Configuration::isDebugBuild()) {
- throw OptionException("debug tags not available in non-debug builds");
- } else {
- throw OptionException("debug tags not available in non-tracing builds");
- }
- exit(0);
-}
-
-void SmtOptionsHandler::showTraceTags(std::string option) {
- if(Configuration::isTracingBuild()) {
- printf("available tags:");
- unsigned ntags = Configuration::getNumTraceTags();
- char const* const* tags = Configuration::getTraceTags();
- for (unsigned i = 0; i < ntags; ++ i) {
- printf(" %s", tags[i]);
- }
- printf("\n");
- } else {
- throw OptionException("trace tags not available in non-tracing build");
- }
- exit(0);
-}
-
-void SmtOptionsHandler::threadN(std::string option) {
- throw OptionException(option + " is not a real option by itself. Use e.g. --thread0=\"--random-seed=10 --random-freq=0.02\" --thread1=\"--random-seed=20 --random-freq=0.05\"");
-}
-
-
-
-/* options/base_options_handlers.h */
-void SmtOptionsHandler::setVerbosity(std::string option, int value) throw(OptionException) {
- if(Configuration::isMuzzledBuild()) {
- DebugChannel.setStream(CVC4::null_os);
- TraceChannel.setStream(CVC4::null_os);
- NoticeChannel.setStream(CVC4::null_os);
- ChatChannel.setStream(CVC4::null_os);
- MessageChannel.setStream(CVC4::null_os);
- WarningChannel.setStream(CVC4::null_os);
- } else {
- if(value < 2) {
- ChatChannel.setStream(CVC4::null_os);
- } else {
- ChatChannel.setStream(std::cout);
- }
- if(value < 1) {
- NoticeChannel.setStream(CVC4::null_os);
- } else {
- NoticeChannel.setStream(std::cout);
- }
- if(value < 0) {
- MessageChannel.setStream(CVC4::null_os);
- WarningChannel.setStream(CVC4::null_os);
- } else {
- MessageChannel.setStream(std::cout);
- WarningChannel.setStream(std::cerr);
- }
- }
-}
-
-void SmtOptionsHandler::increaseVerbosity(std::string option) {
- options::verbosity.set(options::verbosity() + 1);
- setVerbosity(option, options::verbosity());
-}
-
-void SmtOptionsHandler::decreaseVerbosity(std::string option) {
- options::verbosity.set(options::verbosity() - 1);
- setVerbosity(option, options::verbosity());
-}
-
-OutputLanguage SmtOptionsHandler::stringToOutputLanguage(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "help") {
- options::languageHelp.set(true);
- return language::output::LANG_AUTO;
- }
-
- try {
- return language::toOutputLanguage(optarg);
- } catch(OptionException& oe) {
- throw OptionException("Error in " + option + ": " + oe.getMessage() + "\nTry --output-language help");
- }
-
- Unreachable();
-}
-
-InputLanguage SmtOptionsHandler::stringToInputLanguage(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "help") {
- options::languageHelp.set(true);
- return language::input::LANG_AUTO;
- }
-
- try {
- return language::toInputLanguage(optarg);
- } catch(OptionException& oe) {
- throw OptionException("Error in " + option + ": " + oe.getMessage() + "\nTry --language help");
- }
-
- Unreachable();
-}
-
-void SmtOptionsHandler::addTraceTag(std::string option, std::string optarg) {
- if(Configuration::isTracingBuild()) {
- if(!Configuration::isTraceTag(optarg.c_str())) {
-
- if(optarg == "help") {
- printf("available tags:");
- unsigned ntags = Configuration::getNumTraceTags();
- char const* const* tags = Configuration::getTraceTags();
- for(unsigned i = 0; i < ntags; ++ i) {
- printf(" %s", tags[i]);
- }
- printf("\n");
- exit(0);
- }
-
- throw OptionException(std::string("trace tag ") + optarg +
- std::string(" not available.") +
- suggestTags(Configuration::getTraceTags(), optarg) );
- }
- } else {
- throw OptionException("trace tags not available in non-tracing builds");
- }
- Trace.on(optarg);
-}
-
-void SmtOptionsHandler::addDebugTag(std::string option, std::string optarg) {
- if(Configuration::isDebugBuild() && Configuration::isTracingBuild()) {
- if(!Configuration::isDebugTag(optarg.c_str()) &&
- !Configuration::isTraceTag(optarg.c_str())) {
-
- if(optarg == "help") {
- printf("available tags:");
- unsigned ntags = Configuration::getNumDebugTags();
- char const* const* tags = Configuration::getDebugTags();
- for(unsigned i = 0; i < ntags; ++ i) {
- printf(" %s", tags[i]);
- }
- printf("\n");
- exit(0);
- }
-
- throw OptionException(std::string("debug tag ") + optarg +
- std::string(" not available.") +
- suggestTags(Configuration::getDebugTags(), optarg, Configuration::getTraceTags()) );
- }
- } else if(! Configuration::isDebugBuild()) {
- throw OptionException("debug tags not available in non-debug builds");
- } else {
- throw OptionException("debug tags not available in non-tracing builds");
- }
- Debug.on(optarg);
- Trace.on(optarg);
-}
-
-void SmtOptionsHandler::setPrintSuccess(std::string option, bool value) {
- Debug.getStream() << Command::printsuccess(value);
- Trace.getStream() << Command::printsuccess(value);
- Notice.getStream() << Command::printsuccess(value);
- Chat.getStream() << Command::printsuccess(value);
- Message.getStream() << Command::printsuccess(value);
- Warning.getStream() << Command::printsuccess(value);
- *options::out() << Command::printsuccess(value);
-}
-
-
-std::string SmtOptionsHandler::suggestTags(char const* const* validTags, std::string inputTag,
- char const* const* additionalTags)
-{
- DidYouMean didYouMean;
-
- const char* opt;
- for(size_t i = 0; (opt = validTags[i]) != NULL; ++i) {
- didYouMean.addWord(validTags[i]);
- }
- if(additionalTags != NULL) {
- for(size_t i = 0; (opt = additionalTags[i]) != NULL; ++i) {
- didYouMean.addWord(additionalTags[i]);
- }
- }
-
- return didYouMean.getMatchAsString(inputTag);
-}
-
-std::string SmtOptionsHandler::__cvc4_errno_failreason() {
-#if HAVE_STRERROR_R
-#if STRERROR_R_CHAR_P
- if(errno != 0) {
- // GNU version of strerror_r: *might* use the given buffer,
- // or might not. It returns a pointer to buf, or not.
- char buf[80];
- return std::string(strerror_r(errno, buf, sizeof buf));
- } else {
- return "unknown reason";
- }
-#else /* STRERROR_R_CHAR_P */
- if(errno != 0) {
- // XSI version of strerror_r: always uses the given buffer.
- // Returns an error code.
- char buf[80];
- if(strerror_r(errno, buf, sizeof buf) == 0) {
- return std::string(buf);
- } else {
- // some error occurred while getting the error string
- return "unknown reason";
- }
- } else {
- return "unknown reason";
- }
-#endif /* STRERROR_R_CHAR_P */
-#else /* HAVE_STRERROR_R */
- return "unknown reason";
-#endif /* HAVE_STRERROR_R */
-}
-
-}/* CVC4::smt namespace */
-}/* CVC4 namespace */
+++ /dev/null
-/********************* */
-/*! \file options_handler_interface.h
- ** \verbatim
- ** Original author: Tim King
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Interface for custom handlers and predicates options.
- **
- ** Interface for custom handlers and predicates options.
- **/
-
-#include "cvc4_private.h"
-
-#ifndef __CVC4__SMT__SMT_OPTIONS_HANDLER_H
-#define __CVC4__SMT__SMT_OPTIONS_HANDLER_H
-
-#include <ostream>
-#include <string>
-
-#include "base/modal_exception.h"
-#include "options/arith_heuristic_pivot_rule.h"
-#include "options/arith_propagation_mode.h"
-#include "options/arith_unate_lemma_mode.h"
-#include "options/boolean_term_conversion_mode.h"
-#include "options/bv_bitblast_mode.h"
-#include "options/decision_mode.h"
-#include "options/language.h"
-#include "options/option_exception.h"
-#include "options/options_handler_interface.h"
-#include "options/printer_modes.h"
-#include "options/quantifiers_modes.h"
-#include "options/simplification_mode.h"
-#include "options/theoryof_mode.h"
-#include "options/ufss_mode.h"
-#include "smt/smt_engine.h"
-#include "theory/logic_info.h"
-
-namespace CVC4 {
-namespace smt {
-
-class CVC4_PUBLIC SmtOptionsHandler : public options::OptionsHandler {
-public:
- SmtOptionsHandler(SmtEngine* smt);
- ~SmtOptionsHandler();
-
- // TODO
- // theory/arith/options_handlers.h
- // theory/quantifiers/options_handlers.h
- // theory/bv/options_handlers.h
- // theory/booleans/options_handlers.h
- // theory/uf/options_handlers.h
- // theory/options_handlers.h
- // printer/options_handlers.h
- // decision/options_handlers.h
- // smt/options_handlers.h
- // expr/options_handlers.h
- // main/options_handlers.h
- // options/base_options_handlers.h
-
- // theory/arith/options_handlers.h
- virtual ArithUnateLemmaMode stringToArithUnateLemmaMode(std::string option, std::string optarg) throw(OptionException);
- virtual ArithPropagationMode stringToArithPropagationMode(std::string option, std::string optarg) throw(OptionException);
- virtual ErrorSelectionRule stringToErrorSelectionRule(std::string option, std::string optarg) throw(OptionException);
-
- // theory/quantifiers/options_handlers.h
- virtual theory::quantifiers::InstWhenMode stringToInstWhenMode(std::string option, std::string optarg) throw(OptionException);
- virtual void checkInstWhenMode(std::string option, theory::quantifiers::InstWhenMode mode) throw(OptionException);
- virtual theory::quantifiers::LiteralMatchMode stringToLiteralMatchMode(std::string option, std::string optarg) throw(OptionException);
- virtual void checkLiteralMatchMode(std::string option, theory::quantifiers::LiteralMatchMode mode) throw(OptionException);
- virtual theory::quantifiers::MbqiMode stringToMbqiMode(std::string option, std::string optarg) throw(OptionException);
- virtual void checkMbqiMode(std::string option, theory::quantifiers::MbqiMode mode) throw(OptionException);
- virtual theory::quantifiers::QcfWhenMode stringToQcfWhenMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::QcfMode stringToQcfMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::UserPatMode stringToUserPatMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::TriggerSelMode stringToTriggerSelMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::PrenexQuantMode stringToPrenexQuantMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::CegqiFairMode stringToCegqiFairMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::TermDbMode stringToTermDbMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::IteLiftQuantMode stringToIteLiftQuantMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::SygusInvTemplMode stringToSygusInvTemplMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::quantifiers::MacrosQuantMode stringToMacrosQuantMode(std::string option, std::string optarg) throw(OptionException);
-
- // theory/bv/options_handlers.h
- virtual void abcEnabledBuild(std::string option, bool value) throw(OptionException);
- virtual void abcEnabledBuild(std::string option, std::string value) throw(OptionException);
- virtual theory::bv::BitblastMode stringToBitblastMode(std::string option, std::string optarg) throw(OptionException);
- virtual theory::bv::BvSlicerMode stringToBvSlicerMode(std::string option, std::string optarg) throw(OptionException);
- virtual void setBitblastAig(std::string option, bool arg) throw(OptionException);
-
-
- // theory/booleans/options_handlers.h
- virtual theory::booleans::BooleanTermConversionMode stringToBooleanTermConversionMode(std::string option, std::string optarg) throw(OptionException);
-
- // theory/uf/options_handlers.h
- virtual theory::uf::UfssMode stringToUfssMode(std::string option, std::string optarg) throw(OptionException);
-
- // theory/options_handlers.h
- virtual theory::TheoryOfMode stringToTheoryOfMode(std::string option, std::string optarg);
- virtual void useTheory(std::string option, std::string optarg);
-
-
- // printer/options_handlers.h
- virtual ModelFormatMode stringToModelFormatMode(std::string option, std::string optarg) throw(OptionException);
- virtual InstFormatMode stringToInstFormatMode(std::string option, std::string optarg) throw(OptionException);
-
- // decision/options_handlers.h
- virtual decision::DecisionMode stringToDecisionMode(std::string option, std::string optarg) throw(OptionException);
- virtual decision::DecisionWeightInternal stringToDecisionWeightInternal(std::string option, std::string optarg) throw(OptionException);
-
-
- // smt/options_handlers.h
- virtual void dumpMode(std::string option, std::string optarg);
- virtual LogicInfo* stringToLogicInfo(std::string option, std::string optarg) throw(OptionException);
- virtual SimplificationMode stringToSimplificationMode(std::string option, std::string optarg) throw(OptionException);
- virtual void beforeSearch(std::string option, bool value) throw(ModalException);
- virtual void setProduceAssertions(std::string option, bool value) throw();
- virtual void proofEnabledBuild(std::string option, bool value) throw(OptionException);
- virtual void dumpToFile(std::string option, std::string optarg);
- virtual void setRegularOutputChannel(std::string option, std::string optarg);
- virtual void setDiagnosticOutputChannel(std::string option, std::string optarg);
- virtual std::string checkReplayFilename(std::string option, std::string optarg);
- virtual void statsEnabledBuild(std::string option, bool value) throw(OptionException);
- virtual unsigned long tlimitHandler(std::string option, std::string optarg) throw(OptionException);
- virtual unsigned long tlimitPerHandler(std::string option, std::string optarg) throw(OptionException);
- virtual unsigned long rlimitHandler(std::string option, std::string optarg) throw(OptionException);
- virtual unsigned long rlimitPerHandler(std::string option, std::string optarg) throw(OptionException);
-
- /* expr/options_handlers.h */
- virtual void setDefaultExprDepth(std::string option, int depth);
- virtual void setDefaultDagThresh(std::string option, int dag);
- virtual void setPrintExprTypes(std::string option);
-
- /* main/options_handlers.h */
- virtual void showConfiguration(std::string option);
- virtual void showDebugTags(std::string option);
- virtual void showTraceTags(std::string option);
- virtual void threadN(std::string option);
-
- /* options/base_options_handlers.h */
- virtual void setVerbosity(std::string option, int value) throw(OptionException);
- virtual void increaseVerbosity(std::string option);
- virtual void decreaseVerbosity(std::string option);
- virtual OutputLanguage stringToOutputLanguage(std::string option, std::string optarg) throw(OptionException);
- virtual InputLanguage stringToInputLanguage(std::string option, std::string optarg) throw(OptionException) ;
- virtual void addTraceTag(std::string option, std::string optarg);
- virtual void addDebugTag(std::string option, std::string optarg);
- virtual void setPrintSuccess(std::string option, bool value);
-
- static std::string __cvc4_errno_failreason();
-
-private:
- SmtEngine* d_smtEngine;
-
- /* Helper utilities */
- static std::string suggestTags(char const* const* validTags, std::string inputTag,
- char const* const* additionalTags = NULL);
-
- /* Help strings */
- static const std::string s_bitblastingModeHelp;
- static const std::string s_booleanTermConversionModeHelp;
- static const std::string s_bvSlicerModeHelp;
- static const std::string s_cegqiFairModeHelp;
- static const std::string s_decisionModeHelp;
- static const std::string s_dumpHelp;
- static const std::string s_instFormatHelp ;
- static const std::string s_instWhenHelp;
- static const std::string s_iteLiftQuantHelp;
- static const std::string s_literalMatchHelp;
- static const std::string s_macrosQuantHelp;
- static const std::string s_mbqiModeHelp;
- static const std::string s_modelFormatHelp;
- static const std::string s_prenexQuantModeHelp;
- static const std::string s_qcfModeHelp;
- static const std::string s_qcfWhenModeHelp;
- static const std::string s_simplificationHelp;
- static const std::string s_sygusInvTemplHelp;
- static const std::string s_termDbModeHelp;
- static const std::string s_theoryOfModeHelp;
- static const std::string s_triggerSelModeHelp;
- static const std::string s_ufssModeHelp;
- static const std::string s_userPatModeHelp;
- static const std::string s_errorSelectionRulesHelp;
- static const std::string s_arithPropagationModeHelp;
- static const std::string s_arithUnateLemmasHelp;
-
-
-}; /* class SmtOptionsHandler */
-
-
-}/* CVC4::smt namespace */
-}/* CVC4 namespace */
-
-#endif /* __CVC4__SMT__SMT_OPTIONS_HANDLER_H */
--- /dev/null
+/********************* */
+/*! \file update_ostream.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2016 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief [[ Add one-line brief description here ]]
+ **
+ ** [[ Add lengthier description here ]]
+ ** \todo document this file
+ **/
+
+#include "cvc4_private.h"
+
+#ifndef __CVC4__UPDATE_OSTREAM_H
+#define __CVC4__UPDATE_OSTREAM_H
+
+#include <ostream>
+
+#include "base/cvc4_assert.h"
+#include "base/output.h"
+#include "expr/expr_iomanip.h"
+#include "options/language.h"
+#include "options/set_language.h"
+#include "options/base_options.h"
+#include "smt_util/dump.h"
+
+namespace CVC4 {
+
+class ChannelSettings {
+ public:
+ ChannelSettings(std::ostream& out)
+ : d_dagSetting(expr::ExprDag::getDag(out)),
+ d_exprDepthSetting(expr::ExprSetDepth::getDepth(out)),
+ d_printtypesSetting(expr::ExprPrintTypes::getPrintTypes(out)),
+ d_languageSetting(language::SetLanguage::getLanguage(out))
+ {}
+
+ void apply(std::ostream& out) {
+ out << expr::ExprDag(d_dagSetting);
+ out << expr::ExprSetDepth(d_exprDepthSetting);
+ out << expr::ExprPrintTypes(d_printtypesSetting);
+ out << language::SetLanguage(d_languageSetting);
+ }
+
+ private:
+ const int d_dagSetting;
+ const size_t d_exprDepthSetting;
+ const bool d_printtypesSetting;
+ const OutputLanguage d_languageSetting;
+}; /* class ChannelSettings */
+
+class OstreamUpdate {
+public:
+ virtual std::ostream& get() = 0;
+ virtual void set(std::ostream* setTo) = 0;
+
+ void apply(std::ostream* setTo) {
+ PrettyCheckArgument(setTo != NULL, setTo);
+
+ ChannelSettings initialSettings(get());
+ set(setTo);
+ initialSettings.apply(get());
+ }
+}; /* class OstreamUpdate */
+
+class OptionsErrOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return *(options::err()); }
+ virtual void set(std::ostream* setTo) { return options::err.set(setTo); }
+}; /* class OptionsErrOstreamUpdate */
+
+class DumpOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return Dump.getStream(); }
+ virtual void set(std::ostream* setTo) { Dump.setStream(setTo); }
+}; /* class DumpOstreamUpdate */
+
+class DebugOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return Debug.getStream(); }
+ virtual void set(std::ostream* setTo) { Debug.setStream(setTo); }
+}; /* class DebugOstreamUpdate */
+
+class WarningOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return Warning.getStream(); }
+ virtual void set(std::ostream* setTo) { Warning.setStream(setTo); }
+}; /* class WarningOstreamUpdate */
+
+class MessageOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return Message.getStream(); }
+ virtual void set(std::ostream* setTo) { Message.setStream(setTo); }
+}; /* class MessageOstreamUpdate */
+
+class NoticeOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return Notice.getStream(); }
+ virtual void set(std::ostream* setTo) { Notice.setStream(setTo); }
+}; /* class NoticeOstreamUpdate */
+
+class ChatOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return Chat.getStream(); }
+ virtual void set(std::ostream* setTo) { Chat.setStream(setTo); }
+}; /* class ChatOstreamUpdate */
+
+class TraceOstreamUpdate : public OstreamUpdate {
+ public:
+ virtual std::ostream& get() { return Trace.getStream(); }
+ virtual void set(std::ostream* setTo) { Trace.setStream(setTo); }
+}; /* class TraceOstreamUpdate */
+
+}/* CVC4 namespace */
+
+#endif /* __CVC4__UPDATE_OSTREAM_H */
boolean_simplification.h \
command.cpp \
command.h \
- dump.h \
dump.cpp \
- lemma_input_channel.h \
- lemma_output_channel.h \
+ dump.h \
ite_removal.cpp \
ite_removal.h \
+ lemma_channels.cpp \
+ lemma_channels.h \
+ lemma_input_channel.h \
+ lemma_output_channel.h \
model.cpp \
model.h \
nary_builder.cpp \
*/
class BooleanSimplification {
// cannot construct one of these
- BooleanSimplification() CVC4_UNUSED;
- BooleanSimplification(const BooleanSimplification&) CVC4_UNUSED;
+ BooleanSimplification() CVC4_UNDEFINED;
+ BooleanSimplification(const BooleanSimplification&) CVC4_UNDEFINED;
static bool push_back_associative_commute_recursive
(Node n, std::vector<Node>& buffer, Kind k, Kind notK, bool negateNode)
DumpC DumpChannel CVC4_PUBLIC;
+std::ostream& DumpC::setStream(std::ostream* os) {
+ DumpOut.setStream(os);
+ return *os;
+}
+std::ostream& DumpC::getStream() { return DumpOut.getStream(); }
+std::ostream* DumpC::getStreamPointer() { return DumpOut.getStreamPointer(); }
+
+
+void DumpC::setDumpFromString(const std::string& optarg) {
+#ifdef CVC4_DUMPING
+ char* optargPtr = strdup(optarg.c_str());
+ char* tokstr = optargPtr;
+ char* toksave;
+ while((optargPtr = strtok_r(tokstr, ",", &toksave)) != NULL) {
+ tokstr = NULL;
+ if(!strcmp(optargPtr, "benchmark")) {
+ } else if(!strcmp(optargPtr, "declarations")) {
+ } else if(!strcmp(optargPtr, "assertions")) {
+ Dump.on("assertions:post-everything");
+ } else if(!strncmp(optargPtr, "assertions:", 11)) {
+ const char* p = optargPtr + 11;
+ if(!strncmp(p, "pre-", 4)) {
+ p += 4;
+ } else if(!strncmp(p, "post-", 5)) {
+ p += 5;
+ } else {
+ throw OptionException(std::string("don't know how to dump `") +
+ optargPtr + "'. Please consult --dump help.");
+ }
+ if(!strcmp(p, "everything")) {
+ } else if(!strcmp(p, "definition-expansion")) {
+ } else if(!strcmp(p, "boolean-terms")) {
+ } else if(!strcmp(p, "constrain-subtypes")) {
+ } else if(!strcmp(p, "substitution")) {
+ } else if(!strcmp(p, "strings-pp")) {
+ } else if(!strcmp(p, "skolem-quant")) {
+ } else if(!strcmp(p, "simplify")) {
+ } else if(!strcmp(p, "static-learning")) {
+ } else if(!strcmp(p, "ite-removal")) {
+ } else if(!strcmp(p, "repeat-simplify")) {
+ } else if(!strcmp(p, "rewrite-apply-to-const")) {
+ } else if(!strcmp(p, "theory-preprocessing")) {
+ } else if(!strcmp(p, "nonclausal")) {
+ } else if(!strcmp(p, "theorypp")) {
+ } else if(!strcmp(p, "itesimp")) {
+ } else if(!strcmp(p, "unconstrained")) {
+ } else if(!strcmp(p, "repeatsimp")) {
+ } else {
+ throw OptionException(std::string("don't know how to dump `") +
+ optargPtr + "'. Please consult --dump help.");
+ }
+ Dump.on("assertions");
+ } else if(!strcmp(optargPtr, "skolems")) {
+ } else if(!strcmp(optargPtr, "clauses")) {
+ } else if(!strcmp(optargPtr, "t-conflicts") ||
+ !strcmp(optargPtr, "t-lemmas") ||
+ !strcmp(optargPtr, "t-explanations") ||
+ !strcmp(optargPtr, "bv-rewrites") ||
+ !strcmp(optargPtr, "theory::fullcheck")) {
+ // These are "non-state-dumping" modes. If state (SAT decisions,
+ // propagations, etc.) is dumped, it will interfere with the validity
+ // of these generated queries.
+ if(Dump.isOn("state")) {
+ throw OptionException(std::string("dump option `") + optargPtr +
+ "' conflicts with a previous, "
+ "state-dumping dump option. You cannot "
+ "mix stateful and non-stateful dumping modes; "
+ "see --dump help.");
+ } else {
+ Dump.on("no-permit-state");
+ }
+ } else if(!strcmp(optargPtr, "state") ||
+ !strcmp(optargPtr, "missed-t-conflicts") ||
+ !strcmp(optargPtr, "t-propagations") ||
+ !strcmp(optargPtr, "missed-t-propagations")) {
+ // These are "state-dumping" modes. If state (SAT decisions,
+ // propagations, etc.) is not dumped, it will interfere with the
+ // validity of these generated queries.
+ if(Dump.isOn("no-permit-state")) {
+ throw OptionException(std::string("dump option `") + optargPtr +
+ "' conflicts with a previous, "
+ "non-state-dumping dump option. You cannot "
+ "mix stateful and non-stateful dumping modes; "
+ "see --dump help.");
+ } else {
+ Dump.on("state");
+ }
+ } else if(!strcmp(optargPtr, "help")) {
+ puts(s_dumpHelp.c_str());
+ exit(1);
+ } else if(!strcmp(optargPtr, "bv-abstraction")) {
+ Dump.on("bv-abstraction");
+ } else if(!strcmp(optargPtr, "bv-algebraic")) {
+ Dump.on("bv-algebraic");
+ } else {
+ throw OptionException(std::string("unknown option for --dump: `") +
+ optargPtr + "'. Try --dump help.");
+ }
+
+ Dump.on(optargPtr);
+ Dump.on("benchmark");
+ if(strcmp(optargPtr, "benchmark")) {
+ Dump.on("declarations");
+ if(strcmp(optargPtr, "declarations")) {
+ Dump.on("skolems");
+ }
+ }
+ }
+ free(optargPtr);
+#else /* CVC4_DUMPING */
+ throw OptionException("The dumping feature was disabled in this build of CVC4.");
+#endif /* CVC4_DUMPING */
+}
+
+
+const std::string DumpC::s_dumpHelp = "\
+Dump modes currently supported by the --dump option:\n\
+\n\
+benchmark\n\
++ Dump the benchmark structure (set-logic, push/pop, queries, etc.), but\n\
+ does not include any declarations or assertions. Implied by all following\n\
+ modes.\n\
+\n\
+declarations\n\
++ Dump user declarations. Implied by all following modes.\n\
+\n\
+skolems\n\
++ Dump internally-created skolem variable declarations. These can\n\
+ arise from preprocessing simplifications, existential elimination,\n\
+ and a number of other things. Implied by all following modes.\n\
+\n\
+assertions\n\
++ Output the assertions after preprocessing and before clausification.\n\
+ Can also specify \"assertions:pre-PASS\" or \"assertions:post-PASS\",\n\
+ where PASS is one of the preprocessing passes: definition-expansion\n\
+ boolean-terms constrain-subtypes substitution strings-pp skolem-quant\n\
+ simplify static-learning ite-removal repeat-simplify\n\
+ rewrite-apply-to-const theory-preprocessing.\n\
+ PASS can also be the special value \"everything\", in which case the\n\
+ assertions are printed before any preprocessing (with\n\
+ \"assertions:pre-everything\") or after all preprocessing completes\n\
+ (with \"assertions:post-everything\").\n\
+\n\
+clauses\n\
++ Do all the preprocessing outlined above, and dump the CNF-converted\n\
+ output\n\
+\n\
+state\n\
++ Dump all contextual assertions (e.g., SAT decisions, propagations..).\n\
+ Implied by all \"stateful\" modes below and conflicts with all\n\
+ non-stateful modes below.\n\
+\n\
+t-conflicts [non-stateful]\n\
++ Output correctness queries for all theory conflicts\n\
+\n\
+missed-t-conflicts [stateful]\n\
++ Output completeness queries for theory conflicts\n\
+\n\
+t-propagations [stateful]\n\
++ Output correctness queries for all theory propagations\n\
+\n\
+missed-t-propagations [stateful]\n\
++ Output completeness queries for theory propagations (LARGE and EXPENSIVE)\n\
+\n\
+t-lemmas [non-stateful]\n\
++ Output correctness queries for all theory lemmas\n\
+\n\
+t-explanations [non-stateful]\n\
++ Output correctness queries for all theory explanations\n\
+\n\
+bv-rewrites [non-stateful]\n\
++ Output correctness queries for all bitvector rewrites\n\
+\n\
+bv-abstraction [non-stateful]\n\
++ Output correctness queries for all bv abstraction \n\
+\n\
+bv-algebraic [non-stateful]\n\
++ Output correctness queries for bv algebraic solver. \n\
+\n\
+theory::fullcheck [non-stateful]\n \
++ Output completeness queries for all full-check effort-level theory checks\n\
+\n\
+Dump modes can be combined with multiple uses of --dump. Generally you want\n\
+one from the assertions category (either assertions or clauses), and\n\
+perhaps one or more stateful or non-stateful modes for checking correctness\n\
+and completeness of decision procedure implementations. Stateful modes dump\n\
+the contextual assertions made by the core solver (all decisions and\n\
+propagations as assertions; that affects the validity of the resulting\n\
+correctness and completeness queries, so of course stateful and non-stateful\n\
+modes cannot be mixed in the same run.\n\
+\n\
+The --output-language option controls the language used for dumping, and\n\
+this allows you to connect CVC4 to another solver implementation via a UNIX\n\
+pipe to perform on-line checking. The --dump-to option can be used to dump\n\
+to a file.\n\
+";
+
}/* CVC4 namespace */
std::set<std::string> d_tags;
CommandSequence d_commands;
+ static const std::string s_dumpHelp;
+
public:
CVC4dumpstream operator()(const char* tag) {
if(!d_tags.empty() && d_tags.find(std::string(tag)) != d_tags.end()) {
return CVC4dumpstream();
}
}
+
CVC4dumpstream operator()(std::string tag) {
if(!d_tags.empty() && d_tags.find(tag) != d_tags.end()) {
return CVC4dumpstream(getStream(), d_commands);
bool isOn(const char* tag) { return d_tags.find(std::string(tag)) != d_tags.end(); }
bool isOn(std::string tag) { return d_tags.find(tag) != d_tags.end(); }
- std::ostream& setStream(std::ostream& os) { DumpOut.setStream(os); return os; }
- std::ostream& getStream() { return DumpOut.getStream(); }
+ std::ostream& setStream(std::ostream* os);
+ std::ostream& getStream();
+ std::ostream* getStreamPointer();
+
+ void setDumpFromString(const std::string& optarg);
};/* class DumpC */
/** The dump singleton */
--- /dev/null
+/********************* */
+/*! \file lemma_channels.cpp
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2015 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief This class is a light container for globals that used to live
+ ** in options. This is NOT a good long term solution, but is a reasonable
+ ** stop gap.
+ **
+ ** This class is a light container for globals that used to live
+ ** in options. This is NOT a good long term solution, but is a reasonable
+ ** stop gap.
+ **/
+
+#include "smt_util/lemma_channels.h"
+
+#include <cerrno>
+#include <iostream>
+#include <string>
+#include <utility>
+
+#include "cvc4autoconfig.h" // Needed for CVC4_REPLAY
+#include "expr/expr_stream.h"
+#include "options/open_ostream.h"
+#include "options/option_exception.h"
+#include "options/parser_options.h"
+#include "smt_util/lemma_input_channel.h"
+#include "smt_util/lemma_output_channel.h"
+
+namespace CVC4 {
+
+LemmaChannels::LemmaChannels()
+ : d_lemmaInputChannel(NULL)
+ , d_lemmaOutputChannel(NULL)
+{}
+
+LemmaChannels::~LemmaChannels(){}
+
+void LemmaChannels::setLemmaInputChannel(LemmaInputChannel* in) {
+ d_lemmaInputChannel = in;
+}
+
+void LemmaChannels::setLemmaOutputChannel(LemmaOutputChannel* out) {
+ d_lemmaOutputChannel = out;
+}
+
+
+} /* namespace CVC4 */
--- /dev/null
+/********************* */
+/*! \file lemma_channels.h
+ ** \verbatim
+ ** Original author: Tim King
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2015 New York University and The University of Iowa
+ ** See the file COPYING in the top-level source directory for licensing
+ ** information.\endverbatim
+ **
+ ** \brief LemmaChannels is a light container for a pair of input and output
+ ** lemma channels.
+ **
+ ** LemmaChannels is a light container for a pair of input and output
+ ** lemma channels. These contain paramaters for the infrequently
+ ** used Portfolio mode. There should be exactly one of these per SmtEngine
+ ** with the same lifetime as the SmtEngine. The user directly passes these as
+ ** pointers and is resonsible for cleaning up the memory.
+ **
+ ** Basically, the problem this class is solving is that previously these were
+ ** using smt_options.h and the Options class as globals for these same
+ ** datastructures.
+ **/
+
+#include "cvc4_public.h"
+
+#ifndef __CVC4__SMT_UTIL__LEMMA_CHANNELS_H
+#define __CVC4__SMT_UTIL__LEMMA_CHANNELS_H
+
+#include <iosfwd>
+#include <string>
+#include <utility>
+
+#include "options/option_exception.h"
+#include "smt_util/lemma_input_channel.h"
+#include "smt_util/lemma_output_channel.h"
+
+namespace CVC4 {
+
+/**
+ * LemmaChannels is a wrapper around two pointers:
+ * - getLemmaInputChannel()
+ * - getLemmaOutputChannel()
+ *
+ * The user can directly set these and is responsible for handling the
+ * memory for these. These datastructures are used for Portfolio mode.
+ */
+class CVC4_PUBLIC LemmaChannels {
+ public:
+ /** Creates an empty LemmaChannels with all 4 pointers initially NULL. */
+ LemmaChannels();
+ ~LemmaChannels();
+
+ void setLemmaInputChannel(LemmaInputChannel* in);
+ LemmaInputChannel* getLemmaInputChannel() { return d_lemmaInputChannel; }
+
+ void setLemmaOutputChannel(LemmaOutputChannel* out);
+ LemmaOutputChannel* getLemmaOutputChannel() { return d_lemmaOutputChannel; }
+
+ private:
+ // Disable copy constructor.
+ LemmaChannels(const LemmaChannels&) CVC4_UNDEFINED;
+
+ // Disable assignment operator.
+ LemmaChannels& operator=(const LemmaChannels&) CVC4_UNDEFINED;
+
+ /** This captures the old options::lemmaInputChannel .*/
+ LemmaInputChannel* d_lemmaInputChannel;
+
+ /** This captures the old options::lemmaOutputChannel .*/
+ LemmaOutputChannel* d_lemmaOutputChannel;
+}; /* class LemmaChannels */
+
+} /* namespace CVC4 */
+
+#endif /* __CVC4__SMT_UTIL__LEMMA_CHANNELS_H */
#ifndef __CVC4__THEORY__ARITH__CONSTRAINT_H
#define __CVC4__THEORY__ARITH__CONSTRAINT_H
-#include "expr/node.h"
-#include "proof/proof.h"
+#include <ext/hash_map>
+#include <list>
+#include <set>
+#include <vector>
-#include "context/context.h"
+#include "base/configuration_private.h"
#include "context/cdlist.h"
#include "context/cdqueue.h"
-
+#include "context/context.h"
+#include "expr/node.h"
+#include "proof/proof.h"
#include "theory/arith/arithvar.h"
-#include "theory/arith/delta_rational.h"
+#include "theory/arith/callbacks.h"
#include "theory/arith/congruence_manager.h"
#include "theory/arith/constraint_forward.h"
-#include "theory/arith/callbacks.h"
-
-#include "util/configuration_private.h"
-
-#include <vector>
-#include <list>
-#include <set>
-#include <ext/hash_map>
+#include "theory/arith/delta_rational.h"
namespace CVC4 {
namespace theory {
namespace arith {
/**
- * Logs the types of different proofs.
+ * Logs the types of different proofs.
* Current, proof types:
* - NoAP : This constraint is not known to be true.
* - AssumeAP : This is an input assertion. There is no proof.
class ApproximateSimplex;
class TreeLog {
private:
- ApproximateSimplex* d_generator CVC4_UNUSED;
+ ApproximateSimplex* d_generator;
int next_exec_ord;
typedef std::map<int, NodeLog> ToNodeMap;
TheoryArith::TheoryArith(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals)
- : Theory(THEORY_ARITH, c, u, out, valuation, logicInfo, globals)
+ const LogicInfo& logicInfo)
+ : Theory(THEORY_ARITH, c, u, out, valuation, logicInfo)
, d_internal(new TheoryArithPrivate(*this, c, u, out, valuation, logicInfo))
, d_ppRewriteTimer("theory::arith::ppRewriteTimer")
{
public:
TheoryArith(context::Context* c, context::UserContext* u, OutputChannel& out,
- Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals);
+ Valuation valuation, const LogicInfo& logicInfo);
virtual ~TheoryArith();
/**
TheoryArrays::TheoryArrays(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals,
- std::string name)
- : Theory(THEORY_ARRAY, c, u, out, valuation, logicInfo, globals, name),
+ const LogicInfo& logicInfo, std::string name)
+ : Theory(THEORY_ARRAY, c, u, out, valuation, logicInfo, name),
d_numRow(name + "theory::arrays::number of Row lemmas", 0),
d_numExt(name + "theory::arrays::number of Ext lemmas", 0),
d_numProp(name + "theory::arrays::number of propagations", 0),
// MISC
/////////////////////////////////////////////////////////////////////////////
- private:
+ private:
/** True node for predicates = true */
Node d_true;
/** conflicts in setModelVal */
IntStat d_numSetModelValConflicts;
- public:
+ public:
TheoryArrays(context::Context* c, context::UserContext* u, OutputChannel& out,
Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals, std::string name = "");
+ std::string instanceName = "");
~TheoryArrays();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
// PREPROCESSING
/////////////////////////////////////////////////////////////////////////////
- private:
+ private:
// PPNotifyClass: dummy template class for d_ppEqualityEngine - notifications not used
class PPNotifyClass {
class TheoryBool : public Theory {
public:
TheoryBool(context::Context* c, context::UserContext* u, OutputChannel& out,
- Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals)
- : Theory(THEORY_BOOL, c, u, out, valuation, logicInfo, globals)
+ Valuation valuation, const LogicInfo& logicInfo)
+ : Theory(THEORY_BOOL, c, u, out, valuation, logicInfo)
{}
PPAssertStatus ppAssert(TNode in, SubstitutionMap& outSubstitutions);
public:
TheoryBuiltin(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals)
- : Theory(THEORY_BUILTIN, c, u, out, valuation, logicInfo, globals) {}
+ const LogicInfo& logicInfo)
+ : Theory(THEORY_BUILTIN, c, u, out, valuation, logicInfo) {}
std::string identify() const { return std::string("TheoryBuiltin"); }
};/* class TheoryBuiltin */
#include "context/cdhashmap.h"
#include "expr/node.h"
#include "prop/sat_solver.h"
-#include "smt/smt_globals.h"
#include "theory/theory_registrar.h"
#include "theory/valuation.h"
#include "util/resource_manager.h"
d_bitblastingRegistrar = new BitblastingRegistrar(this);
d_nullContext = new context::Context();
- d_satSolver = prop::SatSolverFactory::createMinisat(d_nullContext,
- smtStatisticsRegistry(),
- "EagerBitblaster");
- d_cnfStream = new prop::TseitinCnfStream(d_satSolver,
- d_bitblastingRegistrar,
- d_nullContext,
- d_bv->globals(),
- options::proof(),
- "EagerBitblaster");
-
+ d_satSolver = prop::SatSolverFactory::createMinisat(
+ d_nullContext, smtStatisticsRegistry(), "EagerBitblaster");
+
+ d_cnfStream = new prop::TseitinCnfStream(
+ d_satSolver, d_bitblastingRegistrar, d_nullContext, options::proof(),
+ "EagerBitblaster");
+
MinisatEmptyNotify* notify = new MinisatEmptyNotify();
d_satSolver->setNotify(notify);
d_bvp = NULL;
d_cnfStream = new prop::TseitinCnfStream(d_satSolver,
d_nullRegistrar,
d_nullContext,
- d_bv->globals(),
options::proof(),
"LazyBitblaster");
d_satSolverNotify = d_emptyNotify ?
(prop::BVSatSolverInterface::Notify*) new MinisatEmptyNotify() :
- (prop::BVSatSolverInterface::Notify*) new MinisatNotify(d_cnfStream, bv, this);
+ (prop::BVSatSolverInterface::Notify*) new MinisatNotify(d_cnfStream, bv,
+ this);
d_satSolver->setNotify(d_satSolverNotify);
}
d_satSolver = prop::SatSolverFactory::createMinisat(
d_ctx, smtStatisticsRegistry());
d_cnfStream = new prop::TseitinCnfStream(d_satSolver, d_nullRegistrar,
- d_nullContext, d_bv->globals());
+ d_nullContext);
d_satSolverNotify = d_emptyNotify ?
(prop::BVSatSolverInterface::Notify*) new MinisatEmptyNotify() :
- (prop::BVSatSolverInterface::Notify*) new MinisatNotify(d_cnfStream, d_bv, this);
+ (prop::BVSatSolverInterface::Notify*) new MinisatNotify(d_cnfStream, d_bv,
+ this);
d_satSolver->setNotify(d_satSolverNotify);
}
TheoryBV::TheoryBV(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals)
- : Theory(THEORY_BV, c, u, out, valuation, logicInfo, globals),
+ const LogicInfo& logicInfo)
+ : Theory(THEORY_BV, c, u, out, valuation, logicInfo),
d_context(c),
d_alreadyPropagatedSet(c),
d_sharedTermsSet(c),
#include "context/cdhashset.h"
#include "context/cdlist.h"
#include "context/context.h"
-#include "smt/smt_globals.h"
#include "theory/bv/bv_subtheory.h"
#include "theory/bv/theory_bv_utils.h"
#include "theory/theory.h"
public:
- TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, SmtGlobals* globals);
+ TheoryBV(context::Context* c, context::UserContext* u, OutputChannel& out,
+ Valuation valuation, const LogicInfo& logicInfo);
~TheoryBV();
namespace datatypes {
TheoryDatatypes::TheoryDatatypes(Context* c, UserContext* u, OutputChannel& out,
- Valuation valuation,
- const LogicInfo& logicInfo,
- SmtGlobals* globals)
- : Theory(THEORY_DATATYPES, c, u, out, valuation, logicInfo, globals),
+ Valuation valuation, const LogicInfo& logicInfo)
+ : Theory(THEORY_DATATYPES, c, u, out, valuation, logicInfo),
//d_cycle_check(c),
d_hasSeenCycle(c, false),
d_infer(c),
public:
TheoryDatatypes(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals);
+ const LogicInfo& logicInfo);
~TheoryDatatypes();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
namespace fp {
namespace removeToFPGeneric {
-
+
Node removeToFPGeneric (TNode node) {
Assert(node.getKind() == kind::FLOATINGPOINT_TO_FP_GENERIC);
-
- FloatingPointToFPGeneric info = node.getOperator().getConst<FloatingPointToFPGeneric>();
-
+
+ FloatingPointToFPGeneric info =
+ node.getOperator().getConst<FloatingPointToFPGeneric>();
+
size_t children = node.getNumChildren();
-
+
Node op;
-
+
if (children == 1) {
- op = NodeManager::currentNM()->mkConst(FloatingPointToFPIEEEBitVector(info.t.exponent(),
- info.t.significand()));
+ op = NodeManager::currentNM()->mkConst(
+ FloatingPointToFPIEEEBitVector(info.t.exponent(),
+ info.t.significand()));
return NodeManager::currentNM()->mkNode(op, node[0]);
-
+
} else {
Assert(children == 2);
Assert(node[0].getType().isRoundingMode());
-
+
TypeNode t = node[1].getType();
-
+
if (t.isFloatingPoint()) {
- op = NodeManager::currentNM()->mkConst(FloatingPointToFPFloatingPoint(info.t.exponent(),
- info.t.significand()));
+ op = NodeManager::currentNM()->mkConst(
+ FloatingPointToFPFloatingPoint(info.t.exponent(),
+ info.t.significand()));
} else if (t.isReal()) {
- op = NodeManager::currentNM()->mkConst(FloatingPointToFPReal(info.t.exponent(),
- info.t.significand()));
+ op = NodeManager::currentNM()->mkConst(
+ FloatingPointToFPReal(info.t.exponent(),
+ info.t.significand()));
} else if (t.isBitVector()) {
- op = NodeManager::currentNM()->mkConst(FloatingPointToFPSignedBitVector(info.t.exponent(),
- info.t.significand()));
-
+ op = NodeManager::currentNM()->mkConst(
+ FloatingPointToFPSignedBitVector(info.t.exponent(),
+ info.t.significand()));
+
} else {
- throw TypeCheckingExceptionPrivate(node, "cannot rewrite to_fp generic due to incorrect type of second argument");
+ throw TypeCheckingExceptionPrivate(
+ node,
+ "cannot rewrite to_fp generic due to incorrect type of second "
+ "argument");
}
-
+
return NodeManager::currentNM()->mkNode(op, node[0], node[1]);
}
-
+
Unreachable("to_fp generic not rewritten");
}
}
/** Constructs a new instance of TheoryFp w.r.t. the provided contexts. */
TheoryFp::TheoryFp(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals)
- : Theory(THEORY_FP, c, u, out, valuation, logicInfo, globals)
+ const LogicInfo& logicInfo)
+ : Theory(THEORY_FP, c, u, out, valuation, logicInfo)
{}/* TheoryFp::TheoryFp() */
context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- SmtGlobals* globals);
+ const LogicInfo& logicInfo);
Node expandDefinition(LogicRequest &, Node node);
TheoryIdl::TheoryIdl(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals)
- : Theory(THEORY_ARITH, c, u, out, valuation, logicInfo, globals)
+ const LogicInfo& logicInfo)
+ : Theory(THEORY_ARITH, c, u, out, valuation, logicInfo)
, d_model(c)
, d_assertionsDB(c)
{}
/** Theory constructor. */
TheoryIdl(context::Context* c, context::UserContext* u, OutputChannel& out,
- Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals);
+ Valuation valuation, const LogicInfo& logicInfo);
/** Pre-processing of input atoms */
Node ppRewrite(TNode atom);
#include "base/cvc4_assert.h"
#include "expr/kind.h"
-#warning "TODO: Remove logic_info_forward.h"
-
using namespace std;
using namespace CVC4::theory;
#include <string>
#include <vector>
#include "expr/kind.h"
-#include "options/logic_info_forward.h"
namespace CVC4 {
"
eval "alternate_for_$1=\"\${alternate_for_$1}
- if(options::theoryAlternates()[\\\"$2\\\"]) {
+ if(engine->useTheoryAlternative(\\\"$2\\\")) {
engine->addTheory< $3 >($1);
return;
}\""
using namespace CVC4::theory;
using namespace CVC4::theory::quantifiers;
-TheoryQuantifiers::TheoryQuantifiers(Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, SmtGlobals* globals) :
- Theory(THEORY_QUANTIFIERS, c, u, out, valuation, logicInfo, globals),
+TheoryQuantifiers::TheoryQuantifiers(Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(THEORY_QUANTIFIERS, c, u, out, valuation, logicInfo),
d_masterEqualityEngine(0)
{
d_numInstantiations = 0;
public:
TheoryQuantifiers(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals);
+ const LogicInfo& logicInfo);
~TheoryQuantifiers();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
context::UserContext* u,
OutputChannel& out,
Valuation valuation,
- const LogicInfo& logicInfo,
- SmtGlobals* globals)
- : Theory(THEORY_SETS, c, u, out, valuation, logicInfo, globals),
+ const LogicInfo& logicInfo)
+ : Theory(THEORY_SETS, c, u, out, valuation, logicInfo),
d_internal(new TheorySetsPrivate(*this, c, u))
{}
* contexts.
*/
TheorySets(context::Context* c, context::UserContext* u, OutputChannel& out,
- Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals);
+ Valuation valuation, const LogicInfo& logicInfo);
~TheorySets();
TheoryStrings::TheoryStrings(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals)
- : Theory(THEORY_STRINGS, c, u, out, valuation, logicInfo, globals),
+ const LogicInfo& logicInfo)
+ : Theory(THEORY_STRINGS, c, u, out, valuation, logicInfo),
RMAXINT(LONG_MAX),
d_notify( *this ),
d_equalityEngine(d_notify, c, "theory::strings::TheoryStrings", true),
public:
TheoryStrings(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals);
+ const LogicInfo& logicInfo);
~TheoryStrings();
void setMasterEqualityEngine(eq::EqualityEngine* eq);
#include "theory/theory.h"
#include <vector>
+#include <sstream>
+#include <iostream>
+#include <string>
#include "base/cvc4_assert.h"
#include "smt/smt_statistics_registry.h"
return os;
}/* ostream& operator<<(ostream&, Theory::Effort) */
-Theory::Theory(TheoryId id, context::Context* satContext, context::UserContext* userContext,
- OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals, std::string name) throw()
+
+Theory::Theory(TheoryId id, context::Context* satContext,
+ context::UserContext* userContext, OutputChannel& out,
+ Valuation valuation, const LogicInfo& logicInfo,
+ std::string name) throw()
: d_id(id)
, d_instanceName(name)
, d_satContext(satContext)
, d_out(&out)
, d_valuation(valuation)
, d_proofsEnabled(false)
- , d_globals(globals)
{
smtStatisticsRegistry()->registerStat(&d_checkTime);
smtStatisticsRegistry()->registerStat(&d_computeCareGraphTime);
std::hash_set<TNode, TNodeHashFunction> Theory::currentlySharedTerms() const{
std::hash_set<TNode, TNodeHashFunction> currentlyShared;
- for(shared_terms_iterator i = shared_terms_begin(), i_end = shared_terms_end(); i != i_end; ++i){
+ for (shared_terms_iterator i = shared_terms_begin(),
+ i_end = shared_terms_end(); i != i_end; ++i) {
currentlyShared.insert (*i);
}
return currentlyShared;
}
-Theory::PPAssertStatus Theory::ppAssert(TNode in, SubstitutionMap& outSubstitutions)
+Theory::PPAssertStatus Theory::ppAssert(TNode in,
+ SubstitutionMap& outSubstitutions)
{
if (in.getKind() == kind::EQUAL) {
// (and (= x t) phi) can be replaced by phi[x/t] if
// 1) x is a variable
// 2) x is not in the term t
// 3) x : T and t : S, then S <: T
- if (in[0].isVar() && !in[1].hasSubterm(in[0]) && (in[1].getType()).isSubtypeOf(in[0].getType()) ){
+ if (in[0].isVar() && !in[1].hasSubterm(in[0]) &&
+ (in[1].getType()).isSubtypeOf(in[0].getType()) ){
outSubstitutions.addSubstitution(in[0], in[1]);
return PP_ASSERT_STATUS_SOLVED;
}
- if (in[1].isVar() && !in[0].hasSubterm(in[1]) && (in[0].getType()).isSubtypeOf(in[1].getType())){
+ if (in[1].isVar() && !in[0].hasSubterm(in[1]) &&
+ (in[0].getType()).isSubtypeOf(in[1].getType())){
outSubstitutions.addSubstitution(in[1], in[0]);
return PP_ASSERT_STATUS_SOLVED;
}
return PP_ASSERT_STATUS_UNSOLVED;
}
-std::pair<bool, Node> Theory::entailmentCheck(TNode lit,
- const EntailmentCheckParameters* params,
- EntailmentCheckSideEffects* out){
+std::pair<bool, Node> Theory::entailmentCheck(
+ TNode lit,
+ const EntailmentCheckParameters* params,
+ EntailmentCheckSideEffects* out) {
return make_pair(false, Node::null());
}
: d_tid(tid) {
}
+std::string Theory::getFullInstanceName() const {
+ std::stringstream ss;
+ ss << "theory<" << d_id << ">" << d_instanceName;
+ return ss.str();
+}
+
EntailmentCheckParameters::~EntailmentCheckParameters(){}
TheoryId EntailmentCheckParameters::getTheoryId() const {
#define __CVC4__THEORY__THEORY_H
#include <ext/hash_set>
-#include <iostream>
+#include <iosfwd>
#include <string>
-#include <strings.h>
#include "context/cdlist.h"
#include "context/cdo.h"
#include "options/theory_options.h"
#include "options/theoryof_mode.h"
#include "smt/logic_request.h"
-#include "smt/smt_globals.h"
#include "smt_util/command.h"
#include "smt_util/dump.h"
#include "theory/logic_info.h"
friend class ::CVC4::TheoryEngine;
// Disallow default construction, copy, assignment.
- Theory() CVC4_UNUSED;
- Theory(const Theory&) CVC4_UNUSED;
- Theory& operator=(const Theory&) CVC4_UNUSED;
+ Theory() CVC4_UNDEFINED;
+ Theory(const Theory&) CVC4_UNDEFINED;
+ Theory& operator=(const Theory&) CVC4_UNDEFINED;
/**
* An integer identifying the type of the theory
* an unique string identifier for each instance of a Theory class. We need
* this to ensure unique statistics names over multiple theory instances. */
std::string d_instanceName;
-
+
/**
* The SAT search context for the Theory.
*/
/**
* Construct a Theory.
+ *
+ * The pair <id, instance> is assumed to uniquely identify this Theory
+ * w.r.t. the SmtEngine.
*/
- Theory(TheoryId id, context::Context* satContext, context::UserContext* userContext,
- OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals, std::string name = "") throw(); // taking : No default.
+ Theory(TheoryId id, context::Context* satContext,
+ context::UserContext* userContext, OutputChannel& out,
+ Valuation valuation, const LogicInfo& logicInfo,
+ std::string instance = "") throw(); // taking : No default.
/**
* This is called at shutdown time by the TheoryEngine, just before
void printFacts(std::ostream& os) const;
void debugPrintFacts() const;
- SmtGlobals* d_globals;
+ /**
+ * Whether proofs are enabled
+ *
+ */
+ bool d_proofEnabled;
public:
return d_id;
}
- std::string getFullInstanceName() const {
- std::stringstream ss;
- ss << "theory<" << d_id << ">" << d_instanceName;
- return ss.str();
- }
+ /**
+ * Returns a string that uniquely identifies this theory solver w.r.t. the
+ * SmtEngine.
+ */
+ std::string getFullInstanceName() const;
+
-
/**
* Get the SAT context associated to this Theory.
*/
* Turn on proof-production mode.
*/
void produceProofs() { d_proofsEnabled = true; }
-
- /** Returns a pointer to the globals copy the theory is using. */
- SmtGlobals* globals() { return d_globals; }
};/* class Theory */
context::UserContext* userContext,
RemoveITE& iteRemover,
const LogicInfo& logicInfo,
- SmtGlobals* globals)
+ LemmaChannels* channels)
: d_propEngine(NULL),
d_decisionEngine(NULL),
d_context(context),
d_false(),
d_interrupted(false),
d_resourceManager(NodeManager::currentResourceManager()),
- d_globals(globals),
+ d_channels(channels),
d_inPreregister(false),
d_factsAsserted(context, false),
d_preRegistrationVisitor(this, context),
d_sharedTermsVisitor(d_sharedTerms),
d_unconstrainedSimp(new UnconstrainedSimplifier(context, logicInfo)),
d_bvToBoolPreprocessor(),
+ d_theoryAlternatives(),
+ d_attr_handle(),
d_arithSubstitutionsAdded("theory::arith::zzz::arith::substitutions", 0)
{
- for(TheoryId theoryId = theory::THEORY_FIRST; theoryId != theory::THEORY_LAST; ++ theoryId) {
+ for(TheoryId theoryId = theory::THEORY_FIRST; theoryId != theory::THEORY_LAST;
+ ++ theoryId)
+ {
d_theoryTable[theoryId] = NULL;
d_theoryOut[theoryId] = NULL;
}
d_true = NodeManager::currentNM()->mkConst<bool>(true);
d_false = NodeManager::currentNM()->mkConst<bool>(false);
- PROOF (ProofManager::currentPM()->initTheoryProofEngine(d_globals); );
+ PROOF (ProofManager::currentPM()->initTheoryProofEngine(); );
d_iteUtilities = new ITEUtilities(d_iteRemover.getContainsVisitor());
}
// Share with other portfolio threads
- if(d_globals->getLemmaOutputChannel() != NULL) {
- d_globals->getLemmaOutputChannel()->notifyNewLemma(node.toExpr());
+ if(d_channels->getLemmaOutputChannel() != NULL) {
+ d_channels->getLemmaOutputChannel()->notifyNewLemma(node.toExpr());
}
// Run theory preprocessing, maybe
d_resourceManager->spendResource(ammount);
}
+void TheoryEngine::enableTheoryAlternative(const std::string& name){
+ Debug("TheoryEngine::enableTheoryAlternative")
+ << "TheoryEngine::enableTheoryAlternative(" << name << ")" << std::endl;
+
+ d_theoryAlternatives.insert(name);
+}
+
+bool TheoryEngine::useTheoryAlternative(const std::string& name) {
+ return d_theoryAlternatives.find(name) != d_theoryAlternatives.end();
+}
+
+
TheoryEngine::Statistics::Statistics(theory::TheoryId theory):
conflicts(mkName("theory<", theory, ">::conflicts"), 0),
propagations(mkName("theory<", theory, ">::propagations"), 0),
#define __CVC4__THEORY_ENGINE_H
#include <deque>
+#include <set>
#include <vector>
#include <utility>
#include "options/options.h"
#include "options/smt_options.h"
#include "prop/prop_engine.h"
-#include "smt/smt_globals.h"
#include "smt_util/command.h"
+#include "smt_util/lemma_channels.h"
#include "theory/atom_requests.h"
#include "theory/bv/bv_to_bool.h"
#include "theory/interrupted.h"
bool d_interrupted;
ResourceManager* d_resourceManager;
- /** Container for misc. globals. */
- SmtGlobals* d_globals;
+ /** Container for lemma input and output channels. */
+ LemmaChannels* d_channels;
public:
/** Constructs a theory engine */
TheoryEngine(context::Context* context, context::UserContext* userContext,
- RemoveITE& iteRemover, const LogicInfo& logic, SmtGlobals* globals);
+ RemoveITE& iteRemover, const LogicInfo& logic,
+ LemmaChannels* channels);
/** Destroys a theory engine */
~TheoryEngine();
d_theoryOut[theoryId] = new EngineOutputChannel(this, theoryId);
d_theoryTable[theoryId] =
new TheoryClass(d_context, d_userContext, *d_theoryOut[theoryId],
- theory::Valuation(this), d_logicInfo, d_globals);
+ theory::Valuation(this), d_logicInfo);
}
inline void setPropEngine(prop::PropEngine* propEngine) {
/** Prints the assertions to the debug stream */
void printAssertions(const char* tag);
+ /** Theory alternative is in use. */
+ bool useTheoryAlternative(const std::string& name);
+
+ /** Enables using a theory alternative by name. */
+ void enableTheoryAlternative(const std::string& name);
+
private:
+ std::set< std::string > d_theoryAlternatives;
+
std::map< std::string, std::vector< theory::Theory* > > d_attr_handle;
public:
/** Constructs a new instance of TheoryUF w.r.t. the provided context.*/
TheoryUF::TheoryUF(context::Context* c, context::UserContext* u,
OutputChannel& out, Valuation valuation,
- const LogicInfo& logicInfo, SmtGlobals* globals, std::string name)
- : Theory(THEORY_UF, c, u, out, valuation, logicInfo, globals, name),
+ const LogicInfo& logicInfo, std::string instanceName)
+ : Theory(THEORY_UF, c, u, out, valuation, logicInfo, instanceName),
d_notify(*this),
/* The strong theory solver can be notified by EqualityEngine::init(),
* so make sure it's initialized first. */
d_thss(NULL),
- d_equalityEngine(d_notify, c, name + "theory::uf::TheoryUF", true),
+ d_equalityEngine(d_notify, c, instanceName + "theory::uf::TheoryUF",
+ true),
d_conflict(c, false),
d_literalsToPropagate(c),
d_literalsToPropagateIndex(c, 0),
d_functionsTerms(c),
- d_symb(u, name)
+ d_symb(u, instanceName)
{
// The kinds we are treating as function application in congruence
d_equalityEngine.addFunctionKind(kind::APPLY_UF);
/** Constructs a new instance of TheoryUF w.r.t. the provided context.*/
TheoryUF(context::Context* c, context::UserContext* u, OutputChannel& out,
Valuation valuation, const LogicInfo& logicInfo,
- SmtGlobals* globals, std::string name = "");
+ std::string instanceName = "");
~TheoryUF();
cardinality.cpp \
cardinality.h \
channel.h \
- configuration.cpp \
- configuration.h \
- configuration_private.h \
debug.h \
dense_map.h \
divisible.cpp \
bitvector.i \
bool.i \
cardinality.i \
- configuration.i \
divisible.i \
floatingpoint.i \
hash.i \
typename Map::iterator d_result;
// disallow copy/assignment
- Cache(const Cache&) CVC4_UNUSED;
- Cache& operator=(const Cache&) CVC4_UNUSED;
+ Cache(const Cache&) CVC4_UNDEFINED;
+ Cache& operator=(const Cache&) CVC4_UNDEFINED;
public:
+++ /dev/null
-/********************* */
-/*! \file configuration.cpp
- ** \verbatim
- ** Original author: Morgan Deters
- ** Major contributors: none
- ** Minor contributors (to current version): Liana Hadarean, Tim King, ACSYS, Christopher L. Conway, Dejan Jovanovic, Francois Bobot
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Implementation of Configuration class, which provides compile-time
- ** configuration information about the CVC4 library
- **
- ** Implementation of Configuration class, which provides compile-time
- ** configuration information about the CVC4 library.
- **/
-#include "util/configuration.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <sstream>
-#include <string>
-
-#include "cvc4autoconfig.h"
-#include "util/configuration_private.h"
-
-#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
-# include "options/Debug_tags.h"
-#endif /* CVC4_DEBUG && CVC4_TRACING */
-
-#ifdef CVC4_TRACING
-# include "options/Trace_tags.h"
-#endif /* CVC4_TRACING */
-
-using namespace std;
-
-namespace CVC4 {
-
-string Configuration::getName() {
- return PACKAGE_NAME;
-}
-
-bool Configuration::isDebugBuild() {
- return IS_DEBUG_BUILD;
-}
-
-bool Configuration::isStatisticsBuild() {
- return IS_STATISTICS_BUILD;
-}
-
-bool Configuration::isReplayBuild() {
- return IS_REPLAY_BUILD;
-}
-
-bool Configuration::isTracingBuild() {
- return IS_TRACING_BUILD;
-}
-
-bool Configuration::isDumpingBuild() {
- return IS_DUMPING_BUILD;
-}
-
-bool Configuration::isMuzzledBuild() {
- return IS_MUZZLED_BUILD;
-}
-
-bool Configuration::isAssertionBuild() {
- return IS_ASSERTIONS_BUILD;
-}
-
-bool Configuration::isProofBuild() {
- return IS_PROOFS_BUILD;
-}
-
-bool Configuration::isCoverageBuild() {
- return IS_COVERAGE_BUILD;
-}
-
-bool Configuration::isProfilingBuild() {
- return IS_PROFILING_BUILD;
-}
-
-bool Configuration::isCompetitionBuild() {
- return IS_COMPETITION_BUILD;
-}
-
-string Configuration::getPackageName() {
- return PACKAGE_NAME;
-}
-
-string Configuration::getVersionString() {
- return CVC4_RELEASE_STRING;
-}
-
-unsigned Configuration::getVersionMajor() {
- return CVC4_MAJOR;
-}
-
-unsigned Configuration::getVersionMinor() {
- return CVC4_MINOR;
-}
-
-unsigned Configuration::getVersionRelease() {
- return CVC4_RELEASE;
-}
-
-std::string Configuration::getVersionExtra() {
- return CVC4_EXTRAVERSION;
-}
-
-std::string Configuration::about() {
- return CVC4_ABOUT_STRING;
-}
-
-bool Configuration::licenseIsGpl() {
- return IS_GPL_BUILD;
-}
-
-bool Configuration::isBuiltWithGmp() {
- return IS_GMP_BUILD;
-}
-
-bool Configuration::isBuiltWithCln() {
- return IS_CLN_BUILD;
-}
-
-bool Configuration::isBuiltWithGlpk() {
- return IS_GLPK_BUILD;
-}
-
-bool Configuration::isBuiltWithAbc() {
- return IS_ABC_BUILD;
-}
-
-bool Configuration::isBuiltWithReadline() {
- return IS_READLINE_BUILD;
-}
-
-bool Configuration::isBuiltWithCudd() {
- return false;
-}
-
-bool Configuration::isBuiltWithTlsSupport() {
- return USING_TLS;
-}
-
-unsigned Configuration::getNumDebugTags() {
-#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
- /* -1 because a NULL pointer is inserted as the last value */
- return (sizeof(Debug_tags) / sizeof(Debug_tags[0])) - 1;
-#else /* CVC4_DEBUG && CVC4_TRACING */
- return 0;
-#endif /* CVC4_DEBUG && CVC4_TRACING */
-}
-
-char const* const* Configuration::getDebugTags() {
-#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
- return Debug_tags;
-#else /* CVC4_DEBUG && CVC4_TRACING */
- static char const* no_tags[] = { NULL };
- return no_tags;
-#endif /* CVC4_DEBUG && CVC4_TRACING */
-}
-
-int strcmpptr(const char **s1, const char **s2){
- return strcmp(*s1,*s2);
-}
-
-bool Configuration::isDebugTag(char const *tag){
-#if defined(CVC4_DEBUG) && defined(CVC4_TRACING)
- unsigned ntags = getNumDebugTags();
- char const* const* tags = getDebugTags();
- for (unsigned i = 0; i < ntags; ++ i) {
- if (strcmp(tag, tags[i]) == 0) {
- return true;
- }
- }
-#endif /* CVC4_DEBUG && CVC4_TRACING */
- return false;
-}
-
-unsigned Configuration::getNumTraceTags() {
-#if CVC4_TRACING
- /* -1 because a NULL pointer is inserted as the last value */
- return sizeof(Trace_tags) / sizeof(Trace_tags[0]) - 1;
-#else /* CVC4_TRACING */
- return 0;
-#endif /* CVC4_TRACING */
-}
-
-char const* const* Configuration::getTraceTags() {
-#if CVC4_TRACING
- return Trace_tags;
-#else /* CVC4_TRACING */
- static char const* no_tags[] = { NULL };
- return no_tags;
-#endif /* CVC4_TRACING */
-}
-
-bool Configuration::isTraceTag(char const * tag){
-#if CVC4_TRACING
- unsigned ntags = getNumTraceTags();
- char const* const* tags = getTraceTags();
- for (unsigned i = 0; i < ntags; ++ i) {
- if (strcmp(tag, tags[i]) == 0) {
- return true;
- }
- }
-#endif /* CVC4_TRACING */
- return false;
-}
-
-bool Configuration::isGitBuild() {
- return IS_GIT_BUILD;
-}
-
-const char* Configuration::getGitBranchName() {
- return GIT_BRANCH_NAME;
-}
-
-const char* Configuration::getGitCommit() {
- return GIT_COMMIT;
-}
-
-bool Configuration::hasGitModifications() {
- return GIT_HAS_MODIFICATIONS;
-}
-
-std::string Configuration::getGitId() {
- if(! isGitBuild()) {
- return "";
- }
-
- const char* branchName = getGitBranchName();
- if(*branchName == '\0') {
- branchName = "-";
- }
-
- stringstream ss;
- ss << "git " << branchName << " " << string(getGitCommit()).substr(0, 8)
- << ( ::CVC4::Configuration::hasGitModifications() ? " (with modifications)" : "" );
- return ss.str();
-}
-
-bool Configuration::isSubversionBuild() {
- return IS_SUBVERSION_BUILD;
-}
-
-const char* Configuration::getSubversionBranchName() {
- return SUBVERSION_BRANCH_NAME;
-}
-
-unsigned Configuration::getSubversionRevision() {
- return SUBVERSION_REVISION;
-}
-
-bool Configuration::hasSubversionModifications() {
- return SUBVERSION_HAS_MODIFICATIONS;
-}
-
-std::string Configuration::getSubversionId() {
- if(! isSubversionBuild()) {
- return "";
- }
-
- stringstream ss;
- ss << "subversion " << getSubversionBranchName() << " r" << getSubversionRevision()
- << ( ::CVC4::Configuration::hasSubversionModifications() ? " (with modifications)" : "" );
- return ss.str();
-}
-
-std::string Configuration::getCompiler() {
- stringstream ss;
-#ifdef __GNUC__
- ss << "GCC";
-#else /* __GNUC__ */
- ss << "unknown compiler";
-#endif /* __GNUC__ */
-#ifdef __VERSION__
- ss << " version " << __VERSION__;
-#else /* __VERSION__ */
- ss << ", unknown version";
-#endif /* __VERSION__ */
- return ss.str();
-}
-
-std::string Configuration::getCompiledDateTime() {
- return __DATE__ " " __TIME__;
-}
-
-}/* CVC4 namespace */
+++ /dev/null
-/********************* */
-/*! \file configuration.h
- ** \verbatim
- ** Original author: Morgan Deters
- ** Major contributors: none
- ** Minor contributors (to current version): ACSYS, Liana Hadarean, Tim King, Francois Bobot
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Interface to a public class that provides compile-time information
- ** about the CVC4 library.
- **
- ** Interface to a public class that provides compile-time information
- ** about the CVC4 library.
- **/
-
-#include "cvc4_public.h"
-
-#ifndef __CVC4__CONFIGURATION_H
-#define __CVC4__CONFIGURATION_H
-
-#include <string>
-
-namespace CVC4 {
-
-/**
- * Represents the (static) configuration of CVC4.
- */
-class CVC4_PUBLIC Configuration {
-private:
- /** Private default ctor: Disallow construction of this class */
- Configuration();
-
- // these constants are filled in by the build system
- static const bool IS_SUBVERSION_BUILD;
- static const char* const SUBVERSION_BRANCH_NAME;
- static const unsigned SUBVERSION_REVISION;
- static const bool SUBVERSION_HAS_MODIFICATIONS;
- static const bool IS_GIT_BUILD;
- static const char* const GIT_BRANCH_NAME;
- static const char* const GIT_COMMIT;
- static const bool GIT_HAS_MODIFICATIONS;
-
-public:
-
- static std::string getName();
-
- static bool isDebugBuild();
-
- static bool isStatisticsBuild();
-
- static bool isReplayBuild();
-
- static bool isTracingBuild();
-
- static bool isDumpingBuild();
-
- static bool isMuzzledBuild();
-
- static bool isAssertionBuild();
-
- static bool isProofBuild();
-
- static bool isCoverageBuild();
-
- static bool isProfilingBuild();
-
- static bool isCompetitionBuild();
-
- static std::string getPackageName();
-
- static std::string getVersionString();
-
- static unsigned getVersionMajor();
-
- static unsigned getVersionMinor();
-
- static unsigned getVersionRelease();
-
- static std::string getVersionExtra();
-
- static std::string about();
-
- static bool licenseIsGpl();
-
- static bool isBuiltWithGmp();
-
- static bool isBuiltWithCln();
-
- static bool isBuiltWithGlpk();
-
- static bool isBuiltWithAbc();
-
- static bool isBuiltWithReadline();
-
- static bool isBuiltWithCudd();
-
- static bool isBuiltWithTlsSupport();
-
- /* Return the number of debug tags */
- static unsigned getNumDebugTags();
- /* Return a sorted array of the debug tags name */
- static char const* const* getDebugTags();
- /* Test if the given argument is a known debug tag name */
- static bool isDebugTag(char const *);
-
- /* Return the number of trace tags */
- static unsigned getNumTraceTags();
- /* Return a sorted array of the trace tags name */
- static char const* const* getTraceTags();
- /* Test if the given argument is a known trace tag name */
- static bool isTraceTag(char const *);
-
- static bool isGitBuild();
- static const char* getGitBranchName();
- static const char* getGitCommit();
- static bool hasGitModifications();
- static std::string getGitId();
-
- static bool isSubversionBuild();
- static const char* getSubversionBranchName();
- static unsigned getSubversionRevision();
- static bool hasSubversionModifications();
- static std::string getSubversionId();
-
- static std::string getCompiler();
- static std::string getCompiledDateTime();
-
-};/* class Configuration */
-
-}/* CVC4 namespace */
-
-#endif /* __CVC4__CONFIGURATION_H */
+++ /dev/null
-%{
-#include "util/configuration.h"
-%}
-
-%apply char **STRING_ARRAY { char const* const* }
-%include "util/configuration.h"
-%clear char const* const*;
+++ /dev/null
-/********************* */
-/*! \file configuration_private.h
- ** \verbatim
- ** Original author: Christopher L. Conway
- ** Major contributors: ACSYS, Morgan Deters
- ** Minor contributors (to current version): Liana Hadarean, Tim King
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Provides compile-time configuration information about the
- ** CVC4 library.
- **/
-
-#include "cvc4_private.h"
-
-#ifndef __CVC4__CONFIGURATION_PRIVATE_H
-#define __CVC4__CONFIGURATION_PRIVATE_H
-
-#include <string>
-#include "util/configuration.h"
-
-namespace CVC4 {
-
-#ifdef CVC4_DEBUG
-# define IS_DEBUG_BUILD true
-#else /* CVC4_DEBUG */
-# define IS_DEBUG_BUILD false
-#endif /* CVC4_DEBUG */
-
-#ifdef CVC4_STATISTICS_ON
-# define IS_STATISTICS_BUILD true
-#else /* CVC4_STATISTICS_ON */
-# define IS_STATISTICS_BUILD false
-#endif /* CVC4_STATISTICS_ON */
-
-#ifdef CVC4_REPLAY
-# define IS_REPLAY_BUILD true
-#else /* CVC4_REPLAY */
-# define IS_REPLAY_BUILD false
-#endif /* CVC4_REPLAY */
-
-#ifdef CVC4_TRACING
-# define IS_TRACING_BUILD true
-#else /* CVC4_TRACING */
-# define IS_TRACING_BUILD false
-#endif /* CVC4_TRACING */
-
-#ifdef CVC4_DUMPING
-# define IS_DUMPING_BUILD true
-#else /* CVC4_DUMPING */
-# define IS_DUMPING_BUILD false
-#endif /* CVC4_DUMPING */
-
-#ifdef CVC4_MUZZLE
-# define IS_MUZZLED_BUILD true
-#else /* CVC4_MUZZLE */
-# define IS_MUZZLED_BUILD false
-#endif /* CVC4_MUZZLE */
-
-#ifdef CVC4_ASSERTIONS
-# define IS_ASSERTIONS_BUILD true
-#else /* CVC4_ASSERTIONS */
-# define IS_ASSERTIONS_BUILD false
-#endif /* CVC4_ASSERTIONS */
-
-#ifdef CVC4_PROOF
-# define IS_PROOFS_BUILD true
-#else /* CVC4_PROOF */
-# define IS_PROOFS_BUILD false
-#endif /* CVC4_PROOF */
-
-#ifdef CVC4_COVERAGE
-# define IS_COVERAGE_BUILD true
-#else /* CVC4_COVERAGE */
-# define IS_COVERAGE_BUILD false
-#endif /* CVC4_COVERAGE */
-
-#ifdef CVC4_PROFILING
-# define IS_PROFILING_BUILD true
-#else /* CVC4_PROFILING */
-# define IS_PROFILING_BUILD false
-#endif /* CVC4_PROFILING */
-
-#ifdef CVC4_COMPETITION_MODE
-# define IS_COMPETITION_BUILD true
-#else /* CVC4_COMPETITION_MODE */
-# define IS_COMPETITION_BUILD false
-#endif /* CVC4_COMPETITION_MODE */
-
-#ifdef CVC4_GMP_IMP
-# define IS_GMP_BUILD true
-#else /* CVC4_GMP_IMP */
-# define IS_GMP_BUILD false
-#endif /* CVC4_GMP_IMP */
-
-#ifdef CVC4_CLN_IMP
-# define IS_CLN_BUILD true
-#else /* CVC4_CLN_IMP */
-# define IS_CLN_BUILD false
-#endif /* CVC4_CLN_IMP */
-
-#if CVC4_USE_GLPK
-# define IS_GLPK_BUILD true
-#else /* CVC4_USE_GLPK */
-# define IS_GLPK_BUILD false
-#endif /* CVC4_USE_GLPK */
-
-#if CVC4_USE_ABC
-# define IS_ABC_BUILD true
-#else /* CVC4_USE_ABC */
-# define IS_ABC_BUILD false
-#endif /* CVC4_USE_ABC */
-
-#ifdef HAVE_LIBREADLINE
-# define IS_READLINE_BUILD true
-#else /* HAVE_LIBREADLINE */
-# define IS_READLINE_BUILD false
-#endif /* HAVE_LIBREADLINE */
-
-#if CVC4_GPL_DEPS
-# define IS_GPL_BUILD true
-#else /* CVC4_GPL_DEPS */
-# define IS_GPL_BUILD false
-#endif /* CVC4_GPL_DEPS */
-
-#ifdef TLS
-# define USING_TLS true
-#else /* TLS */
-# define USING_TLS false
-#endif /* TLS */
-
-#define CVC4_ABOUT_STRING ( ::std::string("\
-This is CVC4 version " CVC4_RELEASE_STRING ) + \
- ( ::CVC4::Configuration::isGitBuild() \
- ? ( ::std::string(" [") + ::CVC4::Configuration::getGitId() + "]" ) \
- : \
- ( ::CVC4::Configuration::isSubversionBuild() \
- ? ( ::std::string(" [") + ::CVC4::Configuration::getSubversionId() + "]" ) \
- : ::std::string("") \
- )) + "\n\
-compiled with " + ::CVC4::Configuration::getCompiler() + "\n\
-on " + ::CVC4::Configuration::getCompiledDateTime() + "\n\n\
-Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014\n\
- New York University and The University of Iowa\n\n" + \
- ( IS_GPL_BUILD ? "\
-This build of CVC4 uses GPLed libraries, and is thus covered by the GNU\n\
-General Public License (GPL) version 3. Versions of CVC4 are available\n\
-that are covered by the (modified) BSD license. If you want to license\n\
-CVC4 under this license, please configure CVC4 with the \"--bsd\" option\n\
-before building from sources.\n\
-" : \
-"This CVC4 library uses GMP as its multi-precision arithmetic library.\n\n\
-CVC4 is open-source and is covered by the BSD license (modified).\n\n\
-" ) + "\
-THIS SOFTWARE PROVIDED AS-IS, WITHOUT ANY WARRANTIES. USE AT YOUR OWN RISK.\n\n\
-See the file COPYING (distributed with the source code, and with all binaries)\n\
-for the full CVC4 copyright, licensing, and (lack of) warranty information.\n" )
-
-}/* CVC4 namespace */
-
-#endif /* __CVC4__CONFIGURATION_PRIVATE_H */
#include "base/cvc4_assert.h"
#include "base/output.h"
+#include "options/smt_options.h"
using namespace std;
d_thisCallResourceUsed += ammount;
if(out()) {
Trace("limit") << "ResourceManager::spendResource: interrupt!" << std::endl;
- Trace("limit") << " on call " << d_spendResourceCalls << std::endl;
+ Trace("limit") << " on call " << d_spendResourceCalls << std::endl;
if (outOfTime()) {
- Trace("limit") << "ResourceManager::spendResource: elapsed time" << d_cumulativeTimer.elapsed() << std::endl;
+ Trace("limit") << "ResourceManager::spendResource: elapsed time"
+ << d_cumulativeTimer.elapsed() << std::endl;
}
if (d_isHardLimit) {
d_on = on;
}
-ListenerCollection* ResourceManager::getHardListeners() {
- return &d_hardListeners;
+ListenerCollection::Registration* ResourceManager::registerHardListener(
+ Listener* listener)
+{
+ return d_hardListeners.registerListener(listener);
}
-ListenerCollection* ResourceManager::getSoftListeners() {
- return &d_softListeners;
+ListenerCollection::Registration* ResourceManager::registerSoftListener(
+ Listener* listener)
+{
+ return d_softListeners.registerListener(listener);
}
} /* namespace CVC4 */
/** Receives a notification on reaching a hard limit. */
ListenerCollection d_softListeners;
+ /**
+ * ResourceManagers cannot be copied as they are given an explicit
+ * list of Listeners to respond to.
+ */
+ ResourceManager(const ResourceManager&) CVC4_UNDEFINED;
+
+ /**
+ * ResourceManagers cannot be assigned as they are given an explicit
+ * list of Listeners to respond to.
+ */
+ ResourceManager& operator=(const ResourceManager&) CVC4_UNDEFINED;
+
public:
ResourceManager();
static uint64_t getFrequencyCount() { return s_resourceCount; }
- /** Collection of listeners that are notified on a hard resource out. */
- ListenerCollection* getHardListeners();
+ /**
+ * Registers a listener that is notified on a hard resource out.
+ *
+ * This Registration must be destroyed by the user before this
+ * ResourceManager.
+ */
+ ListenerCollection::Registration* registerHardListener(Listener* listener);
+
+ /**
+ * Registers a listener that is notified on a soft resource out.
+ *
+ * This Registration must be destroyed by the user before this
+ * ResourceManager.
+ */
+ ListenerCollection::Registration* registerSoftListener(Listener* listener);
- /** Collection of listeners that are notified on a soft resource out. */
- ListenerCollection* getSoftListeners();
};/* class ResourceManager */
+
}/* CVC4 namespace */
#endif /* __CVC4__RESOURCE_MANAGER_H */
d_children(NULL) {
}
- /**
- * This constructs a string expression from a const char* value.
- * This cannot be removed in order to support SExpr("foo").
- * Given the other constructors this SExpr("foo") converts to bool.
- * instead of SExpr(string("foo")).
- */
+/**
+ * This constructs a string expression from a const char* value.
+ * This cannot be removed in order to support SExpr("foo").
+ * Given the other constructors this SExpr("foo") converts to bool.
+ * instead of SExpr(string("foo")).
+ */
SExpr::SExpr(const char* value) :
d_sexprType(SEXPR_STRING),
d_integerValue(0),
d_children(NULL) {
}
-#warning "TODO: Discuss this change with Clark."
SExpr::SExpr(bool value) :
d_sexprType(SEXPR_KEYWORD),
d_integerValue(0),
#include <sstream>
#include "expr/expr_manager.h"
-#include "options/base_options.h"
+#include "options/options.h"
#include "options/set_language.h"
-#include "options/smt_options.h"
#include "parser/parser.h"
#include "parser/parser_builder.h"
#include "smt/smt_engine.h"
int main() {
Options opts;
- opts.set(options::inputLanguage, language::input::LANG_SMTLIB_V2);
- opts.set(options::outputLanguage, language::output::LANG_SMTLIB_V2);
+ opts.setInputLanguage(language::input::LANG_SMTLIB_V2);
+ opts.setOutputLanguage(language::output::LANG_SMTLIB_V2);
cout << language::SetLanguage(language::output::LANG_SMTLIB_V2);
}
void testGetInfo(SmtEngine& smt, const char* s) {
- ParserBuilder pb(smt.getExprManager(), "<internal>", smt.getExprManager()->getOptions());
+ ParserBuilder pb(smt.getExprManager(), "<internal>",
+ smt.getExprManager()->getOptions());
Parser* p = pb.withStringInput(string("(get-info ") + s + ")").build();
assert(p != NULL);
Command* c = p->nextCommand();
}
class Foo {
- int blah CVC4_UNUSED;
+ int d_bar;
public:
- Foo(int b) : blah(b) {}
+ Foo(int b) : d_bar(b) {}
+ int getBar() const { return d_bar; }
};
struct PtrAttributeId {};
TS_ASSERT(!node->getAttribute(cdattr, data2));
node->setAttribute(cdattr, val);
TS_ASSERT(node->getAttribute(cdattr, data3));
+ TS_ASSERT(data3 != NULL);
+ TS_ASSERT_EQUALS(63489, data3->getBar());
TS_ASSERT_EQUALS(data3, val);
delete node;
delete val;
#include "base/exception.h"
#include "expr/expr_manager.h"
#include "expr/expr.h"
-#include "smt/smt_options_handler.h"
+#include "options/options.h"
using namespace CVC4;
using namespace CVC4::kind;
private:
Options opts;
- smt::SmtOptionsHandler* d_handler;
ExprManager* d_em;
void setUp() {
try {
- d_handler = new smt::SmtOptionsHandler(NULL);
char *argv[2];
argv[0] = strdup("");
argv[1] = strdup("--output-language=ast");
- opts.parseOptions(2, argv, d_handler);
+ opts.parseOptions(2, argv);
free(argv[0]);
free(argv[1]);
delete c_bool_and;
delete b_bool;
delete a_bool;
- delete d_handler;
delete d_em;
} catch(Exception e) {
#include "expr/node_builder.h"
#include "expr/node_manager.h"
#include "expr/node.h"
-#include "smt/smt_options_handler.h"
using namespace CVC4;
using namespace CVC4::kind;
private:
Options opts;
- smt::SmtOptionsHandler* d_handler;
NodeManager* d_nodeManager;
NodeManagerScope* d_scope;
TypeNode* d_booleanType;
public:
void setUp() {
-#warning "TODO: Discuss the effects of this change with Clark."
- d_handler = new smt::SmtOptionsHandler(NULL);
-
char *argv[2];
argv[0] = strdup("");
argv[1] = strdup("--output-language=ast");
- opts.parseOptions(2, argv, d_handler);
+ opts.parseOptions(2, argv);
free(argv[0]);
free(argv[1]);
delete d_booleanType;
delete d_scope;
delete d_nodeManager;
- delete d_handler;
}
bool imp(bool a, bool b) const {
d_satSolver = new FakeSatSolver();
d_cnfStream = new CVC4::prop::TseitinCnfStream(
d_satSolver, new theory::TheoryRegistrar(d_theoryEngine),
- new context::Context(), d_smt->globals());
+ new context::Context(), d_smt->channels());
}
void tearDown() {
d_smt->d_theoryEngine->d_theoryOut[THEORY_ARITH] = NULL;
d_arith = new TheoryArith(d_ctxt, d_uctxt, d_outputChannel, Valuation(NULL),
- d_logicInfo, d_smt->globals());
+ d_logicInfo);
preregistered = new std::set<Node>();
// static std::deque<RewriteItem> s_expected;
public:
- FakeTheory(context::Context* ctxt, context::UserContext* uctxt, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, SmtGlobals* globals) :
- Theory(theoryId, ctxt, uctxt, out, valuation, logicInfo, globals)
+ FakeTheory(context::Context* ctxt, context::UserContext* uctxt, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo) :
+ Theory(theoryId, ctxt, uctxt, out, valuation, logicInfo)
{ }
/** Register an expected rewrite call */
vector<Node> d_getSequence;
DummyTheory(Context* ctxt, UserContext* uctxt, OutputChannel& out,
- Valuation valuation, const LogicInfo& logicInfo, SmtGlobals* globals)
- : Theory(theory::THEORY_BUILTIN, ctxt, uctxt, out, valuation, logicInfo, globals)
+ Valuation valuation, const LogicInfo& logicInfo)
+ : Theory(theory::THEORY_BUILTIN, ctxt, uctxt, out, valuation, logicInfo)
{}
void registerTerm(TNode n) {
d_smt->d_theoryEngine->d_theoryOut[THEORY_BUILTIN] = NULL;
d_dummy = new DummyTheory(d_ctxt, d_uctxt, d_outputChannel, Valuation(NULL),
- *d_logicInfo, d_smt->globals());
+ *d_logicInfo);
d_outputChannel.clear();
atom0 = d_nm->mkConst(true);
atom1 = d_nm->mkConst(false);
#include <cxxtest/TestSuite.h>
-#include "util/configuration.h"
+#include "base/configuration.h"
using namespace CVC4;
using namespace std;
ListenerCollection collection;
std::string expected[1] = {"a"};
{
- RegisterListener a(&collection, new EventListener(d_events, "a"));
+ ListenerCollection::Registration a(&collection, new EventListener(d_events, "a"));
collection.notify();
TS_ASSERT(not collection.empty());
}
// registering a single event.
ListenerCollection* collection = new ListenerCollection;
{
- RegisterListener a(collection, new EventListener(d_events, "a"));
+ ListenerCollection::Registration a(collection, new EventListener(d_events, "a"));
TS_ASSERT(not collection->empty());
// The destructor for a now runs.
}
void testMultipleCollection() {
ListenerCollection* collection = new ListenerCollection;
{
- RegisterListener c(collection, new EventListener(d_events, "c"));
+ ListenerCollection::Registration c(collection, new EventListener(d_events, "c"));
collection->notify();
// d_events == {"c"}
- RegisterListener b(collection, new EventListener(d_events, "b"));
- RegisterListener a(collection, new EventListener(d_events, "a"));
+ ListenerCollection::Registration b(collection, new EventListener(d_events, "b"));
+ ListenerCollection::Registration a(collection, new EventListener(d_events, "a"));
collection->notify();
// d_events == {"a", "b", "c", "c"}
TS_ASSERT(not collection->empty());
// registering several events.
ListenerCollection* collection = new ListenerCollection;
{
- RegisterListener a(collection, new EventListener(d_events, "a"));
- RegisterListener* b =
- new RegisterListener(collection, new EventListener(d_events, "b"));
- RegisterListener c(collection, new EventListener(d_events, "c"));
+ ListenerCollection::Registration a(collection, new EventListener(d_events, "a"));
+ ListenerCollection::Registration* b =
+ new ListenerCollection::Registration(collection, new EventListener(d_events, "b"));
+ ListenerCollection::Registration c(collection, new EventListener(d_events, "c"));
collection->notify();
delete b;
// This tests adds and notify multiple times.
ListenerCollection collection;
- std::vector<RegisterListener*> listeners;
+ std::vector<ListenerCollection::Registration*> listeners;
for(int i = 0; i < 4 ; ++i){
stringstream ss; ss << i;
Listener* listener = new EventListener(d_events, ss.str());
- listeners.push_back(new RegisterListener(&collection, listener));
+ listeners.push_back(new ListenerCollection::Registration(&collection, listener));
collection.notify();
}
TS_ASSERT(not collection.empty());
for(int i=0; i < listeners.size(); ++i){
- RegisterListener* at_i = listeners[i];
+ ListenerCollection::Registration* at_i = listeners[i];
delete at_i;
}
listeners.clear();
public:
void setUp() {
- DebugChannel.setStream(d_debugStream);
- TraceChannel.setStream(d_traceStream);
- NoticeChannel.setStream(d_noticeStream);
- ChatChannel.setStream(d_chatStream);
- MessageChannel.setStream(d_messageStream);
- WarningChannel.setStream(d_warningStream);
+ DebugChannel.setStream(&d_debugStream);
+ TraceChannel.setStream(&d_traceStream);
+ NoticeChannel.setStream(&d_noticeStream);
+ ChatChannel.setStream(&d_chatStream);
+ MessageChannel.setStream(&d_messageStream);
+ WarningChannel.setStream(&d_warningStream);
d_debugStream.str("");
d_traceStream.str("");