diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-05-19 21:48:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-19 21:48:01 -0500 |
commit | af874a5c7a2ff134da0d4c20d06a0626d3e36d9b (patch) | |
tree | 16ad9de2b0c5753d2cd4cd3fcdd43bf8fbd55a71 /src/theory/theory_model.h | |
parent | 9712a20e6585728c7d0453e64e1e3b06a7d37b7f (diff) |
Do not eliminate variables that are equal to unevaluatable terms (#4267)
When we eliminate a variable x -> v during simplification, it may be the case that v contains "unevaluated" operators like forall, choice, etc. Thus, we do not produce correct models for such inputs unless simplification is disabled.
This PR ensures we only eliminate variables when v contains only evaluated operators.
Additionally, the kinds registered as unevaluated were slightly modified so that when we are in a logic like QF_LIA, there are no registered unevaluated operators, hence the check above is unnecessary. This is to minimize the performance impact of this change.
Fixes #4500.
Diffstat (limited to 'src/theory/theory_model.h')
-rw-r--r-- | src/theory/theory_model.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/theory/theory_model.h b/src/theory/theory_model.h index d984fbc6b..1deec82d9 100644 --- a/src/theory/theory_model.h +++ b/src/theory/theory_model.h @@ -266,6 +266,13 @@ public: */ void setUnevaluatedKind(Kind k); void setSemiEvaluatedKind(Kind k); + /** is legal elimination + * + * Returns true if x -> val is a legal elimination of variable x. + * In particular, this ensures that val does not have any subterms that + * are of unevaluated kinds. + */ + bool isLegalElimination(TNode x, TNode val); //---------------------------- end building the model // ------------------- general equality queries @@ -356,8 +363,8 @@ public: std::map<Node, Node> d_approximations; /** list of all approximations */ std::vector<std::pair<Node, Node> > d_approx_list; - /** a set of kinds that are not evaluated */ - std::unordered_set<Kind, kind::KindHashFunction> d_not_evaluated_kinds; + /** a set of kinds that are unevaluated */ + std::unordered_set<Kind, kind::KindHashFunction> d_unevaluated_kinds; /** a set of kinds that are semi-evaluated */ std::unordered_set<Kind, kind::KindHashFunction> d_semi_evaluated_kinds; /** |