mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-07 03:35:38 -05:00
8 lines
No EOL
5.9 KiB
HTML
8 lines
No EOL
5.9 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Term (sidekick-bin.Sidekick_smtlib.Process.Solver.T.Term)</title><link rel="stylesheet" href="../../../../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../../../../index.html">sidekick-bin</a> » <a href="../../../../index.html">Sidekick_smtlib</a> » <a href="../../../index.html">Process</a> » <a href="../../index.html">Solver</a> » <a href="../index.html">T</a> » Term</nav><h1>Module <code>T.Term</code></h1><p>Term structure.</p><p>Terms should be <b>hashconsed</b>, with perfect sharing. This allows, for example, <a href="Tbl/index.html"><code>Term.Tbl</code></a> and <a href="index.html#val-iter_dag"><code>Term.iter_dag</code></a> to be efficient.</p></header><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code><code> = <a href="../../../../../../sidekick-base/Sidekick_base__Base_types/Term/index.html#type-t">Sidekick_base.Term.t</a></code></dt></dl><dl><dt class="spec value" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span class="keyword">val</span> equal : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt><dt class="spec value" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span class="keyword">val</span> compare : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> int</code></dt><dt class="spec value" id="val-hash"><a href="#val-hash" class="anchor"></a><code><span class="keyword">val</span> hash : <a href="index.html#type-t">t</a> <span>-></span> int</code></dt><dt class="spec value" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span class="keyword">val</span> pp : <span><a href="index.html#type-t">t</a> <a href="../../../../../../sidekick/Sidekick_core/index.html#module-Fmt">Sidekick_core.Fmt</a>.printer</span></code></dt></dl><dl><dt class="spec type" id="type-store"><a href="#type-store" class="anchor"></a><code><span class="keyword">type</span> store</code><code> = <a href="../../../../../../sidekick-base/Sidekick_base__Base_types/Term/index.html#type-store">Sidekick_base.Term.store</a></code></dt><dd><p>A store used to create new terms. It is where the hashconsing table should live, along with other all-terms related store.</p></dd></dl><dl><dt class="spec value" id="val-ty"><a href="#val-ty" class="anchor"></a><code><span class="keyword">val</span> ty : <a href="index.html#type-t">t</a> <span>-></span> <a href="../Ty/index.html#type-t">Ty.t</a></code></dt><dt class="spec value" id="val-bool"><a href="#val-bool" class="anchor"></a><code><span class="keyword">val</span> bool : <a href="index.html#type-store">store</a> <span>-></span> bool <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>build true/false</p></dd></dl><dl><dt class="spec value" id="val-as_bool"><a href="#val-as_bool" class="anchor"></a><code><span class="keyword">val</span> as_bool : <a href="index.html#type-t">t</a> <span>-></span> <span>bool option</span></code></dt><dd><p><code>as_bool t</code> is <code>Some true</code> if <code>t</code> is the term <code>true</code>, and similarly for <code>false</code>. For other terms it is <code>None</code>.</p></dd></dl><dl><dt class="spec value" id="val-abs"><a href="#val-abs" class="anchor"></a><code><span class="keyword">val</span> abs : <a href="index.html#type-store">store</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> * bool</code></dt><dd><p><code>abs t</code> returns an "absolute value" for the term, along with the sign of <code>t</code>.</p><p>The idea is that we want to turn <code>not a</code> into <code>(a, false)</code>, or <code>(a != b)</code> into <code>(a=b, false)</code>. For terms without a negation this should return <code>(t, true)</code>.</p><p>The store is passed in case a new term needs to be created.</p></dd></dl><dl><dt class="spec value" id="val-map_shallow"><a href="#val-map_shallow" class="anchor"></a><code><span class="keyword">val</span> map_shallow : <a href="index.html#type-store">store</a> <span>-></span> <span>(<a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a>)</span> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>Map function on immediate subterms. This should not be recursive.</p></dd></dl><dl><dt class="spec value" id="val-iter_dag"><a href="#val-iter_dag" class="anchor"></a><code><span class="keyword">val</span> iter_dag : <a href="index.html#type-t">t</a> <span>-></span> <span>(<a href="index.html#type-t">t</a> <span>-></span> unit)</span> <span>-></span> unit</code></dt><dd><p><code>iter_dag t f</code> calls <code>f</code> once on each subterm of <code>t</code>, <code>t</code> included. It must <b>not</b> traverse <code>t</code> as a tree, but rather as a perfectly shared DAG.</p><p>For example, in:</p><pre><code class="ml">let x = 2 in
|
||
let y = f x x in
|
||
let z = g y x in
|
||
z = z</code></pre><p>the DAG has the following nodes:</p><pre><code class="ml">n1: 2
|
||
n2: f n1 n1
|
||
n3: g n2 n1
|
||
n4: = n3 n3</code></pre></dd></dl><div class="spec module" id="module-Tbl"><a href="#module-Tbl" class="anchor"></a><code><span class="keyword">module</span> Tbl : CCHashtbl.S <span class="keyword">with</span> <span class="keyword">type</span> <a href="index.html#module-Tbl">Tbl</a>.key = <a href="index.html#type-t">t</a></code></div></div></body></html> |