3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00
This commit is contained in:
Christoph M. Wintersteiger 2018-04-05 20:29:01 +01:00
commit 932ba15261
33 changed files with 594 additions and 312 deletions

View file

@ -821,6 +821,10 @@ namespace datatype {
return d;
}
app* util::mk_is(func_decl * c, expr *f) {
return m.mk_app(get_constructor_is(c), 1, &f);
}
func_decl * util::get_recognizer_constructor(func_decl * recognizer) const {
SASSERT(is_recognizer(recognizer));
return to_func_decl(recognizer->get_parameter(0).get_ast());

View file

@ -362,6 +362,7 @@ namespace datatype {
bool is_recognizer(app * f) const { return is_recognizer0(f) || is_is(f); }
bool is_accessor(app * f) const { return is_app_of(f, m_family_id, OP_DT_ACCESSOR); }
bool is_update_field(app * f) const { return is_app_of(f, m_family_id, OP_DT_UPDATE_FIELD); }
app* mk_is(func_decl * c, expr *f);
ptr_vector<func_decl> const * get_datatype_constructors(sort * ty);
unsigned get_datatype_num_constructors(sort * ty);
unsigned get_datatype_num_parameter_sorts(sort * ty);

View file

@ -23,6 +23,9 @@ br_status datatype_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr
switch(f->get_decl_kind()) {
case OP_DT_CONSTRUCTOR: return BR_FAILED;
case OP_DT_RECOGNISER:
SASSERT(num_args == 1);
result = m_util.mk_is(m_util.get_recognizer_constructor(f), args[0]);
return BR_REWRITE1;
case OP_DT_IS:
//
// simplify is_cons(cons(x,y)) -> true