UNPKG

@ciao-lang/ts-ciao-interface

Version:

Simple Ciao interface for node.

108 lines (90 loc) 16.5 kB
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>Lists and conjunctions and disjunctions &mdash; The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">&#9776;</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="ExtraLibs.html">&#x2191;</a><a class="lpdoc-navbutton" href="modblobs.html">&#x2190;</a><a class="lpdoc-navbutton" href="counters.html">&#x2192;</a><a class="lpdoc-navbutton" href="ciaosearch.html">&#x1F50D;</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> &raquo;<br/> </li><li><a href="ExtraLibs.html">PART VIII - Additional libraries</a> &raquo;<br/> </li><li><a href=""><strong>Lists and conjunctions and disjunctions</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>Lists and conjunctions and disjunctions</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#formulae"></a><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(formulae)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="0" href="#list_to_conj/3"><tt>list_to_conj/3</tt></a>, <a class="lpdoc-idx-anchor" id="1" href="#list_to_conj/2"><tt>list_to_conj/2</tt></a>, <a class="lpdoc-idx-anchor" id="2" href="#conj_to_list/2"><tt>conj_to_list/2</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="#list_to_disj/2"><tt>list_to_disj/2</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="#disj_to_list/2"><tt>disj_to_list/2</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="#conj_to_llist/2"><tt>conj_to_llist/2</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="#llist_to_conj/2"><tt>llist_to_conj/2</tt></a>, <a class="lpdoc-idx-anchor" id="7" href="#disj_to_llist/2"><tt>disj_to_llist/2</tt></a>, <a class="lpdoc-idx-anchor" id="8" href="#llist_to_disj/2"><tt>llist_to_disj/2</tt></a>, <a class="lpdoc-idx-anchor" id="9" href="#body2list/2"><tt>body2list/2</tt></a>, <a class="lpdoc-idx-anchor" id="10" href="#asbody_to_conj/2"><tt>asbody_to_conj/2</tt></a>, <a class="lpdoc-idx-anchor" id="11" href="#list_to_disj2/2"><tt>list_to_disj2/2</tt></a>. <li><em>Properties:</em><br/><a class="lpdoc-idx-anchor" id="12" href="#assert_body_type/1"><tt>assert_body_type/1</tt></a>. <li><em>Regular Types:</em><br/><a class="lpdoc-idx-anchor" id="13" href="#conj_disj_type/1"><tt>conj_disj_type/1</tt></a>, <a class="lpdoc-idx-anchor" id="14" href="#t_conj/1"><tt>t_conj/1</tt></a>, <a class="lpdoc-idx-anchor" id="15" href="#t_disj/1"><tt>t_disj/1</tt></a>. </ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="list_to_conj/3" href="ciaosearch.html#list_to_conj/3">list_to_conj/3</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>list_to_conj(List,Conj,End)</tt> </span><p> <span class="lpdoc-var">Conj</span> is the conjunction made up of the elements of <span class="lpdoc-var">List</span> plus a final element <span class="lpdoc-var">End</span>.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="list_to_conj/2" href="ciaosearch.html#list_to_conj/2">list_to_conj/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>list_to_conj(A,B)</tt> </span><p> Examples: <pre class="lpdoc-codeblock">?- list_to_conj(A, a). A = [a] ? ; no ?- list_to_conj(A, (a,V,b)). A = [a,V,b] ? ; no ?- list_to_conj([A], B). B = A ? ; no ?- list_to_conj([a,A,b], B). B = (a,A,b) ? ; no ?- list_to_conj([], B). B = true ? ; no </pre> <p><span class="lpdoc-usage-header">Usage 1:</span><span class="lpdoc-usage-decl"><tt>list_to_conj(A,B)</tt> </span><p><span class="lpdoc-var">Conj</span> is the conjunction made up of the elements of <span class="lpdoc-var">List</span>. The empty list is (<tt>[]</tt>) is <tt>true</tt>).</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="16" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a list. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="17" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">B</span> is a free variable. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="18" href="#t_conj/1"><tt>formulae:t_conj/1</tt></a>)</span><span>Conjuntions </span> </ul><p><span class="lpdoc-usage-header">Usage 2:</span><span class="lpdoc-usage-decl"><tt>list_to_conj(A,B)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="19" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="20" href="#t_conj/1"><tt>formulae:t_conj/1</tt></a>)</span><span>Conjuntions </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="21" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a list. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="conj_to_list/2" href="ciaosearch.html#conj_to_list/2">conj_to_list/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>conj_to_list(Conj,List)</tt> </span><p> <span class="lpdoc-var">List</span> is the list made up of the elements of conjunction <span class="lpdoc-var">Conj</span> (<tt>true</tt> is <tt>[]</tt>).</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="list_to_disj/2" href="ciaosearch.html#list_to_disj/2">list_to_disj/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>list_to_disj(A,B)</tt> </span><p> Examples:<p><pre class="lpdoc-codeblock">?- list_to_disj([a], A). A = a ? ; no ?- list_to_disj([a,B,b], A). A = (a;B;b) ? ; no ?- list_to_disj(A, (a)). A = [a] ? ; no ?- list_to_disj(A, (a;B;b)). A = [a,B,b] ? ; no ?- </pre><p><span class="lpdoc-usage-header">Usage 1:</span><span class="lpdoc-usage-decl"><tt>list_to_disj(A,B)</tt> </span><p><span class="lpdoc-var">Disj</span> is the disjunction made up of the elements of <span class="lpdoc-var">List</span>. (<tt>[]</tt> is <tt>false</tt>).</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="22" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a list. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="23" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">B</span> is a free variable. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="24" href="#t_disj/1"><tt>formulae:t_disj/1</tt></a>)</span><span>Disjunctions </span> </ul><p><span class="lpdoc-usage-header">Usage 2:</span><span class="lpdoc-usage-decl"><tt>list_to_disj(A,B)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="25" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="26" href="#t_disj/1"><tt>formulae:t_disj/1</tt></a>)</span><span>Disjunctions </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="27" href="basic_props.html#list/1"><tt>basic_props:list/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a list. </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="disj_to_list/2" href="ciaosearch.html#disj_to_list/2">disj_to_list/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>disj_to_list(Disj,List)</tt> </span><p> <span class="lpdoc-var">List</span> is the list made up of the elements of disjunction <span class="lpdoc-var">Disj</span> (<tt>true</tt> is <tt>[]</tt>).</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="conj_to_llist/2" href="ciaosearch.html#conj_to_llist/2">conj_to_llist/2</a></div><div class="lpdoc-deftext">Turns a conjunctive (normal form) formula into a list (of lists of ...). As a side-effect, inner conjunctions get flattened. No special care for <tt>true</tt>.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="llist_to_conj/2" href="ciaosearch.html#llist_to_conj/2">llist_to_conj/2</a></div><div class="lpdoc-deftext">Inverse of <tt>conj_to_llist/2</tt>. No provisions for anything else than a non-empty list on input (i.e., they will go `as are&apos; in the output.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="disj_to_llist/2" href="ciaosearch.html#disj_to_llist/2">disj_to_llist/2</a></div><div class="lpdoc-deftext">Turns a disjunctive (normal form) formula into a list (of lists of ...). As a side-effect, inner disjunctions get flattened. No special care for <tt>true</tt>.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="llist_to_disj/2" href="ciaosearch.html#llist_to_disj/2">llist_to_disj/2</a></div><div class="lpdoc-deftext">Inverse of <tt>disj_to_llist/2</tt>. No provisions for anything else than a non-empty list on input (i.e., they will go `as are&apos; in the output.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="body2list/2" href="ciaosearch.html#body2list/2">body2list/2</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="asbody_to_conj/2" href="ciaosearch.html#asbody_to_conj/2">asbody_to_conj/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage 1:</span><span class="lpdoc-usage-decl"><tt>asbody_to_conj(A,B)</tt> </span><p>Transforms assertion body <span class="lpdoc-var">A</span> into a conjuntion (<span class="lpdoc-var">B</span>). It runs in both ways</p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="29" href="#assert_body_type/1"><tt>formulae:assert_body_type/1</tt></a>)</span><span><a class="lpdoc-idx-anchor" id="28" href="ciaosearch.html#assert_body_type(A)"><tt>formulae:assert_body_type(A)</tt></a> </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="30" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">B</span> is a free variable. </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="31" href="#conj_disj_type/1"><tt>formulae:conj_disj_type/1</tt></a>)</span><span>The usual prolog way of writing conjuntions and disjuntions in a body using &apos;,&apos; and &apos;;&apos; </span> </ul><p><span class="lpdoc-usage-header">Usage 2:</span><span class="lpdoc-usage-decl"><tt>asbody_to_conj(A,B)</tt> </span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="32" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">A</span> is a free variable. </span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="33" href="#conj_disj_type/1"><tt>formulae:conj_disj_type/1</tt></a>)</span><span>The usual prolog way of writing conjuntions and disjuntions in a body using &apos;,&apos; and &apos;;&apos; </span> <li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="35" href="#assert_body_type/1"><tt>formulae:assert_body_type/1</tt></a>)</span><span><a class="lpdoc-idx-anchor" id="34" href="ciaosearch.html#assert_body_type(A)"><tt>formulae:assert_body_type(A)</tt></a> </span> </ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="assert_body_type/1" href="ciaosearch.html#assert_body_type/1">assert_body_type/1</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="conj_disj_type/1" href="ciaosearch.html#conj_disj_type/1">conj_disj_type/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>The usual prolog way of writing conjuntions and disjuntions in a body using &apos;,&apos; and &apos;;&apos;</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="t_conj/1" href="ciaosearch.html#t_conj/1">t_conj/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Conjuntions</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">REGTYPE</span><a class="lpdoc-idx-anchor" id="t_disj/1" href="ciaosearch.html#t_disj/1">t_disj/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><p>Disjunctions</p><ul class="lpdoc-itemize-minus"></ul></div></div><p> <div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="list_to_disj2/2" href="ciaosearch.html#list_to_disj2/2">list_to_disj2/2</a></div><div class="lpdoc-deftext">No further documentation available for this predicate.</div></div><p> </div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="36" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="37" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="38" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="39" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="40" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="41" href="regtypes_doc.html"><tt>regtypes</tt></a>. </ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>