This makes it so that we attempt evaluation + rewriting on applications of operators that do not always evaluate, and return constants in case the evaluation was successful.
This fixes warnings for check-models on 43 of our regressions, and also uncovered one regression where our model was wrong but check-models silently succeeded. I've opened CVC4/cvc4-projects#276 for fixing the latter.
Node ret = n;
NodeManager* nm = NodeManager::currentNM();
- // if it is an evaluated kind, compute model values for children and evaluate
- if (n.getNumChildren() > 0
- && d_unevaluated_kinds.find(nk) == d_unevaluated_kinds.end()
- && d_semi_evaluated_kinds.find(nk) == d_semi_evaluated_kinds.end())
+ // If it has children, evaluate them. We do this even if n is an unevaluatable
+ // or semi-unevaluatable operator. Notice this includes quantified
+ // formulas. It may not be possible in general to evaluate bodies of
+ // quantified formulas, because they have free variables. Regardless, we
+ // may often be able to evaluate the body of a quantified formula to true,
+ // e.g. forall x. P(x) where P = lambda x. true.
+ if (n.getNumChildren() > 0)
{
Debug("model-getvalue-debug")
<< "Get model value children " << n << std::endl;
children.push_back(n.getOperator());
}
// evaluate the children
- for (unsigned i = 0, nchild = n.getNumChildren(); i < nchild; ++i)
+ for (size_t i = 0, nchild = n.getNumChildren(); i < nchild; ++i)
{
- ret = getModelValue(n[i]);
+ if (n.isClosure() && i==0)
+ {
+ // do not evaluate bound variable lists
+ ret = n[0];
+ }
+ else
+ {
+ ret = getModelValue(n[i]);
+ }
Debug("model-getvalue-debug")
<< " " << n << "[" << i << "] is " << ret << std::endl;
children.push_back(ret);
ret = nm->mkConst(
Rational(getCardinality(ret[0].getType()).getFiniteCardinality()));
}
- d_modelCache[n] = ret;
- return ret;
+ // if the value was constant, we return it. If it was non-constant,
+ // we only return it if we an evaluated kind. This can occur if the
+ // children of n failed to evaluate.
+ if (ret.isConst() || (
+ d_unevaluated_kinds.find(nk) == d_unevaluated_kinds.end()
+ && d_semi_evaluated_kinds.find(nk) == d_semi_evaluated_kinds.end()))
+ {
+ d_modelCache[n] = ret;
+ return ret;
+ }
}
// it might be approximate
std::map<Node, Node>::const_iterator ita = d_approximations.find(n);
regress1/fmf/issue5738-dt-interp-finite.smt2
regress1/fmf/issue916-fmf-or.smt2
regress1/fmf/jasmin-cdt-crash.smt2
- regress1/fmf/ko-bound-set.cvc
regress1/fmf/loopy_coda.smt2
regress1/fmf/lst-no-self-rev-exp.smt2
regress1/fmf/memory_model-R_cpp-dd.cvc
###
regress1/bug472.smt2
regress1/datatypes/non-simple-rec-set.smt2
+ # TODO: fix models (projects #276)
+ regress1/fmf/ko-bound-set.cvc
# results in an assertion failure (see issue #1650).
regress1/ho/hoa0102.smt2
# slow on some builds after changes to tangent planes
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic QF_NIA)
(set-info :status sat)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic QF_NIA)
(declare-fun a () Int)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
; Preamble --------------
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic ALL)
(set-option :solve-bv-as-int sum)
-; COMMAND-LINE: --decision=justification -q
+; COMMAND-LINE: --decision=justification
; EXPECT: sat
(set-logic AUFLIRA)
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
(set-option :incremental false)
(set-info :status sat)
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
; this problem produced a model where incorrectly card(a)=1 due to --mbqi=fmc
(set-logic ALL_SUPPORTED)
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(set-info :status sat)
; REQUIRES: symfpu
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic QF_FPLRA)
(set-info :status sat)
-; COMMAND-LINE: --incremental --solve-real-as-int -q
+; COMMAND-LINE: --incremental --solve-real-as-int
; EXPECT: sat
; EXPECT: sat
; EXPECT: sat
-; COMMAND-LINE: --sygus-inference -q
+; COMMAND-LINE: --sygus-inference
; EXPECT: sat
(set-logic UFLIA)
(set-info :status sat)
-; COMMAND-LINE: --macros-quant -q
+; COMMAND-LINE: --macros-quant
; EXPECT: sat
(set-logic AUFNIRA)
(set-info :status sat)
-; COMMAND-LINE: --macros-quant -q
+; COMMAND-LINE: --macros-quant
; EXPECT: sat
(set-logic UFLIA)
(declare-fun A (Int) Int)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic QF_AUFNRA)
(set-info :status sat)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic QF_AUFNRA)
(set-info :status sat)
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
(set-option :incremental false)
(set-info :status sat)
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(set-info :status sat)
-% COMMAND-LINE: -q
+% COMMAND-LINE:
% EXPECT: sat
OPTION "produce-models";
OPTION "finite-model-find";
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(set-info :status sat)
-; COMMAND-LINE: --fmf-bound --no-cegqi -q
+; COMMAND-LINE: --fmf-bound --no-cegqi
; EXPECT: sat
(set-logic ALL)
(assert (forall ((a Int)) (or (distinct (/ 0 0) a) (= (/ 0 a) 0))))
-; COMMAND-LINE: --finite-model-find --fmf-inst-engine --uf-ss-fair-monotone -q
+; COMMAND-LINE: --finite-model-find --fmf-inst-engine --uf-ss-fair-monotone
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(set-info :status sat)
-; COMMAND-LINE: --finite-model-find --fmf-inst-engine --uf-ss-fair-monotone -q
+; COMMAND-LINE: --finite-model-find --fmf-inst-engine --uf-ss-fair-monotone
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(set-info :status sat)
-; COMMAND-LINE: --finite-model-find --dt-rewrite-error-sel -q
+; COMMAND-LINE: --finite-model-find --dt-rewrite-error-sel
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(declare-datatypes ((Nat 0) (Lst 0)) (((succ (pred Nat)) (zero)) ((cons (hd Nat) (tl Lst)) (nil))))
-% COMMAND-LINE: -q
+% COMMAND-LINE:
% EXPECT: sat
OPTION "produce-models";
OPTION "fmf-bound";
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(declare-sort b__ 0)
-; COMMAND-LINE: --finite-model-find -q
+; COMMAND-LINE: --finite-model-find
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(set-info :smt-lib-version 2.6)
-; COMMAND-LINE: --sygus-unif-pi=complete --sygus-infer -q
+; COMMAND-LINE: --sygus-unif-pi=complete --sygus-infer
; EXPECT: sat
(set-logic UFLIA)
(set-info :status sat)
-; COMMAND-LINE: --cegqi-bv -q
+; COMMAND-LINE: --cegqi-bv
; EXPECT: sat
(set-logic BV)
(set-info :status sat)
-; COMMAND-LINE: --fmf-fun-rlv --sygus-inference -q
+; COMMAND-LINE: --fmf-fun-rlv --sygus-inference
; EXPECT: sat
(set-logic QF_NRA)
(declare-fun a () Real)
-; COMMAND-LINE: --cegqi-nested-qe -q
+; COMMAND-LINE: --cegqi-nested-qe
; EXPECT: sat
(set-logic LIA)
(set-option :cegqi-nested-qe true)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic NIA)
(set-option :strings-exp true)
-; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full -q
+; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full
; EXPECT: sat
(set-logic BV)
(set-info :status sat)
-; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full -q
+; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full
; EXPECT: sat
(set-logic BV)
(set-info :status sat)
-; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full -q
+; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full
; EXPECT: sat
(set-logic BV)
(set-info :status sat)
-; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full -q
+; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full
; EXPECT: sat
(set-logic BV)
(set-info :status sat)
-; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full -q
+; COMMAND-LINE: --cegqi-bv --cegqi-bv-ineq=keep --no-cegqi-full
; EXPECT: sat
(set-logic BV)
(set-info :status sat)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic ALL_SUPPORTED)
(set-info :status sat)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic ALL)
(set-info :status sat)
-% COMMAND-LINE: -q
+% COMMAND-LINE:
% EXPECT: sat
OPTION "sets-ext";
OPTION "logic" "ALL_SUPPORTED";
-; COMMAND-LINE: --strings-exp --fmf-fun-rlv -i -q\r
+; COMMAND-LINE: --strings-exp --fmf-fun-rlv -i --no-check-models\r
; EXPECT: sat\r
; EXPECT: sat\r
; EXPECT: sat\r
; EXPECT: sat\r
; EXPECT: sat\r
; EXPECT: sat\r
+\r
+; note that fmf-fun-rlv is incompatible with check-models\r
+\r
(set-info :smt-lib-version 2.6)\r
(set-option :produce-models true)\r
(set-logic ALL)\r
; EXPECT: sat
-; COMMAND-LINE: --sygus-inference -q
+; COMMAND-LINE: --sygus-inference
(set-logic ALL)
(declare-fun a () Int)
(declare-fun b () Int)
-% COMMAND-LINE: --finite-model-find -q
+% COMMAND-LINE: --finite-model-find
% EXPECT: sat
DATATYPE
myType = A | B
-; COMMAND-LINE: --check-models -q
+; COMMAND-LINE: --check-models
; EXPECT: sat
(set-logic QF_ABV)
(declare-fun c () (_ BitVec 32))
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic UFDTLIRA)
(set-option :fmf-bound true)
-; COMMAND-LINE: -q
+; COMMAND-LINE:
; EXPECT: sat
(set-logic ALL)
(set-option :conjecture-filter-model true)