<!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: search_simple.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">search_simple.cpp</div> </div> </div> <div class="contents"> <a href="search__simple_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 search_simple.cpp</span> <a name="l00004"></a>00004 <span class="comment"> * </span> <a name="l00005"></a>00005 <span class="comment"> * Author: Clark Barrett</span> <a name="l00006"></a>00006 <span class="comment"> * </span> <a name="l00007"></a>00007 <span class="comment"> * Created: Sat Mar 29 21:59:36 2003</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * <hr></span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span> <a name="l00012"></a>00012 <span class="comment"> * and its documentation for any purpose is hereby granted without</span> <a name="l00013"></a>00013 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span> <a name="l00014"></a>00014 <span class="comment"> * LICENSE file provided with this distribution.</span> <a name="l00015"></a>00015 <span class="comment"> * </span> <a name="l00016"></a>00016 <span class="comment"> * <hr></span> <a name="l00017"></a>00017 <span class="comment"> * </span> <a name="l00018"></a>00018 <span class="comment"> */</span> <a name="l00019"></a>00019 <span class="comment">/*****************************************************************************/</span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="search__simple_8h.html">search_simple.h</a>"</span> <a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="theory__core_8h.html">theory_core.h</a>"</span> <a name="l00023"></a>00023 <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="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="search__rules_8h.html" title="Abstract proof rules interface to the simple search engine.">search_rules.h</a>"</span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="decision__engine__dfs_8h.html">decision_engine_dfs.h</a>"</span> <a name="l00027"></a>00027 <span class="comment">//#include "decision_engine_caching.h"</span> <a name="l00028"></a>00028 <span class="comment">//#include "decision_engine_mbtf.h"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="expr__transform_8h.html" title="Generally Useful Expression Transformations.">expr_transform.h</a>"</span> <a name="l00030"></a>00030 <span class="preprocessor">#include "<a class="code" href="command__line__flags_8h.html">command_line_flags.h</a>"</span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <a name="l00033"></a>00033 <span class="keyword">using namespace </span>std; <a name="l00034"></a>00034 <span class="keyword">using namespace </span>CVC3; <a name="l00035"></a>00035 <a name="l00036"></a>00036 <a name="l00037"></a><a class="code" href="group__SE__Simple.html#ga419ec575e6d5efc40222b50ee9448bae">00037</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> SearchSimple::checkValidRec(<a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& thm) <a name="l00038"></a>00038 { <a name="l00039"></a>00039 <span class="keywordflow">if</span> (d_core->outOfResources()) <span class="keywordflow">return</span> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498ba33046505033fa14ebb412efb4474ff56">ABORT</a>; <a name="l00040"></a>00040 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValidRec() {"</span>); <a name="l00041"></a>00041 <span class="keywordflow">if</span> (d_core->inconsistent()) { <a name="l00042"></a>00042 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValidRec => "</span>, d_core->inconsistentThm(), <a name="l00043"></a>00043 <span class="stringliteral">" (context inconsistent) }"</span>); <a name="l00044"></a>00044 d_decisionEngine->goalSatisfied(); <a name="l00045"></a>00045 thm = d_core->inconsistentThm(); <a name="l00046"></a>00046 <span class="keywordflow">return</span> <a class="code" href="xchaff__solver_8h.html#a259c70233f322b3e490149190b8bb87ba709691b4dfbbba6c6f992a7cd34dd0e9">UNSATISFIABLE</a>; <a name="l00047"></a>00047 } <a name="l00048"></a>00048 <a name="l00049"></a>00049 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> e = d_goal.get(); <a name="l00050"></a>00050 <span class="keywordtype">bool</span> workingOnGoal = <span class="keyword">true</span>; <a name="l00051"></a>00051 <span class="keywordflow">if</span> (d_goal.get().getExpr().isTrue()) { <a name="l00052"></a>00052 e = d_nonLiterals.get(); <a name="l00053"></a>00053 workingOnGoal = <span class="keyword">false</span>; <a name="l00054"></a>00054 } <a name="l00055"></a>00055 <a name="l00056"></a>00056 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> simp = simplify(e); <a name="l00057"></a>00057 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> rhs = simp.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(); <a name="l00058"></a>00058 <span class="keywordflow">if</span> (rhs.<a class="code" href="group__ExprPkg.html#ga4dc94c33ae308ff8d9d004f49df8f42b">hasFind</a>()) { <a name="l00059"></a>00059 simp = d_commonRules->iffMP(simp, d_core->find(rhs)); <a name="l00060"></a>00060 rhs = simp.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(); <a name="l00061"></a>00061 } <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="keywordflow">if</span> (workingOnGoal) d_goal.set(simp); <a name="l00064"></a>00064 <span class="keywordflow">else</span> d_nonLiterals.set(simp); <a name="l00065"></a>00065 <a name="l00066"></a>00066 <span class="keywordflow">if</span> (rhs.<a class="code" href="group__ExprPkg.html#ga6173f64b22cba76472cd0c814bbf6dae">isFalse</a>()) { <a name="l00067"></a>00067 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValidRec => "</span>, simp, <span class="stringliteral">" (rhs=false) }"</span>); <a name="l00068"></a>00068 d_decisionEngine->goalSatisfied(); <a name="l00069"></a>00069 thm = simp; <a name="l00070"></a>00070 <span class="keywordflow">return</span> <a class="code" href="xchaff__solver_8h.html#a259c70233f322b3e490149190b8bb87ba709691b4dfbbba6c6f992a7cd34dd0e9">UNSATISFIABLE</a>; <a name="l00071"></a>00071 } <a name="l00072"></a>00072 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (rhs.<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>()) { <a name="l00073"></a>00073 <span class="keywordflow">if</span> (workingOnGoal || !d_core->checkSATCore()) { <a name="l00074"></a>00074 <span class="keywordflow">return</span> checkValidRec(thm); <a name="l00075"></a>00075 } <a name="l00076"></a>00076 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValidRec => "</span>, <span class="stringliteral">"Null (true)"</span>, <span class="stringliteral">"}"</span>); <a name="l00077"></a>00077 thm = <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>(); <a name="l00078"></a>00078 <span class="keywordflow">return</span> <a class="code" href="xchaff__solver_8h.html#a259c70233f322b3e490149190b8bb87baa6a5c07f8c320f440ebc34fed65eb550">SATISFIABLE</a>; <a name="l00079"></a>00079 } <a name="l00080"></a>00080 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> splitter = d_decisionEngine->findSplitter(rhs); <a name="l00081"></a>00081 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!splitter.<a class="code" href="group__ExprPkg.html#ga0265d1ca42fa59c95aaff3ca675b6504">isNull</a>(), <span class="stringliteral">"Expected splitter"</span>); <a name="l00082"></a>00082 d_decisionEngine->pushDecision(splitter); <a name="l00083"></a>00083 <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> qres = checkValidRec(thm); <a name="l00084"></a>00084 <span class="keywordflow">if</span> (qres == <a class="code" href="xchaff__solver_8h.html#a259c70233f322b3e490149190b8bb87ba709691b4dfbbba6c6f992a7cd34dd0e9">UNSATISFIABLE</a>) { <a name="l00085"></a>00085 d_decisionEngine->popDecision(); <a name="l00086"></a>00086 d_decisionEngine->pushDecision(splitter, <span class="keyword">false</span>); <a name="l00087"></a>00087 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm2; <a name="l00088"></a>00088 qres = checkValidRec(thm2); <a name="l00089"></a>00089 <span class="keywordflow">if</span> (qres == <a class="code" href="xchaff__solver_8h.html#a259c70233f322b3e490149190b8bb87ba709691b4dfbbba6c6f992a7cd34dd0e9">UNSATISFIABLE</a>) { <a name="l00090"></a>00090 d_decisionEngine->popDecision(); <a name="l00091"></a>00091 thm = d_rules->caseSplit(splitter, thm, thm2); <a name="l00092"></a>00092 <span class="keywordflow">return</span> qres; <a name="l00093"></a>00093 } <a name="l00094"></a>00094 thm = thm2; <a name="l00095"></a>00095 <span class="keywordflow">return</span> qres; <a name="l00096"></a>00096 } <a name="l00097"></a>00097 <span class="keywordflow">return</span> qres; <a name="l00098"></a>00098 } <a name="l00099"></a>00099 <a name="l00100"></a>00100 <a name="l00101"></a><a class="code" href="group__SE__Simple.html#gad315bc80781ed5344d2803a28587b504">00101</a> SearchSimple::SearchSimple(<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="l00102"></a>00102 : <a class="code" href="classCVC3_1_1SearchImplBase.html" title="API to to a generic proof search engine (a.k.a. SAT solver)">SearchImplBase</a>(core), <a name="l00103"></a>00103 d_name(<span class="stringliteral">"simple"</span>), <a name="l00104"></a>00104 d_goal(core->getCM()->getCurrentContext()), <a name="l00105"></a>00105 d_nonLiterals(core->getCM()->getCurrentContext()), <a name="l00106"></a>00106 d_simplifiedThm(core->getCM()->getCurrentContext()) <a name="l00107"></a>00107 { <a name="l00108"></a>00108 <span class="comment">// if (core->getFlags()["de"].getString() == "caching")</span> <a name="l00109"></a>00109 <span class="comment">// d_decisionEngine = new DecisionEngineCaching(core, this);</span> <a name="l00110"></a>00110 <span class="comment">// else if (core->getFlags()["de"].getString() == "mbtf")</span> <a name="l00111"></a>00111 <span class="comment">// d_decisionEngine = new DecisionEngineMBTF(core, this);</span> <a name="l00112"></a>00112 <span class="comment">// else</span> <a name="l00113"></a>00113 <a class="code" href="group__SE__Simple.html#ga2768cc5c1cd7cc3ddad85c58a12be346" title="Decision Engine.">d_decisionEngine</a> = <span class="keyword">new</span> <a class="code" href="classCVC3_1_1DecisionEngineDFS.html" title="Decision Engine for use with the Search EngineAuthor: Clark Barrett.">DecisionEngineDFS</a>(core, <span class="keyword">this</span>); <a name="l00114"></a>00114 <a name="l00115"></a>00115 <a class="code" href="group__SE__Simple.html#gac6fb434835121c59d9ddfb6292ba1748" title="Formula being checked.">d_goal</a>.<a class="code" href="classCVC3_1_1CDO.html#ab4e881820af78a628c72691cb9c2128e">set</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-><a class="code" href="classCVC3_1_1CommonProofRules.html#a6e93694c76f7b567487bc8cae674ae5d" title="==> TRUE">trueTheorem</a>()); <a name="l00116"></a>00116 <a class="code" href="group__SE__Simple.html#ga5993bff58130ad6cf24be03068caafc0" title="Non-literals generated by DP's.">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDO.html#ab4e881820af78a628c72691cb9c2128e">set</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-><a class="code" href="classCVC3_1_1CommonProofRules.html#a6e93694c76f7b567487bc8cae674ae5d" title="==> TRUE">trueTheorem</a>()); <a name="l00117"></a>00117 } <a name="l00118"></a>00118 <a name="l00119"></a>00119 <a name="l00120"></a><a class="code" href="group__SE__Simple.html#gaf145d5394c5d9a598ea05e40628e6807">00120</a> <a class="code" href="group__SE__Simple.html#gaf145d5394c5d9a598ea05e40628e6807" title="Destructor.">SearchSimple::~SearchSimple</a>() <a name="l00121"></a>00121 { <a name="l00122"></a>00122 <span class="keyword">delete</span> <a class="code" href="group__SE__Simple.html#ga2768cc5c1cd7cc3ddad85c58a12be346" title="Decision Engine.">d_decisionEngine</a>; <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <a name="l00125"></a>00125 <a name="l00126"></a><a class="code" href="group__SE__Simple.html#ga8f4845fe98fd0da613062d118335192a">00126</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> <a class="code" href="group__SE__Simple.html#ga8f4845fe98fd0da613062d118335192a" title="Private helper function for checkValid and restart.">SearchSimple::checkValidMain</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& e2) <a name="l00127"></a>00127 { <a name="l00128"></a>00128 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm; <a name="l00129"></a>00129 <a name="l00130"></a>00130 <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> qres = <a class="code" href="group__SE__Simple.html#ga419ec575e6d5efc40222b50ee9448bae" title="Recursive DPLL algorithm used by checkValid.">checkValidRec</a>(thm); <a name="l00131"></a>00131 <a name="l00132"></a>00132 <span class="keywordflow">if</span> (qres == <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498bad11a6bd5ab8c3e02ec8503e7a7860a61">SATISFIABLE</a> && <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-><a class="code" href="classCVC3_1_1TheoryCore.html#a36571dc56183d89cd36def27939430b0" title="Check if the current decision branch is marked as incomplete.">incomplete</a>()) qres = <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498ba249f3dbc426c80d4a31cb5073bf07cfa">UNKNOWN</a>; <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="keywordflow">if</span> (qres == <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498bad11a6bd5ab8c3e02ec8503e7a7860a61">SATISFIABLE</a>) { <a name="l00135"></a>00135 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Simple.html#gac6fb434835121c59d9ddfb6292ba1748" title="Formula being checked.">d_goal</a>.<a class="code" href="classCVC3_1_1CDO.html#a818fcacc7b30b0f05347335ab125626c">get</a>().<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>(), <a name="l00136"></a>00136 <span class="stringliteral">"checkValid: Expected true goal"</span>); <a name="l00137"></a>00137 vector<Expr> a; <a name="l00138"></a>00138 <a class="code" href="group__SE__Simple.html#gac6fb434835121c59d9ddfb6292ba1748" title="Formula being checked.">d_goal</a>.<a class="code" href="classCVC3_1_1CDO.html#a818fcacc7b30b0f05347335ab125626c">get</a>().<a class="code" href="classCVC3_1_1Theorem.html#a524b4dafa4fb8f14742baa856612d92b">getLeafAssumptions</a>(a); <a name="l00139"></a>00139 <a class="code" href="group__SE.html#gaf6841e86841006b6917d46664de64d21" title="Assumptions from the last unsuccessful checkValid call. These are used by getCounterExample.">d_lastCounterExample</a>.<a class="code" href="classCVC3_1_1ExprHashMap.html#aa20f14dba09537171af45bf479b99c66">clear</a>(); <a name="l00140"></a>00140 <span class="keywordflow">for</span> (vector<Expr>::iterator i=a.begin(), iend=a.end(); i != iend; ++i) { <a name="l00141"></a>00141 <a class="code" href="group__SE.html#gaf6841e86841006b6917d46664de64d21" title="Assumptions from the last unsuccessful checkValid call. These are used by getCounterExample.">d_lastCounterExample</a>[*i] = <span class="keyword">true</span>; <a name="l00142"></a>00142 } <a name="l00143"></a>00143 } <a name="l00144"></a>00144 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (qres != <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498baba54da61f61403de5204b899fe55d92f">UNSATISFIABLE</a>) <span class="keywordflow">return</span> qres; <a name="l00145"></a>00145 <a name="l00146"></a>00146 <a class="code" href="group__SE.html#ga0d509e38a03048dcbdb9e28f3f5da724" title="Process result of checkValid.">processResult</a>(thm, e2); <a name="l00147"></a>00147 <a name="l00148"></a>00148 <span class="keywordflow">if</span> (qres == <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498baba54da61f61403de5204b899fe55d92f">UNSATISFIABLE</a>) { <a name="l00149"></a>00149 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search terse"</span>, <span class="stringliteral">"checkValid => true}"</span>); <a name="l00150"></a>00150 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValid => true; theorem = "</span>, <a class="code" href="group__SE.html#ga88ba664573602ecfca1d6eadc14a30af" title="Theorem from the last successful checkValid call. It is used by getProof and getAssumptions.">d_lastValid</a>, <span class="stringliteral">"}"</span>); <a name="l00151"></a>00151 <a name="l00152"></a>00152 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> e_iff_e2(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-><a class="code" href="classCVC3_1_1CommonProofRules.html#af38f25446a561384c3de66392c4d3544" title="e1 <=> e2 ==> ~e1 <=> ~e2">iffContrapositive</a>(<a class="code" href="group__SE__Simple.html#gacb55ccfffc8ddac8c90c3f77e24867ec" title="Theorem which records simplification of the last query.">d_simplifiedThm</a>)); <a name="l00153"></a>00153 <a class="code" href="group__SE.html#ga88ba664573602ecfca1d6eadc14a30af" title="Theorem from the last successful checkValid call. It is used by getProof and getAssumptions.">d_lastValid</a> = <a name="l00154"></a>00154 <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-><a class="code" href="classCVC3_1_1CommonProofRules.html#aebbcd4a194e4fdca0bcd16143fb03a75">iffMP</a>(d_lastValid, <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-><a class="code" href="classCVC3_1_1CommonProofRules.html#a0a87e88508f49b73037e0024afa841bf" title=" (same for IFF)">symmetryRule</a>(e_iff_e2)); <a name="l00155"></a>00155 <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-><a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-><a class="code" href="classCVC3_1_1ContextManager.html#ae74b114a270baff44940a8916d958e9c">pop</a>(); <a name="l00156"></a>00156 } <a name="l00157"></a>00157 <span class="keywordflow">else</span> { <a name="l00158"></a>00158 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search terse"</span>, <span class="stringliteral">"checkValid => false}"</span>); <a name="l00159"></a>00159 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValid => false; }"</span>); <a name="l00160"></a>00160 } <a name="l00161"></a>00161 <span class="keywordflow">return</span> qres; <a name="l00162"></a>00162 } <a name="l00163"></a>00163 <a name="l00164"></a>00164 <a name="l00165"></a><a class="code" href="group__SE__Simple.html#ga7a84d46236fb724f3057702c1fb9e073">00165</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> <a class="code" href="group__SE__Simple.html#ga7a84d46236fb724f3057702c1fb9e073" title="Checks the validity of a formula in the current context.">SearchSimple::checkValidInternal</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="l00166"></a>00166 { <a name="l00167"></a>00167 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Simple.html#gac6fb434835121c59d9ddfb6292ba1748" title="Formula being checked.">d_goal</a>.<a class="code" href="classCVC3_1_1CDO.html#a818fcacc7b30b0f05347335ab125626c">get</a>().<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>(),<span class="stringliteral">"checkValid: Expected true goal"</span>); <a name="l00168"></a>00168 <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Simple.html#ga5993bff58130ad6cf24be03068caafc0" title="Non-literals generated by DP's.">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDO.html#a818fcacc7b30b0f05347335ab125626c">get</a>().<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>(),<span class="stringliteral">"checkValid: Expected true nonLiterals"</span>); <a name="l00169"></a>00169 <a name="l00170"></a>00170 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValid("</span>, e, <span class="stringliteral">") {"</span>); <a name="l00171"></a>00171 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search terse"</span>, <span class="stringliteral">"checkValid() {"</span>); <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="keywordflow">if</span> (!e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>().<a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">isBool</a>()) { <a name="l00174"></a>00174 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a> <a name="l00175"></a>00175 (<span class="stringliteral">"checking validity of a non-boolean expression:\n\n "</span> <a name="l00176"></a>00176 + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>() <a name="l00177"></a>00177 + <span class="stringliteral">"\n\nwhich has the following type:\n\n "</span> <a name="l00178"></a>00178 + 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#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">toString</a>()); <a name="l00179"></a>00179 } <a name="l00180"></a>00180 <a name="l00181"></a>00181 <span class="comment">// A successful query should leave the context unchanged</span> <a name="l00182"></a>00182 <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-><a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-><a class="code" href="classCVC3_1_1ContextManager.html#a90e301927cc935d561b81761d4ab2ee8">push</a>(); <a name="l00183"></a>00183 <a class="code" href="group__SE.html#ga640e08e2b051e08f2abdd4111b9a2e71" title="The bottom-most scope for the current call to checkSAT (where conflict clauses are still valid)...">d_bottomScope</a> = <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>(); <a name="l00184"></a>00184 <a name="l00185"></a>00185 <a class="code" href="group__SE__Simple.html#gacb55ccfffc8ddac8c90c3f77e24867ec" title="Theorem which records simplification of the last query.">d_simplifiedThm</a>.<a class="code" href="classCVC3_1_1CDO.html#ab4e881820af78a628c72691cb9c2128e">set</a>(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-><a class="code" href="classCVC3_1_1TheoryCore.html#acc963fd43994f06d3647394b731e835c">getExprTrans</a>()-><a class="code" href="classCVC3_1_1ExprTransform.html#a39652560061ab1172040113d9dfa25f6">preprocess</a>(e.<a class="code" href="group__ExprPkg.html#gab1ce461dc931af73bf04e88c8d37dcbc">negate</a>())); <a name="l00186"></a>00186 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValid: simplifiedThm = "</span>, <a class="code" href="group__SE__Simple.html#gacb55ccfffc8ddac8c90c3f77e24867ec" title="Theorem which records simplification of the last query.">d_simplifiedThm</a>, <span class="stringliteral">""</span>); <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>& not_e2 = <a class="code" href="group__SE__Simple.html#gacb55ccfffc8ddac8c90c3f77e24867ec" title="Theorem which records simplification of the last query.">d_simplifiedThm</a>.<a class="code" href="classCVC3_1_1CDO.html#a818fcacc7b30b0f05347335ab125626c">get</a>().<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>(); <a name="l00189"></a>00189 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> e2 = not_e2.<a class="code" href="group__ExprPkg.html#gab1ce461dc931af73bf04e88c8d37dcbc">negate</a>(); <a name="l00190"></a>00190 <a name="l00191"></a>00191 <span class="comment">// Assert not_e2 if it's not already asserted</span> <a name="l00192"></a>00192 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search terse"</span>, <span class="stringliteral">"checkValid: Asserting !e: "</span>); <a name="l00193"></a>00193 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"checkValid: Asserting !e: "</span>, not_e2, <span class="stringliteral">""</span>); <a name="l00194"></a>00194 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> not_e2_thm; <a name="l00195"></a>00195 <span class="keywordflow">if</span>(<a class="code" href="group__SE.html#ga83dfe2d2d85bacf5e4aa10c0320a140b" title="Maintain the list of current assumptions (user asserts and splitters) for getAssumptions().">d_assumptions</a>.<a class="code" href="classCVC3_1_1CDMap.html#af5f700035db0db798c645e36dd0b31bd">count</a>(not_e2) == 0) { <a name="l00196"></a>00196 not_e2_thm = <a class="code" href="group__SE.html#gaf46a82b16f76c9e97cfe252d4398eac7" title="Generate and add a new assertion to the set of assertions in the current context. This should only be...">newUserAssumption</a>(not_e2); <a name="l00197"></a>00197 } <span class="keywordflow">else</span> { <a name="l00198"></a>00198 not_e2_thm = <a class="code" href="group__SE.html#ga83dfe2d2d85bacf5e4aa10c0320a140b" title="Maintain the list of current assumptions (user asserts and splitters) for getAssumptions().">d_assumptions</a>[not_e2]; <a name="l00199"></a>00199 } <a name="l00200"></a>00200 <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-><a class="code" href="classCVC3_1_1TheoryCore.html#aecef2465eb761f7f112ddce77f93d081" title="Add a new assertion to the core from the user or a SAT solver. Do NOT use it in a decision procedure;...">addFact</a>(not_e2_thm); <a name="l00201"></a>00201 <a class="code" href="group__SE__Simple.html#gac6fb434835121c59d9ddfb6292ba1748" title="Formula being checked.">d_goal</a>.<a class="code" href="classCVC3_1_1CDO.html#ab4e881820af78a628c72691cb9c2128e">set</a>(not_e2_thm); <a name="l00202"></a>00202 <a name="l00203"></a>00203 <span class="keywordflow">return</span> <a class="code" href="group__SE__Simple.html#ga8f4845fe98fd0da613062d118335192a" title="Private helper function for checkValid and restart.">checkValidMain</a>(e2); <a name="l00204"></a>00204 } <a name="l00205"></a>00205 <a name="l00206"></a>00206 <a name="l00207"></a><a class="code" href="group__SE__Simple.html#ga29f819e266d4821ae874f69da080247c">00207</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> <a class="code" href="group__SE__Simple.html#ga29f819e266d4821ae874f69da080247c" title="Reruns last check with e as an additional assumption.">SearchSimple::restartInternal</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="l00208"></a>00208 { <a name="l00209"></a>00209 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"restart("</span>, e, <span class="stringliteral">") {"</span>); <a name="l00210"></a>00210 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search terse"</span>, <span class="stringliteral">"restart() {"</span>); <a name="l00211"></a>00211 <a name="l00212"></a>00212 <span class="keywordflow">if</span> (!e.<a class="code" href="group__ExprPkg.html#ga42929221eb172250697b72c28af6de07" title="Get the type. Recursively compute if necessary.">getType</a>().<a class="code" href="classCVC3_1_1Type.html#a38bba404056eadf3c283a67ab2347e02">isBool</a>()) { <a name="l00213"></a>00213 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a> <a name="l00214"></a>00214 (<span class="stringliteral">"argument to restart is a non-boolean expression:\n\n "</span> <a name="l00215"></a>00215 + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>() <a name="l00216"></a>00216 + <span class="stringliteral">"\n\nwhich has the following type:\n\n "</span> <a name="l00217"></a>00217 + 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#a2f5ce4b1973ec02b2f2b2eba8ce3cc50">toString</a>()); <a name="l00218"></a>00218 } <a name="l00219"></a>00219 <a name="l00220"></a>00220 <span class="keywordflow">if</span> (<a class="code" href="group__SE.html#ga640e08e2b051e08f2abdd4111b9a2e71" title="The bottom-most scope for the current call to checkSAT (where conflict clauses are still valid)...">d_bottomScope</a> == 0) { <a name="l00221"></a>00221 <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1Exception.html">Exception</a>(<span class="stringliteral">"Call to restart with no current query"</span>); <a name="l00222"></a>00222 } <a name="l00223"></a>00223 <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-><a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-><a class="code" href="classCVC3_1_1ContextManager.html#a0a0dc6f3a5a7ce61cf02566fe31b8691">popto</a>(<a class="code" href="group__SE.html#ga640e08e2b051e08f2abdd4111b9a2e71" title="The bottom-most scope for the current call to checkSAT (where conflict clauses are still valid)...">d_bottomScope</a>); <a name="l00224"></a>00224 <a name="l00225"></a>00225 <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> e2 = <a class="code" href="group__SE__Simple.html#gacb55ccfffc8ddac8c90c3f77e24867ec" title="Theorem which records simplification of the last query.">d_simplifiedThm</a>.<a class="code" href="classCVC3_1_1CDO.html#a818fcacc7b30b0f05347335ab125626c">get</a>().<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>().<a class="code" href="group__ExprPkg.html#gab1ce461dc931af73bf04e88c8d37dcbc">negate</a>(); <a name="l00226"></a>00226 <a name="l00227"></a>00227 <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">"search terse"</span>, <span class="stringliteral">"restart: Asserting e: "</span>); <a name="l00228"></a>00228 <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">"search"</span>, <span class="stringliteral">"restart: Asserting e: "</span>, e, <span class="stringliteral">""</span>); <a name="l00229"></a>00229 <span class="keywordflow">if</span>(<a class="code" href="group__SE.html#ga83dfe2d2d85bacf5e4aa10c0320a140b" title="Maintain the list of current assumptions (user asserts and splitters) for getAssumptions().">d_assumptions</a>.<a class="code" href="classCVC3_1_1CDMap.html#af5f700035db0db798c645e36dd0b31bd">count</a>(e) == 0) { <a name="l00230"></a>00230 <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-><a class="code" href="classCVC3_1_1TheoryCore.html#aecef2465eb761f7f112ddce77f93d081" title="Add a new assertion to the core from the user or a SAT solver. Do NOT use it in a decision procedure;...">addFact</a>(<a class="code" href="group__SE.html#gaf46a82b16f76c9e97cfe252d4398eac7" title="Generate and add a new assertion to the set of assertions in the current context. This should only be...">newUserAssumption</a>(e)); <a name="l00231"></a>00231 } <a name="l00232"></a>00232 <a name="l00233"></a>00233 <span class="keywordflow">return</span> <a class="code" href="group__SE__Simple.html#ga8f4845fe98fd0da613062d118335192a" title="Private helper function for checkValid and restart.">checkValidMain</a>(e2); <a name="l00234"></a>00234 } <a name="l00235"></a>00235 <a name="l00236"></a>00236 <a name="l00237"></a><a class="code" href="group__SE__Simple.html#gadf91beae0add624c57c6481ab23147f8">00237</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Simple.html#gadf91beae0add624c57c6481ab23147f8" title="Notify the search engine about a new non-literal fact.">SearchSimple::addNonLiteralFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>& thm) <a name="l00238"></a>00238 { <a name="l00239"></a>00239 <a class="code" href="group__SE__Simple.html#ga5993bff58130ad6cf24be03068caafc0" title="Non-literals generated by DP's.">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDO.html#ab4e881820af78a628c72691cb9c2128e">set</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-><a class="code" href="classCVC3_1_1CommonProofRules.html#a4aa193bfeb969c96b63db39a70470015">andIntro</a>(<a class="code" href="group__SE__Simple.html#ga5993bff58130ad6cf24be03068caafc0" title="Non-literals generated by DP's.">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDO.html#a818fcacc7b30b0f05347335ab125626c">get</a>(), thm)); <a name="l00240"></a>00240 } </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>