**/
#include "options/bv_options.h"
+#include "options/proof_options.h"
#include "proof/array_proof.h"
#include "proof/bitvector_proof.h"
#include "proof/clause_id.h"
, d_resolutionProof(NULL)
, d_cnfProof(NULL)
, d_bitblaster(NULL)
+ , d_useConstantLetification(false)
{}
void BitVectorProof::initSatProof(CVC4::BVMinisat::Solver* solver) {
void BitVectorProof::registerTerm(Expr term) {
Debug("pf::bv") << "BitVectorProof::registerTerm( " << term << " )" << std::endl;
+ if (options::lfscLetification() && term.isConst()) {
+ if (d_constantLetMap.find(term) == d_constantLetMap.end()) {
+ std::ostringstream name;
+ name << "letBvc" << d_constantLetMap.size();
+ d_constantLetMap[term] = name.str();
+ }
+ }
+
d_usedBB.insert(term);
if (Theory::isLeafOf(term, theory::THEORY_BV) &&
void LFSCBitVectorProof::printConstant(Expr term, std::ostream& os) {
Assert (term.isConst());
- os <<"(a_bv " << utils::getSize(term)<<" ";
- std::ostringstream paren;
- int size = utils::getSize(term);
- for (int i = size - 1; i >= 0; --i) {
- os << "(bvc ";
- os << (utils::getBit(term, i) ? "b1" : "b0") <<" ";
- paren << ")";
+ os << "(a_bv " << utils::getSize(term) << " ";
+
+ if (d_useConstantLetification) {
+ os << d_constantLetMap[term] << ")";
+ } else {
+ std::ostringstream paren;
+ int size = utils::getSize(term);
+ for (int i = size - 1; i >= 0; --i) {
+ os << "(bvc ";
+ os << (utils::getBit(term, i) ? "b1" : "b0") <<" ";
+ paren << ")";
+ }
+ os << " bvn)";
+ os << paren.str();
}
- os << " bvn)";
- os << paren.str();
}
void LFSCBitVectorProof::printOperatorNary(Expr term, std::ostream& os, const ProofLetMap& map) {
}
void LFSCBitVectorProof::printDeferredDeclarations(std::ostream& os, std::ostream& paren) {
- // Nothing to do here at this point.
+ if (options::lfscLetification()) {
+ os << std::endl << ";; BV const letification\n" << std::endl;
+ std::map<Expr,std::string>::const_iterator it;
+ for (it = d_constantLetMap.begin(); it != d_constantLetMap.end(); ++it) {
+ os << "\n(@ " << it->second << " ";
+ std::ostringstream localParen;
+ int size = utils::getSize(it->first);
+ for (int i = size - 1; i >= 0; --i) {
+ os << "(bvc ";
+ os << (utils::getBit(it->first, i) ? "b1" : "b0") << " ";
+ localParen << ")";
+ }
+ os << "bvn";
+ os << localParen.str();
+ paren << ")";
+ }
+ os << std::endl;
+
+ d_useConstantLetification = true;
+ }
}
void LFSCBitVectorProof::printAliasingDeclarations(std::ostream& os, std::ostream& paren, const ProofLetMap &globalLetMap) {
os << "(bv_bbl_const "<< utils::getSize(term) <<" _ ";
std::ostringstream paren;
int size = utils::getSize(term);
- for (int i = size - 1; i>= 0; --i) {
- os << "(bvc ";
- os << (utils::getBit(term, i) ? "b1" : "b0") <<" ";
- paren << ")";
+ if (d_useConstantLetification) {
+ os << d_constantLetMap[term] << ")";
+ } else {
+ for (int i = size - 1; i>= 0; --i) {
+ os << "(bvc ";
+ os << (utils::getBit(term, i) ? "b1" : "b0") <<" ";
+ paren << ")";
+ }
+ os << " bvn)";
+ os << paren.str();
}
- os << " bvn)";
- os << paren.str();
return;
}
+
case kind::BITVECTOR_AND :
case kind::BITVECTOR_OR :
case kind::BITVECTOR_XOR :