mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-07 03:35:38 -05:00
2 lines
No EOL
15 KiB
HTML
2 lines
No EOL
15 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Make_cdcl_t (sidekick.Sidekick_sat.Solver.Make_cdcl_t)</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</a> » <a href="../../index.html">Sidekick_sat</a> » <a href="../index.html">Solver</a> » Make_cdcl_t</nav><h1>Module <code>Solver.Make_cdcl_t</code></h1><nav class="toc"><ul><li><a href="#internal-modules">Internal modules</a></li><li><a href="#clause-pools">Clause Pools</a></li><li><a href="#types">Types</a></li><li><a href="#base-operations">Base operations</a></li></ul></nav></header><h3 class="heading">Parameters</h3><ul><li><code><a href="argument-1-Th/index.html">Th</a> : <a href="../../Solver_intf/index.html#module-type-PLUGIN_CDCL_T">Solver_intf.PLUGIN_CDCL_T</a></code></li></ul><h3 class="heading">Signature</h3><section><header><h3 id="internal-modules"><a href="#internal-modules" class="anchor"></a>Internal modules</h3><p>These are the internal modules used, you should probably not use them if you're not familiar with the internals of mSAT.</p></header><dl><dt class="spec type" id="type-lit"><a href="#type-lit" class="anchor"></a><code><span class="keyword">type</span> lit</code><code> = <a href="argument-1-Th/index.html#type-lit">Th.lit</a></code></dt><dd><p>literals</p></dd></dl><div class="spec module" id="module-Lit"><a href="#module-Lit" class="anchor"></a><code><span class="keyword">module</span> Lit = <a href="argument-1-Th/index.html#module-Lit">Th.Lit</a></code></div><dl><dt class="spec type" id="type-clause"><a href="#type-clause" class="anchor"></a><code><span class="keyword">type</span> clause</code></dt><dt class="spec type" id="type-clause_pool_id"><a href="#type-clause_pool_id" class="anchor"></a><code><span class="keyword">type</span> clause_pool_id</code></dt><dd><p>Pool of clauses, with its own lifetime management</p></dd></dl><dl><dt class="spec type" id="type-theory"><a href="#type-theory" class="anchor"></a><code><span class="keyword">type</span> theory</code><code> = <a href="argument-1-Th/index.html#type-t">Th.t</a></code></dt><dt class="spec type" id="type-proof"><a href="#type-proof" class="anchor"></a><code><span class="keyword">type</span> proof</code><code> = <a href="argument-1-Th/index.html#type-proof">Th.proof</a></code></dt><dd><p>A representation of a full proof</p></dd></dl><dl><dt class="spec type" id="type-dproof"><a href="#type-dproof" class="anchor"></a><code><span class="keyword">type</span> dproof</code><code> = <a href="index.html#type-proof">proof</a> <span>-></span> unit</code></dt><dt class="spec type" id="type-solver"><a href="#type-solver" class="anchor"></a><code><span class="keyword">type</span> solver</code></dt><dd><p>The main solver type.</p></dd></dl><dl><dt class="spec type" id="type-store"><a href="#type-store" class="anchor"></a><code><span class="keyword">type</span> store</code></dt><dd><p>Stores atoms, clauses, etc.</p></dd></dl><div class="spec module" id="module-Clause"><a href="#module-Clause" class="anchor"></a><code><span class="keyword">module</span> <a href="Clause/index.html">Clause</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></div><dl><dt class="spec module" id="module-Proof"><a href="#module-Proof" class="anchor"></a><code><span class="keyword">module</span> Proof = <a href="argument-1-Th/index.html#module-Proof">Th.Proof</a></code></dt><dd><p>A module to manipulate proofs.</p></dd></dl><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="index.html#type-solver">solver</a></code></dt><dd><p>Main solver type, containing all state for solving.</p></dd></dl><dl><dt class="spec value" id="val-create"><a href="#val-create" class="anchor"></a><code><span class="keyword">val</span> create : <span>?⁠on_conflict:<span>(<a href="index.html#type-t">t</a> <span>-></span> <a href="Clause/index.html#type-t">Clause.t</a> <span>-></span> unit)</span></span> <span>-></span> <span>?⁠on_decision:<span>(<a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-lit">lit</a> <span>-></span> unit)</span></span> <span>-></span> <span>?⁠on_learnt:<span>(<a href="index.html#type-t">t</a> <span>-></span> <a href="Clause/index.html#type-t">Clause.t</a> <span>-></span> unit)</span></span> <span>-></span> <span>?⁠on_gc:<span>(<a href="index.html#type-t">t</a> <span>-></span> <span><a href="index.html#type-lit">lit</a> array</span> <span>-></span> unit)</span></span> <span>-></span> <span>?⁠stat:<a href="../../../Sidekick_util/Stat/index.html#type-t">Sidekick_util.Stat.t</a></span> <span>-></span> <span>?⁠size:<span>[ `Tiny <span>| `Small</span> <span>| `Big</span> ]</span></span> <span>-></span> <span>proof:<a href="Proof/index.html#type-t">Proof.t</a></span> <span>-></span> <a href="index.html#type-theory">theory</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>Create new solver</p><dl><dt>parameter theory</dt><dd><p>the theory</p></dd></dl><dl><dt>parameter the</dt><dd><p>proof</p></dd></dl><dl><dt>parameter size</dt><dd><p>the initial size of internal data structures. The bigger, the faster, but also the more RAM it uses.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-theory"><a href="#val-theory" class="anchor"></a><code><span class="keyword">val</span> theory : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-theory">theory</a></code></dt><dd><p>Access the theory state</p></dd></dl><dl><dt class="spec value" id="val-store"><a href="#val-store" class="anchor"></a><code><span class="keyword">val</span> store : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-store">store</a></code></dt><dd><p>Store for the solver</p></dd></dl><dl><dt class="spec value" id="val-stat"><a href="#val-stat" class="anchor"></a><code><span class="keyword">val</span> stat : <a href="index.html#type-t">t</a> <span>-></span> <a href="../../../Sidekick_util/Stat/index.html#type-t">Sidekick_util.Stat.t</a></code></dt><dd><p>Statistics</p></dd></dl><dl><dt class="spec value" id="val-proof"><a href="#val-proof" class="anchor"></a><code><span class="keyword">val</span> proof : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-proof">proof</a></code></dt><dd><p>Access the inner proof</p></dd></dl></section><section><header><h3 id="clause-pools"><a href="#clause-pools" class="anchor"></a>Clause Pools</h3></header><aside><p>Clause pools.</p><p>A clause pool holds/owns a set of clauses, and is responsible for managing their lifetime. We only expose an id, not a private type.</p></aside><dl><dt class="spec value" id="val-clause_pool_descr"><a href="#val-clause_pool_descr" class="anchor"></a><code><span class="keyword">val</span> clause_pool_descr : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-clause_pool_id">clause_pool_id</a> <span>-></span> string</code></dt><dt class="spec value" id="val-new_clause_pool_gc_fixed_size"><a href="#val-new_clause_pool_gc_fixed_size" class="anchor"></a><code><span class="keyword">val</span> new_clause_pool_gc_fixed_size : <span>descr:string</span> <span>-></span> <span>size:int</span> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-clause_pool_id">clause_pool_id</a></code></dt><dd><p>Allocate a new clause pool that GC's its clauses when its size goes above <code>size</code>. It keeps half of the clauses.</p></dd></dl></section><section><header><h3 id="types"><a href="#types" class="anchor"></a>Types</h3></header><dl><dt class="spec type" id="type-res"><a href="#type-res" class="anchor"></a><code><span class="keyword">type</span> res</code><code> = </code><table class="variant"><tr id="type-res.Sat" class="anchored"><td class="def constructor"><a href="#type-res.Sat" class="anchor"></a><code>| </code><code><span class="constructor">Sat</span> <span class="keyword">of</span> <span><a href="index.html#type-lit">lit</a> <a href="../../Solver_intf/index.html#type-sat_state">Solver_intf.sat_state</a></span></code></td><td class="doc"><p>Returned when the solver reaches SAT, with a model</p></td></tr><tr id="type-res.Unsat" class="anchored"><td class="def constructor"><a href="#type-res.Unsat" class="anchor"></a><code>| </code><code><span class="constructor">Unsat</span> <span class="keyword">of</span> <span><span>(<a href="index.html#type-lit">lit</a>, <a href="index.html#type-clause">clause</a>)</span> <a href="../../Solver_intf/index.html#type-unsat_state">Solver_intf.unsat_state</a></span></code></td><td class="doc"><p>Returned when the solver reaches UNSAT, with a proof</p></td></tr></table></dt><dd><p>Result type for the solver</p></dd></dl><dl><dt class="spec exception" id="exception-UndecidedLit"><a href="#exception-UndecidedLit" class="anchor"></a><code><span class="keyword">exception</span> </code><code><span class="exception">UndecidedLit</span></code></dt><dd><p>Exception raised by the evaluating functions when a literal has not yet been assigned a value.</p></dd></dl></section><section><header><h3 id="base-operations"><a href="#base-operations" class="anchor"></a>Base operations</h3></header><dl><dt class="spec value" id="val-assume"><a href="#val-assume" class="anchor"></a><code><span class="keyword">val</span> assume : <a href="index.html#type-t">t</a> <span>-></span> <span><span><a href="index.html#type-lit">lit</a> list</span> list</span> <span>-></span> unit</code></dt><dd><p>Add the list of clauses to the current set of assumptions. Modifies the sat solver state in place.</p></dd></dl><dl><dt class="spec value" id="val-add_clause"><a href="#val-add_clause" class="anchor"></a><code><span class="keyword">val</span> add_clause : <a href="index.html#type-t">t</a> <span>-></span> <span><a href="index.html#type-lit">lit</a> list</span> <span>-></span> <a href="index.html#type-dproof">dproof</a> <span>-></span> unit</code></dt><dd><p>Lower level addition of clauses</p></dd></dl><dl><dt class="spec value" id="val-add_clause_a"><a href="#val-add_clause_a" class="anchor"></a><code><span class="keyword">val</span> add_clause_a : <a href="index.html#type-t">t</a> <span>-></span> <span><a href="index.html#type-lit">lit</a> array</span> <span>-></span> <a href="index.html#type-dproof">dproof</a> <span>-></span> unit</code></dt><dd><p>Lower level addition of clauses</p></dd></dl><dl><dt class="spec value" id="val-add_input_clause"><a href="#val-add_input_clause" class="anchor"></a><code><span class="keyword">val</span> add_input_clause : <a href="index.html#type-t">t</a> <span>-></span> <span><a href="index.html#type-lit">lit</a> list</span> <span>-></span> unit</code></dt><dd><p>Like <a href="index.html#val-add_clause"><code>add_clause</code></a> but with the justification of being an input clause</p></dd></dl><dl><dt class="spec value" id="val-add_input_clause_a"><a href="#val-add_input_clause_a" class="anchor"></a><code><span class="keyword">val</span> add_input_clause_a : <a href="index.html#type-t">t</a> <span>-></span> <span><a href="index.html#type-lit">lit</a> array</span> <span>-></span> unit</code></dt><dd><p>Like <a href="index.html#val-add_clause_a"><code>add_clause_a</code></a> but with justification of being an input clause</p></dd></dl><dl><dt class="spec value" id="val-add_clause_in_pool"><a href="#val-add_clause_in_pool" class="anchor"></a><code><span class="keyword">val</span> add_clause_in_pool : <a href="index.html#type-t">t</a> <span>-></span> <span>pool:<a href="index.html#type-clause_pool_id">clause_pool_id</a></span> <span>-></span> <span><a href="index.html#type-lit">lit</a> list</span> <span>-></span> <a href="index.html#type-dproof">dproof</a> <span>-></span> unit</code></dt><dd><p>Like <a href="index.html#val-add_clause"><code>add_clause</code></a> but using a specific clause pool</p></dd></dl><dl><dt class="spec value" id="val-add_clause_a_in_pool"><a href="#val-add_clause_a_in_pool" class="anchor"></a><code><span class="keyword">val</span> add_clause_a_in_pool : <a href="index.html#type-t">t</a> <span>-></span> <span>pool:<a href="index.html#type-clause_pool_id">clause_pool_id</a></span> <span>-></span> <span><a href="index.html#type-lit">lit</a> array</span> <span>-></span> <a href="index.html#type-dproof">dproof</a> <span>-></span> unit</code></dt><dd><p>Like <a href="index.html#val-add_clause_a"><code>add_clause_a</code></a> but using a specific clause pool</p></dd></dl><dl><dt class="spec value" id="val-solve"><a href="#val-solve" class="anchor"></a><code><span class="keyword">val</span> solve : <span>?⁠assumptions:<span><a href="index.html#type-lit">lit</a> list</span></span> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-res">res</a></code></dt><dd><p>Try and solves the current set of clauses.</p><dl><dt>parameter assumptions</dt><dd><p>additional atomic assumptions to be temporarily added. The assumptions are just used for this call to <code>solve</code>, they are not saved in the solver's state.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-add_lit"><a href="#val-add_lit" class="anchor"></a><code><span class="keyword">val</span> add_lit : <a href="index.html#type-t">t</a> <span>-></span> <span>?⁠default_pol:bool</span> <span>-></span> <a href="index.html#type-lit">lit</a> <span>-></span> unit</code></dt><dd><p>Ensure the SAT solver handles this particular literal, ie add a boolean variable for it if it's not already there.</p></dd></dl><dl><dt class="spec value" id="val-set_default_pol"><a href="#val-set_default_pol" class="anchor"></a><code><span class="keyword">val</span> set_default_pol : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-lit">lit</a> <span>-></span> bool <span>-></span> unit</code></dt><dd><p>Set default polarity for the given boolean variable. Sign of the literal is ignored.</p></dd></dl><dl><dt class="spec value" id="val-true_at_level0"><a href="#val-true_at_level0" class="anchor"></a><code><span class="keyword">val</span> true_at_level0 : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-lit">lit</a> <span>-></span> bool</code></dt><dd><p><code>true_at_level0 a</code> returns <code>true</code> if <code>a</code> was proved at level0, i.e. it must hold in all models</p></dd></dl><dl><dt class="spec value" id="val-eval_lit"><a href="#val-eval_lit" class="anchor"></a><code><span class="keyword">val</span> eval_lit : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-lit">lit</a> <span>-></span> <a href="../../Solver_intf/index.html#type-lbool">Solver_intf.lbool</a></code></dt><dd><p>Evaluate atom in current state</p></dd></dl></section></div></body></html> |