summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2019-08-14 10:37:03 -0500
committerGitHub <noreply@github.com>2019-08-14 10:37:03 -0500
commit4924138b1431d7bbc263bc4a6c63510926da3c72 (patch)
treedf0f434bdd7d5dd048742f0646996c4afa45d399
parent5c97514836a18ddb0d00041c013445f2b93efd25 (diff)
Fix issue related to higher-order purification in term database (#3157)
-rw-r--r--src/theory/quantifiers/term_database.cpp16
-rw-r--r--src/theory/quantifiers/term_database.h18
2 files changed, 26 insertions, 8 deletions
diff --git a/src/theory/quantifiers/term_database.cpp b/src/theory/quantifiers/term_database.cpp
index 989609a76..84147bf6b 100644
--- a/src/theory/quantifiers/term_database.cpp
+++ b/src/theory/quantifiers/term_database.cpp
@@ -1039,7 +1039,21 @@ bool TermDb::reset( Theory::Effort effort ){
}
Trace("quant-ho") << "- assert purify equality : " << eq << std::endl;
ee->assertEquality(eq, true, eq);
- Assert(ee->consistent());
+ if (!ee->consistent())
+ {
+ // In some rare cases, purification functions (in the domain of
+ // d_ho_purify_to_term) may escape the term database. For example,
+ // matching algorithms may construct instantiations involving these
+ // functions. As a result, asserting these equalities internally may
+ // cause a conflict. In this case, we insist that the purification
+ // equality is sent out as a lemma here.
+ Trace("term-db-lemma")
+ << "Purify equality lemma: " << eq << std::endl;
+ d_quantEngine->addLemma(eq);
+ d_quantEngine->setConflict();
+ d_consistent_ee = false;
+ return false;
+ }
}
}
}
diff --git a/src/theory/quantifiers/term_database.h b/src/theory/quantifiers/term_database.h
index d58d33673..f92bce8bd 100644
--- a/src/theory/quantifiers/term_database.h
+++ b/src/theory/quantifiers/term_database.h
@@ -271,11 +271,15 @@ class TermDb : public QuantifiersUtil {
void setTermInactive(Node n);
/** has term current
*
- * This function is used in cases where we restrict which terms appear in the
- * database, such as for heuristics used in local theory extensions
- * and for --term-db-mode=relevant.
- * It returns whether the term n should be indexed in the current context.
- */
+ * This function is used in cases where we restrict which terms appear in the
+ * database, such as for heuristics used in local theory extensions
+ * and for --term-db-mode=relevant.
+ * It returns whether the term n should be indexed in the current context.
+ *
+ * If the argument useMode is true, then this method returns a value based on
+ * the option options::termDbMode().
+ * Otherwise, it returns the lookup in the map d_has_map.
+ */
bool hasTermCurrent(Node n, bool useMode = true);
/** is term eligble for instantiation? */
bool isTermEligibleForInstantiation(TNode n, TNode f);
@@ -387,7 +391,7 @@ class TermDb : public QuantifiersUtil {
* [1] -> (@ (@ f 0) 1)
* is an entry in the term index of g. To do this, we maintain a term
* index for a fresh variable pfun, the purification variable for
- * (@ f 0). Thus, we register the term (psk 1) in the call to this function
+ * (@ f 0). Thus, we register the term (pfun 1) in the call to this function
* for (@ (@ f 0) 1). This ensures that, when processing the equality
* (@ f 0) = g, we merge the term indices of g and pfun. Hence, the entry
* [1] -> (@ (@ f 0) 1)
@@ -395,7 +399,7 @@ class TermDb : public QuantifiersUtil {
* the equivalence class of g and pfun.
*
* Above, we set d_ho_fun_op_purify[(@ f 0)] = pfun, and
- * d_ho_purify_to_term[(@ (@ f 0) 1)] = (psk 1).
+ * d_ho_purify_to_term[(pfun 1)] = (@ (@ f 0) 1).
*/
void addTermHo(Node n,
std::set<Node>& added,
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback