diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/prop/cnf_stream.cpp | 7 | ||||
-rw-r--r-- | src/theory/theory_engine.cpp | 48 | ||||
-rw-r--r-- | src/theory/theory_engine.h | 7 |
3 files changed, 40 insertions, 22 deletions
diff --git a/src/prop/cnf_stream.cpp b/src/prop/cnf_stream.cpp index 9136a73c3..e95322348 100644 --- a/src/prop/cnf_stream.cpp +++ b/src/prop/cnf_stream.cpp @@ -364,6 +364,13 @@ SatLiteral TseitinCnfStream::toCNF(TNode node, bool negated) { case AND: nodeLit = handleAnd(node); break; + case EQUAL: + if(node[0].getType().isBoolean() && node[1].getType().isBoolean()) { + nodeLit = handleIff(node[0].iffNode(node[1])); + } else { + nodeLit = convertAtom(node); + } + break; default: { //TODO make sure this does not contain any boolean substructure diff --git a/src/theory/theory_engine.cpp b/src/theory/theory_engine.cpp index 4fae94254..bf501ec37 100644 --- a/src/theory/theory_engine.cpp +++ b/src/theory/theory_engine.cpp @@ -132,36 +132,40 @@ void TheoryEngine::EngineOutputChannel::newFact(TNode fact) { } +Theory* TheoryEngine::theoryOf(TypeNode t) { + // FIXME: we don't yet have a Type-to-Theory map. When we do, + // look up the type of the var and return that Theory (?) + + // The following JUST hacks around this lack of a table + Kind k = t.getKind(); + if(k == kind::TYPE_CONSTANT) { + switch(TypeConstant tc = t.getConst<TypeConstant>()) { + case BOOLEAN_TYPE: + return d_theoryOfTable[kind::CONST_BOOLEAN]; + case INTEGER_TYPE: + return d_theoryOfTable[kind::CONST_INTEGER]; + case REAL_TYPE: + return d_theoryOfTable[kind::CONST_RATIONAL]; + case KIND_TYPE: + default: + Unhandled(tc); + } + } + + return d_theoryOfTable[k]; +} + + Theory* TheoryEngine::theoryOf(TNode n) { Kind k = n.getKind(); Assert(k >= 0 && k < kind::LAST_KIND); if(n.getMetaKind() == kind::metakind::VARIABLE) { - // FIXME: we don't yet have a Type-to-Theory map. When we do, - // look up the type of the var and return that Theory (?) - - //The following JUST hacks around this lack of a table - TypeNode t = n.getType(); - Kind k = t.getKind(); - if(k == kind::TYPE_CONSTANT) { - switch(TypeConstant tc = t.getConst<TypeConstant>()) { - case BOOLEAN_TYPE: - return d_theoryOfTable[kind::CONST_BOOLEAN]; - case INTEGER_TYPE: - return d_theoryOfTable[kind::CONST_INTEGER]; - case REAL_TYPE: - return d_theoryOfTable[kind::CONST_RATIONAL]; - case KIND_TYPE: - default: - Unhandled(tc); - } - } - - return d_theoryOfTable[k]; + return theoryOf(n.getType()); } else if(k == kind::EQUAL) { // equality is special: use LHS - return theoryOf(n[0]); + return theoryOf(n[0].getType()); } else { // use our Kind-to-Theory mapping return d_theoryOfTable[k]; diff --git a/src/theory/theory_engine.h b/src/theory/theory_engine.h index bb9131023..fbe9fba16 100644 --- a/src/theory/theory_engine.h +++ b/src/theory/theory_engine.h @@ -247,6 +247,13 @@ public: } /** + * Get the theory associated to a given TypeNode. + * + * @returns the theory owning the type + */ + theory::Theory* theoryOf(TypeNode t); + + /** * Get the theory associated to a given Node. * * @returns the theory, or NULL if the TNode is |