From: Tim King Date: Thu, 25 Feb 2010 21:55:17 +0000 (+0000) Subject: Updated uf to reflect APPLY structure after conversation with Chris. Also corrected... X-Git-Tag: cvc5-1.0.0~9221 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=175741488a4dd986ad69ee644617ff735b855031;p=cvc5.git Updated uf to reflect APPLY structure after conversation with Chris. Also corrected conflict generation to reflect this morning's discussion. --- diff --git a/src/theory/uf/theory_uf.cpp b/src/theory/uf/theory_uf.cpp index 47bda5bc4..2a5eb682e 100644 --- a/src/theory/uf/theory_uf.cpp +++ b/src/theory/uf/theory_uf.cpp @@ -107,7 +107,12 @@ void TheoryUF::registerTerm(TNode n){ * of its children. */ if(n.getKind() == APPLY){ - for(TNode::iterator cIter = n.begin(); cIter != n.end(); ++cIter){ + TNode::iterator cIter = n.begin(); + + //The first element of an apply is the function symbol which should not + //have an associated ECData, so it needs to be skipped. + ++cIter; + for(; cIter != n.end(); ++cIter){ TNode child = *cIter; /* Because this can be called after nodes have been merged, we need @@ -137,6 +142,9 @@ bool TheoryUF::sameCongruenceClass(TNode x, TNode y){ } bool TheoryUF::equiv(TNode x, TNode y){ + Assert(x.getKind() == kind::APPLY); + Assert(y.getKind() == kind::APPLY); + if(x.getNumChildren() != y.getNumChildren()) return false; @@ -146,6 +154,10 @@ bool TheoryUF::equiv(TNode x, TNode y){ TNode::iterator xIter = x.begin(); TNode::iterator yIter = y.begin(); + //Skip operator of the applies + ++xIter; + ++yIter; + while(xIter != x.end()){ if(!sameCongruenceClass(*xIter, *yIter)){ @@ -226,9 +238,18 @@ void TheoryUF::merge(){ } } +Node TheoryUF::constructConflict(TNode diseq){ + NodeBuilder<> nb(kind::AND); + nb << diseq; + for(unsigned i=0; iconflict(*diseqIter, true); + Node remakeNeq = (*diseqIter).notNode(); + Node conflict = constructConflict(remakeNeq); + d_out->conflict(conflict, true); } } } diff --git a/src/theory/uf/theory_uf.h b/src/theory/uf/theory_uf.h index 4bb18bd43..4fc835223 100644 --- a/src/theory/uf/theory_uf.h +++ b/src/theory/uf/theory_uf.h @@ -126,6 +126,9 @@ private: /** Performs Congruence Closure to reflect the new additions to d_pending. */ void merge(); + /** Constructs a conflict from an inconsistent disequality. */ + Node constructConflict(TNode diseq); + };