summaryrefslogtreecommitdiff
path: root/src/proof
diff options
context:
space:
mode:
Diffstat (limited to 'src/proof')
-rw-r--r--src/proof/options8
-rw-r--r--src/proof/proof.h2
-rw-r--r--src/proof/proof_manager.cpp17
-rw-r--r--src/proof/unsat_core.cpp54
-rw-r--r--src/proof/unsat_core.h72
-rw-r--r--src/proof/unsat_core.i69
6 files changed, 205 insertions, 17 deletions
diff --git a/src/proof/options b/src/proof/options
deleted file mode 100644
index af4ffeb93..000000000
--- a/src/proof/options
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Option specification file for CVC4
-# See src/options/base_options for a description of this file format
-#
-
-module PROOF "proof/options.h" Proof
-
-endmodule
diff --git a/src/proof/proof.h b/src/proof/proof.h
index 25979dc46..ae4c940a0 100644
--- a/src/proof/proof.h
+++ b/src/proof/proof.h
@@ -19,7 +19,7 @@
#ifndef __CVC4__PROOF__PROOF_H
#define __CVC4__PROOF__PROOF_H
-#include "smt/options.h"
+#include "options/smt_options.h"
/* Do NOT use #ifdef CVC4_PROOF to check if proofs are enabled.
diff --git a/src/proof/proof_manager.cpp b/src/proof/proof_manager.cpp
index 311d4afeb..88d380c4f 100644
--- a/src/proof/proof_manager.cpp
+++ b/src/proof/proof_manager.cpp
@@ -16,22 +16,23 @@
**/
#include "proof/proof_manager.h"
-#include "util/proof.h"
-#include "proof/sat_proof.h"
+
+#include "base/cvc4_assert.h"
+#include "context/context.h"
#include "proof/cnf_proof.h"
+#include "proof/sat_proof.h"
#include "proof/theory_proof.h"
-#include "util/cvc4_assert.h"
#include "smt/smt_engine.h"
#include "smt/smt_engine_scope.h"
+#include "smt_util/node_visitor.h"
+#include "theory/arrays/theory_arrays.h"
#include "theory/output_channel.h"
-#include "theory/valuation.h"
-#include "util/node_visitor.h"
#include "theory/term_registration_visitor.h"
-#include "theory/uf/theory_uf.h"
#include "theory/uf/equality_engine.h"
-#include "theory/arrays/theory_arrays.h"
-#include "context/context.h"
+#include "theory/uf/theory_uf.h"
+#include "theory/valuation.h"
#include "util/hash.h"
+#include "util/proof.h"
namespace CVC4 {
diff --git a/src/proof/unsat_core.cpp b/src/proof/unsat_core.cpp
new file mode 100644
index 000000000..4a4d13977
--- /dev/null
+++ b/src/proof/unsat_core.cpp
@@ -0,0 +1,54 @@
+/********************* */
+/*! \file unsat_core.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 Representation of unsat cores
+ **
+ ** Representation of unsat cores.
+ **/
+
+#include "proof/unsat_core.h"
+
+#include "printer/printer.h"
+#include "smt/smt_engine_scope.h"
+#include "smt_util/command.h"
+
+namespace CVC4 {
+
+void UnsatCore::initMessage() const {
+ Debug("core") << "UnsatCore size " << d_core.size() << std::endl;
+}
+
+UnsatCore::const_iterator UnsatCore::begin() const {
+ return d_core.begin();
+}
+
+UnsatCore::const_iterator UnsatCore::end() const {
+ return d_core.end();
+}
+
+void UnsatCore::toStream(std::ostream& out) const {
+ smt::SmtScope smts(d_smt);
+ Expr::dag::Scope scope(out, false);
+ Printer::getPrinter(options::outputLanguage())->toStream(out, *this);
+}
+
+void UnsatCore::toStream(std::ostream& out, const std::map<Expr, std::string>& names) const {
+ smt::SmtScope smts(d_smt);
+ Expr::dag::Scope scope(out, false);
+ Printer::getPrinter(options::outputLanguage())->toStream(out, *this, names);
+}
+
+std::ostream& operator<<(std::ostream& out, const UnsatCore& core) {
+ core.toStream(out);
+ return out;
+}
+
+}/* CVC4 namespace */
diff --git a/src/proof/unsat_core.h b/src/proof/unsat_core.h
new file mode 100644
index 000000000..644f56509
--- /dev/null
+++ b/src/proof/unsat_core.h
@@ -0,0 +1,72 @@
+/********************* */
+/*! \file unsat_core.h
+ ** \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 [[ Add one-line brief description here ]]
+ **
+ ** [[ Add lengthier description here ]]
+ ** \todo document this file
+ **/
+
+#include "cvc4_public.h"
+
+#ifndef __CVC4__UNSAT_CORE_H
+#define __CVC4__UNSAT_CORE_H
+
+#include <iostream>
+#include <vector>
+#include "expr/expr.h"
+
+namespace CVC4 {
+
+class SmtEngine;
+class UnsatCore;
+
+std::ostream& operator<<(std::ostream& out, const UnsatCore& core) CVC4_PUBLIC;
+
+class CVC4_PUBLIC UnsatCore {
+ friend std::ostream& operator<<(std::ostream&, const UnsatCore&);
+
+ /** The SmtEngine we're associated with */
+ SmtEngine* d_smt;
+
+ std::vector<Expr> d_core;
+
+ void initMessage() const;
+
+public:
+ UnsatCore() : d_smt(NULL) {}
+
+ template <class T>
+ UnsatCore(SmtEngine* smt, T begin, T end) : d_smt(smt), d_core(begin, end) {
+ initMessage();
+ }
+
+ ~UnsatCore() {}
+
+ /** get the smt engine that this unsat core is hooked up to */
+ SmtEngine* getSmtEngine() { return d_smt; }
+
+ size_t size() const { return d_core.size(); }
+
+ typedef std::vector<Expr>::const_iterator iterator;
+ typedef std::vector<Expr>::const_iterator const_iterator;
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ void toStream(std::ostream& out) const;
+ void toStream(std::ostream& out, const std::map<Expr, std::string>& names) const;
+
+};/* class UnsatCore */
+
+}/* CVC4 namespace */
+
+#endif /* __CVC4__UNSAT_CORE_H */
diff --git a/src/proof/unsat_core.i b/src/proof/unsat_core.i
new file mode 100644
index 000000000..cee78da06
--- /dev/null
+++ b/src/proof/unsat_core.i
@@ -0,0 +1,69 @@
+%{
+#include "proof/unsat_core.h"
+
+#ifdef SWIGJAVA
+
+#include "bindings/java_iterator_adapter.h"
+#include "bindings/java_stream_adapters.h"
+
+#endif /* SWIGJAVA */
+%}
+
+%ignore CVC4::operator<<(std::ostream&, const UnsatCore&);
+
+#ifdef SWIGJAVA
+
+// Instead of UnsatCore::begin() and end(), create an
+// iterator() method on the Java side that returns a Java-style
+// Iterator.
+%ignore CVC4::UnsatCore::begin();
+%ignore CVC4::UnsatCore::end();
+%ignore CVC4::UnsatCore::begin() const;
+%ignore CVC4::UnsatCore::end() const;
+%extend CVC4::UnsatCore {
+ CVC4::JavaIteratorAdapter<CVC4::UnsatCore> iterator() {
+ return CVC4::JavaIteratorAdapter<CVC4::UnsatCore>(*$self);
+ }
+}
+
+// UnsatCore is "iterable" on the Java side
+%typemap(javainterfaces) CVC4::UnsatCore "java.lang.Iterable<edu.nyu.acsys.CVC4.Expr>";
+
+// the JavaIteratorAdapter should not be public, and implements Iterator
+%typemap(javaclassmodifiers) CVC4::JavaIteratorAdapter<CVC4::UnsatCore> "class";
+%typemap(javainterfaces) CVC4::JavaIteratorAdapter<CVC4::UnsatCore> "java.util.Iterator<edu.nyu.acsys.CVC4.Expr>";
+// add some functions to the Java side (do it here because there's no way to do these in C++)
+%typemap(javacode) CVC4::JavaIteratorAdapter<CVC4::UnsatCore> "
+ public void remove() {
+ throw new java.lang.UnsupportedOperationException();
+ }
+
+ public edu.nyu.acsys.CVC4.Expr next() {
+ if(hasNext()) {
+ return getNext();
+ } else {
+ throw new java.util.NoSuchElementException();
+ }
+ }
+"
+// getNext() just allows C++ iterator access from Java-side next(), make it private
+%javamethodmodifiers CVC4::JavaIteratorAdapter<CVC4::UnsatCore>::getNext() "private";
+
+// map the types appropriately
+%typemap(jni) CVC4::UnsatCore::const_iterator::value_type "jobject";
+%typemap(jtype) CVC4::UnsatCore::const_iterator::value_type "edu.nyu.acsys.CVC4.Expr";
+%typemap(jstype) CVC4::UnsatCore::const_iterator::value_type "edu.nyu.acsys.CVC4.Expr";
+%typemap(javaout) CVC4::UnsatCore::const_iterator::value_type { return $jnicall; }
+
+#endif /* SWIGJAVA */
+
+%include "proof/unsat_core.h"
+
+#ifdef SWIGJAVA
+
+%include "bindings/java_iterator_adapter.h"
+%include "bindings/java_stream_adapters.h"
+
+%template(JavaIteratorAdapter_UnsatCore) CVC4::JavaIteratorAdapter<CVC4::UnsatCore>;
+
+#endif /* SWIGJAVA */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback