mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
move to util
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
6d4bd37e15
commit
decd69ac73
3 changed files with 32 additions and 34 deletions
|
@ -17,6 +17,8 @@ Revision History:
|
|||
|
||||
--*/
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
|
||||
app * mk_list_assoc_app(ast_manager & m, func_decl * f, unsigned num_args, expr * const * args) {
|
||||
|
@ -372,3 +374,22 @@ static app_ref plus(ast_manager& m, expr* a, expr* b) {
|
|||
app_ref operator+(expr_ref& a, expr_ref& b) {
|
||||
return plus(a.m(), a.get(), b.get());
|
||||
}
|
||||
|
||||
bool has_uninterpreted(ast_manager& m, expr* _e) {
|
||||
expr_ref e(_e, m);
|
||||
arith_util au(m);
|
||||
func_decl_ref f_out(m);
|
||||
for (expr* arg : subterms(e)) {
|
||||
if (!is_app(arg))
|
||||
continue;
|
||||
app* a = to_app(arg);
|
||||
func_decl* f = a->get_decl();
|
||||
if (a->get_num_args() == 0)
|
||||
continue;
|
||||
if (m.is_considered_uninterpreted(f))
|
||||
return true;
|
||||
if (au.is_considered_uninterpreted(f, a->get_num_args(), a->get_args(), f_out))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -67,20 +67,14 @@ inline bool depth_leq_one(app * n) {
|
|||
|
||||
template<typename AST>
|
||||
void dec_ref(ast_manager & m, obj_hashtable<AST> & s) {
|
||||
typename obj_hashtable<AST>::iterator it = s.begin();
|
||||
typename obj_hashtable<AST>::iterator end = s.end();
|
||||
for (;it != end; ++it) {
|
||||
m.dec_ref(*it);
|
||||
}
|
||||
for (auto a : s)
|
||||
m.dec_ref(a);
|
||||
}
|
||||
|
||||
template<typename AST>
|
||||
void inc_ref(ast_manager & m, obj_hashtable<AST> & s) {
|
||||
typename obj_hashtable<AST>::iterator it = s.begin();
|
||||
typename obj_hashtable<AST>::iterator end = s.end();
|
||||
for (;it != end; ++it) {
|
||||
m.inc_ref(*it);
|
||||
}
|
||||
for (auto a : s)
|
||||
m.inc_ref(a);
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
|
@ -174,5 +168,6 @@ void flatten_or(expr_ref_vector& result);
|
|||
|
||||
void flatten_or(expr* fml, expr_ref_vector& result);
|
||||
|
||||
bool has_uninterpreted(ast_manager& m, expr* e);
|
||||
|
||||
#endif /* AST_UTIL_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue