//Checks for various issues //return false if issues present void ProofGraph::checkClause(clauseid_t nid) { ProofNode* n=graph[nid]; assert(n!=NULL); assert(n->getId()==nid); //Check if empty clause if(n->getId()==root) { if(n->clause.size()!=0) { cerr << n->getId() << " is the sink but not an empty clause" << endl; printClause(n); assert(false); } } if(n->getClauseSize()==0) { if(n->getType()==CLAORIG || n->getType()==CLALEMMA) { cerr << n->getId() << " is an empty original or lemma clause" << endl; assert(false); } } if(n->ant1==NULL && n->ant2!=NULL) { cerr << "Antecedent 1 null" << endl; assert(false); } if(n->ant1!=NULL && n->ant2==NULL) { cerr << "Antecedent 2 null" << endl; assert(false); } if(n->ant1!=NULL && n->ant2!=NULL) { assert(n->id != n->ant1->id && n->id !=n->ant2->id); vector<Lit> v; mergeClauses(n->ant1->clause,n->ant2->clause,v,n->pivot); if(v.size()!=n->clause.size()) { cerr << "Clause : "; printClause(graph[nid]); cout << " does not correctly derive from antecedents " << endl; printClause(graph[n->ant1->id]); printClause(graph[n->ant2->id]); assert(false); } for(size_t i=0;i<n->clause.size();i++) if(!litEq(n->clause[i],v[i])) { cerr << "Clause : "; printClause(graph[nid]); cout << " does not correctly derive from antecedents " << endl; printClause(graph[n->ant1->id]); printClause(graph[n->ant2->id]); assert(false); } assert(graph[n->ant1->id]!=NULL); assert(graph[n->ant2->id]!=NULL); } }
//Checks for various issues //return false if issues present void ProofGraph::checkClause(clauseid_t nid) { ProofNode* n=graph[nid]; assert(n!=NULL); assert(n->id==nid); //Check if empty clause if(n->id==root) { if(n->clause.size()!=0) { cerr << n->id << " is the sink but not an empty clause" << endl; printClause(n); assert(false); } } if(n->clause.size()==0) { if(n->id!=root) { cerr << n->id << " is an empty clause not sink" << endl; printClause(n); assert(false); } } else { checkClauseSorting(nid); } if(n->ant1==NULL && n->ant2!=NULL) { cerr << "Antecedent 1 null" << endl; assert(false); } if(n->ant1!=NULL && n->ant2==NULL) { cerr << "Antecedent 2 null" << endl; assert(false); } if(n->ant1!=NULL && n->ant2!=NULL) { assert(n->id != n->ant1->id && n->id !=n->ant2->id); vector<Lit> v; mergeClauses(n->ant1->clause,n->ant2->clause,v,n->pivot); if(v.size()!=n->clause.size()) { cerr << "Clause : "; printClause(graph[nid]); cout << " does not correctly derive from antecedents " << endl; printClause(graph[n->ant1->id]); printClause(graph[n->ant2->id]); assert(false); } for(size_t i=0;i<n->clause.size();i++) if(!litEq(n->clause[i],v[i])) { cerr << "Clause : "; printClause(graph[nid]); cout << " does not correctly derive from antecedents " << endl; printClause(graph[n->ant1->id]); printClause(graph[n->ant2->id]); assert(false); } assert(graph[n->ant1->id]!=NULL); assert(graph[n->ant2->id]!=NULL); } set<ProofNode*>::iterator it; ProofNode* r; for(it=n->res.begin();it!=n->res.end();it++) { r=(*it); if(graph[r->id]==NULL) { cerr << "Clause " << nid << " resolvent " << r->id << " does not exist anymore " << endl; assert(false); } assert(r->ant1==n || r->ant2==n); } }