mirror of
https://github.com/Z3Prover/z3
synced 2025-08-02 01:13:18 +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:
parent
af444beb2e
commit
8e772b428b
13 changed files with 109 additions and 57 deletions
|
@ -132,7 +132,7 @@ public:
|
|||
// if(range_is_empty(r))
|
||||
range r = ast_scope(quanted);
|
||||
if(range_is_empty(r))
|
||||
throw "can't skolemize";
|
||||
throw iz3_exception("can't skolemize");
|
||||
if(frame == INT_MAX || !in_range(frame,r))
|
||||
frame = range_max(r); // this is desperation -- may fail
|
||||
if(frame >= frames) frame = frames - 1;
|
||||
|
@ -1086,10 +1086,10 @@ public:
|
|||
rational xcoeff = get_first_coefficient(arg(x,0),xvar);
|
||||
rational ycoeff = get_first_coefficient(arg(y,0),yvar);
|
||||
if(xcoeff == rational(0) || ycoeff == rational(0) || xvar != yvar)
|
||||
throw "bad assign-bounds lemma";
|
||||
throw iz3_exception("bad assign-bounds lemma");
|
||||
rational ratio = xcoeff/ycoeff;
|
||||
if(denominator(ratio) != rational(1))
|
||||
throw "bad assign-bounds lemma";
|
||||
throw iz3_exception("bad assign-bounds lemma");
|
||||
return make_int(ratio); // better be integer!
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ public:
|
|||
get_assign_bounds_coeffs(proof,farkas_coeffs);
|
||||
int nargs = num_args(con);
|
||||
if(nargs != (int)(farkas_coeffs.size()))
|
||||
throw "bad assign-bounds theory lemma";
|
||||
throw iz3_exception("bad assign-bounds theory lemma");
|
||||
#if 0
|
||||
if(farkas_coeffs[0] != make_int(rational(1)))
|
||||
farkas_coeffs[0] = make_int(rational(1));
|
||||
|
@ -1139,7 +1139,7 @@ public:
|
|||
get_assign_bounds_rule_coeffs(proof,farkas_coeffs);
|
||||
int nargs = num_prems(proof)+1;
|
||||
if(nargs != (int)(farkas_coeffs.size()))
|
||||
throw "bad assign-bounds theory lemma";
|
||||
throw iz3_exception("bad assign-bounds theory lemma");
|
||||
#if 0
|
||||
if(farkas_coeffs[0] != make_int(rational(1)))
|
||||
farkas_coeffs[0] = make_int(rational(1));
|
||||
|
@ -1415,7 +1415,7 @@ public:
|
|||
|
||||
std::vector<ast> vals = cvec;
|
||||
if(!is_sat(cnstrs,new_proof,vals))
|
||||
throw "Proof error!";
|
||||
throw iz3_exception("Proof error!");
|
||||
std::vector<rational> rat_farkas_coeffs;
|
||||
for(unsigned i = 0; i < cvec.size(); i++){
|
||||
ast bar = vals[i];
|
||||
|
@ -1423,7 +1423,7 @@ public:
|
|||
if(is_numeral(bar,r))
|
||||
rat_farkas_coeffs.push_back(r);
|
||||
else
|
||||
throw "Proof error!";
|
||||
throw iz3_exception("Proof error!");
|
||||
}
|
||||
rational the_lcd = lcd(rat_farkas_coeffs);
|
||||
std::vector<ast> farkas_coeffs;
|
||||
|
@ -1471,7 +1471,7 @@ public:
|
|||
ast new_proof;
|
||||
std::vector<ast> dummy;
|
||||
if(is_sat(npcons,new_proof,dummy))
|
||||
throw "Proof error!";
|
||||
throw iz3_exception("Proof error!");
|
||||
pfrule dk = pr(new_proof);
|
||||
int nnp = num_prems(new_proof);
|
||||
std::vector<Iproof::node> my_prems;
|
||||
|
@ -1532,7 +1532,7 @@ public:
|
|||
ast new_proof;
|
||||
std::vector<ast> dummy;
|
||||
if(is_sat(npcons,new_proof,dummy))
|
||||
throw "Proof error!";
|
||||
throw iz3_exception("Proof error!");
|
||||
pfrule dk = pr(new_proof);
|
||||
int nnp = num_prems(new_proof);
|
||||
std::vector<Iproof::node> my_prems;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue