CVC3
|
00001 #ifndef LFSC_LRA_PROOF_H_ 00002 #define LFSC_LRA_PROOF_H_ 00003 00004 #include "LFSCProof.h" 00005 00006 // lra_add_~_~ 00007 class LFSCLraAdd: public LFSCProof{ 00008 private: 00009 RefPtr< LFSCProof > d_children[2]; 00010 int d_op1, d_op2; 00011 00012 LFSCLraAdd(LFSCProof* pf1, LFSCProof* pf2, int op1, int op2): LFSCProof(), 00013 d_op1(op1), 00014 d_op2(op2){ 00015 d_children[0] = pf1; 00016 d_children[1] = pf2; 00017 } 00018 virtual ~LFSCLraAdd(){} 00019 long int get_length(){ 00020 return 20 + d_children[0]->get_string_length() + d_children[1]->get_string_length(); 00021 } 00022 public: 00023 virtual LFSCLraAdd* AsLFSCLraAdd(){ return this; } 00024 void print_pf( std::ostream& s, int ind = 0 ); 00025 static LFSCProof* Make(LFSCProof* pf1, LFSCProof* pf2, int op1, int op2); 00026 LFSCProof* clone() { return new LFSCLraAdd( d_children[0].get(), d_children[1].get(), d_op1, d_op2 ); } 00027 int getNumChildren() { return 2; } 00028 LFSCProof* getChild( int n ) { return d_children[n].get(); } 00029 int checkOp() { return get_knd_result( d_op1, d_op2 ); } 00030 }; 00031 00032 00033 // lra_~_axiom 00034 00035 class LFSCLraAxiom: public LFSCProof{ 00036 private: 00037 static RefPtr< LFSCProof > eq; 00038 int d_op; 00039 Rational d_r; 00040 LFSCLraAxiom(int op ) : LFSCProof(), d_op(op){} 00041 LFSCLraAxiom(int op, Rational r): LFSCProof(), 00042 d_op(op), 00043 d_r(r){} 00044 virtual ~LFSCLraAxiom(){} 00045 long int get_length(){ return 15; } 00046 public: 00047 virtual LFSCLraAxiom* AsLFSCLraAxiom(){ return this; } 00048 void print_pf( std::ostream& s, int ind = 0 ); 00049 bool isTrivial() { return d_op==EQ; } 00050 static LFSCProof* MakeEq(); 00051 static LFSCProof* Make( Rational r, int op ){ return new LFSCLraAxiom( op,r ); } 00052 LFSCProof* clone() { return new LFSCLraAxiom( d_op, d_r ); } 00053 int checkOp() { return d_op; } 00054 }; 00055 00056 00057 // lra_mult_c 00058 class LFSCLraMulC: public LFSCProof{ 00059 private: 00060 RefPtr< LFSCProof > d_pf; 00061 Rational d_r; 00062 int d_op; // = | > | >= | distinct 00063 LFSCLraMulC(LFSCProof* pf, Rational r, int op): LFSCProof(), 00064 d_pf(pf), 00065 d_r(r), 00066 d_op(op){ 00067 d_op = pf->checkOp() != -1 ? pf->checkOp() : d_op; 00068 } 00069 virtual ~LFSCLraMulC(){} 00070 long int get_length(){ return 20 + d_pf->get_string_length(); } 00071 public: 00072 virtual LFSCLraMulC* AsLFSCLraMulC(){ return this; } 00073 bool isLraMulC() { return true; } 00074 void print_pf( std::ostream& s, int ind = 0 ); 00075 static LFSCProof* Make(LFSCProof* pf, Rational r, int op); 00076 LFSCProof* clone() { return new LFSCLraMulC( d_pf.get(), d_r, d_op ); } 00077 int getNumChildren() { return 1; } 00078 LFSCProof* getChild( int n ) { return d_pf.get(); } 00079 int checkOp() { return d_op; } 00080 }; 00081 00082 00083 // lra_sub_~_~ 00084 class LFSCLraSub: public LFSCProof{ 00085 private: 00086 RefPtr< LFSCProof > d_children[2]; 00087 int d_op1, d_op2; 00088 LFSCLraSub(LFSCProof* pf1, LFSCProof* pf2, int op1, int op2): LFSCProof(), 00089 d_op1(op1), 00090 d_op2(op2){ 00091 d_children[0] = pf1; 00092 d_children[1] = pf2; 00093 d_op1 = pf1->checkOp()!=-1 ? pf1->checkOp() : d_op1; 00094 d_op2 = pf2->checkOp()!=-1 ? pf2->checkOp() : d_op2; 00095 } 00096 virtual ~LFSCLraSub(){} 00097 long int get_length(){ 00098 return 20 + d_children[0]->get_string_length() + d_children[1]->get_string_length(); 00099 } 00100 public: 00101 virtual LFSCLraSub* AsLFSCLraSub(){ return this; } 00102 void print_pf( std::ostream& s, int ind = 0 ); 00103 static LFSCProof* Make(LFSCProof* pf1, LFSCProof* pf2, int op1, int op2); 00104 LFSCProof* clone() { return new LFSCLraSub( d_children[0].get(), d_children[1].get(), d_op1, d_op2 ); } 00105 int getNumChildren() { return 2; } 00106 LFSCProof* getChild( int n ) { return d_children[n].get(); } 00107 int checkOp() { return get_knd_result( d_op1, d_op2 ); } 00108 }; 00109 00110 class LFSCLraPoly : public LFSCProof 00111 { 00112 private: 00113 RefPtr< LFSCProof > d_pf; 00114 int d_var; 00115 int d_op; 00116 LFSCLraPoly( LFSCProof* pf, int var, int op ) : LFSCProof(), 00117 d_pf( pf ), 00118 d_var( var ), 00119 d_op( op ){ 00120 d_op = pf->checkOp() != -1 ? pf->checkOp() : d_op; 00121 } 00122 virtual ~LFSCLraPoly(){} 00123 long int get_length(){ return 15 + d_pf->get_string_length(); } 00124 public: 00125 virtual LFSCLraPoly* AsLFSCLraPoly(){ return this; } 00126 void print_pf( std::ostream& s, int ind = 0 ); 00127 static LFSCProof* Make( LFSCProof* pf, int var, int op ){ 00128 return new LFSCLraPoly( pf, var, op ); 00129 } 00130 static LFSCProof* Make( const Expr& e, LFSCProof* p ); 00131 LFSCProof* clone() { return new LFSCLraPoly( d_pf.get(), d_var, d_op ); } 00132 int getNumChildren() { return 1; } 00133 LFSCProof* getChild( int n ) { return d_pf.get(); } 00134 int checkOp() { 00135 return get_normalized( d_op, d_var<0 ); 00136 } 00137 00138 }; 00139 00140 class LFSCLraContra : public LFSCProof 00141 { 00142 private: 00143 RefPtr< LFSCProof > d_pf; 00144 int d_op; 00145 LFSCLraContra( LFSCProof* pf, int op ) : LFSCProof(), 00146 d_pf( pf ), 00147 d_op( op ){ 00148 d_op = pf->checkOp() != -1 ? pf->checkOp() : d_op; 00149 } 00150 virtual ~LFSCLraContra(){} 00151 long int get_length(){ return 15 + d_pf->get_string_length(); } 00152 public: 00153 virtual LFSCLraContra* AsLFSCLraContra(){ return this; } 00154 void print_pf( std::ostream& s, int ind = 0 ){ 00155 s <<"(lra_contra_" << kind_to_str(d_op) << " _ "; 00156 d_pf->print( s, ind+1 ); 00157 s << ")"; 00158 } 00159 static LFSCProof* Make( LFSCProof* pf, int op ){ 00160 return new LFSCLraContra( pf, op ); 00161 } 00162 LFSCProof* clone() { return new LFSCLraContra( d_pf.get(), d_op ); } 00163 int getNumChildren() { return 1; } 00164 LFSCProof* getChild( int n ) { return d_pf.get(); } 00165 int checkOp() { return d_op; } 00166 }; 00167 00168 00169 #endif