3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-08 08:15:47 +00:00

use a base iz3_exception class for exceptions raised during interpolation

Using a base exception class, derived from z3_exception, makes it possible to
recover gracefully if something goes wrong during the computation of
interpolants.
This commit is contained in:
Alberto Griggio 2015-04-16 19:14:34 +02:00
parent af444beb2e
commit 8e772b428b
13 changed files with 109 additions and 57 deletions

View file

@ -515,7 +515,7 @@ bool iz3mgr::is_farkas_coefficient_negative(const ast &proof, int n){
symb s = sym(proof);
bool ok = s->get_parameter(n+2).is_rational(r);
if(!ok)
throw "Bad Farkas coefficient";
throw iz3_exception("Bad Farkas coefficient");
return r.is_neg();
}
@ -532,7 +532,7 @@ void iz3mgr::get_farkas_coeffs(const ast &proof, std::vector<rational>& rats){
rational r;
bool ok = s->get_parameter(i).is_rational(r);
if(!ok)
throw "Bad Farkas coefficient";
throw iz3_exception("Bad Farkas coefficient");
#if 0
{
ast con = conc(prem(proof,i-2));
@ -577,7 +577,7 @@ void iz3mgr::get_assign_bounds_coeffs(const ast &proof, std::vector<rational>& r
rational r;
bool ok = s->get_parameter(i).is_rational(r);
if(!ok)
throw "Bad Farkas coefficient";
throw iz3_exception("Bad Farkas coefficient");
{
ast con = arg(conc(proof),i-1);
ast temp = make_real(r); // for debugging
@ -593,7 +593,7 @@ void iz3mgr::get_assign_bounds_coeffs(const ast &proof, std::vector<rational>& r
if(rats[1].is_neg()){ // work around bug -- if all coeffs negative, negate them
for(unsigned i = 1; i < rats.size(); i++){
if(!rats[i].is_neg())
throw "Bad Farkas coefficients";
throw iz3_exception("Bad Farkas coefficients");
rats[i] = -rats[i];
}
}
@ -623,7 +623,7 @@ void iz3mgr::get_assign_bounds_rule_coeffs(const ast &proof, std::vector<rationa
rational r;
bool ok = s->get_parameter(i).is_rational(r);
if(!ok)
throw "Bad Farkas coefficient";
throw iz3_exception("Bad Farkas coefficient");
{
ast con = conc(prem(proof,i-2));
ast temp = make_real(r); // for debugging
@ -639,7 +639,7 @@ void iz3mgr::get_assign_bounds_rule_coeffs(const ast &proof, std::vector<rationa
if(rats[1].is_neg()){ // work around bug -- if all coeffs negative, negate them
for(unsigned i = 1; i < rats.size(); i++){
if(!rats[i].is_neg())
throw "Bad Farkas coefficients";
throw iz3_exception("Bad Farkas coefficients");
rats[i] = -rats[i];
}
}
@ -671,7 +671,7 @@ void iz3mgr::linear_comb(ast &P, const ast &c, const ast &Q, bool round_off){
qstrict = true;
break;
default:
throw "not an inequality";
throw iz3_exception("not an inequality");
}
}
else {
@ -691,7 +691,7 @@ void iz3mgr::linear_comb(ast &P, const ast &c, const ast &Q, bool round_off){
qstrict = true;
break;
default:
throw "not an inequality";
throw iz3_exception("not an inequality");
}
}
bool pstrict = op(P) == Lt;