Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 583ffa4ba069126c3ba0bc565dc0485a > files > 1704

cvc3-doc-2.4.1-1.fc15.noarch.rpm

<!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.cpp 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&#160;<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&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;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&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">theory_uf.cpp</div>  </div>
</div>
<div class="contents">
<a href="theory__uf_8cpp.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.cpp</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 24 02:07:59 2003</span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * &lt;hr&gt;</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"> * &lt;hr&gt;</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">#include &quot;<a class="code" href="theory__uf_8h.html">theory_uf.h</a>&quot;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="uf__proof__rules_8h.html" title="Abstract interface for uninterpreted function/predicate proof rules.">uf_proof_rules.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="typecheck__exception_8h.html" title="An exception to be thrown at typecheck error.">typecheck_exception.h</a>&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;<a class="code" href="parser__exception_8h.html" title="An exception thrown by the parser.">parser_exception.h</a>&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="smtlib__exception_8h.html" title="An exception to be thrown by the smtlib translator.">smtlib_exception.h</a>&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="command__line__flags_8h.html">command_line_flags.h</a>&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="theory__core_8h.html">theory_core.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;<a class="code" href="translator_8h.html" title="An exception to be thrown by the smtlib translator.">translator.h</a>&quot;</span>
<a name="l00029"></a>00029 <span class="comment">// HACK: include theory_records.h to access the TUPLE_TYPE kind</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="theory__records_8h.html">theory_records.h</a>&quot;</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keyword">using namespace </span>std;
<a name="l00034"></a>00034 <span class="keyword">using namespace </span>CVC3;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="comment"></span>
<a name="l00037"></a>00037 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00038"></a>00038 <span class="comment"></span><span class="comment">// TheoryUF Public Methods                                                   //</span><span class="comment"></span>
<a name="l00039"></a>00039 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00040"></a>00040 <span class="comment"></span>
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="classCVC3_1_1TheoryUF.html#ac00f7aea61528906495cb96d6c38ecab">00042</a> TheoryUF::TheoryUF(<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)<span class="comment">//, bool useAckermann)</span>
<a name="l00043"></a>00043   : <a class="code" href="classCVC3_1_1Theory.html" title="Base class for theories.">Theory</a>(core, <span class="stringliteral">&quot;Uninterpreted Functions&quot;</span>),
<a name="l00044"></a>00044     d_applicationsInModel(core-&gt;getFlags()[<span class="stringliteral">&quot;applications&quot;</span>].getBool()),
<a name="l00045"></a>00045     d_funApplications(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00046"></a>00046     d_funApplicationsIdx(core-&gt;getCM()-&gt;getCurrentContext(), 0),
<a name="l00047"></a>00047     d_sharedIdx1(core-&gt;getCM()-&gt;getCurrentContext(), 0),
<a name="l00048"></a>00048     d_sharedIdx2(core-&gt;getCM()-&gt;getCurrentContext(), 0),
<a name="l00049"></a>00049     d_sharedTermsMap(core-&gt;getCM()-&gt;getCurrentContext())
<a name="l00050"></a>00050     <span class="comment">//    d_useAckermann(useAckermann)</span>
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052   <a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a> = <a class="code" href="classCVC3_1_1TheoryUF.html#a5f8eb53743b3755791ce2ed374bad868">createProofRules</a>();
<a name="l00053"></a>00053 
<a name="l00054"></a>00054   <span class="comment">// Register new local kinds with ExprManager</span>
<a name="l00055"></a>00055   <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;<a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>, <span class="stringliteral">&quot;_TRANS_CLOSURE&quot;</span>);
<a name="l00056"></a>00056   <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;<a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>, <span class="stringliteral">&quot;_OLD_ARROW&quot;</span>, <span class="keyword">true</span>);
<a name="l00057"></a>00057 
<a name="l00058"></a>00058   vector&lt;int&gt; kinds;
<a name="l00059"></a>00059   <span class="comment">//TODO: should this stuff really be in theory_uf?</span>
<a name="l00060"></a>00060   kinds.push_back(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>);
<a name="l00061"></a>00061   kinds.push_back(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>);
<a name="l00062"></a>00062   kinds.push_back(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>);
<a name="l00063"></a>00063   kinds.push_back(<a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>);
<a name="l00064"></a>00064   kinds.push_back(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a>);
<a name="l00065"></a>00065   kinds.push_back(<a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>);
<a name="l00066"></a>00066 
<a name="l00067"></a>00067   <a class="code" href="classCVC3_1_1Theory.html#a97a6f8e09f71513da969fa7847346c6f" title="Register a new theory.">registerTheory</a>(<span class="keyword">this</span>, kinds);
<a name="l00068"></a>00068 }
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 
<a name="l00071"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a2ffd3c9bab9abb60724448bd0551dc36">00071</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a2ffd3c9bab9abb60724448bd0551dc36">TheoryUF::~TheoryUF</a>() {
<a name="l00072"></a>00072   <span class="keyword">delete</span> <a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>;
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 <span class="comment">//TODO: clean up transitive closure tables</span>
<a name="l00077"></a>00077 <span class="comment">// be sure to free CD objects</span>
<a name="l00078"></a>00078 
<a name="l00079"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a42e164b13affdc5abdb9e56c43e4242c">00079</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a42e164b13affdc5abdb9e56c43e4242c" title="Assert a new fact to the decision procedure.">TheoryUF::assertFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; e)
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; expr = e.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>();
<a name="l00082"></a>00082   <span class="keywordflow">switch</span> (expr.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00083"></a>00083     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba0378ebc895849163b249d0b330257dd6">NOT</a>:
<a name="l00084"></a>00084       <span class="keywordflow">break</span>;
<a name="l00085"></a>00085     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>:
<a name="l00086"></a>00086       <span class="keywordflow">if</span> (expr.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>().<a class="code" href="group__ExprPkg.html#gac3aeac6fba7a1d6cacfe4bd653c5a084">computeTransClosure</a>()) {
<a name="l00087"></a>00087   <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(<a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>-&gt;<a class="code" href="classCVC3_1_1UFProofRules.html#a3a6ee8bd1e49a0a5ce39a7d4c8506d28">relToClosure</a>(e));
<a name="l00088"></a>00088       }
<a name="l00089"></a>00089       <span class="keywordflow">else</span> <span class="keywordflow">if</span> (expr.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>() == <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>) {
<a name="l00090"></a>00090         <span class="comment">// const Expr&amp; rel = expr.getFun();</span>
<a name="l00091"></a>00091         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(expr.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>(), <span class="stringliteral">&quot;Should be apply&quot;</span>);
<a name="l00092"></a>00092         <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> rel = <a class="code" href="classCVC3_1_1Theory.html#a07b326cd94b2bb8bafa39faf07caaec5" title="Resolve an identifier, for use in parseExprOp()">resolveID</a>(expr.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>().<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>());
<a name="l00093"></a>00093         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!rel.isNull(), <span class="stringliteral">&quot;Expected known identifier&quot;</span>);
<a name="l00094"></a>00094         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(rel.isSymbol() &amp;&amp; rel.getKind()==<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a> &amp;&amp; expr.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()==2,
<a name="l00095"></a>00095                     <span class="stringliteral">&quot;Unexpected use of transitive closure: &quot;</span>+expr.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00096"></a>00096 
<a name="l00097"></a>00097         <span class="comment">// Insert into transitive closure table</span>
<a name="l00098"></a>00098         <a class="code" href="classCVC3_1_1ExprMap.html">ExprMap&lt;TCMapPair*&gt;::iterator</a> i = <a class="code" href="classCVC3_1_1TheoryUF.html#a7e7a38e729bf36884241e8e8e239dba4">d_transClosureMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#ae50ab1874dd63b575553e7db769abe28">find</a>(rel);
<a name="l00099"></a>00099         <a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html">TCMapPair</a>* pTable;
<a name="l00100"></a>00100         <span class="keywordflow">if</span> (i == <a class="code" href="classCVC3_1_1TheoryUF.html#a7e7a38e729bf36884241e8e8e239dba4">d_transClosureMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#a283ae6c44308cbdda0d82da5a16e52c8">end</a>()) {
<a name="l00101"></a>00101           pTable = <span class="keyword">new</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a99f45ac6d21871fdc4a0b5874563939d">TCMapPair</a>();
<a name="l00102"></a>00102           <a class="code" href="classCVC3_1_1TheoryUF.html#a7e7a38e729bf36884241e8e8e239dba4">d_transClosureMap</a>[rel] = pTable;
<a name="l00103"></a>00103         }
<a name="l00104"></a>00104         <span class="keywordflow">else</span> {
<a name="l00105"></a>00105           pTable = (*i).second;
<a name="l00106"></a>00106         }
<a name="l00107"></a>00107 
<a name="l00108"></a>00108         <a class="code" href="classCVC3_1_1ExprMap.html">ExprMap&lt;CDList&lt;Theorem&gt;</a>*&gt;::iterator i2 = pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a9e3dbe418924f988b04289634927c7f6">appearsFirstMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#ae50ab1874dd63b575553e7db769abe28">find</a>(expr[0]);
<a name="l00109"></a>00109         <a class="code" href="classCVC3_1_1CDList.html">CDList&lt;Theorem&gt;</a>* pList;
<a name="l00110"></a>00110         <span class="keywordflow">if</span> (i2 == pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a9e3dbe418924f988b04289634927c7f6">appearsFirstMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#a283ae6c44308cbdda0d82da5a16e52c8">end</a>()) {
<a name="l00111"></a>00111           pList = <span class="keyword">new</span>(<span class="keyword">true</span>) <a class="code" href="classCVC3_1_1CDList.html">CDList&lt;Theorem&gt;</a>(<a class="code" href="classCVC3_1_1Theory.html#a90684d2a97738341c00f8f9c99af7b66" title="Get a pointer to theoryCore.">theoryCore</a>()-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-&gt;<a class="code" href="classCVC3_1_1ContextManager.html#a66a7d900301c1459de90b048623d9297">getCurrentContext</a>());
<a name="l00112"></a>00112           pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a9e3dbe418924f988b04289634927c7f6">appearsFirstMap</a>[expr[0]] = pList;
<a name="l00113"></a>00113         }
<a name="l00114"></a>00114         <span class="keywordflow">else</span> {
<a name="l00115"></a>00115           pList = (*i2).second;
<a name="l00116"></a>00116         }
<a name="l00117"></a>00117         pList-&gt;<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(e);
<a name="l00118"></a>00118 
<a name="l00119"></a>00119         i2 = pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a3188576390aa926a1cda9571d7a45b65">appearsSecondMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#ae50ab1874dd63b575553e7db769abe28">find</a>(expr[1]);
<a name="l00120"></a>00120         <span class="keywordflow">if</span> (i2 == pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a3188576390aa926a1cda9571d7a45b65">appearsSecondMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#a283ae6c44308cbdda0d82da5a16e52c8">end</a>()) {
<a name="l00121"></a>00121           pList = <span class="keyword">new</span>(<span class="keyword">true</span>) <a class="code" href="classCVC3_1_1CDList.html">CDList&lt;Theorem&gt;</a>(<a class="code" href="classCVC3_1_1Theory.html#a90684d2a97738341c00f8f9c99af7b66" title="Get a pointer to theoryCore.">theoryCore</a>()-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-&gt;<a class="code" href="classCVC3_1_1ContextManager.html#a66a7d900301c1459de90b048623d9297">getCurrentContext</a>());
<a name="l00122"></a>00122           pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a3188576390aa926a1cda9571d7a45b65">appearsSecondMap</a>[expr[1]] = pList;
<a name="l00123"></a>00123         }
<a name="l00124"></a>00124         <span class="keywordflow">else</span> {
<a name="l00125"></a>00125           pList = (*i2).second;
<a name="l00126"></a>00126         }
<a name="l00127"></a>00127         pList-&gt;<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(e);
<a name="l00128"></a>00128 
<a name="l00129"></a>00129         <span class="comment">// Compute transitive closure with existing relations</span>
<a name="l00130"></a>00130         <span class="keywordtype">size_t</span> s,l;
<a name="l00131"></a>00131         i2 = pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a9e3dbe418924f988b04289634927c7f6">appearsFirstMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#ae50ab1874dd63b575553e7db769abe28">find</a>(expr[1]);
<a name="l00132"></a>00132         <span class="keywordflow">if</span> (i2 != pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a9e3dbe418924f988b04289634927c7f6">appearsFirstMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#a283ae6c44308cbdda0d82da5a16e52c8">end</a>()) {
<a name="l00133"></a>00133           pList = (*i2).second;
<a name="l00134"></a>00134           s = pList-&gt;<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l00135"></a>00135           <span class="keywordflow">for</span> (l = 0; l &lt; s; ++l) {
<a name="l00136"></a>00136             <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(<a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>-&gt;<a class="code" href="classCVC3_1_1UFProofRules.html#ab66928a2bf8ea96c965023cbe5e021e4">relTrans</a>(e,(*pList)[l]));
<a name="l00137"></a>00137           }
<a name="l00138"></a>00138         }
<a name="l00139"></a>00139 
<a name="l00140"></a>00140         i2 = pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a3188576390aa926a1cda9571d7a45b65">appearsSecondMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#ae50ab1874dd63b575553e7db769abe28">find</a>(expr[0]);
<a name="l00141"></a>00141         <span class="keywordflow">if</span> (i2 != pTable-&gt;<a class="code" href="structCVC3_1_1TheoryUF_1_1TCMapPair.html#a3188576390aa926a1cda9571d7a45b65">appearsSecondMap</a>.<a class="code" href="classCVC3_1_1ExprMap.html#a283ae6c44308cbdda0d82da5a16e52c8">end</a>()) {
<a name="l00142"></a>00142           pList = (*i2).second;
<a name="l00143"></a>00143           s = pList-&gt;<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l00144"></a>00144           <span class="keywordflow">for</span> (l = 0; l &lt; s; ++l) {
<a name="l00145"></a>00145             <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(<a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>-&gt;<a class="code" href="classCVC3_1_1UFProofRules.html#ab66928a2bf8ea96c965023cbe5e021e4">relTrans</a>((*pList)[l],e));
<a name="l00146"></a>00146           }
<a name="l00147"></a>00147         }
<a name="l00148"></a>00148       }
<a name="l00149"></a>00149       <span class="keywordflow">break</span>;
<a name="l00150"></a>00150     <span class="keywordflow">default</span>:
<a name="l00151"></a>00151       <span class="keywordflow">break</span>;
<a name="l00152"></a>00152   }
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154 
<a name="l00155"></a>00155 
<a name="l00156"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a51e3b956b0e83af64548b0e402611b61">00156</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a51e3b956b0e83af64548b0e402611b61" title="Check for satisfiability in the theory.">TheoryUF::checkSat</a>(<span class="keywordtype">bool</span> fullEffort)
<a name="l00157"></a>00157 {
<a name="l00158"></a>00158   <span class="comment">// Check for any unexpanded lambdas</span>
<a name="l00159"></a>00159   <span class="keywordtype">bool</span> enqueued = <span class="keyword">false</span>;
<a name="l00160"></a>00160   <span class="keywordflow">for</span>(; <a class="code" href="classCVC3_1_1TheoryUF.html#ae8387e395bd085233c0fd5d37fa086cd" title="Pointer to the last unprocessed element (for lambda expansions)">d_funApplicationsIdx</a> &lt; <a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l00161"></a>00161       <a class="code" href="classCVC3_1_1TheoryUF.html#ae8387e395bd085233c0fd5d37fa086cd" title="Pointer to the last unprocessed element (for lambda expansions)">d_funApplicationsIdx</a> = <a class="code" href="classCVC3_1_1TheoryUF.html#ae8387e395bd085233c0fd5d37fa086cd" title="Pointer to the last unprocessed element (for lambda expansions)">d_funApplicationsIdx</a> + 1) {
<a name="l00162"></a>00162     <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e = <a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>[<a class="code" href="classCVC3_1_1TheoryUF.html#ae8387e395bd085233c0fd5d37fa086cd" title="Pointer to the last unprocessed element (for lambda expansions)">d_funApplicationsIdx</a>];
<a name="l00163"></a>00163     <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>().<a class="code" href="group__ExprPkg.html#ga165dba5b9e9502059c3cf01bddf4fe1e">isLambda</a>()) {
<a name="l00164"></a>00164       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;Expanded lambdas (checkSat)&quot;</span>)++;)
<a name="l00165"></a>00165       <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(<a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>-&gt;<a class="code" href="classCVC3_1_1UFProofRules.html#aa9560710733459819ed2108b7d98119b" title="Beta reduction: |- (lambda x. f(x))(arg) = f(arg)">applyLambda</a>(e));
<a name="l00166"></a>00166       enqueued = <span class="keyword">true</span>;
<a name="l00167"></a>00167     }
<a name="l00168"></a>00168   }
<a name="l00169"></a>00169 
<a name="l00170"></a>00170   <span class="comment">// If something has been returned, we are done</span>
<a name="l00171"></a>00171   <span class="keywordflow">if</span> (!fullEffort || enqueued) <span class="keywordflow">return</span>;
<a name="l00172"></a>00172 
<a name="l00173"></a>00173   <span class="comment">// Expand on the shared terms</span>
<a name="l00174"></a>00174   <span class="keywordflow">for</span>( ; <a class="code" href="classCVC3_1_1TheoryUF.html#a48545e083f3c4d152d7f79aec75fcbcd" title="The pointers to the last unprocessed shared pair.">d_sharedIdx1</a> &lt; <a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</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#a48545e083f3c4d152d7f79aec75fcbcd" title="The pointers to the last unprocessed shared pair.">d_sharedIdx1</a>
<a name="l00175"></a>00175       + 1, <a class="code" href="classCVC3_1_1TheoryUF.html#a80f414cb2926646f3028983ddc1eccac">d_sharedIdx2</a> = 0 ) {
<a name="l00176"></a>00176     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> f1 = <a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>[<a class="code" href="classCVC3_1_1TheoryUF.html#a48545e083f3c4d152d7f79aec75fcbcd" title="The pointers to the last unprocessed shared pair.">d_sharedIdx1</a>];
<a name="l00177"></a>00177     <span class="keywordflow">if</span>( f1.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a> &amp;&amp; !f1.<a class="code" href="group__ExprPkg.html#gae281b04465cc1bf24b5797c8b5e9cbb4">getSig</a>().<a class="code" href="classCVC3_1_1Theorem.html#afc6fdb0507eb3669e28d9be5ed0bd333">isNull</a>() ) {
<a name="l00178"></a>00178       f1 = f1.<a class="code" href="group__ExprPkg.html#gae281b04465cc1bf24b5797c8b5e9cbb4">getSig</a>().<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00179"></a>00179       <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> f1_fun = f1.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>();
<a name="l00180"></a>00180       <span class="keywordflow">for</span>( ; d_sharedIdx2 &lt; <a class="code" href="classCVC3_1_1TheoryUF.html#a48545e083f3c4d152d7f79aec75fcbcd" title="The pointers to the last unprocessed shared pair.">d_sharedIdx1</a>; d_sharedIdx2 = d_sharedIdx2 + 1 ) {
<a name="l00181"></a>00181         <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> f2 = <a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>[<a class="code" href="classCVC3_1_1TheoryUF.html#a80f414cb2926646f3028983ddc1eccac">d_sharedIdx2</a>];
<a name="l00182"></a>00182         <span class="keywordflow">if</span> (f2.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a> &amp;&amp; !f2.<a class="code" href="group__ExprPkg.html#gae281b04465cc1bf24b5797c8b5e9cbb4">getSig</a>().<a class="code" href="classCVC3_1_1Theorem.html#afc6fdb0507eb3669e28d9be5ed0bd333">isNull</a>() ) {
<a name="l00183"></a>00183           f2 = f2.<a class="code" href="group__ExprPkg.html#gae281b04465cc1bf24b5797c8b5e9cbb4">getSig</a>().<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00184"></a>00184           <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> f2_fun = f2.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>();
<a name="l00185"></a>00185           <span class="keywordflow">if</span>( f1 != f2 &amp;&amp; <a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(f1).getRHS() != <a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(f2).getRHS() &amp;&amp; f1_fun == f2_fun ) {
<a name="l00186"></a>00186             <span class="keywordflow">for</span>( <span class="keywordtype">int</span> k = 0; k &lt; f1.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); ++k ) {
<a name="l00187"></a>00187               <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> x_k = f1[k];
<a name="l00188"></a>00188               <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> y_k = f2[k];
<a name="l00189"></a>00189               <span class="keywordflow">if</span>( <a class="code" href="classCVC3_1_1TheoryUF.html#ac15e725de0573cf067ebb9c91b14f9a3" title="The set of all shared terms.">d_sharedTermsMap</a>.<a class="code" href="classCVC3_1_1CDMap.html#a1cadecbd2d6fa614a2f2e9419aa43f33">find</a>(x_k) == <a class="code" href="classCVC3_1_1TheoryUF.html#ac15e725de0573cf067ebb9c91b14f9a3" title="The set of all shared terms.">d_sharedTermsMap</a>.<a class="code" href="classCVC3_1_1CDMap.html#a2a26c7cc4db12cb17d273db5cfa5a890">end</a>() )
<a name="l00190"></a>00190                 <span class="keywordflow">continue</span>;
<a name="l00191"></a>00191               <span class="keywordflow">if</span>( <a class="code" href="classCVC3_1_1TheoryUF.html#ac15e725de0573cf067ebb9c91b14f9a3" title="The set of all shared terms.">d_sharedTermsMap</a>.<a class="code" href="classCVC3_1_1CDMap.html#a1cadecbd2d6fa614a2f2e9419aa43f33">find</a>(y_k) == <a class="code" href="classCVC3_1_1TheoryUF.html#ac15e725de0573cf067ebb9c91b14f9a3" title="The set of all shared terms.">d_sharedTermsMap</a>.<a class="code" href="classCVC3_1_1CDMap.html#a2a26c7cc4db12cb17d273db5cfa5a890">end</a>() )
<a name="l00192"></a>00192                 <span class="keywordflow">continue</span>;
<a name="l00193"></a>00193               <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> eq = x_k.<a class="code" href="group__ExprPkg.html#gacb48495ca445c895f95d0c3c1ae2070b">eqExpr</a>(y_k);
<a name="l00194"></a>00194               <span class="keywordflow">if</span>( !<a class="code" href="classCVC3_1_1Theory.html#a52158688456f8605b064fbbf7a46039c" title="Simplify a term e and return a Theorem(e==e&#39;)">simplify</a>(eq).getRHS().isBoolConst() ) {
<a name="l00195"></a>00195                 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;sharing&quot;</span>, <span class="stringliteral">&quot;splitting &quot;</span> + y_k.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>(), <span class="stringliteral">&quot; and &quot;</span>, x_k.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00196"></a>00196                 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;sharing&quot;</span>, <span class="stringliteral">&quot;from &quot;</span> + f2.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>(), <span class="stringliteral">&quot; and &quot;</span>, f1.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00197"></a>00197                 <a class="code" href="classCVC3_1_1Theory.html#a605e960d2442b587046c562723b7f03a" title="Suggest a splitter to the SearchEngine.">addSplitter</a>(eq);
<a name="l00198"></a>00198                 enqueued = <span class="keyword">true</span>;
<a name="l00199"></a>00199               }
<a name="l00200"></a>00200             }
<a name="l00201"></a>00201             <span class="keywordflow">if</span>( enqueued )
<a name="l00202"></a>00202               <span class="keywordflow">return</span>;
<a name="l00203"></a>00203           }
<a name="l00204"></a>00204         }
<a name="l00205"></a>00205       }
<a name="l00206"></a>00206     }
<a name="l00207"></a>00207   }
<a name="l00208"></a>00208 }
<a name="l00209"></a>00209 
<a name="l00210"></a>00210 
<a name="l00211"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a128eb911fae9a65232037d6cf0c4f0e5">00211</a> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a128eb911fae9a65232037d6cf0c4f0e5" title="Theory-specific rewrite rules.">TheoryUF::rewrite</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e)
<a name="l00212"></a>00212 {
<a name="l00213"></a>00213   <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>()) {
<a name="l00214"></a>00214     <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; op = e.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>();
<a name="l00215"></a>00215     <span class="keywordtype">int</span> opKind = op.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>(); 
<a name="l00216"></a>00216     <span class="keywordflow">switch</span>(opKind) {
<a name="l00217"></a>00217       <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>: {
<a name="l00218"></a>00218         <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> res = <a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>-&gt;<a class="code" href="classCVC3_1_1UFProofRules.html#aa9560710733459819ed2108b7d98119b" title="Beta reduction: |- (lambda x. f(x))(arg) = f(arg)">applyLambda</a>(e);
<a name="l00219"></a>00219         <span class="comment">// Simplify recursively</span>
<a name="l00220"></a>00220         res = <a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) &amp; (a2 == a3) ==&gt; (a1 == a3)">transitivityRule</a>(res, <a class="code" href="classCVC3_1_1Theory.html#a52158688456f8605b064fbbf7a46039c" title="Simplify a term e and return a Theorem(e==e&#39;)">simplify</a>(res.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>()));
<a name="l00221"></a>00221         <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;Expanded lambdas&quot;</span>)++;)
<a name="l00222"></a>00222         <span class="keywordflow">return</span> res;
<a name="l00223"></a>00223       }
<a name="l00224"></a>00224       <span class="keywordflow">default</span>: <span class="comment">// A truly uninterpreted function</span>
<a name="l00225"></a>00225         <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>().<a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">isBool</a>()) <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Theory.html#af860f5d5e01423628c97c399606916ff" title="==&gt; a == a">reflexivityRule</a>(e);
<a name="l00226"></a>00226         <span class="keywordflow">else</span> <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Theory.html#a2d91d71489b0c0a9822cef765326bc89" title="Rewrite a term w.r.t. congruence closure (must be setup with setupCC())">rewriteCC</a>(e);
<a name="l00227"></a>00227     }
<a name="l00228"></a>00228   }
<a name="l00229"></a>00229   <span class="keywordflow">else</span> {
<a name="l00230"></a>00230     e.<a class="code" href="group__ExprPkg.html#ga06284723527dbaa4784949f63f586877">setRewriteNormal</a>();
<a name="l00231"></a>00231     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Theory.html#af860f5d5e01423628c97c399606916ff" title="==&gt; a == a">reflexivityRule</a>(e);
<a name="l00232"></a>00232   }
<a name="l00233"></a>00233 }
<a name="l00234"></a>00234 
<a name="l00235"></a>00235 
<a name="l00236"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a9a004c0e28f9b018db1173635400cc90">00236</a> <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.">TheoryUF::setup</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e)
<a name="l00237"></a>00237 {
<a name="l00238"></a>00238   <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#gad527acb49daef3591b78c748746e7eef" title="Test if e is a term (as opposed to a predicate/formula)">isTerm</a>() &amp;&amp; e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>().<a class="code" href="classCVC3_1_1Type.html#a79df1e87774d07af2e0f1e63ef9a5898" title="Return cardinality of type.">card</a>() != <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54ad4a45eb68b0ebb32f0c805f6d2abf6d6">CARD_INFINITE</a>) {
<a name="l00239"></a>00239     <a class="code" href="classCVC3_1_1TheoryUF.html#a452face1b48cfdd389cee5f9ef693810" title="Notify theory of a new shared term.">addSharedTerm</a>(e);
<a name="l00240"></a>00240     <a class="code" href="classCVC3_1_1Theory.html#a01fa8047ed1f649dc98831cb536187e4" title="Return the theory associated with a kind.">theoryOf</a>(e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>())-&gt;<a class="code" href="classCVC3_1_1TheoryUF.html#a452face1b48cfdd389cee5f9ef693810" title="Notify theory of a new shared term.">addSharedTerm</a>(e);
<a name="l00241"></a>00241   }
<a name="l00242"></a>00242   <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>() != <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>) <span class="keywordflow">return</span>;
<a name="l00243"></a>00243 <span class="comment">//   if (d_useAckermann) {</span>
<a name="l00244"></a>00244 <span class="comment">//     Theorem thm = getCommonRules()-&gt;varIntroSkolem(e);</span>
<a name="l00245"></a>00245 <span class="comment">//     theoryCore()-&gt;addToVarDB(thm.getRHS());</span>
<a name="l00246"></a>00246 <span class="comment">//     enqueueFact(thm);</span>
<a name="l00247"></a>00247 <span class="comment">//   }</span>
<a name="l00248"></a>00248 <span class="comment">//   else {</span>
<a name="l00249"></a>00249     <a class="code" href="classCVC3_1_1Theory.html#a29cc343040a52a299a4f20123edf4c75" title="Setup a term for congruence closure (must have sig and rep attributes)">setupCC</a>(e);
<a name="l00250"></a>00250 <span class="comment">//   }</span>
<a name="l00251"></a>00251   <span class="comment">// Add this function application for concrete model generation</span>
<a name="l00252"></a>00252   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;model&quot;</span>, <span class="stringliteral">&quot;TheoryUF: add function application &quot;</span>, e, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00253"></a>00253   <a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>.<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(e);
<a name="l00254"></a>00254 }
<a name="l00255"></a>00255 
<a name="l00256"></a>00256 
<a name="l00257"></a><a class="code" href="classCVC3_1_1TheoryUF.html#ace17a32e291a61b858e0892b21083f5d">00257</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#ace17a32e291a61b858e0892b21083f5d" title="Notify a theory of a new equality.">TheoryUF::update</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; e, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; d)
<a name="l00258"></a>00258 {
<a name="l00259"></a>00259   <span class="comment">/*</span>
<a name="l00260"></a>00260 <span class="comment">  int k, ar(d.arity());</span>
<a name="l00261"></a>00261 <span class="comment">  const Theorem&amp; dEQdsig = d.getSig();</span>
<a name="l00262"></a>00262 <span class="comment">  if (!dEQdsig.isNull()) {</span>
<a name="l00263"></a>00263 <span class="comment">    Expr dsig = dEQdsig.getRHS();</span>
<a name="l00264"></a>00264 <span class="comment">    Theorem thm = updateHelper(d);</span>
<a name="l00265"></a>00265 <span class="comment">    const Expr&amp; sigNew = thm.getRHS();</span>
<a name="l00266"></a>00266 <span class="comment">    if (sigNew == dsig) return;</span>
<a name="l00267"></a>00267 <span class="comment">    dsig.setRep(Theorem());</span>
<a name="l00268"></a>00268 <span class="comment">    const Theorem&amp; repEQsigNew = sigNew.getRep();</span>
<a name="l00269"></a>00269 <span class="comment">    if (!repEQsigNew.isNull()) {</span>
<a name="l00270"></a>00270 <span class="comment">      d.setSig(Theorem());</span>
<a name="l00271"></a>00271 <span class="comment">      enqueueFact(transitivityRule(repEQsigNew, symmetryRule(thm)));</span>
<a name="l00272"></a>00272 <span class="comment">    }</span>
<a name="l00273"></a>00273 <span class="comment">    else {</span>
<a name="l00274"></a>00274 <span class="comment">      for (k = 0; k &lt; ar; ++k) {</span>
<a name="l00275"></a>00275 <span class="comment">  if (sigNew[k] != dsig[k]) {</span>
<a name="l00276"></a>00276 <span class="comment">    sigNew[k].addToNotify(this, d);</span>
<a name="l00277"></a>00277 <span class="comment">  }</span>
<a name="l00278"></a>00278 <span class="comment">      }</span>
<a name="l00279"></a>00279 <span class="comment">      d.setSig(thm);</span>
<a name="l00280"></a>00280 <span class="comment">      sigNew.setRep(thm);</span>
<a name="l00281"></a>00281 <span class="comment"></span>
<a name="l00282"></a>00282 <span class="comment">      if (d_compute_trans_closure &amp;&amp; d.getKind() == APPLY &amp;&amp;</span>
<a name="l00283"></a>00283 <span class="comment">    d.arity() == 2 &amp;&amp; findExpr(d).isTrue()) {</span>
<a name="l00284"></a>00284 <span class="comment">  thm = iffTrueElim(transitivityRule(symmetryRule(thm),find(d)));</span>
<a name="l00285"></a>00285 <span class="comment">  enqueueFact(d_rules-&gt;relToClosure(thm));</span>
<a name="l00286"></a>00286 <span class="comment">      }</span>
<a name="l00287"></a>00287 <span class="comment"></span>
<a name="l00288"></a>00288 <span class="comment">    }</span>
<a name="l00289"></a>00289 <span class="comment">  }</span>
<a name="l00290"></a>00290 <span class="comment">  */</span>
<a name="l00291"></a>00291   <span class="comment">// Record the original signature</span>
<a name="l00292"></a>00292   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; dEQdsig = d.<a class="code" href="group__ExprPkg.html#gae281b04465cc1bf24b5797c8b5e9cbb4">getSig</a>();
<a name="l00293"></a>00293   <span class="keywordflow">if</span> (!dEQdsig.<a class="code" href="classCVC3_1_1Theorem.html#afc6fdb0507eb3669e28d9be5ed0bd333">isNull</a>()) {
<a name="l00294"></a>00294     <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; dsig = dEQdsig.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00295"></a>00295     <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm = <a class="code" href="classCVC3_1_1Theory.html#ad6cb45844df7f1b08a53e41e40a362e3" title="Update the children of the term e.">updateHelper</a>(d);
<a name="l00296"></a>00296     <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; sigNew = thm.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00297"></a>00297     <span class="keywordflow">if</span> (sigNew == dsig) {
<a name="l00298"></a>00298       <span class="comment">//      TRACE_MSG(&quot;facts update&quot;, &quot;updateCC[&quot;+getName()+&quot;]() [no change] =&gt; }&quot;);</span>
<a name="l00299"></a>00299       <span class="keywordflow">return</span>;
<a name="l00300"></a>00300     }
<a name="l00301"></a>00301     dsig.<a class="code" href="group__ExprPkg.html#ga7b85677789c5a03e1a5dc2c93f0b6288">setRep</a>(<a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>());
<a name="l00302"></a>00302     <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; repEQsigNew = sigNew.<a class="code" href="group__ExprPkg.html#gaa4b5652980861e593ab8a741b5521779">getRep</a>();
<a name="l00303"></a>00303     <span class="keywordflow">if</span> (!repEQsigNew.<a class="code" href="classCVC3_1_1Theorem.html#afc6fdb0507eb3669e28d9be5ed0bd333">isNull</a>()) {
<a name="l00304"></a>00304       d.<a class="code" href="group__ExprPkg.html#gaaaba7ddaccd58bd37e3259fe9b949645">setSig</a>(<a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>());
<a name="l00305"></a>00305       <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(<a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) &amp; (a2 == a3) ==&gt; (a1 == a3)">transitivityRule</a>(repEQsigNew, <a class="code" href="classCVC3_1_1Theory.html#a7440711981ac1bba2bed7476c0fa4e0b" title="a1 == a2 ==&gt; a2 == a1">symmetryRule</a>(thm)));
<a name="l00306"></a>00306     }
<a name="l00307"></a>00307     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (d.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>().<a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">isBool</a>()) {
<a name="l00308"></a>00308       d.<a class="code" href="group__ExprPkg.html#gaaaba7ddaccd58bd37e3259fe9b949645">setSig</a>(<a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>());
<a name="l00309"></a>00309       <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(thm);
<a name="l00310"></a>00310     }
<a name="l00311"></a>00311     <span class="keywordflow">else</span> {
<a name="l00312"></a>00312       <span class="keywordtype">int</span> k, ar(d.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>());
<a name="l00313"></a>00313       <span class="keywordflow">for</span> (k = 0; k &lt; ar; ++k) {
<a name="l00314"></a>00314   <span class="keywordflow">if</span> (sigNew[k] != dsig[k]) {
<a name="l00315"></a>00315     sigNew[k].<a class="code" href="group__ExprPkg.html#ga159d60cb0f32e09df89a395b2680664a" title="Add (e,i) to the notify list of this expression.">addToNotify</a>(<span class="keyword">this</span>, d);
<a name="l00316"></a>00316   }
<a name="l00317"></a>00317       }
<a name="l00318"></a>00318       d.<a class="code" href="group__ExprPkg.html#gaaaba7ddaccd58bd37e3259fe9b949645">setSig</a>(thm);
<a name="l00319"></a>00319       sigNew.<a class="code" href="group__ExprPkg.html#ga7b85677789c5a03e1a5dc2c93f0b6288">setRep</a>(thm);
<a name="l00320"></a>00320       <span class="keywordflow">if</span> (dsig != sigNew &amp;&amp; d.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>() &amp;&amp; <a class="code" href="classCVC3_1_1Theory.html#a08412b310cb743536f7edd9fccd60e46" title="Return the find of e, or e if it has no find.">findExpr</a>(d).<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>()) {
<a name="l00321"></a>00321         <span class="keywordflow">if</span> (d.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>().<a class="code" href="group__ExprPkg.html#gac3aeac6fba7a1d6cacfe4bd653c5a084">computeTransClosure</a>()) {
<a name="l00322"></a>00322           thm = <a class="code" href="classCVC3_1_1Theory.html#a50802b148e8192178cf790e6c45ddff3" title="Get a pointer to common proof rules.">getCommonRules</a>()-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#ad2edb920405666bf6e9d21ae496ff6b3">iffTrueElim</a>(<a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) &amp; (a2 == a3) ==&gt; (a1 == a3)">transitivityRule</a>(<a class="code" href="classCVC3_1_1Theory.html#a7440711981ac1bba2bed7476c0fa4e0b" title="a1 == a2 ==&gt; a2 == a1">symmetryRule</a>(thm),
<a name="l00323"></a>00323                                                                <a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(d)));
<a name="l00324"></a>00324           <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(<a class="code" href="classCVC3_1_1TheoryUF.html#afd242395132e65f59563689a3053d083">d_rules</a>-&gt;<a class="code" href="classCVC3_1_1UFProofRules.html#a3a6ee8bd1e49a0a5ce39a7d4c8506d28">relToClosure</a>(thm));
<a name="l00325"></a>00325         }
<a name="l00326"></a>00326         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (d.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>() == <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>) {
<a name="l00327"></a>00327           thm = <a class="code" href="classCVC3_1_1Theory.html#a50802b148e8192178cf790e6c45ddff3" title="Get a pointer to common proof rules.">getCommonRules</a>()-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#ad2edb920405666bf6e9d21ae496ff6b3">iffTrueElim</a>(<a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) &amp; (a2 == a3) ==&gt; (a1 == a3)">transitivityRule</a>(<a class="code" href="classCVC3_1_1Theory.html#a7440711981ac1bba2bed7476c0fa4e0b" title="a1 == a2 ==&gt; a2 == a1">symmetryRule</a>(thm),
<a name="l00328"></a>00328                                                                <a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(d)));
<a name="l00329"></a>00329           <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(thm);
<a name="l00330"></a>00330         }
<a name="l00331"></a>00331       }
<a name="l00332"></a>00332     }
<a name="l00333"></a>00333   }
<a name="l00334"></a>00334 }
<a name="l00335"></a>00335 
<a name="l00336"></a>00336 
<a name="l00337"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a34d126b5ce21bca5de2d51c834f964b7">00337</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a34d126b5ce21bca5de2d51c834f964b7" title="Check that e is a valid Type expr.">TheoryUF::checkType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e)
<a name="l00338"></a>00338 {
<a name="l00339"></a>00339   <span class="keywordflow">switch</span> (e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00340"></a>00340     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>: {
<a name="l00341"></a>00341       <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2) <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1Exception.html">Exception</a>
<a name="l00342"></a>00342             (<span class="stringliteral">&quot;Function type needs at least two arguments&quot;</span>
<a name="l00343"></a>00343              +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00344"></a>00344       <a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i = e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend = e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>();
<a name="l00345"></a>00345       <span class="keywordflow">for</span> (; i != iend; ) {
<a name="l00346"></a>00346         <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> t(*i);
<a name="l00347"></a>00347         ++i;
<a name="l00348"></a>00348         <span class="keywordflow">if</span> (i == iend &amp;&amp; t.<a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">isBool</a>()) <span class="keywordflow">break</span>;
<a name="l00349"></a>00349         <span class="keywordflow">if</span> (t.<a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">isBool</a>()) <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1Exception.html">Exception</a>
<a name="l00350"></a>00350             (<span class="stringliteral">&quot;Function argument types must be non-Boolean: &quot;</span>
<a name="l00351"></a>00351              +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00352"></a>00352         <span class="keywordflow">if</span> (t.<a class="code" href="classCVC3_1_1Type.html#a9c3be568546a63fb424e4cb49391dfa6">isFunction</a>()) <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1Exception.html">Exception</a>
<a name="l00353"></a>00353             (<span class="stringliteral">&quot;Function domain or range types cannot be functions: &quot;</span>
<a name="l00354"></a>00354              +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00355"></a>00355       }
<a name="l00356"></a>00356       <span class="keywordflow">break</span>;
<a name="l00357"></a>00357     }
<a name="l00358"></a>00358     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>: {
<a name="l00359"></a>00359       <span class="keywordflow">break</span>;
<a name="l00360"></a>00360     }
<a name="l00361"></a>00361     <span class="keywordflow">default</span>:
<a name="l00362"></a>00362       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">&quot;Unexpected kind in TheoryUF::checkType&quot;</span>
<a name="l00363"></a>00363                   +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;getKindName(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()));
<a name="l00364"></a>00364   }
<a name="l00365"></a>00365 }
<a name="l00366"></a>00366 
<a name="l00367"></a>00367 
<a name="l00368"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a47b4f06fa93d0f190534a35af01fb5f7">00368</a> <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.">TheoryUF::finiteTypeInfo</a>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e, <a class="code" href="classCVC3_1_1Unsigned.html">Unsigned</a>&amp; n,
<a name="l00369"></a>00369                                      <span class="keywordtype">bool</span> enumerate, <span class="keywordtype">bool</span> computeSize)
<a name="l00370"></a>00370 {
<a name="l00371"></a>00371   <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>() != <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>) {
<a name="l00372"></a>00372     <span class="comment">// uninterpreted type</span>
<a name="l00373"></a>00373     <span class="keywordflow">return</span> <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54a61454dbfa122fc961909dfd151695807">CARD_UNKNOWN</a>;
<a name="l00374"></a>00374   }
<a name="l00375"></a>00375   <a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i = e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend = e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>();
<a name="l00376"></a>00376   <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54" title="Enum for cardinality of types.">Cardinality</a> card = <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54ac1ba3119b0fd85d3e54c69601ec1ccca">CARD_FINITE</a>, cardTmp;
<a name="l00377"></a>00377   <a class="code" href="classCVC3_1_1Unsigned.html">Unsigned</a> thisSize = 1, size;
<a name="l00378"></a>00378   <span class="keywordtype">bool</span> getSize = enumerate || computeSize;
<a name="l00379"></a>00379   <span class="keywordflow">for</span> (; i != iend; ) {
<a name="l00380"></a>00380     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> e2 = (*i);
<a name="l00381"></a>00381     cardTmp = <a class="code" href="classCVC3_1_1Theory.html#a01fa8047ed1f649dc98831cb536187e4" title="Return the theory associated with a kind.">theoryOf</a>(e2)-&gt;<a class="code" href="group__Theory__API.html#ga166b2a0c7ec3b09e079c2f84bb6087bc" title="Compute information related to finiteness of types.">finiteTypeInfo</a>(e2, size, getSize, <span class="keyword">false</span>);
<a name="l00382"></a>00382     <span class="keywordflow">if</span> (cardTmp == <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54ad4a45eb68b0ebb32f0c805f6d2abf6d6">CARD_INFINITE</a>) {
<a name="l00383"></a>00383       <span class="keywordflow">return</span> <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54ad4a45eb68b0ebb32f0c805f6d2abf6d6">CARD_INFINITE</a>;
<a name="l00384"></a>00384     }
<a name="l00385"></a>00385     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (cardTmp == <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54a61454dbfa122fc961909dfd151695807">CARD_UNKNOWN</a>) {
<a name="l00386"></a>00386       card = <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54a61454dbfa122fc961909dfd151695807">CARD_UNKNOWN</a>;
<a name="l00387"></a>00387       getSize = <span class="keyword">false</span>;
<a name="l00388"></a>00388       <span class="comment">// Keep looking to see if we can determine it is infinite</span>
<a name="l00389"></a>00389     }
<a name="l00390"></a>00390     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (getSize) {
<a name="l00391"></a>00391       thisSize = thisSize * size;
<a name="l00392"></a>00392       <span class="comment">// Give up if it gets too big</span>
<a name="l00393"></a>00393       <span class="keywordflow">if</span> (thisSize &gt; 1000000) thisSize = 0;
<a name="l00394"></a>00394       <span class="keywordflow">if</span> (thisSize == 0) {
<a name="l00395"></a>00395         getSize = <span class="keyword">false</span>;
<a name="l00396"></a>00396       }
<a name="l00397"></a>00397     }
<a name="l00398"></a>00398   }
<a name="l00399"></a>00399 
<a name="l00400"></a>00400   <span class="keywordflow">if</span> (card == <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54ac1ba3119b0fd85d3e54c69601ec1ccca">CARD_FINITE</a>) {
<a name="l00401"></a>00401 
<a name="l00402"></a>00402     <span class="keywordflow">if</span> (enumerate) {
<a name="l00403"></a>00403       <span class="comment">// TODO: enumerate functions? maybe at least n == 0</span>
<a name="l00404"></a>00404       e = <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>();
<a name="l00405"></a>00405     }
<a name="l00406"></a>00406 
<a name="l00407"></a>00407     <span class="keywordflow">if</span> (computeSize) {
<a name="l00408"></a>00408       n = thisSize;
<a name="l00409"></a>00409     }
<a name="l00410"></a>00410 
<a name="l00411"></a>00411   }
<a name="l00412"></a>00412 
<a name="l00413"></a>00413   <span class="keywordflow">return</span> card;
<a name="l00414"></a>00414 }
<a name="l00415"></a>00415 
<a name="l00416"></a>00416 
<a name="l00417"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a26061e351f02b3d372efa85d1b250134">00417</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a26061e351f02b3d372efa85d1b250134" title="Compute and store the type of e.">TheoryUF::computeType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e)
<a name="l00418"></a>00418 {
<a name="l00419"></a>00419   <span class="keywordflow">switch</span> (e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00420"></a>00420     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>: {
<a name="l00421"></a>00421       vector&lt;Type&gt; args;
<a name="l00422"></a>00422       <span class="keyword">const</span> vector&lt;Expr&gt;&amp; vars = e.<a class="code" href="group__ExprPkg.html#gaad22e223d0e273780557aca9d87620cd" title="Get bound variables from a closure Expr.">getVars</a>();
<a name="l00423"></a>00423       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(vars.size() &gt; 0,
<a name="l00424"></a>00424                   <span class="stringliteral">&quot;TheorySimulate::computeType(&quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()+<span class="stringliteral">&quot;)&quot;</span>);
<a name="l00425"></a>00425       <span class="keywordflow">for</span>(vector&lt;Expr&gt;::const_iterator i=vars.begin(), iend=vars.end();
<a name="l00426"></a>00426           i!=iend; ++i)
<a name="l00427"></a>00427         args.push_back((*i).getType());
<a name="l00428"></a>00428       e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(<a class="code" href="classCVC3_1_1Type.html#a3ebf8a1ba9d894c33df064ea37c5ead5">Type::funType</a>(args, e.<a class="code" href="group__ExprPkg.html#ga9060193194020fee3dac69ed1876a940" title="Get the body of the closure Expr.">getBody</a>().<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>()));
<a name="l00429"></a>00429       <span class="keywordflow">break</span>;
<a name="l00430"></a>00430     }
<a name="l00431"></a>00431     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>: {
<a name="l00432"></a>00432       <a class="code" href="classCVC3_1_1Theory.html#a01fa8047ed1f649dc98831cb536187e4" title="Return the theory associated with a kind.">theoryOf</a>(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>)-&gt;<a class="code" href="group__Theory__API.html#gabaed6b47e6fdea3ae1e53ff75f1882db" title="Compute and store the type of e.">computeType</a>(e);
<a name="l00433"></a>00433       <span class="keywordflow">break</span>;
<a name="l00434"></a>00434     }
<a name="l00435"></a>00435     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>: {
<a name="l00436"></a>00436       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga93059bf6ddd8020cef4e6796a3c9b5a4">isSymbol</a>(), <span class="stringliteral">&quot;Expected symbol&quot;</span>);
<a name="l00437"></a>00437       <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> funExpr = <a class="code" href="classCVC3_1_1Theory.html#a07b326cd94b2bb8bafa39faf07caaec5" title="Resolve an identifier, for use in parseExprOp()">resolveID</a>(e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>());
<a name="l00438"></a>00438       <span class="keywordflow">if</span> (funExpr.isNull()) {
<a name="l00439"></a>00439         <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>
<a name="l00440"></a>00440           (<span class="stringliteral">&quot;Attempt to take transitive closure of unknown id: &quot;</span>
<a name="l00441"></a>00441            +e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>());
<a name="l00442"></a>00442       }
<a name="l00443"></a>00443       <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> funType = funExpr.getType();
<a name="l00444"></a>00444       <span class="keywordflow">if</span>(!funType.<a class="code" href="classCVC3_1_1Type.html#a9c3be568546a63fb424e4cb49391dfa6">isFunction</a>()) {
<a name="l00445"></a>00445   <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>
<a name="l00446"></a>00446     (<span class="stringliteral">&quot;Attempt to take transitive closure of non-function:\n\n&quot;</span>
<a name="l00447"></a>00447      +funExpr.toString() + <span class="stringliteral">&quot;\n\n which has type: &quot;</span>
<a name="l00448"></a>00448      +funType.<a class="code" href="classCVC3_1_1Type.html#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">toString</a>());
<a name="l00449"></a>00449       }
<a name="l00450"></a>00450       <span class="keywordflow">if</span>(funType.<a class="code" href="classCVC3_1_1Type.html#abd7ab3fcb112e27aa05da8981b56e02c">arity</a>()!=3) {
<a name="l00451"></a>00451         <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>
<a name="l00452"></a>00452           (<span class="stringliteral">&quot;Attempt to take transitive closure of non-binary function:\n\n&quot;</span>
<a name="l00453"></a>00453            +funExpr.toString() + <span class="stringliteral">&quot;\n\n which has type: &quot;</span>
<a name="l00454"></a>00454            +funType.<a class="code" href="classCVC3_1_1Type.html#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">toString</a>());
<a name="l00455"></a>00455       }
<a name="l00456"></a>00456       <span class="keywordflow">if</span> (!funType[2].isBool()) {
<a name="l00457"></a>00457         <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>
<a name="l00458"></a>00458           (<span class="stringliteral">&quot;Attempt to take transitive closure of function:\n\n&quot;</span>
<a name="l00459"></a>00459            +funExpr.toString() + <span class="stringliteral">&quot;\n\n which does not return BOOLEAN&quot;</span>);
<a name="l00460"></a>00460       }
<a name="l00461"></a>00461       e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(funType);
<a name="l00462"></a>00462       <span class="keywordflow">break</span>;
<a name="l00463"></a>00463     }
<a name="l00464"></a>00464     <span class="keywordflow">default</span>:
<a name="l00465"></a>00465       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>,<span class="stringliteral">&quot;Unexpected type: &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00466"></a>00466       <span class="keywordflow">break</span>;
<a name="l00467"></a>00467   }
<a name="l00468"></a>00468 }
<a name="l00469"></a>00469 
<a name="l00470"></a>00470 
<a name="l00471"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a69f52441ffdbcc56cd227380904e4371">00471</a> <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.">TheoryUF::computeBaseType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>&amp; t) {
<a name="l00472"></a>00472   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e = t.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>();
<a name="l00473"></a>00473   <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00474"></a>00474   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>: {
<a name="l00475"></a>00475     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &gt; 0, <span class="stringliteral">&quot;Expected non-empty ARROW&quot;</span>);
<a name="l00476"></a>00476     vector&lt;Expr&gt; kids;
<a name="l00477"></a>00477     <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>(); i!=iend; ++i) {
<a name="l00478"></a>00478       kids.push_back(<a class="code" href="classCVC3_1_1Theory.html#aa408fe61c3d28f4333b78a3027606bb8" title="Compute (or look up in cache) the base type of e and return the result.">getBaseType</a>(<a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(*i)).getExpr());
<a name="l00479"></a>00479     }
<a name="l00480"></a>00480     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>(), kids));
<a name="l00481"></a>00481   }
<a name="l00482"></a>00482   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>: <span class="keywordflow">return</span> t;
<a name="l00483"></a>00483   <span class="keywordflow">default</span>:
<a name="l00484"></a>00484     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>,
<a name="l00485"></a>00485     <span class="stringliteral">&quot;TheoryUF::computeBaseType(&quot;</span>+t.<a class="code" href="classCVC3_1_1Type.html#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">toString</a>()+<span class="stringliteral">&quot;)&quot;</span>);
<a name="l00486"></a>00486     <span class="keywordflow">return</span> t;
<a name="l00487"></a>00487   }
<a name="l00488"></a>00488 }
<a name="l00489"></a>00489 
<a name="l00490"></a>00490 
<a name="l00491"></a><a class="code" href="classCVC3_1_1TheoryUF.html#abeee663f7e0372e4b98635be772d0ac5">00491</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#abeee663f7e0372e4b98635be772d0ac5" title="Add variables from &#39;e&#39; to &#39;v&#39; for constructing a concrete model.">TheoryUF::computeModelTerm</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e, std::vector&lt;Expr&gt;&amp; v) {
<a name="l00492"></a>00492   <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1CDList.html">CDList&lt;Expr&gt;::const_iterator</a> i=<a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>.<a class="code" href="classCVC3_1_1CDList.html#ae2cf006604b1ab88139332a5e2c08568">begin</a>(),
<a name="l00493"></a>00493   iend=<a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>.<a class="code" href="classCVC3_1_1CDList.html#a96313ff2924c89a93d7fe6c618c837af">end</a>(); i!=iend; ++i) {
<a name="l00494"></a>00494     <span class="keywordflow">if</span>((*i).isApply() &amp;&amp; (*i).getOp().getExpr() == e) {
<a name="l00495"></a>00495       <span class="comment">// Add both the function application</span>
<a name="l00496"></a>00496       <span class="comment">// getModelTerm(*i, v);</span>
<a name="l00497"></a>00497       v.push_back(*i);
<a name="l00498"></a>00498       <span class="comment">// and the arguments to the model terms.  Reason: the argument</span>
<a name="l00499"></a>00499       <span class="comment">// to the function better be a concrete value, and it might not</span>
<a name="l00500"></a>00500       <span class="comment">// necessarily be in the current list of model terms.</span>
<a name="l00501"></a>00501       <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> j=(*i).begin(), jend=(*i).end(); j!=jend; ++j)
<a name="l00502"></a>00502   <span class="comment">// getModelTerm(*j, v);</span>
<a name="l00503"></a>00503   v.push_back(*j);
<a name="l00504"></a>00504     }
<a name="l00505"></a>00505   }
<a name="l00506"></a>00506 }
<a name="l00507"></a>00507 
<a name="l00508"></a>00508 
<a name="l00509"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a6b6437208e5cd05563b4be9a83b4ed35">00509</a> <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.">TheoryUF::computeModel</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e, std::vector&lt;Expr&gt;&amp; vars) {
<a name="l00510"></a>00510   <span class="comment">// Repeat the same search for applications of e as in</span>
<a name="l00511"></a>00511   <span class="comment">// computeModelTerm(), but this time get the concrete values of the</span>
<a name="l00512"></a>00512   <span class="comment">// arguments, and return the applications of e to concrete values in</span>
<a name="l00513"></a>00513   <span class="comment">// vars.</span>
<a name="l00514"></a>00514 
<a name="l00515"></a>00515   <span class="comment">// We&#39;ll assign &#39;e&#39; a value later.</span>
<a name="l00516"></a>00516   vars.push_back(e);
<a name="l00517"></a>00517   <span class="comment">// Map of f(c) to val for concrete values of c and val</span>
<a name="l00518"></a>00518   <a class="code" href="classCVC3_1_1ExprHashMap.html">ExprHashMap&lt;Expr&gt;</a> appls;
<a name="l00519"></a>00519   <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1CDList.html">CDList&lt;Expr&gt;::const_iterator</a> i=<a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>.<a class="code" href="classCVC3_1_1CDList.html#ae2cf006604b1ab88139332a5e2c08568">begin</a>(),
<a name="l00520"></a>00520   iend=<a class="code" href="classCVC3_1_1TheoryUF.html#aeff599bb60058a6df8dd5b35ee3d783b" title="Backtracking list of function applications.">d_funApplications</a>.<a class="code" href="classCVC3_1_1CDList.html#a96313ff2924c89a93d7fe6c618c837af">end</a>(); i!=iend; ++i) {
<a name="l00521"></a>00521     <span class="keywordflow">if</span>((*i).isApply() &amp;&amp; (*i).getOp().getExpr() == e) {
<a name="l00522"></a>00522       <span class="comment">// Update all arguments with concrete values</span>
<a name="l00523"></a>00523       vector&lt;Theorem&gt; thms;
<a name="l00524"></a>00524       vector&lt;unsigned&gt; changed;
<a name="l00525"></a>00525       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0; j&lt;(*i).arity(); ++j) {
<a name="l00526"></a>00526   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> asst(<a class="code" href="classCVC3_1_1Theory.html#a4867f332c809f6efe8f01ffa45c32db3" title="Fetch the concrete assignment to the variable during model generation.">getModelValue</a>((*i)[j]));
<a name="l00527"></a>00527   <span class="keywordflow">if</span>(asst.<a class="code" href="classCVC3_1_1Theorem.html#a206c04f39fbbcacef2337148675553f4">getLHS</a>()!=asst.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>()) {
<a name="l00528"></a>00528     thms.push_back(asst);
<a name="l00529"></a>00529     changed.push_back(j);
<a name="l00530"></a>00530   }
<a name="l00531"></a>00531       }
<a name="l00532"></a>00532       <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> var;
<a name="l00533"></a>00533       <span class="keywordflow">if</span>(changed.size()&gt;0) {
<a name="l00534"></a>00534   <span class="comment">// Arguments changed.  Compute the new application, and assign</span>
<a name="l00535"></a>00535   <span class="comment">// it a concrete value</span>
<a name="l00536"></a>00536   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> subst = <a class="code" href="classCVC3_1_1Theory.html#a92e2da5223d7fb620cce85b2813e047f" title="(c_1 == d_1) &amp; ... &amp; (c_n == d_n) ==&gt; op(c_1,...,c_n) == op(d_1,...,d_n)">substitutivityRule</a>(*i, changed, thms);
<a name="l00537"></a>00537   <a class="code" href="classCVC3_1_1Theory.html#a917b117d28514f486b296568fcd1cfd1" title="Assigns t a concrete value val. Used in model generation.">assignValue</a>(<a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) &amp; (a2 == a3) ==&gt; (a1 == a3)">transitivityRule</a>(<a class="code" href="classCVC3_1_1Theory.html#a7440711981ac1bba2bed7476c0fa4e0b" title="a1 == a2 ==&gt; a2 == a1">symmetryRule</a>(subst), <a class="code" href="classCVC3_1_1Theory.html#a4867f332c809f6efe8f01ffa45c32db3" title="Fetch the concrete assignment to the variable during model generation.">getModelValue</a>(*i)));
<a name="l00538"></a>00538   var = subst.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00539"></a>00539       } <span class="keywordflow">else</span>
<a name="l00540"></a>00540   var = *i;
<a name="l00541"></a>00541       <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryUF.html#a608a96026a281c8e2da549584e9b2cdc" title="Flag to include function applications to the concrete model.">d_applicationsInModel</a>) vars.push_back(var);
<a name="l00542"></a>00542       <span class="comment">// Record it in the map</span>
<a name="l00543"></a>00543       appls[var] = <a class="code" href="classCVC3_1_1Theory.html#a4867f332c809f6efe8f01ffa45c32db3" title="Fetch the concrete assignment to the variable during model generation.">getModelValue</a>(var).<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00544"></a>00544     }
<a name="l00545"></a>00545   }
<a name="l00546"></a>00546   <span class="comment">// Create a LAMBDA expression for e</span>
<a name="l00547"></a>00547   <span class="keywordflow">if</span>(appls.<a class="code" href="classCVC3_1_1ExprHashMap.html#a9d792cf5282604c376d329ae325c983e">size</a>()==0) { <span class="comment">// Leave it fully uninterpreted</span>
<a name="l00548"></a>00548     <a class="code" href="classCVC3_1_1Theory.html#a917b117d28514f486b296568fcd1cfd1" title="Assigns t a concrete value val. Used in model generation.">assignValue</a>(<a class="code" href="classCVC3_1_1Theory.html#af860f5d5e01423628c97c399606916ff" title="==&gt; a == a">reflexivityRule</a>(e));
<a name="l00549"></a>00549   } <span class="keywordflow">else</span> {
<a name="l00550"></a>00550     <span class="comment">// Bound vars</span>
<a name="l00551"></a>00551     vector&lt;Expr&gt; args;
<a name="l00552"></a>00552     <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> tp(e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>());
<a name="l00553"></a>00553     <span class="keyword">static</span> <span class="keywordtype">unsigned</span> count(0);
<a name="l00554"></a>00554     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(tp.isFunction(), <span class="stringliteral">&quot;TheoryUF::computeModel(&quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()
<a name="l00555"></a>00555     +<span class="stringliteral">&quot; : &quot;</span>+tp.toString()+<span class="stringliteral">&quot;)&quot;</span>);
<a name="l00556"></a>00556     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0, iend=tp.arity()-1; i&lt;iend; ++i) {
<a name="l00557"></a>00557       <span class="keywordtype">string</span> str = <span class="stringliteral">&quot;uf_&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(count);
<a name="l00558"></a>00558       <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> v = <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;<a class="code" href="group__EM__Priv.html#ga22dbb23f716cc73378d4c69d564e38dd">newBoundVarExpr</a>(str, <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(count++));
<a name="l00559"></a>00559       v.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(tp[i]);
<a name="l00560"></a>00560       args.push_back(v);
<a name="l00561"></a>00561     }
<a name="l00562"></a>00562     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(args.size()&gt;0, <span class="stringliteral">&quot;TheoryUF::computeModel()&quot;</span>);
<a name="l00563"></a>00563     <a class="code" href="classCVC3_1_1ExprHashMap.html">ExprHashMap&lt;Expr&gt;::iterator</a> i=appls.<a class="code" href="classCVC3_1_1ExprHashMap.html#a1a0ea7ed7eb73e3f08ccce9f29e90c71">begin</a>(), iend=appls.<a class="code" href="classCVC3_1_1ExprHashMap.html#a0ea2aa250fd1431c311d83f32862bba7">end</a>();
<a name="l00564"></a>00564     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i!=iend, <span class="stringliteral">&quot;TheoryUF::computeModel(): empty appls hash&quot;</span>);
<a name="l00565"></a>00565     <span class="comment">// Use one of the concrete values as a default</span>
<a name="l00566"></a>00566     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> res((*i).second); ++i;
<a name="l00567"></a>00567     <span class="keywordflow">for</span>(; i!=iend; ++i) {
<a name="l00568"></a>00568       <span class="comment">// Optimization: if the current value is the same as that of the</span>
<a name="l00569"></a>00569       <span class="comment">// next application, skip this case; i.e. keep &#39;res&#39; instead of</span>
<a name="l00570"></a>00570       <span class="comment">// building ite(cond, res, res).</span>
<a name="l00571"></a>00571       <span class="keywordflow">if</span>((*i).second == res) <span class="keywordflow">continue</span>;
<a name="l00572"></a>00572 
<a name="l00573"></a>00573       <span class="comment">// Create an ITE condition</span>
<a name="l00574"></a>00574       <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> cond;
<a name="l00575"></a>00575       vector&lt;Expr&gt; eqs;
<a name="l00576"></a>00576       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0, jend=args.size(); j&lt;jend; ++j)
<a name="l00577"></a>00577   eqs.push_back(args[j].eqExpr((*i).first[j]));
<a name="l00578"></a>00578       <span class="keywordflow">if</span>(eqs.size()==1)
<a name="l00579"></a>00579   cond = eqs[0];
<a name="l00580"></a>00580       <span class="keywordflow">else</span>
<a name="l00581"></a>00581   cond = <a class="code" href="namespaceCVC3.html#ad4258158bba138eb54b9080af7f8223a">andExpr</a>(eqs);
<a name="l00582"></a>00582       <span class="comment">// Create an ITE</span>
<a name="l00583"></a>00583       res = cond.<a class="code" href="group__ExprPkg.html#ga5532cabad6f699c57da32a8db65a38da">iteExpr</a>((*i).second, res);
<a name="l00584"></a>00584     }
<a name="l00585"></a>00585     res = <a class="code" href="classCVC3_1_1TheoryUF.html#a2d7120ba1b7a5525cf06b2064a34e6ba" title="Create a new LAMBDA-abstraction.">lambdaExpr</a>(args, res);
<a name="l00586"></a>00586     <a class="code" href="classCVC3_1_1Theory.html#a917b117d28514f486b296568fcd1cfd1" title="Assigns t a concrete value val. Used in model generation.">assignValue</a>(e, res);
<a name="l00587"></a>00587   }
<a name="l00588"></a>00588 }
<a name="l00589"></a>00589 
<a name="l00590"></a>00590 
<a name="l00591"></a><a class="code" href="classCVC3_1_1TheoryUF.html#ad39e7c0bacd10a30d33f187afeebcf2e">00591</a> <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.">TheoryUF::computeTCC</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e)
<a name="l00592"></a>00592 {
<a name="l00593"></a>00593   <span class="keywordflow">switch</span> (e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00594"></a>00594     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>: {
<a name="l00595"></a>00595       <span class="comment">// Compute subtype predicates from the domain types applied to</span>
<a name="l00596"></a>00596       <span class="comment">// the corresponding arguments.  That is, if f: (T0,..,Tn)-&gt;T,</span>
<a name="l00597"></a>00597       <span class="comment">// and e = f(e0,...,en), then the TCC is</span>
<a name="l00598"></a>00598       <span class="comment">//</span>
<a name="l00599"></a>00599       <span class="comment">//   pred_T0(e0) &amp; ... &amp; pred_Tn(en) &amp; TCC(e),</span>
<a name="l00600"></a>00600       <span class="comment">//</span>
<a name="l00601"></a>00601       <span class="comment">// where the last TCC(e) is the conjunction of TCCs for the</span>
<a name="l00602"></a>00602       <span class="comment">// arguments, which ensures that all arguments are defined.</span>
<a name="l00603"></a>00603       <span class="comment">//</span>
<a name="l00604"></a>00604       <span class="comment">// If the operator is a lambda-expression, compute the TCC for</span>
<a name="l00605"></a>00605       <span class="comment">// the beta-reduced expression.  We do this in a somewhat sneaky</span>
<a name="l00606"></a>00606       <span class="comment">// but an efficient way: first, compute TCC of the op.body</span>
<a name="l00607"></a>00607       <span class="comment">// (which depends on the bound vars), then wrap that into</span>
<a name="l00608"></a>00608       <span class="comment">// lambda, and apply it to the arguments:</span>
<a name="l00609"></a>00609       <span class="comment">//</span>
<a name="l00610"></a>00610       <span class="comment">//   (LAMBDA(x0...xn): TCC(op.body)) (e0 ... en)</span>
<a name="l00611"></a>00611       <span class="comment">//</span>
<a name="l00612"></a>00612       <span class="comment">// The reason it is more efficient is that TCC(op.body) is cached,</span>
<a name="l00613"></a>00613       <span class="comment">// and doesn&#39;t change with the arguments.</span>
<a name="l00614"></a>00614       
<a name="l00615"></a>00615       vector&lt;Expr&gt; preds;
<a name="l00616"></a>00616       preds.push_back(<a class="code" href="group__Theory__API.html#ga9278ad3a6eb8351865a71acd7bb7f968" title="Compute and cache the TCC of e.">Theory::computeTCC</a>(e));
<a name="l00617"></a>00617       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>(), <span class="stringliteral">&quot;Should be application&quot;</span>);
<a name="l00618"></a>00618       <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> op(e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>());
<a name="l00619"></a>00619       <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> funType(op.getType());
<a name="l00620"></a>00620       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(funType.isFunction() || funType.isBool(),
<a name="l00621"></a>00621       <span class="stringliteral">&quot;TheoryUF::computeTCC(): funType = &quot;</span>
<a name="l00622"></a>00622       +funType.toString());
<a name="l00623"></a>00623       <span class="keywordflow">if</span>(funType.isFunction()) {
<a name="l00624"></a>00624   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(funType.arity() == e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()+1,
<a name="l00625"></a>00625         <span class="stringliteral">&quot;TheoryUF::computeTCC(): funType = &quot;</span>
<a name="l00626"></a>00626         +funType.toString()+<span class="stringliteral">&quot;\n e = &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00627"></a>00627   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); i&lt;iend; ++i) {
<a name="l00628"></a>00628     <span class="comment">// Optimization: if the type of the formal argument is</span>
<a name="l00629"></a>00629     <span class="comment">// exactly the same as the type of the actual, then skip the</span>
<a name="l00630"></a>00630     <span class="comment">// type predicate for that argument</span>
<a name="l00631"></a>00631     <span class="keywordflow">if</span>(funType[i] != e[i].getType())
<a name="l00632"></a>00632       preds.push_back(<a class="code" href="classCVC3_1_1Theory.html#a39539e895f8aade88ae5bc05bbcc9302" title="Calls the correct theory to compute a type predicate.">getTypePred</a>(funType[i], e[i]));
<a name="l00633"></a>00633   }
<a name="l00634"></a>00634       }
<a name="l00635"></a>00635       <span class="comment">// Now strip off all the LETDECL</span>
<a name="l00636"></a>00636       <span class="keywordflow">while</span>(op.getKind()==<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba9508dd8c8e7db280a5dacc19bd74d92d">LETDECL</a>) op = op[1];
<a name="l00637"></a>00637       <span class="comment">// and add a TCC for the lambda-expression</span>
<a name="l00638"></a>00638       <span class="keywordflow">if</span>(op.isLambda()) {
<a name="l00639"></a>00639   preds.push_back(<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>(op.getVars(),
<a name="l00640"></a>00640                                         <a class="code" href="classCVC3_1_1Theory.html#af38bdeb162a9ab9bd81ce40f598f608f" title="Compute the TCC of e, or the subtyping predicate, if e is a type.">getTCC</a>(op.getBody())).<a class="code" href="group__ExprPkg.html#ga3aefe2fb15c2d8e3a51dd92dbcc5cdc5" title="Make the expr into an operator.">mkOp</a>(),
<a name="l00641"></a>00641                              e.<a class="code" href="group__ExprPkg.html#ga1e18ae89889e781591eb2874a4196b73">getKids</a>()));
<a name="l00642"></a>00642       }
<a name="l00643"></a>00643       <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Theory.html#aba1822f2d985b50f6405c290c3814c1a" title="==&gt; AND(e1,e2) IFF [simplified expr]">rewriteAnd</a>(<a class="code" href="namespaceCVC3.html#ad4258158bba138eb54b9080af7f8223a">andExpr</a>(preds)).<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00644"></a>00644     }
<a name="l00645"></a>00645     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>:
<a name="l00646"></a>00646       <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Theory.html#ab8835beee96db67f3c26a604d96f2fe8" title="Return TRUE Expr.">trueExpr</a>();
<a name="l00647"></a>00647     <span class="keywordflow">default</span>:
<a name="l00648"></a>00648       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>,<span class="stringliteral">&quot;Unexpected type: &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00649"></a>00649       <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Theory.html#ab8835beee96db67f3c26a604d96f2fe8" title="Return TRUE Expr.">trueExpr</a>();
<a name="l00650"></a>00650   }
<a name="l00651"></a>00651 }
<a name="l00652"></a>00652 <span class="comment"></span>
<a name="l00653"></a>00653 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00654"></a>00654 <span class="comment"></span><span class="comment">// Pretty-printing                                           //</span><span class="comment"></span>
<a name="l00655"></a>00655 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00656"></a>00656 <span class="comment"></span>
<a name="l00657"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a7e28ba1a365a401e09681b580b37a7de">00657</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a7e28ba1a365a401e09681b580b37a7de">TheoryUF::printSmtLibShared</a>(<a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>&amp; os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e) {
<a name="l00658"></a>00658   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>( os.<a class="code" href="classCVC3_1_1ExprStream.html#ac2b2872228aff3fd5d08bbd69c672543" title="Get the current output language.">lang</a>() == <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea548619427a4d459d859ccd041ced9bfa" title="SMT-LIB format.">SMTLIB_LANG</a> || os.<a class="code" href="classCVC3_1_1ExprStream.html#ac2b2872228aff3fd5d08bbd69c672543" title="Get the current output language.">lang</a>() == <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0eaed2643c62e36b9b222804a1ab5b4809e" title="SMT-LIB v2 format.">SMTLIB_V2_LANG</a>, <span class="stringliteral">&quot;Illegal state in printSmtLibShared&quot;</span>);
<a name="l00659"></a>00659   <span class="keywordflow">switch</span>( e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>() ) {
<a name="l00660"></a>00660   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>:
<a name="l00661"></a>00661     <span class="keywordflow">if</span>( e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 1 &amp;&amp; e[0].<a class="code" href="group__ExprPkg.html#ga72034a21a6bcbd4d5d2085aa23c8f290">isString</a>() ) {
<a name="l00662"></a>00662       os &lt;&lt; e[0].<a class="code" href="group__ExprPkg.html#ga5e679ab39ad8166c3c027afee9004c26">getString</a>();
<a name="l00663"></a>00663       <span class="keywordflow">break</span>;
<a name="l00664"></a>00664     }
<a name="l00665"></a>00665     <span class="comment">// If it&#39;s straight from the parser, we may have several type</span>
<a name="l00666"></a>00666     <span class="comment">// names in one declaration.  Print these in LISP format.</span>
<a name="l00667"></a>00667     <span class="comment">// Otherwise, print the name of the type.</span>
<a name="l00668"></a>00668     <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1SmtlibException.html">SmtlibException</a>(<span class="stringliteral">&quot;TheoryUF::print: TYPEDECL not supported&quot;</span>);
<a name="l00669"></a>00669     <span class="comment">//       if(e.arity() != 1) e.print(os);</span>
<a name="l00670"></a>00670     <span class="comment">//       else if(e[0].isString()) os &lt;&lt; e[0].getString();</span>
<a name="l00671"></a>00671     <span class="comment">//       else e[0].print(os);</span>
<a name="l00672"></a>00672     <span class="keywordflow">break</span>;
<a name="l00673"></a>00673   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>:
<a name="l00674"></a>00674     <span class="keywordflow">if</span>( e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 0 )
<a name="l00675"></a>00675       os &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>();
<a name="l00676"></a>00676     <span class="keywordflow">else</span> {
<a name="l00677"></a>00677       os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>();
<a name="l00678"></a>00678       <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0, iend = e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); i &lt; iend; ++i )
<a name="l00679"></a>00679         os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; e[i];
<a name="l00680"></a>00680       <span class="keywordflow">if</span>( e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>() == <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a> ) {
<a name="l00681"></a>00681         os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; <span class="stringliteral">&quot;:transclose&quot;</span>;
<a name="l00682"></a>00682       }
<a name="l00683"></a>00683       os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00684"></a>00684     }
<a name="l00685"></a>00685     <span class="keywordflow">break</span>;
<a name="l00686"></a>00686   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>:
<a name="l00687"></a>00687     os &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>();
<a name="l00688"></a>00688     <span class="keywordflow">break</span>;
<a name="l00689"></a>00689   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a>:
<a name="l00690"></a>00690     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga93059bf6ddd8020cef4e6796a3c9b5a4">isSymbol</a>(), <span class="stringliteral">&quot;Expected symbol&quot;</span>);
<a name="l00691"></a>00691     os &lt;&lt; <a class="code" href="classCVC3_1_1Theory.html#a90684d2a97738341c00f8f9c99af7b66" title="Get a pointer to theoryCore.">theoryCore</a>()-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#af21dce6ee9ed152e132a4e77f10323e7">getTranslator</a>()-&gt;<a class="code" href="classCVC3_1_1Translator.html#a0ee4f6a5cf7bb40bfe341e4b99f06810">fixConstName</a>(e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>());
<a name="l00692"></a>00692     <span class="keywordflow">break</span>;
<a name="l00693"></a>00693   <span class="keywordflow">default</span>: {
<a name="l00694"></a>00694     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">&quot;TheoryUF::print: SMTLIB_LANG: Unexpected expression: &quot;</span>
<a name="l00695"></a>00695         +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;getKindName(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()));
<a name="l00696"></a>00696   }
<a name="l00697"></a>00697   }
<a name="l00698"></a>00698 }
<a name="l00699"></a>00699 
<a name="l00700"></a><a class="code" href="classCVC3_1_1TheoryUF.html#accc78347b4cda9a9534377d6d9df7eb8">00700</a> <a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>&amp; <a class="code" href="classCVC3_1_1TheoryUF.html#accc78347b4cda9a9534377d6d9df7eb8" title="Theory-specific pretty-printing.">TheoryUF::print</a>(<a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>&amp; os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e) {
<a name="l00701"></a>00701   <span class="keywordflow">switch</span>(os.<a class="code" href="classCVC3_1_1ExprStream.html#ac2b2872228aff3fd5d08bbd69c672543" title="Get the current output language.">lang</a>()) {
<a name="l00702"></a>00702   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea8a86c3f9706ac2fc5b108d01eae7c756" title="for output into Simplify format">SIMPLIFY_LANG</a>:
<a name="l00703"></a>00703     <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00704"></a>00704     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>:
<a name="l00705"></a>00705     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>:
<a name="l00706"></a>00706       os&lt;&lt;<span class="stringliteral">&quot;ERROR:ARROW:unsupported in Simplify\n&quot;</span>;
<a name="l00707"></a>00707       <span class="keywordflow">break</span>;
<a name="l00708"></a>00708     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>: {
<a name="l00709"></a>00709       os&lt;&lt;<span class="stringliteral">&quot;ERROR:LAMBDA:unsupported in Simplify\n&quot;</span>;
<a name="l00710"></a>00710       <span class="keywordflow">break</span>;
<a name="l00711"></a>00711     }
<a name="l00712"></a>00712     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>:
<a name="l00713"></a>00713       os&lt;&lt;<span class="stringliteral">&quot;ERROR:TRANS_CLOSURE:unsupported in Simplify\n&quot;</span>;
<a name="l00714"></a>00714       <span class="keywordflow">break</span>;
<a name="l00715"></a>00715     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>:
<a name="l00716"></a>00716       os&lt;&lt;<span class="stringliteral">&quot;ERROR:TYPEDECL:unsupported in Simplify\n&quot;</span>;
<a name="l00717"></a>00717       <span class="keywordflow">break</span>;
<a name="l00718"></a>00718     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a>:
<a name="l00719"></a>00719     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>:
<a name="l00720"></a>00720       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>()) os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>()&lt;&lt;<span class="stringliteral">&quot; &quot;</span>;
<a name="l00721"></a>00721       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &gt; 0) {
<a name="l00722"></a>00722   <span class="keywordtype">bool</span> first(<span class="keyword">true</span>);
<a name="l00723"></a>00723   <span class="keywordflow">for</span> (<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>(); i!=iend; ++i) {
<a name="l00724"></a>00724     <span class="keywordflow">if</span>(first) first = <span class="keyword">false</span>;
<a name="l00725"></a>00725     <span class="keywordflow">else</span> os &lt;&lt; <span class="stringliteral">&quot; &quot;</span> ;
<a name="l00726"></a>00726     os &lt;&lt; *i;
<a name="l00727"></a>00727   }
<a name="l00728"></a>00728       os &lt;&lt;  <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00729"></a>00729       }
<a name="l00730"></a>00730       <span class="keywordflow">break</span>;
<a name="l00731"></a>00731     <span class="keywordflow">default</span>: {
<a name="l00732"></a>00732       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">&quot;TheoryUF::print: Unexpected expression: &quot;</span>
<a name="l00733"></a>00733       +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;getKindName(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()));
<a name="l00734"></a>00734     }
<a name="l00735"></a>00735     }
<a name="l00736"></a>00736     <span class="keywordflow">break</span>; <span class="comment">// end of case SIMPLIFY_LANGUAGE</span>
<a name="l00737"></a>00737 
<a name="l00738"></a>00738   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea5a0016ee7e592d6cc61821bfb0a0697c" title="for output in TPTP format">TPTP_LANG</a>:
<a name="l00739"></a>00739     <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00740"></a>00740     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>:
<a name="l00741"></a>00741     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>:
<a name="l00742"></a>00742       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2) e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l00743"></a>00743       <span class="keywordflow">else</span> {
<a name="l00744"></a>00744   os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00745"></a>00745   <span class="keywordtype">bool</span> first(<span class="keyword">true</span>);
<a name="l00746"></a>00746   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()-1; i&lt;iend; ++i) {
<a name="l00747"></a>00747     <span class="keywordflow">if</span>(first) first=<span class="keyword">false</span>;
<a name="l00748"></a>00748     <span class="keywordflow">else</span> os &lt;&lt; <span class="stringliteral">&quot; * &quot;</span> ;
<a name="l00749"></a>00749     os &lt;&lt; e[i];
<a name="l00750"></a>00750   }
<a name="l00751"></a>00751   os &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> ;
<a name="l00752"></a>00752   os &lt;&lt;  <span class="stringliteral">&quot; &gt; &quot;</span>  &lt;&lt; e[e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()-1];
<a name="l00753"></a>00753       }
<a name="l00754"></a>00754       <span class="keywordflow">break</span>;
<a name="l00755"></a>00755 
<a name="l00756"></a>00756     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>: {
<a name="l00757"></a>00757       os&lt;&lt;<span class="stringliteral">&quot;ERROR:LAMBDA:unsupported in TPTP\n&quot;</span>;
<a name="l00758"></a>00758       <span class="keywordflow">break</span>;
<a name="l00759"></a>00759     }
<a name="l00760"></a>00760     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>:
<a name="l00761"></a>00761       os&lt;&lt;<span class="stringliteral">&quot;ERROR:TRANS_CLOSURE:unsupported in TPTP\n&quot;</span>;
<a name="l00762"></a>00762       <span class="keywordflow">break</span>;
<a name="l00763"></a>00763     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>:
<a name="l00764"></a>00764       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 1) e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l00765"></a>00765       <span class="keywordflow">else</span> os &lt;&lt; e[0].<a class="code" href="group__ExprPkg.html#ga5e679ab39ad8166c3c027afee9004c26">getString</a>();
<a name="l00766"></a>00766       <span class="keywordflow">break</span>;
<a name="l00767"></a>00767 
<a name="l00768"></a>00768     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a>:
<a name="l00769"></a>00769       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga93059bf6ddd8020cef4e6796a3c9b5a4">isSymbol</a>(), <span class="stringliteral">&quot;Expected symbol&quot;</span>);
<a name="l00770"></a>00770       os &lt;&lt; <a class="code" href="namespaceCVC3.html#a8964cf9d9e2568f9bae1b51f8344032e">to_lower</a>(e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>());
<a name="l00771"></a>00771       <span class="keywordflow">break</span>;
<a name="l00772"></a>00772 
<a name="l00773"></a>00773     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>:
<a name="l00774"></a>00774       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>()) os &lt;&lt;e.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>()&lt;&lt;<span class="stringliteral">&quot;(&quot;</span>;
<a name="l00775"></a>00775       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &gt; 0) {
<a name="l00776"></a>00776   <span class="keywordtype">bool</span> first(<span class="keyword">true</span>);
<a name="l00777"></a>00777   <span class="keywordflow">for</span> (<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>(); i!=iend; ++i) {
<a name="l00778"></a>00778     <span class="keywordflow">if</span>(first) first = <span class="keyword">false</span>;
<a name="l00779"></a>00779     <span class="keywordflow">else</span> os &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> ;
<a name="l00780"></a>00780     os &lt;&lt; *i;
<a name="l00781"></a>00781   }
<a name="l00782"></a>00782       os &lt;&lt;  <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00783"></a>00783       }
<a name="l00784"></a>00784       <span class="keywordflow">break</span>;
<a name="l00785"></a>00785     <span class="keywordflow">default</span>: {
<a name="l00786"></a>00786       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">&quot;TheoryUF::print: Unexpected expression: &quot;</span>
<a name="l00787"></a>00787       +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;getKindName(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()));
<a name="l00788"></a>00788     }
<a name="l00789"></a>00789     }
<a name="l00790"></a>00790     <span class="keywordflow">break</span>; <span class="comment">// end of case TPTP_LANGUAGE</span>
<a name="l00791"></a>00791 
<a name="l00792"></a>00792 
<a name="l00793"></a>00793   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0eaa315c228d5c3290ce37df81524ed8e9a" title="Nice SAL-like language for manually written specs.">PRESENTATION_LANG</a>:
<a name="l00794"></a>00794     <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00795"></a>00795     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>:
<a name="l00796"></a>00796     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>:
<a name="l00797"></a>00797       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2) e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l00798"></a>00798       <span class="keywordflow">else</span> {
<a name="l00799"></a>00799   <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2)
<a name="l00800"></a>00800     os &lt;&lt; e[0];
<a name="l00801"></a>00801   <span class="keywordflow">else</span> {
<a name="l00802"></a>00802     os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00803"></a>00803     <span class="keywordtype">bool</span> first(<span class="keyword">true</span>);
<a name="l00804"></a>00804     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()-1; i&lt;iend; ++i) {
<a name="l00805"></a>00805       <span class="keywordflow">if</span>(first) first=<span class="keyword">false</span>;
<a name="l00806"></a>00806       <span class="keywordflow">else</span> os &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a>;
<a name="l00807"></a>00807       os &lt;&lt; e[i];
<a name="l00808"></a>00808     }
<a name="l00809"></a>00809     os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>;
<a name="l00810"></a>00810   }
<a name="l00811"></a>00811   os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; <span class="stringliteral">&quot;-&gt;&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; e[e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()-1];
<a name="l00812"></a>00812       }
<a name="l00813"></a>00813       <span class="keywordflow">break</span>;
<a name="l00814"></a>00814     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>:
<a name="l00815"></a>00815       <span class="comment">// If it&#39;s straight from the parser, we may have several type</span>
<a name="l00816"></a>00816       <span class="comment">// names in one declaration.  Print these in LISP format.</span>
<a name="l00817"></a>00817       <span class="comment">// Otherwise, print the name of the type.</span>
<a name="l00818"></a>00818       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 1) e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l00819"></a>00819       <span class="keywordflow">else</span> os &lt;&lt; e[0].<a class="code" href="group__ExprPkg.html#ga5e679ab39ad8166c3c027afee9004c26">getString</a>();
<a name="l00820"></a>00820       <span class="keywordflow">break</span>;
<a name="l00821"></a>00821     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>: {
<a name="l00822"></a>00822       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga165dba5b9e9502059c3cf01bddf4fe1e">isLambda</a>(), <span class="stringliteral">&quot;Expected Lambda&quot;</span>);
<a name="l00823"></a>00823       os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> &lt;&lt;  <span class="stringliteral">&quot;LAMBDA&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00824"></a>00824       <span class="keyword">const</span> vector&lt;Expr&gt;&amp; vars = e.<a class="code" href="group__ExprPkg.html#gaad22e223d0e273780557aca9d87620cd" title="Get bound variables from a closure Expr.">getVars</a>();
<a name="l00825"></a>00825       <span class="keywordtype">bool</span> first(<span class="keyword">true</span>);
<a name="l00826"></a>00826       os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00827"></a>00827       <span class="keywordflow">for</span>(vector&lt;Expr&gt;::const_iterator i=vars.begin(), iend=vars.end();
<a name="l00828"></a>00828           i!=iend; ++i) {
<a name="l00829"></a>00829         <span class="keywordflow">if</span>(first) first = <span class="keyword">false</span>;
<a name="l00830"></a>00830         <span class="keywordflow">else</span> os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a>;
<a name="l00831"></a>00831         os &lt;&lt; *i;
<a name="l00832"></a>00832         <span class="comment">// The lambda Expr may be in a raw parsed form, in which case</span>
<a name="l00833"></a>00833         <span class="comment">// the type is not assigned yet</span>
<a name="l00834"></a>00834         <span class="keywordflow">if</span>(i-&gt;isVar())
<a name="l00835"></a>00835           os &lt;&lt; <span class="stringliteral">&quot;:&quot;</span> &lt;&lt; space &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga1475185296de10fdbe07f0b498e8ed36">pushdag</a> &lt;&lt; (*i).getType() &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga07ae0c39b4082065891134536f2fa91c">popdag</a>;
<a name="l00836"></a>00836       }
<a name="l00837"></a>00837       os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;): &quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga1475185296de10fdbe07f0b498e8ed36">pushdag</a> &lt;&lt; push
<a name="l00838"></a>00838          &lt;&lt; e.<a class="code" href="group__ExprPkg.html#ga9060193194020fee3dac69ed1876a940" title="Get the body of the closure Expr.">getBody</a>() &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00839"></a>00839       <span class="keywordflow">break</span>;
<a name="l00840"></a>00840     }
<a name="l00841"></a>00841     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>:
<a name="l00842"></a>00842       os &lt;&lt; e.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>();
<a name="l00843"></a>00843       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &gt; 0) {
<a name="l00844"></a>00844   os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00845"></a>00845   <span class="keywordtype">bool</span> first(<span class="keyword">true</span>);
<a name="l00846"></a>00846   <span class="keywordflow">for</span> (<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>(); i!=iend; ++i) {
<a name="l00847"></a>00847     <span class="keywordflow">if</span>(first) first = <span class="keyword">false</span>;
<a name="l00848"></a>00848     <span class="keywordflow">else</span> os &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a>;
<a name="l00849"></a>00849     os &lt;&lt; *i;
<a name="l00850"></a>00850   }
<a name="l00851"></a>00851         os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00852"></a>00852       }
<a name="l00853"></a>00853       <span class="keywordflow">break</span>;
<a name="l00854"></a>00854     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>:
<a name="l00855"></a>00855       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga93059bf6ddd8020cef4e6796a3c9b5a4">isSymbol</a>(), <span class="stringliteral">&quot;Expected symbol&quot;</span>);
<a name="l00856"></a>00856       os &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>() &lt;&lt; <span class="stringliteral">&quot;*&quot;</span>;
<a name="l00857"></a>00857       <span class="keywordflow">break</span>;
<a name="l00858"></a>00858     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a>:
<a name="l00859"></a>00859       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga93059bf6ddd8020cef4e6796a3c9b5a4">isSymbol</a>(), <span class="stringliteral">&quot;Expected symbol&quot;</span>);
<a name="l00860"></a>00860       os &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>();
<a name="l00861"></a>00861       <span class="keywordflow">break</span>;
<a name="l00862"></a>00862     <span class="keywordflow">default</span>: {
<a name="l00863"></a>00863       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">&quot;TheoryUF::print: Unexpected expression: &quot;</span>
<a name="l00864"></a>00864       +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;getKindName(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()));
<a name="l00865"></a>00865     }
<a name="l00866"></a>00866     }
<a name="l00867"></a>00867     <span class="keywordflow">break</span>; <span class="comment">// end of case PRESENTATION_LANGUAGE</span>
<a name="l00868"></a>00868   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea548619427a4d459d859ccd041ced9bfa" title="SMT-LIB format.">SMTLIB_LANG</a>:
<a name="l00869"></a>00869     <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00870"></a>00870     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>:
<a name="l00871"></a>00871     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>: {
<a name="l00872"></a>00872       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2) {
<a name="l00873"></a>00873         <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1SmtlibException.html">SmtlibException</a>(<span class="stringliteral">&quot;TheoryUF::print: Expected 2 or more arguments to ARROW&quot;</span>);
<a name="l00874"></a>00874         <span class="comment">//        e.print(os);</span>
<a name="l00875"></a>00875       }
<a name="l00876"></a>00876       <a class="code" href="classCVC3_1_1Theory.html#a262fdc338527489b376ec181ecc38ddc">d_theoryUsed</a> = <span class="keyword">true</span>;
<a name="l00877"></a>00877       os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00878"></a>00878       <span class="keywordtype">bool</span> oldDagFlag = os.<a class="code" href="classCVC3_1_1ExprStream.html#a2d4ff13cb98b358eb02dfbf149ae03ae" title="Set the DAG flag (return previous value)">dagFlag</a>(<span class="keyword">false</span>);
<a name="l00879"></a>00879       <span class="keywordtype">int</span> iend = e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>();
<a name="l00880"></a>00880       <span class="keywordflow">if</span> (e[iend-1].getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba8a583f16e8d237a423c8c1d9087a4c72">BOOLEAN</a>) --iend;
<a name="l00881"></a>00881       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i&lt;iend; ++i) {
<a name="l00882"></a>00882         <span class="keywordflow">if</span> (i != 0) os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a>;
<a name="l00883"></a>00883   os &lt;&lt; e[i];
<a name="l00884"></a>00884       }
<a name="l00885"></a>00885       os.<a class="code" href="classCVC3_1_1ExprStream.html#a2d4ff13cb98b358eb02dfbf149ae03ae" title="Set the DAG flag (return previous value)">dagFlag</a>(oldDagFlag);
<a name="l00886"></a>00886       <span class="keywordflow">break</span>;
<a name="l00887"></a>00887     }
<a name="l00888"></a>00888     <span class="keywordflow">default</span>:
<a name="l00889"></a>00889       <a class="code" href="classCVC3_1_1TheoryUF.html#a7e28ba1a365a401e09681b580b37a7de">printSmtLibShared</a>(os,e);
<a name="l00890"></a>00890     }
<a name="l00891"></a>00891     <span class="keywordflow">break</span>; <span class="comment">// End of SMT_LIB</span>
<a name="l00892"></a>00892   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0eaed2643c62e36b9b222804a1ab5b4809e" title="SMT-LIB v2 format.">SMTLIB_V2_LANG</a>:
<a name="l00893"></a>00893     <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00894"></a>00894     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>:
<a name="l00895"></a>00895     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>: {
<a name="l00896"></a>00896       <span class="comment">/* Prints out a function type (A,B,C) -&gt; D as &quot;(A B C) D&quot; */</span>
<a name="l00897"></a>00897       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2) {
<a name="l00898"></a>00898         <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1SmtlibException.html">SmtlibException</a>(<span class="stringliteral">&quot;TheoryUF::print: Expected 2 or more arguments to ARROW&quot;</span>);
<a name="l00899"></a>00899         <span class="comment">//        e.print(os);</span>
<a name="l00900"></a>00900       }
<a name="l00901"></a>00901       <a class="code" href="classCVC3_1_1Theory.html#a262fdc338527489b376ec181ecc38ddc">d_theoryUsed</a> = <span class="keyword">true</span>;
<a name="l00902"></a>00902       <span class="keywordtype">bool</span> oldDagFlag = os.<a class="code" href="classCVC3_1_1ExprStream.html#a2d4ff13cb98b358eb02dfbf149ae03ae" title="Set the DAG flag (return previous value)">dagFlag</a>(<span class="keyword">false</span>);
<a name="l00903"></a>00903       os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> &lt;&lt; <span class="stringliteral">&quot;(&quot;</span>;
<a name="l00904"></a>00904       <span class="keywordflow">for</span>( <span class="keywordtype">int</span> i = 0; i &lt; e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() - 1; ++i ) {
<a name="l00905"></a>00905         <span class="keywordflow">if</span>( i != 0 ) {
<a name="l00906"></a>00906           os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a>;
<a name="l00907"></a>00907         }
<a name="l00908"></a>00908         os &lt;&lt; e[i];
<a name="l00909"></a>00909       }
<a name="l00910"></a>00910       os &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; e[e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() - 1] &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> ;
<a name="l00911"></a>00911       os.<a class="code" href="classCVC3_1_1ExprStream.html#a2d4ff13cb98b358eb02dfbf149ae03ae" title="Set the DAG flag (return previous value)">dagFlag</a>(oldDagFlag);
<a name="l00912"></a>00912       <span class="keywordflow">break</span>;
<a name="l00913"></a>00913     }
<a name="l00914"></a>00914     <span class="keywordflow">default</span>:
<a name="l00915"></a>00915       <a class="code" href="classCVC3_1_1TheoryUF.html#a7e28ba1a365a401e09681b580b37a7de">printSmtLibShared</a>(os,e);
<a name="l00916"></a>00916     }
<a name="l00917"></a>00917     <span class="keywordflow">break</span>; <span class="comment">// End of SMT-LIB v2</span>
<a name="l00918"></a>00918   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea00df691ed79361b36910e60b49824c35" title="Lisp-like format for automatically generated specs.">LISP_LANG</a>:
<a name="l00919"></a>00919     <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00920"></a>00920     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>:
<a name="l00921"></a>00921     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>:
<a name="l00922"></a>00922       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2) e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l00923"></a>00923       os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> &lt;&lt; <span class="stringliteral">&quot;ARROW&quot;</span>;
<a name="l00924"></a>00924       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); i&lt;iend; ++i)
<a name="l00925"></a>00925   os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; e[i];
<a name="l00926"></a>00926       os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00927"></a>00927       <span class="keywordflow">break</span>;
<a name="l00928"></a>00928     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>:
<a name="l00929"></a>00929       e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l00930"></a>00930       <span class="keywordflow">break</span>;
<a name="l00931"></a>00931     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>:
<a name="l00932"></a>00932       <span class="comment">// If it&#39;s straight from the parser, we may have several type</span>
<a name="l00933"></a>00933       <span class="comment">// names in one declaration.  Print these in LISP format.</span>
<a name="l00934"></a>00934       <span class="comment">// Otherwise, print the name of the type.</span>
<a name="l00935"></a>00935       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 1) e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l00936"></a>00936       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(e[0].isString()) os &lt;&lt; e[0].<a class="code" href="group__ExprPkg.html#ga5e679ab39ad8166c3c027afee9004c26">getString</a>();
<a name="l00937"></a>00937       <span class="keywordflow">else</span> e[0].<a class="code" href="group__ExprPkg.html#ga76180628bc1561af88e41be586973fac" title="Print the expression in the specified format.">print</a>(os);
<a name="l00938"></a>00938       <span class="keywordflow">break</span>;
<a name="l00939"></a>00939     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>: {
<a name="l00940"></a>00940       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga165dba5b9e9502059c3cf01bddf4fe1e">isLambda</a>(), <span class="stringliteral">&quot;Expected LAMBDA&quot;</span>);
<a name="l00941"></a>00941       os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; push &lt;&lt;  <span class="stringliteral">&quot;LAMBDA&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a>;
<a name="l00942"></a>00942       <span class="keyword">const</span> vector&lt;Expr&gt;&amp; vars = e.<a class="code" href="group__ExprPkg.html#gaad22e223d0e273780557aca9d87620cd" title="Get bound variables from a closure Expr.">getVars</a>();
<a name="l00943"></a>00943       <span class="keywordtype">bool</span> first(<span class="keyword">true</span>);
<a name="l00944"></a>00944       os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00945"></a>00945       <span class="keywordflow">for</span>(vector&lt;Expr&gt;::const_iterator i=vars.begin(), iend=vars.end();
<a name="l00946"></a>00946           i!=iend; ++i) {
<a name="l00947"></a>00947         <span class="keywordflow">if</span>(first) first = <span class="keyword">false</span>;
<a name="l00948"></a>00948         <span class="keywordflow">else</span> os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a>;
<a name="l00949"></a>00949         os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; push &lt;&lt; *i;
<a name="l00950"></a>00950         <span class="comment">// The expression may be in a raw parsed form, in which case</span>
<a name="l00951"></a>00951         <span class="comment">// the type is not assigned yet</span>
<a name="l00952"></a>00952         <span class="keywordflow">if</span>(i-&gt;isVar())
<a name="l00953"></a>00953           os &lt;&lt; space &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga1475185296de10fdbe07f0b498e8ed36">pushdag</a> &lt;&lt; (*i).getType() &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga07ae0c39b4082065891134536f2fa91c">popdag</a>;
<a name="l00954"></a>00954         os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>;
<a name="l00955"></a>00955       }
<a name="l00956"></a>00956       os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga1475185296de10fdbe07f0b498e8ed36">pushdag</a>
<a name="l00957"></a>00957          &lt;&lt; e.<a class="code" href="group__ExprPkg.html#ga9060193194020fee3dac69ed1876a940" title="Get the body of the closure Expr.">getBody</a>() &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00958"></a>00958       <span class="keywordflow">break</span>;
<a name="l00959"></a>00959     }
<a name="l00960"></a>00960     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>:
<a name="l00961"></a>00961       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>(), <span class="stringliteral">&quot;Expected Apply&quot;</span>);
<a name="l00962"></a>00962       <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 0) os &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>();
<a name="l00963"></a>00963       <span class="keywordflow">else</span> {
<a name="l00964"></a>00964   os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; push &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>();
<a name="l00965"></a>00965   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); i&lt;iend; ++i)
<a name="l00966"></a>00966     os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; e[i];
<a name="l00967"></a>00967   os &lt;&lt; push &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00968"></a>00968       }
<a name="l00969"></a>00969       <span class="keywordflow">break</span>;
<a name="l00970"></a>00970     <span class="keywordflow">default</span>: {
<a name="l00971"></a>00971       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">&quot;TheoryUF::print: Unexpected expression: &quot;</span>
<a name="l00972"></a>00972       +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;getKindName(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()));
<a name="l00973"></a>00973     }
<a name="l00974"></a>00974     }
<a name="l00975"></a>00975     <span class="keywordflow">break</span>; <span class="comment">// End of LISP_LANG</span>
<a name="l00976"></a>00976   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea7bdae8b250b94f50cea68f05c563cdca" title="for output in SPASS format">SPASS_LANG</a>:
<a name="l00977"></a>00977     <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) {
<a name="l00978"></a>00978     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baa677b4263f974f2ccfe7986cedf3988e">UFUNC</a>:
<a name="l00979"></a>00979       os &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gaa3023d9117f249f079b0a202a1dfc5c2">getName</a>();
<a name="l00980"></a>00980       <span class="keywordflow">break</span>;
<a name="l00981"></a>00981     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba5c41450c4e719ca40d8e734f6a2008f0">APPLY</a>:
<a name="l00982"></a>00982       os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> &lt;&lt; e.<a class="code" href="group__ExprPkg.html#gace479f04faca399219496195152f7806" title="Get operator from expression.">getOp</a>().<a class="code" href="classCVC3_1_1Op.html#a4a38071541d1e863583f12e9d81de3a2">getExpr</a>();
<a name="l00983"></a>00983       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &gt; 0) {
<a name="l00984"></a>00984         os &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; e[0];
<a name="l00985"></a>00985   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=1, iend=e.arity(); i&lt;iend; ++i)
<a name="l00986"></a>00986           os &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> &lt;&lt; e[i];
<a name="l00987"></a>00987         os &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00988"></a>00988       }
<a name="l00989"></a>00989       os &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>;
<a name="l00990"></a>00990       <span class="keywordflow">break</span>;
<a name="l00991"></a>00991     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>:
<a name="l00992"></a>00992     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>:
<a name="l00993"></a>00993     <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>:
<a name="l00994"></a>00994     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>:
<a name="l00995"></a>00995     <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>:
<a name="l00996"></a>00996     <span class="keywordflow">default</span>:
<a name="l00997"></a>00997       <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1SmtlibException.html">SmtlibException</a>(<span class="stringliteral">&quot;TheoryUF::print: Unexpected expression for SPASS_LANG: &quot;</span>
<a name="l00998"></a>00998                             +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;getKindName(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()));
<a name="l00999"></a>00999     }
<a name="l01000"></a>01000     <span class="keywordflow">break</span>;
<a name="l01001"></a>01001   <span class="keywordflow">default</span>:
<a name="l01002"></a>01002     <span class="comment">// Print the top node in the default format, continue with</span>
<a name="l01003"></a>01003     <span class="comment">// pretty-printing for children.</span>
<a name="l01004"></a>01004     e.<a class="code" href="group__ExprPkg.html#ga092308b0a88e12a5c7ff2fc0a2eca818" title="Print the top node and then recurse through the children */.">printAST</a>(os);
<a name="l01005"></a>01005     <span class="keywordflow">break</span>;
<a name="l01006"></a>01006   }
<a name="l01007"></a>01007   <span class="keywordflow">return</span> os;
<a name="l01008"></a>01008 }
<a name="l01009"></a>01009 <span class="comment"></span>
<a name="l01010"></a>01010 <span class="comment">//////////////////////////////////////////////////////////////////////////////</span>
<a name="l01011"></a>01011 <span class="comment"></span><span class="comment">//parseExprOp:</span>
<a name="l01012"></a>01012 <span class="comment">//translating special Exprs to regular EXPR??</span><span class="comment"></span>
<a name="l01013"></a>01013 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l01014"></a>01014 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>
<a name="l01015"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a43cd4922172049de0dfa948c1b09f81e">01015</a> <a class="code" href="classCVC3_1_1TheoryUF.html#a43cd4922172049de0dfa948c1b09f81e" title="Theory-specific parsing implemented by the DP.">TheoryUF::parseExprOp</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e) {
<a name="l01016"></a>01016   <span class="comment">// If the expression is not a list, it must have been already</span>
<a name="l01017"></a>01017   <span class="comment">// parsed, so just return it as is.</span>
<a name="l01018"></a>01018   <span class="keywordflow">if</span>(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba60238049e233c8d68fc58e4d5ceb55e2">RAW_LIST</a> != e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) <span class="keywordflow">return</span> e;
<a name="l01019"></a>01019 
<a name="l01020"></a>01020   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &gt; 0,
<a name="l01021"></a>01021         <span class="stringliteral">&quot;TheoryUF::parseExprOp:\n e = &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l01022"></a>01022 
<a name="l01023"></a>01023   <span class="keywordflow">if</span> (e[0].getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba60238049e233c8d68fc58e4d5ceb55e2">RAW_LIST</a>) {
<a name="l01024"></a>01024     <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2)
<a name="l01025"></a>01025       <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;Bad function application: &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l01026"></a>01026     <a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>();
<a name="l01027"></a>01027     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> op(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(*i)); ++i;
<a name="l01028"></a>01028     vector&lt;Expr&gt; args;
<a name="l01029"></a>01029     <span class="keywordflow">for</span>(; i!=iend; ++i) args.push_back(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(*i));
<a name="l01030"></a>01030     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(op.<a class="code" href="group__ExprPkg.html#ga3aefe2fb15c2d8e3a51dd92dbcc5cdc5" title="Make the expr into an operator.">mkOp</a>(), args);
<a name="l01031"></a>01031   }
<a name="l01032"></a>01032 
<a name="l01033"></a>01033   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e[0].getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba001479a58fb44c39a29b20d565081a68" title="Identifier is (ID (STRING_EXPR &quot;name&quot;))">ID</a> || e[0][0].getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba001479a58fb44c39a29b20d565081a68" title="Identifier is (ID (STRING_EXPR &quot;name&quot;))">ID</a>,
<a name="l01034"></a>01034               <span class="stringliteral">&quot;Expected identifier&quot;</span>);
<a name="l01035"></a>01035   <span class="keywordtype">int</span> kind = e[0].<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>();
<a name="l01036"></a>01036   <span class="keywordflow">if</span> (kind == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba001479a58fb44c39a29b20d565081a68" title="Identifier is (ID (STRING_EXPR &quot;name&quot;))">ID</a>) kind = <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;<a class="code" href="group__EM__Priv.html#ga9e7929fab9329724812e74b066a3c90a" title="Return a kind associated with a name. Returns NULL_KIND if not found.">getKind</a>(e[0][0].getString());
<a name="l01037"></a>01037   <span class="keywordflow">switch</span>(kind) {
<a name="l01038"></a>01038   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa0a0341a99545f72e5d4976ce374445d4">OLD_ARROW</a>: {
<a name="l01039"></a>01039     <span class="keywordflow">if</span> (!<a class="code" href="classCVC3_1_1Theory.html#a90684d2a97738341c00f8f9c99af7b66" title="Get a pointer to theoryCore.">theoryCore</a>()-&gt;getFlags()[<span class="stringliteral">&quot;old-func-syntax&quot;</span>].getBool()) {
<a name="l01040"></a>01040       <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;You seem to be using the old syntax for function types.\n&quot;</span>
<a name="l01041"></a>01041                             <span class="stringliteral">&quot;Please convert to the new syntax or run with +old-func-syntax&quot;</span>);
<a name="l01042"></a>01042     }
<a name="l01043"></a>01043     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()==3,<span class="stringliteral">&quot;Expected arity 3 in OLD_ARROW&quot;</span>);
<a name="l01044"></a>01044     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> arg = <a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[1]);
<a name="l01045"></a>01045     vector&lt;Expr&gt; k;
<a name="l01046"></a>01046     <span class="keywordflow">if</span> (arg.getOpKind() == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>) {
<a name="l01047"></a>01047       <a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i = arg.begin(), iend=arg.end();
<a name="l01048"></a>01048       <span class="keywordflow">for</span> (; i != iend; ++i) {
<a name="l01049"></a>01049         k.push_back(*i);
<a name="l01050"></a>01050       }
<a name="l01051"></a>01051     }
<a name="l01052"></a>01052     <span class="keywordflow">else</span> k.push_back(arg);
<a name="l01053"></a>01053     k.push_back(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[2]));
<a name="l01054"></a>01054     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>, k);
<a name="l01055"></a>01055   }
<a name="l01056"></a>01056   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba546eccfedc4dcc8623ed0668f77ef982">ARROW</a>:
<a name="l01057"></a>01057   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba3bcf72a59026c6765481b300b363ff59">TYPEDECL</a>: {
<a name="l01058"></a>01058     vector&lt;Expr&gt; k;
<a name="l01059"></a>01059     <a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i = e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>();
<a name="l01060"></a>01060     <span class="comment">// Skip first element of the vector of kids in &#39;e&#39;.</span>
<a name="l01061"></a>01061     <span class="comment">// The first element is the operator.</span>
<a name="l01062"></a>01062     ++i; 
<a name="l01063"></a>01063     <span class="comment">// Parse the kids of e and push them into the vector &#39;k&#39;</span>
<a name="l01064"></a>01064     <span class="keywordflow">for</span>(; i!=iend; ++i) 
<a name="l01065"></a>01065       k.push_back(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(*i));
<a name="l01066"></a>01066     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(kind, k, e.<a class="code" href="group__ExprPkg.html#gab57ce3dfa78947a906241d090c7cf34d">getEM</a>());
<a name="l01067"></a>01067     <span class="keywordflow">break</span>;
<a name="l01068"></a>01068   }
<a name="l01069"></a>01069   <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>: {
<a name="l01070"></a>01070     <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 4)
<a name="l01071"></a>01071       <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;Wrong number of arguments to &quot;</span>
<a name="l01072"></a>01072           <span class="stringliteral">&quot;TRANS_CLOSURE expression\n&quot;</span>
<a name="l01073"></a>01073           <span class="stringliteral">&quot; (expected 3 arguments): &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l01074"></a>01074     <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; name = e[1][0].<a class="code" href="group__ExprPkg.html#ga5e679ab39ad8166c3c027afee9004c26">getString</a>();
<a name="l01075"></a>01075     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> funExpr = <a class="code" href="classCVC3_1_1Theory.html#a07b326cd94b2bb8bafa39faf07caaec5" title="Resolve an identifier, for use in parseExprOp()">resolveID</a>(name);
<a name="l01076"></a>01076     <span class="keywordflow">if</span> (funExpr.<a class="code" href="group__ExprPkg.html#ga0265d1ca42fa59c95aaff3ca675b6504">isNull</a>())
<a name="l01077"></a>01077       <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;Attempt to take transitive closure of unknown &quot;</span>
<a name="l01078"></a>01078                             <span class="stringliteral">&quot;predicate&quot;</span>+name);
<a name="l01079"></a>01079     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryUF.html#ae9ebc6963f71169466bf7f59acb0363e" title="Create a transitive closure expression.">transClosureExpr</a>(name, <a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[2]), <a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[3]));
<a name="l01080"></a>01080   }
<a name="l01081"></a>01081   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>: { <span class="comment">// (LAMBDA ((v1 ... vn tp1) ...) body)</span>
<a name="l01082"></a>01082     <span class="keywordflow">if</span>(!(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 3 &amp;&amp; e[1].<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba60238049e233c8d68fc58e4d5ceb55e2">RAW_LIST</a> &amp;&amp; e[1].<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &gt; 0))
<a name="l01083"></a>01083       <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;Bad LAMBDA expression: &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l01084"></a>01084     <span class="comment">// Iterate through the groups of bound variables</span>
<a name="l01085"></a>01085     vector&lt;pair&lt;string,Type&gt; &gt; vars; <span class="comment">// temporary stack of bound variables</span>
<a name="l01086"></a>01086     <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=e[1].begin(), iend=e[1].<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>(); i!=iend; ++i) {
<a name="l01087"></a>01087       <span class="keywordflow">if</span>(i-&gt;getKind() != <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba60238049e233c8d68fc58e4d5ceb55e2">RAW_LIST</a> || i-&gt;arity() &lt; 2)
<a name="l01088"></a>01088   <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;Bad variable declaration block in LAMBDA &quot;</span>
<a name="l01089"></a>01089           <span class="stringliteral">&quot;expression: &quot;</span>+i-&gt;toString()+
<a name="l01090"></a>01090           <span class="stringliteral">&quot;\n e = &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l01091"></a>01091       <span class="comment">// Iterate through individual bound vars in the group.  The</span>
<a name="l01092"></a>01092       <span class="comment">// last element is the type, which we have to rebuild and</span>
<a name="l01093"></a>01093       <span class="comment">// parse, since it is used in the creation of bound variables.</span>
<a name="l01094"></a>01094       <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> tp(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>((*i)[i-&gt;arity()-1]));
<a name="l01095"></a>01095       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> j=0, jend=i-&gt;arity()-1; j&lt;jend; ++j) {
<a name="l01096"></a>01096   <span class="keywordflow">if</span>((*i)[j].getKind() != <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba001479a58fb44c39a29b20d565081a68" title="Identifier is (ID (STRING_EXPR &quot;name&quot;))">ID</a>)
<a name="l01097"></a>01097     <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;Bad variable declaration in LAMBDA&quot;</span>
<a name="l01098"></a>01098             <span class="stringliteral">&quot; expression: &quot;</span>+(*i)[j].toString()+
<a name="l01099"></a>01099             <span class="stringliteral">&quot;\n e = &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l01100"></a>01100   vars.push_back(pair&lt;string,Type&gt;((*i)[j][0].getString(), tp));
<a name="l01101"></a>01101       }
<a name="l01102"></a>01102     }
<a name="l01103"></a>01103     <span class="comment">// Create all the bound vars and save them in a vector</span>
<a name="l01104"></a>01104     vector&lt;Expr&gt; boundVars;
<a name="l01105"></a>01105     <span class="keywordflow">for</span>(vector&lt;pair&lt;string,Type&gt; &gt;::iterator i=vars.begin(), iend=vars.end();
<a name="l01106"></a>01106   i!=iend; ++i)
<a name="l01107"></a>01107       boundVars.push_back(<a class="code" href="classCVC3_1_1Theory.html#a13ba9024a22362cc96760519a84f2316" title="Create and add a new bound variable to the stack, for parseExprOp().">addBoundVar</a>(i-&gt;first, i-&gt;second));
<a name="l01108"></a>01108     <span class="comment">// Rebuild the body</span>
<a name="l01109"></a>01109     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> body(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[2]));
<a name="l01110"></a>01110     <span class="comment">// Build the resulting Expr as (LAMBDA (vars) body)</span>
<a name="l01111"></a>01111     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a2d7120ba1b7a5525cf06b2064a34e6ba" title="Create a new LAMBDA-abstraction.">lambdaExpr</a>(boundVars, body);
<a name="l01112"></a>01112     <span class="keywordflow">break</span>;
<a name="l01113"></a>01113   }
<a name="l01114"></a>01114   <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba60238049e233c8d68fc58e4d5ceb55e2">RAW_LIST</a>: <span class="comment">// Lambda application</span>
<a name="l01115"></a>01115   <span class="keywordflow">default</span>: { <span class="comment">// Application of an uninterpreted function</span>
<a name="l01116"></a>01116     <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() &lt; 2)
<a name="l01117"></a>01117       <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">&quot;Bad function application: &quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l01118"></a>01118     <a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>();
<a name="l01119"></a>01119     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> op(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(*i)); ++i;
<a name="l01120"></a>01120     vector&lt;Expr&gt; args;
<a name="l01121"></a>01121     <span class="keywordflow">for</span>(; i!=iend; ++i) args.push_back(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(*i));
<a name="l01122"></a>01122     <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(op.<a class="code" href="group__ExprPkg.html#ga3aefe2fb15c2d8e3a51dd92dbcc5cdc5" title="Make the expr into an operator.">mkOp</a>(), args);
<a name="l01123"></a>01123   }
<a name="l01124"></a>01124   }
<a name="l01125"></a>01125   <span class="keywordflow">return</span> e;
<a name="l01126"></a>01126 }
<a name="l01127"></a>01127 
<a name="l01128"></a>01128 
<a name="l01129"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a2d7120ba1b7a5525cf06b2064a34e6ba">01129</a> <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.">TheoryUF::lambdaExpr</a>(<span class="keyword">const</span> vector&lt;Expr&gt;&amp; vars, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; body) {
<a name="l01130"></a>01130   <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;<a class="code" href="group__EM__Priv.html#ga0d2ff7603a249b30b2df4e549607ad6e">newClosureExpr</a>(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba40176493726a127184ca47ea6352dc1f">LAMBDA</a>, vars, body);
<a name="l01131"></a>01131 }
<a name="l01132"></a>01132 
<a name="l01133"></a>01133 
<a name="l01134"></a><a class="code" href="classCVC3_1_1TheoryUF.html#ae9ebc6963f71169466bf7f59acb0363e">01134</a> <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.">TheoryUF::transClosureExpr</a>(<span class="keyword">const</span> std::string&amp; name, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e1,
<a name="l01135"></a>01135         <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e2) {
<a name="l01136"></a>01136   <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-&gt;newSymbolExpr(name, <a class="code" href="namespaceCVC3.html#afaaef5e303e3d0aec4e1874b5ef2923aa5d779af6a0a27075487337bf4ec8e92a">TRANS_CLOSURE</a>).mkOp(), e1, e2);
<a name="l01137"></a>01137 }
<a name="l01138"></a>01138 
<a name="l01139"></a><a class="code" href="classCVC3_1_1TheoryUF.html#a452face1b48cfdd389cee5f9ef693810">01139</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryUF.html#a452face1b48cfdd389cee5f9ef693810" title="Notify theory of a new shared term.">TheoryUF::addSharedTerm</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">CVC3::Expr</a>&amp; e) {
<a name="l01140"></a>01140   <a class="code" href="classCVC3_1_1TheoryUF.html#ac15e725de0573cf067ebb9c91b14f9a3" title="The set of all shared terms.">d_sharedTermsMap</a>[e] = <span class="keyword">true</span>;
<a name="l01141"></a>01141 }
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Sep 7 2011 for CVC3 by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>