mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
fix #6792, add scaffolding for type variables
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
f5c069f899
commit
5806869ae4
8 changed files with 96 additions and 14 deletions
|
@ -1378,6 +1378,7 @@ void ast_manager::init() {
|
|||
ENSURE(model_value_family_id == mk_family_id("model-value"));
|
||||
ENSURE(user_sort_family_id == mk_family_id("user-sort"));
|
||||
ENSURE(arith_family_id == mk_family_id("arith"));
|
||||
ENSURE(poly_family_id == mk_family_id("polymorphic"));
|
||||
basic_decl_plugin * plugin = alloc(basic_decl_plugin);
|
||||
register_plugin(basic_family_id, plugin);
|
||||
m_bool_sort = plugin->mk_bool_sort();
|
||||
|
@ -2019,6 +2020,11 @@ sort * ast_manager::mk_uninterpreted_sort(symbol const & name, unsigned num_para
|
|||
return plugin->mk_sort(kind, num_parameters, parameters);
|
||||
}
|
||||
|
||||
sort * ast_manager::mk_type_var(symbol const& name) {
|
||||
sort_info si(poly_family_id, 0);
|
||||
return mk_sort(name, &si);
|
||||
}
|
||||
|
||||
func_decl * ast_manager::mk_func_decl(symbol const & name, unsigned arity, sort * const * domain, sort * range,
|
||||
bool assoc, bool comm, bool inj) {
|
||||
func_decl_info info(null_family_id, null_decl_kind);
|
||||
|
|
|
@ -85,6 +85,7 @@ const family_id user_sort_family_id = 4;
|
|||
const family_id last_builtin_family_id = 4;
|
||||
|
||||
const family_id arith_family_id = 5;
|
||||
const family_id poly_family_id = 6;
|
||||
|
||||
// -----------------------------------
|
||||
//
|
||||
|
@ -622,6 +623,7 @@ public:
|
|||
sort_size const & get_num_elements() const { return get_info()->get_num_elements(); }
|
||||
void set_num_elements(sort_size const& s) { get_info()->set_num_elements(s); }
|
||||
unsigned get_size() const { return get_obj_size(); }
|
||||
bool is_type_var() const { return get_family_id() == poly_family_id; }
|
||||
};
|
||||
|
||||
// -----------------------------------
|
||||
|
@ -1709,6 +1711,8 @@ public:
|
|||
|
||||
sort * mk_uninterpreted_sort(symbol const & name) { return mk_uninterpreted_sort(name, 0, nullptr); }
|
||||
|
||||
sort * mk_type_var(symbol const& name);
|
||||
|
||||
sort * mk_sort(symbol const & name, sort_info const & info) {
|
||||
if (info.get_family_id() == null_family_id) {
|
||||
return mk_uninterpreted_sort(name);
|
||||
|
|
|
@ -665,12 +665,19 @@ br_status bool_rewriter::try_ite_value(app * ite, app * val, expr_ref & result)
|
|||
SASSERT(m().is_value(val));
|
||||
|
||||
if (m().are_distinct(val, e)) {
|
||||
mk_eq(t, val, result);
|
||||
if (get_depth(t) < 500)
|
||||
mk_eq(t, val, result);
|
||||
else
|
||||
result = m().mk_eq(t, val);
|
||||
|
||||
result = m().mk_and(result, cond);
|
||||
return BR_REWRITE2;
|
||||
}
|
||||
if (m().are_distinct(val, t)) {
|
||||
mk_eq(e, val, result);
|
||||
if (get_depth(e) < 500)
|
||||
mk_eq(e, val, result);
|
||||
else
|
||||
result = m().mk_eq(e, val);
|
||||
result = m().mk_and(result, m().mk_not(cond));
|
||||
return BR_REWRITE2;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue