00001 /*****************************************************************************/ 00002 /*! 00003 *\file expr_transform.h 00004 *\brief Generally Useful Expression Transformations 00005 * 00006 * Author: Clark Barrett 00007 * 00008 * Created: Fri Aug 5 16:11:51 2005 00009 * 00010 * <hr> 00011 * Copyright (C) 2003 by the Board of Trustees of Leland Stanford 00012 * Junior University and by New York University. 00013 * 00014 * License to use, copy, modify, sell and/or distribute this software 00015 * and its documentation for any purpose is hereby granted without 00016 * royalty, subject to the terms and conditions defined in the \ref 00017 * LICENSE file provided with this distribution. In particular: 00018 * 00019 * - The above copyright notice and this permission notice must appear 00020 * in all copies of the software and related documentation. 00021 * 00022 * - THE SOFTWARE IS PROVIDED "AS-IS", WITHOUT ANY WARRANTIES, 00023 * EXPRESSED OR IMPLIED. USE IT AT YOUR OWN RISK. 00024 * 00025 * <hr> 00026 * 00027 */ 00028 /*****************************************************************************/ 00029 00030 #ifndef _cvcl__include__expr_transform_h_ 00031 #define _cvcl__include__expr_transform_h_ 00032 00033 #include "expr.h" 00034 00035 namespace CVCL { 00036 00037 class VCL; 00038 class TheoryCore; 00039 class CommonProofRules; 00040 class CoreProofRules; 00041 00042 class ExprTransform { 00043 00044 TheoryCore* d_core; 00045 CommonProofRules* d_commonRules; 00046 CoreProofRules* d_rules; 00047 00048 //! Cache for pushNegation() 00049 ExprMap<Theorem> d_pushNegCache; 00050 00051 public: 00052 ExprTransform(TheoryCore* core); 00053 ~ExprTransform() {} 00054 00055 /*************************************************************************/ 00056 /*! 00057 *\name Preprocessor methods 00058 * FIXME: please document these functions 00059 *@{ 00060 */ 00061 /*************************************************************************/ 00062 Theorem preprocess(const Expr& e); 00063 Theorem preprocess(const Theorem& thm); 00064 //! Push all negations down to the leaves 00065 Theorem pushNegation(const Expr& e); 00066 //! Auxiliary recursive function for pushNegation(). 00067 Theorem pushNegationRec(const Expr& e, bool neg); 00068 //! Its version for transitivity 00069 Theorem pushNegationRec(const Theorem& e, bool neg); 00070 //! Push negation one level down. Takes 'e' which is 'NOT e[0]' 00071 Theorem pushNegation1(const Expr& e); 00072 Theorem substitute(Expr e, ExprMap<Theorem> *init_st=NULL); 00073 Theorem ite_simplify(Expr e); 00074 Theorem ite_convert(const Expr& e); 00075 Expr ite_reorder(const Expr& e); 00076 Expr getNeg(const Expr& e); 00077 /*@}*/ // end of preprocessor stuff 00078 00079 }; 00080 00081 } 00082 00083 #endif