using namespace CVC4::prop;
namespace CVC4 {
+
CnfProof::CnfProof(CnfStream* stream) :
d_cnfStream(stream) {}
-
} /* CVC4 namespace */
**/
#include "cvc4_private.h"
-
+#include "util/proof.h"
#ifndef __CVC4__CNF_PROOF_H
#define __CVC4__CNF_PROOF_H
d_temp_clauseId(),
d_temp_idClause(),
d_unitConflictId(),
- d_storedUnitConflict(false)
+ d_storedUnitConflict(false),
+ d_atomToVar()
{
d_proxy = new ProofProxy(this);
}
}
}
+/// store mapping from theory atoms to new variables
+void SatProof::storeAtom(::Minisat::Lit literal, Expr atom) {
+ (d_atomToVar.find(atom) == d_atomToVar.end());
+ d_atomToVar[atom] = literal;
+}
+
+
+
/// LFSCSatProof class
std::string LFSCSatProof::varName(::Minisat::Lit lit) {
void LFSCSatProof::flush(std::ostream& out) {
+ out << d_atomsSS.str();
out << "(check \n";
d_paren <<")";
out << d_varSS.str();
void LFSCSatProof::toStream(std::ostream& out) {
Debug("proof:sat") << " LFSCSatProof::printProof \n";
-
+
// first collect lemmas to print in reverse order
collectLemmas(d_emptyClauseId);
for(IdSet::iterator it = d_seenLemmas.begin(); it!= d_seenLemmas.end(); ++it) {
printResolution(*it);
}
}
+ printAtoms();
// last resolution to be printed is the empty clause
printResolution(d_emptyClauseId);
-
+
printClauses();
printVariables();
flush(out);
}
+void LFSCSatProof::printAtoms() {
+ d_atomsSS << "; Mapping between boolean variables and theory atoms \n";
+ for (AtomToVar::iterator it = d_atomToVar.begin(); it != d_atomToVar.end(); ++it) {
+ d_atomsSS << "; " << it->first << " => v" << var(it->second) << "\n";
+ }
+}
+
+
} /* CVC4 namespace */
#include <ext/hash_map>
#include <ext/hash_set>
#include <sstream>
+#include "expr/expr.h"
+
namespace Minisat {
class Solver;
typedef std::hash_set < int > VarSet;
typedef std::set < ClauseId > IdSet;
typedef std::vector < ::Minisat::Lit > LitVector;
+typedef __gnu_cxx::hash_map<Expr, ::Minisat::Lit, ExprHashFunction > AtomToVar;
+
class SatProof;
class ProofProxy : public ProofProxyAbstract {
// unit conflict
ClauseId d_unitConflictId;
- bool d_storedUnitConflict;
+ bool d_storedUnitConflict;
+
+ // atom mapping
+ AtomToVar d_atomToVar;
public:
SatProof(::Minisat::Solver* solver, bool checkRes = false);
protected:
*/
void storeUnitResolution(::Minisat::Lit lit);
- ProofProxy* getProxy() {return d_proxy; }
+ ProofProxy* getProxy() {return d_proxy; }
+ /**
+ * At mapping between literal and theory-atom it represents
+ *
+ * @param literal
+ * @param atom
+ */
+ void storeAtom(::Minisat::Lit literal, Expr atom);
};/* class SatProof */
class LFSCSatProof: public SatProof {
private:
- VarSet d_seenVars;
+ VarSet d_seenVars;
+ std::ostringstream d_atomsSS;
std::ostringstream d_varSS;
std::ostringstream d_lemmaSS;
std::ostringstream d_clauseSS;
void printVariables();
void printClauses();
void flush(std::ostream& out);
-
+ void printAtoms();
public:
LFSCSatProof(::Minisat::Solver* solver, bool checkRes = false):
SatProof(solver, checkRes),
d_seenVars(),
+ d_atomsSS(),
d_varSS(),
d_lemmaSS(),
d_paren(),
#include "expr/expr.h"
#include "prop/theory_proxy.h"
#include "theory/bv/options.h"
-
+#include "proof/proof_manager.h"
+#include "proof/sat_proof.h"
+#include "prop/minisat/minisat.h"
#include <queue>
using namespace std;
// Make a new literal (variables are not considered theory literals)
SatLiteral lit = newLiteral(node, theoryLiteral, preRegister, canEliminate);
-
+ PROOF (ProofManager::getSatProof()->storeAtom(MinisatSatSolver::toMinisatLit(lit), node.toExpr()); );
// Return the resulting literal
return lit;
}