<!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_records.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 <span id="projectnumber">2.4.1</span></div> </td> </tr> </tbody> </table> </div> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">theory_records.cpp</div> </div> </div> <div class="contents"> <a href="theory__records_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_records.cpp</span> <a name="l00004"></a>00004 <span class="comment"> * </span> <a name="l00005"></a>00005 <span class="comment"> * Author: Daniel Wichs</span> <a name="l00006"></a>00006 <span class="comment"> * </span> <a name="l00007"></a>00007 <span class="comment"> * Created: 7/21/03</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * <hr></span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span> <a name="l00012"></a>00012 <span class="comment"> * and its documentation for any purpose is hereby granted without</span> <a name="l00013"></a>00013 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span> <a name="l00014"></a>00014 <span class="comment"> * LICENSE file provided with this distribution.</span> <a name="l00015"></a>00015 <span class="comment"> * </span> <a name="l00016"></a>00016 <span class="comment"> * <hr></span> <a name="l00017"></a>00017 <span class="comment"> * </span> <a name="l00018"></a>00018 <span class="comment"> */</span> <a name="l00019"></a>00019 <span class="comment">/*****************************************************************************/</span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="theory__records_8h.html">theory_records.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="typecheck__exception_8h.html" title="An exception to be thrown at typecheck error.">typecheck_exception.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="parser__exception_8h.html" title="An exception thrown by the parser.">parser_exception.h</a>"</span> <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="smtlib__exception_8h.html" title="An exception to be thrown by the smtlib translator.">smtlib_exception.h</a>"</span> <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="records__proof__rules_8h.html">records_proof_rules.h</a>"</span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="theory__core_8h.html">theory_core.h</a>"</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="keyword">using namespace </span>std; <a name="l00029"></a>00029 <span class="keyword">using namespace </span>CVC3; <a name="l00030"></a>00030 <span class="comment"></span> <a name="l00031"></a>00031 <span class="comment">/*!</span> <a name="l00032"></a>00032 <span class="comment"> * When a record/tuple (dis)equality is expanded into the</span> <a name="l00033"></a>00033 <span class="comment"> * (dis)equalities of fields, we have to perform rewrites on the</span> <a name="l00034"></a>00034 <span class="comment"> * resulting record terms before the simplifier kicks in. </span> <a name="l00035"></a>00035 <span class="comment"> *</span> <a name="l00036"></a>00036 <span class="comment"> * Otherwise, if we have r1.f = r2.f, but r1=r2 was asserted before,</span> <a name="l00037"></a>00037 <span class="comment"> * for some complex record expressions r1 and r2, then the simplifier</span> <a name="l00038"></a>00038 <span class="comment"> * will substitute r2 for r1, and we get r2.f=r2.f at the end, which</span> <a name="l00039"></a>00039 <span class="comment"> * is not a useful fact to have.</span> <a name="l00040"></a>00040 <span class="comment"> *</span> <a name="l00041"></a>00041 <span class="comment"> * However, r1.f and/or r2.f may rewrite to something interesting, and</span> <a name="l00042"></a>00042 <span class="comment"> * the equality may yield new important facts.</span> <a name="l00043"></a>00043 <span class="comment"> */</span> <a name="l00044"></a>00044 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> <a name="l00045"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a243eef0e23027e100aede3646eca3617">00045</a> TheoryRecords::rewriteAux(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) { <a name="l00046"></a>00046 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> res; <a name="l00047"></a>00047 <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) { <a name="l00048"></a>00048 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba9efdc855f3c1477957fb50affec07f8f">EQ</a>: <a name="l00049"></a>00049 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba527cb185631442655c4486d51522b5a7">IFF</a>: <a name="l00050"></a>00050 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba865555c9f2e0458a7078486aa1b3254f">AND</a>: <a name="l00051"></a>00051 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba96727447c0ad447987df1c6415aef074">OR</a>: { <a name="l00052"></a>00052 vector<unsigned> changed; <a name="l00053"></a>00053 vector<Theorem> thms; <a name="l00054"></a>00054 <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<iend; ++i) { <a name="l00055"></a>00055 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> t(rewriteAux(e[i])); <a name="l00056"></a>00056 <span class="keywordflow">if</span>(t.<a class="code" href="classCVC3_1_1Theorem.html#a206c04f39fbbcacef2337148675553f4">getLHS</a>() != t.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>()) { <a name="l00057"></a>00057 changed.push_back(i); <a name="l00058"></a>00058 thms.push_back(t); <a name="l00059"></a>00059 } <a name="l00060"></a>00060 } <a name="l00061"></a>00061 <span class="keywordflow">if</span>(thms.size() > 0) { <a name="l00062"></a>00062 res = substitutivityRule(e, changed, thms); <a name="l00063"></a>00063 <span class="comment">// Need to guarantee that new expressions are fully simplified</span> <a name="l00064"></a>00064 <span class="keywordflow">if</span>(res.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>().<a class="code" href="group__ExprPkg.html#ga4dc94c33ae308ff8d9d004f49df8f42b">hasFind</a>()) <a name="l00065"></a>00065 res = transitivityRule(res, res.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>().<a class="code" href="group__ExprPkg.html#ga9be55edbdc2c0878fec750921a9fcc89">getFind</a>()); <a name="l00066"></a>00066 } <span class="keywordflow">else</span> <a name="l00067"></a>00067 res = reflexivityRule(e); <a name="l00068"></a>00068 <span class="keywordflow">break</span>; <a name="l00069"></a>00069 } <a name="l00070"></a>00070 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba0378ebc895849163b249d0b330257dd6">NOT</a>: { <a name="l00071"></a>00071 vector<Theorem> thms; <a name="l00072"></a>00072 thms.push_back(rewriteAux(e[0])); <a name="l00073"></a>00073 <span class="keywordflow">if</span>(thms[0].getLHS() != thms[0].getRHS()) { <a name="l00074"></a>00074 res = substitutivityRule(<a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba0378ebc895849163b249d0b330257dd6">NOT</a>, thms); <a name="l00075"></a>00075 <span class="comment">// Need to guarantee that new expressions are fully simplified</span> <a name="l00076"></a>00076 <span class="keywordflow">if</span>(res.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>().<a class="code" href="group__ExprPkg.html#ga4dc94c33ae308ff8d9d004f49df8f42b">hasFind</a>()) <a name="l00077"></a>00077 res = transitivityRule(res, res.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>().<a class="code" href="group__ExprPkg.html#ga9be55edbdc2c0878fec750921a9fcc89">getFind</a>()); <a name="l00078"></a>00078 } <span class="keywordflow">else</span> <a name="l00079"></a>00079 res = reflexivityRule(e); <a name="l00080"></a>00080 <span class="keywordflow">break</span>; <a name="l00081"></a>00081 } <a name="l00082"></a>00082 <span class="keywordflow">default</span>: <a name="l00083"></a>00083 res = rewrite(e); <a name="l00084"></a>00084 <span class="keywordflow">break</span>; <a name="l00085"></a>00085 } <a name="l00086"></a>00086 <span class="keywordflow">return</span> res; <a name="l00087"></a>00087 } <a name="l00088"></a>00088 <a name="l00089"></a>00089 <a name="l00090"></a>00090 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> <a name="l00091"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a89f926d66c9b7b414160bb12f42f4485">00091</a> TheoryRecords::rewriteAux(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& thm) { <a name="l00092"></a>00092 <span class="keywordflow">return</span> iffMP(thm, rewriteAux(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>())); <a name="l00093"></a>00093 } <a name="l00094"></a>00094 <a name="l00095"></a>00095 <a name="l00096"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a7f3fc16c1167afe2d6ff3da0a59c06fd">00096</a> TheoryRecords::TheoryRecords(<a class="code" href="classCVC3_1_1TheoryCore.html" title="This theory handles the built-in logical connectives plus equality. It also handles the registration ...">TheoryCore</a>* core) <a name="l00097"></a>00097 : <a class="code" href="classCVC3_1_1Theory.html" title="Base class for theories.">Theory</a>(core, <span class="stringliteral">"Records"</span>) <a name="l00098"></a>00098 { <a name="l00099"></a>00099 <a name="l00100"></a>00100 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>, <span class="stringliteral">"_RECORD_TYPE"</span>, <span class="keyword">true</span>); <a name="l00101"></a>00101 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>, <span class="stringliteral">"_TUPLE_TYPE"</span>, <span class="keyword">true</span>); <a name="l00102"></a>00102 <a name="l00103"></a>00103 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>, <span class="stringliteral">"_RECORD"</span>); <a name="l00104"></a>00104 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>, <span class="stringliteral">"_RECORD_SELECT"</span>); <a name="l00105"></a>00105 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>, <span class="stringliteral">"_RECORD_UPDATE"</span>); <a name="l00106"></a>00106 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>, <span class="stringliteral">"_TUPLE"</span>); <a name="l00107"></a>00107 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>, <span class="stringliteral">"_TUPLE_SELECT"</span>); <a name="l00108"></a>00108 <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()-><a class="code" href="group__EM__Priv.html#ga2b0c6f8e83135e82ebe084188e390da1" title="Register a new kind.">newKind</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>, <span class="stringliteral">"_TUPLE_UPDATE"</span>); <a name="l00109"></a>00109 <a name="l00110"></a>00110 <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a> = <a class="code" href="classCVC3_1_1TheoryRecords.html#acefe38731a5693d2c2b7d630088ee708" title="creates a reference to the proof rules">createProofRules</a>(); <a name="l00111"></a>00111 vector<int> kinds; <a name="l00112"></a>00112 <a name="l00113"></a>00113 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>); <a name="l00114"></a>00114 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>); <a name="l00115"></a>00115 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>); <a name="l00116"></a>00116 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>); <a name="l00117"></a>00117 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>); <a name="l00118"></a>00118 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>); <a name="l00119"></a>00119 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>); <a name="l00120"></a>00120 kinds.push_back(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>); <a name="l00121"></a>00121 <a name="l00122"></a>00122 <a class="code" href="classCVC3_1_1Theory.html#a97a6f8e09f71513da969fa7847346c6f" title="Register a new theory.">registerTheory</a>(<span class="keyword">this</span>, kinds); <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <a name="l00125"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a7e0ac2c2be6942fc04ce9c21951fe7a7">00125</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a7e0ac2c2be6942fc04ce9c21951fe7a7">TheoryRecords::~TheoryRecords</a>() { <a name="l00126"></a>00126 <span class="keyword">delete</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>; <a name="l00127"></a>00127 } <a name="l00128"></a>00128 <a name="l00129"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#ad7fd739c906e86c0b5a135374cc10dc0">00129</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#ad7fd739c906e86c0b5a135374cc10dc0" title="assert a fact to the theory of records">TheoryRecords::assertFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& e) <a name="l00130"></a>00130 { <a name="l00131"></a>00131 <span class="comment">// TRACE("records", "assertFact => ", e.toString(), "");</span> <a name="l00132"></a>00132 <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& expr = e.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(); <a name="l00133"></a>00133 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> expanded; <a name="l00134"></a>00134 <span class="keywordflow">switch</span>(expr.<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>()) { <a name="l00135"></a>00135 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba527cb185631442655c4486d51522b5a7">IFF</a>: <a name="l00136"></a>00136 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba9efdc855f3c1477957fb50affec07f8f">EQ</a>: { <a name="l00137"></a>00137 <span class="keywordtype">int</span> lhsKind = <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>(expr[0]).<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>().<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>(); <a name="l00138"></a>00138 <span class="keywordflow">if</span>(lhsKind == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a> || lhsKind== <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>) <a name="l00139"></a>00139 { <a name="l00140"></a>00140 expanded = <a class="code" href="classCVC3_1_1TheoryRecords.html#a243eef0e23027e100aede3646eca3617" title="Auxiliary rewrites: Processing of AND and OR of equations. Returns e=e'.">rewriteAux</a>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#a70d657a0ff820b3276c88d4208b2c6d7" title="From T|- e = e' return T|- AND (e.i = e'.i) for all i.">expandEq</a>(e)); <a name="l00141"></a>00141 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"records"</span>, <span class="stringliteral">"assertFact: enqueuing: "</span>, expanded.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>(), <span class="stringliteral">""</span>); <a name="l00142"></a>00142 <a class="code" href="classCVC3_1_1Theory.html#a93856c9af82b2c25c51b3c36bafb71f4" title="Submit a derived fact to the core from a decision procedure.">enqueueFact</a>(expanded); <a name="l00143"></a>00143 } <a name="l00144"></a>00144 <span class="keywordflow">return</span>; <a name="l00145"></a>00145 } <a name="l00146"></a>00146 <span class="keywordflow">case</span> <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba0378ebc895849163b249d0b330257dd6">NOT</a>: <a name="l00147"></a>00147 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(expr[0].getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba9efdc855f3c1477957fb50affec07f8f">EQ</a> || expr[0].getKind() == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba527cb185631442655c4486d51522b5a7">IFF</a>, <a name="l00148"></a>00148 <span class="stringliteral">"expecting a disequality or boolean field extraction: "</span> <a name="l00149"></a>00149 +expr.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00150"></a>00150 <span class="keywordflow">break</span>; <a name="l00151"></a>00151 <span class="keywordflow">default</span>: <a name="l00152"></a>00152 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">"TheoryRecords::assertFact expected an equation"</span> <a name="l00153"></a>00153 <span class="stringliteral">" or negation of equation expression. Instead it got"</span> <a name="l00154"></a>00154 + e.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>()); <a name="l00155"></a>00155 <a name="l00156"></a>00156 } <a name="l00157"></a>00157 <a name="l00158"></a>00158 } <a name="l00159"></a>00159 <a name="l00160"></a>00160 <a name="l00161"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a56d1048536807a3bb9d746c833b75c47">00161</a> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a56d1048536807a3bb9d746c833b75c47" title="rewrites an expression e to one of several allowed forms">TheoryRecords::rewrite</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) { <a name="l00162"></a>00162 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> rw; <a name="l00163"></a>00163 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"records"</span>, <span class="stringliteral">"rewrite("</span>, e, <span class="stringliteral">") {"</span>); <a name="l00164"></a>00164 <span class="keywordtype">bool</span> needRecursion=<span class="keyword">false</span>; <a name="l00165"></a>00165 <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00166"></a>00166 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>: <a name="l00167"></a>00167 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>: { <a name="l00168"></a>00168 <span class="keywordflow">switch</span>(e[0].getOpKind()){ <a name="l00169"></a>00169 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>:{ <a name="l00170"></a>00170 rw = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#a3e3add607e89398f2cc6cc38ea99d1ff" title="==> (REC_LITERAL (f1 v1) ... (fi vi) ...).fi = vi">rewriteLitSelect</a>(e); <a name="l00171"></a>00171 <span class="keywordflow">break</span>; <a name="l00172"></a>00172 } <a name="l00173"></a>00173 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>: { <a name="l00174"></a>00174 rw = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#a3e3add607e89398f2cc6cc38ea99d1ff" title="==> (REC_LITERAL (f1 v1) ... (fi vi) ...).fi = vi">rewriteLitSelect</a>(e); <a name="l00175"></a>00175 <span class="keywordflow">break</span>; <a name="l00176"></a>00176 } <a name="l00177"></a>00177 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: { <a name="l00178"></a>00178 rw = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#aa89519b074a161d4709cc57c72be9877" title="==> (REC_SELECT (REC_UPDATE e fi vi) fi) = vi">rewriteUpdateSelect</a>(e); <a name="l00179"></a>00179 needRecursion=<span class="keyword">true</span>; <a name="l00180"></a>00180 <span class="keywordflow">break</span>; <a name="l00181"></a>00181 } <a name="l00182"></a>00182 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: { <a name="l00183"></a>00183 rw = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#aa89519b074a161d4709cc57c72be9877" title="==> (REC_SELECT (REC_UPDATE e fi vi) fi) = vi">rewriteUpdateSelect</a>(e); <a name="l00184"></a>00184 needRecursion=<span class="keyword">true</span>; <a name="l00185"></a>00185 <span class="keywordflow">break</span>; <a name="l00186"></a>00186 } <a name="l00187"></a>00187 <span class="keywordflow">default</span>:{ <a name="l00188"></a>00188 rw = <a class="code" href="classCVC3_1_1Theory.html#af860f5d5e01423628c97c399606916ff" title="==> a == a">reflexivityRule</a>(e); <a name="l00189"></a>00189 <span class="keywordflow">break</span>; <a name="l00190"></a>00190 } <a name="l00191"></a>00191 } <a name="l00192"></a>00192 <span class="keywordflow">break</span>; <a name="l00193"></a>00193 } <a name="l00194"></a>00194 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: { <a name="l00195"></a>00195 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2, <a name="l00196"></a>00196 <span class="stringliteral">"TheoryRecords::rewrite(RECORD_UPDATE): e="</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00197"></a>00197 <span class="keywordflow">if</span>(e[0].getOpKind() == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>) <a name="l00198"></a>00198 rw= <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#a123d754579587119040963036a57b20c" title="==> (REC_UPDATE (REC_LITERAL (f1 v1) ... (fi vi) ...) fi v') =(REC_LITERAL (f1 v1) ...">rewriteLitUpdate</a>(e); <a name="l00199"></a>00199 <span class="keywordflow">else</span> <a name="l00200"></a>00200 rw = <a class="code" href="classCVC3_1_1Theory.html#af860f5d5e01423628c97c399606916ff" title="==> a == a">reflexivityRule</a>(e); <a name="l00201"></a>00201 <span class="keywordflow">break</span>; <a name="l00202"></a>00202 } <a name="l00203"></a>00203 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: { <a name="l00204"></a>00204 <span class="keywordflow">if</span>(e[0].getOpKind() == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>) <a name="l00205"></a>00205 rw = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#a123d754579587119040963036a57b20c" title="==> (REC_UPDATE (REC_LITERAL (f1 v1) ... (fi vi) ...) fi v') =(REC_LITERAL (f1 v1) ...">rewriteLitUpdate</a>(e); <a name="l00206"></a>00206 <span class="keywordflow">else</span> <a name="l00207"></a>00207 rw = <a class="code" href="classCVC3_1_1Theory.html#af860f5d5e01423628c97c399606916ff" title="==> a == a">reflexivityRule</a>(e); <a name="l00208"></a>00208 <span class="keywordflow">break</span>; <a name="l00209"></a>00209 } <a name="l00210"></a>00210 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: <a name="l00211"></a>00211 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>: <a name="l00212"></a>00212 rw = <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); <span class="comment">// Congruence closure rewrites</span> <a name="l00213"></a>00213 <span class="keywordflow">break</span>; <a name="l00214"></a>00214 <span class="keywordflow">default</span>: { <a name="l00215"></a>00215 rw = <a class="code" href="classCVC3_1_1Theory.html#af860f5d5e01423628c97c399606916ff" title="==> a == a">reflexivityRule</a>(e); <a name="l00216"></a>00216 <span class="keywordflow">break</span>; <a name="l00217"></a>00217 } <a name="l00218"></a>00218 } <a name="l00219"></a>00219 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> res; <a name="l00220"></a>00220 <span class="keywordflow">if</span>(needRecursion==<span class="keyword">true</span>) res = <a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) & (a2 == a3) ==> (a1 == a3)">transitivityRule</a>(rw, <a class="code" href="classCVC3_1_1TheoryRecords.html#a56d1048536807a3bb9d746c833b75c47" title="rewrites an expression e to one of several allowed forms">rewrite</a>(rw.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>())); <a name="l00221"></a>00221 <span class="keywordflow">else</span> <a name="l00222"></a>00222 res = rw; <a name="l00223"></a>00223 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"records"</span>, <span class="stringliteral">"rewrite => "</span>, res.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>(), <span class="stringliteral">" }"</span>); <a name="l00224"></a>00224 <span class="keywordflow">return</span> res; <a name="l00225"></a>00225 } <a name="l00226"></a>00226 <a name="l00227"></a>00227 <a name="l00228"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a2ae67fcdda4a2c2f55238adea0b8eabc">00228</a> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a2ae67fcdda4a2c2f55238adea0b8eabc" title="Compute and cache the TCC of e.">TheoryRecords::computeTCC</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) <a name="l00229"></a>00229 { <a name="l00230"></a>00230 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"records"</span>, <span class="stringliteral">"computeTCC( "</span>, e, <span class="stringliteral">") {"</span>); <a name="l00231"></a>00231 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> tcc(<a class="code" href="group__Theory__API.html#ga9278ad3a6eb8351865a71acd7bb7f968" title="Compute and cache the TCC of e.">Theory::computeTCC</a>(e)); <a name="l00232"></a>00232 <span class="keywordflow">switch</span> (e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00233"></a>00233 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: <a name="l00234"></a>00234 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>: <a name="l00235"></a>00235 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>: <a name="l00236"></a>00236 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>: <a name="l00237"></a>00237 <span class="keywordflow">break</span>; <a name="l00238"></a>00238 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: { <a name="l00239"></a>00239 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> tExpr = 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#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00240"></a>00240 <span class="keyword">const</span> std::string field(<a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e)); <a name="l00241"></a>00241 <span class="keywordtype">int</span> index = <a class="code" href="classCVC3_1_1TheoryRecords.html#a8b8cf0a921555538ec1b91c08600e721" title="Get the field index in the record literal or type.">getFieldIndex</a>(tExpr, field); <a name="l00242"></a>00242 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> pred = <a class="code" href="classCVC3_1_1Theory.html#a39539e895f8aade88ae5bc05bbcc9302" title="Calls the correct theory to compute a type predicate.">getTypePred</a>(e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>()[index], e[1]); <a name="l00243"></a>00243 tcc = <a class="code" href="classCVC3_1_1Theory.html#aba1822f2d985b50f6405c290c3814c1a" title="==> AND(e1,e2) IFF [simplified expr]">rewriteAnd</a>(tcc.andExpr(pred)).getRHS(); <a name="l00244"></a>00244 <span class="keywordflow">break</span>; <a name="l00245"></a>00245 } <a name="l00246"></a>00246 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: { <a name="l00247"></a>00247 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> tExpr = 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#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00248"></a>00248 <span class="keywordtype">int</span> index = <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e); <a name="l00249"></a>00249 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> pred = <a class="code" href="classCVC3_1_1Theory.html#a39539e895f8aade88ae5bc05bbcc9302" title="Calls the correct theory to compute a type predicate.">getTypePred</a>(e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>()[index], e[1]); <a name="l00250"></a>00250 tcc = <a class="code" href="classCVC3_1_1Theory.html#aba1822f2d985b50f6405c290c3814c1a" title="==> AND(e1,e2) IFF [simplified expr]">rewriteAnd</a>(tcc.andExpr(pred)).getRHS(); <a name="l00251"></a>00251 <span class="keywordflow">break</span>; <a name="l00252"></a>00252 } <a name="l00253"></a>00253 <span class="keywordflow">default</span>: { <a name="l00254"></a>00254 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a> (<span class="keyword">false</span>, <span class="stringliteral">"Theory records cannot calculate this tcc"</span>); <a name="l00255"></a>00255 } <a name="l00256"></a>00256 } <a name="l00257"></a>00257 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"records"</span>, <span class="stringliteral">"computeTCC => "</span>, tcc, <span class="stringliteral">"}"</span>); <a name="l00258"></a>00258 <span class="keywordflow">return</span> tcc; <a name="l00259"></a>00259 } <a name="l00260"></a>00260 <a name="l00261"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a77c8993b2ad9daca3803c78991589351">00261</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a77c8993b2ad9daca3803c78991589351" title="Add variables from 'e' to 'v' for constructing a concrete model.">TheoryRecords::computeModelTerm</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e, std::vector<Expr>& v) { <a name="l00262"></a>00262 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> t = e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>(); <a name="l00263"></a>00263 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> tExpr = t.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00264"></a>00264 <span class="keywordflow">if</span>(tExpr.<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#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>) { <a name="l00265"></a>00265 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(tExpr); <a name="l00266"></a>00266 <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < fields.size() ; i++) { <a name="l00267"></a>00267 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> term(<a class="code" href="classCVC3_1_1TheoryRecords.html#a6123e229d2eac24364f4cf1b30927f0c" title="Create a record field select expression.">recordSelect</a>(e, fields[i].getString())); <a name="l00268"></a>00268 term = <a class="code" href="classCVC3_1_1TheoryRecords.html#a56d1048536807a3bb9d746c833b75c47" title="rewrites an expression e to one of several allowed forms">rewrite</a>(term).<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>(); <a name="l00269"></a>00269 v.push_back(term); <a name="l00270"></a>00270 } <a name="l00271"></a>00271 } <a name="l00272"></a>00272 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(tExpr.<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#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>) { <a name="l00273"></a>00273 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i<tExpr.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); i++) { <a name="l00274"></a>00274 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> term(<a class="code" href="classCVC3_1_1TheoryRecords.html#ada5d6a109788e70405af2adee937c379" title="Create a tuple index selector expression.">tupleSelect</a>(e, i)); <a name="l00275"></a>00275 term = <a class="code" href="classCVC3_1_1TheoryRecords.html#a56d1048536807a3bb9d746c833b75c47" title="rewrites an expression e to one of several allowed forms">rewrite</a>(term).<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>(); <a name="l00276"></a>00276 v.push_back(term); <a name="l00277"></a>00277 } <a name="l00278"></a>00278 } <a name="l00279"></a>00279 } <a name="l00280"></a>00280 <a name="l00281"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a43f8bb4aeae98801e974b7f3fa0ed068">00281</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a43f8bb4aeae98801e974b7f3fa0ed068" title="Compute the value of a compound variable from the more primitive ones.">TheoryRecords::computeModel</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e, std::vector<Expr>& v) { <a name="l00282"></a>00282 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> t = <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>(e); <a name="l00283"></a>00283 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> tExpr = t.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00284"></a>00284 vector<Theorem> thms; <a name="l00285"></a>00285 vector<unsigned> changed; <a name="l00286"></a>00286 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> asst; <a name="l00287"></a>00287 <span class="keywordflow">if</span>(tExpr.<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#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>) <a name="l00288"></a>00288 asst = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#ab813be2b9919eae3952a0f0a73ed5e3a" title="Expand a record into a literal: |- e = (# f1:=e.f1, ..., fn:=e.fn #)">expandRecord</a>(e); <a name="l00289"></a>00289 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(tExpr.<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#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>) <a name="l00290"></a>00290 asst = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#a249e1cab39dd671e11f775b8f9658629" title="Expand a tuple into a literal: |- e = (e.0, ..., e.n-1)">expandTuple</a>(e); <a name="l00291"></a>00291 <span class="keywordflow">else</span> { <a name="l00292"></a>00292 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">"TheoryRecords::computeModel("</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()+<span class="stringliteral">")"</span>); <a name="l00293"></a>00293 <span class="keywordflow">return</span>; <a name="l00294"></a>00294 } <a name="l00295"></a>00295 <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>& lit = asst.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>(); <a name="l00297"></a>00297 <span class="keywordtype">int</span> size(lit.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()); <a name="l00298"></a>00298 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i < size ; i++) { <a name="l00299"></a>00299 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm(<a class="code" href="classCVC3_1_1Theory.html#a4867f332c809f6efe8f01ffa45c32db3" title="Fetch the concrete assignment to the variable during model generation.">getModelValue</a>(lit[i])); <a name="l00300"></a>00300 <span class="keywordflow">if</span>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a206c04f39fbbcacef2337148675553f4">getLHS</a>() != thm.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>()) { <a name="l00301"></a>00301 thms.push_back(thm); <a name="l00302"></a>00302 changed.push_back(i); <a name="l00303"></a>00303 } <a name="l00304"></a>00304 } <a name="l00305"></a>00305 <span class="keywordflow">if</span>(changed.size()>0) <a name="l00306"></a>00306 asst = <a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) & (a2 == a3) ==> (a1 == a3)">transitivityRule</a>(asst, <a class="code" href="classCVC3_1_1Theory.html#a92e2da5223d7fb620cce85b2813e047f" title="(c_1 == d_1) & ... & (c_n == d_n) ==> op(c_1,...,c_n) == op(d_1,...,d_n)">substitutivityRule</a>(lit, changed, thms)); <a name="l00307"></a>00307 <a class="code" href="classCVC3_1_1Theory.html#a917b117d28514f486b296568fcd1cfd1" title="Assigns t a concrete value val. Used in model generation.">assignValue</a>(asst); <a name="l00308"></a>00308 v.push_back(e); <a name="l00309"></a>00309 } <a name="l00310"></a>00310 <a name="l00311"></a>00311 <a name="l00312"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a62ea35463c9093da92601e33698f905b">00312</a> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a62ea35463c9093da92601e33698f905b" title="Theory specific computation of the subtyping predicate for type t applied to the expression e...">TheoryRecords::computeTypePred</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>& t, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) <a name="l00313"></a>00313 { <a name="l00314"></a>00314 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"typePred"</span>, <span class="stringliteral">"ComputeTypePred[Records]"</span>, e, <span class="stringliteral">""</span>); <a name="l00315"></a>00315 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> tExpr = t.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00316"></a>00316 <span class="keywordflow">switch</span>(tExpr.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00317"></a>00317 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>: { <a name="l00318"></a>00318 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(tExpr); <a name="l00319"></a>00319 vector<Expr> fieldPreds; <a name="l00320"></a>00320 <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i<fields.size(); i++) { <a name="l00321"></a>00321 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> sel(<a class="code" href="classCVC3_1_1TheoryRecords.html#a6123e229d2eac24364f4cf1b30927f0c" title="Create a record field select expression.">recordSelect</a>(e, fields[i].getString())); <a name="l00322"></a>00322 fieldPreds.push_back(<a class="code" href="classCVC3_1_1Theory.html#a39539e895f8aade88ae5bc05bbcc9302" title="Calls the correct theory to compute a type predicate.">getTypePred</a>(tExpr[i], sel)); <a name="l00323"></a>00323 } <a name="l00324"></a>00324 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> pred = <a class="code" href="namespaceCVC3.html#ad4258158bba138eb54b9080af7f8223a">andExpr</a>(fieldPreds); <a name="l00325"></a>00325 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"typePred"</span>, <span class="stringliteral">"Computed predicate "</span>, pred, <span class="stringliteral">""</span>); <a name="l00326"></a>00326 <span class="keywordflow">return</span> pred; <a name="l00327"></a>00327 } <a name="l00328"></a>00328 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>: { <a name="l00329"></a>00329 std::vector<Expr> fieldPreds; <a name="l00330"></a>00330 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i<tExpr.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); i++) { <a name="l00331"></a>00331 fieldPreds.push_back(<a class="code" href="classCVC3_1_1Theory.html#a39539e895f8aade88ae5bc05bbcc9302" title="Calls the correct theory to compute a type predicate.">getTypePred</a>(tExpr[i], <a class="code" href="classCVC3_1_1TheoryRecords.html#ada5d6a109788e70405af2adee937c379" title="Create a tuple index selector expression.">tupleSelect</a>(e, i))); <a name="l00332"></a>00332 } <a name="l00333"></a>00333 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> pred = <a class="code" href="namespaceCVC3.html#ad4258158bba138eb54b9080af7f8223a">andExpr</a>(fieldPreds); <a name="l00334"></a>00334 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"typePred"</span>, <span class="stringliteral">"Computed predicate "</span>, pred, <span class="stringliteral">""</span>); <a name="l00335"></a>00335 <span class="keywordflow">return</span> pred; <a name="l00336"></a>00336 } <a name="l00337"></a>00337 <span class="keywordflow">default</span>: <a name="l00338"></a>00338 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">"computeTypePred[TheoryRecords] called with wrong type"</span>); <a name="l00339"></a>00339 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(); <a name="l00340"></a>00340 } <a name="l00341"></a>00341 } <a name="l00342"></a>00342 <a name="l00343"></a>00343 <a name="l00344"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a0fd20bc4ca8c7701c189ce465cd3641c">00344</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a0fd20bc4ca8c7701c189ce465cd3641c" title="check record or tuple type">TheoryRecords::checkType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) <a name="l00345"></a>00345 { <a name="l00346"></a>00346 <span class="keywordflow">switch</span> (e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00347"></a>00347 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>: { <a name="l00348"></a>00348 <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="l00349"></a>00349 <span class="keywordflow">for</span> (; i != iend; ) { <a name="l00350"></a>00350 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> t(*i); <a name="l00351"></a>00351 ++i; <a name="l00352"></a>00352 <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="l00353"></a>00353 (<span class="stringliteral">"Records cannot contain BOOLEANs: "</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 <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="l00356"></a>00356 (<span class="stringliteral">"Records cannot contain functions"</span>); <a name="l00357"></a>00357 } <a name="l00358"></a>00358 <span class="keywordflow">break</span>; <a name="l00359"></a>00359 } <a name="l00360"></a>00360 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>: { <a name="l00361"></a>00361 <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="l00362"></a>00362 <span class="keywordflow">for</span> (; i != iend; ) { <a name="l00363"></a>00363 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> t(*i); <a name="l00364"></a>00364 ++i; <a name="l00365"></a>00365 <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="l00366"></a>00366 (<span class="stringliteral">"Tuples cannot contain BOOLEANs: "</span> <a name="l00367"></a>00367 +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00368"></a>00368 <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="l00369"></a>00369 (<span class="stringliteral">"Tuples cannot contain functions"</span>); <a name="l00370"></a>00370 } <a name="l00371"></a>00371 <span class="keywordflow">break</span>; <a name="l00372"></a>00372 } <a name="l00373"></a>00373 <span class="keywordflow">default</span>: <a name="l00374"></a>00374 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">"Unexpected kind in TheoryRecords::checkType"</span> <a name="l00375"></a>00375 +<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()->getKindName(e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>())); <a name="l00376"></a>00376 } <a name="l00377"></a>00377 } <a name="l00378"></a>00378 <a name="l00379"></a>00379 <a name="l00380"></a>00380 <span class="comment">//TODO: implement finiteTypeInfo</span> <a name="l00381"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#ac58f7129ed3e62d2d183922cb70428ac">00381</a> <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54" title="Enum for cardinality of types.">Cardinality</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#ac58f7129ed3e62d2d183922cb70428ac" title="Compute information related to finiteness of types.">TheoryRecords::finiteTypeInfo</a>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e, <a class="code" href="classCVC3_1_1Unsigned.html">Unsigned</a>& n, <a name="l00382"></a>00382 <span class="keywordtype">bool</span> enumerate, <span class="keywordtype">bool</span> computeSize) <a name="l00383"></a>00383 { <a name="l00384"></a>00384 <span class="keywordflow">return</span> <a class="code" href="namespaceCVC3.html#af969e724f8b7016909f5804e8cea3e54a61454dbfa122fc961909dfd151695807">CARD_UNKNOWN</a>; <a name="l00385"></a>00385 } <a name="l00386"></a>00386 <a name="l00387"></a>00387 <a name="l00388"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a59dd99a5c7c1540d6517dc69dc157cfb">00388</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a59dd99a5c7c1540d6517dc69dc157cfb" title="computes the type of a record or a tuple">TheoryRecords::computeType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) <a name="l00389"></a>00389 { <a name="l00390"></a>00390 <span class="keywordflow">switch</span> (e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00391"></a>00391 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>:{ <a name="l00392"></a>00392 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() > 0, <span class="stringliteral">"wrong arity of RECORD"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00393"></a>00393 vector<Expr> fieldTypes; <a name="l00394"></a>00394 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l00395"></a>00395 <span class="keywordtype">string</span> previous; <a name="l00396"></a>00396 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>((<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>)e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == fields.size(), <a name="l00397"></a>00397 <span class="stringliteral">"size of fields does not match size of values"</span>); <a name="l00398"></a>00398 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i<e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); ++i) { <a name="l00399"></a>00399 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(fields[i].getString() != previous, <a name="l00400"></a>00400 <span class="stringliteral">"a record cannot not contain repeated fields"</span> <a name="l00401"></a>00401 + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00402"></a>00402 fieldTypes.push_back(e[i].getType().getExpr()); <a name="l00403"></a>00403 previous=fields[i].getString(); <a name="l00404"></a>00404 } <a name="l00405"></a>00405 e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(<a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105" title="Create a record type.">recordType</a>(fields, fieldTypes))); <a name="l00406"></a>00406 <span class="keywordflow">return</span>; <a name="l00407"></a>00407 } <a name="l00408"></a>00408 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>: { <a name="l00409"></a>00409 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 1, <span class="stringliteral">"wrong arity of RECORD_SELECT"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00410"></a>00410 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> t = e[0].<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#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00411"></a>00411 <span class="keyword">const</span> <span class="keywordtype">string</span>& field = <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e); <a name="l00412"></a>00412 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(t.getOpKind() == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>, <span class="stringliteral">"incorrect RECORD_SELECT expression"</span> <a name="l00413"></a>00413 <span class="stringliteral">"first child not a RECORD_TYPE"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00414"></a>00414 <span class="keywordtype">int</span> index = <a class="code" href="classCVC3_1_1TheoryRecords.html#a8b8cf0a921555538ec1b91c08600e721" title="Get the field index in the record literal or type.">getFieldIndex</a>(t, field); <a name="l00415"></a>00415 <span class="keywordflow">if</span>(index==-1) <a name="l00416"></a>00416 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>(<span class="stringliteral">"record selection does not match any field "</span> <a name="l00417"></a>00417 <span class="stringliteral">"in record"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00418"></a>00418 e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(<a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(t[index])); <a name="l00419"></a>00419 <span class="keywordflow">return</span>; <a name="l00420"></a>00420 } <a name="l00421"></a>00421 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: { <a name="l00422"></a>00422 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2, <span class="stringliteral">"wrong arity of RECORD_UPDATE"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00423"></a>00423 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> t = e[0].<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#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00424"></a>00424 <span class="keyword">const</span> <span class="keywordtype">string</span>& field = <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e); <a name="l00425"></a>00425 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(t.getOpKind() == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>, <span class="stringliteral">"incorrect RECORD_SELECT expression"</span> <a name="l00426"></a>00426 <span class="stringliteral">"first child not a RECORD_TYPE"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00427"></a>00427 <span class="keywordtype">int</span> index = <a class="code" href="classCVC3_1_1TheoryRecords.html#a8b8cf0a921555538ec1b91c08600e721" title="Get the field index in the record literal or type.">getFieldIndex</a>(t, field); <a name="l00428"></a>00428 <span class="keywordflow">if</span>(index==-1) <a name="l00429"></a>00429 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a> <a name="l00430"></a>00430 (<span class="stringliteral">"record update field \""</span>+field <a name="l00431"></a>00431 +<span class="stringliteral">"\" does not match any in record type:\n"</span> <a name="l00432"></a>00432 +t.toString()+<span class="stringliteral">"\n\nThe complete expression is:\n\n"</span> <a name="l00433"></a>00433 + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00434"></a>00434 <span class="keywordflow">if</span>(<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>(t[index])) != <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>(e[1])) <a name="l00435"></a>00435 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>(<span class="stringliteral">"Type checking error: \n"</span>+ e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00436"></a>00436 e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(e[0].getType()); <a name="l00437"></a>00437 <span class="keywordflow">return</span>; <a name="l00438"></a>00438 } <a name="l00439"></a>00439 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>: { <a name="l00440"></a>00440 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() > 0, <span class="stringliteral">"wrong arity of TUPLE"</span>+ e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00441"></a>00441 std::vector<Expr> types; <a name="l00442"></a>00442 <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> it = e.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), end=e.<a class="code" href="group__ExprPkg.html#gaf6048a5030c8fa2511bf5dfee868e653" title="End iterator.">end</a>(); it!=end; ++it) <a name="l00443"></a>00443 { <a name="l00444"></a>00444 types.push_back((*it).getType().getExpr()); <a name="l00445"></a>00445 } <a name="l00446"></a>00446 e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(<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>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>, types, <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()))); <a name="l00447"></a>00447 <span class="keywordflow">return</span>; <a name="l00448"></a>00448 } <a name="l00449"></a>00449 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>: { <a name="l00450"></a>00450 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 1, <span class="stringliteral">"wrong arity of TUPLE_SELECT"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00451"></a>00451 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> t = e[0].<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#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00452"></a>00452 <span class="keywordtype">int</span> index = <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e); <a name="l00453"></a>00453 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(t.getOpKind() == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>, <a name="l00454"></a>00454 <span class="stringliteral">"incorrect TUPLE_SELECT expression: "</span> <a name="l00455"></a>00455 <span class="stringliteral">"first child is not a TUPLE_TYPE:\n\n"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00456"></a>00456 <span class="keywordflow">if</span>(index >= t.arity()) <a name="l00457"></a>00457 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>(<span class="stringliteral">"tuple index exceeds number of fields: \n"</span> <a name="l00458"></a>00458 + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00459"></a>00459 e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(<a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>(t[index])); <a name="l00460"></a>00460 <span class="keywordflow">return</span>; <a name="l00461"></a>00461 } <a name="l00462"></a>00462 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: { <a name="l00463"></a>00463 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2, <span class="stringliteral">"wrong arity of TUPLE_UPDATE"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00464"></a>00464 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> t = e[0].<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#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00465"></a>00465 <span class="keywordtype">int</span> index = <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e); <a name="l00466"></a>00466 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(t.getOpKind() == <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>, <span class="stringliteral">"incorrect TUPLE_SELECT expression: "</span> <a name="l00467"></a>00467 <span class="stringliteral">"first child not a TUPLE_TYPE:\n\n"</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00468"></a>00468 <span class="keywordflow">if</span>(index >= t.arity()) <a name="l00469"></a>00469 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>(<span class="stringliteral">"tuple index exceeds number of fields: \n"</span> <a name="l00470"></a>00470 + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00471"></a>00471 <span class="keywordflow">if</span>(<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>(t[index])) != <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>(e[1])) <a name="l00472"></a>00472 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>(<span class="stringliteral">"tuple update type mismatch: \n"</span>+ e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00473"></a>00473 e.<a class="code" href="group__ExprPkg.html#ga07d47f902598e00097086deabf04d9c5" title="Set the cached type.">setType</a>(e[0].getType()); <a name="l00474"></a>00474 <span class="keywordflow">return</span>; <a name="l00475"></a>00475 } <a name="l00476"></a>00476 <span class="keywordflow">default</span>: <a name="l00477"></a>00477 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>,<span class="stringliteral">"Unexpected type: "</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00478"></a>00478 <span class="keywordflow">break</span>; <a name="l00479"></a>00479 } <a name="l00480"></a>00480 } <a name="l00481"></a>00481 <a name="l00482"></a>00482 <a name="l00483"></a>00483 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a name="l00484"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a0cdc07a00c674c1190f721908a77c0ca">00484</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a0cdc07a00c674c1190f721908a77c0ca" title="Compute the base type of the top-level operator of an arbitrary type.">TheoryRecords::computeBaseType</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a>& t) { <a name="l00485"></a>00485 <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e = t.<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00486"></a>00486 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> res; <a name="l00487"></a>00487 <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00488"></a>00488 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>: <a name="l00489"></a>00489 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>: { <a name="l00490"></a>00490 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() > 0, <span class="stringliteral">"Expected non-empty type"</span>); <a name="l00491"></a>00491 vector<Expr> kids; <a name="l00492"></a>00492 <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="l00493"></a>00493 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="l00494"></a>00494 } <a name="l00495"></a>00495 res = <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="l00496"></a>00496 <span class="keywordflow">break</span>; <a name="l00497"></a>00497 } <a name="l00498"></a>00498 <span class="keywordflow">default</span>: <a name="l00499"></a>00499 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <a name="l00500"></a>00500 <span class="stringliteral">"TheoryRecords::computeBaseType("</span>+t.<a class="code" href="classCVC3_1_1Type.html#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">toString</a>()+<span class="stringliteral">")"</span>); <a name="l00501"></a>00501 res = t; <a name="l00502"></a>00502 } <a name="l00503"></a>00503 <span class="keywordflow">return</span> res; <a name="l00504"></a>00504 } <a name="l00505"></a>00505 <a name="l00506"></a>00506 <a name="l00507"></a>00507 <span class="keywordtype">void</span> <a name="l00508"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a707f98454898e685084f75a006cdd100">00508</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a707f98454898e685084f75a006cdd100" title="Set up the term e for call-backs when e or its children change.">TheoryRecords::setup</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) { <a name="l00509"></a>00509 <span class="comment">// Only set up terms</span> <a name="l00510"></a>00510 <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>()) { <a name="l00511"></a>00511 <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00512"></a>00512 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: <a name="l00513"></a>00513 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>: <span class="comment">// Setup for congruence closure</span> <a name="l00514"></a>00514 <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="l00515"></a>00515 <span class="keywordflow">break</span>; <a name="l00516"></a>00516 <span class="keywordflow">default</span>: { <span class="comment">// Everything else</span> <a name="l00517"></a>00517 <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="l00518"></a>00518 i->addToNotify(<span class="keyword">this</span>, e); <a name="l00519"></a>00519 <span class="comment">// Check if we have a tuple of record type, and set up those for CC</span> <a name="l00520"></a>00520 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> tp(<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>(e)); <a name="l00521"></a>00521 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm; <a name="l00522"></a>00522 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a71dfd95cef55ec88b9c2a29297542ab0" title="Test whether expr is a record type.">isRecordType</a>(tp)) <span class="comment">// Expand e into its literal, and it setup for CC</span> <a name="l00523"></a>00523 thm = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#ab813be2b9919eae3952a0f0a73ed5e3a" title="Expand a record into a literal: |- e = (# f1:=e.f1, ..., fn:=e.fn #)">expandRecord</a>(e); <a name="l00524"></a>00524 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a6c178cfcd9fd7e13a0c28ff28ce60f4d" title="Test if expr represents a tuple type.">isTupleType</a>(tp)) <a name="l00525"></a>00525 thm = <a class="code" href="classCVC3_1_1TheoryRecords.html#a6bb9f23a660b77ee034a407bc46774dd">d_rules</a>-><a class="code" href="classCVC3_1_1RecordsProofRules.html#a249e1cab39dd671e11f775b8f9658629" title="Expand a tuple into a literal: |- e = (e.0, ..., e.n-1)">expandTuple</a>(e); <a name="l00526"></a>00526 <span class="keywordflow">if</span>(!thm.<a class="code" href="classCVC3_1_1Theorem.html#afc6fdb0507eb3669e28d9be5ed0bd333">isNull</a>()) { <a name="l00527"></a>00527 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> lit(thm.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>()); <a name="l00528"></a>00528 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"records"</span>, <span class="stringliteral">"setup: lit = "</span>, lit, <span class="stringliteral">""</span>); <a name="l00529"></a>00529 <span class="comment">// Simplify the kids</span> <a name="l00530"></a>00530 vector<Theorem> thms; <a name="l00531"></a>00531 vector<unsigned> changed; <a name="l00532"></a>00532 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0,iend=lit.arity(); i<iend; ++i) { <a name="l00533"></a>00533 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"records"</span>, <span class="stringliteral">"setup: rewriting lit["</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">"] = "</span>, <a name="l00534"></a>00534 lit[i], <span class="stringliteral">""</span>); <a name="l00535"></a>00535 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> t = <a class="code" href="classCVC3_1_1TheoryRecords.html#a56d1048536807a3bb9d746c833b75c47" title="rewrites an expression e to one of several allowed forms">rewrite</a>(lit[i]); <a name="l00536"></a>00536 t = <a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) & (a2 == a3) ==> (a1 == a3)">transitivityRule</a>(t, <a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(t.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>())); <a name="l00537"></a>00537 <span class="keywordflow">if</span>(lit[i] != t.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>()) { <a name="l00538"></a>00538 thms.push_back(t); <a name="l00539"></a>00539 changed.push_back(i); <a name="l00540"></a>00540 } <a name="l00541"></a>00541 } <a name="l00542"></a>00542 <span class="keywordflow">if</span>(changed.size()>0) { <a name="l00543"></a>00543 thm = <a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) & (a2 == a3) ==> (a1 == a3)">transitivityRule</a>(thm, <a class="code" href="classCVC3_1_1Theory.html#a92e2da5223d7fb620cce85b2813e047f" title="(c_1 == d_1) & ... & (c_n == d_n) ==> op(c_1,...,c_n) == op(d_1,...,d_n)">substitutivityRule</a>(lit, changed, thms)); <a name="l00544"></a>00544 lit = thm.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>(); <a name="l00545"></a>00545 } <a name="l00546"></a>00546 <span class="comment">// Check if lit has already been setup</span> <a name="l00547"></a>00547 <span class="keywordflow">if</span>(lit.hasFind()) { <a name="l00548"></a>00548 <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) & (a2 == a3) ==> (a1 == a3)">transitivityRule</a>(thm, <a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(lit))); <a name="l00549"></a>00549 } <span class="keywordflow">else</span> { <a name="l00550"></a>00550 <a class="code" href="classCVC3_1_1Theory.html#a90684d2a97738341c00f8f9c99af7b66" title="Get a pointer to theoryCore.">theoryCore</a>()-><a class="code" href="classCVC3_1_1TheoryCore.html#afbd6dec08ab7f31031ddc2a97d779bd8" title="Setup additional terms within a theory-specific setup().">setupTerm</a>(lit, <span class="keyword">this</span>, thm); <a name="l00551"></a>00551 <a class="code" href="classCVC3_1_1Theory.html#a135cfab97004ee025a7840d72b6c4e1d" title="Handle new equalities (usually asserted through addFact)">assertEqualities</a>(<a class="code" href="classCVC3_1_1Theory.html#a7440711981ac1bba2bed7476c0fa4e0b" title="a1 == a2 ==> a2 == a1">symmetryRule</a>(thm)); <a name="l00552"></a>00552 } <a name="l00553"></a>00553 } <a name="l00554"></a>00554 } <a name="l00555"></a>00555 } <a name="l00556"></a>00556 } <a name="l00557"></a>00557 } <a name="l00558"></a>00558 <a name="l00559"></a>00559 <a name="l00560"></a>00560 <span class="keywordtype">void</span> <a name="l00561"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a070b5644bc6e362999305ee8bb3774ff">00561</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a070b5644bc6e362999305ee8bb3774ff" title="Notify a theory of a new equality.">TheoryRecords::update</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& e, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& d) { <a name="l00562"></a>00562 <span class="keywordflow">if</span> (<a class="code" href="classCVC3_1_1Theory.html#ab85541a91803599b7495f709c72c28c5" title="Check if the current context is inconsistent.">inconsistent</a>()) <span class="keywordflow">return</span>; <a name="l00563"></a>00563 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(d.<a class="code" href="group__ExprPkg.html#ga4dc94c33ae308ff8d9d004f49df8f42b">hasFind</a>(), <span class="stringliteral">"Expected d to have find"</span>); <a name="l00564"></a>00564 <a name="l00565"></a>00565 <span class="keywordflow">switch</span>(d.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()) { <a name="l00566"></a>00566 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: <a name="l00567"></a>00567 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>: <a name="l00568"></a>00568 <span class="comment">// Record and tuple literals are handled by congruence closure updates</span> <a name="l00569"></a>00569 <a class="code" href="classCVC3_1_1Theory.html#a0b9e5a75b0e23a334563392f075df9e2" title="Update a term w.r.t. congruence closure (must be setup with setupCC())">updateCC</a>(e, d); <a name="l00570"></a>00570 <span class="keywordflow">break</span>; <a name="l00571"></a>00571 <span class="keywordflow">default</span>: <span class="comment">// Everything else</span> <a name="l00572"></a>00572 <span class="comment">// If d is not its own representative, don't do anything; the</span> <a name="l00573"></a>00573 <span class="comment">// representative will be sent to us eventually.</span> <a name="l00574"></a>00574 <span class="keywordflow">if</span> (<a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(d).getRHS() == d) { <a name="l00575"></a>00575 <span class="comment">// Substitute e[1] for e[0] in d and assert the result equal to d</span> <a name="l00576"></a>00576 <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="l00577"></a>00577 thm = <a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) & (a2 == a3) ==> (a1 == a3)">transitivityRule</a>(thm, <a class="code" href="classCVC3_1_1TheoryRecords.html#a56d1048536807a3bb9d746c833b75c47" title="rewrites an expression e to one of several allowed forms">rewrite</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>())); <a name="l00578"></a>00578 <a class="code" href="classCVC3_1_1Theory.html#a135cfab97004ee025a7840d72b6c4e1d" title="Handle new equalities (usually asserted through addFact)">assertEqualities</a>(<a class="code" href="classCVC3_1_1Theory.html#a76f6507116e36f46dab074781fb9bf2d" title="(a1 == a2) & (a2 == a3) ==> (a1 == a3)">transitivityRule</a>(thm, <a class="code" href="classCVC3_1_1Theory.html#ac59f888b3b3f973580e061ffd803b6bb" title="Return the theorem that e is equal to its find.">find</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>()))); <a name="l00579"></a>00579 } <a name="l00580"></a>00580 } <a name="l00581"></a>00581 } <a name="l00582"></a>00582 <a name="l00583"></a>00583 <a name="l00584"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#aad0935f7bc94c98934c0e1690b2ec850">00584</a> <a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>& <a class="code" href="classCVC3_1_1TheoryRecords.html#aad0935f7bc94c98934c0e1690b2ec850" title="pretty printing">TheoryRecords::print</a>(<a class="code" href="classCVC3_1_1ExprStream.html" title="Pretty-printing output stream for Expr. READ THE DOCS BEFORE USING!">ExprStream</a>& os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) <a name="l00585"></a>00585 { <a name="l00586"></a>00586 <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="l00587"></a>00587 <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="l00588"></a>00588 <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()){ <a name="l00589"></a>00589 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>:{ <a name="l00590"></a>00590 <span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00591"></a>00591 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>; <a name="l00592"></a>00592 <span class="keywordflow">if</span>(i!=iend) os << e[i]; <a name="l00593"></a>00593 ++i; <a name="l00594"></a>00594 <span class="keywordflow">for</span>(; i!=iend; ++i) os << push << <span class="stringliteral">","</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i]; <a name="l00595"></a>00595 os << push << <span class="stringliteral">")"</span>; <a name="l00596"></a>00596 <span class="keywordflow">break</span>; <a name="l00597"></a>00597 } <a name="l00598"></a>00598 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>: { <a name="l00599"></a>00599 <span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00600"></a>00600 os << <span class="stringliteral">"["</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>; <a name="l00601"></a>00601 <span class="keywordflow">if</span>(i!=iend) os << e[i]; <a name="l00602"></a>00602 ++i; <a name="l00603"></a>00603 <span class="keywordflow">for</span>(; i!=iend; ++i) os << push << <span class="stringliteral">","</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i]; <a name="l00604"></a>00604 os << push << <span class="stringliteral">"]"</span>; <a name="l00605"></a>00605 <span class="keywordflow">break</span>; <a name="l00606"></a>00606 } <a name="l00607"></a>00607 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: { <a name="l00608"></a>00608 <span class="keywordtype">size_t</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00609"></a>00609 <span class="keywordflow">if</span>(!<a class="code" href="classCVC3_1_1TheoryRecords.html#a5aee76070091906e4b5a710d2c1e2d5b" title="Test whether expr is a record literal.">isRecord</a>(e)) { <a name="l00610"></a>00610 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="l00611"></a>00611 <span class="keywordflow">break</span>; <a name="l00612"></a>00612 } <a name="l00613"></a>00613 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l00614"></a>00614 <span class="keywordflow">if</span>(iend != fields.size()) { <a name="l00615"></a>00615 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="l00616"></a>00616 <span class="keywordflow">break</span>; <a name="l00617"></a>00617 } <a name="l00618"></a>00618 os << <span class="stringliteral">"(# "</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>; <a name="l00619"></a>00619 <span class="keywordflow">if</span>(i!=iend) { <a name="l00620"></a>00620 os << fields[i].getString() << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00621"></a>00621 << <span class="stringliteral">":="</span><< <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << push << e[i] << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00622"></a>00622 ++i; <a name="l00623"></a>00623 } <a name="l00624"></a>00624 <span class="keywordflow">for</span>(; i!=iend; ++i) <a name="l00625"></a>00625 os << push << <span class="stringliteral">","</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << fields[i].getString() <a name="l00626"></a>00626 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00627"></a>00627 << <span class="stringliteral">":="</span><< <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << push << e[i] << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00628"></a>00628 os << push << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"#)"</span>; <a name="l00629"></a>00629 <span class="keywordflow">break</span>; <a name="l00630"></a>00630 } <a name="l00631"></a>00631 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>: { <a name="l00632"></a>00632 <span class="keywordtype">size_t</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00633"></a>00633 <span class="keywordflow">if</span>(!<a class="code" href="classCVC3_1_1TheoryRecords.html#a71dfd95cef55ec88b9c2a29297542ab0" title="Test whether expr is a record type.">isRecordType</a>(e)) { <a name="l00634"></a>00634 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="l00635"></a>00635 <span class="keywordflow">break</span>; <a name="l00636"></a>00636 } <a name="l00637"></a>00637 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l00638"></a>00638 <span class="keywordflow">if</span>(iend != fields.size()) { <a name="l00639"></a>00639 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="l00640"></a>00640 <span class="keywordflow">break</span>; <a name="l00641"></a>00641 } <a name="l00642"></a>00642 os << <span class="stringliteral">"[# "</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a>; <a name="l00643"></a>00643 <span class="keywordflow">if</span>(i!=iend) { <a name="l00644"></a>00644 os << fields[i].getString() << <span class="stringliteral">":"</span><< <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << push << e[i] << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00645"></a>00645 ++i; <a name="l00646"></a>00646 } <a name="l00647"></a>00647 <span class="keywordflow">for</span>(; i!=iend; ++i) <a name="l00648"></a>00648 os << push << <span class="stringliteral">","</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << fields[i].getString() <a name="l00649"></a>00649 << <span class="stringliteral">":"</span><< <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << push << e[i] << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00650"></a>00650 os << push << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"#]"</span>; <a name="l00651"></a>00651 <span class="keywordflow">break</span>; <a name="l00652"></a>00652 } <a name="l00653"></a>00653 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>: <a name="l00654"></a>00654 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a09dac099c2d70610b91e30cd21e00fe1" title="Test whether expr is a record select/update subclass.">isRecordAccess</a>(e) && e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 1) <a name="l00655"></a>00655 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">")"</span> << <span class="stringliteral">"."</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> <a name="l00656"></a>00656 << <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e); <a name="l00657"></a>00657 <span class="keywordflow">else</span> <a name="l00658"></a>00658 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="l00659"></a>00659 <span class="keywordflow">break</span>; <a name="l00660"></a>00660 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>: <a name="l00661"></a>00661 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a8524c2c102a95e757b3c990b44e9576d" title="Test whether expr is a tuple select/update subclass.">isTupleAccess</a>(e) && e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 1) <a name="l00662"></a>00662 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">")"</span> << <span class="stringliteral">"."</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> <a name="l00663"></a>00663 << <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e); <a name="l00664"></a>00664 <span class="keywordflow">else</span> <a name="l00665"></a>00665 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="l00666"></a>00666 <span class="keywordflow">break</span>; <a name="l00667"></a>00667 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: <a name="l00668"></a>00668 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a09dac099c2d70610b91e30cd21e00fe1" title="Test whether expr is a record select/update subclass.">isRecordAccess</a>(e) && e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2) <a name="l00669"></a>00669 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"WITH ."</span> <a name="l00670"></a>00670 << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e) <a name="l00671"></a>00671 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">":="</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << e[1] << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">")"</span>; <a name="l00672"></a>00672 <span class="keywordflow">else</span> <a name="l00673"></a>00673 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="l00674"></a>00674 <span class="keywordflow">break</span>; <a name="l00675"></a>00675 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: <a name="l00676"></a>00676 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a8524c2c102a95e757b3c990b44e9576d" title="Test whether expr is a tuple select/update subclass.">isTupleAccess</a>(e) && e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2) <a name="l00677"></a>00677 os << <span class="stringliteral">"("</span> << push << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"WITH ."</span> <a name="l00678"></a>00678 << push << <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e) <a name="l00679"></a>00679 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">":="</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << push << e[1] << push << <span class="stringliteral">")"</span>; <a name="l00680"></a>00680 <span class="keywordflow">else</span> <a name="l00681"></a>00681 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="l00682"></a>00682 <span class="keywordflow">break</span>; <a name="l00683"></a>00683 <span class="keywordflow">default</span>: <a name="l00684"></a>00684 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="l00685"></a>00685 <span class="keywordflow">break</span>; <a name="l00686"></a>00686 } <a name="l00687"></a>00687 <span class="keywordflow">break</span>; <a name="l00688"></a>00688 } <a name="l00689"></a>00689 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea548619427a4d459d859ccd041ced9bfa" title="SMT-LIB format.">SMTLIB_LANG</a>: <a name="l00690"></a>00690 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0eaed2643c62e36b9b222804a1ab5b4809e" title="SMT-LIB v2 format.">SMTLIB_V2_LANG</a>: { <a name="l00691"></a>00691 <a class="code" href="classCVC3_1_1Theory.html#a262fdc338527489b376ec181ecc38ddc">d_theoryUsed</a> = <span class="keyword">true</span>; <a name="l00692"></a>00692 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1SmtlibException.html">SmtlibException</a>(<span class="stringliteral">"TheoryRecords::print: SMTLIB not supported"</span>); <a name="l00693"></a>00693 <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()){ <a name="l00694"></a>00694 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>:{ <a name="l00695"></a>00695 <span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00696"></a>00696 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"TUPLE"</span>; <a name="l00697"></a>00697 <span class="keywordflow">for</span>(; i<iend; ++i) os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i]; <a name="l00698"></a>00698 os << push << <span class="stringliteral">")"</span>; <a name="l00699"></a>00699 <span class="keywordflow">break</span>; <a name="l00700"></a>00700 } <a name="l00701"></a>00701 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>: { <span class="comment">// FIXME: change to TUPLE_TYPE</span> <a name="l00702"></a>00702 <span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00703"></a>00703 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"TUPLE_TYPE"</span>; <a name="l00704"></a>00704 <span class="keywordflow">for</span>(; i!=iend; ++i) os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i]; <a name="l00705"></a>00705 os << push << <span class="stringliteral">")"</span>; <a name="l00706"></a>00706 <span class="keywordflow">break</span>; <a name="l00707"></a>00707 } <a name="l00708"></a>00708 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: { <a name="l00709"></a>00709 <span class="keywordtype">size_t</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00710"></a>00710 <span class="keywordflow">if</span>(!<a class="code" href="classCVC3_1_1TheoryRecords.html#a5aee76070091906e4b5a710d2c1e2d5b" title="Test whether expr is a record literal.">isRecord</a>(e)) { <a name="l00711"></a>00711 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="l00712"></a>00712 <span class="keywordflow">break</span>; <a name="l00713"></a>00713 } <a name="l00714"></a>00714 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l00715"></a>00715 <span class="keywordflow">if</span>(iend != fields.size()) { <a name="l00716"></a>00716 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="l00717"></a>00717 <span class="keywordflow">break</span>; <a name="l00718"></a>00718 } <a name="l00719"></a>00719 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"RECORD"</span>; <a name="l00720"></a>00720 <span class="keywordflow">for</span>(; i!=iend; ++i) <a name="l00721"></a>00721 os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"("</span> << push << fields[i].getString() << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00722"></a>00722 << e[i] << push << <span class="stringliteral">")"</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00723"></a>00723 os << push << <span class="stringliteral">")"</span>; <a name="l00724"></a>00724 <span class="keywordflow">break</span>; <a name="l00725"></a>00725 } <a name="l00726"></a>00726 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>: { <a name="l00727"></a>00727 <span class="keywordtype">size_t</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00728"></a>00728 <span class="keywordflow">if</span>(!<a class="code" href="classCVC3_1_1TheoryRecords.html#a5aee76070091906e4b5a710d2c1e2d5b" title="Test whether expr is a record literal.">isRecord</a>(e)) { <a name="l00729"></a>00729 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="l00730"></a>00730 <span class="keywordflow">break</span>; <a name="l00731"></a>00731 } <a name="l00732"></a>00732 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l00733"></a>00733 <span class="keywordflow">if</span>(iend != fields.size()) { <a name="l00734"></a>00734 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="l00735"></a>00735 <span class="keywordflow">break</span>; <a name="l00736"></a>00736 } <a name="l00737"></a>00737 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"RECORD_TYPE"</span>; <a name="l00738"></a>00738 <span class="keywordflow">for</span>(; i!=iend; ++i) <a name="l00739"></a>00739 os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"("</span> << push << fields[i].getString() <a name="l00740"></a>00740 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i] << push << <span class="stringliteral">")"</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00741"></a>00741 os << push << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">")"</span>; <a name="l00742"></a>00742 <span class="keywordflow">break</span>; <a name="l00743"></a>00743 } <a name="l00744"></a>00744 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>: <a name="l00745"></a>00745 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a09dac099c2d70610b91e30cd21e00fe1" title="Test whether expr is a record select/update subclass.">isRecordAccess</a>(e)) <a name="l00746"></a>00746 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"RECORD_SELECT"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00747"></a>00747 << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e) << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">")"</span>; <a name="l00748"></a>00748 <span class="keywordflow">else</span> <a name="l00749"></a>00749 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="l00750"></a>00750 <span class="keywordflow">break</span>; <a name="l00751"></a>00751 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>: <a name="l00752"></a>00752 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a8524c2c102a95e757b3c990b44e9576d" title="Test whether expr is a tuple select/update subclass.">isTupleAccess</a>(e)) <a name="l00753"></a>00753 os << <span class="stringliteral">"("</span> << push << <span class="stringliteral">"TUPLE_SELECT"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00754"></a>00754 << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e) << push << <span class="stringliteral">")"</span>; <a name="l00755"></a>00755 <span class="keywordflow">else</span> <a name="l00756"></a>00756 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="l00757"></a>00757 <span class="keywordflow">break</span>; <a name="l00758"></a>00758 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: <a name="l00759"></a>00759 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a09dac099c2d70610b91e30cd21e00fe1" title="Test whether expr is a record select/update subclass.">isRecordAccess</a>(e) && e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2) <a name="l00760"></a>00760 os << <span class="stringliteral">"("</span> << push << <span class="stringliteral">"RECORD_UPDATE"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00761"></a>00761 << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e) <a name="l00762"></a>00762 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[1] << push << <span class="stringliteral">")"</span>; <a name="l00763"></a>00763 <span class="keywordflow">else</span> <a name="l00764"></a>00764 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">break</span>; <a name="l00766"></a>00766 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: <a name="l00767"></a>00767 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a8524c2c102a95e757b3c990b44e9576d" title="Test whether expr is a tuple select/update subclass.">isTupleAccess</a>(e)) <a name="l00768"></a>00768 os << <span class="stringliteral">"("</span> << push << <span class="stringliteral">"TUPLE_UPDATE"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[0] <a name="l00769"></a>00769 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e) <a name="l00770"></a>00770 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[1] << push << <span class="stringliteral">")"</span>; <a name="l00771"></a>00771 <span class="keywordflow">else</span> <a name="l00772"></a>00772 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="l00773"></a>00773 <span class="keywordflow">break</span>; <a name="l00774"></a>00774 <span class="keywordflow">default</span>: <a name="l00775"></a>00775 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="l00776"></a>00776 <span class="keywordflow">break</span>; <a name="l00777"></a>00777 } <a name="l00778"></a>00778 <span class="keywordflow">break</span>; <a name="l00779"></a>00779 } <a name="l00780"></a>00780 <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="l00781"></a>00781 <span class="keywordflow">switch</span>(e.<a class="code" href="group__ExprPkg.html#gad036a3a3597d590ca6ee694505c6e1cd" title="Get kind of operator (for APPLY Exprs only)">getOpKind</a>()){ <a name="l00782"></a>00782 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>:{ <a name="l00783"></a>00783 <span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00784"></a>00784 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"TUPLE"</span>; <a name="l00785"></a>00785 <span class="keywordflow">for</span>(; i<iend; ++i) os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i]; <a name="l00786"></a>00786 os << push << <span class="stringliteral">")"</span>; <a name="l00787"></a>00787 <span class="keywordflow">break</span>; <a name="l00788"></a>00788 } <a name="l00789"></a>00789 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>: { <span class="comment">// FIXME: change to TUPLE_TYPE</span> <a name="l00790"></a>00790 <span class="keywordtype">int</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00791"></a>00791 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"TUPLE_TYPE"</span>; <a name="l00792"></a>00792 <span class="keywordflow">for</span>(; i!=iend; ++i) os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i]; <a name="l00793"></a>00793 os << push << <span class="stringliteral">")"</span>; <a name="l00794"></a>00794 <span class="keywordflow">break</span>; <a name="l00795"></a>00795 } <a name="l00796"></a>00796 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: { <a name="l00797"></a>00797 <span class="keywordtype">size_t</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00798"></a>00798 <span class="keywordflow">if</span>(!<a class="code" href="classCVC3_1_1TheoryRecords.html#a5aee76070091906e4b5a710d2c1e2d5b" title="Test whether expr is a record literal.">isRecord</a>(e)) { <a name="l00799"></a>00799 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="l00800"></a>00800 <span class="keywordflow">break</span>; <a name="l00801"></a>00801 } <a name="l00802"></a>00802 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l00803"></a>00803 <span class="keywordflow">if</span>(iend != fields.size()) { <a name="l00804"></a>00804 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="l00805"></a>00805 <span class="keywordflow">break</span>; <a name="l00806"></a>00806 } <a name="l00807"></a>00807 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"RECORD"</span>; <a name="l00808"></a>00808 <span class="keywordflow">for</span>(; i!=iend; ++i) <a name="l00809"></a>00809 os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"("</span> << push << fields[i].getString() << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00810"></a>00810 << e[i] << push << <span class="stringliteral">")"</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00811"></a>00811 os << push << <span class="stringliteral">")"</span>; <a name="l00812"></a>00812 <span class="keywordflow">break</span>; <a name="l00813"></a>00813 } <a name="l00814"></a>00814 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>: { <a name="l00815"></a>00815 <span class="keywordtype">size_t</span> i=0, iend=e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>(); <a name="l00816"></a>00816 <span class="keywordflow">if</span>(!<a class="code" href="classCVC3_1_1TheoryRecords.html#a5aee76070091906e4b5a710d2c1e2d5b" title="Test whether expr is a record literal.">isRecord</a>(e)) { <a name="l00817"></a>00817 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="l00818"></a>00818 <span class="keywordflow">break</span>; <a name="l00819"></a>00819 } <a name="l00820"></a>00820 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l00821"></a>00821 <span class="keywordflow">if</span>(iend != fields.size()) { <a name="l00822"></a>00822 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="l00823"></a>00823 <span class="keywordflow">break</span>; <a name="l00824"></a>00824 } <a name="l00825"></a>00825 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"RECORD_TYPE"</span>; <a name="l00826"></a>00826 <span class="keywordflow">for</span>(; i!=iend; ++i) <a name="l00827"></a>00827 os << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">"("</span> << push << fields[i].getString() <a name="l00828"></a>00828 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[i] << push << <span class="stringliteral">")"</span> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a> << <a class="code" href="group__ExprStream__Manip.html#gaddb050a787be87116afc51791293d3be" title="Restore the indentation.">pop</a>; <a name="l00829"></a>00829 os << push << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <span class="stringliteral">")"</span>; <a name="l00830"></a>00830 <span class="keywordflow">break</span>; <a name="l00831"></a>00831 } <a name="l00832"></a>00832 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>: <a name="l00833"></a>00833 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a09dac099c2d70610b91e30cd21e00fe1" title="Test whether expr is a record select/update subclass.">isRecordAccess</a>(e)) <a name="l00834"></a>00834 os << <span class="stringliteral">"("</span> << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">"RECORD_SELECT"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00835"></a>00835 << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e) << <a class="code" href="group__ExprStream__Manip.html#ga2a0348c6d3f94f2f8febc6dd0a9c3218" title="Set the indentation to the current position.">push</a> << <span class="stringliteral">")"</span>; <a name="l00836"></a>00836 <span class="keywordflow">else</span> <a name="l00837"></a>00837 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="l00838"></a>00838 <span class="keywordflow">break</span>; <a name="l00839"></a>00839 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>: <a name="l00840"></a>00840 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a8524c2c102a95e757b3c990b44e9576d" title="Test whether expr is a tuple select/update subclass.">isTupleAccess</a>(e)) <a name="l00841"></a>00841 os << <span class="stringliteral">"("</span> << push << <span class="stringliteral">"TUPLE_SELECT"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00842"></a>00842 << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e) << push << <span class="stringliteral">")"</span>; <a name="l00843"></a>00843 <span class="keywordflow">else</span> <a name="l00844"></a>00844 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="l00845"></a>00845 <span class="keywordflow">break</span>; <a name="l00846"></a>00846 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: <a name="l00847"></a>00847 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a09dac099c2d70610b91e30cd21e00fe1" title="Test whether expr is a record select/update subclass.">isRecordAccess</a>(e) && e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() == 2) <a name="l00848"></a>00848 os << <span class="stringliteral">"("</span> << push << <span class="stringliteral">"RECORD_UPDATE"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> <a name="l00849"></a>00849 << e[0] << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">getField</a>(e) <a name="l00850"></a>00850 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[1] << push << <span class="stringliteral">")"</span>; <a name="l00851"></a>00851 <span class="keywordflow">else</span> <a name="l00852"></a>00852 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="l00853"></a>00853 <span class="keywordflow">break</span>; <a name="l00854"></a>00854 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: <a name="l00855"></a>00855 <span class="keywordflow">if</span>(<a class="code" href="classCVC3_1_1TheoryRecords.html#a8524c2c102a95e757b3c990b44e9576d" title="Test whether expr is a tuple select/update subclass.">isTupleAccess</a>(e)) <a name="l00856"></a>00856 os << <span class="stringliteral">"("</span> << push << <span class="stringliteral">"TUPLE_UPDATE"</span> << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[0] <a name="l00857"></a>00857 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">getIndex</a>(e) <a name="l00858"></a>00858 << <a class="code" href="group__ExprStream__Manip.html#ga02670eb229648e9e2d888f21f91b6810" title="Insert a single white space separator.">space</a> << e[1] << push << <span class="stringliteral">")"</span>; <a name="l00859"></a>00859 <span class="keywordflow">else</span> <a name="l00860"></a>00860 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="l00861"></a>00861 <span class="keywordflow">break</span>; <a name="l00862"></a>00862 <span class="keywordflow">default</span>: <a name="l00863"></a>00863 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="l00864"></a>00864 <span class="keywordflow">break</span>; <a name="l00865"></a>00865 } <a name="l00866"></a>00866 <span class="keywordflow">break</span>; <a name="l00867"></a>00867 } <a name="l00868"></a>00868 <span class="keywordflow">default</span>: <a name="l00869"></a>00869 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="l00870"></a>00870 <span class="keywordflow">break</span>; <a name="l00871"></a>00871 } <a name="l00872"></a>00872 <span class="keywordflow">return</span> os; <a name="l00873"></a>00873 } <a name="l00874"></a>00874 <span class="comment"></span> <a name="l00875"></a>00875 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span> <a name="l00876"></a>00876 <span class="comment"></span><span class="comment">//parseExprOp:</span> <a name="l00877"></a>00877 <span class="comment">//translating special Exprs to regular EXPR??</span><span class="comment"></span> <a name="l00878"></a>00878 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span> <a name="l00879"></a>00879 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l00880"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a72f4af007baf95a36b21246433266319">00880</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a72f4af007baf95a36b21246433266319" title="Theory-specific parsing implemented by the DP.">TheoryRecords::parseExprOp</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e) { <a name="l00881"></a>00881 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"parser"</span>, <span class="stringliteral">"TheoryRecords::parseExprOp("</span>, e, <span class="stringliteral">")"</span>); <a name="l00882"></a>00882 <span class="comment">// If the expression is not a list, it must have been already</span> <a name="l00883"></a>00883 <span class="comment">// parsed, so just return it as is.</span> <a name="l00884"></a>00884 <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="l00885"></a>00885 <a name="l00886"></a>00886 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() > 0, <a name="l00887"></a>00887 <span class="stringliteral">"TheoryRecords::parseExprOp:\n e = "</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00888"></a>00888 <a name="l00889"></a>00889 <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& c1 = e[0][0]; <a name="l00890"></a>00890 <span class="keyword">const</span> <span class="keywordtype">string</span>& kindStr = c1.<a class="code" href="group__ExprPkg.html#ga5e679ab39ad8166c3c027afee9004c26">getString</a>(); <a name="l00891"></a>00891 <span class="keywordtype">int</span> kind = e.<a class="code" href="group__ExprPkg.html#gab57ce3dfa78947a906241d090c7cf34d">getEM</a>()-><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>(kindStr); <a name="l00892"></a>00892 <span class="keywordflow">switch</span>(kind) { <a name="l00893"></a>00893 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>: <span class="comment">// (RECORD_TYPE (f1 e1) (f2 e2) ...)</span> <a name="l00894"></a>00894 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>: { <span class="comment">// (RECORD (f1 e1) (f2 e2) ...)</span> <a name="l00895"></a>00895 <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() < 2) <a name="l00896"></a>00896 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">"Empty "</span>+kindStr+<span class="stringliteral">": "</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00897"></a>00897 vector<Expr> fields; <a name="l00898"></a>00898 vector<Expr> kids; <a name="l00899"></a>00899 <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="l00900"></a>00900 ++i; <a name="l00901"></a>00901 <span class="keywordflow">for</span>(; i!=iend; ++i) { <a name="l00902"></a>00902 <span class="keywordflow">if</span>(i->arity() != 2 || (*i)[0].getKind() != <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba001479a58fb44c39a29b20d565081a68" title="Identifier is (ID (STRING_EXPR "name"))">ID</a>) <a name="l00903"></a>00903 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">"Bad field declaration in "</span>+kindStr+<span class="stringliteral">": "</span> <a name="l00904"></a>00904 +i->toString()+<span class="stringliteral">"\n in "</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00905"></a>00905 fields.push_back((*i)[0][0]); <a name="l00906"></a>00906 kids.push_back(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>((*i)[1])); <a name="l00907"></a>00907 } <a name="l00908"></a>00908 <span class="keywordflow">return</span> (kind==<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>)? <a class="code" href="classCVC3_1_1TheoryRecords.html#aa5a9cbcd30ed23792c030d70181483d3" title="Create a record literal.">recordExpr</a>(fields, kids) <a name="l00909"></a>00909 : <a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105" title="Create a record type.">recordType</a>(fields, kids).<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00910"></a>00910 } <a name="l00911"></a>00911 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>: { <span class="comment">// (RECORD_SELECT e field)</span> <a name="l00912"></a>00912 <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 3 || e[2].<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>() != <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba001479a58fb44c39a29b20d565081a68" title="Identifier is (ID (STRING_EXPR "name"))">ID</a>) <a name="l00913"></a>00913 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">"Field must be an ID in RECORD_SELECT: "</span> <a name="l00914"></a>00914 +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00915"></a>00915 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a6123e229d2eac24364f4cf1b30927f0c" title="Create a record field select expression.">recordSelect</a>(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[1]), e[2][0].getString()); <a name="l00916"></a>00916 } <a name="l00917"></a>00917 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>: { <span class="comment">// (RECORD_UPDATE e1 field e2)</span> <a name="l00918"></a>00918 <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 4 || e[2].<a class="code" href="group__ExprPkg.html#ga7814e4f55f65c7ca860c637413df5f4d">getKind</a>() != <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba001479a58fb44c39a29b20d565081a68" title="Identifier is (ID (STRING_EXPR "name"))">ID</a>) <a name="l00919"></a>00919 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">"Field must be an ID in RECORD_UPDATE: "</span> <a name="l00920"></a>00920 +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00921"></a>00921 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#ad6d5734bb5b21cada7e7958c6840e2c4" title="Create a record field update expression.">recordUpdate</a>(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[1]), e[2][0].getString(), <a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[3])); <a name="l00922"></a>00922 } <a name="l00923"></a>00923 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>: { <span class="comment">// (TUPLE_SELECT e index)</span> <a name="l00924"></a>00924 <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 3 || !e[2].<a class="code" href="group__ExprPkg.html#gac5ced6adc7a60945ea6707ef494aa28f">isRational</a>() || !e[2].<a class="code" href="group__ExprPkg.html#gab0eee70e4a7f97c09954dc61b71b65e5" title="Get the Rational value out of RATIONAL_EXPR.">getRational</a>().<a class="code" href="classCVC3_1_1Rational.html#a1366320f4de558bb964c67f8aecedb36">isInteger</a>()) <a name="l00925"></a>00925 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">"Index must be an integer in TUPLE_SELECT: "</span> <a name="l00926"></a>00926 +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00927"></a>00927 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#ada5d6a109788e70405af2adee937c379" title="Create a tuple index selector expression.">tupleSelect</a>(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[1]), e[2].getRational().getInt()); <a name="l00928"></a>00928 } <a name="l00929"></a>00929 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>: { <span class="comment">// (TUPLE_UPDATE e1 index e2)</span> <a name="l00930"></a>00930 <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() != 4 || !e[2].<a class="code" href="group__ExprPkg.html#gac5ced6adc7a60945ea6707ef494aa28f">isRational</a>() || !e[2].<a class="code" href="group__ExprPkg.html#gab0eee70e4a7f97c09954dc61b71b65e5" title="Get the Rational value out of RATIONAL_EXPR.">getRational</a>().<a class="code" href="classCVC3_1_1Rational.html#a1366320f4de558bb964c67f8aecedb36">isInteger</a>()) <a name="l00931"></a>00931 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">"Index must be an integer in TUPLE_UPDATE: "</span> <a name="l00932"></a>00932 +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00933"></a>00933 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a7ca579aacef4b87f4b2235da4ef1ec47" title="Create a tuple index update expression.">tupleUpdate</a>(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[1]), e[2].getRational().getInt(), <a name="l00934"></a>00934 <a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(e[3])); <a name="l00935"></a>00935 } <a name="l00936"></a>00936 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>: <a name="l00937"></a>00937 <span class="keywordflow">case</span> <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>: { <a name="l00938"></a>00938 <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>() < 2) <a name="l00939"></a>00939 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1ParserException.html">ParserException</a>(<span class="stringliteral">"Empty "</span>+kindStr+<span class="stringliteral">": "</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00940"></a>00940 vector<Expr> k; <a name="l00941"></a>00941 <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="l00942"></a>00942 <span class="comment">// Skip first element of the vector of kids in 'e'.</span> <a name="l00943"></a>00943 <span class="comment">// The first element is the operator.</span> <a name="l00944"></a>00944 ++i; <a name="l00945"></a>00945 <span class="comment">// Parse the kids of e and push them into the vector 'k'</span> <a name="l00946"></a>00946 <span class="keywordflow">for</span>(; i!=iend; ++i) <a name="l00947"></a>00947 k.push_back(<a class="code" href="classCVC3_1_1Theory.html#abd5a64ee867dda0c216a04e9fc7fbd6c" title="Parse the generic expression.">parseExpr</a>(*i)); <a name="l00948"></a>00948 <span class="keywordflow">return</span> (kind==<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>)? <a class="code" href="classCVC3_1_1TheoryRecords.html#a6633d0d5b34ebfaf5d6a42f72c8d4818" title="Create a tuple literal.">tupleExpr</a>(k) : <a class="code" href="classCVC3_1_1TheoryRecords.html#a4ab484efb75ef41b5a29d5e598ab91a1" title="Create a tuple type.">tupleType</a>(k).<a class="code" href="classCVC3_1_1Type.html#a0bc1eebf8dbd9d2880e1f18d7804e5c2">getExpr</a>(); <a name="l00949"></a>00949 } <a name="l00950"></a>00950 <span class="keywordflow">default</span>: <a name="l00951"></a>00951 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <a name="l00952"></a>00952 <span class="stringliteral">"TheoryRecords::parseExprOp: invalid command or expression: "</span> + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l00953"></a>00953 <span class="keywordflow">break</span>; <a name="l00954"></a>00954 } <a name="l00955"></a>00955 <span class="keywordflow">return</span> e; <a name="l00956"></a>00956 } <a name="l00957"></a>00957 <a name="l00958"></a>00958 <span class="comment"></span> <a name="l00959"></a>00959 <span class="comment">//! Create a record literal</span> <a name="l00960"></a>00960 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l00961"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#aa5a9cbcd30ed23792c030d70181483d3">00961</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#aa5a9cbcd30ed23792c030d70181483d3" title="Create a record literal.">TheoryRecords::recordExpr</a>(<span class="keyword">const</span> std::vector<std::string>& fields, <a name="l00962"></a>00962 <span class="keyword">const</span> std::vector<Expr>& kids) { <a name="l00963"></a>00963 vector<Expr> fieldExprs; <a name="l00964"></a>00964 vector<string>::const_iterator i = fields.<a class="code" href="group__ExprPkg.html#gac890e13db184610276fc533fa4b4fe99" title="Begin iterator.">begin</a>(), iend = fields.end(); <a name="l00965"></a>00965 <span class="keywordflow">for</span> (; i != iend; ++i) fieldExprs.push_back(<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()->newStringExpr(*i)); <a name="l00966"></a>00966 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#aa5a9cbcd30ed23792c030d70181483d3" title="Create a record literal.">recordExpr</a>(fieldExprs, kids); <a name="l00967"></a>00967 } <a name="l00968"></a>00968 <a name="l00969"></a>00969 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l00970"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a179c7224344f4316c25ceb4626a6f2f0">00970</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#aa5a9cbcd30ed23792c030d70181483d3" title="Create a record literal.">TheoryRecords::recordExpr</a>(<span class="keyword">const</span> std::vector<Expr>& fields, <a name="l00971"></a>00971 <span class="keyword">const</span> std::vector<Expr>& kids) { <a name="l00972"></a>00972 <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_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a>, fields).mkOp(), kids); <a name="l00973"></a>00973 } <a name="l00974"></a>00974 <span class="comment"></span> <a name="l00975"></a>00975 <span class="comment">//! Create a record type</span> <a name="l00976"></a>00976 <span class="comment"></span><a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a name="l00977"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105">00977</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105" title="Create a record type.">TheoryRecords::recordType</a>(<span class="keyword">const</span> std::vector<std::string>& fields, <a name="l00978"></a>00978 <span class="keyword">const</span> std::vector<Type>& types) { <a name="l00979"></a>00979 vector<Expr> kids; <a name="l00980"></a>00980 <span class="keywordflow">for</span>(vector<Type>::const_iterator i=types.begin(), iend=types.end(); <a name="l00981"></a>00981 i!=iend; ++i) <a name="l00982"></a>00982 kids.push_back(i->getExpr()); <a name="l00983"></a>00983 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105" title="Create a record type.">recordType</a>(fields, kids); <a name="l00984"></a>00984 } <a name="l00985"></a>00985 <span class="comment"></span> <a name="l00986"></a>00986 <span class="comment">//! Create a record type</span> <a name="l00987"></a>00987 <span class="comment"></span><a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a name="l00988"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a9a918c3cb8e49f04b4a8331eaf696c7c">00988</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105" title="Create a record type.">TheoryRecords::recordType</a>(<span class="keyword">const</span> std::vector<std::string>& fields, <a name="l00989"></a>00989 <span class="keyword">const</span> std::vector<Expr>& types) { <a name="l00990"></a>00990 vector<Expr> fieldExprs; <a name="l00991"></a>00991 vector<string>::const_iterator i = fields.begin(), iend = fields.end(); <a name="l00992"></a>00992 <span class="keywordflow">for</span> (; i != iend; ++i) fieldExprs.push_back(<a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()->newStringExpr(*i)); <a name="l00993"></a>00993 <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105" title="Create a record type.">recordType</a>(fieldExprs, types); <a name="l00994"></a>00994 } <a name="l00995"></a>00995 <a name="l00996"></a>00996 <a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a name="l00997"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a4c7522da56902a7f3bd8a7b530a77dc5">00997</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a4b298f0e7a25449c945480544996d105" title="Create a record type.">TheoryRecords::recordType</a>(<span class="keyword">const</span> std::vector<Expr>& fields, <a name="l00998"></a>00998 <span class="keyword">const</span> std::vector<Expr>& types) { <a name="l00999"></a>00999 <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>(<a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>, fields).mkOp(), types)); <a name="l01000"></a>01000 } <a name="l01001"></a>01001 <span class="comment"></span> <a name="l01002"></a>01002 <span class="comment">//! Create a record field selector expression</span> <a name="l01003"></a>01003 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l01004"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a6123e229d2eac24364f4cf1b30927f0c">01004</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a6123e229d2eac24364f4cf1b30927f0c" title="Create a record field select expression.">TheoryRecords::recordSelect</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& r, <span class="keyword">const</span> std::string& field) { <a name="l01005"></a>01005 <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>()->newSymbolExpr(field, <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a>).mkOp(), r); <a name="l01006"></a>01006 } <a name="l01007"></a>01007 <span class="comment"></span> <a name="l01008"></a>01008 <span class="comment">//! Create a record field update expression</span> <a name="l01009"></a>01009 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l01010"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#ad6d5734bb5b21cada7e7958c6840e2c4">01010</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#ad6d5734bb5b21cada7e7958c6840e2c4" title="Create a record field update expression.">TheoryRecords::recordUpdate</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& r, <span class="keyword">const</span> std::string& field, <a name="l01011"></a>01011 <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& val) { <a name="l01012"></a>01012 <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>()->newSymbolExpr(field, <a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>).mkOp(), r, val); <a name="l01013"></a>01013 } <a name="l01014"></a>01014 <span class="comment"></span> <a name="l01015"></a>01015 <span class="comment">//! Get the list of fields from a record literal</span> <a name="l01016"></a>01016 <span class="comment"></span><span class="keyword">const</span> vector<Expr>& <a name="l01017"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163">01017</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">TheoryRecords::getFields</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& r) { <a name="l01018"></a>01018 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(r.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>() && <a name="l01019"></a>01019 (r.<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#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a> || r.<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#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>), <a name="l01020"></a>01020 <span class="stringliteral">"TheoryRecords::getFields: Not a record literal: "</span> <a name="l01021"></a>01021 +r.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>(<a class="code" href="namespaceCVC3.html#a3aaaf7bc1fc47a4860ef6e59ddb0db0ea0ee28952d729595b97a9e592975d1521">AST_LANG</a>)); <a name="l01022"></a>01022 <span class="keywordflow">return</span> r.<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#ga1e18ae89889e781591eb2874a4196b73">getKids</a>(); <a name="l01023"></a>01023 } <a name="l01024"></a>01024 <a name="l01025"></a>01025 <span class="comment">// Get the i-th field name from the record literal</span> <a name="l01026"></a>01026 <span class="keyword">const</span> <span class="keywordtype">string</span>& <a name="l01027"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77">01027</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">TheoryRecords::getField</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& r, <span class="keywordtype">int</span> i) { <a name="l01028"></a>01028 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(r.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>() && <a name="l01029"></a>01029 (r.<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#ad12649859b64bd3aed25985b147c078aadba2f0df8bf015c12bca0efbd077db7d">RECORD</a> || r.<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#ad12649859b64bd3aed25985b147c078aa5b98e4e73895afeec2e8904eb5c3effa">RECORD_TYPE</a>), <a name="l01030"></a>01030 <span class="stringliteral">"TheoryRecords::getField: Not a record literal: "</span> <a name="l01031"></a>01031 +r.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()); <a name="l01032"></a>01032 <span class="keywordflow">return</span> r.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>()[i].<a class="code" href="group__ExprPkg.html#ga5e679ab39ad8166c3c027afee9004c26">getString</a>(); <a name="l01033"></a>01033 } <a name="l01034"></a>01034 <a name="l01035"></a>01035 <span class="comment">// Get field index from the record literal</span> <a name="l01036"></a>01036 <span class="keywordtype">int</span> <a name="l01037"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a8b8cf0a921555538ec1b91c08600e721">01037</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a8b8cf0a921555538ec1b91c08600e721" title="Get the field index in the record literal or type.">TheoryRecords::getFieldIndex</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e, <span class="keyword">const</span> <span class="keywordtype">string</span>& field) { <a name="l01038"></a>01038 <span class="keyword">const</span> vector<Expr>& fields = <a class="code" href="classCVC3_1_1TheoryRecords.html#aaf09fd297eafe6e114863581c558f163" title="Get the list of fields from a record literal.">getFields</a>(e); <a name="l01039"></a>01039 <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i=0, iend=fields.size(); i<iend; ++i) { <a name="l01040"></a>01040 <span class="keywordflow">if</span>(fields[i].getString() == field) <span class="keywordflow">return</span> i; <a name="l01041"></a>01041 } <a name="l01042"></a>01042 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<span class="keyword">false</span>, <span class="stringliteral">"TheoryRecords::getFieldIndex(e="</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>() <a name="l01043"></a>01043 +<span class="stringliteral">", field="</span>+field+<span class="stringliteral">"): field is not found"</span>); <a name="l01044"></a>01044 <span class="keywordflow">return</span> -1; <a name="l01045"></a>01045 } <a name="l01046"></a>01046 <span class="comment"></span> <a name="l01047"></a>01047 <span class="comment">//! Get the field name from the record select and update expressions</span> <a name="l01048"></a>01048 <span class="comment"></span><span class="keyword">const</span> std::string& <a name="l01049"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#ac64247bde64f8819221125be780f3a1d">01049</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#ac45307e001d2f373bdf4116416c84b77" title="Get the i-th field name from the record literal or type.">TheoryRecords::getField</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& r) { <a name="l01050"></a>01050 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(r.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>() && (r.<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#ad12649859b64bd3aed25985b147c078aa9efca25c90a81dcfde159d13a86d9f77">RECORD_SELECT</a> || <a name="l01051"></a>01051 r.<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#ad12649859b64bd3aed25985b147c078aac6dfe36442cddb6cb993669fec8a51c5">RECORD_UPDATE</a>), <a name="l01052"></a>01052 <span class="stringliteral">"TheoryRecords::getField: Not a record literal: "</span>); <a name="l01053"></a>01053 <span class="keywordflow">return</span> r.<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="l01054"></a>01054 } <a name="l01055"></a>01055 <span class="comment"></span> <a name="l01056"></a>01056 <span class="comment">//! Create a tuple literal</span> <a name="l01057"></a>01057 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l01058"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a6633d0d5b34ebfaf5d6a42f72c8d4818">01058</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a6633d0d5b34ebfaf5d6a42f72c8d4818" title="Create a tuple literal.">TheoryRecords::tupleExpr</a>(<span class="keyword">const</span> std::vector<Expr>& kids) { <a name="l01059"></a>01059 <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="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aade6582602ff5a8d049aa0dd26e50a30e">TUPLE</a>, kids, <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()); <a name="l01060"></a>01060 } <a name="l01061"></a>01061 <span class="comment"></span> <a name="l01062"></a>01062 <span class="comment">//! Create a tuple type</span> <a name="l01063"></a>01063 <span class="comment"></span><a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a name="l01064"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a4ab484efb75ef41b5a29d5e598ab91a1">01064</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a4ab484efb75ef41b5a29d5e598ab91a1" title="Create a tuple type.">TheoryRecords::tupleType</a>(<span class="keyword">const</span> std::vector<Type>& types) { <a name="l01065"></a>01065 vector<Expr> kids; <a name="l01066"></a>01066 <span class="keywordflow">for</span>(vector<Type>::const_iterator i=types.begin(), iend=types.end(); <a name="l01067"></a>01067 i!=iend; ++i) <a name="l01068"></a>01068 kids.push_back(i->getExpr()); <a name="l01069"></a>01069 <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>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>, kids, <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>())); <a name="l01070"></a>01070 } <a name="l01071"></a>01071 <span class="comment"></span> <a name="l01072"></a>01072 <span class="comment">//! Create a tuple type</span> <a name="l01073"></a>01073 <span class="comment"></span><a class="code" href="classCVC3_1_1Type.html" title="MS C++ specific settings.">Type</a> <a name="l01074"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#aaf96b1c14ffa1741f3dfadcca8bfa212">01074</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a4ab484efb75ef41b5a29d5e598ab91a1" title="Create a tuple type.">TheoryRecords::tupleType</a>(<span class="keyword">const</span> std::vector<Expr>& types) { <a name="l01075"></a>01075 <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="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aaabdfca29cc90169c7689e6a05e5cc316">TUPLE_TYPE</a>, types, <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()); <a name="l01076"></a>01076 } <a name="l01077"></a>01077 <span class="comment"></span> <a name="l01078"></a>01078 <span class="comment">//! Create a tuple index selector expression</span> <a name="l01079"></a>01079 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l01080"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#ada5d6a109788e70405af2adee937c379">01080</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#ada5d6a109788e70405af2adee937c379" title="Create a tuple index selector expression.">TheoryRecords::tupleSelect</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& tup, <span class="keywordtype">int</span> i) { <a name="l01081"></a>01081 <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_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a>, <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()->newRatExpr(i)).mkOp(), tup); <a name="l01082"></a>01082 } <a name="l01083"></a>01083 <span class="comment"></span> <a name="l01084"></a>01084 <span class="comment">//! Create a tuple index update expression</span> <a name="l01085"></a>01085 <span class="comment"></span><a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a name="l01086"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#a7ca579aacef4b87f4b2235da4ef1ec47">01086</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#a7ca579aacef4b87f4b2235da4ef1ec47" title="Create a tuple index update expression.">TheoryRecords::tupleUpdate</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& tup, <span class="keywordtype">int</span> i, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& val) { <a name="l01087"></a>01087 <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_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>(<a class="code" href="namespaceCVC3.html#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>, <a class="code" href="classCVC3_1_1Theory.html#abc2e30308c9e1f3cf752cfe8d939df1e" title="Access to ExprManager.">getEM</a>()->newRatExpr(i)).mkOp(), tup, val); <a name="l01088"></a>01088 } <a name="l01089"></a>01089 <span class="comment"></span> <a name="l01090"></a>01090 <span class="comment">//! Get the index from the tuple select and update expressions</span> <a name="l01091"></a>01091 <span class="comment"></span><span class="keywordtype">int</span> <a name="l01092"></a><a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811">01092</a> <a class="code" href="classCVC3_1_1TheoryRecords.html#ab228944f5113535c5859cbaa2de0d811" title="Get the index from the tuple select and update expressions.">TheoryRecords::getIndex</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& r) { <a name="l01093"></a>01093 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(r.<a class="code" href="group__ExprPkg.html#ga1d6a6b4a9ce81b0dd8fd74870ff4284b">isApply</a>() && (r.<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#ad12649859b64bd3aed25985b147c078aae26285c151f7ee2c084c68848a88dde0">TUPLE_SELECT</a> || <a name="l01094"></a>01094 r.<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#ad12649859b64bd3aed25985b147c078aab6ace4f4d51d446b07d2f6f486f5aef8">TUPLE_UPDATE</a>), <a name="l01095"></a>01095 <span class="stringliteral">"TheoryRecords::getField: Not a record literal: "</span>); <a name="l01096"></a>01096 <span class="keywordflow">return</span> r.<a class="code" href="group__ExprPkg.html#ga9f3328fe077191803a780cfd6566ff9b" title="Get expression of operator (for APPLY Exprs only)">getOpExpr</a>()[0].<a class="code" href="group__ExprPkg.html#gab0eee70e4a7f97c09954dc61b71b65e5" title="Get the Rational value out of RATIONAL_EXPR.">getRational</a>().<a class="code" href="classCVC3_1_1Rational.html#a094636dfa3a740640ca1b0c7406f7e8f">getInt</a>(); <a name="l01097"></a>01097 } </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Sep 7 2011 for CVC3 by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address> </body> </html>