class EqualityTypeRule {
public:
- inline static TypeNode computeType(NodeManager* nodeManager, TNode n) throw (TypeCheckingException) {
+ inline static TypeNode computeType(NodeManager* nodeManager, TNode n) throw (TypeCheckingExceptionPrivate) {
if (n[0].getType() != n[1].getType()) {
throw TypeCheckingExceptionPrivate(n, "Left and right hand side of the equation are not of the same type");
}
}
bool TypeNode::isReal() const {
- return getKind() == kind::TYPE_CONSTANT && getConst<TypeConstant>() == REAL_TYPE;
+ return getKind() == kind::TYPE_CONSTANT
+ && (getConst<TypeConstant>() == REAL_TYPE || getConst<TypeConstant>() == INTEGER_TYPE);
}
/** Is this a function type? */
* @return true if expressions are equal, false otherwise
*/
bool operator==(const TypeNode& typeNode) const {
- return d_nv == typeNode.d_nv;
+ return d_nv == typeNode.d_nv || (typeNode.isReal() && this->isReal());
}
/**
* @return true if expressions are equal, false otherwise
*/
bool operator!=(const TypeNode& typeNode) const {
- return d_nv != typeNode.d_nv;
+ return !(*this == typeNode);
}
/**
if(node.getKind() == ITE) {
Assert( node.getNumChildren() == 3 );
+ //TODO should this be a skolem?
Node skolem = nodeManager->mkVar(node.getType());
Node newAssertion =
nodeManager->mkNode(
return rewritePlus(t);
}else if(t.getKind() == kind::DIVISION){
return rewriteConstantDiv(t);
+ }else if(t.getKind() == kind::MINUS){
+ Node sub = makeSubtractionNode(t[0],t[1]);
+ return rewrite(sub);
}else{
Unreachable();
return Node::null();
Node rewriteTerm(TNode t);
Node rewriteMult(TNode t);
Node rewritePlus(TNode t);
+ Node rewriteMinus(TNode t);
Node makeSubtractionNode(TNode l, TNode r);
void subsitute(Row& row_s){
TNode x_s = row_s.basicVar();
- Assert(!has(x_s));
+ Assert(has(x_s));
Assert(x_s != d_x_i);
if(tn.getKind() == kind::BUILTIN) return;
if(tn.getMetaKind() == metakind::VARIABLE){
+
setupVariable(tn);
}
Node TheoryArith::simulatePreprocessing(TNode n){
if(n.getKind() == NOT){
Node sub = simulatePreprocessing(n[0]);
- return NodeManager::currentNM()->mkNode(NOT,sub);
+ if(sub.getKind() == NOT){
+ return sub[0];
+ }else{
+ return NodeManager::currentNM()->mkNode(NOT,sub);
+ }
}else{
Node rewritten = rewrite(n);
Kind k = rewritten.getKind();
- if(!isRelationOperator(k)){
- return rewritten;
+ bool negate = false;
+
+ if(rewritten.getKind() == NOT){
+ Node sub = simulatePreprocessing(rewritten[0]);
+ if(sub.getKind() == NOT){
+ return sub[0];
+ }else{
+ return NodeManager::currentNM()->mkNode(NOT,sub);
+ }
+ } else if(!isRelationOperator(k)){
+ Unreachable("Slack must be have been created!");
}else if(rewritten[0].getMetaKind() == metakind::VARIABLE){
return rewritten;
}else {
--- /dev/null
+(set-logic QF_LRA)
+(set-info :status unsat)
+(declare-fun x () Real)
+(declare-fun y () Real)
+(assert (not (= x (ite true x y))))
+(check-sat)
--- /dev/null
+(benchmark ite_real_int_type
+:logic QF_LRA
+:status sat
+:extrafuns ((x Real))
+:extrafuns ((y Real))
+:formula
+ (and (= 0 (ite true x 1)) (= 0 (ite (= x 0) 0 1)) (= x (ite true y 0)) (= 0 (ite true 0 0)) )
+)