mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 18:31:49 +00:00
fix #1547 by rewriting legacy recognizers to SMT-LIB2.6 style recognizers which are assumed by theory_datatype
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
b12a1caa07
commit
ebc6ec2eb5
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -255,12 +255,12 @@ public:
|
|||
catch (const char *msg) {
|
||||
throw interpolation_failure(msg);
|
||||
}
|
||||
catch (const iz3translation::unsupported &) {
|
||||
TRACE("iz3", tout << "unsupported\n";);
|
||||
catch (const iz3translation::unsupported & ex) {
|
||||
TRACE("iz3", tout << "unsupported " << "\n";);
|
||||
throw interpolation_error();
|
||||
}
|
||||
catch (const iz3proof::proof_error &) {
|
||||
TRACE("iz3", tout << "proof error\n";);
|
||||
catch (const iz3proof::proof_error & ex) {
|
||||
TRACE("iz3", tout << "proof error " << "\n";);
|
||||
throw interpolation_error();
|
||||
}
|
||||
profiling::timer_stop("Proof translation");
|
||||
|
@ -306,8 +306,8 @@ public:
|
|||
catch (const char *msg) {
|
||||
throw interpolation_failure(msg);
|
||||
}
|
||||
catch (const iz3translation::unsupported &) {
|
||||
TRACE("iz3", tout << "unsupported\n";);
|
||||
catch (const iz3translation::unsupported & ex) {
|
||||
TRACE("iz3", tout << "unsupported " << "\n";);
|
||||
throw interpolation_error();
|
||||
}
|
||||
catch (const iz3proof::proof_error &) {
|
||||
|
|
|
@ -2029,8 +2029,8 @@ public:
|
|||
case PR_IFF_FALSE: { // turns ~p into p <-> false, noop for us
|
||||
if(is_local(con))
|
||||
res = args[0];
|
||||
else
|
||||
throw_unsupported(con);
|
||||
else
|
||||
throw_unsupported(proof);
|
||||
break;
|
||||
}
|
||||
case PR_COMMUTATIVITY: {
|
||||
|
|
Loading…
Reference in a new issue