Sophie

Sophie

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>CVC3: search_fast.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">CVC3&#160;<span id="projectnumber">2.4.1</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">search_fast.cpp</div>  </div>
</div>
<div class="contents">
<a href="search__fast_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>
<a name="l00002"></a>00002 <span class="comment"></span><span class="comment">/*!</span>
<a name="l00003"></a>00003 <span class="comment"> * \file search_fast.cpp</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * Author: Mark Zavislak &lt;zavislak@stanford.edu&gt;</span>
<a name="l00006"></a>00006 <span class="comment"> *         Undergraduate</span>
<a name="l00007"></a>00007 <span class="comment"> *         Stanford University          </span>
<a name="l00008"></a>00008 <span class="comment"> *</span>
<a name="l00009"></a>00009 <span class="comment"> * Created: Mon Jul 21 23:52:39 UTC 2003</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span>
<a name="l00014"></a>00014 <span class="comment"> * and its documentation for any purpose is hereby granted without</span>
<a name="l00015"></a>00015 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span>
<a name="l00016"></a>00016 <span class="comment"> * LICENSE file provided with this distribution.</span>
<a name="l00017"></a>00017 <span class="comment"> * </span>
<a name="l00018"></a>00018 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00019"></a>00019 <span class="comment">*/</span><span class="comment"></span>
<a name="l00020"></a>00020 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
<a name="l00021"></a>00021 <span class="comment"></span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="search__fast_8h.html">search_fast.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="typecheck__exception_8h.html" title="An exception to be thrown at typecheck error.">typecheck_exception.h</a>&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;<a class="code" href="search__rules_8h.html" title="Abstract proof rules interface to the simple search engine.">search_rules.h</a>&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &quot;<a class="code" href="command__line__flags_8h.html">command_line_flags.h</a>&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;<a class="code" href="cdmap_8h.html">cdmap.h</a>&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;<a class="code" href="decision__engine__dfs_8h.html">decision_engine_dfs.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="comment">//#include &quot;decision_engine_caching.h&quot;</span>
<a name="l00029"></a>00029 <span class="comment">//#include &quot;decision_engine_mbtf.h&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;<a class="code" href="expr__transform_8h.html" title="Generally Useful Expression Transformations.">expr_transform.h</a>&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="assumptions_8h.html">assumptions.h</a>&quot;</span>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="keyword">using namespace </span>CVC3;
<a name="l00035"></a>00035 <span class="keyword">using namespace </span>std;
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="comment"></span>
<a name="l00038"></a>00038 <span class="comment">//! When set to true, match Chaff behavior as close as possible</span>
<a name="l00039"></a><a class="code" href="search__fast_8cpp.html#afd7f76a27f781c5a8fe2205dd075d865">00039</a> <span class="comment"></span><span class="preprocessor">#define followChaff false</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="classCVC3_1_1SearchEngineFast_1_1ConflictClauseManager.html#ab6f279d5486d100804dcd8e749cb6665">00042</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1SearchEngineFast_1_1ConflictClauseManager.html#ab6f279d5486d100804dcd8e749cb6665">SearchEngineFast::ConflictClauseManager::setRestorePoint</a>()
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;conflict clauses&quot;</span>,
<a name="l00045"></a>00045   <span class="stringliteral">&quot;ConflictClauseManager::setRestorePoint(): scope=&quot;</span>,
<a name="l00046"></a>00046       d_se-&gt;scopeLevel(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l00047"></a>00047   d_se-&gt;d_conflictClauseStack.push_back(<span class="keyword">new</span> deque&lt;ClauseOwner&gt;());
<a name="l00048"></a>00048   d_se-&gt;d_conflictClauses = d_se-&gt;d_conflictClauseStack.back();
<a name="l00049"></a>00049   d_restorePoints.push_back(d_se-&gt;scopeLevel());
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a>00052 
<a name="l00053"></a><a class="code" href="classCVC3_1_1SearchEngineFast_1_1ConflictClauseManager.html#a71dce237fa65a2954f2ab4000369d8cc">00053</a> <span class="keywordtype">void</span> <a class="code" href="classCVC3_1_1SearchEngineFast_1_1ConflictClauseManager.html#a71dce237fa65a2954f2ab4000369d8cc">SearchEngineFast::ConflictClauseManager::notify</a>()
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055   <span class="keywordflow">if</span> (d_restorePoints.size() &gt; 0) {
<a name="l00056"></a>00056     <span class="keywordtype">int</span> scope = d_restorePoints.back();
<a name="l00057"></a>00057     <span class="keywordflow">if</span> (scope &gt; d_se-&gt;scopeLevel()) {
<a name="l00058"></a>00058       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;conflict clauses&quot;</span>,
<a name="l00059"></a>00059       <span class="stringliteral">&quot;ConflictClauseManager::notify(): restore to scope &quot;</span>, scope, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00060"></a>00060       d_restorePoints.pop_back();
<a name="l00061"></a>00061       <span class="keywordflow">while</span> (d_se-&gt;d_conflictClauses-&gt;size() &gt; 0)
<a name="l00062"></a>00062         d_se-&gt;d_conflictClauses-&gt;pop_back();
<a name="l00063"></a>00063       <span class="keyword">delete</span> d_se-&gt;d_conflictClauseStack.back();
<a name="l00064"></a>00064       d_se-&gt;d_conflictClauseStack.pop_back();
<a name="l00065"></a>00065       d_se-&gt;d_conflictClauses = d_se-&gt;d_conflictClauseStack.back();
<a name="l00066"></a>00066     }
<a name="l00067"></a>00067   }
<a name="l00068"></a>00068 }
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 <span class="comment"></span>
<a name="l00071"></a>00071 <span class="comment">//! Constructor</span>
<a name="l00072"></a><a class="code" href="group__SE__Fast.html#ga8869c248ac69ea02656c95b40c99ed24">00072</a> <span class="comment"></span><a class="code" href="group__SE__Fast.html#ga8869c248ac69ea02656c95b40c99ed24" title="The main Constructor.">SearchEngineFast::SearchEngineFast</a>(<a class="code" href="classCVC3_1_1TheoryCore.html" title="This theory handles the built-in logical connectives plus equality. It also handles the registration ...">TheoryCore</a>* core)
<a name="l00073"></a>00073   : <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="l00074"></a>00074     d_name(<span class="stringliteral">&quot;fast&quot;</span>),
<a name="l00075"></a>00075     d_unitPropCount(core-&gt;getStatistics().counter(<span class="stringliteral">&quot;unit propagations&quot;</span>)),
<a name="l00076"></a>00076     d_circuitPropCount(core-&gt;getStatistics().counter(<span class="stringliteral">&quot;circuit propagations&quot;</span>)),
<a name="l00077"></a>00077     d_conflictCount(core-&gt;getStatistics().counter(<span class="stringliteral">&quot;conflicts&quot;</span>)),
<a name="l00078"></a>00078     d_conflictClauseCount(core-&gt;getStatistics().counter(<span class="stringliteral">&quot;conflict clauses&quot;</span>)),
<a name="l00079"></a>00079     d_clauses(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00080"></a>00080     d_unreportedLits(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00081"></a>00081     d_unreportedLitsHandled(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00082"></a>00082     d_nonLiterals(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00083"></a>00083     d_nonLiteralsSaved(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00084"></a>00084     d_simplifiedThm(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00085"></a>00085     d_nonlitQueryStart(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00086"></a>00086     d_nonlitQueryEnd(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00087"></a>00087     d_clausesQueryStart(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00088"></a>00088     d_clausesQueryEnd(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00089"></a>00089     d_conflictClauseManager(core-&gt;getCM()-&gt;getCurrentContext(), this),
<a name="l00090"></a>00090     d_literalSet(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00091"></a>00091     d_useEnqueueFact(false),
<a name="l00092"></a>00092     d_inCheckSAT(false),
<a name="l00093"></a>00093     d_litsAlive(core-&gt;getCM()-&gt;getCurrentContext()),
<a name="l00094"></a>00094     d_litsMaxScorePos(0),
<a name="l00095"></a>00095     d_splitterCount(0),
<a name="l00096"></a>00096     d_litSortCount(0),
<a name="l00097"></a>00097     d_berkminFlag(false)
<a name="l00098"></a>00098 {
<a name="l00099"></a>00099 <span class="comment">//   if (core-&gt;getFlags()[&quot;de&quot;].getString() == &quot;caching&quot;)</span>
<a name="l00100"></a>00100 <span class="comment">//     d_decisionEngine = new DecisionEngineCaching(core, this);</span>
<a name="l00101"></a>00101 <span class="comment">//   else if (core-&gt;getFlags()[&quot;de&quot;].getString() == &quot;mbtf&quot;)</span>
<a name="l00102"></a>00102 <span class="comment">//     d_decisionEngine = new DecisionEngineMBTF(core, this);</span>
<a name="l00103"></a>00103 <span class="comment">//   else</span>
<a name="l00104"></a>00104     <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" 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="l00105"></a>00105 
<a name="l00106"></a>00106   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a> (
<a name="l00107"></a>00107     <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>.setName(<span class="stringliteral">&quot;CDList[SearchEngineDefault.d_nonLiterals]&quot;</span>);
<a name="l00108"></a>00108     <a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>.setName(<span class="stringliteral">&quot;CDList[SearchEngineDefault.d_clauses]&quot;</span>);
<a name="l00109"></a>00109   )
<a name="l00110"></a>00110 
<a name="l00111"></a>00111   <a class="code" href="group__SE__Fast.html#ga8e96b8f24bd89c190e561f387a4a30ee" title="Array of conflict clauses: one deque for each outstanding query.">d_conflictClauseStack</a>.push_back(<span class="keyword">new</span> deque&lt;ClauseOwner&gt;());
<a name="l00112"></a>00112   <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a> = <a class="code" href="group__SE__Fast.html#ga8e96b8f24bd89c190e561f387a4a30ee" title="Array of conflict clauses: one deque for each outstanding query.">d_conflictClauseStack</a>.back();
<a name="l00113"></a>00113 }
<a name="l00114"></a>00114 <span class="comment"></span>
<a name="l00115"></a>00115 <span class="comment">//! Destructor</span>
<a name="l00116"></a>00116 <span class="comment"></span><span class="comment">/*! We own the proof rules (d_rules) and the variable manager (d_vm);</span>
<a name="l00117"></a>00117 <span class="comment">  delete them. */</span>
<a name="l00118"></a><a class="code" href="group__SE__Fast.html#ga8f8c0138aa4f31355dad949f604e3927">00118</a> <a class="code" href="group__SE__Fast.html#ga8f8c0138aa4f31355dad949f604e3927" title="Destructor.">SearchEngineFast::~SearchEngineFast</a>() {
<a name="l00119"></a>00119   <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i=0; i &lt; <a class="code" href="group__SE__Fast.html#ga5db32a771408c468676e407075184b64" title="Mappings of literals to vectors of pointers to the corresponding watched literals.">d_circuits</a>.size(); i++)
<a name="l00120"></a>00120     <span class="keyword">delete</span> <a class="code" href="group__SE__Fast.html#ga5db32a771408c468676e407075184b64" title="Mappings of literals to vectors of pointers to the corresponding watched literals.">d_circuits</a>[i];
<a name="l00121"></a>00121   <span class="keyword">delete</span> <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>;
<a name="l00122"></a>00122   <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i=0, iend=<a class="code" href="group__SE__Fast.html#ga8e96b8f24bd89c190e561f387a4a30ee" title="Array of conflict clauses: one deque for each outstanding query.">d_conflictClauseStack</a>.size(); i&lt;iend; ++i)
<a name="l00123"></a>00123     <span class="keyword">delete</span> <a class="code" href="group__SE__Fast.html#ga8e96b8f24bd89c190e561f387a4a30ee" title="Array of conflict clauses: one deque for each outstanding query.">d_conflictClauseStack</a>[i];
<a name="l00124"></a>00124 }
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 <span class="comment"></span>
<a name="l00127"></a>00127 <span class="comment">/*! @brief Return a ref to the vector of watched literals.  If no</span>
<a name="l00128"></a>00128 <span class="comment">  such vector exists, create it. */</span><span class="comment"></span>
<a name="l00129"></a>00129 <span class="comment">/*!  This function is normally used when the value of &#39;literal&#39;</span>
<a name="l00130"></a>00130 <span class="comment"> * becomes false.  The vector contains pointers to all clauses where</span>
<a name="l00131"></a>00131 <span class="comment"> * this literal occurs, and therefore, these clauses may cause unit</span>
<a name="l00132"></a>00132 <span class="comment"> * propagation.  In any case, the watch pointers in these clauses</span>
<a name="l00133"></a>00133 <span class="comment"> * need to be updated.</span>
<a name="l00134"></a>00134 <span class="comment"> */</span>
<a name="l00135"></a>00135 vector&lt;std::pair&lt;Clause, int&gt; &gt;&amp; 
<a name="l00136"></a><a class="code" href="group__SE__Fast.html#ga8f4353c8f8c65ed00806861471bd857f">00136</a> <a class="code" href="group__SE__Fast.html#ga8f4353c8f8c65ed00806861471bd857f" title="Return a ref to the vector of watched literals. If no such vector exists, create it.">SearchEngineFast::wp</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>&amp; literal) {
<a name="l00137"></a>00137   <span class="comment">// return d_wp[literal.getExpr()];</span>
<a name="l00138"></a>00138   <span class="keywordflow">return</span> literal.<a class="code" href="classCVC3_1_1Literal.html#a93986b2c3cd2889cbbf35fca5d216251">wp</a>();
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 <span class="preprocessor">#ifdef _CVC3_DEBUG_MODE</span>
<a name="l00142"></a>00142 <span class="preprocessor"></span><span class="keyword">static</span> <span class="keywordtype">void</span> checkAssump(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; t, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; orig,
<a name="l00143"></a>00143      <span class="keyword">const</span> <a class="code" href="classCVC3_1_1CDMap.html">CDMap&lt;Expr,Theorem&gt;</a>&amp; assumptions) {
<a name="l00144"></a>00144   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Assumptions.html">Assumptions</a>&amp; a(t.<a class="code" href="classCVC3_1_1Theorem.html#a5e9ab00a613df15cc02f55edb55a67b3">getAssumptionsRef</a>());
<a name="l00145"></a>00145   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Assumptions_1_1iterator.html" title="Iterator for the Assumptions: points to class Theorem.">Assumptions::iterator</a> iend = a.end();
<a name="l00146"></a>00146   <span class="keywordflow">if</span>(!(!t.<a class="code" href="classCVC3_1_1Theorem.html#a05282db6832afb4f198d8c6b2b67aeb1">isAssump</a>() || assumptions.<a class="code" href="classCVC3_1_1CDMap.html#af5f700035db0db798c645e36dd0b31bd">count</a>(t.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>()) &gt; 0))
<a name="l00147"></a>00147     orig.<a class="code" href="classCVC3_1_1Theorem.html#ad9da69b34ab2bab4192e5977e5c10498">printDebug</a>();
<a name="l00148"></a>00148   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>((!t.<a class="code" href="classCVC3_1_1Theorem.html#a05282db6832afb4f198d8c6b2b67aeb1">isAssump</a>() || assumptions.<a class="code" href="classCVC3_1_1CDMap.html#af5f700035db0db798c645e36dd0b31bd">count</a>(t.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>()) &gt; 0), 
<a name="l00149"></a>00149         <span class="stringliteral">&quot;checkAssump: found stray theorem:\n  &quot;</span>
<a name="l00150"></a>00150         + t.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>());
<a name="l00151"></a>00151   <span class="keywordflow">if</span>(t.<a class="code" href="classCVC3_1_1Theorem.html#a05282db6832afb4f198d8c6b2b67aeb1">isAssump</a>()) <span class="keywordflow">return</span>;
<a name="l00152"></a>00152   <span class="keywordflow">for</span> (<a class="code" href="classCVC3_1_1Assumptions_1_1iterator.html" title="Iterator for the Assumptions: points to class Theorem.">Assumptions::iterator</a> i = a.begin(); i != iend; ++i) {
<a name="l00153"></a>00153     <span class="keywordflow">if</span> (!i-&gt;isFlagged()) {
<a name="l00154"></a>00154       i-&gt;setFlag();
<a name="l00155"></a>00155       <span class="comment">// comparing only TheoremValue pointers in .find()</span>
<a name="l00156"></a>00156       checkAssump(*i, orig, assumptions);
<a name="l00157"></a>00157     }
<a name="l00158"></a>00158   }
<a name="l00159"></a>00159 }
<a name="l00160"></a>00160 
<a name="l00161"></a>00161 <span class="comment"></span>
<a name="l00162"></a>00162 <span class="comment">/*! @brief Check that assumptions in the result of checkValid() are a</span>
<a name="l00163"></a>00163 <span class="comment">  subset of assertions */</span><span class="comment"></span>
<a name="l00164"></a>00164 <span class="comment">/*! Only defined in the debug build. </span>
<a name="l00165"></a>00165 <span class="comment"> * \ingroup SE_Default</span>
<a name="l00166"></a>00166 <span class="comment"> */</span>
<a name="l00167"></a>00167 <span class="keyword">static</span> <span class="keywordtype">void</span>
<a name="l00168"></a>00168 checkAssumpDebug(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; res,
<a name="l00169"></a>00169      <span class="keyword">const</span> <a class="code" href="classCVC3_1_1CDMap.html">CDMap&lt;Expr,Theorem&gt;</a>&amp; assumptions) {
<a name="l00170"></a>00170   <span class="comment">// FIXME: (jimz) will need to traverse graph</span>
<a name="l00171"></a>00171 
<a name="l00172"></a>00172   <span class="keywordflow">if</span>(!res.<a class="code" href="classCVC3_1_1Theorem.html#a90349125fe644e8a075e1a47a49872c7">withAssumptions</a>()) <span class="keywordflow">return</span>;
<a name="l00173"></a>00173   res.<a class="code" href="classCVC3_1_1Theorem.html#a621ab2150eedc0e3b38d34275ac206cd" title="Clear the flag attribute in all the theorems.">clearAllFlags</a>();
<a name="l00174"></a>00174   checkAssump(res, res, assumptions);
<a name="l00175"></a>00175 }
<a name="l00176"></a>00176 <span class="preprocessor">#endif</span>
<a name="l00177"></a>00177 <span class="preprocessor"></span>
<a name="l00178"></a>00178 
<a name="l00179"></a>00179 
<a name="l00180"></a>00180 <span class="comment"></span>
<a name="l00181"></a>00181 <span class="comment">////////////////////////////</span>
<a name="l00182"></a>00182 <span class="comment"></span><span class="comment">// New Search Engine Code //</span><span class="comment"></span>
<a name="l00183"></a>00183 <span class="comment">////////////////////////////</span>
<a name="l00184"></a>00184 <span class="comment"></span>
<a name="l00185"></a>00185 
<a name="l00186"></a><a class="code" href="group__SE__Fast.html#gac68652e5ed46a097f846ba9a86fcd630">00186</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> <a class="code" href="group__SE__Fast.html#gac68652e5ed46a097f846ba9a86fcd630">SearchEngineFast::checkSAT</a>()
<a name="l00187"></a>00187 {
<a name="l00188"></a>00188   <a class="code" href="group__SE__Fast.html#ga6368ec56b20c12896000e370bbb4a3b6" title="True when checkSAT() is running.">d_inCheckSAT</a>=<span class="keyword">true</span>;
<a name="l00189"></a>00189   <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> result = <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498baba54da61f61403de5204b899fe55d92f">UNSATISFIABLE</a>;
<a name="l00190"></a>00190   <span class="keywordflow">if</span> (!<a class="code" href="group__SE__Fast.html#gac6d49471ba5c76fffc7581e01e423218" title="Boolean constraint propagation.">bcp</a>()) { <span class="comment">// run an initial bcp</span>
<a name="l00191"></a>00191     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;checkSAT()&quot;</span>);
<a name="l00192"></a>00192     <span class="keywordflow">if</span> (!<a class="code" href="group__SE__Fast.html#ga4490cc372993398612e7556e14222ff3" title="Determines backtracking level and adds conflict clauses.">fixConflict</a>()) <span class="keywordflow">goto</span> checkSATfinalize;
<a name="l00193"></a>00193   }
<a name="l00194"></a>00194   <span class="keywordflow">while</span> (!<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#abf168c0ef6bed9274e49dc2c0576312e" title="Return true if resources are exhausted.">outOfResources</a>()) {
<a name="l00195"></a>00195     <span class="keywordflow">if</span> (<a class="code" href="group__SE__Fast.html#ga6d05128f71cc4e239030fe0434cda727" title="Choose a splitter.">split</a>()) {   <span class="comment">// if we were able to split successfully</span>
<a name="l00196"></a>00196       <span class="comment">// Run BCP</span>
<a name="l00197"></a>00197       <span class="keywordflow">while</span> (!<a class="code" href="group__SE__Fast.html#gac6d49471ba5c76fffc7581e01e423218" title="Boolean constraint propagation.">bcp</a>()) {  <span class="comment">// while bcp finds conflicts</span>
<a name="l00198"></a>00198   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;checkSAT()&quot;</span>);
<a name="l00199"></a>00199   <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>-&gt;<a class="code" href="group__DE.html#ga7910d09d94bd27c02f53a3f7e0a9af00" title="Search should call this when it derives &#39;false&#39;.">goalSatisfied</a>();
<a name="l00200"></a>00200 
<a name="l00201"></a>00201         <span class="comment">// Try to fix those conflicts by rolling back contexts and</span>
<a name="l00202"></a>00202         <span class="comment">// adding new conflict clauses to help in the future.</span>
<a name="l00203"></a>00203         <span class="keywordflow">if</span> (!<a class="code" href="group__SE__Fast.html#ga4490cc372993398612e7556e14222ff3" title="Determines backtracking level and adds conflict clauses.">fixConflict</a>()) <span class="keywordflow">goto</span> checkSATfinalize;
<a name="l00204"></a>00204       }
<a name="l00205"></a>00205     }
<a name="l00206"></a>00206     <span class="comment">// Now we couldn&#39;t find a splitter.  This may have been caused by</span>
<a name="l00207"></a>00207     <span class="comment">// other reasons, so we allow them to be processed here.</span>
<a name="l00208"></a>00208     <span class="keywordflow">else</span> {
<a name="l00209"></a>00209       result = <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498bad11a6bd5ab8c3e02ec8503e7a7860a61">SATISFIABLE</a>;
<a name="l00210"></a>00210       <span class="keywordflow">break</span>;
<a name="l00211"></a>00211     }
<a name="l00212"></a>00212   }
<a name="l00213"></a>00213  checkSATfinalize:
<a name="l00214"></a>00214   <a class="code" href="group__SE__Fast.html#ga6368ec56b20c12896000e370bbb4a3b6" title="True when checkSAT() is running.">d_inCheckSAT</a> = <span class="keyword">false</span>;
<a name="l00215"></a>00215   <span class="keywordflow">if</span> (<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#abf168c0ef6bed9274e49dc2c0576312e" title="Return true if resources are exhausted.">outOfResources</a>()) result = <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498ba33046505033fa14ebb412efb4474ff56">ABORT</a>;
<a name="l00216"></a>00216   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (result == <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498bad11a6bd5ab8c3e02ec8503e7a7860a61">SATISFIABLE</a> &amp;&amp; <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a36571dc56183d89cd36def27939430b0" title="Check if the current decision branch is marked as incomplete.">incomplete</a>()) result = <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498ba249f3dbc426c80d4a31cb5073bf07cfa">UNKNOWN</a>;
<a name="l00217"></a>00217   <span class="keywordflow">return</span> result;
<a name="l00218"></a>00218 }
<a name="l00219"></a>00219 
<a name="l00220"></a>00220 
<a name="l00221"></a>00221 <span class="comment">/* There are different heurisitics for splitters available.  We would</span>
<a name="l00222"></a>00222 <span class="comment"> * normally try to use the new generic decision class, but initially</span>
<a name="l00223"></a>00223 <span class="comment"> * we want this just to work, and so we use a custom decision class</span>
<a name="l00224"></a>00224 <span class="comment"> * that knows about this particular search engine.  We can realize</span>
<a name="l00225"></a>00225 <span class="comment"> * this same behavior using the existing mechanism by having a</span>
<a name="l00226"></a>00226 <span class="comment"> * decision subclass dynamic_cast the received SearchEngine pointer as</span>
<a name="l00227"></a>00227 <span class="comment"> * a SearchEngineFast and work from there.  However, as of this time I</span>
<a name="l00228"></a>00228 <span class="comment"> * do not plan on supporting the nextClause() and nextNonClause()</span>
<a name="l00229"></a>00229 <span class="comment"> * functionality, as they don&#39;t make much sense in this kind of modern</span>
<a name="l00230"></a>00230 <span class="comment"> * solver.  It may make more sense to have the solver and it&#39;s literal</span>
<a name="l00231"></a>00231 <span class="comment"> * splitting heuristic tightly connected, but leaving the nonLiteral</span>
<a name="l00232"></a>00232 <span class="comment"> * splitting heurisitic separate, since it is generally independent of</span>
<a name="l00233"></a>00233 <span class="comment"> * the search mechanism.</span>
<a name="l00234"></a>00234 <span class="comment"> *</span>
<a name="l00235"></a>00235 <span class="comment"> * By this point we&#39;ve already guaranteed that we need to split: no</span>
<a name="l00236"></a>00236 <span class="comment"> * unit clauses, and no conflicts.  The procedure is as follows.  Ask</span>
<a name="l00237"></a>00237 <span class="comment"> * the decision engine for an expression to split on.  The decision</span>
<a name="l00238"></a>00238 <span class="comment"> * engine dutifully returns an expression.  We craft an assumption out</span>
<a name="l00239"></a>00239 <span class="comment"> * of this and assert it to the core (after making sure d_assumptions</span>
<a name="l00240"></a>00240 <span class="comment"> * has a copy).</span>
<a name="l00241"></a>00241 <span class="comment"> *</span>
<a name="l00242"></a>00242 <span class="comment"> * If no splitters are available, we still have to let the decision</span>
<a name="l00243"></a>00243 <span class="comment"> * procedures have a final chance at showing the context is</span>
<a name="l00244"></a>00244 <span class="comment"> * inconsistent by calling checkSATcore().  If we get a false out of</span>
<a name="l00245"></a>00245 <span class="comment"> * this, we have to continue processing, so the context is left</span>
<a name="l00246"></a>00246 <span class="comment"> * unchanged, no splitter is chosen, and we return true to let the</span>
<a name="l00247"></a>00247 <span class="comment"> * bcp+conflict processing have another chance.  If we get true, then</span>
<a name="l00248"></a>00248 <span class="comment"> * the problem is SAT and we are done, so we return false.</span>
<a name="l00249"></a>00249 <span class="comment"> *</span>
<a name="l00250"></a>00250 <span class="comment"> * Otherwise, we obtain the splitter, then ship it back off to the</span>
<a name="l00251"></a>00251 <span class="comment"> * decision engine for processing.</span>
<a name="l00252"></a>00252 <span class="comment"> */</span>
<a name="l00253"></a>00253 
<a name="l00254"></a><a class="code" href="group__SE__Fast.html#ga6d05128f71cc4e239030fe0434cda727">00254</a> <span class="keywordtype">bool</span> <a class="code" href="group__SE__Fast.html#ga6d05128f71cc4e239030fe0434cda727" title="Choose a splitter.">SearchEngineFast::split</a>()
<a name="l00255"></a>00255 {
<a name="l00256"></a>00256   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search basic&quot;</span>, <span class="stringliteral">&quot;Choosing splitter&quot;</span>);
<a name="l00257"></a>00257   <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> splitter = <a class="code" href="group__SE__Fast.html#ga711544b769f4c0a5713df247de927019" title="Returns a splitter.">findSplitter</a>();
<a name="l00258"></a>00258   <span class="keywordflow">if</span> (splitter.<a class="code" href="group__ExprPkg.html#ga0265d1ca42fa59c95aaff3ca675b6504">isNull</a>()) {
<a name="l00259"></a>00259     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search basic&quot;</span>, <span class="stringliteral">&quot;No splitter&quot;</span>);
<a name="l00260"></a>00260     <span class="keywordtype">bool</span> res(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a289340e4457a79f1101f37c3a07a49ed" title="Check if the current context is inconsistent.">inconsistent</a>() || !<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#ae45217f71500d48ef1c4c5118011f254" title="To be called by SearchEngine when it believes the context is satisfiable.">checkSATCore</a>());
<a name="l00261"></a>00261     <span class="keywordflow">if</span>(!res) {
<a name="l00262"></a>00262       <a class="code" href="group__SE__Fast.html#ga52c9c181bcd623a36ab594e0ee16a67e" title="Internal splitter counter for delaying updateLitScores()">d_splitterCount</a> = 0; <span class="comment">// Force resorting splitters next time</span>
<a name="l00263"></a>00263       res = !<a class="code" href="group__SE__Fast.html#gac6d49471ba5c76fffc7581e01e423218" title="Boolean constraint propagation.">bcp</a>();
<a name="l00264"></a>00264     }
<a name="l00265"></a>00265     <span class="keywordflow">return</span> res;
<a name="l00266"></a>00266   }
<a name="l00267"></a>00267   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(splitter));
<a name="l00268"></a>00268   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> simp;
<a name="l00269"></a>00269   <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() != 0) {
<a name="l00270"></a>00270     <span class="comment">// The literal is valid at a lower scope than it has been derived,</span>
<a name="l00271"></a>00271     <span class="comment">// and therefore, it was lost after a scope pop.  Reassert it here.</span>
<a name="l00272"></a>00272     simp = l.<a class="code" href="classCVC3_1_1Literal.html#a9d040e10a412d4a86642a9b2776dd258">deriveTheorem</a>();
<a name="l00273"></a>00273     <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.push_back((l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 1)? l : !l);
<a name="l00274"></a>00274     <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<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>(simp);
<a name="l00275"></a>00275     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00276"></a>00276   }
<a name="l00277"></a>00277   <span class="keywordflow">else</span> {
<a name="l00278"></a>00278     simp = <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a8a66da5ca687474a3a725448a3be8c41" title="Top-level simplifier.">simplify</a>(splitter);
<a name="l00279"></a>00279     <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> e = simp.<a class="code" href="classCVC3_1_1Theorem.html#a97d957fcbf9094480851b1d2e5d3729f">getRHS</a>();
<a name="l00280"></a>00280     <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#ga5c2cee598096c66e80d87490d6505bc4">isBoolConst</a>()) {
<a name="l00281"></a>00281       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;splitter simplified to TRUE or FALSE&quot;</span>)++;)
<a name="l00282"></a>00282       <span class="keywordflow">if</span>(e.<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>()) simp = <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#ad2edb920405666bf6e9d21ae496ff6b3">iffTrueElim</a>(simp);
<a name="l00283"></a>00283       <span class="keywordflow">else</span> {
<a name="l00284"></a>00284   <span class="keywordflow">if</span>(splitter.<a class="code" href="group__ExprPkg.html#ga1a898858ccadce833df5a294c7740f11">isNot</a>())
<a name="l00285"></a>00285     simp = <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#ace6786234994faf89bc1b0ac8575278a">notNotElim</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a11b56754024b56844336954cf789a63a">iffFalseElim</a>(simp));
<a name="l00286"></a>00286   <span class="keywordflow">else</span>
<a name="l00287"></a>00287     simp = <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a11b56754024b56844336954cf789a63a">iffFalseElim</a>(simp);
<a name="l00288"></a>00288       }
<a name="l00289"></a>00289       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search full&quot;</span>, <span class="stringliteral">&quot;Simplified candidate: &quot;</span>, splitter.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l00290"></a>00290       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search full&quot;</span>, <span class="stringliteral">&quot;                  to: &quot;</span>,
<a name="l00291"></a>00291       simp.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l00292"></a>00292       <span class="comment">// Send this literal to DPs and enqueue it for BCP</span>
<a name="l00293"></a>00293       <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<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>(simp);
<a name="l00294"></a>00294       <a class="code" href="group__SE__Fast.html#gaef3113afb8dc9ea1b06217ab77f5d713" title="Notify the search engine about a new literal fact.">addLiteralFact</a>(simp);
<a name="l00295"></a>00295       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>()!=0, <span class="stringliteral">&quot;SearchFast::split(): l = &quot;</span>+l.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>());
<a name="l00296"></a>00296       <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00297"></a>00297     }
<a name="l00298"></a>00298   }
<a name="l00299"></a>00299 
<a name="l00300"></a>00300   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search terse&quot;</span>, <span class="stringliteral">&quot;Asserting splitter: #&quot;</span>
<a name="l00301"></a>00301   +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a7f119c4fa5313b72feca7dd441e045f0">getStatistics</a>().<a class="code" href="classCVC3_1_1Statistics.html#a9b2503d33c8c41b768f40b1a43c2d3bf">counter</a>(<span class="stringliteral">&quot;splitters&quot;</span>))+<span class="stringliteral">&quot;: &quot;</span>,
<a name="l00302"></a>00302   splitter, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00303"></a>00303   <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>-&gt;<a class="code" href="group__DE.html#ga03a83031c2361cce4e8ce952842973be" title="Push context and record the splitter.">pushDecision</a>(splitter);
<a name="l00304"></a>00304   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00305"></a>00305 }
<a name="l00306"></a>00306 <span class="comment"></span>
<a name="l00307"></a>00307 <span class="comment">//! Total order on literals for the initial sort</span>
<a name="l00308"></a>00308 <span class="comment"></span><span class="comment">/*! Used for debugging, to match Chaff&#39;s behavior as close as possible</span>
<a name="l00309"></a>00309 <span class="comment">  and track any discrepancies or inefficiencies. */</span>
<a name="l00310"></a>00310 <span class="comment">// static bool compareInitial(const Literal&amp; l1, const Literal&amp; l2) {</span>
<a name="l00311"></a>00311 <span class="comment">//   Expr lit1 = l1.getVar().getExpr();</span>
<a name="l00312"></a>00312 <span class="comment">//   Expr lit2 = l2.getVar().getExpr();</span>
<a name="l00313"></a>00313 <span class="comment">//   if(lit1.hasOp() &amp;&amp; lit2.hasOp()) {</span>
<a name="l00314"></a>00314 <span class="comment">//     int i = atoi(&amp;(lit1.getOp().getName().c_str()[2]));</span>
<a name="l00315"></a>00315 <span class="comment">//     int j = atoi(&amp;(lit2.getOp().getName().c_str()[2]));</span>
<a name="l00316"></a>00316 <span class="comment">//     return (i &lt; j);</span>
<a name="l00317"></a>00317 <span class="comment">//   }</span>
<a name="l00318"></a>00318 <span class="comment">//   else</span>
<a name="l00319"></a>00319 <span class="comment">//     return (l1.score() &gt; l2.score());</span>
<a name="l00320"></a>00320 <span class="comment">// }</span>
<a name="l00321"></a>00321 <span class="comment"></span>
<a name="l00322"></a>00322 <span class="comment">//! Ordering on literals, used to sort them by score</span>
<a name="l00323"></a><a class="code" href="search__fast_8cpp.html#a55afec8e553f4d1c6487c4e63a0c2375">00323</a> <span class="comment"></span><span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="search__fast_8cpp.html#a55afec8e553f4d1c6487c4e63a0c2375" title="Total order on literals for the initial sort.">compareLits</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>&amp; l1, 
<a name="l00324"></a>00324              <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>&amp; l2) 
<a name="l00325"></a>00325 {
<a name="l00326"></a>00326   <span class="keywordflow">return</span> (l1.<a class="code" href="classCVC3_1_1Literal.html#a436c5126780bd81c31bc01a868b5b857">score</a>() &gt; l2.<a class="code" href="classCVC3_1_1Literal.html#a436c5126780bd81c31bc01a868b5b857">score</a>());
<a name="l00327"></a>00327 }
<a name="l00328"></a>00328 
<a name="l00329"></a>00329 <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keyword">static</span> <span class="keywordtype">string</span> lits2str(<span class="keyword">const</span> vector&lt;Literal&gt;&amp; lits) {
<a name="l00330"></a>00330   ostringstream ss;
<a name="l00331"></a>00331   ss &lt;&lt; <span class="stringliteral">&quot;\n[&quot;</span>;
<a name="l00332"></a>00332   <span class="keywordflow">for</span>(vector&lt;Literal&gt;::const_iterator i=lits.begin(), iend=lits.end();
<a name="l00333"></a>00333       i!=iend; ++i)
<a name="l00334"></a>00334     ss &lt;&lt; *i &lt;&lt; <span class="stringliteral">&quot;\n &quot;</span>;
<a name="l00335"></a>00335   ss &lt;&lt; <span class="stringliteral">&quot;\n]&quot;</span>;
<a name="l00336"></a>00336   <span class="keywordflow">return</span> ss.str();
<a name="l00337"></a>00337 })
<a name="l00338"></a>00338 
<a name="l00339"></a>00339 <span class="comment"></span>
<a name="l00340"></a>00340 <span class="comment">/*!</span>
<a name="l00341"></a>00341 <span class="comment"> * Recompute the scores for all known literals.  This is a relatively</span>
<a name="l00342"></a>00342 <span class="comment"> * expensive procedure, so it should not be called too often.</span>
<a name="l00343"></a>00343 <span class="comment"> * Currently, it is called once per 100 splitters.</span>
<a name="l00344"></a>00344 <span class="comment"> */</span>
<a name="l00345"></a><a class="code" href="group__SE__Fast.html#ga453b1d390ee3b7af68fe8e915443d1ad">00345</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga453b1d390ee3b7af68fe8e915443d1ad">SearchEngineFast::updateLitScores</a>(<span class="keywordtype">bool</span> firstTime)
<a name="l00346"></a>00346 {
<a name="l00347"></a>00347   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;updateLitScores(size=&quot;</span>, d_litsByScores.size(),
<a name="l00348"></a>00348   <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l00349"></a>00349   <span class="keywordtype">unsigned</span> count, score;
<a name="l00350"></a>00350 
<a name="l00351"></a>00351   <span class="keywordflow">if</span> (firstTime &amp;&amp; <a class="code" href="search__fast_8cpp.html#afd7f76a27f781c5a8fe2205dd075d865" title="When set to true, match Chaff behavior as close as possible.">followChaff</a>) {
<a name="l00352"></a>00352     ::stable_sort(d_litsByScores.begin(), d_litsByScores.end(), <a class="code" href="search__fast_8cpp.html#a55afec8e553f4d1c6487c4e63a0c2375" title="Total order on literals for the initial sort.">compareLits</a>);
<a name="l00353"></a>00353   }
<a name="l00354"></a>00354 
<a name="l00355"></a>00355   <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i=0; i&lt; d_litsByScores.size(); ++i) {
<a name="l00356"></a>00356     <span class="comment">// Reading by value, since we&#39;ll be modifying the attributes.</span>
<a name="l00357"></a>00357     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> lit = d_litsByScores[i];
<a name="l00358"></a>00358     <span class="comment">// First, clean up the unused literals</span>
<a name="l00359"></a>00359     <span class="keywordflow">while</span>(lit.<a class="code" href="classCVC3_1_1Literal.html#a4823b2e9ec3a6a13a28c209d22269564">count</a>()==0 &amp;&amp; i+1 &lt; d_litsByScores.size()) {
<a name="l00360"></a>00360       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Removing lit[&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">&quot;] = &quot;</span>, lit,
<a name="l00361"></a>00361       <span class="stringliteral">&quot; from d_litsByScores&quot;</span>);
<a name="l00362"></a>00362       <span class="comment">// Remove this literal from the list</span>
<a name="l00363"></a>00363       lit.<a class="code" href="classCVC3_1_1Literal.html#a49129c1ccac9ad6380af512daae84b34">added</a>()=<span class="keyword">false</span>;
<a name="l00364"></a>00364       lit = d_litsByScores.back();
<a name="l00365"></a>00365       d_litsByScores[i] = lit;
<a name="l00366"></a>00366       d_litsByScores.pop_back();
<a name="l00367"></a>00367     }
<a name="l00368"></a>00368     <span class="comment">// Take care of the last literal in the vector</span>
<a name="l00369"></a>00369     <span class="keywordflow">if</span>(lit.<a class="code" href="classCVC3_1_1Literal.html#a4823b2e9ec3a6a13a28c209d22269564">count</a>()==0 &amp;&amp; i+1 == d_litsByScores.size()) {
<a name="l00370"></a>00370       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Removing last lit[&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">&quot;] = &quot;</span>, lit,
<a name="l00371"></a>00371       <span class="stringliteral">&quot; from d_litsByScores&quot;</span>);
<a name="l00372"></a>00372       lit.<a class="code" href="classCVC3_1_1Literal.html#a49129c1ccac9ad6380af512daae84b34">added</a>()=<span class="keyword">false</span>;
<a name="l00373"></a>00373       d_litsByScores.pop_back();
<a name="l00374"></a>00374       <span class="keywordflow">break</span>; <span class="comment">// Break out of the loop -- no more literals to process</span>
<a name="l00375"></a>00375     }
<a name="l00376"></a>00376 
<a name="l00377"></a>00377     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Updating lit[&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">&quot;] = &quot;</span>, lit, <span class="stringliteral">&quot; {&quot;</span>);
<a name="l00378"></a>00378 
<a name="l00379"></a>00379     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(lit == d_litsByScores[i], <span class="stringliteral">&quot;lit = &quot;</span>+lit.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>());
<a name="l00380"></a>00380     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(lit.<a class="code" href="classCVC3_1_1Literal.html#a49129c1ccac9ad6380af512daae84b34">added</a>(), <span class="stringliteral">&quot;lit = &quot;</span>+lit.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>());
<a name="l00381"></a>00381     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(lit.<a class="code" href="classCVC3_1_1Literal.html#a4823b2e9ec3a6a13a28c209d22269564">count</a>()&gt;0, <span class="stringliteral">&quot;lit = &quot;</span>+lit.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>());
<a name="l00382"></a>00382 
<a name="l00383"></a>00383     count = lit.<a class="code" href="classCVC3_1_1Literal.html#a4823b2e9ec3a6a13a28c209d22269564">count</a>();
<a name="l00384"></a>00384     <span class="keywordtype">unsigned</span>&amp; countPrev = lit.<a class="code" href="classCVC3_1_1Literal.html#ab2a9170779ff251399c8d197c5c5c8ce">countPrev</a>();
<a name="l00385"></a>00385     <span class="keywordtype">int</span>&amp; scoreRef = lit.<a class="code" href="classCVC3_1_1Literal.html#a436c5126780bd81c31bc01a868b5b857">score</a>();
<a name="l00386"></a>00386 
<a name="l00387"></a>00387     score = scoreRef/2 + count - countPrev;
<a name="l00388"></a>00388     scoreRef = score;
<a name="l00389"></a>00389     countPrev = count;
<a name="l00390"></a>00390 
<a name="l00391"></a>00391     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Updated lit[&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">&quot;] = &quot;</span>, lit, <span class="stringliteral">&quot; }&quot;</span>);
<a name="l00392"></a>00392 <span class="comment">//     Literal neglit(!lit);</span>
<a name="l00393"></a>00393 
<a name="l00394"></a>00394 <span class="comment">//     count = neglit.count();</span>
<a name="l00395"></a>00395 <span class="comment">//     unsigned&amp; negcountPrev = neglit.countPrev();</span>
<a name="l00396"></a>00396 <span class="comment">//     unsigned&amp; negscoreRef = neglit.score();</span>
<a name="l00397"></a>00397 
<a name="l00398"></a>00398 <span class="comment">//     negscore = negscoreRef/2 + count - negcountPrev;</span>
<a name="l00399"></a>00399 <span class="comment">//     negscoreRef = negscore;</span>
<a name="l00400"></a>00400 <span class="comment">//     negcountPrev = count;</span>
<a name="l00401"></a>00401 
<a name="l00402"></a>00402 <span class="comment">//     if(negscore &gt; score) d_litsByScores[i] = neglit;</span>
<a name="l00403"></a>00403   }
<a name="l00404"></a>00404   ::stable_sort(d_litsByScores.begin(), d_litsByScores.end(), <a class="code" href="search__fast_8cpp.html#a55afec8e553f4d1c6487c4e63a0c2375" title="Total order on literals for the initial sort.">compareLits</a>);
<a name="l00405"></a>00405   d_litsMaxScorePos = 0;
<a name="l00406"></a>00406   d_litSortCount=d_litsByScores.size();
<a name="l00407"></a>00407   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search splitters&quot;</span>,<span class="stringliteral">&quot;updateLitScores =&gt; &quot;</span>, lits2str(d_litsByScores),<span class="stringliteral">&quot;&quot;</span>);
<a name="l00408"></a>00408   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;updateLitScores(size=&quot;</span>, d_litsByScores.size(),
<a name="l00409"></a>00409   <span class="stringliteral">&quot;) =&gt; }&quot;</span>);
<a name="l00410"></a>00410 }
<a name="l00411"></a>00411 
<a name="l00412"></a><a class="code" href="group__SE__Fast.html#ga775b06e155128cc8817f254bc293c6c6">00412</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga775b06e155128cc8817f254bc293c6c6" title="Add the literals of a new clause to d_litsByScores.">SearchEngineFast::updateLitCounts</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>&amp; c)
<a name="l00413"></a>00413 {
<a name="l00414"></a>00414   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;updateLitCounts(&quot;</span>, <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c), <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l00415"></a>00415   <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> i=0; i&lt;c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); ++i) {
<a name="l00416"></a>00416     <span class="comment">// Assign by value to modify the attributes</span>
<a name="l00417"></a>00417     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> lit = c[i];
<a name="l00418"></a>00418     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(lit.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>().<a class="code" href="group__ExprPkg.html#gaac535dae48f02fcd093a5b1b1a062211" title="Test if e is an abstract literal.">isAbsLiteral</a>(),<span class="stringliteral">&quot;Expected literal&quot;</span>);
<a name="l00419"></a>00419     <span class="comment">// Only add the literal if it wasn&#39;t added before.  The literal</span>
<a name="l00420"></a>00420     <span class="comment">// counts are taken care of in Clause constructors/destructors.</span>
<a name="l00421"></a>00421 <span class="comment">//     if(!lit.added() || lit.count() != lit.countPrev())</span>
<a name="l00422"></a>00422     <a class="code" href="group__SE__Fast.html#ga2d54fdadc1b167dbbb366e37e0b97a58" title="Internal (decrementing) count of added splitters, to sort d_litByScores.">d_litSortCount</a>--;
<a name="l00423"></a>00423     
<a name="l00424"></a>00424     <span class="keywordflow">if</span>(!lit.<a class="code" href="classCVC3_1_1Literal.html#a49129c1ccac9ad6380af512daae84b34">added</a>()) {
<a name="l00425"></a>00425       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;adding literal &quot;</span>, lit, <span class="stringliteral">&quot; to d_litsByScores&quot;</span>);
<a name="l00426"></a>00426       <a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.push_back(lit);
<a name="l00427"></a>00427       lit.<a class="code" href="classCVC3_1_1Literal.html#a49129c1ccac9ad6380af512daae84b34">added</a>()=<span class="keyword">true</span>;
<a name="l00428"></a>00428     }
<a name="l00429"></a>00429   }
<a name="l00430"></a>00430   <span class="keywordflow">if</span>(<a class="code" href="group__SE__Fast.html#ga2d54fdadc1b167dbbb366e37e0b97a58" title="Internal (decrementing) count of added splitters, to sort d_litByScores.">d_litSortCount</a> &lt; 0) {
<a name="l00431"></a>00431     ::stable_sort(<a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.begin(), <a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.end(), <a class="code" href="search__fast_8cpp.html#a55afec8e553f4d1c6487c4e63a0c2375" title="Total order on literals for the initial sort.">compareLits</a>);
<a name="l00432"></a>00432     <a class="code" href="group__SE__Fast.html#ga2d54fdadc1b167dbbb366e37e0b97a58" title="Internal (decrementing) count of added splitters, to sort d_litByScores.">d_litSortCount</a>=<a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.size();
<a name="l00433"></a>00433   }
<a name="l00434"></a>00434   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search splitters&quot;</span>,<span class="stringliteral">&quot;updateLitCounts =&gt; &quot;</span>, lits2str(<a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>),<span class="stringliteral">&quot;&quot;</span>);
<a name="l00435"></a>00435   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;updateLitCounts =&gt; }&quot;</span>);
<a name="l00436"></a>00436 }
<a name="l00437"></a>00437 
<a name="l00438"></a><a class="code" href="group__SE__Fast.html#ga711544b769f4c0a5713df247de927019">00438</a> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> <a class="code" href="group__SE__Fast.html#ga711544b769f4c0a5713df247de927019" title="Returns a splitter.">SearchEngineFast::findSplitter</a>()
<a name="l00439"></a>00439 {
<a name="l00440"></a>00440   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;splitters&quot;</span>, <span class="stringliteral">&quot;SearchEngineFast::findSplitter() {&quot;</span>);
<a name="l00441"></a>00441   <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> splitter; <span class="comment">// Null by default</span>
<a name="l00442"></a>00442   <span class="keywordtype">unsigned</span> i;
<a name="l00443"></a>00443 
<a name="l00444"></a>00444   <span class="comment">// if we have a conflict clause, pick the one inside with the</span>
<a name="l00445"></a>00445   <span class="comment">// best ac(z) score (from the most recent conflict clause)</span>
<a name="l00446"></a>00446   <span class="comment">//  if (d_berkminFlag &amp;&amp; !d_conflictClauses.empty())</span>
<a name="l00447"></a>00447   <span class="keywordflow">if</span> (<a class="code" href="group__SE__Fast.html#ga3877f82445d777c19c60b6ec117335e2" title="Flag to switch on/off the berkmin heuristic.">d_berkminFlag</a> &amp;&amp; !<a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;empty())
<a name="l00448"></a>00448   {
<a name="l00449"></a>00449     <span class="keywordtype">unsigned</span> sCount = 0;
<a name="l00450"></a>00450     std::deque&lt;ClauseOwner&gt;::reverse_iterator foundUnsat = <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;rend();
<a name="l00451"></a>00451     <span class="keywordflow">for</span> (std::deque&lt;ClauseOwner&gt;::reverse_iterator i = <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;rbegin();
<a name="l00452"></a>00452          i != <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;rend();
<a name="l00453"></a>00453          ++i) {
<a name="l00454"></a>00454       ++sCount;
<a name="l00455"></a>00455       <span class="keywordflow">if</span> (!((<a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>)*i).sat(<span class="keyword">true</span>)) {
<a name="l00456"></a>00456         foundUnsat = i;
<a name="l00457"></a>00457         <span class="keywordflow">break</span>;
<a name="l00458"></a>00458       }
<a name="l00459"></a>00459     }
<a name="l00460"></a>00460     <span class="keywordflow">if</span> (foundUnsat != <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;rend()) {
<a name="l00461"></a>00461       <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> &amp;topClause = *foundUnsat;
<a name="l00462"></a>00462       <span class="keywordtype">int</span> numLits = topClause.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>();
<a name="l00463"></a>00463       <span class="keywordtype">int</span> bestScore = 0;
<a name="l00464"></a>00464       <span class="keywordtype">int</span> bestLit = -1;
<a name="l00465"></a>00465       <span class="keywordtype">unsigned</span> numChoices = 0;
<a name="l00466"></a>00466       <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; numLits; ++i) {
<a name="l00467"></a>00467   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>&amp; lit = topClause[i];
<a name="l00468"></a>00468         <span class="keywordflow">if</span> (lit.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() != 0) <span class="keywordflow">continue</span>;
<a name="l00469"></a>00469         <span class="keywordflow">if</span> (bestLit == -1) bestLit = i;
<a name="l00470"></a>00470         ++numChoices;
<a name="l00471"></a>00471         <span class="keywordtype">int</span> s = lit.<a class="code" href="classCVC3_1_1Literal.html#a436c5126780bd81c31bc01a868b5b857">score</a>();
<a name="l00472"></a>00472         <span class="keywordflow">if</span> (s &gt; bestScore) {
<a name="l00473"></a>00473           bestLit = i;
<a name="l00474"></a>00474           bestScore = s;
<a name="l00475"></a>00475         }
<a name="l00476"></a>00476       }
<a name="l00477"></a>00477       <span class="keywordflow">if</span> (bestLit != -1) {
<a name="l00478"></a>00478   splitter = topClause[bestLit].getExpr();
<a name="l00479"></a>00479         <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;BerkMin heuristic&quot;</span>)++;)
<a name="l00480"></a>00480         <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;splitters&quot;</span>, <span class="stringliteral">&quot;SearchEngineFast::findSplitter()[berkmin] =&gt; &quot;</span>,
<a name="l00481"></a>00481         splitter, <span class="stringliteral">&quot; }&quot;</span>); 
<a name="l00482"></a>00482         <span class="keywordflow">return</span> splitter;
<a name="l00483"></a>00483       }
<a name="l00484"></a>00484     }
<a name="l00485"></a>00485   } 
<a name="l00486"></a>00486 
<a name="l00487"></a>00487   <span class="comment">/*</span>
<a name="l00488"></a>00488 <span class="comment">  // Search for DP-specific splitters</span>
<a name="l00489"></a>00489 <span class="comment">  for(CDMapOrdered&lt;Splitter,bool&gt;::iterator i=d_dpSplitters.begin(),</span>
<a name="l00490"></a>00490 <span class="comment">  iend=d_dpSplitters.end(); i!=iend; ++i) {</span>
<a name="l00491"></a>00491 <span class="comment">    Expr e((*i).first.expr);</span>
<a name="l00492"></a>00492 <span class="comment">    if(e.isBoolConst() || d_core-&gt;find(e).getRHS().isBoolConst())</span>
<a name="l00493"></a>00493 <span class="comment">      continue;</span>
<a name="l00494"></a>00494 <span class="comment">    return e;</span>
<a name="l00495"></a>00495 <span class="comment">  }</span>
<a name="l00496"></a>00496 <span class="comment">  */</span>
<a name="l00497"></a>00497 
<a name="l00498"></a>00498   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>()-1; i &gt;= 0; --i) {
<a name="l00499"></a>00499     <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e = <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>[i].get().getExpr();
<a name="l00500"></a>00500     <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>()) <span class="keywordflow">continue</span>;
<a name="l00501"></a>00501     <span class="comment">//    if (d_nonLiteralSimplified[thm.getExpr()]) continue;</span>
<a name="l00502"></a>00502     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!e.<a class="code" href="group__ExprPkg.html#ga5c2cee598096c66e80d87490d6505bc4">isBoolConst</a>(), <span class="stringliteral">&quot;Expected non-bool const&quot;</span>);
<a name="l00503"></a>00503     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1Theory.html#a9d441225b287419426c80a0374d6c6cb" title="Simplify a term e w.r.t. the current context.">simplifyExpr</a>(e) == e,
<a name="l00504"></a>00504         <span class="stringliteral">&quot;Expected non-literal to be simplified:\n e = &quot;</span>
<a name="l00505"></a>00505     +e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()+<span class="stringliteral">&quot;\n simplify(e) = &quot;</span>
<a name="l00506"></a>00506     +<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1Theory.html#a9d441225b287419426c80a0374d6c6cb" title="Simplify a term e w.r.t. the current context.">simplifyExpr</a>(e).<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00507"></a>00507     splitter = <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>-&gt;<a class="code" href="group__DE.html#ga6f191a7f4edb645e8df7c1f005a50bf8" title="Finds a splitter inside a non const expression. The expression passed in must not be a boolean consta...">findSplitter</a>(e);
<a name="l00508"></a>00508     <span class="comment">//DebugAssert(!splitter.isNull(),</span>
<a name="l00509"></a>00509     <span class="comment">//            &quot;findSplitter: can&#39;t find splitter in non-literal: &quot;</span>
<a name="l00510"></a>00510     <span class="comment">//            + e.toString());</span>
<a name="l00511"></a>00511     <span class="keywordflow">if</span> (splitter.isNull()) <span class="keywordflow">continue</span>;
<a name="l00512"></a>00512     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;splitters from non-literals&quot;</span>)++;)          
<a name="l00513"></a>00513     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;splitters&quot;</span>, <span class="stringliteral">&quot;SearchEngineFast::findSplitter()[non-lit] =&gt; &quot;</span>,
<a name="l00514"></a>00514     splitter, <span class="stringliteral">&quot; }&quot;</span>); 
<a name="l00515"></a>00515     <span class="keywordflow">return</span> splitter;
<a name="l00516"></a>00516   }
<a name="l00517"></a>00517 
<a name="l00518"></a>00518   <span class="comment">// Update the scores: we are about to choose a splitter based on them</span>
<a name="l00519"></a>00519   <span class="keywordflow">if</span> (<a class="code" href="group__SE__Fast.html#ga52c9c181bcd623a36ab594e0ee16a67e" title="Internal splitter counter for delaying updateLitScores()">d_splitterCount</a> &lt;= 0) {
<a name="l00520"></a>00520     <a class="code" href="group__SE__Fast.html#ga453b1d390ee3b7af68fe8e915443d1ad">updateLitScores</a>(<span class="keyword">false</span>);
<a name="l00521"></a>00521 <span class="comment">//     d_splitterCount = d_litsByScores.size();</span>
<a name="l00522"></a>00522 <span class="comment">//     if(d_splitterCount &gt; 100)</span>
<a name="l00523"></a>00523       <a class="code" href="group__SE__Fast.html#ga52c9c181bcd623a36ab594e0ee16a67e" title="Internal splitter counter for delaying updateLitScores()">d_splitterCount</a> = 0x10;
<a name="l00524"></a>00524   } <span class="keywordflow">else</span>
<a name="l00525"></a>00525     <a class="code" href="group__SE__Fast.html#ga52c9c181bcd623a36ab594e0ee16a67e" title="Internal splitter counter for delaying updateLitScores()">d_splitterCount</a>--;
<a name="l00526"></a>00526   <span class="comment">// pick splitter based on score</span>
<a name="l00527"></a>00527   <span class="keywordflow">for</span> (i=<a class="code" href="group__SE__Fast.html#gad80c2b69b88a04c8c78309859abd3f76" title="Position of a literal with max score in d_litsByScores.">d_litsMaxScorePos</a>; i&lt;<a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.size(); ++i) {
<a name="l00528"></a>00528     <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>&amp; splitterLit = <a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>[i];
<a name="l00529"></a>00529     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search splitters&quot;</span>, <span class="stringliteral">&quot;d_litsByScores[&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">&quot;] = &quot;</span>,
<a name="l00530"></a>00530     splitterLit,<span class="stringliteral">&quot;&quot;</span>);
<a name="l00531"></a>00531     <span class="comment">//if (d_core-&gt;simplifyExpr(splitter).isBoolConst()) continue;</span>
<a name="l00532"></a>00532     <span class="keywordflow">if</span>(splitterLit.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() != 0) <span class="keywordflow">continue</span>;
<a name="l00533"></a>00533     splitter = splitterLit.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>();
<a name="l00534"></a>00534     <span class="comment">// Skip auxiliary CNF vars</span>
<a name="l00535"></a>00535     <span class="keywordflow">if</span>(!<a class="code" href="group__SE.html#gaed4079f44a18e496b87366ce65b20d99" title="Check if a splitter is required for completeness.">isGoodSplitter</a>(splitter)) <span class="keywordflow">continue</span>;
<a name="l00536"></a>00536     <a class="code" href="group__SE__Fast.html#gad80c2b69b88a04c8c78309859abd3f76" title="Position of a literal with max score in d_litsByScores.">d_litsMaxScorePos</a> = i+1;
<a name="l00537"></a>00537     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;splitters from literals&quot;</span>)++;)
<a name="l00538"></a>00538     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;splitters&quot;</span>, <span class="stringliteral">&quot;d_litsMaxScorePos: &quot;</span>, <a class="code" href="group__SE__Fast.html#gad80c2b69b88a04c8c78309859abd3f76" title="Position of a literal with max score in d_litsByScores.">d_litsMaxScorePos</a>, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00539"></a>00539     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;splitters&quot;</span>, <span class="stringliteral">&quot;SearchEngineFast::findSplitter()[lit] =&gt; &quot;</span>,
<a name="l00540"></a>00540     splitter, <span class="stringliteral">&quot; }&quot;</span>); 
<a name="l00541"></a>00541     <span class="keywordflow">return</span> splitter;
<a name="l00542"></a>00542   }
<a name="l00543"></a>00543   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;splitters&quot;</span>,
<a name="l00544"></a>00544       <span class="stringliteral">&quot;SearchEngineFast::findSplitter()[not found] =&gt; Null }&quot;</span>);
<a name="l00545"></a>00545   <span class="keywordflow">return</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>();
<a name="l00546"></a>00546 }
<a name="l00547"></a>00547 
<a name="l00548"></a>00548 
<a name="l00549"></a><a class="code" href="group__SE__Fast.html#ga2ec0e19a01ac0926b690c50a3206c5a3">00549</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga2ec0e19a01ac0926b690c50a3206c5a3" title="Process a new derived fact (auxiliary function)">SearchEngineFast::recordFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; thm)
<a name="l00550"></a>00550 {
<a name="l00551"></a>00551   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>()));
<a name="l00552"></a>00552   <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 0) {
<a name="l00553"></a>00553     l.<a class="code" href="classCVC3_1_1Literal.html#ad731e76b4037cb3e5d797543596514a1">setValue</a>(thm, thm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>());
<a name="l00554"></a>00554     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;recordFact adds unreported lit&quot;</span>)++;)
<a name="l00555"></a>00555     <a class="code" href="group__SE__Fast.html#gabe8dbaf4592793c49cd58ff93a897a06" title="Backtrackable set of pending unprocessed literals.">d_unreportedLits</a>.<a class="code" href="classCVC3_1_1CDMap.html#a664a15046de83b0af599f488cb420022">insert</a>(l.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>(),thm,thm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>());
<a name="l00556"></a>00556   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 1 &amp;&amp; l.<a class="code" href="classCVC3_1_1Literal.html#a2abe99239ecdf75235e242282cd672f2">getScope</a>() &gt; thm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>()) {
<a name="l00557"></a>00557     <span class="comment">// Cannot do this, it will trigger DebugAssert</span>
<a name="l00558"></a>00558     <span class="comment">// l.setValue(thm,thm.getScope());</span>
<a name="l00559"></a>00559     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;recordFact adds unreported lit&quot;</span>)++;)
<a name="l00560"></a>00560     <a class="code" href="group__SE__Fast.html#gabe8dbaf4592793c49cd58ff93a897a06" title="Backtrackable set of pending unprocessed literals.">d_unreportedLits</a>.<a class="code" href="classCVC3_1_1CDMap.html#a664a15046de83b0af599f488cb420022">insert</a>(l.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>(),thm,thm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>());
<a name="l00561"></a>00561   } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() &lt; 0) { <span class="comment">// Contradiction, bcp will die anyway</span>
<a name="l00562"></a>00562     <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#aad653dd8534feb823b9d30f060b4e181">isNegative</a>())
<a name="l00563"></a>00563       <a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234" title="Set the context inconsistent. Takes Theorem(FALSE).">setInconsistent</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a1074822d52c22daacaa78b34ac0635ba">contradictionRule</a>(l.<a class="code" href="classCVC3_1_1Literal.html#a9d040e10a412d4a86642a9b2776dd258">deriveTheorem</a>(), thm));
<a name="l00564"></a>00564     <span class="keywordflow">else</span>
<a name="l00565"></a>00565       <a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234" title="Set the context inconsistent. Takes Theorem(FALSE).">setInconsistent</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a1074822d52c22daacaa78b34ac0635ba">contradictionRule</a>(thm, l.<a class="code" href="classCVC3_1_1Literal.html#a9d040e10a412d4a86642a9b2776dd258">deriveTheorem</a>()));
<a name="l00566"></a>00566   }
<a name="l00567"></a>00567   <span class="comment">//else if (thm.getScope() &lt; scopeLevel())</span>
<a name="l00568"></a>00568   <span class="comment">//  d_unreportedLits.insert(l.getExpr(),l,thm.getScope());</span>
<a name="l00569"></a>00569   
<a name="l00570"></a>00570 }
<a name="l00571"></a>00571 
<a name="l00572"></a>00572 <span class="preprocessor">#ifdef _CVC3_DEBUG_MODE</span>
<a name="l00573"></a>00573 <span class="preprocessor"></span><span class="keywordtype">void</span> SearchEngineFast::fullCheck()
<a name="l00574"></a>00574 {
<a name="l00575"></a>00575   <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0;
<a name="l00576"></a>00576        i &lt; <a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l00577"></a>00577        ++i) {
<a name="l00578"></a>00578     <span class="keywordflow">if</span> (!((<a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>)<a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>[i]).sat()) {
<a name="l00579"></a>00579       <span class="keywordtype">bool</span> sat = <span class="keyword">false</span>;
<a name="l00580"></a>00580       <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> &amp;theClause = <a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>[i];
<a name="l00581"></a>00581       <span class="keywordtype">unsigned</span> numLits = theClause.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>();
<a name="l00582"></a>00582       <span class="keywordtype">unsigned</span> numChoices = 0;
<a name="l00583"></a>00583       <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> j = 0; !sat &amp;&amp; j &lt; numLits; ++j) {
<a name="l00584"></a>00584         <span class="keywordflow">if</span> (theClause[j].<a class="code" href="group__SE.html#gadf867c70d67d05d72a11895a2cc13971">getValue</a>() == 0)
<a name="l00585"></a>00585           ++numChoices;
<a name="l00586"></a>00586         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (theClause[j].<a class="code" href="group__SE.html#gadf867c70d67d05d72a11895a2cc13971">getValue</a>() == 1)
<a name="l00587"></a>00587           sat = <span class="keyword">true</span>;
<a name="l00588"></a>00588       }
<a name="l00589"></a>00589       <span class="keywordflow">if</span> (sat) <span class="keywordflow">continue</span>;
<a name="l00590"></a>00590       <span class="keywordflow">if</span> (numChoices &lt;= 1 || !theClause.wpCheck()) {
<a name="l00591"></a>00591         CVC3::debugger.getOS() &lt;&lt; <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(theClause) &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga05b0ea7353ec24fa8e7e272d7a7875d8" title="Print the end-of-line.">endl</a>;
<a name="l00592"></a>00592         CVC3::debugger.getOS() &lt;&lt; theClause.<a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">toString</a>() &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga05b0ea7353ec24fa8e7e272d7a7875d8" title="Print the end-of-line.">endl</a>;
<a name="l00593"></a>00593       }
<a name="l00594"></a>00594       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(numChoices &gt; 1, <span class="stringliteral">&quot;BCP postcondition violated: unsat or unit clause(s)&quot;</span>);
<a name="l00595"></a>00595       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(theClause.wpCheck(), <span class="stringliteral">&quot;Watchpointers broken&quot;</span>);
<a name="l00596"></a>00596     }
<a name="l00597"></a>00597   }
<a name="l00598"></a>00598 
<a name="l00599"></a>00599   <span class="keywordflow">if</span> (!<a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;empty())
<a name="l00600"></a>00600   {
<a name="l00601"></a>00601     <span class="keywordflow">for</span> (std::deque&lt;ClauseOwner&gt;::reverse_iterator i = <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;rbegin();
<a name="l00602"></a>00602          i != <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;rend();
<a name="l00603"></a>00603          ++i) {
<a name="l00604"></a>00604       <span class="keywordflow">if</span> (!((<a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>)*i).sat()) {
<a name="l00605"></a>00605         <span class="keywordtype">bool</span> sat = <span class="keyword">false</span>;
<a name="l00606"></a>00606         <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> &amp;theClause = *i;
<a name="l00607"></a>00607         <span class="keywordtype">unsigned</span> numLits = theClause.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>();
<a name="l00608"></a>00608         <span class="keywordtype">unsigned</span> numChoices = 0;
<a name="l00609"></a>00609         <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> j = 0; !sat &amp;&amp; j &lt; numLits; ++j) {
<a name="l00610"></a>00610            <span class="keywordflow">if</span> (theClause[j].<a class="code" href="group__SE.html#gadf867c70d67d05d72a11895a2cc13971">getValue</a>() == 0)
<a name="l00611"></a>00611             ++numChoices; 
<a name="l00612"></a>00612            <span class="keywordflow">else</span> <span class="keywordflow">if</span> (theClause[j].<a class="code" href="group__SE.html#gadf867c70d67d05d72a11895a2cc13971">getValue</a>() == 1)
<a name="l00613"></a>00613              sat = <span class="keyword">true</span>;
<a name="l00614"></a>00614         }
<a name="l00615"></a>00615         <span class="keywordflow">if</span> (sat) <span class="keywordflow">continue</span>;
<a name="l00616"></a>00616         <span class="keywordflow">if</span> (numChoices &lt;= 1 || !theClause.wpCheck()) {
<a name="l00617"></a>00617           CVC3::debugger.getOS() &lt;&lt; <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(theClause) &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga05b0ea7353ec24fa8e7e272d7a7875d8" title="Print the end-of-line.">endl</a>;
<a name="l00618"></a>00618           CVC3::debugger.getOS() &lt;&lt; theClause.<a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">toString</a>() &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga05b0ea7353ec24fa8e7e272d7a7875d8" title="Print the end-of-line.">endl</a>;
<a name="l00619"></a>00619         }
<a name="l00620"></a>00620         
<a name="l00621"></a>00621         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(numChoices &gt; 1, <span class="stringliteral">&quot;BCP postcondition violated: unsat or unit conflict clause(s)&quot;</span>);
<a name="l00622"></a>00622         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(theClause.wpCheck(), <span class="stringliteral">&quot;Watchpointers broken&quot;</span>);
<a name="l00623"></a>00623       
<a name="l00624"></a>00624       }
<a name="l00625"></a>00625     }
<a name="l00626"></a>00626   } 
<a name="l00627"></a>00627 }
<a name="l00628"></a>00628 <span class="preprocessor">#endif</span>
<a name="l00629"></a>00629 <span class="preprocessor"></span>
<a name="l00630"></a>00630 
<a name="l00631"></a><a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be">00631</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be" title="Clear the list of asserted literals (d_literals)">SearchEngineFast::clearLiterals</a>() {
<a name="l00632"></a>00632   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;clearLiterals()&quot;</span>);
<a name="l00633"></a>00633   <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.clear();
<a name="l00634"></a>00634 }
<a name="l00635"></a>00635 
<a name="l00636"></a>00636 
<a name="l00637"></a><a class="code" href="group__SE__Fast.html#gac6d49471ba5c76fffc7581e01e423218">00637</a> <span class="keywordtype">bool</span> <a class="code" href="group__SE__Fast.html#gac6d49471ba5c76fffc7581e01e423218" title="Boolean constraint propagation.">SearchEngineFast::bcp</a>()
<a name="l00638"></a>00638 {
<a name="l00639"></a>00639   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;bcp@&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>())+<span class="stringliteral">&quot;(#lits=&quot;</span>,
<a name="l00640"></a>00640   <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.size(), <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l00641"></a>00641   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;literals=[\n&quot;</span>);
<a name="l00642"></a>00642      <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i=0,iend=<a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.size(); i&lt;iend; i++)
<a name="l00643"></a>00643      <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;          &quot;</span>, <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>[i], <span class="stringliteral">&quot;,&quot;</span>);
<a name="l00644"></a>00644      <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;]&quot;</span>);)
<a name="l00645"></a>00645   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;bcp(): start&quot;</span>);
<a name="l00646"></a>00646   <span class="keywordtype">bool</span> newInfo = <span class="keyword">true</span>;
<a name="l00647"></a>00647   <span class="comment">/*</span>
<a name="l00648"></a>00648 <span class="comment">  CDMap&lt;Expr,Theorem&gt;::iterator i = d_unreportedLits.begin(),</span>
<a name="l00649"></a>00649 <span class="comment">    iend = d_unreportedLits.end();</span>
<a name="l00650"></a>00650 <span class="comment">  for (; i != iend; ++i) {</span>
<a name="l00651"></a>00651 <span class="comment">    if (d_unreportedLitsHandled[(*i).first])</span>
<a name="l00652"></a>00652 <span class="comment">      continue;</span>
<a name="l00653"></a>00653 <span class="comment">    Theorem thm((*i).second);</span>
<a name="l00654"></a>00654 <span class="comment">    Literal l(newLiteral(thm.getExpr()));</span>
<a name="l00655"></a>00655 <span class="comment">    DebugAssert(l.getValue() != -1, &quot;Bad unreported literal: &quot;+l.toString());</span>
<a name="l00656"></a>00656 <span class="comment">    if(l.getValue() == 0) l.setValue(thm, scopeLevel());</span>
<a name="l00657"></a>00657 <span class="comment">    IF_DEBUG(debugger.counter(&quot;re-assert unreported lits&quot;)++;)</span>
<a name="l00658"></a>00658 <span class="comment">    DebugAssert(l.getExpr().isAbsLiteral(),</span>
<a name="l00659"></a>00659 <span class="comment">                &quot;bcp(): pushing non-literal to d_literals:\n &quot;</span>
<a name="l00660"></a>00660 <span class="comment">                +l.getExpr().toString());</span>
<a name="l00661"></a>00661 <span class="comment">    // The literal may be set to 1, but not on the list; push it here</span>
<a name="l00662"></a>00662 <span class="comment">    // explicitly</span>
<a name="l00663"></a>00663 <span class="comment">    d_literals.push_back(l);</span>
<a name="l00664"></a>00664 <span class="comment">    //recordFact((*i).second.getTheorem());</span>
<a name="l00665"></a>00665 <span class="comment">    enqueueFact(thm);</span>
<a name="l00666"></a>00666 <span class="comment">    d_unreportedLitsHandled[(*i).first] = true;</span>
<a name="l00667"></a>00667 <span class="comment">  }</span>
<a name="l00668"></a>00668 <span class="comment">  */</span>
<a name="l00669"></a>00669   <span class="keywordflow">while</span> (newInfo) {
<a name="l00670"></a>00670     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;BCP: while(newInfo)&quot;</span>)++;)
<a name="l00671"></a>00671     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;while(newInfo) {&quot;</span>);
<a name="l00672"></a>00672     newInfo = <span class="keyword">false</span>;
<a name="l00673"></a>00673     <span class="keywordflow">while</span>(!<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a289340e4457a79f1101f37c3a07a49ed" title="Check if the current context is inconsistent.">inconsistent</a>() &amp;&amp; <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.size() &gt; 0) {
<a name="l00674"></a>00674      <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> i=0; !<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a289340e4457a79f1101f37c3a07a49ed" title="Check if the current context is inconsistent.">inconsistent</a>() &amp;&amp; i&lt;<a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.size(); ++i) {
<a name="l00675"></a>00675       <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l = <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>[i];
<a name="l00676"></a>00676       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search props&quot;</span>, <span class="stringliteral">&quot;Propagating literal: [&quot;</span>, l.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>(), <span class="stringliteral">&quot;]&quot;</span>);
<a name="l00677"></a>00677       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 1, <span class="stringliteral">&quot;Bad literal is d_literals: &quot;</span>
<a name="l00678"></a>00678                   +l.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>());
<a name="l00679"></a>00679       <a class="code" href="group__SE__Fast.html#ga0214c0205e48fd792c4d01d3428cd333" title="Set of alive literals that shouldn&#39;t be garbage-collected.">d_litsAlive</a>.<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(l);
<a name="l00680"></a>00680       <span class="comment">// Use the watch pointers to find more literals to assert.  Repeat</span>
<a name="l00681"></a>00681       <span class="comment">// until conflict.  Once conflict found, call unsatClause() to</span>
<a name="l00682"></a>00682       <span class="comment">// assert the contradiction.</span>
<a name="l00683"></a>00683       std::vector&lt;std::pair&lt;Clause, int&gt; &gt;&amp; wps = <a class="code" href="group__SE__Fast.html#ga8f4353c8f8c65ed00806861471bd857f" title="Return a ref to the vector of watched literals. If no such vector exists, create it.">wp</a>(l);
<a name="l00684"></a>00684       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search props&quot;</span>, <span class="stringliteral">&quot;Appears in &quot;</span>, wps.size(), <span class="stringliteral">&quot; clauses.&quot;</span>);
<a name="l00685"></a>00685       <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> j=0; j&lt;wps.size(); ++j) {
<a name="l00686"></a>00686         <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>&amp; c = wps[j].first;
<a name="l00687"></a>00687         <span class="keywordtype">int</span> k = wps[j].second;
<a name="l00688"></a>00688         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(c.<a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">watched</a>(k).<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>() == (!l).getExpr(),
<a name="l00689"></a>00689                     <span class="stringliteral">&quot;Bad watched literal:\n l = &quot;</span>+l.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>()
<a name="l00690"></a>00690                     +<span class="stringliteral">&quot;\n c[k] = &quot;</span>+c.<a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">watched</a>(k).<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>());
<a name="l00691"></a>00691         <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1Clause.html#a420281d9272ac052c75859be690bfd4d">deleted</a>()) { <span class="comment">// Remove the clause from the list</span>
<a name="l00692"></a>00692           <span class="keywordflow">if</span>(wps.size() &gt; 1) {
<a name="l00693"></a>00693             wps[j] = wps.back();
<a name="l00694"></a>00694             --j;
<a name="l00695"></a>00695           }
<a name="l00696"></a>00696           wps.pop_back();
<a name="l00697"></a>00697         } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<span class="keyword">true</span> || !c.<a class="code" href="classCVC3_1_1Clause.html#a1e5660eadbc4e0c0ad18c6a9aae45d39" title="Check if the clause marked as SAT.">sat</a>()) {
<a name="l00698"></a>00698           <span class="comment">// Call BCP to update the watch pointer</span>
<a name="l00699"></a>00699           <span class="keywordtype">bool</span> wpUpdated;
<a name="l00700"></a>00700           <span class="keywordtype">bool</span> conflict = !<a class="code" href="group__SE__Fast.html#gad7548d572241f215212176af0216cb94" title="Auxiliary function for unit propagation.">propagate</a>(c, k, wpUpdated);
<a name="l00701"></a>00701           <span class="comment">// Delete the old watch pointer from the list</span>
<a name="l00702"></a>00702           <span class="keywordflow">if</span>(wpUpdated) {
<a name="l00703"></a>00703             <span class="keywordflow">if</span>(wps.size() &gt; 1) {
<a name="l00704"></a>00704               wps[j] = wps.back();
<a name="l00705"></a>00705               --j;
<a name="l00706"></a>00706             }
<a name="l00707"></a>00707             wps.pop_back();
<a name="l00708"></a>00708           }
<a name="l00709"></a>00709           <span class="keywordflow">if</span> (conflict) {
<a name="l00710"></a>00710       <a class="code" href="group__SE__Fast.html#gafa7937cc0b7d14c0aafb1f9c20abf011" title="Clear the local fact queue.">clearFacts</a>();
<a name="l00711"></a>00711       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;bcp(): conflict&quot;</span>);
<a name="l00712"></a>00712       <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;bcp[conflict] =&gt; false }}&quot;</span>);
<a name="l00713"></a>00713             <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00714"></a>00714     }
<a name="l00715"></a>00715         }
<a name="l00716"></a>00716       }
<a name="l00717"></a>00717 
<a name="l00718"></a>00718       vector&lt;Circuit*&gt;&amp; cps = <a class="code" href="group__SE__Fast.html#ga84bfa366c43221ba288e0a1bd716efc6">d_circuitsByExpr</a>[l.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>()];
<a name="l00719"></a>00719       <span class="keywordflow">for</span> (vector&lt;Circuit*&gt;::iterator it = cps.begin(), end = cps.end();
<a name="l00720"></a>00720            it &lt; end; it++)
<a name="l00721"></a>00721       {
<a name="l00722"></a>00722         <span class="keywordflow">if</span> (!(*it)-&gt;propagate(<span class="keyword">this</span>)) {
<a name="l00723"></a>00723     <a class="code" href="group__SE__Fast.html#gafa7937cc0b7d14c0aafb1f9c20abf011" title="Clear the local fact queue.">clearFacts</a>();
<a name="l00724"></a>00724     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;bcp(): conflict-2&quot;</span>);
<a name="l00725"></a>00725     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;bcp[circuit propagate] =&gt; false }}&quot;</span>);
<a name="l00726"></a>00726           <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00727"></a>00727   }
<a name="l00728"></a>00728       }
<a name="l00729"></a>00729      }
<a name="l00730"></a>00730      <span class="comment">// Finished with BCP* (without DPs).</span>
<a name="l00731"></a>00731      <a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be" title="Clear the list of asserted literals (d_literals)">clearLiterals</a>();
<a name="l00732"></a>00732      <span class="comment">// Now, propagate the facts to DPs and repeat ((BCP*); DP) step</span>
<a name="l00733"></a>00733      <span class="keywordflow">if</span>(!<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a289340e4457a79f1101f37c3a07a49ed" title="Check if the current context is inconsistent.">inconsistent</a>()) <a class="code" href="group__SE__Fast.html#ga6d190905fefb2a36650306e5b577dd9a" title="Commit all the enqueued facts to the DPs.">commitFacts</a>();
<a name="l00734"></a>00734     }
<a name="l00735"></a>00735     <span class="keywordflow">if</span> (<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a289340e4457a79f1101f37c3a07a49ed" title="Check if the current context is inconsistent.">inconsistent</a>()) {
<a name="l00736"></a>00736       <a class="code" href="group__SE__Fast.html#gae961b4fb4bb059a1d867447fc487aaee" title="Theorem(FALSE) which generated a conflict.">d_conflictTheorem</a> = <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a5c7d2aa7db5db78829b8558d28560ddf" title="Get the proof of inconsistency for the current context.">inconsistentThm</a>();
<a name="l00737"></a>00737       <a class="code" href="group__SE__Fast.html#gafa7937cc0b7d14c0aafb1f9c20abf011" title="Clear the local fact queue.">clearFacts</a>();
<a name="l00738"></a>00738       <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;bcp[DP conflict] =&gt; false }}&quot;</span>);
<a name="l00739"></a>00739       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00740"></a>00740     }
<a name="l00741"></a>00741     <span class="keywordflow">else</span>
<a name="l00742"></a>00742       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search basic&quot;</span>, <span class="stringliteral">&quot;Processed &quot;</span>, <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.size(), <span class="stringliteral">&quot; propagations&quot;</span>);
<a name="l00743"></a>00743     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(fullCheck();)
<a name="l00744"></a>00744     <a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be" title="Clear the list of asserted literals (d_literals)">clearLiterals</a>();
<a name="l00745"></a>00745 
<a name="l00746"></a>00746     <span class="keywordtype">bool</span> dfs_heuristic = (<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a46b2792a5c24f95ccfc3fbfc0456b09f">getFlags</a>()[<span class="stringliteral">&quot;de&quot;</span>].getString() == <span class="stringliteral">&quot;dfs&quot;</span>);
<a name="l00747"></a>00747     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search dfs&quot;</span>, <span class="stringliteral">&quot;DFS is &quot;</span>, (dfs_heuristic? <span class="stringliteral">&quot;on&quot;</span> : <span class="stringliteral">&quot;off&quot;</span>),
<a name="l00748"></a>00748     <span class="stringliteral">&quot; (de = &quot;</span>+<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a46b2792a5c24f95ccfc3fbfc0456b09f">getFlags</a>()[<span class="stringliteral">&quot;de&quot;</span>].getString()+<span class="stringliteral">&quot;) {&quot;</span>);
<a name="l00749"></a>00749     <span class="comment">// When DFS heuristic is used, simplify the nonliterals only until</span>
<a name="l00750"></a>00750     <span class="comment">// there is a completely simplified one on top of the stack, or</span>
<a name="l00751"></a>00751     <span class="comment">// all of the non-literals are gone.  Start from the end of the</span>
<a name="l00752"></a>00752     <span class="comment">// list (top of the stack), since that&#39;s where the splitter is</span>
<a name="l00753"></a>00753     <span class="comment">// most likely chosen.  This way we are likely to hit something</span>
<a name="l00754"></a>00754     <span class="comment">// that simplifies very soon.</span>
<a name="l00755"></a>00755 
<a name="l00756"></a>00756     <span class="keywordtype">size_t</span> origSize = <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l00757"></a>00757     <span class="keywordtype">bool</span> done(<span class="keyword">false</span>);
<a name="l00758"></a>00758     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=origSize-1; !done &amp;&amp; !<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a289340e4457a79f1101f37c3a07a49ed" title="Check if the current context is inconsistent.">inconsistent</a>() &amp;&amp; i&gt;=0; --i) {
<a name="l00759"></a>00759       <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; thm = <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>[i].get();
<a name="l00760"></a>00760       <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e = thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>();
<a name="l00761"></a>00761       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search dfs&quot;</span>, <span class="stringliteral">&quot;Simplifying non-literal&quot;</span>, e, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00762"></a>00762       <span class="keywordflow">if</span> (e.<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>()) {
<a name="l00763"></a>00763         <span class="comment">//      if (d_nonLiteralSimplified[thm.getExpr()]) {</span>
<a name="l00764"></a>00764   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;BCP: simplified non-literals: skipped [stale]&quot;</span>)++;)
<a name="l00765"></a>00765   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;}[continue]// end of while(newInfo)&quot;</span>);
<a name="l00766"></a>00766   <span class="keywordflow">continue</span>;
<a name="l00767"></a>00767       }
<a name="l00768"></a>00768       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;BCP: simplified non-literals&quot;</span>)++;)
<a name="l00769"></a>00769       <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> simpThm = <a class="code" href="group__SE.html#gaaa621df0c7e2a2043139e6451eab7072" title="Our version of simplifier: take Theorem(e), apply simplifier to get Theorem(e==e&#39;), return Theorem(e&#39;)">simplify</a>(thm);
<a name="l00770"></a>00770       <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> simp = simpThm.getExpr();
<a name="l00771"></a>00771       <span class="keywordflow">if</span>(simp != e) {
<a name="l00772"></a>00772   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;BCP: simplified non-literals: changed&quot;</span>)++;)
<a name="l00773"></a>00773         newInfo = <span class="keyword">true</span>;
<a name="l00774"></a>00774         <span class="comment">//        d_nonLiteralSimplified[thm.getExpr()] = true;</span>
<a name="l00775"></a>00775         <span class="keywordflow">if</span> (!simp.<a class="code" href="group__ExprPkg.html#ga6173f64b22cba76472cd0c814bbf6dae">isFalse</a>()) {
<a name="l00776"></a>00776           <span class="keywordflow">while</span> (simp.<a class="code" href="group__ExprPkg.html#ga1c922163af59ed6bc101728d65e04d16">isExists</a>()) {
<a name="l00777"></a>00777             simpThm = <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a015539886185195ba5d98c60cd7e8f66">skolemize</a>(simpThm);
<a name="l00778"></a>00778             simp = simpThm.getExpr();
<a name="l00779"></a>00779           }
<a name="l00780"></a>00780           <span class="keywordflow">if</span> (simp.<a class="code" href="group__ExprPkg.html#gaac535dae48f02fcd093a5b1b1a062211" title="Test if e is an abstract literal.">isAbsLiteral</a>()) {
<a name="l00781"></a>00781             <a class="code" href="group__SE__Fast.html#ga2c71aa94289db9ece678963617660640" title="Queue up a fact to assert to the DPs later.">enqueueFact</a>(simpThm);
<a name="l00782"></a>00782             <a class="code" href="group__SE__Fast.html#ga6d190905fefb2a36650306e5b577dd9a" title="Commit all the enqueued facts to the DPs.">commitFacts</a>();
<a name="l00783"></a>00783           }
<a name="l00784"></a>00784           <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>[i] = simpThm;
<a name="l00785"></a>00785     <span class="keywordflow">if</span>(dfs_heuristic) {
<a name="l00786"></a>00786       <span class="comment">// Something has changed, time to stop this loop.  If we</span>
<a name="l00787"></a>00787       <span class="comment">// also get a new non-literal on top of the stack, and no</span>
<a name="l00788"></a>00788       <span class="comment">// new literals, then stop the entire BCP (since that</span>
<a name="l00789"></a>00789       <span class="comment">// non-literal is guaranteed to be fully simplified).</span>
<a name="l00790"></a>00790       done = <span class="keyword">true</span>;
<a name="l00791"></a>00791       <span class="keywordflow">if</span>(<a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>() &gt; origSize &amp;&amp; <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.empty())
<a name="l00792"></a>00792         newInfo = <span class="keyword">false</span>;
<a name="l00793"></a>00793     }
<a name="l00794"></a>00794         } <span class="keywordflow">else</span>
<a name="l00795"></a>00795           <a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234" title="Set the context inconsistent. Takes Theorem(FALSE).">setInconsistent</a>(simpThm);
<a name="l00796"></a>00796       } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (dfs_heuristic) done = <span class="keyword">true</span>;
<a name="l00797"></a>00797     }
<a name="l00798"></a>00798     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search dfs&quot;</span>, <span class="stringliteral">&quot;End of non-literal simplification: newInfo = &quot;</span>,
<a name="l00799"></a>00799     (newInfo? <span class="stringliteral">&quot;true&quot;</span> : <span class="stringliteral">&quot;false&quot;</span>), <span class="stringliteral">&quot; }}&quot;</span>);
<a name="l00800"></a>00800     <span class="keywordflow">if</span> (<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a289340e4457a79f1101f37c3a07a49ed" title="Check if the current context is inconsistent.">inconsistent</a>()) {
<a name="l00801"></a>00801       <a class="code" href="group__SE__Fast.html#gae961b4fb4bb059a1d867447fc487aaee" title="Theorem(FALSE) which generated a conflict.">d_conflictTheorem</a> = <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a5c7d2aa7db5db78829b8558d28560ddf" title="Get the proof of inconsistency for the current context.">inconsistentThm</a>();
<a name="l00802"></a>00802       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;bcp(): inconsistent (nonLits)&quot;</span>);
<a name="l00803"></a>00803       <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;bcp[nonCNF conflict] =&gt; false }}&quot;</span>);
<a name="l00804"></a>00804       <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00805"></a>00805     }
<a name="l00806"></a>00806     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;}// end of while(newInfo)&quot;</span>);
<a name="l00807"></a>00807   }
<a name="l00808"></a>00808   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(fullCheck();)
<a name="l00809"></a>00809   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;bcp(): end&quot;</span>);
<a name="l00810"></a>00810   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search bcp&quot;</span>, <span class="stringliteral">&quot;bcp =&gt; true }&quot;</span>);
<a name="l00811"></a>00811   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00812"></a>00812 }
<a name="l00813"></a>00813 
<a name="l00814"></a>00814 
<a name="l00815"></a>00815 <span class="comment">// True if successfully propagated.  False if conflict.</span>
<a name="l00816"></a><a class="code" href="group__SE__Fast.html#gad7548d572241f215212176af0216cb94">00816</a> <span class="keywordtype">bool</span> <a class="code" href="group__SE__Fast.html#gad7548d572241f215212176af0216cb94" title="Auxiliary function for unit propagation.">SearchEngineFast::propagate</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> &amp;c, <span class="keywordtype">int</span> idx, <span class="keywordtype">bool</span>&amp; wpUpdated)
<a name="l00817"></a>00817 {
<a name="l00818"></a>00818   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search propagate&quot;</span>, <span class="stringliteral">&quot;propagate(&quot;</span>, <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c),
<a name="l00819"></a>00819   <span class="stringliteral">&quot;, idx = &quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(idx)+<span class="stringliteral">&quot;) {&quot;</span>);
<a name="l00820"></a>00820   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(idx==0 || idx==1, <span class="stringliteral">&quot;propagate(): bad index = &quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(idx));
<a name="l00821"></a>00821   <span class="comment">// The current watched literal must be set to FALSE, unless the</span>
<a name="l00822"></a>00822   <span class="comment">// clause is of size 1</span>
<a name="l00823"></a>00823   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>((c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>() == 1) ||  c.<a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">watched</a>(idx).<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() &lt; 0,
<a name="l00824"></a>00824         <span class="stringliteral">&quot;propagate(): this literal must be FALSE: c.watched(&quot;</span>
<a name="l00825"></a>00825         +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(idx)+<span class="stringliteral">&quot;)\n c = &quot;</span>+c.<a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">toString</a>());
<a name="l00826"></a>00826   wpUpdated = <span class="keyword">false</span>;
<a name="l00827"></a>00827   <span class="keywordtype">int</span> lit = c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(idx), otherLit = c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(1-idx);
<a name="l00828"></a>00828   <span class="keywordtype">int</span> dir = c.<a class="code" href="classCVC3_1_1Clause.html#a4c9a2e81c05572893ba1a3b09526d172">dir</a>(idx);
<a name="l00829"></a>00829   <span class="keywordtype">int</span> size = c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>();
<a name="l00830"></a>00830   <span class="keywordflow">while</span>(<span class="keyword">true</span>) {
<a name="l00831"></a>00831     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search propagate&quot;</span>, <span class="stringliteral">&quot;propagate: lit=&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(lit)
<a name="l00832"></a>00832         +<span class="stringliteral">&quot;, otherLit=&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(otherLit)+<span class="stringliteral">&quot;, dir=&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(dir));
<a name="l00833"></a>00833     lit += dir;
<a name="l00834"></a>00834     <span class="keywordflow">if</span>(lit &lt; 0 || lit &gt;= size) { <span class="comment">// hit the edge</span>
<a name="l00835"></a>00835       <span class="keywordflow">if</span>(dir == c.<a class="code" href="classCVC3_1_1Clause.html#a4c9a2e81c05572893ba1a3b09526d172">dir</a>(idx)) {
<a name="l00836"></a>00836   <span class="comment">// Finished first half of the clause, do the other half</span>
<a name="l00837"></a>00837   lit = c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(idx);
<a name="l00838"></a>00838   dir = -dir;
<a name="l00839"></a>00839   <span class="keywordflow">continue</span>;
<a name="l00840"></a>00840       }
<a name="l00841"></a>00841       <span class="comment">// All literals are false, except for the other watched literal.</span>
<a name="l00842"></a>00842       <span class="comment">// Check its value.</span>
<a name="l00843"></a>00843       <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(c[otherLit]);
<a name="l00844"></a>00844       <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() &lt; 0) { <span class="comment">// a conflict</span>
<a name="l00845"></a>00845   <span class="comment">//Literal ff(newLiteral(d_vcl-&gt;getEM()-&gt;falseExpr()));</span>
<a name="l00846"></a>00846   <span class="comment">//ff.setValue(1, c, -1);</span>
<a name="l00847"></a>00847         <span class="comment">//d_lastBCPConflict = ff;</span>
<a name="l00848"></a>00848         vector&lt;Theorem&gt; thms;
<a name="l00849"></a>00849         <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); ++i)
<a name="l00850"></a>00850           thms.push_back(c[i].<a class="code" href="classCVC3_1_1Clause.html#aa933cec7528780d7971be0c10b76dc02">getTheorem</a>());
<a name="l00851"></a>00851         <a class="code" href="group__SE__Fast.html#gae961b4fb4bb059a1d867447fc487aaee" title="Theorem(FALSE) which generated a conflict.">d_conflictTheorem</a> = <a class="code" href="group__SE.html#ga879b68112123e2b4ae7175d85a03bfec" title="Proof rules for the search engine.">d_rules</a>-&gt;<a class="code" href="group__SE__Rules.html#ga9c74425b4471d411f58f16781951c441" title="&quot;Conflict&quot; rule (all literals in a clause become FALSE) ">conflictRule</a>(thms,c.<a class="code" href="classCVC3_1_1Clause.html#aa933cec7528780d7971be0c10b76dc02">getTheorem</a>());
<a name="l00852"></a>00852   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search propagate&quot;</span>, <span class="stringliteral">&quot;propagate[&quot;</span>, <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c),
<a name="l00853"></a>00853         <span class="stringliteral">&quot;] =&gt; false }&quot;</span>);
<a name="l00854"></a>00854         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00855"></a>00855       }
<a name="l00856"></a>00856       <span class="keywordflow">else</span> <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 0) {
<a name="l00857"></a>00857         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>() &gt; 1 &amp;&amp; l.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>().<a class="code" href="group__ExprPkg.html#gaac535dae48f02fcd093a5b1b1a062211" title="Test if e is an abstract literal.">isAbsLiteral</a>(), <span class="stringliteral">&quot;BCP: Expr should be literal&quot;</span>);
<a name="l00858"></a>00858         <a class="code" href="group__SE__Fast.html#ga29e749a0ca7cbe86118a0d72e02e0696" title="Total number of unit propagations.">d_unitPropCount</a>++;
<a name="l00859"></a>00859         c.<a class="code" href="classCVC3_1_1Clause.html#ae266a9c156142d2f9f53ec741d7304df">markSat</a>();
<a name="l00860"></a>00860         <span class="comment">// Let&#39;s prove the new literal instead of playing assumption games</span>
<a name="l00861"></a>00861         <a class="code" href="group__SE__Fast.html#ga88d524fb175ae8156696cc73cb182ffd" title="Do the unit propagation for the clause.">unitPropagation</a>(c,otherLit);
<a name="l00862"></a>00862         <span class="comment">//l.setValue(1, c, otherLit);</span>
<a name="l00863"></a>00863         <span class="comment">//d_core-&gt;addFact(createAssumption(l));</span>
<a name="l00864"></a>00864   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search propagate&quot;</span>, <span class="stringliteral">&quot;propagate[&quot;</span>, <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c),
<a name="l00865"></a>00865         <span class="stringliteral">&quot;] =&gt; true }&quot;</span>);
<a name="l00866"></a>00866         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00867"></a>00867       }
<a name="l00868"></a>00868       <span class="keywordflow">else</span> {
<a name="l00869"></a>00869         c.<a class="code" href="classCVC3_1_1Clause.html#ae266a9c156142d2f9f53ec741d7304df">markSat</a>();
<a name="l00870"></a>00870   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search propagate&quot;</span>, <span class="stringliteral">&quot;propagate[&quot;</span>, <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c),
<a name="l00871"></a>00871         <span class="stringliteral">&quot;] =&gt; true }&quot;</span>);
<a name="l00872"></a>00872         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00873"></a>00873       }
<a name="l00874"></a>00874     }
<a name="l00875"></a>00875     <span class="comment">// If it&#39;s the other watched literal, skip it</span>
<a name="l00876"></a>00876     <span class="keywordflow">if</span>(lit == otherLit) <span class="keywordflow">continue</span>;
<a name="l00877"></a>00877 
<a name="l00878"></a>00878     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(c[lit]);
<a name="l00879"></a>00879     <span class="keywordtype">int</span> val(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>());
<a name="l00880"></a>00880     <span class="comment">// if it is false, keep looking</span>
<a name="l00881"></a>00881     <span class="keywordflow">if</span>(val &lt; 0) <span class="keywordflow">continue</span>;
<a name="l00882"></a>00882     <span class="comment">// OPTIMIZATION: if lit is TRUE, mark the clause SAT and give up.</span>
<a name="l00883"></a>00883     <span class="comment">// FIXME: this is different from Chaff.  Make sure it doesn&#39;t harm</span>
<a name="l00884"></a>00884     <span class="comment">// the performance.</span>
<a name="l00885"></a>00885      <span class="keywordflow">if</span>(val &gt; 0) {
<a name="l00886"></a>00886        c.<a class="code" href="classCVC3_1_1Clause.html#ae266a9c156142d2f9f53ec741d7304df">markSat</a>();
<a name="l00887"></a>00887 <span class="comment">//       return true;</span>
<a name="l00888"></a>00888      }
<a name="l00889"></a>00889 
<a name="l00890"></a>00890     <span class="comment">// Now the value of &#39;lit&#39; is unknown.  Set the watch pointer to</span>
<a name="l00891"></a>00891     <span class="comment">// this literal, if it is indeed a literal (it may be any formula</span>
<a name="l00892"></a>00892     <span class="comment">// in a pseudo-clause), and update the direction.</span>
<a name="l00893"></a>00893     c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(idx, lit);
<a name="l00894"></a>00894     c.<a class="code" href="classCVC3_1_1Clause.html#a4c9a2e81c05572893ba1a3b09526d172">dir</a>(idx, dir);
<a name="l00895"></a>00895     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(c.<a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">watched</a>(idx).<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() &gt;= 0,
<a name="l00896"></a>00896     <span class="stringliteral">&quot;Bad watched literals in clause:\n&quot;</span>
<a name="l00897"></a>00897     +<a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c).<a class="code" href="classCVC3_1_1CompactClause.html#abb55c9dc63b8ac52030738cbacea0141">toString</a>());
<a name="l00898"></a>00898     <span class="comment">// Get the expression of the literal&#39;s inverse</span>
<a name="l00899"></a>00899     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> inv(!c[lit]);
<a name="l00900"></a>00900     <span class="comment">// If it is indeed a literal, update the watch pointers</span>
<a name="l00901"></a>00901     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(inv.getExpr().isAbsLiteral(), <span class="stringliteral">&quot;Expr should be literal: inv = &quot;</span>
<a name="l00902"></a>00902     +inv.getExpr().toString());
<a name="l00903"></a>00903     <span class="comment">// Add the new watched literal to the watch pointer list</span>
<a name="l00904"></a>00904     pair&lt;Clause, int&gt; p(c, idx);
<a name="l00905"></a>00905     <a class="code" href="group__SE__Fast.html#ga8f4353c8f8c65ed00806861471bd857f" title="Return a ref to the vector of watched literals. If no such vector exists, create it.">wp</a>(inv).push_back(p);
<a name="l00906"></a>00906 
<a name="l00907"></a>00907     <span class="comment">// Signal to remove the old watch pointer</span>
<a name="l00908"></a>00908     wpUpdated = <span class="keyword">true</span>;
<a name="l00909"></a>00909     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search propagate&quot;</span>, <span class="stringliteral">&quot;propagate[&quot;</span>, <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c),
<a name="l00910"></a>00910     <span class="stringliteral">&quot;] =&gt; true }&quot;</span>);
<a name="l00911"></a>00911     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00912"></a>00912   }
<a name="l00913"></a>00913 }
<a name="l00914"></a>00914 
<a name="l00915"></a><a class="code" href="group__SE__Fast.html#ga88d524fb175ae8156696cc73cb182ffd">00915</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga88d524fb175ae8156696cc73cb182ffd" title="Do the unit propagation for the clause.">SearchEngineFast::unitPropagation</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> &amp;c, <span class="keywordtype">unsigned</span> idx)
<a name="l00916"></a>00916 {  
<a name="l00917"></a>00917   vector&lt;Theorem&gt; thms;
<a name="l00918"></a>00918   <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); ++i)
<a name="l00919"></a>00919     <span class="keywordflow">if</span> (i != idx) {
<a name="l00920"></a>00920       thms.push_back(c[i].getTheorem());
<a name="l00921"></a>00921       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!thms.back().isNull(),
<a name="l00922"></a>00922       <span class="stringliteral">&quot;unitPropagation(idx = &quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(idx)+<span class="stringliteral">&quot;, i = &quot;</span>
<a name="l00923"></a>00923       +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(i)+<span class="stringliteral">&quot;,\n&quot;</span>+c.<a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">toString</a>()+<span class="stringliteral">&quot;)&quot;</span>);
<a name="l00924"></a>00924     }
<a name="l00925"></a>00925   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm(<a class="code" href="group__SE.html#ga879b68112123e2b4ae7175d85a03bfec" title="Proof rules for the search engine.">d_rules</a>-&gt;<a class="code" href="group__SE__Rules.html#gae7221bb8b77313a9b53a4beca9cc0aa0" title="Unit propagation rule: .">unitProp</a>(thms,c.<a class="code" href="classCVC3_1_1Clause.html#aa933cec7528780d7971be0c10b76dc02">getTheorem</a>(),idx));
<a name="l00926"></a>00926   <a class="code" href="group__SE__Fast.html#ga2c71aa94289db9ece678963617660640" title="Queue up a fact to assert to the DPs later.">enqueueFact</a>(thm); <span class="comment">// d_core-&gt;addFact(thm);</span>
<a name="l00927"></a>00927   <span class="comment">// recordFact(thm);</span>
<a name="l00928"></a>00928 
<a name="l00929"></a>00929   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#aed1590a02166f6099e5538dbf681a60c" title="Check if the theorem is a literal.">isAbsLiteral</a>(),
<a name="l00930"></a>00930         <span class="stringliteral">&quot;unitPropagation(): pushing non-literal to d_literals:\n &quot;</span>
<a name="l00931"></a>00931         +thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>());
<a name="l00932"></a>00932   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>()));
<a name="l00933"></a>00933   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(l.getValue() == 1, <span class="stringliteral">&quot;unitPropagation: bad literal: &quot;</span>
<a name="l00934"></a>00934         +l.toString());
<a name="l00935"></a>00935   <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.push_back(l);
<a name="l00936"></a>00936 }
<a name="l00937"></a>00937 
<a name="l00938"></a>00938 
<a name="l00939"></a><a class="code" href="group__SE__Fast.html#ga4490cc372993398612e7556e14222ff3">00939</a> <span class="keywordtype">bool</span> <a class="code" href="group__SE__Fast.html#ga4490cc372993398612e7556e14222ff3" title="Determines backtracking level and adds conflict clauses.">SearchEngineFast::fixConflict</a>()
<a name="l00940"></a>00940 {
<a name="l00941"></a>00941   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search basic&quot;</span>, <span class="stringliteral">&quot;FixConflict&quot;</span>);
<a name="l00942"></a>00942   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> res, conf;
<a name="l00943"></a>00943   <a class="code" href="group__SE__Fast.html#gaecd7cc2115fe235653a62acf93ccb1e5" title="Total number of conflicts.">d_conflictCount</a>++;
<a name="l00944"></a>00944   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;conflicts&quot;</span>, <span class="stringliteral">&quot;found conflict # &quot;</span>, <a class="code" href="group__SE__Fast.html#gaecd7cc2115fe235653a62acf93ccb1e5" title="Total number of conflicts.">d_conflictCount</a>, <span class="stringliteral">&quot;&quot;</span>);
<a name="l00945"></a>00945   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(debugger.trace(<span class="stringliteral">&quot;impl graph verbose&quot;</span>)) {
<a name="l00946"></a>00946     <a class="code" href="group__SE__Fast.html#gae961b4fb4bb059a1d867447fc487aaee" title="Theorem(FALSE) which generated a conflict.">d_conflictTheorem</a>.<a class="code" href="classCVC3_1_1Theorem.html#ad9da69b34ab2bab4192e5977e5c10498">printDebug</a>();
<a name="l00947"></a>00947   })
<a name="l00948"></a>00948 
<a name="l00949"></a>00949   <span class="keywordflow">if</span> (<a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</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="l00950"></a>00950     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00951"></a>00951   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="group__SE__Fast.html#gae961b4fb4bb059a1d867447fc487aaee" title="Theorem(FALSE) which generated a conflict.">d_conflictTheorem</a>.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>() &lt;= <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="l00952"></a>00952     <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>-&gt;<a class="code" href="group__DE.html#ga90d2e881c4cc004754708ee579682d85" title="Pop to given scope.">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="l00953"></a>00953     <a class="code" href="group__SE__Fast.html#gad80c2b69b88a04c8c78309859abd3f76" title="Position of a literal with max score in d_litsByScores.">d_litsMaxScorePos</a> = 0; <span class="comment">// from decision engine</span>
<a name="l00954"></a>00954     <a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be" title="Clear the list of asserted literals (d_literals)">clearLiterals</a>();
<a name="l00955"></a>00955     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00956"></a>00956   }
<a name="l00957"></a>00957 
<a name="l00958"></a>00958   <a class="code" href="group__SE__Fast.html#gab3f2a42375c5b3875ad18acd47ee124d" title="First pass in conflict analysis; takes a theorem of FALSE.">traceConflict</a>(<a class="code" href="group__SE__Fast.html#gae961b4fb4bb059a1d867447fc487aaee" title="Theorem(FALSE) which generated a conflict.">d_conflictTheorem</a>);
<a name="l00959"></a>00959   
<a name="l00960"></a>00960   <span class="keywordflow">if</span> (<a class="code" href="group__SE__Fast.html#gab27227ee9e005ab22a9e2a251bc7c6d1" title="The scope of the last conflict.">d_lastConflictScope</a> &lt;= <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="l00961"></a>00961     <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00962"></a>00962 
<a name="l00963"></a>00963   <span class="comment">// If we have unit conflict clauses, then we have to bounce back to</span>
<a name="l00964"></a>00964   <span class="comment">// the original scope and assert them.</span>
<a name="l00965"></a>00965   <span class="keywordflow">if</span>(<a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.size() &gt; 0) {
<a name="l00966"></a>00966     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search basic&quot;</span>, <span class="stringliteral">&quot;Found unit conflict clause&quot;</span>);
<a name="l00967"></a>00967     <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>-&gt;<a class="code" href="group__DE.html#ga90d2e881c4cc004754708ee579682d85" title="Pop to given scope.">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="l00968"></a>00968     <a class="code" href="group__SE__Fast.html#gad80c2b69b88a04c8c78309859abd3f76" title="Position of a literal with max score in d_litsByScores.">d_litsMaxScorePos</a> = 0; <span class="comment">// from decision engine</span>
<a name="l00969"></a>00969     <a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be" title="Clear the list of asserted literals (d_literals)">clearLiterals</a>();
<a name="l00970"></a>00970     <span class="keywordflow">for</span> (vector&lt;Clause&gt;::reverse_iterator i = <a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.rbegin();
<a name="l00971"></a>00971          i != <a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.rend();
<a name="l00972"></a>00972          ++i) {
<a name="l00973"></a>00973       <span class="comment">//IF_DEBUG(checkAssumpDebug(i-&gt;getTheorem(), d_assumptions);)</span>
<a name="l00974"></a>00974       <span class="comment">// The theorem of *i is, most likely, (OR lit); rewrite it to just `lit&#39;</span>
<a name="l00975"></a>00975       <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm = i-&gt;<a class="code" href="classCVC3_1_1Clause.html#aa933cec7528780d7971be0c10b76dc02">getTheorem</a>();
<a name="l00976"></a>00976       <span class="keywordflow">if</span>(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#ga36f1eff876808586db368dc1b6da5f56">isOr</a>())
<a name="l00977"></a>00977   thm = <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#aebbcd4a194e4fdca0bcd16143fb03a75">iffMP</a>(thm, <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#aa3cfb7d47a6d6bc84c85c7fa6a3e1242" title="==&gt; OR(e1,...,en) IFF [simplified expr]">rewriteOr</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>()));
<a name="l00978"></a>00978       <a class="code" href="group__SE__Fast.html#ga2c71aa94289db9ece678963617660640" title="Queue up a fact to assert to the DPs later.">enqueueFact</a>(thm);
<a name="l00979"></a>00979       <a class="code" href="group__SE__Fast.html#ga6d190905fefb2a36650306e5b577dd9a" title="Commit all the enqueued facts to the DPs.">commitFacts</a>(); <span class="comment">// Make sure facts propagate to DPs</span>
<a name="l00980"></a>00980     }
<a name="l00981"></a>00981     <a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.clear();
<a name="l00982"></a>00982     <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// Let bcp take care of the rest.</span>
<a name="l00983"></a>00983   }
<a name="l00984"></a>00984 
<a name="l00985"></a>00985   <span class="comment">// Otherwise, we need to make our failure driven assertion.</span>
<a name="l00986"></a>00986   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!<a class="code" href="group__SE__Fast.html#ga46e91bb5d782794c6dca6abaa99dc4f9" title="The last conflict clause (for checkSAT()). May be Null.">d_lastConflictClause</a>.<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l00987"></a>00987 
<a name="l00988"></a>00988   <span class="comment">// We need to calculate the backtracking level.  We do this by</span>
<a name="l00989"></a>00989   <span class="comment">// examining the decision levels of all the literals involved in the</span>
<a name="l00990"></a>00990   <span class="comment">// last conflict clause.</span>
<a name="l00991"></a>00991 
<a name="l00992"></a>00992   <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> &amp;c = <a class="code" href="group__SE__Fast.html#ga46e91bb5d782794c6dca6abaa99dc4f9" title="The last conflict clause (for checkSAT()). May be Null.">d_lastConflictClause</a>;
<a name="l00993"></a>00993   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> unit_lit;
<a name="l00994"></a>00994   <span class="keywordtype">unsigned</span> idx=0;
<a name="l00995"></a>00995   <span class="keywordtype">unsigned</span> current_dl = <a class="code" href="group__SE__Fast.html#gab27227ee9e005ab22a9e2a251bc7c6d1" title="The scope of the last conflict.">d_lastConflictScope</a>;
<a name="l00996"></a>00996   <span class="keywordtype">unsigned</span> back_dl = <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="l00997"></a>00997   <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); ++i) {
<a name="l00998"></a>00998     <span class="keywordtype">unsigned</span> dl = c[i].getVar().getScope();
<a name="l00999"></a>00999     <span class="keywordflow">if</span> (dl &lt; current_dl) {
<a name="l01000"></a>01000       <span class="keywordflow">if</span> (dl &gt; back_dl)
<a name="l01001"></a>01001         back_dl = dl;
<a name="l01002"></a>01002     }
<a name="l01003"></a>01003     <span class="keywordflow">else</span> {
<a name="l01004"></a>01004       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(unit_lit.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>().<a class="code" href="group__ExprPkg.html#ga0265d1ca42fa59c95aaff3ca675b6504">isNull</a>(),
<a name="l01005"></a>01005       <span class="stringliteral">&quot;Only one lit from the current decision level is allowed.\n&quot;</span>
<a name="l01006"></a>01006       <span class="stringliteral">&quot;current_dl=&quot;</span>
<a name="l01007"></a>01007       +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(current_dl)+<span class="stringliteral">&quot;, scopeLevel=&quot;</span>
<a name="l01008"></a>01008       +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>())
<a name="l01009"></a>01009       +<span class="stringliteral">&quot;\n l1 = &quot;</span>
<a name="l01010"></a>01010       +unit_lit.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>()
<a name="l01011"></a>01011       +<span class="stringliteral">&quot;\n l2 = &quot;</span>+c[i].toString()
<a name="l01012"></a>01012       +<span class="stringliteral">&quot;\nConflict clause: &quot;</span>+c.toString());
<a name="l01013"></a>01013       unit_lit = c[i];
<a name="l01014"></a>01014       idx = i;
<a name="l01015"></a>01015     }
<a name="l01016"></a>01016   }
<a name="l01017"></a>01017 
<a name="l01018"></a>01018 
<a name="l01019"></a>01019   <span class="comment">// Now we have the backtracking decision level.</span>
<a name="l01020"></a>01020   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!unit_lit.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>().<a class="code" href="group__ExprPkg.html#ga0265d1ca42fa59c95aaff3ca675b6504">isNull</a>(),<span class="stringliteral">&quot;Need to have an FDA in &quot;</span>
<a name="l01021"></a>01021         <span class="stringliteral">&quot;conflict clause: &quot;</span>+c.toString());
<a name="l01022"></a>01022   <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>-&gt;<a class="code" href="group__DE.html#ga90d2e881c4cc004754708ee579682d85" title="Pop to given scope.">popTo</a>(back_dl);
<a name="l01023"></a>01023   <a class="code" href="group__SE__Fast.html#gad80c2b69b88a04c8c78309859abd3f76" title="Position of a literal with max score in d_litsByScores.">d_litsMaxScorePos</a> = 0; <span class="comment">// from decision engine</span>
<a name="l01024"></a>01024   <a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be" title="Clear the list of asserted literals (d_literals)">clearLiterals</a>();
<a name="l01025"></a>01025   <a class="code" href="group__SE__Fast.html#ga88d524fb175ae8156696cc73cb182ffd" title="Do the unit propagation for the clause.">unitPropagation</a>(c,idx);
<a name="l01026"></a>01026   <a class="code" href="group__SE__Fast.html#ga6d190905fefb2a36650306e5b577dd9a" title="Commit all the enqueued facts to the DPs.">commitFacts</a>(); <span class="comment">// Make sure facts propagate to DPs</span>
<a name="l01027"></a>01027   <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l01028"></a>01028 }
<a name="l01029"></a>01029 
<a name="l01030"></a>01030 
<a name="l01031"></a><a class="code" href="group__SE__Fast.html#ga2c71aa94289db9ece678963617660640">01031</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga2c71aa94289db9ece678963617660640" title="Queue up a fact to assert to the DPs later.">SearchEngineFast::enqueueFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; thm) {
<a name="l01032"></a>01032   <span class="comment">//  d_core-&gt;addFact(thm);</span>
<a name="l01033"></a>01033   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search props&quot;</span>, <span class="stringliteral">&quot;SearchEngineFast::enqueueFact(&quot;</span>,
<a name="l01034"></a>01034   thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l01035"></a>01035   <span class="keywordflow">if</span>(thm.<a class="code" href="classCVC3_1_1Theorem.html#aed1590a02166f6099e5538dbf681a60c" title="Check if the theorem is a literal.">isAbsLiteral</a>()) {
<a name="l01036"></a>01036     <a class="code" href="group__SE__Fast.html#gaef3113afb8dc9ea1b06217ab77f5d713" title="Notify the search engine about a new literal fact.">addLiteralFact</a>(thm);
<a name="l01037"></a>01037   }
<a name="l01038"></a>01038   <a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.push_back(thm);
<a name="l01039"></a>01039   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search props&quot;</span>, <span class="stringliteral">&quot;SearchEngineFast::enqueueFact =&gt; }&quot;</span>);
<a name="l01040"></a>01040 }
<a name="l01041"></a>01041 
<a name="l01042"></a>01042 
<a name="l01043"></a><a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234">01043</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234" title="Set the context inconsistent. Takes Theorem(FALSE).">SearchEngineFast::setInconsistent</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; thm) {
<a name="l01044"></a>01044   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search props&quot;</span>, <span class="stringliteral">&quot;SearchEngineFast::setInconsistent()&quot;</span>);
<a name="l01045"></a>01045   <a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.clear();
<a name="l01046"></a>01046   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;conflicts from SAT solver&quot;</span>)++;)
<a name="l01047"></a>01047   <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a4a87431f344c128dc58d5c2bd9206784">setInconsistent</a>(thm);
<a name="l01048"></a>01048 }
<a name="l01049"></a>01049 
<a name="l01050"></a><a class="code" href="group__SE__Fast.html#ga6d190905fefb2a36650306e5b577dd9a">01050</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga6d190905fefb2a36650306e5b577dd9a" title="Commit all the enqueued facts to the DPs.">SearchEngineFast::commitFacts</a>() {
<a name="l01051"></a>01051   <span class="keywordflow">for</span>(vector&lt;Theorem&gt;::iterator i=<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.begin(), iend=<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.end();
<a name="l01052"></a>01052       i!=iend; ++i) {
<a name="l01053"></a>01053     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search props&quot;</span>, <span class="stringliteral">&quot;commitFacts(&quot;</span>, i-&gt;getExpr(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01054"></a>01054     <span class="keywordflow">if</span>(<a class="code" href="group__SE__Fast.html#gaa1ea8707c10a13a631402860eff87026" title="When true, use TheoryCore::enqueueFact() instead of addFact() in commitFacts()">d_useEnqueueFact</a>)
<a name="l01055"></a>01055       <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a479141bc26a125b758a2acc6420274f9" title="Enqueue a new fact.">enqueueFact</a>(*i);
<a name="l01056"></a>01056     <span class="keywordflow">else</span>
<a name="l01057"></a>01057       <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<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>(*i);
<a name="l01058"></a>01058   }
<a name="l01059"></a>01059   <a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.clear();
<a name="l01060"></a>01060 }
<a name="l01061"></a>01061 
<a name="l01062"></a>01062 
<a name="l01063"></a><a class="code" href="group__SE__Fast.html#gafa7937cc0b7d14c0aafb1f9c20abf011">01063</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#gafa7937cc0b7d14c0aafb1f9c20abf011" title="Clear the local fact queue.">SearchEngineFast::clearFacts</a>() {
<a name="l01064"></a>01064   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search props&quot;</span>, <span class="stringliteral">&quot;clearFacts()&quot;</span>);
<a name="l01065"></a>01065   <a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.clear();
<a name="l01066"></a>01066 }
<a name="l01067"></a>01067 
<a name="l01068"></a>01068 
<a name="l01069"></a><a class="code" href="group__SE__Fast.html#ga6e64b8f0a42bd4b42d22b50b351219c9">01069</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga6e64b8f0a42bd4b42d22b50b351219c9" title="Go through all the clauses and check the watch pointers (for debugging)">SearchEngineFast::addNewClause</a>(<a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> &amp;c)
<a name="l01070"></a>01070 {
<a name="l01071"></a>01071   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>() &gt; 1, <span class="stringliteral">&quot;New clauses should have size &gt; 1&quot;</span>);
<a name="l01072"></a>01072   <a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>.<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(c);
<a name="l01073"></a>01073   <a class="code" href="group__SE__Fast.html#ga775b06e155128cc8817f254bc293c6c6" title="Add the literals of a new clause to d_litsByScores.">updateLitCounts</a>(c);
<a name="l01074"></a>01074   <span class="comment">// Set up the watch pointers to this clause: find two unassigned</span>
<a name="l01075"></a>01075   <span class="comment">// literals (otherwise we shouldn&#39;t even receive it as a clause)</span>
<a name="l01076"></a>01076   <span class="keywordtype">size_t</span> i=0, iend=c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>();
<a name="l01077"></a>01077   <span class="keywordflow">for</span>(; i&lt;iend &amp;&amp; c[i].getValue() != 0; ++i);
<a name="l01078"></a>01078   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i&lt;iend, <span class="stringliteral">&quot;SearchEngineFast::addNewClause:\n&quot;</span>
<a name="l01079"></a>01079         <span class="stringliteral">&quot;no unassigned literals in the clause:\nc = &quot;</span>
<a name="l01080"></a>01080         +<a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c).toString());
<a name="l01081"></a>01081   c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(0,i); ++i;
<a name="l01082"></a>01082   <span class="keywordflow">for</span>(; i&lt;iend &amp;&amp; c[i].getValue() != 0; ++i);
<a name="l01083"></a>01083   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(i&lt;iend, <span class="stringliteral">&quot;SearchEngineFast::addNewClause:\n&quot;</span>
<a name="l01084"></a>01084         <span class="stringliteral">&quot;Only one unassigned literal in the clause:\nc = &quot;</span>
<a name="l01085"></a>01085         +<a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c).toString());
<a name="l01086"></a>01086   c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(1,i);
<a name="l01087"></a>01087   <span class="comment">// Add the watched pointers to the appropriate lists</span>
<a name="l01088"></a>01088   <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i&lt;=1; i++) {
<a name="l01089"></a>01089     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(!c.<a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">watched</a>(i));
<a name="l01090"></a>01090     <span class="comment">// Add the pointer to l&#39;s list</span>
<a name="l01091"></a>01091     pair&lt;Clause, int&gt; p(c, i);
<a name="l01092"></a>01092     <a class="code" href="group__SE__Fast.html#ga8f4353c8f8c65ed00806861471bd857f" title="Return a ref to the vector of watched literals. If no such vector exists, create it.">wp</a>(l).push_back(p);
<a name="l01093"></a>01093   }
<a name="l01094"></a>01094 }
<a name="l01095"></a>01095 
<a name="l01096"></a><a class="code" href="search__fast_8cpp.html#a262e92a64449205cbd952a704be68952">01096</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="search__fast_8cpp.html#a262e92a64449205cbd952a704be68952">TheoremEq</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; t1, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; t2) {
<a name="l01097"></a>01097   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!t1.<a class="code" href="classCVC3_1_1Theorem.html#afc6fdb0507eb3669e28d9be5ed0bd333">isNull</a>() &amp;&amp; !t2.<a class="code" href="classCVC3_1_1Theorem.html#afc6fdb0507eb3669e28d9be5ed0bd333">isNull</a>(),
<a name="l01098"></a>01098         <span class="stringliteral">&quot;analyzeUIPs() Null Theorem found&quot;</span>);
<a name="l01099"></a>01099    <span class="keywordflow">return</span> t1.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>() == t2.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>();
<a name="l01100"></a>01100 }
<a name="l01101"></a>01101 
<a name="l01102"></a>01102 <span class="comment"></span>
<a name="l01103"></a>01103 <span class="comment">//! Auxiliary function used in analyzeUIPs()</span>
<a name="l01104"></a>01104 <span class="comment"></span><span class="comment">/*! It processes a node and populates the relevant sets used in the</span>
<a name="l01105"></a>01105 <span class="comment"> * algorithm.</span>
<a name="l01106"></a>01106 <span class="comment"> * \sa analyzeUIPs() for more detail). </span>
<a name="l01107"></a>01107 <span class="comment"> */</span>
<a name="l01108"></a><a class="code" href="search__fast_8cpp.html#a0ffbe582e8cf359e6b82a5bfc8c028ed">01108</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="search__fast_8cpp.html#a0ffbe582e8cf359e6b82a5bfc8c028ed" title="Auxiliary function used in analyzeUIPs()">processNode</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; thm, 
<a name="l01109"></a>01109       vector&lt;Theorem&gt;&amp; lits,
<a name="l01110"></a>01110       vector&lt;Theorem&gt;&amp; gamma,
<a name="l01111"></a>01111       vector&lt;Theorem&gt;&amp; fringe,
<a name="l01112"></a>01112       <span class="keywordtype">int</span>&amp; pending) {
<a name="l01113"></a>01113   <span class="comment">// Decrease the fan-out count</span>
<a name="l01114"></a>01114   <span class="keywordtype">int</span> fanOutCount(thm.<a class="code" href="classCVC3_1_1Theorem.html#a0062fd610006e5bc0b4093ae72943342" title="Check if the flag attribute is set.">getCachedValue</a>() - 1);
<a name="l01115"></a>01115   thm.<a class="code" href="classCVC3_1_1Theorem.html#a293ebbc3162763fbbeaa9fbd8ea1c657" title="Check if the flag attribute is set.">setCachedValue</a>(fanOutCount);
<a name="l01116"></a>01116   <span class="keywordtype">bool</span> wasFlagged(thm.<a class="code" href="classCVC3_1_1Theorem.html#a1695c9afc9a5c1f8cd000d40b9e2a9cd" title="Check if the flag attribute is set.">isFlagged</a>());
<a name="l01117"></a>01117   thm.<a class="code" href="classCVC3_1_1Theorem.html#af83d6b4d71bfb558296a1c296a69c3d7" title="Set the flag attribute.">setFlag</a>();
<a name="l01118"></a>01118   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(fanOutCount &gt;= 0, 
<a name="l01119"></a>01119         <span class="stringliteral">&quot;analyzeUIPs(): node visited too many times: &quot;</span>
<a name="l01120"></a>01120         +thm.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>());
<a name="l01121"></a>01121   <span class="keywordflow">if</span>(fanOutCount == 0) {
<a name="l01122"></a>01122     <span class="keywordflow">if</span>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a2eefa550b2e04a012adc03ba456af38b" title="Check the &quot;expand&quot; attribute.">getExpandFlag</a>()) {
<a name="l01123"></a>01123       <span class="keywordflow">if</span>(wasFlagged) {
<a name="l01124"></a>01124   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;pending.erase(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01125"></a>01125   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(pending &gt; 0, 
<a name="l01126"></a>01126         <span class="stringliteral">&quot;analyzeUIPs(): pending set shouldn&#39;t be empty here&quot;</span>);
<a name="l01127"></a>01127   pending--;
<a name="l01128"></a>01128       }
<a name="l01129"></a>01129       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;fringe.insert(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01130"></a>01130       fringe.push_back(thm);
<a name="l01131"></a>01131     } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a8442e9bc88086d84648ccea5b373cdb0" title="Check the &quot;literal&quot; attribute.">getLitFlag</a>()) {
<a name="l01132"></a>01132       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#aed1590a02166f6099e5538dbf681a60c" title="Check if the theorem is a literal.">isAbsLiteral</a>(), <span class="stringliteral">&quot;analyzeUIPs(): bad flag on &quot;</span>
<a name="l01133"></a>01133       +thm.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>());
<a name="l01134"></a>01134       <span class="keywordflow">if</span>(wasFlagged) {
<a name="l01135"></a>01135   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;pending.erase(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01136"></a>01136   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(pending &gt; 0, 
<a name="l01137"></a>01137         <span class="stringliteral">&quot;analyzeUIPs(): pending set shouldn&#39;t be empty here&quot;</span>);
<a name="l01138"></a>01138   pending--;
<a name="l01139"></a>01139       }
<a name="l01140"></a>01140       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;lits.insert(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01141"></a>01141       lits.push_back(thm);
<a name="l01142"></a>01142     } <span class="keywordflow">else</span> {
<a name="l01143"></a>01143       <span class="keywordflow">if</span>(!wasFlagged) {
<a name="l01144"></a>01144   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;gamma.insert(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01145"></a>01145   gamma.push_back(thm);
<a name="l01146"></a>01146       } <span class="keywordflow">else</span> {
<a name="l01147"></a>01147   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;already in gamma: &quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01148"></a>01148       }
<a name="l01149"></a>01149     }
<a name="l01150"></a>01150   } <span class="keywordflow">else</span> { <span class="comment">// Fan-out count is non-zero</span>
<a name="l01151"></a>01151     <span class="keywordflow">if</span>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a2eefa550b2e04a012adc03ba456af38b" title="Check the &quot;expand&quot; attribute.">getExpandFlag</a>()) {
<a name="l01152"></a>01152       <span class="comment">// Too early to expand; stash in pending</span>
<a name="l01153"></a>01153       <span class="keywordflow">if</span>(!wasFlagged) {
<a name="l01154"></a>01154   pending++;
<a name="l01155"></a>01155   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;pending.insert(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01156"></a>01156       } <span class="keywordflow">else</span> {
<a name="l01157"></a>01157   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;already in pending: &quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01158"></a>01158       }
<a name="l01159"></a>01159     } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a8442e9bc88086d84648ccea5b373cdb0" title="Check the &quot;literal&quot; attribute.">getLitFlag</a>()) {
<a name="l01160"></a>01160       <span class="comment">// It&#39;s a literal which goes into pending</span>
<a name="l01161"></a>01161       <span class="keywordflow">if</span>(!wasFlagged) {
<a name="l01162"></a>01162   pending++;
<a name="l01163"></a>01163   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;pending.insert(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01164"></a>01164       } <span class="keywordflow">else</span> {
<a name="l01165"></a>01165   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;already in pending: &quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01166"></a>01166       }
<a name="l01167"></a>01167     } <span class="keywordflow">else</span> {
<a name="l01168"></a>01168       <span class="keywordflow">if</span>(!wasFlagged) {
<a name="l01169"></a>01169   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;gamma.insert(&quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01170"></a>01170   gamma.push_back(thm);
<a name="l01171"></a>01171       } <span class="keywordflow">else</span> {
<a name="l01172"></a>01172   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;already in gamma: &quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01173"></a>01173       }
<a name="l01174"></a>01174     }
<a name="l01175"></a>01175   }
<a name="l01176"></a>01176   <span class="comment">// FIXME: uniquify theorems in lits, gamma, and fringe by</span>
<a name="l01177"></a>01177   <span class="comment">// expression; the smallest scope theorem should supersede all the</span>
<a name="l01178"></a>01178   <span class="comment">// duplicates.  Question: can we do it safely, without breaking the</span>
<a name="l01179"></a>01179   <span class="comment">// UIP algorithm?</span>
<a name="l01180"></a>01180 }
<a name="l01181"></a>01181 <span class="comment"></span>
<a name="l01182"></a>01182 <span class="comment">/*! </span>
<a name="l01183"></a>01183 <span class="comment"> &lt;strong&gt;Finding UIPs (Unique Implication Pointers)&lt;/strong&gt;</span>
<a name="l01184"></a>01184 <span class="comment"></span>
<a name="l01185"></a>01185 <span class="comment"> This is basically the same as finding hammocks of the subset of the</span>
<a name="l01186"></a>01186 <span class="comment"> implication graph composed of only the nodes from the current scope.</span>
<a name="l01187"></a>01187 <span class="comment"> A hammock is a portion of the graph which has a single source and/or</span>
<a name="l01188"></a>01188 <span class="comment"> sink such that removing that single node makes the graph</span>
<a name="l01189"></a>01189 <span class="comment"> disconnected.</span>
<a name="l01190"></a>01190 <span class="comment"></span>
<a name="l01191"></a>01191 <span class="comment"> Conceptually, the algorithm maintains four sets of nodes: literals</span>
<a name="l01192"></a>01192 <span class="comment"> (named &lt;em&gt;lits&lt;/em&gt;), gamma, fringe, and pending.  Literals are</span>
<a name="l01193"></a>01193 <span class="comment"> nodes whose expressions will become literals in the conflict clause</span>
<a name="l01194"></a>01194 <span class="comment"> of the current hammock, and the nodes in gamma are assumptions from</span>
<a name="l01195"></a>01195 <span class="comment"> which such conflict clause theorem is derived.  Nodes in fringe are</span>
<a name="l01196"></a>01196 <span class="comment"> intermediate nodes which are ready to be &quot;expanded&quot; (see the</span>
<a name="l01197"></a>01197 <span class="comment"> algorithm description below).  The pending nodes are those which are</span>
<a name="l01198"></a>01198 <span class="comment"> not yet ready to be processed (they later become literal or fringe</span>
<a name="l01199"></a>01199 <span class="comment"> nodes).</span>
<a name="l01200"></a>01200 <span class="comment"></span>
<a name="l01201"></a>01201 <span class="comment"> These sets are maintained as vectors, and are updated in such a way</span>
<a name="l01202"></a>01202 <span class="comment"> that the nodes in the vectors never repeat.  The exception is the</span>
<a name="l01203"></a>01203 <span class="comment"> pending set, for which only a size counter is maintained.  A node</span>
<a name="l01204"></a>01204 <span class="comment"> belongs to the pending set if it has been visited (isFlagged()</span>
<a name="l01205"></a>01205 <span class="comment"> method), and its fan-out count is non-zero (stored in the cache,</span>
<a name="l01206"></a>01206 <span class="comment"> getCachedValue()).  In other words, pending nodes are those that have</span>
<a name="l01207"></a>01207 <span class="comment"> been visited, but not sufficient number of times.</span>
<a name="l01208"></a>01208 <span class="comment"></span>
<a name="l01209"></a>01209 <span class="comment"> Also, fringe is maintained as a pair of vectors.  One vector is</span>
<a name="l01210"></a>01210 <span class="comment"> always the current fringe, and the other one is built when the</span>
<a name="l01211"></a>01211 <span class="comment"> current is processed.  When processing of the current fringe is</span>
<a name="l01212"></a>01212 <span class="comment"> finished, it is cleared, and the other vector becomes the current</span>
<a name="l01213"></a>01213 <span class="comment"> fringe (that is, they swap roles).</span>
<a name="l01214"></a>01214 <span class="comment"></span>
<a name="l01215"></a>01215 <span class="comment"> A node is expanded if it is marked for expansion (getExpandFlag()).</span>
<a name="l01216"></a>01216 <span class="comment"> If its fan-out count is not yet zero, it is added to the set of</span>
<a name="l01217"></a>01217 <span class="comment"> pending nodes.</span>
<a name="l01218"></a>01218 <span class="comment"></span>
<a name="l01219"></a>01219 <span class="comment"> If a node has a literal flag (getLitFlag()), it goes into literals</span>
<a name="l01220"></a>01220 <span class="comment"> when its fan-out count reaches zero.  Since this will be the last</span>
<a name="l01221"></a>01221 <span class="comment"> time the node is visited, it is added to the vector only once.</span>
<a name="l01222"></a>01222 <span class="comment"></span>
<a name="l01223"></a>01223 <span class="comment"> A node neither marked for expansion nor with the literal flag goes</span>
<a name="l01224"></a>01224 <span class="comment"> into the gamma set.  It is added the first time the node is visited</span>
<a name="l01225"></a>01225 <span class="comment"> (isFlagged() returns false), and therefore, is added to the vector</span>
<a name="l01226"></a>01226 <span class="comment"> only once.  This is an important distinction from the other sets,</span>
<a name="l01227"></a>01227 <span class="comment"> since a gamma-node may be used by several conflict clauses.</span>
<a name="l01228"></a>01228 <span class="comment"></span>
<a name="l01229"></a>01229 <span class="comment"> Clearing the gamma set after each UIP requires both clearing the</span>
<a name="l01230"></a>01230 <span class="comment"> vector and resetting all flags (clearAllFlags()).</span>
<a name="l01231"></a>01231 <span class="comment"></span>
<a name="l01232"></a>01232 <span class="comment"> &lt;strong&gt;The algorithm&lt;/strong&gt;</span>
<a name="l01233"></a>01233 <span class="comment"></span>
<a name="l01234"></a>01234 <span class="comment">&lt;ol&gt;</span>
<a name="l01235"></a>01235 <span class="comment"></span>
<a name="l01236"></a>01236 <span class="comment">&lt;li&gt; Initially, the fringe contains exactly the predecessors of</span>
<a name="l01237"></a>01237 <span class="comment">    falseThm from the current scope which are ready to be expanded</span>
<a name="l01238"></a>01238 <span class="comment">    (fan-out count is zero).  All the other predecessors of falseThm</span>
<a name="l01239"></a>01239 <span class="comment">    go to the appropriate sets of literals, gamma, and pending.</span>
<a name="l01240"></a>01240 <span class="comment"></span>
<a name="l01241"></a>01241 <span class="comment">&lt;li&gt; If fringe.size() &lt;= 1 and the set of pending nodes is empty, then</span>
<a name="l01242"></a>01242 <span class="comment">    the element in the fringe (if it&#39;s non-empty) is a UIP.  Generate</span>
<a name="l01243"></a>01243 <span class="comment">    a conflict clause from the UIP and the literals (using gamma as</span>
<a name="l01244"></a>01244 <span class="comment">    the set of assumptions), empty the sets, and continue with the</span>
<a name="l01245"></a>01245 <span class="comment">    next step.  Note, that the UIP remains in the fringe, and will be</span>
<a name="l01246"></a>01246 <span class="comment">    expanded in the next step.</span>
<a name="l01247"></a>01247 <span class="comment"></span>
<a name="l01248"></a>01248 <span class="comment">    The important exception: if the only element in the fringe is</span>
<a name="l01249"></a>01249 <span class="comment">    marked for expansion, then this is a false UIP (the SAT solver</span>
<a name="l01250"></a>01250 <span class="comment">    doesn&#39;t know about this node), and it should not appear in the</span>
<a name="l01251"></a>01251 <span class="comment">    conflict clause.  In this case, simply proceed to step 3 as if</span>
<a name="l01252"></a>01252 <span class="comment">    nothing happened.</span>
<a name="l01253"></a>01253 <span class="comment"></span>
<a name="l01254"></a>01254 <span class="comment">&lt;li&gt; If fringe.size()==0, stop (the set of pending nodes must also be</span>
<a name="l01255"></a>01255 <span class="comment">    empty at this point).  Otherwise, for *every* node in the fringe,</span>
<a name="l01256"></a>01256 <span class="comment">    decrement the fan-out for each of its predecessors, and empty the</span>
<a name="l01257"></a>01257 <span class="comment">    fringe.  Take the predecessors from the current scope, and add</span>
<a name="l01258"></a>01258 <span class="comment">    those to the fringe for which fan-out count is zero, and remove</span>
<a name="l01259"></a>01259 <span class="comment">    them from the set of pending nodes.  Add the other predecessors</span>
<a name="l01260"></a>01260 <span class="comment">    from the current scope to the set of pending nodes.  Add the</span>
<a name="l01261"></a>01261 <span class="comment">    remaining predecessors (not from the current scope) to the</span>
<a name="l01262"></a>01262 <span class="comment">    literals or gamma, as appropriate.  Continue with step 2.</span>
<a name="l01263"></a>01263 <span class="comment"></span>
<a name="l01264"></a>01264 <span class="comment">&lt;/ol&gt;</span>
<a name="l01265"></a>01265 <span class="comment">*/</span>
<a name="l01266"></a><a class="code" href="group__SE__Fast.html#gaac9cb2de28ec162fe5ecfe042ad7b101">01266</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#gaac9cb2de28ec162fe5ecfe042ad7b101" title="Analyse the conflict, find the UIPs, etc.">SearchEngineFast::analyzeUIPs</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> &amp;falseThm, <span class="keywordtype">int</span> conflictScope)
<a name="l01267"></a>01267 {
<a name="l01268"></a>01268   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;analyzeUIPs(scope = &quot;</span>, conflictScope, <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l01269"></a>01269   vector&lt;Theorem&gt; fringe[2]; <span class="comment">// 2-element array of vectors (new &amp; curr. fringe)</span>
<a name="l01270"></a>01270   <span class="keywordtype">unsigned</span> curr(0), next(1);
<a name="l01271"></a>01271 
<a name="l01272"></a>01272   <span class="keywordtype">int</span> pending(0);
<a name="l01273"></a>01273   vector&lt;Theorem&gt; lits;
<a name="l01274"></a>01274   vector&lt;Theorem&gt; gamma;
<a name="l01275"></a>01275   
<a name="l01276"></a>01276   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> start = falseThm;
<a name="l01277"></a>01277   <a class="code" href="group__SE__Fast.html#ga46e91bb5d782794c6dca6abaa99dc4f9" title="The last conflict clause (for checkSAT()). May be Null.">d_lastConflictClause</a> = <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>();
<a name="l01278"></a>01278   <a class="code" href="group__SE__Fast.html#gab27227ee9e005ab22a9e2a251bc7c6d1" title="The scope of the last conflict.">d_lastConflictScope</a> = conflictScope;
<a name="l01279"></a>01279   start.<a class="code" href="classCVC3_1_1Theorem.html#a621ab2150eedc0e3b38d34275ac206cd" title="Clear the flag attribute in all the theorems.">clearAllFlags</a>();
<a name="l01280"></a>01280 
<a name="l01281"></a>01281   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search full&quot;</span>, <span class="stringliteral">&quot;Analysing UIPs at level: &quot;</span>, conflictScope, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01282"></a>01282 
<a name="l01283"></a>01283   <span class="comment">// Initialize all the sets</span>
<a name="l01284"></a>01284   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Assumptions.html">Assumptions</a>&amp; a=start.<a class="code" href="classCVC3_1_1Theorem.html#a5e9ab00a613df15cc02f55edb55a67b3">getAssumptionsRef</a>();
<a name="l01285"></a>01285   <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Assumptions_1_1iterator.html" title="Iterator for the Assumptions: points to class Theorem.">Assumptions::iterator</a> i=a.<a class="code" href="classCVC3_1_1Assumptions.html#ac3e7d0e1796c83edf687aac063bdba06">begin</a>(), iend=a.<a class="code" href="classCVC3_1_1Assumptions.html#afc875bbe97e4e2d74a2cdc824f783bfb">end</a>(); i!=iend; ++i) {
<a name="l01286"></a>01286     <a class="code" href="search__fast_8cpp.html#a0ffbe582e8cf359e6b82a5bfc8c028ed" title="Auxiliary function used in analyzeUIPs()">processNode</a>(*i, lits, gamma, fringe[curr], pending);
<a name="l01287"></a>01287   }
<a name="l01288"></a>01288 
<a name="l01289"></a>01289   <span class="keywordflow">while</span> (<span class="keyword">true</span>) {
<a name="l01290"></a>01290     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;analyzeUIPs(): fringe size = &quot;</span>
<a name="l01291"></a>01291         +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(fringe[curr].size())
<a name="l01292"></a>01292         +<span class="stringliteral">&quot;, pending size = &quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(pending));
<a name="l01293"></a>01293     <span class="comment">// Wrap up a conflict clause if:</span>
<a name="l01294"></a>01294     <span class="comment">// (1) There are no pending nodes</span>
<a name="l01295"></a>01295     <span class="comment">// (2) The fringe has at most one element</span>
<a name="l01296"></a>01296     <span class="comment">// (3) If fringe is not empty, its node should not be flagged for expansion</span>
<a name="l01297"></a>01297     <span class="keywordflow">if</span>(fringe[curr].size() &lt;= 1 &amp;&amp; pending == 0
<a name="l01298"></a>01298        &amp;&amp; (fringe[curr].size() == 0
<a name="l01299"></a>01299      || !fringe[curr].back().getExpandFlag())) {
<a name="l01300"></a>01300       <span class="comment">// Found UIP or end of graph.  Generate conflict clause.</span>
<a name="l01301"></a>01301       <span class="keywordflow">if</span>(fringe[curr].size() &gt; 0)
<a name="l01302"></a>01302   lits.push_back(fringe[curr].back());
<a name="l01303"></a>01303       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(debugger.trace(<span class="stringliteral">&quot;impl graph&quot;</span>)) {
<a name="l01304"></a>01304   ostream&amp; os = debugger.getOS();
<a name="l01305"></a>01305   os &lt;&lt; <span class="stringliteral">&quot;Creating conflict clause:&quot;</span>
<a name="l01306"></a>01306      &lt;&lt; <span class="stringliteral">&quot;\n  start: &quot;</span> &lt;&lt; start.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>()
<a name="l01307"></a>01307      &lt;&lt; <span class="stringliteral">&quot;\n  Lits: [\n&quot;</span>;
<a name="l01308"></a>01308   <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i=0; i&lt;lits.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); i++)
<a name="l01309"></a>01309     os &lt;&lt; <span class="stringliteral">&quot;    &quot;</span> &lt;&lt; lits[i].getExpr() &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;
<a name="l01310"></a>01310   os &lt;&lt; <span class="stringliteral">&quot;]\n  Gamma: [\n&quot;</span>;
<a name="l01311"></a>01311   <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i=0; i&lt;gamma.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); i++)
<a name="l01312"></a>01312     os &lt;&lt; <span class="stringliteral">&quot;    &quot;</span> &lt;&lt; gamma[i].getExpr() &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;
<a name="l01313"></a>01313   os &lt;&lt; <span class="stringliteral">&quot;]&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga05b0ea7353ec24fa8e7e272d7a7875d8" title="Print the end-of-line.">endl</a>;
<a name="l01314"></a>01314       })
<a name="l01315"></a>01315       <span class="comment">// Derive a theorem for the conflict clause</span>
<a name="l01316"></a>01316       <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> clause = <a class="code" href="group__SE.html#ga879b68112123e2b4ae7175d85a03bfec" title="Proof rules for the search engine.">d_rules</a>-&gt;<a class="code" href="group__SE__Rules.html#ga03be39f8ffe84a1bcc09bba60f45245c" title="Conflict clause rule: .">conflictClause</a>(start, lits, gamma);
<a name="l01317"></a>01317       <a class="code" href="group__SE__Fast.html#ga483cb3c4c889013b03e2c923977d4ae5" title="Total number of conflict clauses generated (not all may be active)">d_conflictClauseCount</a>++;
<a name="l01318"></a>01318       <span class="comment">// Generate the actual clause and set it up</span>
<a name="l01319"></a>01319       <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> c(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>, <a class="code" href="group__SE.html#ga626a0fe24f363d007d729e16d13349e5" title="Variable manager for classes Variable and Literal.">d_vm</a>, clause, <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>, __FILE__, __LINE__);
<a name="l01320"></a>01320       <a class="code" href="group__SE__Fast.html#ga775b06e155128cc8817f254bc293c6c6" title="Add the literals of a new clause to d_litsByScores.">updateLitCounts</a>(c);
<a name="l01321"></a>01321       <span class="keywordflow">if</span> (c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>() &gt; 1) {
<a name="l01322"></a>01322   <span class="comment">// Set the watched pointers to the two literals with the</span>
<a name="l01323"></a>01323   <span class="comment">// highest scopes</span>
<a name="l01324"></a>01324         <span class="keywordtype">int</span> firstLit = 0;
<a name="l01325"></a>01325         <span class="keywordtype">int</span> secondLit = 1;
<a name="l01326"></a>01326         <span class="keywordtype">int</span> firstDL = c[0].<a class="code" href="classCVC3_1_1Clause.html#af505679fdb9d5b220115747cb4548612">getScope</a>();
<a name="l01327"></a>01327         <span class="keywordtype">int</span> secondDL = c[1].<a class="code" href="classCVC3_1_1Clause.html#af505679fdb9d5b220115747cb4548612">getScope</a>();
<a name="l01328"></a>01328   <span class="comment">// Invariant: firstDL &gt;= secondDL</span>
<a name="l01329"></a>01329   <span class="keywordflow">if</span>(firstDL &lt; secondDL) {
<a name="l01330"></a>01330     firstLit=1; secondLit=0;
<a name="l01331"></a>01331     <span class="keywordtype">int</span> tmp(secondDL);
<a name="l01332"></a>01332     secondDL=firstDL; firstDL=tmp;
<a name="l01333"></a>01333   }
<a name="l01334"></a>01334   <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> i = 2; i &lt; c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); ++i) {
<a name="l01335"></a>01335     <span class="keywordtype">int</span> cur = c[i].<a class="code" href="classCVC3_1_1Clause.html#af505679fdb9d5b220115747cb4548612">getScope</a>();
<a name="l01336"></a>01336     <span class="keywordflow">if</span>(cur &gt;= firstDL) {
<a name="l01337"></a>01337       secondLit=firstLit; secondDL=firstDL;
<a name="l01338"></a>01338       firstLit=i; firstDL=cur;
<a name="l01339"></a>01339     } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(cur &gt; secondDL) {
<a name="l01340"></a>01340       secondLit=i; secondDL=cur;
<a name="l01341"></a>01341     }
<a name="l01342"></a>01342   }
<a name="l01343"></a>01343 
<a name="l01344"></a>01344         c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(0, firstLit);
<a name="l01345"></a>01345         c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(1, secondLit);
<a name="l01346"></a>01346     
<a name="l01347"></a>01347         <span class="comment">// Add the watch pointers to the d_wp lists</span>
<a name="l01348"></a>01348         <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; i&lt;=1; i++) {
<a name="l01349"></a>01349           <span class="comment">// Negated watched literal</span>
<a name="l01350"></a>01350           <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(!c.<a class="code" href="classCVC3_1_1Clause.html#a4a2b1e46395f03fe87a6a5b7558292f0">watched</a>(i));
<a name="l01351"></a>01351           <span class="comment">// Add the pointer to l&#39;s list</span>
<a name="l01352"></a>01352           pair&lt;Clause, int&gt; p(c, i);
<a name="l01353"></a>01353           <a class="code" href="group__SE__Fast.html#ga8f4353c8f8c65ed00806861471bd857f" title="Return a ref to the vector of watched literals. If no such vector exists, create it.">wp</a>(l).push_back(p);
<a name="l01354"></a>01354         }
<a name="l01355"></a>01355       }
<a name="l01356"></a>01356       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;conflict clauses&quot;</span>,
<a name="l01357"></a>01357       <span class="stringliteral">&quot;Conflict clause #&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="group__SE__Fast.html#ga483cb3c4c889013b03e2c923977d4ae5" title="Total number of conflict clauses generated (not all may be active)">d_conflictClauseCount</a>)
<a name="l01358"></a>01358       +<span class="stringliteral">&quot;: &quot;</span>, <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01359"></a>01359       <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>() == 1) {
<a name="l01360"></a>01360         <span class="comment">// Unit clause: stash it for later unit propagation</span>
<a name="l01361"></a>01361         <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;conflict clauses&quot;</span>, <span class="stringliteral">&quot;analyzeUIPs(): unit clause: &quot;</span>,
<a name="l01362"></a>01362               <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01363"></a>01363         <a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.push_back(c);
<a name="l01364"></a>01364       }
<a name="l01365"></a>01365       <span class="keywordflow">else</span> {
<a name="l01366"></a>01366         <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;conflict clauses&quot;</span>, <span class="stringliteral">&quot;analyzeUIPs(): conflict clause &quot;</span>,
<a name="l01367"></a>01367         <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(c), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01368"></a>01368         <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(c.<a class="code" href="classCVC3_1_1Clause.html#af505679fdb9d5b220115747cb4548612">getScope</a>() &lt;= <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="l01369"></a>01369         <span class="stringliteral">&quot;Conflict clause should be at bottom scope.&quot;</span>);
<a name="l01370"></a>01370         <a class="code" href="group__SE__Fast.html#gad79601e3b2032aee4d23dc4bbd785fc3" title="Reference to top deque of conflict clauses.">d_conflictClauses</a>-&gt;push_back(c);
<a name="l01371"></a>01371         <span class="keywordflow">if</span> (<a class="code" href="group__SE__Fast.html#ga46e91bb5d782794c6dca6abaa99dc4f9" title="The last conflict clause (for checkSAT()). May be Null.">d_lastConflictClause</a>.<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>()) {
<a name="l01372"></a>01372           <a class="code" href="group__SE__Fast.html#ga46e91bb5d782794c6dca6abaa99dc4f9" title="The last conflict clause (for checkSAT()). May be Null.">d_lastConflictClause</a> = c;
<a name="l01373"></a>01373 <span class="comment">//    IF_DEBUG(for(unsigned i=0; i&lt;c.size(); ++i)</span>
<a name="l01374"></a>01374 <span class="comment">//      DebugAssert(c[i].getValue() == -1, &quot;Bad conflict clause: &quot;</span>
<a name="l01375"></a>01375 <span class="comment">//      +c.toString());)</span>
<a name="l01376"></a>01376   }
<a name="l01377"></a>01377       }
<a name="l01378"></a>01378       <span class="keywordflow">if</span>(fringe[curr].size() &gt; 0) {
<a name="l01379"></a>01379   <span class="comment">// This was a UIP.  Leave it in the fringe for later expansion.</span>
<a name="l01380"></a>01380   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;UIPs&quot;</span>)++;)
<a name="l01381"></a>01381   start = fringe[curr].back();
<a name="l01382"></a>01382   lits.clear();
<a name="l01383"></a>01383   gamma.clear();
<a name="l01384"></a>01384   start.<a class="code" href="classCVC3_1_1Theorem.html#a621ab2150eedc0e3b38d34275ac206cd" title="Clear the flag attribute in all the theorems.">clearAllFlags</a>();
<a name="l01385"></a>01385       } <span class="keywordflow">else</span> {
<a name="l01386"></a>01386   <span class="comment">// No more conflict clauses, we are done.  This is the only</span>
<a name="l01387"></a>01387   <span class="comment">// way this function can return.</span>
<a name="l01388"></a>01388   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;analyzeUIPs =&gt; }&quot;</span>);
<a name="l01389"></a>01389   <span class="keywordflow">return</span>;
<a name="l01390"></a>01390       }
<a name="l01391"></a>01391     }
<a name="l01392"></a>01392     <span class="comment">// Now expand all the nodes in the fringe</span>
<a name="l01393"></a>01393     <span class="keywordflow">for</span>(vector&lt;Theorem&gt;::iterator i=fringe[curr].begin(),
<a name="l01394"></a>01394     iend=fringe[curr].end();
<a name="l01395"></a>01395   i!=iend; ++i) {
<a name="l01396"></a>01396       <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Assumptions.html">Assumptions</a>&amp; a=i-&gt;getAssumptionsRef();
<a name="l01397"></a>01397       <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Assumptions_1_1iterator.html" title="Iterator for the Assumptions: points to class Theorem.">Assumptions::iterator</a> j=a.<a class="code" href="classCVC3_1_1Assumptions.html#ac3e7d0e1796c83edf687aac063bdba06">begin</a>(), jend=a.<a class="code" href="classCVC3_1_1Assumptions.html#afc875bbe97e4e2d74a2cdc824f783bfb">end</a>(); j!=jend; ++j) {
<a name="l01398"></a>01398   <a class="code" href="search__fast_8cpp.html#a0ffbe582e8cf359e6b82a5bfc8c028ed" title="Auxiliary function used in analyzeUIPs()">processNode</a>(*j, lits, gamma, fringe[next], pending);
<a name="l01399"></a>01399       }
<a name="l01400"></a>01400     }
<a name="l01401"></a>01401     <span class="comment">// Swap the current and next fringes</span>
<a name="l01402"></a>01402     fringe[curr].clear();
<a name="l01403"></a>01403     curr = 1 - curr;
<a name="l01404"></a>01404     next = 1 - next;
<a name="l01405"></a>01405     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(pending &gt; 0 &amp;&amp; fringe[curr].size()==0)
<a name="l01406"></a>01406        falseThm.<a class="code" href="classCVC3_1_1Theorem.html#ad9da69b34ab2bab4192e5977e5c10498">printDebug</a>();)
<a name="l01407"></a>01407     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(pending == 0 || fringe[curr].size() &gt; 0,
<a name="l01408"></a>01408     <span class="stringliteral">&quot;analyzeUIPs(scope = &quot;</span>
<a name="l01409"></a>01409     +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(conflictScope)+<span class="stringliteral">&quot;): empty fringe&quot;</span>);
<a name="l01410"></a>01410   }
<a name="l01411"></a>01411 }
<a name="l01412"></a>01412 
<a name="l01413"></a>01413 <span class="comment"></span>
<a name="l01414"></a>01414 <span class="comment">////////////////////////////////</span>
<a name="l01415"></a>01415 <span class="comment"></span><span class="comment">// End New Search Engine Code //</span><span class="comment"></span>
<a name="l01416"></a>01416 <span class="comment">////////////////////////////////</span>
<a name="l01417"></a>01417 <span class="comment"></span>
<a name="l01418"></a>01418 <span class="comment"></span>
<a name="l01419"></a>01419 <span class="comment">//! Redefine the counterexample generation.</span>
<a name="l01420"></a>01420 <span class="comment"></span><span class="comment">/*! FIXME: for now, it just dumps all the assumptions (same as</span>
<a name="l01421"></a>01421 <span class="comment"> * getAssumptions()).  Eventually, it will simplify the related</span>
<a name="l01422"></a>01422 <span class="comment"> * formulas to TRUE, merge all the generated assumptions into</span>
<a name="l01423"></a>01423 <span class="comment"> * d_lastCounterExample, and call the parent&#39;s method. */</span>
<a name="l01424"></a><a class="code" href="group__SE__Fast.html#ga104e5e0abacb4c9492b0cb818b7d968a">01424</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#ga104e5e0abacb4c9492b0cb818b7d968a" title="Redefine the counterexample generation.">SearchEngineFast::getCounterExample</a>(std::vector&lt;Expr&gt;&amp; assertions) {
<a name="l01425"></a>01425   <span class="comment">// This will not add anything, since the counterexample is empty,</span>
<a name="l01426"></a>01426   <span class="comment">// but will check if we are allowed to be called</span>
<a name="l01427"></a>01427   <a class="code" href="group__SE__Fast.html#ga104e5e0abacb4c9492b0cb818b7d968a" title="Redefine the counterexample generation.">SearchImplBase::getCounterExample</a>(assertions);
<a name="l01428"></a>01428   <a class="code" href="group__SE.html#gadadf46fa5200744c9f30ca548080d35d" title="Get all assumptions made in this and all previous contexts.">getAssumptions</a>(assertions);
<a name="l01429"></a>01429 }
<a name="l01430"></a>01430 
<a name="l01431"></a>01431 <span class="comment"></span>
<a name="l01432"></a>01432 <span class="comment">//! Notify the search engine about a new non-literal fact.</span>
<a name="l01433"></a>01433 <span class="comment"></span><span class="comment">/*! It should be called by TheoryCore::assertFactCore().</span>
<a name="l01434"></a>01434 <span class="comment"> *</span>
<a name="l01435"></a>01435 <span class="comment"> * If the fact is an AND, we split it into individual conjuncts and</span>
<a name="l01436"></a>01436 <span class="comment"> * add them individually.</span>
<a name="l01437"></a>01437 <span class="comment"> *</span>
<a name="l01438"></a>01438 <span class="comment"> * If the fact is an OR, we check whether it&#39;s a CNF clause; that is,</span>
<a name="l01439"></a>01439 <span class="comment"> * whether all disjuncts are literals.  If they are, we add it as a</span>
<a name="l01440"></a>01440 <span class="comment"> * CNF clause.</span>
<a name="l01441"></a>01441 <span class="comment"> *</span>
<a name="l01442"></a>01442 <span class="comment"> * Otherwise add the fact to d_nonLiterals as it is.</span>
<a name="l01443"></a>01443 <span class="comment"> */</span>
<a name="l01444"></a>01444 <span class="keywordtype">void</span>
<a name="l01445"></a><a class="code" href="group__SE__Fast.html#ga03501a968c3c7122a999b1f57d6640a0">01445</a> <a class="code" href="group__SE__Fast.html#ga03501a968c3c7122a999b1f57d6640a0" title="Notify the search engine about a new non-literal fact.">SearchEngineFast::addNonLiteralFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; thm) {
<a name="l01446"></a>01446   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;addNonLiteralFact(&quot;</span>, thm, <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l01447"></a>01447   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;d_nonLiteralsSaved.size()=&quot;</span>,<a class="code" href="group__SE__Fast.html#gae88240871407db238ad8c6a795ba6b91" title="prevent reprocessing">d_nonLiteralsSaved</a>.<a class="code" href="classCVC3_1_1CDMap.html#a2cf256af978e1a3bf82407a13ba85c13">size</a>(),
<a name="l01448"></a>01448   <span class="stringliteral">&quot;@&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>()));
<a name="l01449"></a>01449   <span class="comment">//IF_DEBUG(checkAssumpDebug(thm, d_assumptions);)</span>
<a name="l01450"></a>01450   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>());
<a name="l01451"></a>01451   <span class="keywordflow">if</span>(<a class="code" href="group__SE__Fast.html#gae88240871407db238ad8c6a795ba6b91" title="prevent reprocessing">d_nonLiteralsSaved</a>.<a class="code" href="classCVC3_1_1CDMap.html#af5f700035db0db798c645e36dd0b31bd">count</a>(e) &gt; 0) {
<a name="l01452"></a>01452     <span class="comment">// We&#39;ve seen this non-literal before.</span>
<a name="l01453"></a>01453     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;addNonLiteralFact[skipping] =&gt; }&quot;</span>);
<a name="l01454"></a>01454     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;skipped repeated non-literals&quot;</span>)++;)
<a name="l01455"></a>01455     <span class="keywordflow">return</span>;
<a name="l01456"></a>01456   }
<a name="l01457"></a>01457   <span class="comment">// Save the non-literal</span>
<a name="l01458"></a>01458   <a class="code" href="group__SE__Fast.html#gae88240871407db238ad8c6a795ba6b91" title="prevent reprocessing">d_nonLiteralsSaved</a>[e]=thm;
<a name="l01459"></a>01459   <span class="keywordtype">bool</span> isCNFclause(<span class="keyword">false</span>);
<a name="l01460"></a>01460   <span class="comment">// Split conjunctions into individual assertions and add them to the</span>
<a name="l01461"></a>01461   <span class="comment">// appropriate lists</span>
<a name="l01462"></a>01462 
<a name="l01463"></a>01463   <span class="keywordtype">int</span> k = e.getKind();
<a name="l01464"></a>01464   <span class="keywordflow">if</span> (k == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5baf18208f4921c8175373d32e4ce909d42">AND_R</a> || k == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5bab3535bf1f1c26490d56f63dc20696fa6">IFF_R</a> || k == <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba096c0758089b7d7d0a596b1b4c89a084">ITE_R</a>)
<a name="l01465"></a>01465   {
<a name="l01466"></a>01466     <a class="code" href="group__SE__Fast.html#ga5db32a771408c468676e407075184b64" title="Mappings of literals to vectors of pointers to the corresponding watched literals.">d_circuits</a>.push_back(<span class="keyword">new</span> <a class="code" href="classCVC3_1_1SearchEngineFast.html#a120b136c2c9bc1938e0cd2cca80d91e4">Circuit</a>(<span class="keyword">this</span>, thm));
<a name="l01467"></a>01467   }
<a name="l01468"></a>01468 
<a name="l01469"></a>01469   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(e.isAnd()) {
<a name="l01470"></a>01470     <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0, iend=e.arity(); i&lt;iend; ++i) {
<a name="l01471"></a>01471       <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> t_i(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a3f3592ac74d0aa0caa3b9224ea7e61f4">andElim</a>(thm, i));
<a name="l01472"></a>01472       <span class="comment">// Call enqueueFact(), not addFact(), since we are called from</span>
<a name="l01473"></a>01473       <span class="comment">// addFact() here</span>
<a name="l01474"></a>01474       <span class="keywordflow">if</span>(e[i].isAbsLiteral()) {
<a name="l01475"></a>01475   <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a479141bc26a125b758a2acc6420274f9" title="Enqueue a new fact.">enqueueFact</a>(t_i);
<a name="l01476"></a>01476       }
<a name="l01477"></a>01477       <span class="keywordflow">else</span> <a class="code" href="group__SE__Fast.html#ga03501a968c3c7122a999b1f57d6640a0" title="Notify the search engine about a new non-literal fact.">addNonLiteralFact</a>(t_i);
<a name="l01478"></a>01478     }
<a name="l01479"></a>01479   } <span class="keywordflow">else</span> {
<a name="l01480"></a>01480     <span class="keywordtype">int</span> unsetLits(0); <span class="comment">// Count the number of unset literals</span>
<a name="l01481"></a>01481     <span class="keywordtype">size_t</span> unitLit(0); <span class="comment">// If the #unsetLits==1, this is the only unset literal</span>
<a name="l01482"></a>01482     vector&lt;Theorem&gt; thms; <span class="comment">// collect proofs of !l_i for unit prop.</span>
<a name="l01483"></a>01483     <span class="keywordflow">if</span>(e.isOr()) {
<a name="l01484"></a>01484       isCNFclause = <span class="keyword">true</span>;
<a name="l01485"></a>01485       <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; isCNFclause &amp;&amp; i&lt;e.arity(); ++i) {
<a name="l01486"></a>01486   isCNFclause=e[i].isAbsLiteral();
<a name="l01487"></a>01487   <span class="keywordflow">if</span>(isCNFclause) {
<a name="l01488"></a>01488     <span class="comment">// Check the value of the literal</span>
<a name="l01489"></a>01489     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(e[i]));
<a name="l01490"></a>01490     <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() &gt; 0) <span class="comment">// The entire clause is true; ignore it</span>
<a name="l01491"></a>01491       <span class="keywordflow">return</span>;
<a name="l01492"></a>01492     <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 0) { <span class="comment">// Found unset literal</span>
<a name="l01493"></a>01493       unsetLits++; unitLit = i;
<a name="l01494"></a>01494     } <span class="keywordflow">else</span> <span class="comment">// Literal is false, collect the theorem for it</span>
<a name="l01495"></a>01495       thms.push_back(l.<a class="code" href="classCVC3_1_1Literal.html#a9d040e10a412d4a86642a9b2776dd258">deriveTheorem</a>());
<a name="l01496"></a>01496   }
<a name="l01497"></a>01497       }
<a name="l01498"></a>01498     }
<a name="l01499"></a>01499     <span class="keywordflow">if</span>(isCNFclause) {
<a name="l01500"></a>01500       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.arity() &gt; 1, <span class="stringliteral">&quot;Clause should have more than one literal&quot;</span>);
<a name="l01501"></a>01501       <span class="comment">// Check if clause is unit or unsat</span>
<a name="l01502"></a>01502       <span class="keywordflow">if</span>(unsetLits==0) { <span class="comment">// Contradiction</span>
<a name="l01503"></a>01503   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;contradictory clause:\n&quot;</span>,
<a name="l01504"></a>01504         <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(<a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>, <a class="code" href="group__SE.html#ga626a0fe24f363d007d729e16d13349e5" title="Variable manager for classes Variable and Literal.">d_vm</a>, thm, <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>())),<span class="stringliteral">&quot;&quot;</span>);
<a name="l01505"></a>01505   <a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234" title="Set the context inconsistent. Takes Theorem(FALSE).">setInconsistent</a>(<a class="code" href="group__SE.html#ga879b68112123e2b4ae7175d85a03bfec" title="Proof rules for the search engine.">d_rules</a>-&gt;<a class="code" href="group__SE__Rules.html#ga9c74425b4471d411f58f16781951c441" title="&quot;Conflict&quot; rule (all literals in a clause become FALSE) ">conflictRule</a>(thms, thm));
<a name="l01506"></a>01506       } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(unsetLits==1) { <span class="comment">// Unit clause: propagate literal</span>
<a name="l01507"></a>01507   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;unit clause, unitLit = &quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(unitLit)+<span class="stringliteral">&quot;:\n&quot;</span>, 
<a name="l01508"></a>01508         <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(<a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>, <a class="code" href="group__SE.html#ga626a0fe24f363d007d729e16d13349e5" title="Variable manager for classes Variable and Literal.">d_vm</a>, thm, <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>())),<span class="stringliteral">&quot;&quot;</span>);
<a name="l01509"></a>01509   <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a479141bc26a125b758a2acc6420274f9" title="Enqueue a new fact.">enqueueFact</a>(<a class="code" href="group__SE.html#ga879b68112123e2b4ae7175d85a03bfec" title="Proof rules for the search engine.">d_rules</a>-&gt;<a class="code" href="group__SE__Rules.html#gae7221bb8b77313a9b53a4beca9cc0aa0" title="Unit propagation rule: .">unitProp</a>(thms, thm, unitLit));
<a name="l01510"></a>01510       } <span class="keywordflow">else</span> { <span class="comment">// Wrap up the clause</span>
<a name="l01511"></a>01511   <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a> c(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>, <a class="code" href="group__SE.html#ga626a0fe24f363d007d729e16d13349e5" title="Variable manager for classes Variable and Literal.">d_vm</a>, thm, <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>(), __FILE__, __LINE__);
<a name="l01512"></a>01512   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;CNF clauses added&quot;</span>)++;)
<a name="l01513"></a>01513   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;addNonLiteralFact: adding CNF: &quot;</span>, c, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01514"></a>01514   <a class="code" href="group__SE__Fast.html#ga6e64b8f0a42bd4b42d22b50b351219c9" title="Go through all the clauses and check the watch pointers (for debugging)">addNewClause</a>(c);
<a name="l01515"></a>01515       }
<a name="l01516"></a>01516     } <span class="keywordflow">else</span> {
<a name="l01517"></a>01517       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;addNonLiteralFact: adding non-literal: &quot;</span>, thm, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01518"></a>01518       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(debugger.counter(<span class="stringliteral">&quot;added non-literals&quot;</span>)++;)
<a name="l01519"></a>01519       <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(<a class="code" href="classCVC3_1_1SmartCDO.html">SmartCDO&lt;Theorem&gt;</a>(<a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-&gt;<a class="code" href="classCVC3_1_1ContextManager.html#a66a7d900301c1459de90b048623d9297">getCurrentContext</a>(), thm));
<a name="l01520"></a>01520       <span class="comment">//      d_nonLiteralSimplified[thm.getExpr()] = false;</span>
<a name="l01521"></a>01521     }
<a name="l01522"></a>01522   }
<a name="l01523"></a>01523   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;addNonLiteralFact =&gt; }&quot;</span>);
<a name="l01524"></a>01524 }
<a name="l01525"></a>01525 
<a name="l01526"></a>01526 <span class="comment"></span>
<a name="l01527"></a>01527 <span class="comment">//! Notify the search engine about a new literal fact.</span>
<a name="l01528"></a>01528 <span class="comment"></span><span class="comment">/*! It should be called by TheoryCore::assertFactCore() */</span>
<a name="l01529"></a>01529 <span class="keywordtype">void</span>
<a name="l01530"></a><a class="code" href="group__SE__Fast.html#gaef3113afb8dc9ea1b06217ab77f5d713">01530</a> <a class="code" href="group__SE__Fast.html#gaef3113afb8dc9ea1b06217ab77f5d713" title="Notify the search engine about a new literal fact.">SearchEngineFast::addLiteralFact</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; thm) {
<a name="l01531"></a>01531   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;addLiteralFact(&quot;</span>, thm, <span class="stringliteral">&quot;)&quot;</span>);
<a name="l01532"></a>01532   <span class="comment">// Save the value of the flag to restore it later</span>
<a name="l01533"></a>01533   <span class="keywordtype">bool</span> useEF(<a class="code" href="group__SE__Fast.html#gaa1ea8707c10a13a631402860eff87026" title="When true, use TheoryCore::enqueueFact() instead of addFact() in commitFacts()">d_useEnqueueFact</a>);
<a name="l01534"></a>01534   <a class="code" href="group__SE__Fast.html#gaa1ea8707c10a13a631402860eff87026" title="When true, use TheoryCore::enqueueFact() instead of addFact() in commitFacts()">d_useEnqueueFact</a>=<span class="keyword">true</span>;
<a name="l01535"></a>01535 
<a name="l01536"></a>01536   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#aed1590a02166f6099e5538dbf681a60c" title="Check if the theorem is a literal.">isAbsLiteral</a>(),
<a name="l01537"></a>01537         <span class="stringliteral">&quot;addLiteralFact: not a literal: &quot;</span> + thm.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>());
<a name="l01538"></a>01538   <span class="comment">//IF_DEBUG(checkAssumpDebug(thm, d_assumptions);)</span>
<a name="l01539"></a>01539   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>()));
<a name="l01540"></a>01540   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;addLiteralFact: literal = &quot;</span>, l, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01541"></a>01541   <span class="comment">// Only add the literal if it doesn&#39;t have any value; otherwise it&#39;s</span>
<a name="l01542"></a>01542   <span class="comment">// either a contradiction, or it must already be in the list</span>
<a name="l01543"></a>01543   <span class="comment">// FIXME: why did we need thm.getScope() != 0 ???</span>
<a name="l01544"></a>01544   <span class="keywordflow">if</span> ((l.getValue() == 0 <span class="comment">/* &amp;&amp; thm.getScope() != 0 */</span>)
<a name="l01545"></a>01545       <span class="comment">/* || (l.getValue() == 1 &amp;&amp; l.getScope() &gt; thm.getScope()) */</span>) {
<a name="l01546"></a>01546     l.setValue(thm, <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>());
<a name="l01547"></a>01547     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(l.getExpr().isAbsLiteral(),
<a name="l01548"></a>01548     <span class="stringliteral">&quot;addLiteralFact(): pushing non-literal to d_literals:\n &quot;</span>
<a name="l01549"></a>01549     +l.getExpr().toString());
<a name="l01550"></a>01550     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(l.getValue() == 1, <span class="stringliteral">&quot;addLiteralFact(): l = &quot;</span>+l.toString());
<a name="l01551"></a>01551     <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.push_back(l);
<a name="l01552"></a>01552     <a class="code" href="group__SE__Fast.html#gaf720bf50e81fc4e2561b587d97ec2839" title="Set of asserted literals which may survive accross checkValid() calls.">d_literalSet</a>.<a class="code" href="classCVC3_1_1CDMap.html#a664a15046de83b0af599f488cb420022">insert</a>(l.getExpr(),l);
<a name="l01553"></a>01553     <span class="comment">// Immediately propagate the literal with BCP, unless the SAT</span>
<a name="l01554"></a>01554     <span class="comment">// solver is already running</span>
<a name="l01555"></a>01555     <span class="keywordflow">if</span>(!<a class="code" href="group__SE__Fast.html#ga6368ec56b20c12896000e370bbb4a3b6" title="True when checkSAT() is running.">d_inCheckSAT</a>) <a class="code" href="group__SE__Fast.html#gac6d49471ba5c76fffc7581e01e423218" title="Boolean constraint propagation.">bcp</a>();
<a name="l01556"></a>01556 
<a name="l01557"></a>01557 <span class="comment">//     if (thm.getScope() != scopeLevel()) {</span>
<a name="l01558"></a>01558 <span class="comment">//       IF_DEBUG(debugger.counter(&quot;addLiteralFact adds unreported lit&quot;)++;)</span>
<a name="l01559"></a>01559 <span class="comment">//       d_unreportedLits.insert(l.getExpr(),thm,thm.getScope());</span>
<a name="l01560"></a>01560 <span class="comment">//     }</span>
<a name="l01561"></a>01561   } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(l.getValue() &lt; 0) { <span class="comment">// Contradiction, bcp will die anyway</span>
<a name="l01562"></a>01562     <span class="keywordflow">if</span>(l.isNegative())
<a name="l01563"></a>01563       <a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234" title="Set the context inconsistent. Takes Theorem(FALSE).">setInconsistent</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a1074822d52c22daacaa78b34ac0635ba">contradictionRule</a>(l.deriveTheorem(), thm));
<a name="l01564"></a>01564     <span class="keywordflow">else</span>
<a name="l01565"></a>01565       <a class="code" href="group__SE__Fast.html#ga33ff53b3eeb9811b1510fffd3cdcf234" title="Set the context inconsistent. Takes Theorem(FALSE).">setInconsistent</a>(<a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a1074822d52c22daacaa78b34ac0635ba">contradictionRule</a>(thm, l.deriveTheorem()));
<a name="l01566"></a>01566   }
<a name="l01567"></a>01567   <a class="code" href="group__SE__Fast.html#gaa1ea8707c10a13a631402860eff87026" title="When true, use TheoryCore::enqueueFact() instead of addFact() in commitFacts()">d_useEnqueueFact</a>=useEF;
<a name="l01568"></a>01568 }
<a name="l01569"></a>01569 <span class="comment"></span>
<a name="l01570"></a>01570 <span class="comment">/*! @brief Redefine newIntAssumption(): we need to add the new theorem</span>
<a name="l01571"></a>01571 <span class="comment"> * to the appropriate Literal */</span>
<a name="l01572"></a>01572 <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>
<a name="l01573"></a><a class="code" href="group__SE__Fast.html#gaf54422149559aa048f32723a3dc6fcce">01573</a> <a class="code" href="group__SE__Fast.html#gaf54422149559aa048f32723a3dc6fcce" title="Redefine newIntAssumption(): we need to add the new theorem to the appropriate Literal.">SearchEngineFast::newIntAssumption</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e) {
<a name="l01574"></a>01574   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm(<a class="code" href="group__SE.html#ga635768498a239f0193de5f1445676f65" title="Add a new internal asserion.">SearchImplBase::newIntAssumption</a>(e));
<a name="l01575"></a>01575   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#a05282db6832afb4f198d8c6b2b67aeb1">isAssump</a>(), <span class="stringliteral">&quot;Splitter should be an assumption:&quot;</span> + thm.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>());
<a name="l01576"></a>01576   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search full&quot;</span>, <span class="stringliteral">&quot;Splitter: &quot;</span>, thm.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01577"></a>01577   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; expr = thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>();
<a name="l01578"></a>01578   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(expr));
<a name="l01579"></a>01579   <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 0) {
<a name="l01580"></a>01580     l.<a class="code" href="classCVC3_1_1Literal.html#ad731e76b4037cb3e5d797543596514a1">setValue</a>(thm, <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>());
<a name="l01581"></a>01581     <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a4a2e0a421bfcb590c3a7964d2583a94c">getExpr</a>().<a class="code" href="group__ExprPkg.html#gaac535dae48f02fcd093a5b1b1a062211" title="Test if e is an abstract literal.">isAbsLiteral</a>()) {
<a name="l01582"></a>01582       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 1, <span class="stringliteral">&quot;newIntAssumption(): l = &quot;</span>+l.<a class="code" href="classCVC3_1_1Literal.html#aff53e6b3e4da8c649816441046983a30">toString</a>());
<a name="l01583"></a>01583       <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.push_back(l);
<a name="l01584"></a>01584     }
<a name="l01585"></a>01585     <span class="keywordflow">else</span>
<a name="l01586"></a>01586       <a class="code" href="group__SE__Fast.html#ga0214c0205e48fd792c4d01d3428cd333" title="Set of alive literals that shouldn&#39;t be garbage-collected.">d_litsAlive</a>.<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(l);
<a name="l01587"></a>01587   }
<a name="l01588"></a>01588 
<a name="l01589"></a>01589     
<a name="l01590"></a>01590   <span class="keywordflow">return</span> thm;
<a name="l01591"></a>01591 }
<a name="l01592"></a>01592 
<a name="l01593"></a>01593 <span class="keywordtype">bool</span> 
<a name="l01594"></a><a class="code" href="group__SE__Fast.html#ga4b55b5f49d921ca4b63f874d8404c4d5">01594</a> <a class="code" href="group__SE__Fast.html#ga4b55b5f49d921ca4b63f874d8404c4d5" title="Check if the formula has been assumed.">SearchEngineFast::isAssumption</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e) {
<a name="l01595"></a>01595   <span class="keywordflow">return</span> (<a class="code" href="group__SE.html#ga38ec2c19ebab8525ebc3c6249bf97442" title="Check if the formula has been assumed.">SearchImplBase::isAssumption</a>(e)
<a name="l01596"></a>01596     || (<a class="code" href="group__SE__Fast.html#gae88240871407db238ad8c6a795ba6b91" title="prevent reprocessing">d_nonLiteralsSaved</a>.<a class="code" href="classCVC3_1_1CDMap.html#af5f700035db0db798c645e36dd0b31bd">count</a>(e) &gt; 0));
<a name="l01597"></a>01597 }
<a name="l01598"></a>01598 
<a name="l01599"></a>01599 
<a name="l01600"></a>01600 <span class="keywordtype">void</span>
<a name="l01601"></a><a class="code" href="group__SE__Fast.html#ga40b361c2f9374c541282feca1e237dba">01601</a> <a class="code" href="group__SE__Fast.html#ga40b361c2f9374c541282feca1e237dba" title="Suggest a splitter to the SearchEngine.">SearchEngineFast::addSplitter</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e, <span class="keywordtype">int</span> priority) {
<a name="l01602"></a>01602   <span class="comment">// SearchEngine::addSplitter(e, priority);</span>
<a name="l01603"></a>01603   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(e.<a class="code" href="group__ExprPkg.html#gaac535dae48f02fcd093a5b1b1a062211" title="Test if e is an abstract literal.">isAbsLiteral</a>(), <span class="stringliteral">&quot;SearchEngineFast::addSplitter(&quot;</span>+e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()+<span class="stringliteral">&quot;)&quot;</span>);
<a name="l01604"></a>01604   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> lit(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(e));
<a name="l01605"></a>01605   <a class="code" href="group__SE.html#ga8ea9b2ab9f50d3ddf595595b1f3d7974" title="Backtracking ordered set of DP-suggested splitters.">d_dpSplitters</a>.<a class="code" href="classCVC3_1_1CDList.html#aa1e8d3591c596d1b9c585dec955b519b">push_back</a>(<a class="code" href="classCVC3_1_1SearchImplBase_1_1Splitter.html" title="Representation of a DP-suggested splitter.">Splitter</a>(lit));
<a name="l01606"></a>01606   <span class="keywordflow">if</span>(priority != 0) {
<a name="l01607"></a>01607     <a class="code" href="group__SE__Fast.html#ga2d54fdadc1b167dbbb366e37e0b97a58" title="Internal (decrementing) count of added splitters, to sort d_litByScores.">d_litSortCount</a>--;
<a name="l01608"></a>01608     lit.score() += priority*10;
<a name="l01609"></a>01609   }
<a name="l01610"></a>01610   <span class="keywordflow">if</span>(!lit.added()) {
<a name="l01611"></a>01611     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;addSplitter(): adding literal &quot;</span>, lit, <span class="stringliteral">&quot; to d_litsByScores&quot;</span>);
<a name="l01612"></a>01612     <a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.push_back(lit);
<a name="l01613"></a>01613     lit.added()=<span class="keyword">true</span>;
<a name="l01614"></a>01614     <span class="keywordflow">if</span>(priority == 0) <a class="code" href="group__SE__Fast.html#ga2d54fdadc1b167dbbb366e37e0b97a58" title="Internal (decrementing) count of added splitters, to sort d_litByScores.">d_litSortCount</a>--;
<a name="l01615"></a>01615   }
<a name="l01616"></a>01616   <span class="keywordflow">if</span>(<a class="code" href="group__SE__Fast.html#ga2d54fdadc1b167dbbb366e37e0b97a58" title="Internal (decrementing) count of added splitters, to sort d_litByScores.">d_litSortCount</a> &lt; 0) {
<a name="l01617"></a>01617     ::stable_sort(<a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.begin(), <a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.end(), <a class="code" href="search__fast_8cpp.html#a55afec8e553f4d1c6487c4e63a0c2375" title="Total order on literals for the initial sort.">compareLits</a>);
<a name="l01618"></a>01618     <a class="code" href="group__SE__Fast.html#ga2d54fdadc1b167dbbb366e37e0b97a58" title="Internal (decrementing) count of added splitters, to sort d_litByScores.">d_litSortCount</a>=<a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>.size();
<a name="l01619"></a>01619   }
<a name="l01620"></a>01620   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search splitters&quot;</span>,<span class="stringliteral">&quot;addSplitter =&gt; &quot;</span>, lits2str(<a class="code" href="group__SE__Fast.html#ga57c1c1e58ebd2c1d23a57db97880fbbc" title="Vector of literals sorted by score.">d_litsByScores</a>),<span class="stringliteral">&quot;&quot;</span>);
<a name="l01621"></a>01621 }
<a name="l01622"></a>01622 
<a name="l01623"></a>01623 
<a name="l01624"></a><a class="code" href="group__SE__Fast.html#gaac7ba666d67d3d4808642c5c7858db95">01624</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> <a class="code" href="group__SE__Fast.html#gaac7ba666d67d3d4808642c5c7858db95" title="Private helper function for checkValid and restart.">SearchEngineFast::checkValidMain</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e2)
<a name="l01625"></a>01625 {
<a name="l01626"></a>01626   <span class="comment">// Propagate the literals asserted before checkValid()</span>
<a name="l01627"></a>01627   <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1CDMap.html">CDMap&lt;Expr,Literal&gt;::iterator</a> i=<a class="code" href="group__SE__Fast.html#gaf720bf50e81fc4e2561b587d97ec2839" title="Set of asserted literals which may survive accross checkValid() calls.">d_literalSet</a>.<a class="code" href="classCVC3_1_1CDMap.html#a5d57eb1210dab2fadcd85a2f01e6d6d1">begin</a>(),
<a name="l01628"></a>01628   iend=<a class="code" href="group__SE__Fast.html#gaf720bf50e81fc4e2561b587d97ec2839" title="Set of asserted literals which may survive accross checkValid() calls.">d_literalSet</a>.<a class="code" href="classCVC3_1_1CDMap.html#a2a26c7cc4db12cb17d273db5cfa5a890">end</a>(); i!=iend; ++i)
<a name="l01629"></a>01629     <a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.push_back((*i).second);
<a name="l01630"></a>01630 
<a name="l01631"></a>01631   <span class="comment">// Run the SAT solver</span>
<a name="l01632"></a>01632   <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> result = <a class="code" href="group__SE__Fast.html#gac68652e5ed46a097f846ba9a86fcd630">checkSAT</a>();
<a name="l01633"></a>01633 
<a name="l01634"></a>01634   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> res;
<a name="l01635"></a>01635   <span class="keywordflow">if</span> (result == <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498baba54da61f61403de5204b899fe55d92f">UNSATISFIABLE</a>)
<a name="l01636"></a>01636     res = <a class="code" href="group__SE__Fast.html#gae961b4fb4bb059a1d867447fc487aaee" title="Theorem(FALSE) which generated a conflict.">d_conflictTheorem</a>;
<a name="l01637"></a>01637   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (result == <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498bad11a6bd5ab8c3e02ec8503e7a7860a61">SATISFIABLE</a>) {
<a name="l01638"></a>01638     <span class="comment">// Set counter-example</span>
<a name="l01639"></a>01639     vector&lt;Expr&gt; a;
<a name="l01640"></a>01640     <span class="keywordtype">unsigned</span> i;
<a name="l01641"></a>01641     <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm;
<a name="l01642"></a>01642 
<a name="l01643"></a>01643     <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="l01644"></a>01644     <span class="keywordflow">for</span> (i=<a class="code" href="group__SE__Fast.html#gae4a9e9926613365979d36e2a98769381" title="Size of d_nonLiterals before most recent query.">d_nonlitQueryStart</a>; i &lt; <a class="code" href="group__SE__Fast.html#ga8472c82be89057f32c68a0f0423215a2" title="Size of d_nonLiterals after query (not including DP-generated non-literals)">d_nonlitQueryEnd</a>; ++i) {
<a name="l01645"></a>01645       thm = <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>[i].get();
<a name="l01646"></a>01646       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>(),
<a name="l01647"></a>01647                   <span class="stringliteral">&quot;original nonLiteral doesn&#39;t simplify to true&quot;</span>);
<a name="l01648"></a>01648       thm.<a class="code" href="classCVC3_1_1Theorem.html#a524b4dafa4fb8f14742baa856612d92b">getLeafAssumptions</a>(a);
<a name="l01649"></a>01649       <span class="keywordflow">for</span> (vector&lt;Expr&gt;::iterator i=a.begin(), iend=a.end(); i != iend; ++i) {
<a name="l01650"></a>01650         <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="l01651"></a>01651       }
<a name="l01652"></a>01652       a.<a class="code" href="classCVC3_1_1ExprHashMap.html#aa20f14dba09537171af45bf479b99c66">clear</a>();
<a name="l01653"></a>01653     }
<a name="l01654"></a>01654     <span class="keywordflow">for</span> (i=<a class="code" href="group__SE__Fast.html#ga71a2e31fe2a16420a416b5aeced09455" title="Size of d_clauses before most recent query.">d_clausesQueryStart</a>; i &lt; <a class="code" href="group__SE__Fast.html#ga6dbfd2cd66dee5634f096593f26c47e7" title="Size of d_clauses after query.">d_clausesQueryEnd</a>; ++i) {
<a name="l01655"></a>01655       thm = <a class="code" href="group__SE.html#gaaa621df0c7e2a2043139e6451eab7072" title="Our version of simplifier: take Theorem(e), apply simplifier to get Theorem(e==e&#39;), return Theorem(e&#39;)">simplify</a>(((<a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>)<a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>[i]).getTheorem());
<a name="l01656"></a>01656       <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(thm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#gadf8596df73fa69ff8e6a22b9321f5c34">isTrue</a>(),
<a name="l01657"></a>01657                   <span class="stringliteral">&quot;original nonLiteral doesn&#39;t simplify to true&quot;</span>);
<a name="l01658"></a>01658       thm.<a class="code" href="classCVC3_1_1Theorem.html#a524b4dafa4fb8f14742baa856612d92b">getLeafAssumptions</a>(a);
<a name="l01659"></a>01659       <span class="keywordflow">for</span> (vector&lt;Expr&gt;::iterator i=a.begin(), iend=a.end(); i != iend; ++i) {
<a name="l01660"></a>01660         <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="l01661"></a>01661       }
<a name="l01662"></a>01662       a.<a class="code" href="classCVC3_1_1ExprHashMap.html#aa20f14dba09537171af45bf479b99c66">clear</a>();
<a name="l01663"></a>01663     }
<a name="l01664"></a>01664   }
<a name="l01665"></a>01665   <span class="keywordflow">else</span> <span class="keywordflow">return</span> result;
<a name="l01666"></a>01666 
<a name="l01667"></a>01667   <a class="code" href="group__SE.html#ga0d509e38a03048dcbdb9e28f3f5da724" title="Process result of checkValid.">processResult</a>(res, e2);
<a name="l01668"></a>01668 
<a name="l01669"></a>01669   <span class="keywordflow">if</span> (result == <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498baba54da61f61403de5204b899fe55d92f">UNSATISFIABLE</a>) {
<a name="l01670"></a>01670     <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-&gt;<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="l01671"></a>01671     <a class="code" href="group__SE__Fast.html#gad80c2b69b88a04c8c78309859abd3f76" title="Position of a literal with max score in d_litsByScores.">d_litsMaxScorePos</a> = 0; <span class="comment">// from decision engine</span>
<a name="l01672"></a>01672 
<a name="l01673"></a>01673     <span class="comment">// Clear data structures</span>
<a name="l01674"></a>01674     <a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.clear();
<a name="l01675"></a>01675     <a class="code" href="group__SE__Fast.html#gadf72861b6482f6c585f3199d1436f7be" title="Clear the list of asserted literals (d_literals)">clearLiterals</a>();
<a name="l01676"></a>01676     <a class="code" href="group__SE__Fast.html#gafa7937cc0b7d14c0aafb1f9c20abf011" title="Clear the local fact queue.">clearFacts</a>();
<a name="l01677"></a>01677 
<a name="l01678"></a>01678     <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>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#af38f25446a561384c3de66392c4d3544" title="e1 &lt;=&gt; e2 ==&gt; ~e1 &lt;=&gt; ~e2">iffContrapositive</a>(<a class="code" href="group__SE__Fast.html#gaa8b578a017bcddd578e943add44c2940" title="Theorem which records simplification of the last query.">d_simplifiedThm</a>));
<a name="l01679"></a>01679     <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="l01680"></a>01680       <a class="code" href="group__SE.html#ga63f2a3cfcfa86820bea2f45cb890cc1c" title="Common proof rules.">d_commonRules</a>-&gt;<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>-&gt;<a class="code" href="classCVC3_1_1CommonProofRules.html#a0a87e88508f49b73037e0024afa841bf" title=" (same for IFF)">symmetryRule</a>(e_iff_e2));
<a name="l01681"></a>01681     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(checkAssumpDebug(d_lastValid, <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 name="l01682"></a>01682     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search terse&quot;</span>, <span class="stringliteral">&quot;checkValid =&gt; true}&quot;</span>);
<a name="l01683"></a>01683     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;checkValid =&gt; true; theorem = &quot;</span>, d_lastValid, <span class="stringliteral">&quot;}&quot;</span>);
<a name="l01684"></a>01684     <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-&gt;<a class="code" href="classCVC3_1_1ContextManager.html#ae74b114a270baff44940a8916d958e9c">pop</a>();
<a name="l01685"></a>01685   }
<a name="l01686"></a>01686   <span class="keywordflow">else</span> {
<a name="l01687"></a>01687     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search terse&quot;</span>, <span class="stringliteral">&quot;checkValid =&gt; false}&quot;</span>);
<a name="l01688"></a>01688     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;checkValid =&gt; false; }&quot;</span>);
<a name="l01689"></a>01689     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.size() == 0, <span class="stringliteral">&quot;checkValid(): d_unitConflictClauses postcondition violated&quot;</span>);
<a name="l01690"></a>01690     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#gaa6a69bd3df4bb72abd1e9b0fe868fc0d" title="Set of literals to be processed by bcp.">d_literals</a>.size() == 0, <span class="stringliteral">&quot;checkValid(): d_literals postcondition violated&quot;</span>);
<a name="l01691"></a>01691     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;checkValid(): d_factQueue postcondition violated&quot;</span>);
<a name="l01692"></a>01692   }
<a name="l01693"></a>01693   <span class="keywordflow">return</span> result;
<a name="l01694"></a>01694 }
<a name="l01695"></a>01695 
<a name="l01696"></a>01696 
<a name="l01697"></a><a class="code" href="group__SE__Fast.html#ga1db688bc99f93a978079b3d2efd1bd9f">01697</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> <a class="code" href="group__SE__Fast.html#ga1db688bc99f93a978079b3d2efd1bd9f" title="Implementation of the API call.">SearchEngineFast::checkValidInternal</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e)
<a name="l01698"></a>01698 {
<a name="l01699"></a>01699   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.size() == 0, <span class="stringliteral">&quot;checkValid(): d_unitConflitClauses precondition violated&quot;</span>);
<a name="l01700"></a>01700   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;checkValid(): d_factQueue precondition violated&quot;</span>);
<a name="l01701"></a>01701 
<a name="l01702"></a>01702   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;checkValid(&quot;</span>, e, <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l01703"></a>01703   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search terse&quot;</span>, <span class="stringliteral">&quot;checkValid() {&quot;</span>);
<a name="l01704"></a>01704 
<a name="l01705"></a>01705   <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="l01706"></a>01706     <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>
<a name="l01707"></a>01707       (<span class="stringliteral">&quot;checking validity of a non-boolean expression:\n\n  &quot;</span>
<a name="l01708"></a>01708        + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()
<a name="l01709"></a>01709        + <span class="stringliteral">&quot;\n\nwhich has the following type:\n\n  &quot;</span>
<a name="l01710"></a>01710        + 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="l01711"></a>01711   }
<a name="l01712"></a>01712 
<a name="l01713"></a>01713   <span class="comment">// A successful query should leave the context unchanged</span>
<a name="l01714"></a>01714   <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-&gt;<a class="code" href="classCVC3_1_1ContextManager.html#a90e301927cc935d561b81761d4ab2ee8">push</a>();
<a name="l01715"></a>01715   <a class="code" href="group__SE__Fast.html#gaab577b22f09d51b9b15954b9a529c05d">d_conflictClauseManager</a>.<a class="code" href="classCVC3_1_1SearchEngineFast_1_1ConflictClauseManager.html#ab6f279d5486d100804dcd8e749cb6665">setRestorePoint</a>();
<a name="l01716"></a>01716   <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="l01717"></a>01717 
<a name="l01718"></a>01718   <span class="comment">// First, simplify the NEGATION of the given expression: that&#39;s what</span>
<a name="l01719"></a>01719   <span class="comment">// we&#39;ll assert</span>
<a name="l01720"></a>01720   <a class="code" href="group__SE__Fast.html#gaa8b578a017bcddd578e943add44c2940" title="Theorem which records simplification of the last query.">d_simplifiedThm</a> = <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#acc963fd43994f06d3647394b731e835c">getExprTrans</a>()-&gt;<a class="code" href="classCVC3_1_1ExprTransform.html#a39652560061ab1172040113d9dfa25f6">preprocess</a>(e.<a class="code" href="group__ExprPkg.html#gab1ce461dc931af73bf04e88c8d37dcbc">negate</a>());
<a name="l01721"></a>01721   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;checkValid: simplifiedThm = &quot;</span>, <a class="code" href="group__SE__Fast.html#gaa8b578a017bcddd578e943add44c2940" title="Theorem which records simplification of the last query.">d_simplifiedThm</a>, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01722"></a>01722 
<a name="l01723"></a>01723   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; not_e2 = <a class="code" href="group__SE__Fast.html#gaa8b578a017bcddd578e943add44c2940" 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="l01724"></a>01724   <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="l01725"></a>01725 
<a name="l01726"></a>01726   <span class="comment">// Assert not_e2 if it&#39;s not already asserted</span>
<a name="l01727"></a>01727   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search terse&quot;</span>, <span class="stringliteral">&quot;checkValid: Asserting !e: &quot;</span>);
<a name="l01728"></a>01728   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;checkValid: Asserting !e: &quot;</span>, not_e2, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01729"></a>01729   <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> not_e2_thm;
<a name="l01730"></a>01730   <a class="code" href="group__SE__Fast.html#gae4a9e9926613365979d36e2a98769381" title="Size of d_nonLiterals before most recent query.">d_nonlitQueryStart</a> = <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l01731"></a>01731   <a class="code" href="group__SE__Fast.html#ga71a2e31fe2a16420a416b5aeced09455" title="Size of d_clauses before most recent query.">d_clausesQueryStart</a> = <a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l01732"></a>01732   <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="l01733"></a>01733     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="l01734"></a>01734   } <span class="keywordflow">else</span> {
<a name="l01735"></a>01735     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="l01736"></a>01736   }
<a name="l01737"></a>01737   <span class="comment">//  d_core-&gt;addFact(not_e2_thm);</span>
<a name="l01738"></a>01738   <a class="code" href="group__SE__Fast.html#ga8472c82be89057f32c68a0f0423215a2" title="Size of d_nonLiterals after query (not including DP-generated non-literals)">d_nonlitQueryEnd</a> = <a class="code" href="group__SE__Fast.html#ga07c8e260b60d83042c97453892a15f38" title="Backtrackable list of non-literals (non-CNF formulas).">d_nonLiterals</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l01739"></a>01739   <a class="code" href="group__SE__Fast.html#ga6dbfd2cd66dee5634f096593f26c47e7" title="Size of d_clauses after query.">d_clausesQueryEnd</a> = <a class="code" href="group__SE__Fast.html#gaa1dd9a29eac4c7da6c669d7888909ca5" title="Backtrackable list of clauses.">d_clauses</a>.<a class="code" href="classCVC3_1_1CDList.html#adf92d0f391d73e7ac70da57db135af27">size</a>();
<a name="l01740"></a>01740 
<a name="l01741"></a>01741   <span class="comment">// Reset the splitter counter.  This will force a call to</span>
<a name="l01742"></a>01742   <span class="comment">// updateLitScores() the first time we need to find a splitter, and</span>
<a name="l01743"></a>01743   <span class="comment">// clean out junk from the previous calls to checkValid().</span>
<a name="l01744"></a>01744   <a class="code" href="group__SE__Fast.html#ga52c9c181bcd623a36ab594e0ee16a67e" title="Internal splitter counter for delaying updateLitScores()">d_splitterCount</a>=0;
<a name="l01745"></a>01745 
<a name="l01746"></a>01746   <span class="keywordflow">return</span> <a class="code" href="group__SE__Fast.html#gaac7ba666d67d3d4808642c5c7858db95" title="Private helper function for checkValid and restart.">checkValidMain</a>(e2);
<a name="l01747"></a>01747 }
<a name="l01748"></a>01748 
<a name="l01749"></a>01749 
<a name="l01750"></a><a class="code" href="group__SE__Fast.html#ga99dd1f1c52ecae319bd0b5a3b689a31d">01750</a> <a class="code" href="namespaceCVC3.html#a060d21b3207cc3471e24f8dbcff3498b">QueryResult</a> <a class="code" href="group__SE__Fast.html#ga99dd1f1c52ecae319bd0b5a3b689a31d" title="Reruns last check with e as an additional assumption.">SearchEngineFast::restartInternal</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a>&amp; e)
<a name="l01751"></a>01751 {
<a name="l01752"></a>01752   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#gad05f577d00e93fefed74eb0c19015090" title="Unprocessed unit conflict clauses.">d_unitConflictClauses</a>.size() == 0, <span class="stringliteral">&quot;restart(): d_unitConflitClauses precondition violated&quot;</span>);
<a name="l01753"></a>01753   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(<a class="code" href="group__SE__Fast.html#ga4b05dccebac3de019dc112ab3dffc988" title="Queue of derived facts to be sent to DPs.">d_factQueue</a>.empty(), <span class="stringliteral">&quot;restart(): d_factQueue precondition violated&quot;</span>);
<a name="l01754"></a>01754 
<a name="l01755"></a>01755   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;restart(&quot;</span>, e, <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l01756"></a>01756   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search terse&quot;</span>, <span class="stringliteral">&quot;restart() {&quot;</span>);
<a name="l01757"></a>01757 
<a name="l01758"></a>01758   <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="l01759"></a>01759     <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1TypecheckException.html">TypecheckException</a>
<a name="l01760"></a>01760       (<span class="stringliteral">&quot;argument to restart is a non-boolean expression:\n\n  &quot;</span>
<a name="l01761"></a>01761        + e.<a class="code" href="group__ExprPkg.html#gaf3028bb1619f8cc69b66ec712e1adb54" title="Print the expression to a string.">toString</a>()
<a name="l01762"></a>01762        + <span class="stringliteral">&quot;\n\nwhich has the following type:\n\n  &quot;</span>
<a name="l01763"></a>01763        + 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="l01764"></a>01764   }
<a name="l01765"></a>01765 
<a name="l01766"></a>01766   <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="l01767"></a>01767     <span class="keywordflow">throw</span> <a class="code" href="classCVC3_1_1Exception.html">Exception</a>(<span class="stringliteral">&quot;Call to restart with no current query&quot;</span>);
<a name="l01768"></a>01768   }
<a name="l01769"></a>01769   <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<a class="code" href="classCVC3_1_1TheoryCore.html#a9377f423f4fd59fdac396794363733a6">getCM</a>()-&gt;<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="l01770"></a>01770 
<a name="l01771"></a>01771   <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> e2 = <a class="code" href="group__SE__Fast.html#gaa8b578a017bcddd578e943add44c2940" 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="l01772"></a>01772 
<a name="l01773"></a>01773   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search terse&quot;</span>, <span class="stringliteral">&quot;restart: Asserting e: &quot;</span>);
<a name="l01774"></a>01774   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search&quot;</span>, <span class="stringliteral">&quot;restart: Asserting e: &quot;</span>, e, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01775"></a>01775   <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="l01776"></a>01776     <a class="code" href="group__SE.html#ga3772c6af7eac91b9ed7fc278edf5ef90" title="Access to theory reasoning.">d_core</a>-&gt;<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="l01777"></a>01777   }
<a name="l01778"></a>01778 
<a name="l01779"></a>01779   <span class="keywordflow">return</span> <a class="code" href="group__SE__Fast.html#gaac7ba666d67d3d4808642c5c7858db95" title="Private helper function for checkValid and restart.">checkValidMain</a>(e2);
<a name="l01780"></a>01780 }
<a name="l01781"></a>01781 <span class="comment"></span>
<a name="l01782"></a>01782 <span class="comment">/*!</span>
<a name="l01783"></a>01783 <span class="comment"> * The purpose of this method is to mark up the assumption graph of</span>
<a name="l01784"></a>01784 <span class="comment"> * the FALSE Theorem (conflictThm) for the later UIP analysis.  The</span>
<a name="l01785"></a>01785 <span class="comment"> * required flags for each assumption in the graph are:</span>
<a name="l01786"></a>01786 <span class="comment"> *</span>
<a name="l01787"></a>01787 <span class="comment"> * &lt;strong&gt;ExpandFlag:&lt;/strong&gt; whether to &quot;expand&quot; the node or not;</span>
<a name="l01788"></a>01788 <span class="comment"> * that is, whether to consider the current node as a final assumption</span>
<a name="l01789"></a>01789 <span class="comment"> * (either as a conflict clause literal, or a context assumption from</span>
<a name="l01790"></a>01790 <span class="comment"> * \f$\Gamma\f$)</span>
<a name="l01791"></a>01791 <span class="comment"> *</span>
<a name="l01792"></a>01792 <span class="comment"> * &lt;strong&gt;LitFlag:&lt;/strong&gt; the node (actually, its inverse) is a</span>
<a name="l01793"></a>01793 <span class="comment"> * literal of the conflict clause</span>
<a name="l01794"></a>01794 <span class="comment"> *</span>
<a name="l01795"></a>01795 <span class="comment"> * &lt;strong&gt;CachedValue:&lt;/strong&gt; the &quot;fanout&quot; count, how many nodes in</span>
<a name="l01796"></a>01796 <span class="comment"> * the assumption graph are derived from the current node.</span>
<a name="l01797"></a>01797 <span class="comment"> * </span>
<a name="l01798"></a>01798 <span class="comment"> * INVARIANTS (after the method returns):</span>
<a name="l01799"></a>01799 <span class="comment"> *</span>
<a name="l01800"></a>01800 <span class="comment"> * -# The currect scope is the &quot;true&quot; conflict scope,</span>
<a name="l01801"></a>01801 <span class="comment"> *    i.e. scopeLevel() == conflictThm.getScope()</span>
<a name="l01802"></a>01802 <span class="comment"> * -# The literals marked with LitFlag (CC literals) are known to the</span>
<a name="l01803"></a>01803 <span class="comment"> *    SAT solver, i.e. their Literal class has a value == 1</span>
<a name="l01804"></a>01804 <span class="comment"> * -# The only CC literal from the current scope is the latest splitter</span>
<a name="l01805"></a>01805 <span class="comment"> *</span>
<a name="l01806"></a>01806 <span class="comment"> * ASSUMPTIONS: </span>
<a name="l01807"></a>01807 <span class="comment"> * </span>
<a name="l01808"></a>01808 <span class="comment"> * -# The Theorem scope of an assumption is the same as its Literal scope;</span>
<a name="l01809"></a>01809 <span class="comment"> *    i.e. if thm is a splitter, then </span>
<a name="l01810"></a>01810 <span class="comment"> *    thm.getScope() == newLiteral(thm.getExpr()).getScope()</span>
<a name="l01811"></a>01811 <span class="comment"> *</span>
<a name="l01812"></a>01812 <span class="comment"> * Algorithm:</span>
<a name="l01813"></a>01813 <span class="comment"> * </span>
<a name="l01814"></a>01814 <span class="comment"> * First, backtrack to the scope level of the conflict.  Then,</span>
<a name="l01815"></a>01815 <span class="comment"> * traverse the implication graph until we either hit a literal known</span>
<a name="l01816"></a>01816 <span class="comment"> * to the SAT solver at a lower scope:</span>
<a name="l01817"></a>01817 <span class="comment"> * newLiteral(e).getScope()&lt;scopeLevel(), or a splitter (assumption), or a</span>
<a name="l01818"></a>01818 <span class="comment"> * fact from the bottom scope.  The literals from the first two</span>
<a name="l01819"></a>01819 <span class="comment"> * categories are marked with LitFlag (they&#39;ll comprise the conflict</span>
<a name="l01820"></a>01820 <span class="comment"> * clause), and the bottom scope facts will be the assumptions in the</span>
<a name="l01821"></a>01821 <span class="comment"> * conflict clause&#39;s theorem.</span>
<a name="l01822"></a>01822 <span class="comment"> *</span>
<a name="l01823"></a>01823 <span class="comment"> * The traversed nodes are cached by the .isFlagged() flag, and</span>
<a name="l01824"></a>01824 <span class="comment"> * subsequent hits only increase the fanout count of the node.</span>
<a name="l01825"></a>01825 <span class="comment"> *</span>
<a name="l01826"></a>01826 <span class="comment"> * Notice, that there can only be one literal in the conflict clause</span>
<a name="l01827"></a>01827 <span class="comment"> * from the current scope.  Also, even if some intermediate literals</span>
<a name="l01828"></a>01828 <span class="comment"> * were delayed by the DPs and reported to the SAT solver at or below</span>
<a name="l01829"></a>01829 <span class="comment"> * the conflict scope (which may be below their &quot;true&quot; Theorem scope),</span>
<a name="l01830"></a>01830 <span class="comment"> * they will be skipped, and their assumptions will be used.</span>
<a name="l01831"></a>01831 <span class="comment"> *</span>
<a name="l01832"></a>01832 <span class="comment"> * In other words, it is safe to backtrack to the &quot;true&quot; conflict</span>
<a name="l01833"></a>01833 <span class="comment"> * level, since, in the worst case, we traverse the graph all the way</span>
<a name="l01834"></a>01834 <span class="comment"> * to the splitters, and make a conflict clause out of those.  The</span>
<a name="l01835"></a>01835 <span class="comment"> * hope is, however, that this wouldn&#39;t happen too often.</span>
<a name="l01836"></a>01836 <span class="comment"> */</span>
<a name="l01837"></a><a class="code" href="group__SE__Fast.html#gab3f2a42375c5b3875ad18acd47ee124d">01837</a> <span class="keywordtype">void</span> <a class="code" href="group__SE__Fast.html#gab3f2a42375c5b3875ad18acd47ee124d" title="First pass in conflict analysis; takes a theorem of FALSE.">SearchEngineFast::traceConflict</a>(<span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; conflictThm) {
<a name="l01838"></a>01838   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict(&quot;</span>, conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>(), <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l01839"></a>01839   
<a name="l01840"></a>01840   <span class="comment">// Always process conflict at its true scope or the bottom scope,</span>
<a name="l01841"></a>01841   <span class="comment">// whichever is greater.</span>
<a name="l01842"></a>01842   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>() &lt;= <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>(),
<a name="l01843"></a>01843         <span class="stringliteral">&quot;conflictThm.getScope()=&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>())
<a name="l01844"></a>01844         +<span class="stringliteral">&quot;, scopeLevel()=&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>()));
<a name="l01845"></a>01845   <span class="keywordflow">if</span>(conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>() &lt; <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>()) {
<a name="l01846"></a>01846     <span class="keywordtype">int</span> scope(conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a112466d9793abcf97015233ffdc4ec5e">getScope</a>());
<a name="l01847"></a>01847     <span class="keywordflow">if</span>(scope &lt; <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>) scope = <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="l01848"></a>01848     <a class="code" href="group__SE__Fast.html#gafa042a51f718c312ea7728f175958e35" title="Decision Engine.">d_decisionEngine</a>-&gt;<a class="code" href="group__DE.html#ga90d2e881c4cc004754708ee579682d85" title="Pop to given scope.">popTo</a>(scope);
<a name="l01849"></a>01849   }
<a name="l01850"></a>01850 
<a name="l01851"></a>01851   <span class="keywordflow">if</span>(<a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>() &lt;= <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="l01852"></a>01852     <span class="comment">// This is a top-level conflict, nothing to analyze.</span>
<a name="l01853"></a>01853     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict[bottom scope] =&gt; }&quot;</span>);
<a name="l01854"></a>01854     <span class="keywordflow">return</span>;
<a name="l01855"></a>01855   }
<a name="l01856"></a>01856 
<a name="l01857"></a>01857   <span class="comment">// DFS stack</span>
<a name="l01858"></a>01858   vector&lt;Theorem&gt; stack;
<a name="l01859"></a>01859   <span class="comment">// Max assumption scope for the contradiction</span>
<a name="l01860"></a>01860   <span class="keywordtype">int</span> maxScope(<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="l01861"></a>01861   <span class="comment">// Collect potential top-level splitters</span>
<a name="l01862"></a>01862   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(vector&lt;Theorem&gt; splitters;)
<a name="l01863"></a>01863   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict: maxScope = &quot;</span>, maxScope, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01864"></a>01864 
<a name="l01865"></a>01865   conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a621ab2150eedc0e3b38d34275ac206cd" title="Clear the flag attribute in all the theorems.">clearAllFlags</a>();
<a name="l01866"></a>01866   conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a30644e9241516daa6483f5d9c0be4caf" title="Set the &quot;expand&quot; attribute.">setExpandFlag</a>(<span class="keyword">true</span>);
<a name="l01867"></a>01867   conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a293ebbc3162763fbbeaa9fbd8ea1c657" title="Check if the flag attribute is set.">setCachedValue</a>(0);
<a name="l01868"></a>01868 
<a name="l01869"></a>01869   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Assumptions.html">Assumptions</a>&amp; assump = conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#a5e9ab00a613df15cc02f55edb55a67b3">getAssumptionsRef</a>();
<a name="l01870"></a>01870   <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Assumptions_1_1iterator.html" title="Iterator for the Assumptions: points to class Theorem.">Assumptions::iterator</a> i=assump.<a class="code" href="classCVC3_1_1Assumptions.html#ac3e7d0e1796c83edf687aac063bdba06">begin</a>(),iend=assump.<a class="code" href="classCVC3_1_1Assumptions.html#afc875bbe97e4e2d74a2cdc824f783bfb">end</a>();i!=iend;++i) {
<a name="l01871"></a>01871     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict: adding &quot;</span>, *i, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01872"></a>01872     stack.push_back(*i);
<a name="l01873"></a>01873   }
<a name="l01874"></a>01874 
<a name="l01875"></a>01875   <span class="comment">// Do the non-recursive DFS, mark up the assumption graph</span>
<a name="l01876"></a>01876   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<a class="code" href="classCVC3_1_1Literal.html">Literal</a> maxScopeLit;)
<a name="l01877"></a>01877   <span class="keywordflow">while</span>(stack.size() &gt; 0) {
<a name="l01878"></a>01878     <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a> thm(stack.back());
<a name="l01879"></a>01879     stack.pop_back();
<a name="l01880"></a>01880     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict: while() { thm = &quot;</span>, thm, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01881"></a>01881     <span class="keywordflow">if</span> (thm.isFlagged()) {
<a name="l01882"></a>01882       <span class="comment">// We&#39;ve seen this theorem before.  Update fanout count.</span>
<a name="l01883"></a>01883       thm.setCachedValue(thm.getCachedValue() + 1);
<a name="l01884"></a>01884       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;Found again: &quot;</span>, thm.getExpr().toString(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01885"></a>01885       <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;With fanout: &quot;</span>, thm.getCachedValue(), <span class="stringliteral">&quot;&quot;</span>);
<a name="l01886"></a>01886     }
<a name="l01887"></a>01887     <span class="keywordflow">else</span> {
<a name="l01888"></a>01888       <span class="comment">// This is a new theorem.  Process it.</span>
<a name="l01889"></a>01889       thm.setCachedValue(1);
<a name="l01890"></a>01890       thm.setFlag();
<a name="l01891"></a>01891       thm.setLitFlag(<span class="keyword">false</span>); <span class="comment">// Clear this flag (it may be set later)</span>
<a name="l01892"></a>01892       <span class="keywordtype">bool</span> expand(<span class="keyword">false</span>);
<a name="l01893"></a>01893       <span class="keywordtype">int</span> scope = thm.getScope();
<a name="l01894"></a>01894       <span class="keywordtype">bool</span> isAssump = thm.isAssump();
<a name="l01895"></a>01895 
<a name="l01896"></a>01896       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>({
<a name="l01897"></a>01897   <span class="keywordtype">int</span> s = scope;
<a name="l01898"></a>01898   <span class="keywordflow">if</span>(thm.isAbsLiteral()) {
<a name="l01899"></a>01899     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(thm.getExpr()));
<a name="l01900"></a>01900     <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>() == 1) s = l.<a class="code" href="classCVC3_1_1Literal.html#a2abe99239ecdf75235e242282cd672f2">getScope</a>();
<a name="l01901"></a>01901   }
<a name="l01902"></a>01902   <span class="comment">// maxScope will be reset: clear the splitters</span>
<a name="l01903"></a>01903   <span class="keywordflow">if</span>(s &gt; maxScope) splitters.clear();
<a name="l01904"></a>01904       })
<a name="l01905"></a>01905 
<a name="l01906"></a>01906       <span class="keywordflow">if</span>(thm.isAbsLiteral()) {
<a name="l01907"></a>01907   <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(<a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(thm.getExpr()));
<a name="l01908"></a>01908   <span class="keywordtype">bool</span> isTrue(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>()==1);
<a name="l01909"></a>01909   <span class="keywordflow">if</span>(isTrue) scope = l.<a class="code" href="classCVC3_1_1Literal.html#a2abe99239ecdf75235e242282cd672f2">getScope</a>();
<a name="l01910"></a>01910   <span class="keywordflow">if</span>(!isAssump &amp;&amp; (!isTrue || scope == <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>()))
<a name="l01911"></a>01911     expand=<span class="keyword">true</span>;
<a name="l01912"></a>01912   <span class="keywordflow">else</span> <span class="keywordflow">if</span>(scope &gt; <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>) {<span class="comment">// Found a literal of a conflict clause</span>
<a name="l01913"></a>01913     <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(scope &gt;= maxScope) splitters.push_back(thm);)
<a name="l01914"></a>01914     thm.setLitFlag(<span class="keyword">true</span>);
<a name="l01915"></a>01915   }
<a name="l01916"></a>01916       } <span class="keywordflow">else</span> {
<a name="l01917"></a>01917   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(scope &lt;= <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> || !isAssump,
<a name="l01918"></a>01918         <span class="stringliteral">&quot;SearchEngineFast::traceConflict: thm = &quot;</span>
<a name="l01919"></a>01919         +thm.toString());
<a name="l01920"></a>01920   <span class="keywordflow">if</span>(!isAssump &amp;&amp; scope &gt; <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="l01921"></a>01921     expand=<span class="keyword">true</span>;
<a name="l01922"></a>01922       }
<a name="l01923"></a>01923 
<a name="l01924"></a>01924       <span class="keywordflow">if</span>(scope &gt; maxScope) {
<a name="l01925"></a>01925   maxScope = scope;
<a name="l01926"></a>01926   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(maxScopeLit = <a class="code" href="group__SE.html#gaf0dbbb1806723760ab8744e96a8c6657" title="Construct a Literal out of an Expr or return an existing one.">newLiteral</a>(thm.getExpr());)
<a name="l01927"></a>01927   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict: maxScope = &quot;</span>, maxScope, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01928"></a>01928       }
<a name="l01929"></a>01929 
<a name="l01930"></a>01930       <span class="keywordflow">if</span>(expand) {
<a name="l01931"></a>01931   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!thm.isAssump(),
<a name="l01932"></a>01932         <span class="stringliteral">&quot;traceConflict: thm = &quot;</span>+thm.toString());
<a name="l01933"></a>01933   thm.setExpandFlag(<span class="keyword">true</span>);
<a name="l01934"></a>01934   <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Assumptions.html">Assumptions</a>&amp; assump = thm.getAssumptionsRef();
<a name="l01935"></a>01935   <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Assumptions_1_1iterator.html" title="Iterator for the Assumptions: points to class Theorem.">Assumptions::iterator</a> i=assump.<a class="code" href="classCVC3_1_1Assumptions.html#ac3e7d0e1796c83edf687aac063bdba06">begin</a>(),iend=assump.<a class="code" href="classCVC3_1_1Assumptions.html#afc875bbe97e4e2d74a2cdc824f783bfb">end</a>();
<a name="l01936"></a>01936       i!=iend; ++i) {
<a name="l01937"></a>01937     <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict: adding &quot;</span>, *i, <span class="stringliteral">&quot;&quot;</span>);
<a name="l01938"></a>01938     stack.push_back(*i);
<a name="l01939"></a>01939   }
<a name="l01940"></a>01940       } <span class="keywordflow">else</span>
<a name="l01941"></a>01941   thm.setExpandFlag(<span class="keyword">false</span>);
<a name="l01942"></a>01942     }
<a name="l01943"></a>01943     <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict: end of while() }&quot;</span>);
<a name="l01944"></a>01944   }
<a name="l01945"></a>01945   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(maxScope != <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>()) conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#ad9da69b34ab2bab4192e5977e5c10498">printDebug</a>();)
<a name="l01946"></a>01946   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(maxScope == <a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>(), <span class="stringliteral">&quot;maxScope=&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(maxScope)
<a name="l01947"></a>01947         +<span class="stringliteral">&quot;, scopeLevel()=&quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="group__SE.html#gab267d9f29c30c8e26b5c7bcc4d15306a" title="Return the current scope level (for convenience)">scopeLevel</a>())
<a name="l01948"></a>01948         +<span class="stringliteral">&quot;\n maxScopeLit = &quot;</span>+maxScopeLit.toString());
<a name="l01949"></a>01949   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(
<a name="l01950"></a>01950     <span class="keywordflow">if</span>(!(maxScope == <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> || splitters.size() == 1)) {
<a name="l01951"></a>01951       conflictThm.<a class="code" href="classCVC3_1_1Theorem.html#ad9da69b34ab2bab4192e5977e5c10498">printDebug</a>();
<a name="l01952"></a>01952       ostream&amp; os = debugger.getOS();
<a name="l01953"></a>01953       os &lt;&lt; <span class="stringliteral">&quot;\n\nsplitters = [&quot;</span>;
<a name="l01954"></a>01954       <span class="keywordflow">for</span>(<span class="keywordtype">size_t</span> i=0; i&lt;splitters.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>(); ++i)
<a name="l01955"></a>01955   os &lt;&lt; splitters[i] &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;
<a name="l01956"></a>01956       os &lt;&lt; <span class="stringliteral">&quot;]&quot;</span> &lt;&lt; <a class="code" href="group__ExprStream__Manip.html#ga05b0ea7353ec24fa8e7e272d7a7875d8" title="Print the end-of-line.">endl</a>;
<a name="l01957"></a>01957     }
<a name="l01958"></a>01958     )
<a name="l01959"></a>01959   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(maxScope == <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> || splitters.size() == 1,
<a name="l01960"></a>01960           <span class="stringliteral">&quot;Wrong number of splitters found at maxScope=&quot;</span>
<a name="l01961"></a>01961           +<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(maxScope)
<a name="l01962"></a>01962           +<span class="stringliteral">&quot;: &quot;</span>+<a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(splitters.size())+<span class="stringliteral">&quot; splitters.&quot;</span>);
<a name="l01963"></a>01963   <a class="code" href="group__SE__Fast.html#gab27227ee9e005ab22a9e2a251bc7c6d1" title="The scope of the last conflict.">d_lastConflictScope</a> = maxScope;
<a name="l01964"></a>01964   <a class="code" href="group__SE__Fast.html#gaac9cb2de28ec162fe5ecfe042ad7b101" title="Analyse the conflict, find the UIPs, etc.">analyzeUIPs</a>(conflictThm, maxScope);
<a name="l01965"></a>01965   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;impl graph&quot;</span>, <span class="stringliteral">&quot;traceConflict =&gt; }&quot;</span>);
<a name="l01966"></a>01966 }
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Wed Sep 7 2011 for CVC3 by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>