3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 09:35:32 +00:00

fail gracefully on interpolation errors

This commit is contained in:
Ken McMillan 2015-07-10 14:39:11 -07:00
parent 1cf24f7cdc
commit e6516f549d
5 changed files with 74 additions and 16 deletions

View file

@ -271,7 +271,18 @@ public:
// translate into an interpolatable proof
profiling::timer_start("Proof translation");
tr->translate(proof,pf);
try {
tr->translate(proof,pf);
}
catch (const char *msg) {
throw interpolation_failure(msg);
}
catch (const iz3translation::unsupported &) {
throw interpolation_error();
}
catch (const iz3proof::proof_error &) {
throw interpolation_error();
}
profiling::timer_stop("Proof translation");
// translate the proof into interpolants
@ -309,7 +320,18 @@ public:
// translate into an interpolatable proof
profiling::timer_start("Proof translation");
tr->translate(proof,pf);
try {
tr->translate(proof,pf);
}
catch (const char *msg) {
throw interpolation_failure(msg);
}
catch (const iz3translation::unsupported &) {
throw interpolation_error();
}
catch (const iz3proof::proof_error &) {
throw interpolation_error();
}
profiling::timer_stop("Proof translation");
// translate the proof into interpolants

View file

@ -43,6 +43,27 @@ struct iz3_bad_tree {
struct iz3_incompleteness {
};
// This is thrown if there is some bug in the
// interpolation procedure
class interpolation_failure : public default_exception {
public:
interpolation_failure(const char *msg)
: default_exception(msg)
{
}
};
// This is thrown if we cannot derive an interpolant from a proof
// because it contains unsupported theories or if the proof contains
// errors
class interpolation_error : public default_exception {
public:
interpolation_error()
: default_exception("theory not supported by interpolation or bad proof" )
{
}
};
typedef interpolation_options_struct *interpolation_options;
/* Compute an interpolant from a proof. This version uses the parents vector

View file

@ -2041,11 +2041,23 @@ public:
locality.clear();
#endif
iproof = iz3proof_itp::create(this,range_downward(i),weak_mode());
Iproof::node ipf = translate_main(proof);
ast itp = iproof->interpolate(ipf);
itps.push_back(itp);
delete iproof;
clear_translation();
try {
Iproof::node ipf = translate_main(proof);
ast itp = iproof->interpolate(ipf);
itps.push_back(itp);
delete iproof;
clear_translation();
}
catch (const iz3proof_itp::proof_error &) {
delete iproof;
clear_translation();
throw iz3proof::proof_error();
}
catch (const unsupported &exc) {
delete iproof;
clear_translation();
throw exc;
}
}
// Very simple proof -- lemma of the empty clause with computed interpolation
iz3proof::node Ipf = dst.make_lemma(std::vector<ast>(),itps); // builds result in dst