3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-31 16:33:18 +00:00
This commit is contained in:
Nikolaj Bjorner 2023-07-11 09:40:09 -07:00
parent 9ae6c88e3f
commit d6f2c23627
4 changed files with 128 additions and 27 deletions

View file

@ -400,6 +400,7 @@ struct func_decl_info : public decl_info {
bool m_idempotent:1;
bool m_skolem:1;
bool m_lambda:1;
bool m_polymorphic:1;
func_decl_info(family_id family_id = null_family_id, decl_kind k = null_decl_kind, unsigned num_parameters = 0, parameter const * parameters = nullptr);
@ -414,6 +415,7 @@ struct func_decl_info : public decl_info {
bool is_idempotent() const { return m_idempotent; }
bool is_skolem() const { return m_skolem; }
bool is_lambda() const { return m_lambda; }
bool is_polymorphic() const { return m_polymorphic; }
void set_associative(bool flag = true) { m_left_assoc = flag; m_right_assoc = flag; }
void set_left_associative(bool flag = true) { m_left_assoc = flag; }
@ -426,6 +428,7 @@ struct func_decl_info : public decl_info {
void set_idempotent(bool flag = true) { m_idempotent = flag; }
void set_skolem(bool flag = true) { m_skolem = flag; }
void set_lambda(bool flag = true) { m_lambda = flag; }
void set_polymorphic(bool flag = true) { m_polymorphic = flag; }
bool operator==(func_decl_info const & info) const;
@ -655,6 +658,7 @@ public:
bool is_skolem() const { return get_info() != nullptr && get_info()->is_skolem(); }
bool is_lambda() const { return get_info() != nullptr && get_info()->is_lambda(); }
bool is_idempotent() const { return get_info() != nullptr && get_info()->is_idempotent(); }
bool is_polymorphic() const { return get_info() != nullptr && get_info()->is_polymorphic(); }
unsigned get_arity() const { return m_arity; }
sort * get_domain(unsigned idx) const { SASSERT(idx < get_arity()); return m_domain[idx]; }
sort * const * get_domain() const { return m_domain; }
@ -1511,13 +1515,15 @@ protected:
unsigned m_fresh_id;
bool m_debug_ref_count;
u_map<unsigned> m_debug_free_indices;
std::fstream* m_trace_stream;
bool m_trace_stream_owner;
std::fstream* m_trace_stream = nullptr;
bool m_trace_stream_owner = false;
bool m_has_type_vars = false;
#ifdef Z3DEBUG
bool slow_not_contains(ast const * n);
#endif
ast_manager * m_format_manager; // hack for isolating format objects in a different manager.
symbol m_lambda_def;
symbol m_lambda_def = symbol(":lambda-def");
obj_map<func_decl, func_decl*> m_poly_roots;
void init();
@ -1734,12 +1740,27 @@ public:
bool is_uninterp(sort const * s) const { return s->get_family_id() == null_family_id || s->get_family_id() == user_sort_family_id; }
bool is_type_var(sort const* s) const { return s->get_family_id() == poly_family_id; }
bool has_type_vars() const { return m_has_type_vars; }
func_decl* poly_root(func_decl* f) const { SASSERT(f->is_polymorphic()); return m_poly_roots[f]; }
func_decl* instantiate_polymorphic(func_decl* f, unsigned arity, sort * const* domain, sort * range);
/**
\brief A sort is "fully" interpreted if it is interpreted,
and doesn't depend on other uninterpreted sorts.
*/
bool is_fully_interp(sort * s) const;
bool has_type_var(sort* s) const;
bool has_type_var(func_decl* f) const;
bool has_type_var(unsigned n, sort* const* domain, sort* range) const;
func_decl * mk_func_decl(family_id fid, decl_kind k, unsigned num_parameters, parameter const * parameters,
unsigned arity, sort * const * domain, sort * range = nullptr);