theory_uf.h

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /*!
00003  * \file theory_uf.h
00004  * 
00005  * Author: Clark Barrett
00006  * 
00007  * Created: Fri Jan 17 18:25:40 2003
00008  *
00009  * <hr>
00010  * Copyright (C) 2003 by the Board of Trustees of Leland Stanford
00011  * Junior University and by New York University. 
00012  *
00013  * License to use, copy, modify, sell and/or distribute this software
00014  * and its documentation for any purpose is hereby granted without
00015  * royalty, subject to the terms and conditions defined in the \ref
00016  * LICENSE file provided with this distribution.  In particular:
00017  *
00018  * - The above copyright notice and this permission notice must appear
00019  * in all copies of the software and related documentation.
00020  *
00021  * - THE SOFTWARE IS PROVIDED "AS-IS", WITHOUT ANY WARRANTIES,
00022  * EXPRESSED OR IMPLIED.  USE IT AT YOUR OWN RISK.
00023  * 
00024  * <hr>
00025  * 
00026  */
00027 /*****************************************************************************/
00028 
00029 #ifndef _cvcl__include__theory_uf_h_
00030 #define _cvcl__include__theory_uf_h_
00031 
00032 #include "theory.h"
00033 
00034 namespace CVCL {
00035 
00036 class UFProofRules;
00037 
00038   //! Local kinds for transitive closure of binary relations
00039  typedef enum {
00040    TRANS_CLOSURE = 500,
00041    OLD_ARROW, // for backward compatibility with old function declarations
00042    ANY_TYPE   // allows a function which can take any type
00043  } UFKinds;
00044 
00045 /*****************************************************************************/
00046 /*!
00047  *\class TheoryUF
00048  *\ingroup Theories
00049  *\brief This theory handles uninterpreted functions.
00050  *
00051  * Author: Clark Barrett
00052  *
00053  * Created: Sat Feb  8 14:51:19 2003
00054  */
00055 /*****************************************************************************/
00056 class TheoryUF :public Theory {
00057   UFProofRules* d_rules;  
00058   //! Flag to include function applications to the concrete model
00059   const bool& d_applicationsInModel;
00060 
00061   //! Type that matches any type in a function argument
00062   Type d_anyType;
00063 
00064   // For computing transitive closure of binary relations
00065   typedef struct TCMapPair {
00066     ExprMap<CDList<Theorem>*> appearsFirstMap;
00067     ExprMap<CDList<Theorem>*> appearsSecondMap;
00068   } TCMapPair;
00069 
00070   ExprMap<TCMapPair*> d_transClosureMap;
00071 
00072   //! Backtracking list of function applications
00073   /*! Used for building concrete models and beta-reducing
00074    *  lambda-expressions. */
00075   CDList<Expr> d_funApplications;
00076   //! Pointer to the last unprocessed element (for lambda expansions)
00077   CDO<size_t> d_funApplicationsIdx;
00078   
00079 public:
00080   TheoryUF(TheoryCore* core);
00081   ~TheoryUF();
00082 
00083   // Trusted method that creates the proof rules class (used in constructor).
00084   // Implemented in uf_theorem_producer.cpp
00085   UFProofRules* createProofRules();
00086 
00087   // Theory interface
00088   void addSharedTerm(const Expr& e) {}
00089   void assertFact(const Theorem& e);
00090   void checkSat(bool fullEffort);
00091   Theorem rewrite(const Expr& e);
00092   void setup(const Expr& e);
00093   void update(const Theorem& e, const Expr& d);
00094   void checkType(const Expr& e);
00095   void computeType(const Expr& e);
00096   Type computeBaseType(const Type& t);
00097   void computeModelTerm(const Expr& e, std::vector<Expr>& v);
00098   void computeModel(const Expr& e, std::vector<Expr>& vars);
00099   Expr computeTCC(const Expr& e);
00100   virtual Expr parseExprOp(const Expr& e);
00101   ExprStream& print(ExprStream& os, const Expr& e);
00102 
00103   //! Create a new LAMBDA-abstraction
00104   Expr lambdaExpr(const std::vector<Expr>& vars, const Expr& body);
00105   //! Create a transitive closure expression
00106   Expr transClosureExpr(const std::string& name,
00107                         const Expr& e1, const Expr& e2);
00108   Type anyType() { return d_anyType; }
00109 
00110 };
00111 
00112 }
00113 
00114 #endif

Generated on Thu Apr 13 16:57:35 2006 for CVC Lite by  doxygen 1.4.4