CVC3
|
00001 #ifndef LFSC_PROOF_H_ 00002 #define LFSC_PROOF_H_ 00003 00004 #include "LFSCObject.h" 00005 00006 ////////////////////////////////// 00007 /// LFSC Proof Class & subclasses 00008 ////////////////////////////////// 00009 00010 class LFSCProofExpr; 00011 class LFSCLraAdd; 00012 class LFSCLraSub; 00013 class LFSCLraMulC; 00014 class LFSCLraAxiom; 00015 class LFSCLraContra; 00016 class LFSCLraPoly; 00017 class LFSCBoolRes; 00018 class LFSCLem; 00019 class LFSCClausify; 00020 class LFSCAssume; 00021 class LFSCProofGeneric; 00022 class LFSCPfVar; 00023 class LFSCPfLambda; 00024 class LFSCPfLet; 00025 00026 class LFSCProof : public LFSCObj{ 00027 protected: 00028 static int pf_counter; 00029 static std::map< LFSCProof*, int > lambdaMap; 00030 static std::map< LFSCProof*, LFSCProof* > lambdaPrintMap; 00031 int printCounter; 00032 LFSCProof* rplProof; 00033 static int lambdaCounter; 00034 long int strLen; 00035 int chOp; 00036 int assumeVar; 00037 int assumeVarUsed; 00038 00039 std::vector< int > br; 00040 bool brComputed; 00041 00042 LFSCProof(); 00043 virtual long int get_length() { return 0; } 00044 virtual ~LFSCProof(){} 00045 public: 00046 virtual LFSCProofExpr* AsLFSCProofExpr(){ return NULL; } 00047 virtual LFSCLraAdd* AsLFSCLraAdd(){ return NULL; } 00048 virtual LFSCLraSub* AsLFSCLraSub(){ return NULL; } 00049 virtual LFSCLraMulC* AsLFSCLraMulC(){ return NULL; } 00050 virtual LFSCLraAxiom* AsLFSCLraAxiom(){ return NULL; } 00051 virtual LFSCLraContra* AsLFSCLraContra(){ return NULL; } 00052 virtual LFSCLraPoly* AsLFSCLraPoly(){ return NULL; } 00053 virtual LFSCBoolRes* AsLFSCBoolRes(){ return NULL; } 00054 virtual LFSCLem* AsLFSCLem(){ return NULL; } 00055 virtual LFSCClausify* AsLFSCClausify(){ return NULL; } 00056 virtual LFSCAssume* AsLFSCAssume(){ return NULL; } 00057 virtual LFSCProofGeneric* AsLFSCProofGeneric(){ return NULL; } 00058 virtual LFSCPfVar* AsLFSCPfVar(){ return NULL; } 00059 virtual LFSCPfLambda* AsLFSCPfLambda(){ return NULL; } 00060 virtual LFSCPfLet* AsLFSCPfLet(){ return NULL; } 00061 00062 virtual bool isLraMulC() { return false; } 00063 static int make_lambda( LFSCProof* p ){ 00064 if( lambdaMap[p]==0 ){ 00065 lambdaMap[p] = lambdaCounter; 00066 lambdaCounter++; 00067 } 00068 return lambdaMap[p]; 00069 } 00070 void print( std::ostream& s, int ind = 0 ); 00071 virtual void print_pf( std::ostream& s, int ind = 0 )=0; 00072 virtual bool isTrivial() { return false; } 00073 long int get_string_length() { 00074 if( strLen<0 ){ 00075 strLen = get_length(); 00076 //to prevent overflow 00077 for( int a=0; a<getNumChildren(); a++ ){ 00078 if( strLen<getChild( a )->get_string_length() ){ 00079 strLen = getChild( a )->get_string_length(); 00080 } 00081 } 00082 } 00083 return strLen; 00084 } 00085 void print_structure( std::ostream& s, int ind = 0 ); 00086 virtual void print_struct( std::ostream& s, int ind = 0 ){ 00087 static int psCounter = 0; 00088 s << "P" << psCounter; 00089 psCounter++; 00090 } 00091 void setRplProof( LFSCProof* p ) { rplProof = p; } 00092 virtual void fillHoles(); 00093 #ifdef OPTIMIZE 00094 void calcL( std::vector< int >& lget, std::vector< int >& lgetu ); 00095 #endif 00096 00097 friend class LFSCPrinter; 00098 00099 virtual LFSCProof* clone() = 0; 00100 virtual int getNumChildren() { return 0; } 00101 virtual LFSCProof* getChild( int n ) { return NULL; } 00102 virtual int checkOp(); 00103 int getChOp(){ return chOp; } 00104 void setChOp( int c ) { chOp = c; } 00105 virtual int checkBoolRes( std::vector< int >& clause ){ return 0; } 00106 00107 //proof making methods 00108 public: 00109 static LFSCProof* Make_CNF( const Expr& form, const Expr& reason, int pos ); 00110 static LFSCProof* Make_not_not_elim( const Expr& pf, LFSCProof* p ); 00111 static LFSCProof* Make_mimic( const Expr& pf, LFSCProof* p, int numHoles ); 00112 static LFSCProof* Make_and_elim( const Expr& form, LFSCProof* p, int n, const Expr& expected ); 00113 00114 static int get_proof_counter() { return pf_counter; } 00115 }; 00116 00117 00118 #endif