if( d_smt.d_logic.isTheoryEnabled(THEORY_STRINGS) ) {
dumpAssertions("pre-strings-pp", d_assertions);
CVC4::theory::strings::StringsPreprocess sp;
- std::vector<Node> newNodes;
- newNodes.push_back(d_assertions[d_realAssertionsEnd - 1]);
- sp.simplify( d_assertions.ref(), newNodes );
- if(newNodes.size() > 1) {
- d_assertions[d_realAssertionsEnd - 1] = NodeManager::currentNM()->mkNode(kind::AND, newNodes);
- }
- for (unsigned i = 0; i < d_assertions.size(); ++ i) {
- d_assertions[i] = Rewriter::rewrite( d_assertions[i] );
- }
+ sp.simplify( d_assertions.ref() );
+ //for (unsigned i = 0; i < d_assertions.size(); ++ i) {
+ // d_assertions.replace( i, Rewriter::rewrite( d_assertions[i] ) );
+ //}
dumpAssertions("post-strings-pp", d_assertions);
}
if( d_smt.d_logic.isQuantified() ){
if( d_assertions[i].getKind() == kind::REWRITE_RULE ){
Node prev = d_assertions[i];
Trace("quantifiers-rewrite-debug") << "Rewrite rewrite rule " << prev << "..." << std::endl;
- d_assertions[i] = Rewriter::rewrite( quantifiers::QuantifiersRewriter::rewriteRewriteRule( d_assertions[i] ) );
+ d_assertions.replace(i, Rewriter::rewrite( quantifiers::QuantifiersRewriter::rewriteRewriteRule( d_assertions[i] ) ) );
Trace("quantifiers-rewrite") << "*** rr-rewrite " << prev << endl;
Trace("quantifiers-rewrite") << " ...got " << d_assertions[i] << endl;
}
}
}
- //if( options::quantConflictFind() ){
- // d_smt.d_theoryEngine->getQuantConflictFind()->registerAssertions( d_assertions );
- //}
-
if( options::pbRewrites() ){
d_pbsProcessor.learn(d_assertions.ref());
if(d_pbsProcessor.likelyToHelp()){
vec[i] = 0;\r
}\r
vec_sum = -1;\r
+ }else{\r
+ return;\r
}\r
}\r
}\r
#include "theory/quantifiers/first_order_reasoning.h"
#include "theory/rewriter.h"
+#include "proof/proof_manager.h"
using namespace CVC4;
using namespace std;
}while( num_processed>0 );
Trace("fo-rsn-sum") << "Simplified " << num_true << " / " << assertions.size() << " in " << num_rounds << " rounds." << std::endl;
for( unsigned i=0; i<assertions.size(); i++ ){
- assertions[i] = theory::Rewriter::rewrite( simplify( assertions[i] ) );
+ Node curr = simplify( assertions[i] );
+ if( curr!=assertions[i] ){
+ curr = Rewriter::rewrite( curr );
+ PROOF( ProofManager::currentPM()->addDependence(curr, assertions[i]); );
+ assertions[i] = curr;
+ }
}
}
#include "theory/rewriter.h"
#include "theory/quantifiers/term_database.h"
#include "theory/quantifiers/quant_util.h"
+#include "proof/proof_manager.h"
using namespace CVC4;
using namespace std;
Trace("fmf-fun-def") << "FMF fun def: rewrite " << assertions[i] << std::endl;
Trace("fmf-fun-def") << " to " << std::endl;
- assertions[i] = NodeManager::currentNM()->mkNode( FORALL, bvl, bd );
- assertions[i] = Rewriter::rewrite( assertions[i] );
+ Node new_q = NodeManager::currentNM()->mkNode( FORALL, bvl, bd );
+ new_q = Rewriter::rewrite( new_q );
+ PROOF( ProofManager::currentPM()->addDependence(new_q, assertions[i]); );
+ assertions[i] = new_q;
Trace("fmf-fun-def") << " " << assertions[i] << std::endl;
fd_assertions.push_back( i );
}
Trace("fmf-fun-def-rewrite") << "FMF fun def : rewrite " << assertions[i] << std::endl;
Trace("fmf-fun-def-rewrite") << " to " << std::endl;
Trace("fmf-fun-def-rewrite") << " " << n << std::endl;
+ PROOF( ProofManager::currentPM()->addDependence(n, assertions[i]); );
assertions[i] = n;
}
}
#include "theory/quantifiers/macros.h"
#include "theory/rewriter.h"
+#include "proof/proof_manager.h"
using namespace CVC4;
using namespace std;
if( doRewrite && !d_macro_defs.empty() ){
//now, rewrite based on macro definitions
for( size_t i=0; i<assertions.size(); i++ ){
- Node prev = assertions[i];
- assertions[i] = simplify( assertions[i] );
- if( prev!=assertions[i] ){
- assertions[i] = Rewriter::rewrite( assertions[i] );
- Trace("macros-rewrite") << "Rewrite " << prev << " to " << assertions[i] << std::endl;
+ Node curr = simplify( assertions[i] );
+ if( curr!=assertions[i] ){
+ curr = Rewriter::rewrite( curr );
+ Trace("macros-rewrite") << "Rewrite " << assertions[i] << " to " << curr << std::endl;
+ PROOF( ProofManager::currentPM()->addDependence(curr, assertions[i]); );
+ assertions[i] = curr;
retVal = true;
}
}
** \verbatim
** Original author: Tianyi Liang
** Major contributors: none
- ** Minor contributors (to current version): Morgan Deters
+ ** Minor contributors (to current version): Morgan Deters, Andrew Reynolds
** 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
#include "theory/strings/options.h"
#include "smt/logic_exception.h"
#include <stdint.h>
+#include "proof/proof_manager.h"
namespace CVC4 {
namespace theory {
retNode = t;
}
}*/
-
- Trace("strings-preprocess") << "StringsPreprocess::simplify returns: " << retNode << std::endl;
- if(!new_nodes.empty()) {
- Trace("strings-preprocess") << " ... new nodes (" << new_nodes.size() << "):\n";
- for(unsigned int i=0; i<new_nodes.size(); ++i) {
- Trace("strings-preprocess") << "\t" << new_nodes[i] << "\n";
+ if( t!=retNode ){
+ Trace("strings-preprocess") << "StringsPreprocess::simplify returns: " << retNode << std::endl;
+ if(!new_nodes.empty()) {
+ Trace("strings-preprocess") << " ... new nodes (" << new_nodes.size() << "):\n";
+ for(unsigned int i=0; i<new_nodes.size(); ++i) {
+ Trace("strings-preprocess") << "\t" << new_nodes[i] << "\n";
+ }
}
}
-
return retNode;
}
}
}
-void StringsPreprocess::simplify(std::vector< Node > &vec_node, std::vector< Node > &new_nodes) {
+void StringsPreprocess::simplify(std::vector< Node > &vec_node) {
for( unsigned i=0; i<vec_node.size(); i++ ){
- vec_node[i] = decompose( vec_node[i], new_nodes );
+ std::vector< Node > new_nodes;
+ Node curr = decompose( vec_node[i], new_nodes );
+ if( !new_nodes.empty() ){
+ new_nodes.insert( new_nodes.begin(), curr );
+ curr = NodeManager::currentNM()->mkNode( kind::AND, new_nodes );
+ }
+ if( curr!=vec_node[i] ){
+ curr = Rewriter::rewrite( curr );
+ PROOF( ProofManager::currentPM()->addDependence(curr, vec_node[i]); );
+ vec_node[i] = curr;
+ }
}
}
-
+/*
void StringsPreprocess::simplify(std::vector< Node > &vec_node) {
std::vector< Node > new_nodes;
simplify(vec_node, new_nodes);
vec_node.insert( vec_node.end(), new_nodes.begin(), new_nodes.end() );
}
+*/
}/* CVC4::theory::strings namespace */
}/* CVC4::theory namespace */
** \verbatim
** Original author: Tianyi Liang
** Major contributors: Morgan Deters
- ** Minor contributors (to current version): none
+ ** Minor contributors (to current version): Andrew Reynolds
** 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
Node simplify( Node t, std::vector< Node > &new_nodes );
Node decompose( Node t, std::vector< Node > &new_nodes );
public:
- void simplify(std::vector< Node > &vec_node, std::vector< Node > &new_nodes);
void simplify(std::vector< Node > &vec_node);
StringsPreprocess();
};
#include "smt/options.h"
#include "theory/rewriter.h"
#include "theory/quantifiers/options.h"
+#include "proof/proof_manager.h"
using namespace CVC4;
using namespace std;
Node prev = assertions[i];
std::map< Node, Node > var_bound;
Trace("sort-inference-debug") << "Rewrite " << assertions[i] << std::endl;
- assertions[i] = simplify( assertions[i], var_bound );
+ Node curr = simplify( assertions[i], var_bound );
Trace("sort-inference-debug") << "Done." << std::endl;
- if( prev!=assertions[i] ){
- assertions[i] = theory::Rewriter::rewrite( assertions[i] );
+ if( curr!=assertions[i] ){
+ curr = theory::Rewriter::rewrite( curr );
rewritten = true;
- Trace("sort-inference-rewrite") << prev << std::endl;
- Trace("sort-inference-rewrite") << " --> " << assertions[i] << std::endl;
+ Trace("sort-inference-rewrite") << assertions << std::endl;
+ Trace("sort-inference-rewrite") << " --> " << curr << std::endl;
+ PROOF( ProofManager::currentPM()->addDependence(curr, assertions[i]); );
+ assertions[i] = curr;
}
}
//now, ensure constants are distinct