bool is_atom(ast_manager & m, expr * n) { if (is_quantifier(n) || !m.is_bool(n)) return false; if (is_var(n)) return true; SASSERT(is_app(n)); if (to_app(n)->get_family_id() != m.get_basic_family_id()) { return true; } // the other operators of the basic family are not considered atomic: distinct, ite, and, or, iff, xor, not, implies. return (m.is_eq(n) && !m.is_bool(to_app(n)->get_arg(0))) || m.is_true(n) || m.is_false(n); }
/** \brief Return true if n is of the form (= a b) */ static bool is_iff(ast_manager & m, expr * n, expr * & a, expr * & b) { if (m.is_iff(n, a, b)) return true; if (m.is_eq(n, a, b) && m.is_bool(a)) return true; return false; }
bool is_value_sort(ast_manager& m, sort* s) { arith_util arith(m); datatype_util data(m); bv_util bv(m); ptr_vector<sort> sorts; ast_mark mark; sorts.push_back(s); while (!sorts.empty()) { s = sorts.back(); sorts.pop_back(); if (mark.is_marked(s)) { continue; } mark.mark(s, true); if (arith.is_int_real(s)) { // simple } else if (m.is_bool(s)) { // simple } else if (bv.is_bv_sort(s)) { // simple } else if (data.is_datatype(s)) { ptr_vector<func_decl> const& cs = *data.get_datatype_constructors(s); for (unsigned i = 0; i < cs.size(); ++i) { func_decl* f = cs[i]; for (unsigned j = 0; j < f->get_arity(); ++j) { sorts.push_back(f->get_domain(j)); } } } else { return false; } } return true; }