bindir = @bindir@
libdir = @libdir@
abs_builddir = @abs_builddir@
+BUILDING_STATIC = @BUILDING_STATIC@
+BUILDING_SHARED = @BUILDING_SHARED@
.PHONY: _default_build_ all
_default_build_: all
$(mkinstalldirs) "$(CURRENT_BUILD)$(bindir)" "$(CURRENT_BUILD)$(libdir)"
$(CURRENT_BUILD)/libtool --mode=install install -v $(CURRENT_BUILD)/src/libcvc4.la "$(abs_builddir)$(libdir)"
$(CURRENT_BUILD)/libtool --mode=install install -v $(CURRENT_BUILD)/src/parser/libcvc4parser.la "$(abs_builddir)$(libdir)"
+ifeq ($(BUILDING_SHARED),1)
thelibdir="$(abs_builddir)$(libdir)"; progdir="$(abs_builddir)$(bindir)"; file=cvc4; \
eval `grep '^relink_command=' $(CURRENT_BUILD)/src/main/cvc4 | sed 's:-Wl,-rpath:-Wl,-rpath -Wl,\\\\$$thelibdir -Wl,-rpath:'`; \
eval "(cd $(CURRENT_BUILD)/src/main && $$relink_command)"
+endif
+ifeq ($(BUILDING_STATIC),1)
+ install -v $(CURRENT_BUILD)/src/main/cvc4 "$(abs_builddir)$(bindir)"
+endif
test -e $(CURRENT_BUILD)/lib || ln -sfv "$(abs_builddir)$(libdir)" $(CURRENT_BUILD)/lib
test -e $(CURRENT_BUILD)/bin || ln -sfv "$(abs_builddir)$(bindir)" $(CURRENT_BUILD)/bin
mkdir -pv ".$(bindir)" ".$(libdir)"
$(CURRENT_BUILD)/libtool --mode=install install -v $(CURRENT_BUILD)/src/libcvc4.la "`pwd`$(libdir)"
$(CURRENT_BUILD)/libtool --mode=install install -v $(CURRENT_BUILD)/src/parser/libcvc4parser.la "`pwd`$(libdir)"
+ifeq ($(BUILDING_SHARED),1)
thelibdir="`pwd`$(libdir)"; progdir="`pwd`$(bindir)"; file=cvc4; \
eval `grep '^relink_command=' $(CURRENT_BUILD)/src/main/cvc4 | sed 's:-Wl,-rpath:-Wl,-rpath -Wl,\\\\$$thelibdir -Wl,-rpath:'`; \
eval "(cd $(CURRENT_BUILD)/src/main && $$relink_command)"
+endif
+ifeq ($(BUILDING_STATIC),1)
+ install -v $(CURRENT_BUILD)/src/main/cvc4 "`pwd`$(bindir)"
+endif
test -e lib || ln -sfv ".$(libdir)" lib
test -e bin || ln -sfv ".$(bindir)" bin
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CVC4_PARSER_LIBRARY_VERSION
CVC4_LIBRARY_VERSION
CVC4_LIBRARY_RELEASE_CODE
+BUILDING_STATIC
+BUILDING_SHARED
ANTLR_LDFLAGS
ANTLR_INCLUDES
PERL
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:5459: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:5461: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:5462: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:5464: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:5465: output\"" >&5)
+ (eval echo "\"\$as_me:5467: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6668 "configure"' > conftest.$ac_ext
+ echo '#line 6670 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8136: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8138: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8140: \$? = $ac_status" >&5
+ echo "$as_me:8142: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8475: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8477: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8479: \$? = $ac_status" >&5
+ echo "$as_me:8481: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8580: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8582: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8584: \$? = $ac_status" >&5
+ echo "$as_me:8586: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8635: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8637: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8639: \$? = $ac_status" >&5
+ echo "$as_me:8641: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11018 "configure"
+#line 11020 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11114 "configure"
+#line 11116 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14669: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14671: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14673: \$? = $ac_status" >&5
+ echo "$as_me:14675: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14768: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14770: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14772: \$? = $ac_status" >&5
+ echo "$as_me:14774: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14820: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14822: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14824: \$? = $ac_status" >&5
+ echo "$as_me:14826: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
# Prepare configure output
+if test "$enable_shared" = yes; then BUILDING_SHARED=1; fi
+if test "$enable_static" = yes; then BUILDING_STATIC=1; fi
+
+
+
# Prepare configure output
+if test "$enable_shared" = yes; then BUILDING_SHARED=1; fi
+if test "$enable_static" = yes; then BUILDING_STATIC=1; fi
+AC_SUBST(BUILDING_SHARED)
+AC_SUBST(BUILDING_STATIC)
+
AC_SUBST(CVC4_LIBRARY_RELEASE_CODE)
AC_SUBST(CVC4_LIBRARY_VERSION)
AC_SUBST(CVC4_PARSER_LIBRARY_VERSION)
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
#include "cvc4_config.h"
#include "expr/kind.h"
+#include "util/Assert.h"
namespace CVC4 {
class Node;
bool operator==(const Node& e) const { return d_ev == e.d_ev; }
bool operator!=(const Node& e) const { return d_ev != e.d_ev; }
+ Node operator[](int i) const {
+ Assert(i >= 0 && i < d_ev->d_nchildren);
+ return Node(d_ev->d_children[i]);
+ }
+
/**
* We compare by expression ids so, keeping things deterministic and having
* that subexpressions have to be smaller than the enclosing expressions.
NodeBuilder& append(const Node& n) {
Assert(!d_used, "NodeBuilder is one-shot only; tried to access it after conversion");
+ Debug("prop") << "append: " << this << " " << n << "[" << n.d_ev << "]" << std::endl;
allocateEvIfNecessaryForAppend();
NodeValue* ev = n.d_ev;
d_hash = NodeValue::computeHash(d_hash, ev);
d_used(false),
d_ev(&d_inlineEv),
d_inlineEv(0),
- d_childrenStorage(0) {}
+ d_childrenStorage() {}
template <unsigned nchild_thresh>
inline NodeBuilder<nchild_thresh>::NodeBuilder(Kind k) :
d_used(false),
d_ev(&d_inlineEv),
d_inlineEv(0),
- d_childrenStorage(0) {
+ d_childrenStorage() {
- Message() << "kind " << k << std::endl;
+ //Message() << "kind " << k << std::endl;
d_inlineEv.d_kind = k;
}
d_used(nb.d_used),
d_ev(&d_inlineEv),
d_inlineEv(0),
- d_childrenStorage(0) {
+ d_childrenStorage() {
if(evIsAllocated(nb)) {
realloc(nb->d_size, false);
- std::copy(d_ev->begin(), nb.d_ev->begin(), nb.d_ev->end());
+ std::copy(nb.d_ev->begin(), nb.d_ev->end(), d_ev->begin());
} else {
- std::copy(d_inlineEv.begin(), nb.d_ev->begin(), nb.d_ev->end());
+ std::copy(nb.d_ev->begin(), nb.d_ev->end(), d_inlineEv.begin());
}
}
d_used(nb.d_used),
d_ev(&d_inlineEv),
d_inlineEv(0),
- d_childrenStorage(0) {
+ d_childrenStorage() {
if(nb.d_ev->d_nchildren > nchild_thresh) {
realloc(nb.d_size, false);
- std::copy(d_ev->begin(), nb.d_ev->begin(), nb.d_ev->end());
+ std::copy(nb.d_ev->begin(), nb.d_ev->end(), d_ev->begin());
} else {
- std::copy(d_inlineEv.begin(), nb.d_ev->begin(), nb.d_ev->end());
+ std::copy(nb.d_ev->begin(), nb.d_ev->end(), d_inlineEv.begin());
}
}
d_used(false),
d_ev(&d_inlineEv),
d_inlineEv(0),
- d_childrenStorage(0) {}
+ d_childrenStorage() {}
template <unsigned nchild_thresh>
inline NodeBuilder<nchild_thresh>::NodeBuilder(NodeManager* nm, Kind k) :
d_inlineEv(0),
d_childrenStorage() {
- Message() << "kind " << k << std::endl;
+ //Message() << "kind " << k << std::endl;
d_inlineEv.d_kind = k;
}
d_ev->d_rc = 0;
d_ev->d_kind = d_inlineEv.d_kind;
d_ev->d_nchildren = nchild_thresh;
- std::copy(d_ev->d_children,
- d_inlineEv.d_children,
- d_inlineEv.d_children + nchild_thresh);
+ std::copy(d_inlineEv.d_children,
+ d_inlineEv.d_children + nchild_thresh,
+ d_ev->d_children);
}
}
d_ev->d_kind = d_inlineEv.d_kind;
d_ev->d_nchildren = nchild_thresh;
if(copy) {
- std::copy(d_ev->d_children,
- d_inlineEv.d_children,
- d_inlineEv.d_children + nchild_thresh);
+ std::copy(d_inlineEv.d_children,
+ d_inlineEv.d_children + nchild_thresh,
+ d_ev->d_children);
}
}
}
Assert(d_ev->d_kind != UNDEFINED_KIND,
"Can't make an expression of an undefined kind!");
+ if(d_ev->d_kind == VARIABLE) {
+ Assert(d_ev->d_nchildren == 0);
+ NodeValue *ev = (NodeValue*)
+ std::malloc(sizeof(NodeValue) +
+ ( sizeof(NodeValue*) * d_inlineEv.d_nchildren ));
+ ev->d_nchildren = 0;
+ ev->d_kind = VARIABLE;
+ ev->d_id = NodeValue::next_id++;// FIXME multithreading
+ ev->d_rc = 0;
+ d_used = true;
+ d_ev = NULL;
+ Debug("prop") << "result: " << Node(ev) << std::endl;
+ return Node(ev);
+ }
+
// implementation differs depending on whether the expression value
// was malloc'ed or not
if(ev != NULL) {
// expression already exists in node manager
d_used = true;
+ Debug("prop") << "result: " << Node(ev) << std::endl;
return Node(ev);
}
// this inserts into the NodeManager;
// return the result of lookup() in case another thread beat us to it
d_used = true;
- return d_nm->lookup(d_hash, ev);
+ Node n = d_nm->lookup(d_hash, ev);
+ Debug("prop") << "result: " << n << std::endl;
+ return n;
}
NodeValue *ev = d_nm->lookupNoInsert(d_hash, &d_inlineEv);
if(ev != NULL) {
// expression already exists in node manager
d_used = true;
+ Debug("prop") << "result: " << Node(ev) << std::endl;
return Node(ev);
}
// otherwise create the canonical expression value for this node
ev = (NodeValue*)
std::malloc(sizeof(NodeValue) +
- ( sizeof(NodeValue*) * d_inlineEv.d_nchildren) );
- ev->d_nchildren = d_ev->d_nchildren;
- ev->d_kind = d_ev->d_kind;
+ ( sizeof(NodeValue*) * d_inlineEv.d_nchildren ));
+ ev->d_nchildren = d_inlineEv.d_nchildren;
+ ev->d_kind = d_inlineEv.d_kind;
ev->d_id = NodeValue::next_id++;// FIXME multithreading
ev->d_rc = 0;
+ std::copy(d_inlineEv.d_children,
+ d_inlineEv.d_children + d_inlineEv.d_nchildren,
+ ev->d_children);
d_used = true;
d_ev = NULL;
// this inserts into the NodeManager;
// return the result of lookup() in case another thread beat us to it
- return d_nm->lookup(d_hash, ev);
+ if(ev->numChildren()) {
+ Debug("prop") << "ev first child: " << *ev->ev_begin() << std::endl;
+ }
+ Node n = d_nm->lookup(d_hash, ev);
+ Debug("prop") << "result: " << n << std::endl;
+ return n;
}
}/* CVC4 namespace */
return *j;
}
+
// didn't find it, insert
std::vector<Node> v;
Node e(ev);
return j->d_ev;
}
+
// didn't find it, don't insert
return 0;
}
namespace expr {
inline Node NodeValue::node_iterator::operator*() {
- return Node((NodeValue*) d_i);
+ return Node(*d_i);
}
}/* CVC4::expr namespace */
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
}
if(strcmp(optarg, "help")) {
- throw OptionException(string("unknown language for --lang: `") + argv[optind] + "'. Try --lang help.");
+ throw OptionException(string("unknown language for --lang: `") +
+ optarg + "'. Try --lang help.");
}
fputs(lang_help, stdout);
break;
case '?':
- throw OptionException(string("can't understand option: `") + argv[optind] + "'");
+ throw OptionException(string("can't understand option"));// + argv[optind - 1] + "'");
case ':':
- throw OptionException(string("option `") + argv[optind] + "' missing its required argument");
+ throw OptionException(string("option missing its required argument"));// + argv[optind - 1] + "' missing its required argument");
default:
- throw OptionException(string("can't understand option: `") + argv[optind] + "'");
+ throw OptionException(string("can't understand option"));//: `") + argv[optind - 1] + "'");
}
}
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
c->push(Lit(v->second, true));
return;
}
- Unhandled();
+ if(e.getKind() == OR) {
+ for(Node::iterator i = e.begin(); i != e.end(); ++i) {
+ doAtom(minisat, vars, *i, c);
+ }
+ return;
+ }
+ Unhandled(e.getKind());
}
static void doClause(SimpSolver* minisat, map<Node, Var>* vars, map<Var, Node>* varsReverse, Node e) {
Debug("prop") << " " << e << endl;
if(e.getKind() == VARIABLE || e.getKind() == NOT) {
doAtom(minisat, vars, e, &c);
+ } else if(e.getKind() == FALSE) {
+ // inconsistency
+ Notice() << "adding FALSE clause" << endl;
+ Var v = minisat->newVar();
+ c.push(Lit(v, true));
+ minisat->addClause(c);
+ Notice() << "added unit clause " << v << " [[ " << (*varsReverse)[v] << " ]]" << endl;
+ c.clear();
+ c.push(Lit(v, false));
+ minisat->addClause(c);
+ Notice() << "added unit clause -" << v << " [[ -" << (*varsReverse)[v] << " ]]" << endl;
+ } else if(e.getKind() == TRUE) {
+ Notice() << "adding TRUE clause (do nothing)" << endl;
+ // do nothing
} else {
Assert(e.getKind() == OR);
for(Node::iterator i = e.begin(); i != e.end(); ++i) {
d_sat.verbosity = 1;
bool result = d_sat.solve();
- Notice() << "result is " << (result ? "sat" : "unsat") << endl;
+ Notice() << "result is " << (result ? "sat/invalid" : "unsat/valid") << endl;
if(result) {
Notice() << "model:" << endl;
for(int i = 0; i < d_sat.model.size(); ++i)
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
#include "smt/smt_engine.h"
#include "util/exception.h"
#include "util/command.h"
+#include "util/output.h"
+#include "expr/node_builder.h"
namespace CVC4 {
SmtEngine::SmtEngine(ExprManager* em, Options* opts) throw() :
- d_public_em(em),
- d_em(em->getNodeManager()),
- d_opts(opts),
- d_de(),
- d_te(),
- d_prop(d_de, d_te) {
- }
+ d_assertions(),
+ d_public_em(em),
+ d_nm(em->getNodeManager()),
+ d_opts(opts),
+ d_de(),
+ d_te(),
+ d_prop(d_de, d_te) {
+}
SmtEngine::~SmtEngine() {
}
void SmtEngine::doCommand(Command* c) {
+ NodeManagerScope nms(d_nm);
c->invoke(this);
}
Node SmtEngine::preprocess(const Node& e) {
+ if(e.getKind() == NOT) {
+ if(e[0].getKind() == TRUE) {
+ return d_nm->mkNode(FALSE);
+ } else if(e[0].getKind() == FALSE) {
+ return d_nm->mkNode(TRUE);
+ } else if(e[0].getKind() == NOT) {
+ return preprocess(e[0][0]);
+ }
+ }
return e;
}
Node SmtEngine::processAssertionList() {
- Node asserts;
+ if(d_assertions.size() == 1) {
+ return d_assertions[0];
+ }
+
+ NodeBuilder<> asserts(AND);
for(std::vector<Node>::iterator i = d_assertions.begin();
i != d_assertions.end();
++i) {
- asserts = asserts.isNull() ? *i : d_em->mkNode(AND, asserts, *i);
+ asserts << *i;
}
+
return asserts;
}
}
void SmtEngine::addFormula(const Node& e) {
+ Debug("smt") << "push_back assertion " << e << std::endl;
d_assertions.push_back(e);
}
Result SmtEngine::checkSat(const BoolExpr& e) {
+ NodeManagerScope nms(d_nm);
Node node_e = preprocess(e.getNode());
addFormula(node_e);
return check();
}
Result SmtEngine::query(const BoolExpr& e) {
- Node node_e = preprocess(e.getNode());
+ NodeManagerScope nms(d_nm);
+ Node node_e = preprocess(d_nm->mkNode(NOT, e.getNode()));
addFormula(node_e);
return check();
}
Result SmtEngine::assertFormula(const BoolExpr& e) {
+ NodeManagerScope nms(d_nm);
Node node_e = preprocess(e.getNode());
addFormula(node_e);
return quickCheck();
}
+Expr SmtEngine::simplify(const Expr& e) {
+ Expr simplify(const Expr& e);
+ Unimplemented();
+}
+
}/* CVC4 namespace */
ExprManager *d_public_em;
/** Out internal expression/node manager */
- NodeManager *d_em;
+ NodeManager *d_nm;
/** User-level options */
Options *d_opts;
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
}
};/* class UnhandledCaseException */
+class CVC4_PUBLIC UnimplementedOperationException : public AssertionException {
+protected:
+ UnimplementedOperationException() : AssertionException() {}
+
+public:
+ UnimplementedOperationException(const char* function, const char* file,
+ unsigned line, const char* fmt, ...) :
+ AssertionException() {
+ va_list args;
+ va_start(args, fmt);
+ construct("Unimplemented code encountered",
+ NULL, function, file, line, fmt, args);
+ va_end(args);
+ }
+
+ UnimplementedOperationException(const char* function, const char* file,
+ unsigned line) :
+ AssertionException() {
+ construct("Unimplemented code encountered", NULL, function, file, line);
+ }
+};/* class UnimplementedOperationException */
+
class CVC4_PUBLIC IllegalArgumentException : public AssertionException {
protected:
IllegalArgumentException() : AssertionException() {}
throw UnreachableCodeException(__PRETTY_FUNCTION__, __FILE__, __LINE__, ## msg)
#define Unhandled(msg...) \
throw UnhandledCaseException(__PRETTY_FUNCTION__, __FILE__, __LINE__, ## msg)
+#define Unimplemented(msg...) \
+ throw UnimplementedOperationException(__PRETTY_FUNCTION__, __FILE__, __LINE__, ## msg)
#define IllegalArgument(arg, msg...) \
throw IllegalArgumentException(#arg, __PRETTY_FUNCTION__, __FILE__, __LINE__, ## msg)
#define CheckArgument(cond, arg, msg...) \
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
// Yeting option not possible here
std::ostream& operator()(const char* tag) {
- if(d_tags.find(tag) != d_tags.end())
+ if(d_tags.find(std::string(tag)) != d_tags.end())
return *d_os;
else return null_os;
}
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
-TESTS_ENVIRONMENT = @top_builddir@/bin/cvc4
+TESTS_ENVIRONMENT = @top_builddir@/../../bin/cvc4
TESTS = \
simple.cvc \
simple.smt \
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-TESTS_ENVIRONMENT = @top_builddir@/bin/cvc4
+TESTS_ENVIRONMENT = @top_builddir@/../../bin/cvc4
TESTS = \
simple.cvc \
simple.smt \
:extrapreds ((x1))
:extrapreds ((x2))
:extrapreds ((x3))
-:assumption (or x1 (not x0))
:formula
-(and (or x0 (not x3))
+(and (or x1 (not x0))
+ (or x0 (not x3))
(or x3 x2)
(not x1))
)
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
expr/node_black \
parser/parser_black
+TESTS_DEPENDENCIES = $(abs_top_builddir)/src/libcvc4.la $(abs_top_builddir)/src/parser/libcvc4parser.la
+
# things that aren't tests but that tests rely on and need to
# go into the distribution
TEST_DEPS =
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BUILDING_SHARED = @BUILDING_SHARED@
+BUILDING_STATIC = @BUILDING_STATIC@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
expr/node_black \
parser/parser_black
+TESTS_DEPENDENCIES = $(abs_top_builddir)/src/libcvc4.la $(abs_top_builddir)/src/parser/libcvc4parser.la
# things that aren't tests but that tests rely on and need to
# go into the distribution