#include "theory/arrays/theory_arrays_instantiator.h"
#include "theory/arrays/theory_arrays_model.h"
#include "theory/model.h"
+#include "theory/arrays/options.h"
+
using namespace std;
const bool d_preprocess = true;
const bool d_solveWrite = true;
const bool d_solveWrite2 = false;
-const bool d_useNonLinearOpt = true;
+ // These are now options
+ //bool d_useNonLinearOpt = true;
+ //bool d_lazyRIntro1 = true;
const bool d_eagerIndexSplitting = true;
TheoryArrays::TheoryArrays(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, QuantifiersEngine* qe) :
// The may equal needs the store
d_mayEqualEqualityEngine.addTerm(store);
- // Apply RIntro1 rule to any stores equal to store if not done already
- const CTNodeList* stores = d_infoMap.getStores(store);
- CTNodeList::const_iterator it = stores->begin();
- if (it != stores->end()) {
- NodeManager* nm = NodeManager::currentNM();
- TNode s = *it;
- if (!d_infoMap.rIntro1Applied(s)) {
- d_infoMap.setRIntro1Applied(s);
- Assert(s.getKind()==kind::STORE);
- Node ni = nm->mkNode(kind::SELECT, s, s[1]);
- if (ni != node) {
- preRegisterTerm(ni);
+ if (options::arraysLazyRIntro1()) {
+ // Apply RIntro1 rule to any stores equal to store if not done already
+ const CTNodeList* stores = d_infoMap.getStores(store);
+ CTNodeList::const_iterator it = stores->begin();
+ if (it != stores->end()) {
+ NodeManager* nm = NodeManager::currentNM();
+ TNode s = *it;
+ if (!d_infoMap.rIntro1Applied(s)) {
+ d_infoMap.setRIntro1Applied(s);
+ Assert(s.getKind()==kind::STORE);
+ Node ni = nm->mkNode(kind::SELECT, s, s[1]);
+ if (ni != node) {
+ preRegisterTerm(ni);
+ }
+ d_equalityEngine.assertEquality(ni.eqNode(s[2]), true, d_true);
+ Assert(++it == stores->end());
}
- d_equalityEngine.assertEquality(ni.eqNode(s[2]), true, d_true);
- Assert(++it == stores->end());
}
}
d_equalityEngine.addTriggerTerm(node, THEORY_ARRAY);
TNode a = d_equalityEngine.getRepresentative(node[0]);
- // TNode i = node[1];
- // TNode v = node[2];
d_mayEqualEqualityEngine.assertEquality(node.eqNode(a), true, d_true);
- // NodeManager* nm = NodeManager::currentNM();
- // Node ni = nm->mkNode(kind::SELECT, node, i);
- // if (!d_equalityEngine.hasTerm(ni)) {
- // preRegisterTerm(ni);
- // }
+ if (!options::arraysLazyRIntro1()) {
+ TNode i = node[1];
+ TNode v = node[2];
+ NodeManager* nm = NodeManager::currentNM();
+ Node ni = nm->mkNode(kind::SELECT, node, i);
+ if (!d_equalityEngine.hasTerm(ni)) {
+ preRegisterTerm(ni);
+ }
- // // Apply RIntro1 Rule
- // d_equalityEngine.addEquality(ni, v, d_true);
+ // Apply RIntro1 Rule
+ d_equalityEngine.assertEquality(ni.eqNode(v), true, d_true);
+ }
d_infoMap.addStore(node, node);
d_infoMap.addInStore(a, node);
while (true) {
Trace("arrays-merge") << spaces(getSatContext()->getLevel()) << "Arrays::merge: " << a << "," << b << ")\n";
- checkRIntro1(a, b);
- checkRIntro1(b, a);
+ if (options::arraysLazyRIntro1()) {
+ checkRIntro1(a, b);
+ checkRIntro1(b, a);
+ }
- if (d_useNonLinearOpt) {
+ if (options::arraysOptimizeLinear()) {
bool aNL = d_infoMap.isNonLinear(a);
bool bNL = d_infoMap.isNonLinear(b);
if (aNL) {
TNode brep = d_equalityEngine.getRepresentative(b);
- if (!d_useNonLinearOpt || d_infoMap.isNonLinear(brep)) {
+ if (!options::arraysOptimizeLinear() || d_infoMap.isNonLinear(brep)) {
const CTNodeList* js = d_infoMap.getIndices(brep);
size_t it = 0;
RowLemmaType lem;
queueRowLemma(lem);
}
- if (!d_useNonLinearOpt || d_infoMap.isNonLinear(a)) {
+ if (!options::arraysOptimizeLinear() || d_infoMap.isNonLinear(a)) {
it = 0;
for(; it < instores->size(); ++it) {
TNode instore = (*instores)[it];
}
}
- if (!d_useNonLinearOpt || d_infoMap.isNonLinear(b)) {
+ if (!options::arraysOptimizeLinear() || d_infoMap.isNonLinear(b)) {
for(it = 0 ; it < i_a->size(); ++it ) {
TNode i = (*i_a)[it];
its = 0;
if (a == b && polarity) {
return;
}
- d_equalityEngine.assertEquality( a.eqNode(b), polarity, Node::null() );
Trace("model-builder-assertions") << "(assert " << (polarity ? "(= " : "(not (= ") << a << " " << b << (polarity ? "));" : ")));") << endl;
+ d_equalityEngine.assertEquality( a.eqNode(b), polarity, Node::null() );
Assert(d_equalityEngine.consistent());
}
if( a.getKind()==EQUAL ){
d_equalityEngine.assertEquality( a, polarity, Node::null() );
}else{
- d_equalityEngine.assertPredicate( a, polarity, Node::null() );
Trace("model-builder-assertions") << "(assert " << (polarity ? "" : "(not ") << a << (polarity ? ");" : "));") << endl;
+ d_equalityEngine.assertPredicate( a, polarity, Node::null() );
Assert(d_equalityEngine.consistent());
}
}
assertPredicate(*eqc_i, false);
}
else if (eqc != (*eqc_i)) {
- Trace("model-builder-assertions") << "(assert (iff " << *eqc_i << " " << eqc << "));" << endl;
+ Trace("model-builder-assertions") << "(assert (= " << *eqc_i << " " << eqc << "));" << endl;
d_equalityEngine.mergePredicates(*eqc_i, eqc, Node::null());
Assert(d_equalityEngine.consistent());
}
for (it = typeNoRepSet.begin(); it != typeNoRepSet.end(); ++it) {
TypeNode t = TypeSet::getType(it);
Trace("model-builder") << " Working on type: " << t << endl;
- // This assertion may be too strong, but hopefully not: we expect that for every type, either all of its EC's have asserted reps (or constants)
- // or none of its EC's have asserted reps.
- Assert(!fullModel || typeRepSet.getSet(t) == NULL);
set<Node>& noRepSet = TypeSet::getSet(it);
if (noRepSet.empty()) {
continue;