@ciao-lang/ts-ciao-interface
Version:
Simple Ciao interface for node.
132 lines (131 loc) • 53.9 kB
HTML
<!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>The Ciao assertion language — 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">☰</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="AssrtLang.html">↑</a><a class="lpdoc-navbutton" href="AssrtLang.html">←</a><a class="lpdoc-navbutton" href="assertions_props.html">→</a><a class="lpdoc-navbutton" href="ciaosearch.html">🔍</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> »<br/> </li><li><a href="AssrtLang.html">PART III - Assertions and auto-documentation</a> »<br/> </li><li><a href=""><strong>The Ciao assertion language</strong></a> ▾<ul><li><a href="assertions_props.html">Types and properties related to assertions</a></li></ul></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Getting more information">Getting more information</a></li><li><a href="#Some attention points">Some attention points</a></li><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on new declarations">Documentation on new declarations</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>The Ciao assertion language</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#assertions"></a>
<strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="Manuel Hermenegildo" href="ciaosearch.html#Manuel Hermenegildo">Manuel Hermenegildo</a>, <a class="lpdoc-idx-anchor" id="Francisco Bueno" href="ciaosearch.html#Francisco Bueno">Francisco Bueno</a>, <a class="lpdoc-idx-anchor" id="German Puebla" href="ciaosearch.html#German Puebla">German Puebla</a>.<p>
The <a class="lpdoc-idx-anchor" id="0" href=""><tt>assertions</tt></a> package adds a number of new declaration definitions and new operator definitions which allow including <a class="lpdoc-idx-anchor" id="1" href="ciaosearch.html#program assertions">program assertions</a> in user programs. Such assertions can be used to describe predicates, properties, modules, applications, etc. These descriptions can contain formal specifications (such as sets of preconditions, post-conditions, or descriptions of computations) as well as machine-readable textual comments.<p>This module is part of the <a class="lpdoc-idx-anchor" id="2" href=""><tt>assertions</tt></a> library. It defines the basic code-related assertions, i.e., those intended to be used mainly by compilation-related tools, such as the static analyzer or the run-time test generator.<p>Here we document mainly the use of assertions for providing <a class="lpdoc-idx-anchor" id="3" href="ciaosearch.html#specifications">specifications</a> for predicates and other program elements, as well as the locations within assertions where machine-readable documentation strings can be placed. The commands that can be used in the documentation strings and other directives that can be used to provide additional machine-readable comments <a class="lpdoc-idx-anchor" id="4" href="ciaosearch.html#comments, machine readable"></a> are described in the autodocumenter (<a class="lpdoc-idx-anchor" id="5" href="ciaosearch.html#lpdoc"><tt>lpdoc</tt></a> [<a class="lpdoc-idx-anchor" id="6" href="ciaorefs.html#knuth-lit">Knu84</a>,<a class="lpdoc-idx-anchor" id="7" href="ciaorefs.html#lpdoc-tr">Her99</a>]) manual.<p>There are two kinds of assertions: predicate assertions and program point assertions. Predicate assertions are placed as directives in the source code, i.e., preceded by ``<tt>:-</tt>''. Program point assertions are placed as literals in clause bodies. Additional documentation on the syntax and fields of predicate assertions can be found in the <a href="assertions_props.html">Types and properties related to assertions</a> module.<p><div id="Getting more information"><h2>Getting more information</h2> <p>This documentation is intended to provide information at a ``reference manual'' level. For more tutorial introductions to the assertion language and more examples please see [<a class="lpdoc-idx-anchor" id="8" href="ciaorefs.html#full-prolog-esop96">BCHP96</a>,<a class="lpdoc-idx-anchor" id="9" href="ciaorefs.html#prog-glob-an">HPB99</a>,<a class="lpdoc-idx-anchor" id="10" href="ciaorefs.html#assert-lang-disciplbook">PBH00</a>,<a class="lpdoc-idx-anchor" id="11" href="ciaorefs.html#ciaopp-sas03-journal-scp">HPBLG05</a>,<a class="lpdoc-idx-anchor" id="12" href="ciaorefs.html#hermenegildo11:ciao-design-tplp">HBC12</a>] and the <a class="lpdoc-idx-anchor" id="13" href="ciaosearch.html#ciaopp"><tt>ciaopp</tt></a> tutorial. % The assertion language as implemented in this library essentially follows these documents, although, due to its evolution, it may differ in some details. The purpose of this manual is to document precisely what the implementation of the library supports at any given point in time.<p></div><div id="Some attention points"><h2>Some attention points</h2> <p><ul> <p><li><strong>Formatting commands within text strings:</strong> <a class="lpdoc-idx-anchor" id="14" href="ciaosearch.html#formatting commands"></a> many of the predicates defined in these modules include arguments intended for providing textual information. This includes titles, descriptions, comments, etc. The type of this argument is a character string. In order for the automatic generation of documentation to work correctly, this <a class="lpdoc-idx-anchor" id="15" href="ciaosearch.html#character string">character string</a> should adhere to certain conventions. See the description of the <a class="lpdoc-idx-anchor" id="16" href="assertions_props.html#docstring/1"><tt>docstring/1</tt></a> type/grammar for details.<p><li><strong>Referring to variables:</strong> In order for the automatic documentation system to work correctly, <a class="lpdoc-idx-anchor" id="17" href="ciaosearch.html#variable names">variable names</a> (for example, when referring to arguments in the head patterns of <em>pred</em> declarations) must be surrounded by an <tt>@var</tt> command. For example, <tt>@var{VariableName}</tt> should be used for referring to the variable ``VariableName'', which will appear then formatted as follows: <span class="lpdoc-var">VariableName</span>. See the description of the <a class="lpdoc-idx-anchor" id="18" href="assertions_props.html#docstring/1"><tt>docstring/1</tt></a> type/grammar for details.<p></ul> <p></div><br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_package(assertions).</tt> or <tt>:- module(...,...,[assertions]).</tt>. Use the <a class="lpdoc-idx-anchor" id="19" href="ciaosearch.html#assertions_basic"><tt>assertions_basic</tt></a> package to disable the implicit use of the <a class="lpdoc-idx-anchor" id="20" href="basic_props.html"><tt>basic_props</tt></a> module.<li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="21" href="#check/1"><tt>check/1</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="#trust/1"><tt>trust/1</tt></a>, <a class="lpdoc-idx-anchor" id="23" href="#true/1"><tt>true/1</tt></a>, <a class="lpdoc-idx-anchor" id="24" href="#false/1"><tt>false/1</tt></a>.
</ul><li><strong>New operators defined:</strong><br/><a class="lpdoc-idx-anchor" id="25" href="ciaosearch.html#=>/2"><tt>=>/2</tt></a> [975,xfx], <a class="lpdoc-idx-anchor" id="26" href="ciaosearch.html#::/2"><tt>::/2</tt></a> [978,xfx], <a class="lpdoc-idx-anchor" id="27" href="#decl/1"><tt>decl/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="28" href="#decl/2"><tt>decl/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="29" href="#pred/1"><tt>pred/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="30" href="#pred/2"><tt>pred/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="31" href="#prop/1"><tt>prop/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="32" href="#prop/2"><tt>prop/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="33" href="#modedef/1"><tt>modedef/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="34" href="#calls/1"><tt>calls/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="35" href="#calls/2"><tt>calls/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="36" href="#success/1"><tt>success/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="37" href="#success/2"><tt>success/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="38" href="#comp/1"><tt>comp/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="39" href="#comp/2"><tt>comp/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="40" href="#entry/1"><tt>entry/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="41" href="#exit/1"><tt>exit/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="42" href="#exit/2"><tt>exit/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="43" href="#test/1"><tt>test/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="44" href="#test/2"><tt>test/2</tt></a> [1150,xfx], <a class="lpdoc-idx-anchor" id="45" href="#texec/1"><tt>texec/1</tt></a> [1150,fx], <a class="lpdoc-idx-anchor" id="46" href="#texec/2"><tt>texec/2</tt></a> [1150,xfx].
<li><strong>New declarations defined:</strong><br/><a class="lpdoc-idx-anchor" id="47" href="#pred/1"><tt>pred/1</tt></a>, <a class="lpdoc-idx-anchor" id="48" href="#pred/2"><tt>pred/2</tt></a>, <a class="lpdoc-idx-anchor" id="49" href="#calls/1"><tt>calls/1</tt></a>, <a class="lpdoc-idx-anchor" id="50" href="#calls/2"><tt>calls/2</tt></a>, <a class="lpdoc-idx-anchor" id="51" href="#success/1"><tt>success/1</tt></a>, <a class="lpdoc-idx-anchor" id="52" href="#success/2"><tt>success/2</tt></a>, <a class="lpdoc-idx-anchor" id="53" href="#comp/1"><tt>comp/1</tt></a>, <a class="lpdoc-idx-anchor" id="54" href="#comp/2"><tt>comp/2</tt></a>, <a class="lpdoc-idx-anchor" id="55" href="#prop/1"><tt>prop/1</tt></a>, <a class="lpdoc-idx-anchor" id="56" href="#prop/2"><tt>prop/2</tt></a>, <a class="lpdoc-idx-anchor" id="57" href="#test/1"><tt>test/1</tt></a>, <a class="lpdoc-idx-anchor" id="58" href="#test/2"><tt>test/2</tt></a>, <a class="lpdoc-idx-anchor" id="59" href="#texec/1"><tt>texec/1</tt></a>, <a class="lpdoc-idx-anchor" id="60" href="#texec/2"><tt>texec/2</tt></a>, <a class="lpdoc-idx-anchor" id="61" href="#entry/1"><tt>entry/1</tt></a>, <a class="lpdoc-idx-anchor" id="62" href="#exit/1"><tt>exit/1</tt></a>, <a class="lpdoc-idx-anchor" id="63" href="#exit/2"><tt>exit/2</tt></a>, <a class="lpdoc-idx-anchor" id="64" href="#modedef/1"><tt>modedef/1</tt></a>, <a class="lpdoc-idx-anchor" id="65" href="#decl/1"><tt>decl/1</tt></a>, <a class="lpdoc-idx-anchor" id="66" href="#decl/2"><tt>decl/2</tt></a>, <a class="lpdoc-idx-anchor" id="67" href="#doc/2"><tt>doc/2</tt></a>, <a class="lpdoc-idx-anchor" id="68" href="#comment/2"><tt>comment/2</tt></a>.
<li><strong>Implicit imports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="69" href="assertions_props.html"><tt>assertions_props</tt></a>.
<li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="70" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="71" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="72" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="73" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>.
</ul></ul></div></div><div id="Documentation on new declarations"><h2>Documentation on new declarations</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="pred/1" href="ciaosearch.html#pred/1">pred/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="74" href="ciaosearch.html#pred assertion"></a> <tt>pred</tt> assertions are the most general type of assertion, and they are used to provide information on the set of admissible calls to a predicate, the set of successes, global properties, and documentation. The body of a <tt>pred</tt> assertion (its only argument) contains properties or comments in different fields following the formats specified by <a class="lpdoc-idx-anchor" id="75" href="assertions_props.html#assrt_body/1"><tt>assrt_body/1</tt></a>.<p>There can be more than one of these assertions per predicate, in which case each one represents a possible ``<a class="lpdoc-idx-anchor" id="76" href="ciaosearch.html#mode">mode</a>'' of use (<a class="lpdoc-idx-anchor" id="77" href="ciaosearch.html#usage">usage</a>) of the predicate. The exact scope of the usage is defined by the properties given for calls in the body of each assertion (which should thus distinguish the different usages intended). Predicates are typically specified using a <em>set</em> of <tt>pred</tt> assertions, so that together they cover all ways in which the predicate is intended be used (all usages). Each <tt>pred</tt> assertion is translated internally to a <tt>calls</tt> assertion covering all the calling modes and a <tt>success</tt> assertion covering the successes for those calls.<p>For example, the following assertions would describe all intended modes (and the only modes) of use of a predicate <tt>length/2</tt> (see <a class="lpdoc-idx-anchor" id="78" href="lists.html"><tt>lists</tt></a>): <pre class="lpdoc-codeblock">:- pred length(L,N) : list * var => list * integer
# "Computes the length of <span class="lpdoc-var">L</span>.".
:- pred length(L,N) : var * integer => list * integer
# "Outputs <span class="lpdoc-var">L</span> of length <span class="lpdoc-var">N</span>.".
:- pred length(L,N) : list * integer => list * integer
# "Checks that <span class="lpdoc-var">L</span> is of length <span class="lpdoc-var">N</span>.".
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>pred(AssertionBody)</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="79" href="assertions_props.html#assrt_body/1"><tt>assertions_props:assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is an assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="pred/2" href="ciaosearch.html#pred/2">pred/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="80" href="ciaosearch.html#pred assertion"></a> A <tt>pred</tt> assertion (see <a class="lpdoc-idx-anchor" id="81" href="#pred/1"><tt>pred/1</tt></a>) can be preceded (as most other assertions) by an assertion status (<a class="lpdoc-idx-anchor" id="82" href="assertions_props.html#assrt_status/1"><tt>assrt_status/1</tt></a>). If no assertion status is present (i.e., in <a class="lpdoc-idx-anchor" id="83" href="#pred/1"><tt>pred/1</tt></a> assertions) the status is assumed to be <tt>check</tt>.<p>For example, the following assertion: <pre class="lpdoc-codeblock">:- pred length(L,N) : list * var => list * integer.
</pre> is equivalent to: <pre class="lpdoc-codeblock">:- check pred length(L,N) : list * var => list * integer.
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>pred(AssertionStatus,AssertionBody)</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="84" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="85" href="assertions_props.html#assrt_body/1"><tt>assertions_props:assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is an assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="calls/1" href="ciaosearch.html#calls/1">calls/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="86" href="ciaosearch.html#calls assertion"></a> <tt>calls</tt> assertions are similar to <a class="lpdoc-idx-anchor" id="87" href="#pred/1"><tt>pred/1</tt></a> assertions but the only provide information about the calls to a predicate. The set of calls assertions for a predicate describe <em>all</em> possible calls to the predicate.<p>For example, the following assertion describes all possible calls to predicate <tt>is/2</tt> (see <a class="lpdoc-idx-anchor" id="88" href="arithmetic.html"><tt>arithmetic</tt></a>): <pre class="lpdoc-codeblock">:- calls is(term,arithexpression).
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>calls(AssertionBody)</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="89" href="assertions_props.html#c_assrt_body/1"><tt>assertions_props:c_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a call assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="calls/2" href="ciaosearch.html#calls/2">calls/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="90" href="ciaosearch.html#calls assertion"></a> A <tt>calls</tt> assertion can be preceded (as most other assertions) by an assertion status (<a class="lpdoc-idx-anchor" id="91" href="assertions_props.html#assrt_status/1"><tt>assrt_status/1</tt></a>). If no assertion status is present (i.e., in <a class="lpdoc-idx-anchor" id="92" href="#calls/1"><tt>calls/1</tt></a> assertions) the status is assumed to be <tt>check</tt>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>calls(AssertionStatus,AssertionBody)</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="93" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="94" href="assertions_props.html#c_assrt_body/1"><tt>assertions_props:c_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a call assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="success/1" href="ciaosearch.html#success/1">success/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="95" href="ciaosearch.html#success assertion"></a> <tt>success</tt> assertions specify properties of the answers of a predicate, similarly to the corresponding <tt>success</tt> field of a <tt>pred</tt> assertion. The assertion can be limited to apply to a particular way of calling the predicate if a <tt>calls</tt> field is present. However, unlike <tt>pred</tt> or <tt>calls</tt> assertions, the predicate is not forced to be called only that way.<p>For example, the following assertion specifies the answers of the <tt>length/2</tt> predicate <em>if</em> it is called as in the first mode of usage above (note that the previous pred assertion already conveys such information, however it also restricts the set of admissible <tt>calls</tt>, while the success assertion does not): <pre class="lpdoc-codeblock">:- success length(L,N) : list * var => list * integer.
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>success(AssertionBody)</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="96" href="assertions_props.html#s_assrt_body/1"><tt>assertions_props:s_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a predicate assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="success/2" href="ciaosearch.html#success/2">success/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="97" href="ciaosearch.html#success assertion"></a> A <tt>success</tt> assertion can be preceded (as most other assertions) by an assertion status (<a class="lpdoc-idx-anchor" id="98" href="assertions_props.html#assrt_status/1"><tt>assrt_status/1</tt></a>). If no assertion status is present (i.e., in <a class="lpdoc-idx-anchor" id="99" href="#success/1"><tt>success/1</tt></a> assertions) the status is assumed to be <tt>check</tt>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>success(AssertionStatus,AssertionBody)</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="100" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="101" href="assertions_props.html#s_assrt_body/1"><tt>assertions_props:s_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a predicate assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="comp/1" href="ciaosearch.html#comp/1">comp/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="102" href="ciaosearch.html#comp assertion"></a> <tt>comp</tt> assertions specify global properties of the execution of a predicate, similarly to the corresponding <tt>comp</tt> field of a <tt>pred</tt> assertion. The assertion can be limited to apply to a particular way of calling the predicate if a <tt>calls</tt> field is present. However, unlike <tt>pred</tt> or <tt>calls</tt> assertions, the predicate is not forced to be called only that way.<p>For example, the following assertion specifies that the computation of <tt>append/3</tt> (see <a class="lpdoc-idx-anchor" id="103" href="lists.html"><tt>lists</tt></a>) will not fail <em>if</em> it is called as described (but does not force the predicate to be called only that way): <pre class="lpdoc-codeblock">:- comp append(Xs,Ys,Zs) : var * var * var + not_fail.
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>comp(AssertionBody)</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="104" href="assertions_props.html#g_assrt_body/1"><tt>assertions_props:g_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a comp assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="comp/2" href="ciaosearch.html#comp/2">comp/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="105" href="ciaosearch.html#comp assertion"></a> A <tt>comp</tt> assertion can be preceded (as most other assertions) by an assertion status (<a class="lpdoc-idx-anchor" id="106" href="assertions_props.html#assrt_status/1"><tt>assrt_status/1</tt></a>). If no assertion status is present (i.e., in <a class="lpdoc-idx-anchor" id="107" href="#comp/1"><tt>comp/1</tt></a> assertions) the status is assumed to be <tt>check</tt>.<p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>comp(AssertionStatus,AssertionBody)</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="108" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="109" href="assertions_props.html#g_assrt_body/1"><tt>assertions_props:g_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a comp assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="prop/1" href="ciaosearch.html#prop/1">prop/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="110" href="ciaosearch.html#prop assertion"></a> <tt>prop</tt> assertions are similar to a <tt>pred/1</tt> assertions but they flag that the predicate being documented is also a ``<a class="lpdoc-idx-anchor" id="111" href="ciaosearch.html#property">property</a>.''<p>Properties are standard predicates, but which are <em>guaranteed to terminate for any possible instantiation state of their argument(s)</em>, do not perform side-effects which may interfere with the program behaviour, and do not further instantiate their arguments or add new constraints.<p>Provided the above holds, properties can thus be safely used as <a class="lpdoc-idx-anchor" id="112" href="ciaosearch.html#run-time checks">run-time checks</a>. The program transformation used in <tt>ciaopp</tt> for run-time checking guarantees the third requirement. It also performs some basic checks on properties which in most cases are enough for the second requirement. However, it is the user's responsibility to guarantee termination of the properties defined. (See also <a href="regtypes_doc.html">Declaring regular types</a> for some considerations applicable to writing properties.)<p>The set of properties is thus a strict subset of the set of predicates. Note that properties, in addition to being used to describe characteristics of arguments in assertions, they can also be executed (called) as any other predicates. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>prop(AssertionBody)</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="113" href="assertions_props.html#assrt_body/1"><tt>assertions_props:assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is an assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="prop/2" href="ciaosearch.html#prop/2">prop/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="114" href="ciaosearch.html#prop assertion"></a> This assertion is similar to a <a class="lpdoc-idx-anchor" id="115" href="#prop/1"><tt>prop/1</tt></a> assertion but it is explicitely qualified. Non-qualified <a class="lpdoc-idx-anchor" id="116" href="#prop/1"><tt>prop/1</tt></a> assertions are assumed the qualifier <tt>check</tt>. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>prop(AssertionStatus,AssertionBody)</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="117" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="118" href="assertions_props.html#assrt_body/1"><tt>assertions_props:assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is an assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="test/1" href="ciaosearch.html#test/1">test/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="119" href="ciaosearch.html#test assertion"></a> This assertion is similar to a success assertion but it specifies a concrete test case to be run in order verify (partially) that the predicate is working as expected. For example, the following test will verify that the length predicate works well for the particular list given: <pre class="lpdoc-codeblock">:- test length(L,N) : ( L = [1,2,5,2] ) => ( N = 4 ).
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>test(AssertionBody)</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="120" href="assertions_props.html#s_assrt_body/1"><tt>assertions_props:s_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a predicate assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="test/2" href="ciaosearch.html#test/2">test/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="121" href="ciaosearch.html#test assertion"></a> This assertion is similar to a <a class="lpdoc-idx-anchor" id="122" href="#test/1"><tt>test/1</tt></a> assertion but it is explicitely qualified with an <a class="lpdoc-idx-anchor" id="123" href="ciaosearch.html#assertion status">assertion status</a>. Non-qualified <a class="lpdoc-idx-anchor" id="124" href="#test/1"><tt>test/1</tt></a> assertions are assumed to have <tt>check</tt> status. In this context, check means that the test should be executed when the developer runs the test battery.<p><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>test(AssertionStatus,AssertionBody)</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="125" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="126" href="assertions_props.html#s_assrt_body/1"><tt>assertions_props:s_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a predicate assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="texec/1" href="ciaosearch.html#texec/1">texec/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="127" href="ciaosearch.html#texec assertion"></a> This assertion is similar to a <a class="lpdoc-idx-anchor" id="128" href="#calls/1"><tt>calls/1</tt></a> assertion but it is used to provide input data and execution commands for run-time testing. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>texec(AssertionBody)</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="129" href="assertions_props.html#c_assrt_body/1"><tt>assertions_props:c_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a call assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="texec/2" href="ciaosearch.html#texec/2">texec/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="130" href="ciaosearch.html#texec assertion"></a> This assertion is similar to a <a class="lpdoc-idx-anchor" id="131" href="#texec/1"><tt>texec/1</tt></a> assertion but it is explicitely qualified with an <a class="lpdoc-idx-anchor" id="132" href="ciaosearch.html#assertion status">assertion status</a>. Non-qualified <a class="lpdoc-idx-anchor" id="133" href="#texec/1"><tt>texec/1</tt></a> assertions are assumed to have <tt>check</tt> status. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>texec(AssertionStatus,AssertionBody)</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="134" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="135" href="assertions_props.html#c_assrt_body/1"><tt>assertions_props:c_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a call assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="entry/1" href="ciaosearch.html#entry/1">entry/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="136" href="ciaosearch.html#entry assertion"></a> <tt>entry</tt> assertions provide information about the <em>external</em> calls to a predicate. They are identical syntactically to a <a class="lpdoc-idx-anchor" id="137" href="#calls/1"><tt>calls/1</tt></a> assertion. However, they describe only the external calls, i.e., the calls to the exported predicates of a module from outside the module, or calls to the predicates in a non-modular file from other files (or the user).<p>These assertions are <em>trusted</em> by the compiler, i.e., they are similar to writing a <tt>trust calls</tt> assertion (except for referring only to the external calls). As a result, if they are erroneous they can introduce bugs in programs. Thus, <tt>entry</tt> assertions should be written with care.<p>An important use of these assertions is in <a class="lpdoc-idx-anchor" id="138" href="ciaosearch.html#providing information to the compiler">providing information to the compiler</a> which it may not be able to infer from the program. The main use is in providing information on the ways in which exported predicates of a module will be called from outside the module. This will greatly improve the precision of the analyzer, which otherwise has to assume that the arguments that exported predicates receive are any arbitrary term.<p>The distinction between external and internal calls is not always relevant and in those cases the use of <tt>trust calls</tt> assertions is preferred. Because of this, <tt>entry</tt> assertions may be deprecated in the future, since the distinction between external and internal calls can also be achieved by means of a bridge predicate.<p><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>entry(AssertionBody)</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="139" href="assertions_props.html#c_assrt_body/1"><tt>assertions_props:c_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a call assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="exit/1" href="ciaosearch.html#exit/1">exit/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="140" href="ciaosearch.html#exit assertion"></a> This type of assertion provides information about the answers that an (exported) predicate provides for <em>external</em> calls. It is identical syntactically to a <a class="lpdoc-idx-anchor" id="141" href="#success/1"><tt>success/1</tt></a> assertion. However, it describes only external answers, i.e., answers to the exported predicates of a module from outside the module, or answers to the predicates in a non-modular file from other files (or the user). The described answers may be conditioned to a particular way of calling the predicate. E.g.:<p><pre class="lpdoc-codeblock">:- exit length(L,N) : list * var => list * integer.
</pre> <p>These assertions are <em>trusted</em> by the compiler, i.e., they are similar to writing a <tt>trust success</tt> assertion (except for referring only to the external calls). As a result, if they are erroneous they can introduce bugs in programs. Thus, <tt>exit</tt> assertions should be written with care.<p>The distinction between external and internal calls is not always relevant and in those cases the use of <tt>trust success</tt> assertions is preferred. Because of this, <tt>entry</tt> assertions may be deprecated in the future, since the distinction between external and internal calls can also be achieved by means of a bridge predicate.<p><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>exit(AssertionBody)</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="142" href="assertions_props.html#s_assrt_body/1"><tt>assertions_props:s_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a predicate assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="exit/2" href="ciaosearch.html#exit/2">exit/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="143" href="ciaosearch.html#exit assertion">exit assertion</a> This assertion is similar to an <a class="lpdoc-idx-anchor" id="144" href="#exit/1"><tt>exit/1</tt></a> assertion but it is explicitely qualified with an <a class="lpdoc-idx-anchor" id="145" href="ciaosearch.html#assertion status">assertion status</a>. Non-qualified <a class="lpdoc-idx-anchor" id="146" href="#exit/1"><tt>exit/1</tt></a> assertions are assumed the qualifier <tt>check</tt>. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>exit(AssertionStatus,AssertionBody)</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="147" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="148" href="assertions_props.html#s_assrt_body/1"><tt>assertions_props:s_assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is a predicate assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="modedef/1" href="ciaosearch.html#modedef/1">modedef/1</a></div><div class="lpdoc-deftext">This assertion is used to define modes. A mode defines in a compact way a set of call and success properties. Once defined, modes can be applied to predicate arguments in assertions. The meaning of this application is that the call and success properties defined by the mode hold for the argument to which the mode is applied. Thus, a mode is conceptually a ``property macro.''<p>The syntax of mode definitions is similar to that of <tt>pred</tt> declarations. For example, the following set of assertions:<p><pre class="lpdoc-codeblock">:- modedef +A : nonvar(A) # "<span class="lpdoc-var">A</span> is bound upon predicate entry.".
:- pred p(+A,B) : integer(A) => ground(B).
</pre> <p>is equivalent to:<p><pre class="lpdoc-codeblock">:- pred p(A,B) : (nonvar(A),integer(A)) => ground(B)
# "<span class="lpdoc-var">A</span> is bound upon predicate entry.".
</pre> <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>modedef(AssertionBody)</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="149" href="assertions_props.html#assrt_body/1"><tt>assertions_props:assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is an assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="decl/1" href="ciaosearch.html#decl/1">decl/1</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="150" href="ciaosearch.html#decl assertion"></a> This assertion is similar to a <a class="lpdoc-idx-anchor" id="151" href="#pred/1"><tt>pred/1</tt></a> assertion but it is used to describe declarations instead of predicates. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>decl(AssertionBody)</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="152" href="assertions_props.html#assrt_body/1"><tt>assertions_props:assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is an assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="decl/2" href="ciaosearch.html#decl/2">decl/2</a></div><div class="lpdoc-deftext"><a class="lpdoc-idx-anchor" id="153" href="ciaosearch.html#decl assertion"></a> This assertion is similar to a <a class="lpdoc-idx-anchor" id="154" href="#decl/1"><tt>decl/1</tt></a> assertion but it also has a status. Non-qualified <a class="lpdoc-idx-anchor" id="155" href="#decl/1"><tt>decl/1</tt></a> assertions are assumed to have status <tt>check</tt>. <p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>decl(AssertionStatus,AssertionBody)</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="156" href="assertions_props.html#assrt_status/1"><tt>assertions_props:assrt_status/1</tt></a>)</span><span><span class="lpdoc-var">AssertionStatus</span> is an acceptable status for an assertion.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="157" href="assertions_props.html#assrt_body/1"><tt>assertions_props:assrt_body/1</tt></a>)</span><span><span class="lpdoc-var">AssertionBody</span> is an assertion body.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="doc/2" href="ciaosearch.html#doc/2">doc/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>doc(Pred,Comment)</tt>.
</span><p>Documentation <a class="lpdoc-idx-anchor" id="158" href="ciaosearch.html#comment assertion"></a>. This assertion provides a text <span class="lpdoc-var">Comment</span> for a given predicate <span class="lpdoc-var">Pred</span>, as well as other directives for the documenter.</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="159" href="assertions_props.html#head_pattern/1"><tt>assertions_props:head_pattern/1</tt></a>)</span><span><span class="lpdoc-var">Pred</span> is a head pattern.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="162" href="assertions_props.html#docstring/1"><tt>assertions_props:docstring/1</tt></a>)</span><span><span class="lpdoc-var">Comment</span> is a text comment with admissible documentation commands. The usual formatting commands that are applicable in comment strings are defined by <a class="lpdoc-idx-anchor" id="160" href="ciaosearch.html#stringcommand/1"><tt>stringcommand/1</tt></a>. See the <a class="lpdoc-idx-anchor" id="161" href="ciaosearch.html#lpdoc"><tt>lpdoc</tt></a> manual for documentation on comments.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">DECLARATION</span><a class="lpdoc-idx-anchor" id="comment/2" href="ciaosearch.html#comment/2">comment/2</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl">:- <tt>comment(Pred,Comment)</tt>.
</span><p>An alias for <a class="lpdoc-idx-anchor" id="163" href="#doc/2"><tt>doc/2</tt></a> (deprecated, for compatibility with older versions).</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="164" href="assertions_props.html#head_pattern/1"><tt>assertions_props:head_pattern/1</tt></a>)</span><span><span class="lpdoc-var">Pred</span> is a head pattern.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="167" href="assertions_props.html#docstring/1"><tt>assertions_props:docstring/1</tt></a>)</span><span><span class="lpdoc-var">Comment</span> is a text comment with admissible documentation commands. The usual formatting commands that are applicable in comment strings are defined by <a class="lpdoc-idx-anchor" id="165" href="ciaosearch.html#stringcommand/1"><tt>stringcommand/1</tt></a>. See the <a class="lpdoc-idx-anchor" id="166" href="ciaosearch.html#lpdoc"><tt>lpdoc</tt></a> manual for documentation on comments.
</span>
<li><em>The following properties should hold globally:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="168" href="basic_props.html#deprecated/1"><tt>basic_props:deprecated/1</tt></a>)</span><span><strong>DEPRECATED.</strong>
</span>
</ul></div></div><p>
</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="check/1" href="ciaosearch.html#check/1">check/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>check(PropertyConjunction)</tt>
</span><p><a class="lpdoc-idx-anchor" id="169" href="ciaosearch.html#check assertion"></a> This assertion provides information on a clause program point (position in the body of a clause). Calls to a <a class="lpdoc-idx-anchor" id="170" href="#check/1"><tt>check/1</tt></a> assertion can appear in the body of a clause in any place where a literal can normally appear. The property defined by <span class="lpdoc-var">PropertyConjunction</span> should hold in all the run-time stores corresponding to that program point. See also <span class="lpdoc-missing">Run-time checking of assertions</span>.</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="171" href="assertions_props.html#property_conjunction/1"><tt>assertions_props:property_conjunction/1</tt></a>)</span><span><span class="lpdoc-var">PropertyConjunction</span> is either a term or a <em>conjunction</em> of terms. The main functor and arity of each of those terms corresponds to the definition of a property. The first argument of each such term is a variable which appears as a head argument.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="trust/1" href="ciaosearch.html#trust/1">trust/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>trust(PropertyConjunction)</tt>
</span><p><a class="lpdoc-idx-anchor" id="172" href="ciaosearch.html#trust assertion"></a> This assertion also provides information on a clause program point. It is identical syntactically to a <a class="lpdoc-idx-anchor" id="173" href="#check/1"><tt>check/1</tt></a> assertion. However, the properties stated are not taken as something to be checked but are instead <em>trusted</em> by the compiler. While the compiler may in some cases detect an inconsistency between a <a class="lpdoc-idx-anchor" id="174" href="#trust/1"><tt>trust/1</tt></a> assertion and the program, in all other cases the information given in the assertion will be taken to be true. As a result, if these assertions are erroneous they can introduce bugs in programs. Thus, <a class="lpdoc-idx-anchor" id="175" href="#trust/1"><tt>trust/1</tt></a> assertions should be written with care.<p>An important use of these assertions is in <a cla