3
0
Fork 0
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:
Nikolaj Bjorner 2018-03-19 13:33:58 -07:00
parent b12a1caa07
commit ebc6ec2eb5
5 changed files with 16 additions and 8 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

View file

@ -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 &) {

View file

@ -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: {