Trace("nl-ext-mv-debug") << "computeModelValue " << n << ", index=" << index
<< std::endl;
Node ret;
+ Kind nk = n.getKind();
if (n.isConst())
{
ret = n;
}
- else if (index == 1
- && (n.getKind() == NONLINEAR_MULT
- || isTranscendentalKind(n.getKind())))
+ else if (!isConcrete && hasTerm(n))
{
- if (hasTerm(n))
- {
- // use model value for abstraction
- ret = getRepresentative(n);
- }
- else
- {
- // abstraction does not exist, use model value
- ret = getValueInternal(n);
- }
+ // use model value for abstraction
+ ret = getRepresentative(n);
}
else if (n.getNumChildren() == 0)
{
- if (n.getKind() == PI)
+ // we are interested in the exact value of PI, which cannot be computed.
+ // hence, we return PI itself when asked for the concrete value.
+ if (nk == PI)
{
- // we are interested in the exact value of PI, which cannot be computed.
- // hence, we return PI itself when asked for the concrete value.
ret = n;
}
else
else
{
// otherwise, compute true value
- std::vector<Node> children;
- if (n.getMetaKind() == metakind::PARAMETERIZED)
- {
- children.push_back(n.getOperator());
- }
- for (unsigned i = 0; i < n.getNumChildren(); i++)
+ TheoryId ctid = theory::kindToTheoryId(nk);
+ if (ctid != THEORY_ARITH && ctid != THEORY_BOOL && ctid != THEORY_BUILTIN)
{
- Node mc = computeModelValue(n[i], isConcrete);
- children.push_back(mc);
- }
- ret = NodeManager::currentNM()->mkNode(n.getKind(), children);
- if (n.getKind() == APPLY_UF)
- {
- ret = getValueInternal(ret);
+ // we directly look up terms not belonging to arithmetic
+ ret = getValueInternal(n);
}
else
{
+ std::vector<Node> children;
+ if (n.getMetaKind() == metakind::PARAMETERIZED)
+ {
+ children.push_back(n.getOperator());
+ }
+ for (unsigned i = 0, nchild = n.getNumChildren(); i < nchild; i++)
+ {
+ Node mc = computeModelValue(n[i], isConcrete);
+ children.push_back(mc);
+ }
+ ret = NodeManager::currentNM()->mkNode(nk, children);
ret = Rewriter::rewrite(ret);
}
}