00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _cvc3__sat__proof_h_
00022 #define _cvc3__sat__proof_h_
00023
00024 #include "theorem.h"
00025 #include <list>
00026
00027 namespace SAT {
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class SatProofNode {
00038 private:
00039 CVC3::Theorem d_theorem;
00040 SatProofNode* d_left;
00041 SatProofNode* d_right;
00042 SAT::Lit d_lit;
00043 CVC3::Proof d_proof;
00044 public:
00045 SatProofNode(CVC3::Theorem theorem) :
00046 d_theorem(theorem), d_left(NULL), d_right(NULL){
00047 DebugAssert(!theorem.isNull(), "SatProofNode: constructor");
00048 }
00049
00050
00051
00052 SatProofNode(SatProofNode* left, SatProofNode* right, SAT::Lit lit) :
00053 d_left(left), d_right(right), d_lit(lit) {
00054 DebugAssert(d_left != NULL, "SatProofNode: constructor");
00055 DebugAssert(d_right != NULL, "SatProofNode: constructor");
00056 }
00057
00058 bool isLeaf() { return !d_theorem.isNull(); }
00059 CVC3::Theorem getLeaf() { DebugAssert(isLeaf(), "SatProofNode: getLeaf"); return d_theorem; }
00060 SatProofNode* getLeftParent() { DebugAssert(!isLeaf(), "SatProofNode: getLeftParent"); return d_left; }
00061 SatProofNode* getRightParent() { DebugAssert(!isLeaf(), "SatProofNode: getRightParent"); return d_right; }
00062 SAT::Lit getLit() { DebugAssert(!isLeaf(), "SatProofNode: getLit"); return d_lit; }
00063 bool hasNodeProof() {return !d_proof.isNull();};
00064 CVC3::Proof getNodeProof() {DebugAssert(!d_proof.isNull(), "SatProofNode: nodeProof get null"); return d_proof;}
00065 void setNodeProof(CVC3::Proof pf) { d_proof=pf;}
00066 };
00067
00068
00069
00070 class SatProof {
00071 private:
00072 SatProofNode* d_root;
00073 std::list<SatProofNode*> d_nodes;
00074 public:
00075 SatProof() : d_root(NULL) { };
00076
00077 ~SatProof() {
00078 for (std::list<SatProofNode*>::iterator i = d_nodes.begin(); i != d_nodes.end(); ++i) {
00079 delete(*i);
00080 }
00081 }
00082
00083
00084
00085
00086
00087 SatProofNode* registerLeaf(CVC3::Theorem theorem) {
00088 SatProofNode* node = new SatProofNode(theorem);
00089 d_nodes.push_back(node);
00090 return node;
00091 }
00092
00093
00094 SatProofNode* registerNode(SatProofNode* left, SatProofNode* right, SAT::Lit l) {
00095 SatProofNode* node = new SatProofNode(left, right, l);
00096 d_nodes.push_back(node);
00097 return node;
00098 }
00099
00100 void setRoot(SatProofNode* root) {
00101 d_root = root;
00102 }
00103
00104
00105
00106
00107
00108 SatProofNode* getRoot() {
00109 DebugAssert(d_root != NULL, "null root found in getRoot");
00110 return d_root;
00111 }
00112 };
00113
00114 }
00115
00116 #endif