// TODO: Use model evaluation in Z3 bool Z3BaseSolverImpl::computeValue(const Query &query, ref<Expr> &result) { std::vector<const Array*> objects; std::vector<std::vector<unsigned char> > values; bool hasSolution; findSymbolicObjects(query.expr, objects); if (!computeInitialValues(query.withFalse(), objects, values, hasSolution)) return false; assert(hasSolution && "state has invalid constraint set"); Assignment a(objects, values); result = a.evaluate(query.expr); return true; }
bool Z3SolverImpl::computeValue(const Query &query, ref<Expr> &result) { std::vector<const Array *> objects; std::vector<std::vector<unsigned char> > values; bool hasSolution; // Find the object used in the expression, and compute an assignment // for them. findSymbolicObjects(query.expr, objects); if (!computeInitialValues(query.withFalse(), objects, values, hasSolution)) return false; assert(hasSolution && "state has invalid constraint set"); // Evaluate the expression with the computed assignment. Assignment a(objects, values); result = a.evaluate(query.expr); return true; }