00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 #ifndef _cvc3__expr_h_
00040 #include "expr.h"
00041 #endif
00042 
00043 #ifndef _cvc3__expr_value_h_
00044 #define _cvc3__expr_value_h_
00045 
00046 #include "theorem.h"
00047 #include "type.h"
00048 
00049 
00050 #define PRIME 131
00051 
00052 namespace CVC3 {
00053   
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 class ExprValue {
00070   friend class Expr;
00071   friend class Expr::iterator;
00072   friend class ExprManager;
00073   friend class ::CInterface;
00074   friend class ExprApply;
00075   friend class Theorem;
00076 
00077 
00078   ExprIndex d_index;
00079 
00080 
00081   unsigned d_refcount;
00082   
00083 
00084   size_t d_hash; 
00085 
00086 
00087   CDO<Theorem>* d_find;
00088 
00089 
00090   Type d_type;
00091 
00092 
00093   
00094 
00095 
00096   
00097 
00098 
00099   NotifyList* d_notifyList;
00100 
00101 
00102   Theorem d_simpCache;
00103 
00104 
00105   unsigned d_simpCacheTag;
00106 
00107 
00108   CDFlags d_dynamicFlags;
00109 
00110 
00111   
00112 
00113 
00114   
00115 
00116 
00117   
00118 
00119 
00120   unsigned d_flag;
00121 
00122 protected:
00123 
00124 
00125   int d_kind;
00126 
00127 
00128   ExprManager* d_em;
00129 
00130   
00131 
00132 private:
00133 
00134 
00135   void setIndex(ExprIndex idx) { d_index = idx; }
00136 
00137 
00138   void incRefcount() { ++d_refcount; }
00139 
00140 
00141   void decRefcount() {
00142     
00143     
00144     FatalAssert(d_refcount > 0, "Mis-handled the ref. counting");
00145     if((--d_refcount) == 0) d_em->gc(this);
00146   }
00147 
00148 
00149 
00150 
00151   size_t hash() const {
00152     if(d_hash == 0)
00153       const_cast<ExprValue*>(this)->d_hash = computeHash();
00154     return d_hash;
00155   }
00156 
00157 
00158   
00159 
00160 
00161   
00162 
00163 
00164   
00165 
00166 
00167   
00168 
00169 protected:
00170 
00171   
00172   
00173   
00174   static std::hash<char*> s_charHash;
00175   static std::hash<long int> s_intHash;
00176 
00177   static size_t pointerHash(void* p) { return s_intHash((long int)p); }
00178   
00179   static size_t hash(const int kind, const std::vector<Expr>& kids);
00180   
00181   static size_t hash(const int n) { return s_intHash((long int)n); }
00182 
00183 
00184   MemoryManager* getMM(size_t MMIndex) {
00185     DebugAssert(d_em!=NULL, "ExprValue::getMM()");
00186     return d_em->getMM(MMIndex);
00187   }
00188 
00189 
00190   ExprValue* rebuild(ExprManager* em) const
00191     { return copy(em, 0); }
00192 
00193 
00194   Expr rebuild(Expr e, ExprManager* em) const
00195     { return em->rebuildRec(e); }
00196 
00197   
00198 
00199 
00200 
00201   virtual size_t computeHash() const { return hash(d_kind); }
00202 
00203 
00204   virtual ExprValue* copy(ExprManager* em, ExprIndex idx) const;
00205 
00206 public:
00207 
00208   ExprValue(ExprManager* em, int kind, ExprIndex idx = 0)
00209     : d_index(idx), d_refcount(0),
00210       d_hash(0), d_find(NULL), d_notifyList(NULL),
00211       d_simpCacheTag(0),
00212       d_dynamicFlags(em->getCurrentContext()),
00213       
00214       d_flag(0), d_kind(kind), d_em(em)
00215   {
00216     DebugAssert(em != NULL, "NULL ExprManager is given to ExprValue()");
00217     DebugAssert(em->isKindRegistered(kind),
00218                 ("ExprValue(kind = " + int2string(kind)
00219                  + ")): kind is not registered").c_str());
00220     DebugAssert(kind != APPLY, "Only ExprApply should have APPLY kind");
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229   }
00230 
00231   virtual ~ExprValue();
00232 
00233 
00234   int getKind() const { return d_kind; }
00235 
00236 
00237   void* operator new(size_t size, MemoryManager* mm)
00238     { return mm->newData(size); }
00239   void operator delete(void* pMem, MemoryManager* mm) {
00240     mm->deleteData(pMem);
00241   }
00242 
00243 
00244   void operator delete(void*) { }
00245 
00246 
00247   virtual size_t getMMIndex() const { return EXPR_VALUE; }
00248 
00249 
00250   virtual bool operator==(const ExprValue& ev2) const;
00251 
00252   
00253 
00254 
00255 
00256 
00257 
00258 
00259   virtual const ExprValue* getExprValue() const
00260     { throw Exception("Illegal call to getExprValue()"); }
00261 
00262   virtual bool isString() const { return false; }
00263 
00264   virtual bool isRational() const { return false; }
00265 
00266   virtual bool isVar() const { return false; }
00267 
00268   virtual bool isApply() const { return false; }
00269 
00270   virtual bool isSymbol() const { return false; }
00271 
00272   virtual bool isClosure() const { return false; }
00273 
00274   virtual bool isTheorem() const { return false; }
00275 
00276 
00277   virtual const std::vector<Expr>& getKids() const
00278     { return d_em->getEmptyVector(); }
00279 
00280   
00281 
00282 
00283   virtual unsigned arity() const { return 0; }
00284 
00285 
00286   virtual CDO<Theorem>* getSig() const {
00287     DebugAssert(false, "getSig() is called on ExprValue");
00288     return NULL;
00289   }
00290 
00291   virtual CDO<Theorem>* getRep() const {
00292     DebugAssert(false, "getRep() is called on ExprValue");
00293     return NULL;
00294   }
00295 
00296   virtual void setSig(CDO<Theorem>* sig) {
00297     DebugAssert(false, "setSig() is called on ExprValue");
00298   }
00299 
00300   virtual void setRep(CDO<Theorem>* rep) {
00301     DebugAssert(false, "setRep() is called on ExprValue");
00302   }
00303 
00304   virtual const std::string& getUid() const { 
00305     static std::string null;
00306     DebugAssert(false, "ExprValue::getUid() called in base class");
00307     return null;
00308   }
00309 
00310   virtual const std::string& getString() const {
00311     DebugAssert(false, "getString() is called on ExprValue");
00312     static std::string s("");
00313     return s;
00314   }
00315 
00316   virtual const Rational& getRational() const {
00317     DebugAssert(false, "getRational() is called on ExprValue");
00318     static Rational r(0);
00319     return r;
00320   }
00321 
00322 
00323   virtual const std::string& getName() const {
00324     static std::string ret = "";
00325     DebugAssert(false, "getName() is called on ExprValue");
00326     return ret;
00327   }
00328 
00329 
00330   virtual const Expr& getVar() const {
00331     DebugAssert(false, "getVar() is called on ExprValue");
00332     static Expr null;
00333     return null;
00334   }
00335 
00336 
00337   virtual Op getOp() const {
00338     DebugAssert(false, "getOp() is called on ExprValue");
00339     return Op(NULL_KIND);
00340   }
00341 
00342   virtual const std::vector<Expr>& getVars() const  {
00343     DebugAssert(false, "getVars() is called on ExprValue");
00344     static std::vector<Expr> null;
00345     return null;
00346   }
00347 
00348   virtual const Expr& getBody() const {
00349     DebugAssert(false, "getBody() is called on ExprValue");
00350     static Expr null;
00351     return null;
00352   }
00353 
00354   virtual const Expr& getExistential() const {
00355     DebugAssert(false, "getExistential() is called on ExprValue");
00356     static Expr null;
00357     return null;
00358   }
00359   virtual int getBoundIndex() const {
00360     DebugAssert(false, "getIndex() is called on ExprValue");
00361     return 0;
00362   }
00363 
00364   virtual const std::vector<std::string>& getFields() const {
00365     DebugAssert(false, "getFields() is called on ExprValue");
00366     static std::vector<std::string> null;
00367     return null;
00368   }
00369   virtual const std::string& getField() const {
00370     DebugAssert(false, "getField() is called on ExprValue");
00371     static std::string null;
00372     return null;
00373   }
00374   virtual int getTupleIndex() const {
00375     DebugAssert(false, "getTupleIndex() is called on ExprValue");
00376     return 0;
00377   }
00378   virtual const Theorem& getTheorem() const {
00379     static Theorem null;
00380     DebugAssert(false, "getTheorem() is called on ExprValue");
00381     return null;
00382   }
00383 
00384 }; 
00385 
00386 
00387 class ExprNode: public ExprValue {
00388   friend class Expr;
00389   friend class ExprManager;
00390 
00391 protected:
00392 
00393   std::vector<Expr> d_children;
00394 
00395   
00396   CDO<Theorem>* d_sig;
00397   CDO<Theorem>* d_rep;
00398 
00399 private:
00400 
00401 
00402   size_t getMMIndex() const { return EXPR_NODE; }
00403 
00404 protected:
00405 
00406   unsigned arity() const { return d_children.size(); }
00407 
00408 
00409   std::vector<Expr>& getKids1() { return d_children; }
00410 
00411 
00412   const std::vector<Expr>& getKids() const { return d_children; }
00413 
00414 
00415   size_t computeHash() const {
00416     return ExprValue::hash(d_kind, d_children);
00417   }
00418 
00419 
00420   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00421 
00422 public:
00423 
00424   ExprNode(ExprManager* em, int kind, ExprIndex idx = 0)
00425     : ExprValue(em, kind, idx), d_sig(NULL), d_rep(NULL) { }
00426 
00427   ExprNode(ExprManager* em, int kind, const std::vector<Expr>& kids,
00428            ExprIndex idx = 0)
00429     : ExprValue(em, kind, idx), d_children(kids), d_sig(NULL), d_rep(NULL) { }
00430 
00431   virtual ~ExprNode();
00432     
00433 
00434   void* operator new(size_t size, MemoryManager* mm)
00435     { return mm->newData(size); }
00436   void operator delete(void* pMem, MemoryManager* mm) {
00437     mm->deleteData(pMem);
00438   }
00439 
00440 
00441   void operator delete(void*) { }
00442 
00443 
00444   virtual bool operator==(const ExprValue& ev2) const;
00445 
00446   virtual CDO<Theorem>* getSig() const { return d_sig; }
00447   virtual CDO<Theorem>* getRep() const { return d_rep; }
00448 
00449   virtual void setRep(CDO<Theorem>* rep) { d_rep = rep; }
00450   virtual void setSig(CDO<Theorem>* sig) { d_sig = sig; }
00451 
00452 }; 
00453 
00454 
00455 class ExprNodeTmp: public ExprValue {
00456   friend class Expr;
00457   friend class ExprManager;
00458 
00459 protected:
00460 
00461   const std::vector<Expr>& d_children;
00462 
00463 private:
00464 
00465 
00466   size_t getMMIndex() const { return EXPR_NODE; }
00467 
00468 protected:
00469 
00470   unsigned arity() const { return d_children.size(); }
00471 
00472 
00473   const std::vector<Expr>& getKids() const { return d_children; }
00474 
00475 
00476   size_t computeHash() const {
00477     return ExprValue::hash(d_kind, d_children);
00478   }
00479 
00480 
00481   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00482 
00483 public:
00484 
00485   ExprNodeTmp(ExprManager* em, int kind, const std::vector<Expr>& kids)
00486     : ExprValue(em, kind, 0), d_children(kids) { }
00487 
00488 
00489   virtual ~ExprNodeTmp() {}
00490     
00491 
00492   virtual bool operator==(const ExprValue& ev2) const;
00493 
00494 }; 
00495 
00496 
00497 class ExprApplyTmp: public ExprNodeTmp {
00498   friend class Expr;
00499   friend class ExprManager;
00500 private:
00501   Expr d_opExpr;
00502 protected:
00503   size_t getMMIndex() const { return EXPR_APPLY; }
00504   size_t computeHash() const {
00505     return PRIME*ExprNodeTmp::computeHash() + d_opExpr.hash();
00506   }
00507   Op getOp() const { return Op(d_opExpr); }
00508   bool isApply() const { return true; }
00509   
00510   ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00511 public:
00512   
00513   ExprApplyTmp(ExprManager* em, const Op& op,
00514                const std::vector<Expr>& kids)
00515     : ExprNodeTmp(em, NULL_KIND, kids), d_opExpr(op.getExpr())
00516   { DebugAssert(!op.getExpr().isNull(), "Expected non-null Op");
00517     d_kind = APPLY; }
00518   virtual ~ExprApplyTmp() { }
00519 
00520   bool operator==(const ExprValue& ev2) const;
00521 }; 
00522 
00523 class CVC_DLL ExprApply: public ExprNode {
00524   friend class Expr;
00525   friend class ExprManager;
00526 private:
00527   Expr d_opExpr;
00528 protected:
00529   size_t getMMIndex() const { return EXPR_APPLY; }
00530   size_t computeHash() const {
00531     return PRIME*ExprNode::computeHash() + d_opExpr.hash();
00532   }
00533   Op getOp() const { return Op(d_opExpr); }
00534   bool isApply() const { return true; }
00535   
00536   ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00537 public:
00538   
00539   ExprApply(ExprManager* em, const Op& op, ExprIndex idx = 0)
00540     : ExprNode(em, NULL_KIND, idx), d_opExpr(op.getExpr())
00541   { DebugAssert(!op.getExpr().isNull(), "Expected non-null Op");
00542     d_kind = APPLY; }
00543   ExprApply(ExprManager* em, const Op& op,
00544             const std::vector<Expr>& kids, ExprIndex idx = 0)
00545     : ExprNode(em, NULL_KIND, kids, idx), d_opExpr(op.getExpr())
00546   { DebugAssert(!op.getExpr().isNull(), "Expected non-null Op");
00547     d_kind = APPLY; }
00548   virtual ~ExprApply() { }
00549 
00550   bool operator==(const ExprValue& ev2) const;
00551   
00552   void* operator new(size_t size, MemoryManager* mm) {
00553     return mm->newData(size);
00554   }
00555   void operator delete(void* pMem, MemoryManager* mm) {
00556     mm->deleteData(pMem);
00557   }
00558   void operator delete(void*) { }
00559 }; 
00560 
00561 
00562 
00563 
00564 
00565 
00566 
00567 
00568 
00569 
00570 
00571 
00572 
00573 
00574 
00575 
00576 
00577 
00578 
00579 
00580 
00581 
00582 
00583 
00584 
00585 
00586 
00587 
00588 
00589 
00590 
00591 
00592 
00593 
00594 
00595 
00596 
00597 
00598 
00599 
00600 
00601 
00602 
00603 
00604 
00605 
00606 
00607 
00608 
00609 
00610 
00611 
00612 
00613 
00614 
00615 
00616 
00617 
00618 
00619 
00620 
00621 
00622 class ExprString: public ExprValue {
00623   friend class Expr;
00624   friend class ExprManager;
00625 private:
00626   std::string d_str;
00627 
00628   
00629   static size_t hash(const std::string& str) {
00630     return s_charHash(str.c_str());
00631   }
00632 
00633   
00634   virtual size_t getMMIndex() const { return EXPR_STRING; }
00635 
00636 protected:
00637   
00638   virtual size_t computeHash() const { return hash(d_str); }
00639 
00640   virtual bool isString() const { return true; }
00641   virtual const std::string& getString() const { return d_str; }
00642 
00643 
00644   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00645 public:
00646   
00647   ExprString(ExprManager* em, const std::string& s, ExprIndex idx = 0)
00648     : ExprValue(em, STRING_EXPR, idx), d_str(s) { }
00649   
00650   virtual ~ExprString() { }
00651 
00652   virtual bool operator==(const ExprValue& ev2) const;
00653   
00654   void* operator new(size_t size, MemoryManager* mm) {
00655     return mm->newData(size);
00656   }
00657   void operator delete(void* pMem, MemoryManager* mm) {
00658     mm->deleteData(pMem);
00659   }
00660   void operator delete(void*) { }
00661 }; 
00662 
00663 class ExprSkolem: public ExprValue {
00664   friend class Expr;
00665   friend class ExprManager;
00666 private:
00667   Expr d_quant; 
00668   int d_idx; 
00669   const Expr& getExistential() const {return d_quant;}
00670   int getBoundIndex() const {return d_idx;}
00671 
00672   
00673   size_t getMMIndex() const { return EXPR_SKOLEM;}
00674 
00675 protected:
00676   size_t computeHash() const {
00677     size_t res = getExistential().getBody().hash();
00678     res = PRIME*res + getBoundIndex();
00679     return res;
00680   }
00681 
00682   bool operator==(const ExprValue& ev2) const;
00683 
00684 
00685   ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00686   bool isVar() const { return true; }
00687    
00688 public:
00689   
00690   ExprSkolem(ExprManager* em, int index, const Expr& exist, ExprIndex idx = 0)
00691     : ExprValue(em, SKOLEM_VAR, idx), d_quant(exist), d_idx(index) { }
00692   
00693   virtual ~ExprSkolem() { }
00694   
00695   void* operator new(size_t size, MemoryManager* mm) {
00696     return mm->newData(size);
00697   }
00698   void operator delete(void* pMem, MemoryManager* mm) {
00699     mm->deleteData(pMem);
00700   }
00701   void operator delete(void*) { }
00702 }; 
00703 
00704 class ExprRational: public ExprValue {
00705   friend class Expr;
00706   friend class ExprManager;
00707 private:
00708   Rational d_r;
00709 
00710   virtual const Rational& getRational() const { return d_r; }
00711 
00712   
00713   static size_t hash(const Rational& r) {
00714     return s_charHash(r.toString().c_str());
00715   }
00716 
00717   
00718   virtual size_t getMMIndex() const { return EXPR_RATIONAL; }
00719 
00720 protected:
00721 
00722   virtual size_t computeHash() const { return hash(d_r); }
00723   virtual bool operator==(const ExprValue& ev2) const;
00724 
00725   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00726   virtual bool isRational() const { return true; }
00727 
00728 public:
00729   
00730   ExprRational(ExprManager* em, const Rational& r, ExprIndex idx = 0)
00731     : ExprValue(em, RATIONAL_EXPR, idx), d_r(r) { }
00732   
00733   virtual ~ExprRational() { }
00734   
00735   void* operator new(size_t size, MemoryManager* mm) {
00736     return mm->newData(size);
00737   }
00738   void operator delete(void* pMem, MemoryManager* mm) {
00739     mm->deleteData(pMem);
00740   }
00741   void operator delete(void*) { }
00742 }; 
00743 
00744 
00745 class ExprVar: public ExprValue {
00746   friend class Expr;
00747   friend class ExprManager;
00748 private:
00749   std::string d_name;
00750 
00751   virtual const std::string& getName() const { return d_name; }
00752 
00753   
00754   virtual size_t getMMIndex() const { return EXPR_UCONST; }
00755 protected:
00756 
00757   virtual size_t computeHash() const {
00758     return s_charHash(d_name.c_str());
00759   }
00760   virtual bool isVar() const { return true; }
00761 
00762 
00763   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00764 
00765 public:
00766   
00767   ExprVar(ExprManager *em, const std::string& name, ExprIndex idx = 0)
00768     : ExprValue(em, UCONST, idx), d_name(name) { }
00769   
00770   virtual ~ExprVar() { }
00771 
00772   virtual bool operator==(const ExprValue& ev2) const;
00773   
00774   void* operator new(size_t size, MemoryManager* mm) {
00775     return mm->newData(size);
00776   }
00777   void operator delete(void* pMem, MemoryManager* mm) {
00778     mm->deleteData(pMem);
00779   }
00780   void operator delete(void*) { }
00781 }; 
00782 
00783 
00784 class ExprSymbol: public ExprValue {
00785   friend class Expr;
00786   friend class ExprManager;
00787 private:
00788   std::string d_name;
00789 
00790   virtual const std::string& getName() const { return d_name; }
00791 
00792   
00793   virtual size_t getMMIndex() const { return EXPR_SYMBOL; }
00794 protected:
00795 
00796   virtual size_t computeHash() const {
00797     return s_charHash(d_name.c_str())*PRIME + s_intHash(d_kind);
00798   }
00799 
00800   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00801   bool isSymbol() const { return true; }
00802 
00803 public:
00804   
00805   ExprSymbol(ExprManager *em, int kind, const std::string& name,
00806              ExprIndex idx = 0)
00807     : ExprValue(em, kind, idx), d_name(name) { }
00808   
00809   virtual ~ExprSymbol() { }
00810 
00811   virtual bool operator==(const ExprValue& ev2) const;
00812   
00813   void* operator new(size_t size, MemoryManager* mm) {
00814     return mm->newData(size);
00815   }
00816   void operator delete(void* pMem, MemoryManager* mm) {
00817     mm->deleteData(pMem);
00818   }
00819   void operator delete(void*) { }
00820 }; 
00821 
00822 class ExprBoundVar: public ExprValue {
00823   friend class Expr;
00824   friend class ExprManager;
00825 private:
00826   std::string d_name;
00827   std::string d_uid;
00828 
00829   virtual const std::string& getName() const { return d_name; }
00830   virtual const std::string& getUid() const { return d_uid; }
00831 
00832   
00833   virtual size_t getMMIndex() const { return EXPR_BOUND_VAR; }
00834 protected:
00835 
00836   virtual size_t computeHash() const {
00837     return s_charHash(d_name.c_str())*PRIME + s_charHash(d_uid.c_str());
00838   }
00839   virtual bool isVar() const { return true; }
00840 
00841   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00842 
00843 public:
00844   
00845   ExprBoundVar(ExprManager *em, const std::string& name,
00846                const std::string& uid, ExprIndex idx = 0)
00847     : ExprValue(em, BOUND_VAR, idx), d_name(name), d_uid(uid) { }
00848   
00849   virtual ~ExprBoundVar() { }
00850 
00851   virtual bool operator==(const ExprValue& ev2) const;
00852   
00853   void* operator new(size_t size, MemoryManager* mm) {
00854     return mm->newData(size);
00855   }
00856   void operator delete(void* pMem, MemoryManager* mm) {
00857     mm->deleteData(pMem);
00858   }
00859   void operator delete(void*) { }
00860 }; 
00861 
00862 
00863 
00864 class ExprClosure: public ExprValue {
00865   friend class Expr;
00866   friend class ExprManager;
00867 private:
00868 
00869   std::vector<Expr> d_vars;
00870 
00871   Expr d_body;
00872 
00873 
00874   virtual size_t getMMIndex() const { return EXPR_CLOSURE; }
00875 
00876   virtual const std::vector<Expr>& getVars() const { return d_vars; }
00877   virtual const Expr& getBody() const { return d_body; }
00878 
00879 
00880 protected:
00881 
00882   size_t computeHash() const;
00883 
00884   ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00885 
00886 public:
00887   
00888   ExprClosure(ExprManager *em, int kind, const std::vector<Expr>& vars,
00889               const Expr& body, ExprIndex idx = 0)
00890     : ExprValue(em, kind, idx), d_vars(vars), d_body(body) { }
00891   
00892   virtual ~ExprClosure() { }
00893 
00894   bool operator==(const ExprValue& ev2) const;
00895   
00896   void* operator new(size_t size, MemoryManager* mm) {
00897     return mm->newData(size);
00898   }
00899   void operator delete(void* pMem, MemoryManager* mm) {
00900     mm->deleteData(pMem);
00901   }
00902   void operator delete(void*) { }
00903   virtual bool isClosure() const { return true; }
00904 }; 
00905 
00906 
00907 class ExprTheorem: public ExprValue {
00908   friend class Expr;
00909   friend class ExprManager;
00910 private:
00911   Theorem d_thm;
00912 
00913   virtual const Theorem& getTheorem() const { return d_thm; }
00914 
00915   
00916   virtual size_t getMMIndex() const { return EXPR_THEOREM; }
00917 protected:
00918 
00919   virtual size_t computeHash() const {
00920     return d_thm.hash();
00921   }
00922 
00923   virtual ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const;
00924   bool isTheorem() const { return true; }
00925 
00926 public:
00927   
00928   ExprTheorem(ExprManager *em, const Theorem& thm, ExprIndex idx = 0)
00929     : ExprValue(em, THEOREM_KIND, idx), d_thm(thm) { }
00930   
00931   virtual ~ExprTheorem() { }
00932 
00933   virtual bool operator==(const ExprValue& ev2) const;
00934   
00935   void* operator new(size_t size, MemoryManager* mm) {
00936     return mm->newData(size);
00937   }
00938   void operator delete(void* pMem, MemoryManager* mm) {
00939     mm->deleteData(pMem);
00940   }
00941   void operator delete(void*) { }
00942 
00943 };
00944 
00945 } 
00946 
00947 #endif