bool DatatypesInference::mustCommunicateFact(Node n, Node exp)
{
Trace("dt-lemma-debug") << "Compute for " << exp << " => " << n << std::endl;
- bool addLemma = false;
- if (options::dtInferAsLemmas() && !exp.isConst())
+ // Force lemmas if option is set
+ if (options::dtInferAsLemmas())
{
- // all units are lemmas
- addLemma = true;
- }
- else if (n.getKind() == EQUAL)
- {
- // Note that equalities due to instantiate are forced as lemmas if
- // necessary as they are created. This ensures that terms are shared with
- // external theories when necessary. We send the lemma here only if
- // the equality is not for datatype terms, which can happen for collapse
- // selector / term size or unification.
- TypeNode tn = n[0].getType();
- addLemma = !tn.isDatatype();
+ Trace("dt-lemma-debug")
+ << "Communicate " << n << " due to option" << std::endl;
+ return true;
}
+ // Note that equalities due to instantiate are forced as lemmas if
+ // necessary as they are created. This ensures that terms are shared with
+ // external theories when necessary. We send the lemma here only if the
+ // conclusion has kind LEQ (for datatypes size) or OR. Notice that
+ // all equalities are kept internal, apart from those forced as lemmas
+ // via instantiate.
else if (n.getKind() == LEQ || n.getKind() == OR)
{
- addLemma = true;
- }
- if (addLemma)
- {
- Trace("dt-lemma-debug") << "Communicate " << n << std::endl;
+ Trace("dt-lemma-debug")
+ << "Communicate " << n << " due to kind" << std::endl;
return true;
}
- Trace("dt-lemma-debug") << "Do not need to communicate " << n << std::endl;
+ Trace("dt-lemma-debug") << "Do not communicate " << n << std::endl;
return false;
}
* size( tn )
* (6) non-negative size : 0 <= size(t)
* This method returns true if the fact must be sent out as a lemma. If it
- * returns false, then we assert the fact internally. We may need to
- * communicate outwards if the conclusions involve other theories. Also
- * communicate (6) and OR conclusions.
+ * returns false, then we assert the fact internally. We return true for (6)
+ * and OR conclusions. We also return true if the option dtInferAsLemmas is
+ * set to true.
*/
static bool mustCommunicateFact(Node n, Node exp);
/**