sidekick/dev/sidekick-bin/Sidekick_smtlib/Process/Solver/index.html
2021-07-04 02:50:03 +00:00

2 lines
No EOL
17 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Solver (sidekick-bin.Sidekick_smtlib.Process.Solver)</title><link rel="stylesheet" href="../../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.2"/><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> &#x00BB; <a href="../../index.html">Sidekick_smtlib</a> &#x00BB; <a href="../index.html">Process</a> &#x00BB; Solver</nav><h1>Module <code>Process.Solver</code></h1><nav class="toc"><ul><li><a href="#main-api">Main API</a></li></ul></nav></header><div class="spec module" id="module-T"><a href="#module-T" class="anchor"></a><code><span class="keyword">module</span> <a href="T/index.html">T</a> : <a href="../../../../sidekick/Sidekick_core/index.html#module-type-TERM">Sidekick_core.TERM</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="../../../../sidekick/Sidekick_core/module-type-TERM/Term/index.html#type-t">Term.t</a> = <a href="../../../../sidekick-base/Sidekick_base__Base_types/Term/index.html#type-t">Sidekick_base.Term.t</a> <span class="keyword">and</span> <span class="keyword">type</span> <a href="../../../../sidekick/Sidekick_core/module-type-TERM/Term/index.html#type-store">Term.store</a> = <a href="../../../../sidekick-base/Sidekick_base__Base_types/Term/index.html#type-store">Sidekick_base.Term.store</a> <span class="keyword">and</span> <span class="keyword">type</span> <a href="../../../../sidekick/Sidekick_core/module-type-TERM/Ty/index.html#type-t">Ty.t</a> = <a href="../../../../sidekick-base/Sidekick_base__Base_types/Ty/index.html#type-t">Sidekick_base.Ty.t</a> <span class="keyword">and</span> <span class="keyword">type</span> <a href="../../../../sidekick/Sidekick_core/module-type-TERM/Ty/index.html#type-store">Ty.store</a> = <a href="../../../../sidekick-base/Sidekick_base__Base_types/Ty/index.html#type-store">Sidekick_base.Ty.store</a></code></div><div class="spec module" id="module-P"><a href="#module-P" class="anchor"></a><code><span class="keyword">module</span> <a href="P/index.html">P</a> : <a href="../../../../sidekick/Sidekick_core/index.html#module-type-PROOF">Sidekick_core.PROOF</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="../../../../sidekick/Sidekick_core/module-type-PROOF/index.html#type-term">term</a> = <a href="T/Term/index.html#type-t">T.Term.t</a></code></div><div class="spec module" id="module-Lit"><a href="#module-Lit" class="anchor"></a><code><span class="keyword">module</span> <a href="Lit/index.html">Lit</a> : <a href="../../../../sidekick/Sidekick_core/index.html#module-type-LIT">Sidekick_core.LIT</a> <span class="keyword">with</span> <span class="keyword">module</span> <a href="../../../../sidekick/Sidekick_core/module-type-LIT/T/index.html">T</a> = <a href="index.html#module-T">T</a></code></div><dl><dt class="spec module" id="module-Solver_internal"><a href="#module-Solver_internal" class="anchor"></a><code><span class="keyword">module</span> <a href="Solver_internal/index.html">Solver_internal</a> : <a href="../../../../sidekick/Sidekick_core/index.html#module-type-SOLVER_INTERNAL">Sidekick_core.SOLVER_INTERNAL</a> <span class="keyword">with</span> <span class="keyword">module</span> <a href="../../../../sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/T/index.html">T</a> = <a href="index.html#module-T">T</a> <span class="keyword">and</span> <span class="keyword">module</span> <a href="../../../../sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/P/index.html">P</a> = <a href="index.html#module-P">P</a> <span class="keyword">and</span> <span class="keyword">module</span> <a href="../../../../sidekick/Sidekick_core/module-type-SOLVER_INTERNAL/Lit/index.html">Lit</a> = <a href="index.html#module-Lit">Lit</a></code></dt><dd><p>Internal solver, available to theories.</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></dt><dd><p>The solver's state.</p></dd></dl><dl><dt class="spec type" id="type-solver"><a href="#type-solver" class="anchor"></a><code><span class="keyword">type</span> solver</code><code> = <a href="index.html#type-t">t</a></code></dt><dt class="spec type" id="type-term"><a href="#type-term" class="anchor"></a><code><span class="keyword">type</span> term</code><code> = <a href="T/Term/index.html#type-t">T.Term.t</a></code></dt><dt class="spec type" id="type-ty"><a href="#type-ty" class="anchor"></a><code><span class="keyword">type</span> ty</code><code> = <a href="T/Ty/index.html#type-t">T.Ty.t</a></code></dt><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="Lit/index.html#type-t">Lit.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="P/index.html#type-t">P.t</a></code></dt></dl><dl><dt class="spec module-type" id="module-type-THEORY"><a href="#module-type-THEORY" class="anchor"></a><code><span class="keyword">module</span> <span class="keyword">type</span> <a href="module-type-THEORY/index.html">THEORY</a> = <span class="keyword">sig</span> ... <span class="keyword">end</span></code></dt><dd></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> = <span>(<span class="keyword">module</span> <a href="module-type-THEORY/index.html">THEORY</a>)</span></code></dt><dd><p>A theory that can be used for this particular solver.</p></dd></dl><dl><dt class="spec type" id="type-theory_p"><a href="#type-theory_p" class="anchor"></a><code><span class="keyword">type</span> <span>'a theory_p</span></code><code> = <span>(<span class="keyword">module</span> <a href="module-type-THEORY/index.html">THEORY</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="module-type-THEORY/index.html#type-t">t</a> = <span class="type-var">'a</span>)</span></code></dt><dd><p>A theory that can be used for this particular solver, with state of type <code>'a</code>.</p></dd></dl><dl><dt class="spec value" id="val-mk_theory"><a href="#val-mk_theory" class="anchor"></a><code><span class="keyword">val</span> mk_theory : <span>name:string</span> <span>&#45;&gt;</span> <span>create_and_setup:<span>(<a href="Solver_internal/index.html#type-t">Solver_internal.t</a> <span>&#45;&gt;</span> <span class="type-var">'th</span>)</span></span> <span>&#45;&gt;</span> <span>?&#8288;push_level:<span>(<span class="type-var">'th</span> <span>&#45;&gt;</span> unit)</span></span> <span>&#45;&gt;</span> <span>?&#8288;pop_levels:<span>(<span class="type-var">'th</span> <span>&#45;&gt;</span> int <span>&#45;&gt;</span> unit)</span></span> <span>&#45;&gt;</span> unit <span>&#45;&gt;</span> <a href="index.html#type-theory">theory</a></code></dt><dd><p>Helper to create a theory.</p></dd></dl><dl><dt class="spec module" id="module-Atom"><a href="#module-Atom" class="anchor"></a><code><span class="keyword">module</span> <a href="Atom/index.html">Atom</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></dt><dd></dd></dl><dl><dt class="spec module" id="module-Model"><a href="#module-Model" class="anchor"></a><code><span class="keyword">module</span> <a href="Model/index.html">Model</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></dt><dd><p>Models</p></dd></dl><div class="spec module" id="module-Unknown"><a href="#module-Unknown" class="anchor"></a><code><span class="keyword">module</span> <a href="Unknown/index.html">Unknown</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></div><section><header><h4 id="main-api"><a href="#main-api" class="anchor"></a>Main API</h4></header><dl><dt class="spec value" id="val-stats"><a href="#val-stats" class="anchor"></a><code><span class="keyword">val</span> stats : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="../../../../sidekick/Sidekick_util/Stat/index.html#type-t">Sidekick_util.Stat.t</a></code></dt><dt class="spec value" id="val-tst"><a href="#val-tst" class="anchor"></a><code><span class="keyword">val</span> tst : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="T/Term/index.html#type-store">T.Term.store</a></code></dt><dt class="spec value" id="val-ty_st"><a href="#val-ty_st" class="anchor"></a><code><span class="keyword">val</span> ty_st : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="T/Ty/index.html#type-store">T.Ty.store</a></code></dt><dt class="spec value" id="val-create"><a href="#val-create" class="anchor"></a><code><span class="keyword">val</span> create : <span>?&#8288;stat:<a href="../../../../sidekick/Sidekick_util/Stat/index.html#type-t">Sidekick_util.Stat.t</a></span> <span>&#45;&gt;</span> <span>?&#8288;size:<span>[ `Big <span>| `Tiny</span> <span>| `Small</span> ]</span></span> <span>&#45;&gt;</span> <span>?&#8288;store_proof:bool</span> <span>&#45;&gt;</span> <span>theories:<span><a href="index.html#type-theory">theory</a> list</span></span> <span>&#45;&gt;</span> <a href="T/Term/index.html#type-store">T.Term.store</a> <span>&#45;&gt;</span> <a href="T/Ty/index.html#type-store">T.Ty.store</a> <span>&#45;&gt;</span> unit <span>&#45;&gt;</span> <a href="index.html#type-t">t</a></code></dt><dd><p>Create a new solver.</p><p>It needs a term state and a type state to manipulate terms and types. All terms and types interacting with this solver will need to come from these exact states.</p><dl><dt>parameter store_proof</dt><dd><p>if true, proofs from the SAT solver and theories are retained and potentially accessible after <a href="index.html#val-solve"><code>solve</code></a> returns UNSAT.</p></dd></dl><dl><dt>parameter size</dt><dd><p>influences the size of initial allocations.</p></dd></dl><dl><dt>parameter theories</dt><dd><p>theories to load from the start. Other theories can be added using <a href="index.html#val-add_theory"><code>add_theory</code></a>.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-add_theory"><a href="#val-add_theory" class="anchor"></a><code><span class="keyword">val</span> add_theory : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-theory">theory</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>Add a theory to the solver. This should be called before any call to <a href="index.html#val-solve"><code>solve</code></a> or to <a href="index.html#val-add_clause"><code>add_clause</code></a> and the likes (otherwise the theory will have a partial view of the problem).</p></dd></dl><dl><dt class="spec value" id="val-add_theory_p"><a href="#val-add_theory_p" class="anchor"></a><code><span class="keyword">val</span> add_theory_p : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-theory_p">theory_p</a></span> <span>&#45;&gt;</span> <span class="type-var">'a</span></code></dt><dd><p>Add the given theory and obtain its state</p></dd></dl><dl><dt class="spec value" id="val-add_theory_l"><a href="#val-add_theory_l" class="anchor"></a><code><span class="keyword">val</span> add_theory_l : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <span><a href="index.html#type-theory">theory</a> list</span> <span>&#45;&gt;</span> unit</code></dt><dt class="spec value" id="val-mk_atom_lit"><a href="#val-mk_atom_lit" class="anchor"></a><code><span class="keyword">val</span> mk_atom_lit : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-lit">lit</a> <span>&#45;&gt;</span> <a href="Atom/index.html#type-t">Atom.t</a> * <a href="P/index.html#type-t">P.t</a></code></dt><dd><p><code>mk_atom_lit _ lit</code> returns <code>atom, pr</code> where <code>atom</code> is an internal atom for the solver, and <code>pr</code> is a proof of <code>|- lit = atom</code></p></dd></dl><dl><dt class="spec value" id="val-mk_atom_t"><a href="#val-mk_atom_t" class="anchor"></a><code><span class="keyword">val</span> mk_atom_t : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <span>?&#8288;sign:bool</span> <span>&#45;&gt;</span> <a href="index.html#type-term">term</a> <span>&#45;&gt;</span> <a href="Atom/index.html#type-t">Atom.t</a> * <a href="P/index.html#type-t">P.t</a></code></dt><dd><p><code>mk_atom_t _ ~sign t</code> returns <code>atom, pr</code> where <code>atom</code> is an internal representation of <code>± t</code>, and <code>pr</code> is a proof of <code>|- atom = (± t)</code></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>&#45;&gt;</span> <span><a href="Atom/index.html#type-t">Atom.t</a> <a href="../../../../sidekick/Sidekick_util/IArray/index.html#type-t">Sidekick_util.IArray.t</a></span> <span>&#45;&gt;</span> <a href="P/index.html#type-t">P.t</a> <span>&#45;&gt;</span> unit</code></dt><dd><p><code>add_clause solver cs</code> adds a boolean clause to the solver. Subsequent calls to <a href="index.html#val-solve"><code>solve</code></a> will need to satisfy this clause.</p></dd></dl><dl><dt class="spec value" id="val-add_clause_l"><a href="#val-add_clause_l" class="anchor"></a><code><span class="keyword">val</span> add_clause_l : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <span><a href="Atom/index.html#type-t">Atom.t</a> list</span> <span>&#45;&gt;</span> <a href="P/index.html#type-t">P.t</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>Add a clause to the solver, given as a list.</p></dd></dl><dl><dt class="spec module" id="module-Pre_proof"><a href="#module-Pre_proof" class="anchor"></a><code><span class="keyword">module</span> <a href="Pre_proof/index.html">Pre_proof</a> : <span class="keyword">sig</span> ... <span class="keyword">end</span></code></dt><dd></dd></dl><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> <a href="Model/index.html#type-t">Model.t</a></code></td><td class="doc"><p>Satisfiable</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> </code><code>{</code><table class="record"><tr id="type-res.proof" class="anchored"><td class="def field"><a href="#type-res.proof" class="anchor"></a><code>proof : <span><span><a href="Pre_proof/index.html#type-t">Pre_proof.t</a> option</span> lazy_t</span>;</code></td><td class="doc"><p>proof of unsat</p></td></tr><tr id="type-res.unsat_core" class="anchored"><td class="def field"><a href="#type-res.unsat_core" class="anchor"></a><code>unsat_core : <span><span><a href="Atom/index.html#type-t">Atom.t</a> list</span> lazy_t</span>;</code></td><td class="doc"><p>subset of assumptions responsible for unsat</p></td></tr></table><code>}</code></td><td class="doc"><p>Unsatisfiable</p></td></tr><tr id="type-res.Unknown" class="anchored"><td class="def constructor"><a href="#type-res.Unknown" class="anchor"></a><code>| </code><code><span class="constructor">Unknown</span> <span class="keyword">of</span> <a href="Unknown/index.html#type-t">Unknown.t</a></code></td><td class="doc"><p>Unknown, obtained after a timeout, memory limit, etc.</p></td></tr></table></dt><dd><p>Result of solving for the current set of clauses</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>?&#8288;on_exit:<span><span>(unit <span>&#45;&gt;</span> unit)</span> list</span></span> <span>&#45;&gt;</span> <span>?&#8288;check:bool</span> <span>&#45;&gt;</span> <span>?&#8288;on_progress:<span>(<a href="index.html#type-t">t</a> <span>&#45;&gt;</span> unit)</span></span> <span>&#45;&gt;</span> <span>assumptions:<span><a href="Atom/index.html#type-t">Atom.t</a> list</span></span> <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> <a href="index.html#type-res">res</a></code></dt><dd><p><code>solve s</code> checks the satisfiability of the clauses added so far to <code>s</code>.</p><dl><dt>parameter check</dt><dd><p>if true, the model is checked before returning.</p></dd></dl><dl><dt>parameter on_progress</dt><dd><p>called regularly during solving.</p></dd></dl><dl><dt>parameter assumptions</dt><dd><p>a set of atoms held to be true. The unsat core, if any, will be a subset of <code>assumptions</code>.</p></dd></dl><dl><dt>parameter on_exit</dt><dd><p>functions to be run before this returns</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-pp_stats"><a href="#val-pp_stats" class="anchor"></a><code><span class="keyword">val</span> pp_stats : <span><a href="index.html#type-t">t</a> CCFormat.printer</span></code></dt><dd><p>Print some statistics. What it prints exactly is unspecified.</p></dd></dl></section></div></body></html>