3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-17 19:36:17 +00:00

dealing with incompleteness issues in duality

This commit is contained in:
Ken McMillan 2013-12-19 11:05:56 -08:00
parent a318b0f104
commit 48e10a9e2d
5 changed files with 32 additions and 7 deletions

View file

@ -1005,6 +1005,8 @@ private:
/** Object thrown on cancellation */ /** Object thrown on cancellation */
struct Canceled {}; struct Canceled {};
/** Object thrown on incompleteness */
struct Incompleteness {};
}; };
} }

View file

@ -2289,6 +2289,7 @@ namespace Duality {
} }
void RPFP::InterpolateByCases(Node *root, Node *node){ void RPFP::InterpolateByCases(Node *root, Node *node){
bool axioms_added = false;
aux_solver.push(); aux_solver.push();
AddEdgeToSolver(node->Outgoing); AddEdgeToSolver(node->Outgoing);
node->Annotation.SetEmpty(); node->Annotation.SetEmpty();
@ -2320,15 +2321,24 @@ namespace Duality {
std::vector<expr> case_lits; std::vector<expr> case_lits;
itp = StrengthenFormulaByCaseSplitting(itp, case_lits); itp = StrengthenFormulaByCaseSplitting(itp, case_lits);
SetAnnotation(node,itp); SetAnnotation(node,itp);
node->Annotation.Formula.simplify();
} }
if(node->Annotation.IsEmpty()){ if(node->Annotation.IsEmpty()){
std::cout << "bad in InterpolateByCase -- core:\n"; if(!axioms_added){
std::vector<expr> assumps; // add the axioms in the off chance they are useful
slvr.get_proof().get_assumptions(assumps); const std::vector<expr> &theory = ls->get_axioms();
for(unsigned i = 0; i < assumps.size(); i++) for(unsigned i = 0; i < theory.size(); i++)
assumps[i].show(); aux_solver.add(theory[i]);
throw "ack!"; }
else {
std::cout << "bad in InterpolateByCase -- core:\n";
std::vector<expr> assumps;
slvr.get_proof().get_assumptions(assumps);
for(unsigned i = 0; i < assumps.size(); i++)
assumps[i].show();
throw "ack!";
}
} }
Pop(1); Pop(1);
node->Annotation.UnionWith(old_annot); node->Annotation.UnionWith(old_annot);

View file

@ -1731,6 +1731,7 @@ namespace Duality {
virtual bool Build(){ virtual bool Build(){
stack.back().level = tree->slvr.get_scope_level(); stack.back().level = tree->slvr.get_scope_level();
bool was_sat = true;
while (true) while (true)
{ {
@ -1760,8 +1761,11 @@ namespace Duality {
if(RecordUpdate(node)) if(RecordUpdate(node))
update_count++; update_count++;
} }
if(update_count == 0) if(update_count == 0){
if(was_sat)
throw Incompleteness();
reporter->Message("backtracked without learning"); reporter->Message("backtracked without learning");
}
} }
tree->ComputeProofCore(); // need to compute the proof core before popping solver tree->ComputeProofCore(); // need to compute the proof core before popping solver
while(1) { while(1) {
@ -1796,8 +1800,10 @@ namespace Duality {
HandleUpdatedNodes(); HandleUpdatedNodes();
if(stack.size() == 1) if(stack.size() == 1)
return false; return false;
was_sat = false;
} }
else { else {
was_sat = true;
tree->Push(); tree->Push();
std::vector<Node *> &expansions = stack.back().expansions; std::vector<Node *> &expansions = stack.back().expansions;
for(unsigned i = 0; i < expansions.size(); i++){ for(unsigned i = 0; i < expansions.size(); i++){

View file

@ -1642,6 +1642,10 @@ public:
res = iproof->make_axiom(lits); res = iproof->make_axiom(lits);
break; break;
} }
case PR_IFF_TRUE: { // turns p into p <-> true, noop for us
res = args[0];
break;
}
default: default:
assert(0 && "translate_main: unsupported proof rule"); assert(0 && "translate_main: unsupported proof rule");
throw unsupported(); throw unsupported();

View file

@ -213,6 +213,9 @@ lbool dl_interface::query(::expr * query) {
catch (Duality::solver::cancel_exception &exn){ catch (Duality::solver::cancel_exception &exn){
throw default_exception("duality canceled"); throw default_exception("duality canceled");
} }
catch (Duality::Solver::Incompleteness &exn){
throw default_exception("incompleteness");
}
// profile! // profile!