namespace theory {
namespace quantifiers {
+SynthConjectureProcessFun::SynthConjectureProcessFun(Env& env) : EnvObj(env) {}
+
void SynthConjectureProcessFun::init(Node f)
{
d_synth_fun = f;
}
}
-SynthConjectureProcess::SynthConjectureProcess() {}
+SynthConjectureProcess::SynthConjectureProcess(Env& env) : EnvObj(env) {}
SynthConjectureProcess::~SynthConjectureProcess() {}
Node SynthConjectureProcess::preSimplify(Node q)
{
Node f = q[0][i];
if (f.getType().isFunction())
{
- d_sf_info[f].init(f);
+ std::pair<std::map<Node, SynthConjectureProcessFun>::iterator, bool>
+ it = d_sf_info.emplace(f, d_env);
+ it.first->second.init(f);
}
}
#include "expr/node.h"
#include "expr/type_node.h"
+#include "smt/env_obj.h"
namespace cvc5 {
namespace theory {
* It maintains information about each of the function to
* synthesize's arguments.
*/
-struct SynthConjectureProcessFun
+struct SynthConjectureProcessFun : protected EnvObj
{
public:
- SynthConjectureProcessFun() {}
+ SynthConjectureProcessFun(Env& env);
~SynthConjectureProcessFun() {}
/** initialize this class for function f */
void init(Node f);
* sygus to SynthConjectureProcess::getSymmetryBreakingPredicate(...), which are
* used for pruning search space based on conjecture-specific analysis.
*/
-class SynthConjectureProcess
+class SynthConjectureProcess : protected EnvObj
{
public:
- SynthConjectureProcess();
+ SynthConjectureProcess(Env& env);
~SynthConjectureProcess();
/** simplify the synthesis conjecture q
* Returns a formula that is equivalent to q.
d_hasSolution(false),
d_ceg_si(new CegSingleInv(env, tr, s)),
d_templInfer(new SygusTemplateInfer(env)),
- d_ceg_proc(new SynthConjectureProcess),
+ d_ceg_proc(new SynthConjectureProcess(env)),
d_ceg_gc(new CegGrammarConstructor(env, d_tds, this)),
d_sygus_rconst(new SygusRepairConst(env, d_tds)),
d_exampleInfer(new ExampleInfer(d_tds)),
}
std::stringstream ss;
ss << "_arg_";
- Node val = ufmt.getFunctionValue(ss.str().c_str(), condenseFuncValues);
+ Rewriter* r = condenseFuncValues ? d_env.getRewriter() : nullptr;
+ Node val = ufmt.getFunctionValue(ss.str(), r);
m->assignFunctionDefinition(f, val);
// ufmt.debugPrint( std::cout, m );
}
return std::string("uf_card");
}
-SortModel::SortModel(TypeNode tn,
+SortModel::SortModel(Env& env,
+ TypeNode tn,
TheoryState& state,
TheoryInferenceManager& im,
CardinalityExtension* thss)
- : d_type(tn),
+ : EnvObj(env),
+ d_type(tn),
d_state(state),
d_im(im),
d_thss(thss),
if (!s.isNull() ){
//add lemma to output channel
Assert(s.getKind() == EQUAL);
- Node ss = Rewriter::rewrite( s );
+ Node ss = rewrite(s);
if( ss.getKind()!=EQUAL ){
Node b_t = NodeManager::currentNM()->mkConst( true );
Node b_f = NodeManager::currentNM()->mkConst( false );
if (tn.isSort())
{
Trace("uf-ss-register") << "Create sort model " << tn << "." << std::endl;
- rm = new SortModel(tn, d_state, d_im, this);
+ rm = new SortModel(d_env, tn, d_state, d_im, this);
}
if (rm)
{
* Information for incremental conflict/clique finding for a
* particular sort.
*/
- class SortModel
+ class SortModel : protected EnvObj
{
private:
std::map< Node, std::vector< int > > d_totality_lems;
void simpleCheckCardinality();
public:
- SortModel(TypeNode tn,
+ SortModel(Env& env,
+ TypeNode tn,
TheoryState& state,
TheoryInferenceManager& im,
CardinalityExtension* thss);
namespace eq {
ProofEqEngine::ProofEqEngine(Env& env, EqualityEngine& ee)
- : EagerProofGenerator(env.getProofNodeManager(),
+ : EnvObj(env),
+ EagerProofGenerator(env.getProofNodeManager(),
env.getUserContext(),
"pfee::" + ee.identify()),
d_ee(ee),
// lit may not be equivalent to false, but should rewrite to false
if (lit != d_false)
{
- Assert(Rewriter::rewrite(lit) == d_false)
+ Assert(rewrite(lit) == d_false)
<< "pfee::assertConflict: conflict literal is not rewritable to "
"false";
std::vector<Node> exp;
#include "proof/buffered_proof_generator.h"
#include "proof/eager_proof_generator.h"
#include "proof/lazy_proof.h"
+#include "smt/env_obj.h"
namespace cvc5 {
* - explain, for explaining why a literal is true in the current state.
* Details on these methods can be found below.
*/
-class ProofEqEngine : public EagerProofGenerator
+class ProofEqEngine : protected EnvObj, public EagerProofGenerator
{
typedef context::CDHashSet<Node> NodeSet;
typedef context::CDHashMap<Node, std::shared_ptr<ProofNode>> NodeProofMap;
}
}
-Node UfModelTreeNode::getFunctionValue(std::vector<Node>& args, int index, Node argDefaultValue, bool simplify) {
+Node UfModelTreeNode::getFunctionValue(const std::vector<Node>& args,
+ int index,
+ Node argDefaultValue,
+ bool simplify)
+{
if(!d_data.empty()) {
Node defaultValue = argDefaultValue;
if(d_data.find(Node::null()) != d_data.end()) {
}
}
-Node UfModelTree::getFunctionValue( std::vector< Node >& args, bool simplify ){
- Node body = d_tree.getFunctionValue( args, 0, Node::null(), simplify );
- if(simplify) {
- body = Rewriter::rewrite( body );
+Node UfModelTree::getFunctionValue(const std::vector<Node>& args, Rewriter* r)
+{
+ Node body = d_tree.getFunctionValue(args, 0, Node::null(), r != nullptr);
+ if (r != nullptr)
+ {
+ body = r->rewrite(body);
}
Node boundVarList = NodeManager::currentNM()->mkNode(kind::BOUND_VAR_LIST, args);
return NodeManager::currentNM()->mkNode(kind::LAMBDA, boundVarList, body);
}
-Node UfModelTree::getFunctionValue( const char* argPrefix, bool simplify ){
+Node UfModelTree::getFunctionValue(const std::string& argPrefix, Rewriter* r)
+{
TypeNode type = d_op.getType();
std::vector< Node > vars;
for( size_t i=0; i<type.getNumChildren()-1; i++ ){
ss << argPrefix << (i+1);
vars.push_back( NodeManager::currentNM()->mkBoundVar( ss.str(), type[i] ) );
}
- return getFunctionValue( vars, simplify );
+ return getFunctionValue(vars, r);
}
} // namespace uf
namespace theory {
class TheoryModel;
+class Rewriter;
namespace uf {
/** setValue function */
void setValue( TheoryModel* m, Node n, Node v, std::vector< int >& indexOrder, bool ground, int argIndex );
/** getFunctionValue */
- Node getFunctionValue( std::vector< Node >& args, int index, Node argDefaultValue, bool simplify = true );
+ Node getFunctionValue(const std::vector<Node>& args,
+ int index,
+ Node argDefaultValue,
+ bool simplify = true);
/** update function */
void update( TheoryModel* m );
/** simplify function */
d_tree.setValue( m, Node::null(), v, d_index_order, false, 0 );
}
/** getFunctionValue
- * Returns a representation of this function.
- */
- Node getFunctionValue( std::vector< Node >& args, bool simplify = true );
+ * Returns a representation of this function. The body of the function is
+ * rewritten if r is non-null.
+ */
+ Node getFunctionValue(const std::vector<Node>& args, Rewriter* r);
/** getFunctionValue for args with set prefix */
- Node getFunctionValue( const char* argPrefix, bool simplify = true );
+ Node getFunctionValue(const std::string& argPrefix, Rewriter* r);
/** update
* This will update all values in the tree to be representatives in m.
*/