Sophie

Sophie

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

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: clause.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">clause.cpp</div>  </div>
</div>
<div class="contents">
<a href="clause_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*****************************************************************************/</span><span class="comment"></span>
<a name="l00002"></a>00002 <span class="comment">/*!</span>
<a name="l00003"></a>00003 <span class="comment"> * \file clause.cpp</span>
<a name="l00004"></a>00004 <span class="comment"> * \brief Implementation of class Clause</span>
<a name="l00005"></a>00005 <span class="comment"> * </span>
<a name="l00006"></a>00006 <span class="comment"> * Author: Sergey Berezin</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> * Created: Mon Apr 28 17:20:23 2003</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00011"></a>00011 <span class="comment"> *</span>
<a name="l00012"></a>00012 <span class="comment"> * License to use, copy, modify, sell and/or distribute this software</span>
<a name="l00013"></a>00013 <span class="comment"> * and its documentation for any purpose is hereby granted without</span>
<a name="l00014"></a>00014 <span class="comment"> * royalty, subject to the terms and conditions defined in the \ref</span>
<a name="l00015"></a>00015 <span class="comment"> * LICENSE file provided with this distribution.</span>
<a name="l00016"></a>00016 <span class="comment"> * </span>
<a name="l00017"></a>00017 <span class="comment"> * &lt;hr&gt;</span>
<a name="l00018"></a>00018 <span class="comment"> * </span>
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020 <span class="comment">/*****************************************************************************/</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="clause_8h.html">clause.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;<a class="code" href="theory__core_8h.html">theory_core.h</a>&quot;</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="keyword">using namespace </span>std;
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 <span class="keyword">namespace </span>CVC3 {
<a name="l00028"></a>00028 <span class="comment"></span>
<a name="l00029"></a>00029 <span class="comment">////////////////////////////////////////////////////////////////////////</span>
<a name="l00030"></a>00030 <span class="comment"></span><span class="comment">//  class ClauseValue methods</span><span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment">////////////////////////////////////////////////////////////////////////</span>
<a name="l00032"></a>00032 <span class="comment"></span>
<a name="l00033"></a>00033 <span class="comment">// Constructor: takes the main clause theorem which must be a</span>
<a name="l00034"></a>00034 <span class="comment">// disjunction of literals and have no assumptions.</span>
<a name="l00035"></a><a class="code" href="classCVC3_1_1ClauseValue.html#a5b39de3e0284460be42cec3b89a90348">00035</a> ClauseValue::ClauseValue(<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 class="code" href="classCVC3_1_1VariableManager.html">VariableManager</a>* vm,
<a name="l00036"></a>00036        <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Theorem.html">Theorem</a>&amp; clause, <span class="keywordtype">int</span> scope)
<a name="l00037"></a>00037   : d_refcount(0), d_refcountOwner(0), d_thm(clause), d_scope(scope),
<a name="l00038"></a>00038     <span class="comment">// This backtrackable member is initialized in the first scope</span>
<a name="l00039"></a>00039     <span class="comment">// (which is #0)</span>
<a name="l00040"></a>00040     d_sat(core-&gt;getCM()-&gt;getCurrentContext(), false, 0),
<a name="l00041"></a>00041     d_deleted(false) {
<a name="l00042"></a>00042   <span class="comment">// Check the clause</span>
<a name="l00043"></a>00043   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(clause.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#ga36f1eff876808586db368dc1b6da5f56">isOr</a>(), <span class="stringliteral">&quot;Clause(): bad clause given: &quot;</span>
<a name="l00044"></a>00044         + clause.<a class="code" href="classCVC3_1_1Theorem.html#ac4b1c9570ffb9cc901627ef2abb9ff77">toString</a>());
<a name="l00045"></a>00045 <span class="comment">//   DebugAssert(clause.getExpr().arity()&gt;0, &quot;Clause(): empty clause: &quot;</span>
<a name="l00046"></a>00046 <span class="comment">//        + clause.toString());</span>
<a name="l00047"></a>00047   <span class="comment">// Initialize watched literals to the edges with directions</span>
<a name="l00048"></a>00048   <span class="comment">// pointing outwards</span>
<a name="l00049"></a>00049   <a class="code" href="classCVC3_1_1ClauseValue.html#a4080e117c47d6416c256e6a7c5d9f7e7">d_wp</a>[0]=0; <a class="code" href="classCVC3_1_1ClauseValue.html#a6ccefdca104c4a24a2f45c65db8c3be0">d_dir</a>[0]=-1;
<a name="l00050"></a>00050   d_wp[1] = clause.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>().<a class="code" href="group__ExprPkg.html#ga28b901d05e52a5c646f83a95cc74f94b">arity</a>()-1; <a class="code" href="classCVC3_1_1ClauseValue.html#a6ccefdca104c4a24a2f45c65db8c3be0">d_dir</a>[1]=1;
<a name="l00051"></a>00051   <span class="comment">// Initialize the literals</span>
<a name="l00052"></a>00052   <a class="code" href="classCVC3_1_1Expr.html" title="Data structure of expressions in CVC3.">Expr</a> c(clause.<a class="code" href="classCVC3_1_1Theorem.html#af2b97ae5d270ddf1013bf4f3867a7e5d">getExpr</a>());
<a name="l00053"></a>00053   <a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>.reserve(c.arity());
<a name="l00054"></a>00054   <span class="keywordflow">for</span>(<a class="code" href="classCVC3_1_1Expr_1_1iterator.html">Expr::iterator</a> i=c.begin(), iend=c.end(); i!=iend; ++i) {
<a name="l00055"></a>00055     <span class="keywordtype">int</span> val(i-&gt;isNot()? -1 : 1);
<a name="l00056"></a>00056     <a class="code" href="classCVC3_1_1Variable.html">Variable</a> v(vm, (val &lt; 0)? (*i)[0] : (*i));
<a name="l00057"></a>00057     <a class="code" href="classCVC3_1_1Literal.html">Literal</a> l(v, val &gt; 0);
<a name="l00058"></a>00058     <a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>.push_back(l);
<a name="l00059"></a>00059     <span class="comment">// Update the literal&#39;s count for splitter heuristics</span>
<a name="l00060"></a>00060     l.<a class="code" href="classCVC3_1_1Literal.html#a4823b2e9ec3a6a13a28c209d22269564">count</a>()++;
<a name="l00061"></a>00061   }
<a name="l00062"></a>00062   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<a class="code" href="classCVC3_1_1ClauseValue.html#ae187971f8c1759d203d4d207923eb186">d_sat</a>.setName(<span class="stringliteral">&quot;CDO[Clause.d_sat]&quot;</span>);)
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064 
<a name="l00065"></a><a class="code" href="classCVC3_1_1ClauseValue.html#aad3b57cc63ad2bc763022112de4899bf">00065</a> <a class="code" href="classCVC3_1_1ClauseValue.html">ClauseValue</a>::~<a class="code" href="classCVC3_1_1ClauseValue.html#aa9a93c758484961cc52689f2660caed2">ClauseValue</a>() {
<a name="l00066"></a>00066   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;~ClauseValue() {&quot;</span>);
<a name="l00067"></a>00067   <a class="code" href="debug_8h.html#a2637b2fffa22e3c9fad40cda8fcc3bce" title="If something goes horribly wrong, print a message and abort immediately with exit(1).">FatalAssert</a>(<a class="code" href="classCVC3_1_1ClauseValue.html#a2002fbd254e10953e689c49c3717aab3" title="Ref. counter.">d_refcount</a> == 0, <span class="stringliteral">&quot;~ClauseValue: non-zero refcount: &quot;</span>
<a name="l00068"></a>00068          + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(<a class="code" href="classCVC3_1_1ClauseValue.html#a2002fbd254e10953e689c49c3717aab3" title="Ref. counter.">d_refcount</a>));
<a name="l00069"></a>00069   <span class="keywordflow">if</span>(!<a class="code" href="classCVC3_1_1ClauseValue.html#a648d7b3be67a263a2d1b0938880f2c48">d_deleted</a>) { <span class="comment">// Update the literal counts for splitter heuristics</span>
<a name="l00070"></a>00070     <span class="keywordflow">for</span>(vector&lt;Literal&gt;::iterator i=<a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>.begin(),
<a name="l00071"></a>00071     iend=<a class="code" href="classCVC3_1_1ClauseValue.html#a6696e3c06ab4301893d759559470f917">d_literals</a>.end(); i!=iend; ++i) {
<a name="l00072"></a>00072       i-&gt;count()--;
<a name="l00073"></a>00073       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(i-&gt;count() == 0)
<a name="l00074"></a>00074          <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Null count for &quot;</span>, *i, <span class="stringliteral">&quot;&quot;</span>);)
<a name="l00075"></a>00075     }
<a name="l00076"></a>00076   }
<a name="l00077"></a>00077   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;~ClauseValue() =&gt; }&quot;</span>);
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079   <span class="comment"></span>
<a name="l00080"></a>00080 <span class="comment">////////////////////////////////////////////////////////////////////////</span>
<a name="l00081"></a>00081 <span class="comment"></span><span class="comment">//  class Clause methods</span><span class="comment"></span>
<a name="l00082"></a>00082 <span class="comment">////////////////////////////////////////////////////////////////////////</span>
<a name="l00083"></a>00083 <span class="comment"></span>
<a name="l00084"></a>00084 <span class="comment">// Destructor</span>
<a name="l00085"></a><a class="code" href="classCVC3_1_1Clause.html#aacf7ed78bdf948f49fc3eec100b1213b">00085</a> <a class="code" href="classCVC3_1_1Clause.html#aacf7ed78bdf948f49fc3eec100b1213b">Clause::~Clause</a>() {
<a name="l00086"></a>00086   <span class="keywordflow">if</span>(d_clause != NULL) {
<a name="l00087"></a>00087     <a class="code" href="debug_8h.html#a2637b2fffa22e3c9fad40cda8fcc3bce" title="If something goes horribly wrong, print a message and abort immediately with exit(1).">FatalAssert</a>(d_clause-&gt;d_refcount &gt; 0,
<a name="l00088"></a>00088     <span class="stringliteral">&quot;~Clause: non-positive refcount: &quot;</span>
<a name="l00089"></a>00089     + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(d_clause-&gt;d_refcount));
<a name="l00090"></a>00090     <span class="keywordflow">if</span>(--(d_clause-&gt;d_refcount) == 0) <span class="keyword">delete</span> d_clause;
<a name="l00091"></a>00091   }
<a name="l00092"></a>00092 }
<a name="l00093"></a>00093 
<a name="l00094"></a>00094 
<a name="l00095"></a>00095 <span class="keywordtype">void</span>
<a name="l00096"></a><a class="code" href="classCVC3_1_1Clause.html#a47d7c887d12dce3ad803bd7e9fbdefe8">00096</a> <a class="code" href="classCVC3_1_1Clause.html#a47d7c887d12dce3ad803bd7e9fbdefe8">Clause::markDeleted</a>()<span class="keyword"> const </span>{
<a name="l00097"></a>00097   <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Clause::markDeleted(&quot;</span>,
<a name="l00098"></a>00098   <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>(*<span class="keyword">this</span>), <span class="stringliteral">&quot;) {&quot;</span>);
<a name="l00099"></a>00099   <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(!isNull(), <span class="stringliteral">&quot;Clause::markDeleted()&quot;</span>);
<a name="l00100"></a>00100   <span class="keywordflow">if</span>(!d_clause-&gt;d_deleted) {
<a name="l00101"></a>00101     d_clause-&gt;d_deleted = <span class="keyword">true</span>;
<a name="l00102"></a>00102     <span class="comment">// Update the literal counts for splitter heuristics</span>
<a name="l00103"></a>00103     <span class="keywordflow">for</span>(vector&lt;Literal&gt;::iterator i=d_clause-&gt;d_literals.begin(),
<a name="l00104"></a>00104     iend=d_clause-&gt;d_literals.end(); i!=iend; ++i) {
<a name="l00105"></a>00105       i-&gt;count()--;
<a name="l00106"></a>00106       <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(i-&gt;count() == 0)
<a name="l00107"></a>00107          <a class="code" href="kinds_8h.html#aa10c9e8951b8ccf714a59ec321bdac5ba7fa27e82c6c4f69434225ed81e5d151e">TRACE</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Null count for &quot;</span>, *i, <span class="stringliteral">&quot;&quot;</span>);)
<a name="l00108"></a>00108     }
<a name="l00109"></a>00109   }
<a name="l00110"></a>00110   <a class="code" href="debug_8h.html#ad64155edafde9f067f4868817cd04bdf">TRACE_MSG</a>(<span class="stringliteral">&quot;search literals&quot;</span>, <span class="stringliteral">&quot;Clause::markDeleted =&gt; }&quot;</span>);
<a name="l00111"></a>00111 }
<a name="l00112"></a>00112 
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="comment">// Assignment operator</span>
<a name="l00115"></a><a class="code" href="classCVC3_1_1Clause.html#aeba63913bd39d5a49979459c4a6b5b52">00115</a> <a class="code" href="classCVC3_1_1Clause.html" title="A class representing a CNF clause (a smart pointer)">Clause</a>&amp; <a class="code" href="classCVC3_1_1ClauseValue.html#aaee74fca4faa432a4a86c80f1569586a">Clause::operator=</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="l00116"></a>00116   <span class="keywordflow">if</span>(&amp;c == <span class="keyword">this</span>) <span class="keywordflow">return</span> *<span class="keyword">this</span>; <span class="comment">// Self-assignment</span>
<a name="l00117"></a>00117   <span class="keywordflow">if</span>(d_clause != NULL) {
<a name="l00118"></a>00118     <a class="code" href="debug_8h.html#a40dac3bdb2166ffc852ee8b1489d2b56">DebugAssert</a>(d_clause-&gt;d_refcount &gt; 0,
<a name="l00119"></a>00119     <span class="stringliteral">&quot;Clause::operator=: non-positive refcount: &quot;</span>
<a name="l00120"></a>00120     + <a class="code" href="namespaceCVC3.html#af69618103f1f0f2eadada0796a2a940c">int2string</a>(d_clause-&gt;d_refcount));
<a name="l00121"></a>00121     <span class="keywordflow">if</span>(--(d_clause-&gt;d_refcount) == 0) <span class="keyword">delete</span> d_clause;
<a name="l00122"></a>00122   }
<a name="l00123"></a>00123   d_clause = c.<a class="code" href="classCVC3_1_1Clause.html#a5455f3993d1b7d6c9e8f3731a7d260cc" title="The only value member.">d_clause</a>;
<a name="l00124"></a>00124   <span class="keywordflow">if</span>(d_clause != NULL) d_clause-&gt;<a class="code" href="classCVC3_1_1ClauseValue.html#a2002fbd254e10953e689c49c3717aab3" title="Ref. counter.">d_refcount</a>++;
<a name="l00125"></a>00125   <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00126"></a>00126 }
<a name="l00127"></a>00127 
<a name="l00128"></a>00128 <span class="comment">// Printing</span>
<a name="l00129"></a><a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">00129</a> <span class="keywordtype">string</span> <a class="code" href="classCVC3_1_1Clause.html#a97eeb3430667cd3c05a3c977d7285102">Clause::toString</a>()<span class="keyword"> const </span>{
<a name="l00130"></a>00130   std::ostringstream ss;
<a name="l00131"></a>00131   ss &lt;&lt; *<span class="keyword">this</span>;
<a name="l00132"></a>00132   <span class="keywordflow">return</span> ss.str();
<a name="l00133"></a>00133 }
<a name="l00134"></a>00134 
<a name="l00135"></a><a class="code" href="namespaceCVC3.html#a388a4b259709c19cdba987c75c8c624c">00135</a> ostream&amp; <a class="code" href="namespaceCVC3.html#a6b7e38d3c97da1e91e12a6c9555b8163">operator&lt;&lt;</a>(ostream&amp; os, <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="l00136"></a>00136   <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1Clause.html#a60c298aa79d5cec791f8eeef2086e92f">isNull</a>()) <span class="keywordflow">return</span> os &lt;&lt; <span class="stringliteral">&quot;Clause[Null]&quot;</span>;
<a name="l00137"></a>00137   os &lt;&lt; <span class="stringliteral">&quot;Clause[&quot;</span>;
<a name="l00138"></a>00138   <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1Clause.html#a420281d9272ac052c75859be690bfd4d">deleted</a>()) os &lt;&lt; <span class="stringliteral">&quot;DELETED &quot;</span>;
<a name="l00139"></a>00139   os &lt;&lt; c.<a class="code" href="classCVC3_1_1Clause.html#a3b3fad14d36eec81247fb512acc73b41">id</a>();
<a name="l00140"></a>00140   <a class="code" href="debug_8h.html#a600cb2d68efe7cc413cccbb5714c7016">IF_DEBUG</a>(<span class="keywordflow">if</span>(c.getFile() != <span class="stringliteral">&quot;&quot;</span>)
<a name="l00141"></a>00141      os &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; c.getFile() &lt;&lt; <span class="stringliteral">&quot;:&quot;</span> &lt;&lt; c.getLine();)
<a name="l00142"></a>00142   os &lt;&lt; <span class="stringliteral">&quot;](&quot;</span> &lt;&lt; c.<a class="code" href="classCVC3_1_1Clause.html#aa933cec7528780d7971be0c10b76dc02">getTheorem</a>()
<a name="l00143"></a>00143      &lt;&lt; <span class="stringliteral">&quot;;\n&quot;</span>;
<a name="l00144"></a>00144   <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(0) == c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(1)) os &lt;&lt; <span class="stringliteral">&quot;WARNING: wp[0] = wp[1]\n&quot;</span>;
<a name="l00145"></a>00145   <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="l00146"></a>00146     <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(0) == i)
<a name="l00147"></a>00147       os &lt;&lt; <span class="stringliteral">&quot;wp[0]&quot;</span> &lt;&lt; ((c.<a class="code" href="classCVC3_1_1Clause.html#a4c9a2e81c05572893ba1a3b09526d172">dir</a>(0) &gt; 0)? <span class="stringliteral">&quot;=&gt;&quot;</span> : <span class="stringliteral">&quot;&lt;=&quot;</span>) &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;
<a name="l00148"></a>00148     <span class="keywordflow">else</span> <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(1) == i)
<a name="l00149"></a>00149       os &lt;&lt; <span class="stringliteral">&quot;wp[1]&quot;</span> &lt;&lt; ((c.<a class="code" href="classCVC3_1_1Clause.html#a4c9a2e81c05572893ba1a3b09526d172">dir</a>(1) &gt; 0)? <span class="stringliteral">&quot;=&gt;&quot;</span> : <span class="stringliteral">&quot;&lt;=&quot;</span>) &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;
<a name="l00150"></a>00150     <span class="keywordflow">else</span>
<a name="l00151"></a>00151       os &lt;&lt; <span class="stringliteral">&quot;        &quot;</span>;
<a name="l00152"></a>00152     os &lt;&lt; c[i] &lt;&lt; <span class="stringliteral">&quot;;\n&quot;</span>;
<a name="l00153"></a>00153   }
<a name="l00154"></a>00154   <span class="keywordflow">return</span> os &lt;&lt; ((c.<a class="code" href="classCVC3_1_1Clause.html#a1e5660eadbc4e0c0ad18c6a9aae45d39" title="Check if the clause marked as SAT.">sat</a>())? <span class="stringliteral">&quot;Clause is SAT&quot;</span> : <span class="stringliteral">&quot;&quot;</span>) &lt;&lt; <span class="stringliteral">&quot;)&quot;</span>;
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156   
<a name="l00157"></a><a class="code" href="namespaceCVC3.html#afa4d0fe856c97c30a028eb733ddb3a17">00157</a>   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="namespaceCVC3.html#afa4d0fe856c97c30a028eb733ddb3a17">printLit</a>(ostream&amp; os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1Literal.html">Literal</a>&amp; l) {
<a name="l00158"></a>00158     <span class="keywordflow">if</span>(l.<a class="code" href="classCVC3_1_1Literal.html#aad653dd8534feb823b9d30f060b4e181">isNegative</a>()) os &lt;&lt; <span class="stringliteral">&quot;!&quot;</span>;
<a name="l00159"></a>00159     os &lt;&lt; l.<a class="code" href="classCVC3_1_1Literal.html#af43cfe38032a00cc8e8e60b0389eeb3e">getVar</a>().<a class="code" href="classCVC3_1_1Variable.html#af85a6bbfd1529fce66f70d0012556fdf">getExpr</a>();
<a name="l00160"></a>00160     <span class="keywordtype">int</span> val(l.<a class="code" href="classCVC3_1_1Literal.html#a48feb6e7cf83b3a59b94ca0e75627d0f">getValue</a>());
<a name="l00161"></a>00161     <span class="keywordflow">if</span>(val != 0) os &lt;&lt; <span class="stringliteral">&quot;=&quot;</span> &lt;&lt; val &lt;&lt; <span class="stringliteral">&quot;@&quot;</span> &lt;&lt; l.<a class="code" href="classCVC3_1_1Literal.html#a2abe99239ecdf75235e242282cd672f2">getScope</a>();
<a name="l00162"></a>00162   }
<a name="l00163"></a>00163 
<a name="l00164"></a><a class="code" href="namespaceCVC3.html#a6cd79d19af94cb4c4457a85371999cdc">00164</a> ostream&amp; <a class="code" href="namespaceCVC3.html#a6b7e38d3c97da1e91e12a6c9555b8163">operator&lt;&lt;</a>(std::ostream&amp; os, <span class="keyword">const</span> <a class="code" href="classCVC3_1_1CompactClause.html">CompactClause</a>&amp; c) {
<a name="l00165"></a>00165   <span class="keyword">const</span> vector&lt;Literal&gt;&amp; lits = c.<a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>.<a class="code" href="classCVC3_1_1Clause.html#afbdcb9cd34cb4ff3e14f2e5aace81d7e">getLiterals</a>();
<a name="l00166"></a>00166   <span class="keywordtype">int</span> wp0(c.<a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(0)), wp1(c.<a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>.<a class="code" href="classCVC3_1_1Clause.html#ad399ff73eb62edf9cc4d1135e91afdcb">wp</a>(1));
<a name="l00167"></a>00167   <span class="keywordtype">int</span> i=0, iend=c.<a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>.<a class="code" href="classCVC3_1_1Clause.html#a7cfde40c65fc8eb4f733094fad07dfa1">size</a>();
<a name="l00168"></a>00168   os &lt;&lt; <span class="stringliteral">&quot;Clause[&quot;</span>;
<a name="l00169"></a>00169   <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>.<a class="code" href="classCVC3_1_1Clause.html#a420281d9272ac052c75859be690bfd4d">deleted</a>()) os &lt;&lt; <span class="stringliteral">&quot;*DELETED* &quot;</span>;
<a name="l00170"></a>00170   <span class="keywordflow">if</span>(c.<a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>.<a class="code" href="classCVC3_1_1Clause.html#a4be95d5cff0e0ffb20f01f8c2036caa3" title="Tell how many owners this clause has (for debugging)">owners</a>() &gt; 0) os &lt;&lt; <span class="stringliteral">&quot;owned(&quot;</span> &lt;&lt; c.<a class="code" href="classCVC3_1_1CompactClause.html#a882f0ed8565e078ac1a1cd2c524ed059">d_clause</a>.<a class="code" href="classCVC3_1_1Clause.html#a4be95d5cff0e0ffb20f01f8c2036caa3" title="Tell how many owners this clause has (for debugging)">owners</a>() &lt;&lt; <span class="stringliteral">&quot;) &quot;</span>;
<a name="l00171"></a>00171   <span class="keywordflow">if</span>(i!=iend) {
<a name="l00172"></a>00172     <span class="keywordflow">if</span>(i==wp0 || i==wp1) os &lt;&lt; <span class="stringliteral">&quot;*&quot;</span>;
<a name="l00173"></a>00173     <a class="code" href="namespaceCVC3.html#afa4d0fe856c97c30a028eb733ddb3a17">printLit</a>(os, lits[i]);  ++i; 
<a name="l00174"></a>00174   }
<a name="l00175"></a>00175   <span class="keywordflow">for</span>(; i!=iend; ++i) {
<a name="l00176"></a>00176     os &lt;&lt; <span class="stringliteral">&quot;, &quot;</span>;
<a name="l00177"></a>00177     <span class="keywordflow">if</span>(i==wp0 || i==wp1) os &lt;&lt; <span class="stringliteral">&quot;*&quot;</span>;
<a name="l00178"></a>00178     <a class="code" href="namespaceCVC3.html#afa4d0fe856c97c30a028eb733ddb3a17">printLit</a>(os, lits[i]);
<a name="l00179"></a>00179   }
<a name="l00180"></a>00180   os &lt;&lt; <span class="stringliteral">&quot;]&quot;</span>;
<a name="l00181"></a>00181   <span class="keywordflow">return</span> os;
<a name="l00182"></a>00182 }
<a name="l00183"></a>00183 
<a name="l00184"></a><a class="code" href="classCVC3_1_1CompactClause.html#abb55c9dc63b8ac52030738cbacea0141">00184</a> <span class="keywordtype">string</span> <a class="code" href="classCVC3_1_1CompactClause.html#abb55c9dc63b8ac52030738cbacea0141">CompactClause::toString</a>()<span class="keyword"> const </span>{
<a name="l00185"></a>00185   ostringstream ss;
<a name="l00186"></a>00186   ss &lt;&lt; (*this);
<a name="l00187"></a>00187   <span class="keywordflow">return</span> ss.str();
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00190"></a>00190 <span class="preprocessor">#ifdef _CVC3_DEBUG_MODE</span>
<a name="l00191"></a>00191 <span class="preprocessor"></span><span class="keywordtype">bool</span> CVC3::Clause::wpCheck()<span class="keyword"> const</span>
<a name="l00192"></a>00192 <span class="keyword"></span>{
<a name="l00193"></a>00193   <span class="keywordflow">if</span> (sat(<span class="keyword">true</span>))
<a name="l00194"></a>00194     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00195"></a>00195   <span class="keywordflow">return</span> (getLiteral(wp(0)).getValue() == 0 &amp;&amp; getLiteral(wp(1)).getValue() == 0);
<a name="l00196"></a>00196 }
<a name="l00197"></a>00197 <span class="preprocessor">#endif</span>
<a name="l00198"></a>00198 <span class="preprocessor"></span>
<a name="l00199"></a>00199 } <span class="comment">// end of namespace CVC3</span>
</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>