<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>CVC3: theory_uf.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">CVC3 <span id="projectnumber">2.4.1</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">theory_uf.h</div> </div> </div> <div class="contents"> <a href="theory__uf_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************/</span><span class="comment"></span> <a name="l00002"></a>00002 <span class="comment">/*!</span> <a name="l00003"></a>00003 <span class="comment"> * \file theory_uf.h</span> <a name="l00004"></a>00004 <span class="comment"> * </span> <a name="l00005"></a>00005 <span class="comment"> * Author: Clark Barrett</span> <a name="l00006"></a>00006 <span class="comment"> * </span> <a name="l00007"></a>00007 <span class="comment"> * Created: Fri Jan 17 18:25:40 2003</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * <hr></span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span> <a name="l00012"></a>00012 <span class="comment"> * and its documentation for any purpose is hereby granted without</span> <a name="l00013"></a>00013 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span> <a name="l00014"></a>00014 <span class="comment"> * LICENSE file provided with this distribution.</span> <a name="l00015"></a>00015 <span class="comment"> * </span> <a name="l00016"></a>00016 <span class="comment"> * <hr></span> <a name="l00017"></a>00017 <span class="comment"> * </span> <a name="l00018"></a>00018 <span class="comment"> */</span> <a name="l00019"></a>00019 <span class="comment">/*****************************************************************************/</span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#ifndef _cvc3__include__theory_uf_h_</span> <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define _cvc3__include__theory_uf_h_</span> <a name="l00023"></a>00023 <span class="preprocessor"></span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="theory_8h.html" title="Generic API for Theories plus methods commonly used by theories.">theory.h</a>"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="cdmap_8h.html">cdmap.h</a>"</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="keyword">namespace </span>CVC3 { <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="keyword">class </span>UFProofRules; <a name="l00030"></a>00030 <span class="comment"></span> <a name="l00031"></a>00031 <span class="comment"> //! Local kinds for transitive closure of binary relations</span> <a name="l00032"></a><a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923a">00032</a> <span class="comment"></span> <span class="keyword">typedef</span> <span class="keyword">enum</span> { <a name="l00033"></a><a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">00033</a> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a> = 500, <a name="l00034"></a><a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">00034</a> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a> <span class="comment">// for backward compatibility with old function declarations</span> <a name="l00035"></a>00035 } <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923a" title="Local kinds for transitive closure of binary relations.">UFKinds</a>; <a name="l00036"></a>00036 <a name="l00037"></a>00037 <span class="comment">/*****************************************************************************/</span><span class="comment"></span> <a name="l00038"></a>00038 <span class="comment">/*!</span> <a name="l00039"></a>00039 <span class="comment"> *\class TheoryUF</span> <a name="l00040"></a>00040 <span class="comment"> *\ingroup Theories</span> <a name="l00041"></a>00041 <span class="comment"> *\brief This theory handles uninterpreted functions.</span> <a name="l00042"></a>00042 <span class="comment"> *</span> <a name="l00043"></a>00043 <span class="comment"> * Author: Clark Barrett</span> <a name="l00044"></a>00044 <span class="comment"> *</span> <a name="l00045"></a>00045 <span class="comment"> * Created: Sat Feb 8 14:51:19 2003</span> <a name="l00046"></a>00046 <span class="comment"> */</span> <a name="l00047"></a>00047 <span class="comment">/*****************************************************************************/</span> <a name="l00048"></a><a class="code" href="classCVC3_1_1TheoryUF.html">00048</a> <span class="keyword">class </span><a class="code" href="classCVC3_1_1TheoryUF.html" title="This theory handles uninterpreted functions.">TheoryUF</a> :<span class="keyword">public</span> <a class="code" href="classCVC3_1_1Theory.html" title="Base class for theories.">Theory</a> { <a name="l00049"></a><a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">00049</a> <a class="code" href="classCVC3_1_1UFProofRules.html">UFProofRules</a>* <a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>; <span class="comment"></span> <a name="l00050"></a>00050 <span class="comment"> //! Flag to include function applications to the concrete model</span> <a name="l00051"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a608a96026a281c8e2da549584e9b2cdc">00051</a> <span class="comment"></span> <span class="keyword">const</span> <span class="keywordtype">bool</span>& <a class="code" href="classCVC3_1_1TheoryUF.html#a608a96026a281c8e2da549584e9b2cdc" title="Flag to include function applications to the concrete model.">d_applicationsInModel</a>; <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="comment">// For computing transitive closure of binary relations</span> <a name="l00054"></a><a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html">00054</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html">TCMapPair</a> { <a name="l00055"></a><a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a9e3dbe418924f988b04289634927c7f6">00055</a> <a class="code" href="classCVC3_1_1ExprMap.html">ExprMap<CDList<Theorem></a>*> <a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a9e3dbe418924f988b04289634927c7f6">appearsFirstMap</a>; <a name="l00056"></a><a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a3188576390aa926a1cda9571d7a45b65">00056</a> <a class="code" href="classCVC3_1_1ExprMap.html">ExprMap<CDList<Theorem></a>*> <a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a3188576390aa926a1cda9571d7a45b65">appearsSecondMap</a>; <a name="l00057"></a>00057 } <a class="code" href="classCVC3_1_1TheoryUF.html#a99f45ac6d21871fdc4a0b5874563939d">TCMapPair</a>; <a name="l00058"></a>00058 <a name="l00059"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a7e7a38e729bf36884241e8e8e239dba4">00059</a> <a class="code" href="classCVC3_1_1ExprMap.html">ExprMap<TCMapPair*></a> <a class="code" href="classCVC3_1_1TheoryUF.html#a7e7a38e729bf36884241e8e8e239dba4">d_transClosureMap</a>; <a name="l00060"></a>00060 <span class="comment"></span> <a name="l00061"></a>00061 <span class="comment"> //! Backtracking list of function applications</span> <a name="l00062"></a>00062 <span class="comment"></span><span class="comment"> /*! Used for building concrete models and beta-reducing</span> <a name="l00063"></a>00063 <span class="comment"> * lambda-expressions. */</span> <a name="l00064"></a><a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b">00064</a> <a class="code" href="classCVC3_1_1CDList.html">CDList<Expr></a> <a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>;<span class="comment"></span> <a name="l00065"></a>00065 <span class="comment"> //! Pointer to the last unprocessed element (for lambda expansions)</span> <a name="l00066"></a><a class="code" href="classCVC3_1_1TheoryUF.html#ae8387e395bd085233c0fd5d37fa086cd">00066</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1CDO.html">CDO<size_t></a> <a class="code" href="classCVC3_1_1TheoryUF.html#ae8387e395bd085233c0fd5d37fa086cd" title="Pointer to the last unprocessed element (for lambda expansions)">d_funApplicationsIdx</a>;<span class="comment"></span> <a name="l00067"></a>00067 <span class="comment"> //! The pointers to the last unprocessed shared pair</span> <a name="l00068"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a80f414cb2926646f3028983ddc1eccac">00068</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1CDO.html">CDO<size_t></a> <a class="code" href="classCVC3_1_1TheoryUF.html#a48545e083f3c4d152d7f79aec75fcbcd" title="The pointers to the last unprocessed shared pair.">d_sharedIdx1</a>, <a class="code" href="classCVC3_1_1TheoryUF.html#a80f414cb2926646f3028983ddc1eccac">d_sharedIdx2</a>;<span class="comment"></span> <a name="l00069"></a>00069 <span class="comment"> //! The set of all shared terms</span> <a name="l00070"></a><a class="code" href="classCVC3_1_1TheoryUF.html#ac15e725de0573cf067ebb9c91b14f9a3">00070</a> <span class="comment"></span> <a class="code" href="classCVC3_1_1CDMap.html">CDMap<Expr, bool></a> <a class="code" href="classCVC3_1_1TheoryUF.html#ac15e725de0573cf067ebb9c91b14f9a3" title="The set of all shared terms.">d_sharedTermsMap</a>; <a name="l00071"></a>00071 <a name="l00072"></a>00072 <span class="keyword">public</span>: <a name="l00073"></a>00073 <a class="code" href="classCVC3_1_1TheoryUF.html#ac00f7aea61528906495cb96d6c38ecab">TheoryUF</a>(<a class="code" href="classCVC3_1_1TheoryCore.html" title="This theory handles the built-in logical connectives plus equality. It also handles the registration ...">TheoryCore</a>* core); <a name="l00074"></a>00074 <a class="code" href="classCVC3_1_1TheoryUF.html#a2ffd3c9bab9abb60724448bd0551dc36">~TheoryUF</a>(); <a name="l00075"></a>00075 <a name="l00076"></a>00076 <span class="comment">// Trusted method that creates the proof rules class (used in constructor).</span> <a name="l00077"></a>00077 <span class="comment">// Implemented in uf_theorem_producer.cpp</span> <a name="l00078"></a>00078 <a class="code" href="classCVC3_1_1UFProofRules.html">UFProofRules</a>* <a class="code" href="classCVC3_1_1TheoryUF.html#a5f8eb53743b3755791ce2ed374bad868">createProofRules</a>(); <a name="l00079"></a>00079 <a name="l00080"></a>00080 <span class="comment">// Theory interface</span> <a name="l00081"></a>00081 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a452face1b48cfdd389cee5f9ef693810" title="Notify theory of a new shared term.">addSharedTerm</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00082"></a>00082 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a42e164b13affdc5abdb9e56c43e4242c" title="Assert a new fact to the decision procedure.">assertFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& e); <a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a51e3b956b0e83af64548b0e402611b61" title="Check for satisfiability in the theory.">checkSat</a>(<span class="keywordtype">bool</span> fullEffort); <a name="l00084"></a>00084 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a128eb911fae9a65232037d6cf0c4f0e5" title="Theory-specific rewrite rules.">rewrite</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00085"></a>00085 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a9a004c0e28f9b018db1173635400cc90" title="Set up the term e for call-backs when e or its children change.">setup</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00086"></a>00086 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#ace17a32e291a61b858e0892b21083f5d" title="Notify a theory of a new equality.">update</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& e, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& d); <a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a34d126b5ce21bca5de2d51c834f964b7" title="Check that e is a valid Type expr.">checkType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00088"></a>00088 <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54" title="Enum for cardinality of types.">Cardinality</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a47b4f06fa93d0f190534a35af01fb5f7" title="Compute information related to finiteness of types.">finiteTypeInfo</a>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e, <a class="code" href="classCVC3_1_1Unsigned.html">Unsigned</a>& n, <a name="l00089"></a>00089 <span class="keywordtype">bool</span> enumerate, <span class="keywordtype">bool</span> computeSize); <a name="l00090"></a>00090 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a26061e351f02b3d372efa85d1b250134" title="Compute and store the type of e.">computeType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00091"></a>00091 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a69f52441ffdbcc56cd227380904e4371" title="Compute the base type of the top-level operator of an arbitrary type.">computeBaseType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>& t); <a name="l00092"></a>00092 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#abeee663f7e0372e4b98635be772d0ac5" title="Add variables from 'e' to 'v' for constructing a concrete model.">computeModelTerm</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e, std::vector<Expr>& v); <a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a6b6437208e5cd05563b4be9a83b4ed35" title="Compute the value of a compound variable from the more primitive ones.">computeModel</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e, std::vector<Expr>& vars); <a name="l00094"></a>00094 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="classCVC3_1_1TheoryUF.html#ad39e7c0bacd10a30d33f187afeebcf2e" title="Compute and cache the TCC of e.">computeTCC</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00095"></a>00095 <span class="keyword">virtual</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a43cd4922172049de0dfa948c1b09f81e" title="Theory-specific parsing implemented by the DP.">parseExprOp</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00096"></a>00096 <a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>& <a class="code" href="classCVC3_1_1TheoryUF.html#accc78347b4cda9a9534377d6d9df7eb8" title="Theory-specific pretty-printing.">print</a>(<a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>& os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00097"></a>00097 <span class="comment"></span> <a name="l00098"></a>00098 <span class="comment"> //! Create a new LAMBDA-abstraction</span> <a name="l00099"></a>00099 <span class="comment"></span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a2d7120ba1b7a5525cf06b2064a34e6ba" title="Create a new LAMBDA-abstraction.">lambdaExpr</a>(<span class="keyword">const</span> std::vector<Expr>& vars, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& body);<span class="comment"></span> <a name="l00100"></a>00100 <span class="comment"> //! Create a transitive closure expression</span> <a name="l00101"></a>00101 <span class="comment"></span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="classCVC3_1_1TheoryUF.html#ae9ebc6963f71169466bf7f59acb0363e" title="Create a transitive closure expression.">transClosureExpr</a>(<span class="keyword">const</span> std::string& name, <a name="l00102"></a>00102 <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e1, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e2); <a name="l00103"></a>00103 <span class="keyword">private</span>: <a name="l00104"></a>00104 <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a7e28ba1a365a401e09681b580b37a7de">printSmtLibShared</a>(<a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>& os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e); <a name="l00105"></a>00105 }; <a name="l00106"></a>00106 <a name="l00107"></a>00107 } <a name="l00108"></a>00108 <a name="l00109"></a>00109 <span class="preprocessor">#endif</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Sep 7 2011 for CVC3 by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>