This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/cplint/doc/manual.html
2007-11-08 17:58:30 +00:00

894 lines
40 KiB
HTML
Raw Blame History

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title>cplint Version 1.0 Manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<!-- html -->
<meta name="src" content="manual.tex">
<meta name="date" content="2007-11-08 18:55:00">
<link rel="stylesheet" type="text/css" href="manual.css">
</head><body
>
<div class="maketitle">
<h2 class="titleHead">cplint Version 1.0 Manual</h2>
<div class="author" ><span
class="cmr-12">Fabrizio Riguzzi</span>
<br /><span
class="cmr-12">fabrizio.riguzzi@unife.it</span></div>
<br />
<div class="date" ><span
class="cmr-12">November 8, 2007</span></div>
</div>
<h3 class="sectionHead"><span class="titlemark">1 </span> <a
id="x1-10001"></a>Introduction</h3>
<!--l. 30--><p class="noindent" ><span
class="cmtt-10">cplint </span>is an interpreter for LPADs <span class="cite">[<a
href="#XVenVer03-TR">10</a>,&#x00A0;<a
href="#XVenVer04-ICLP04-IC">11</a>]</span> and CP-logic programs <span class="cite">[<a
href="#XVenDenBru-JELIA06">9</a>,&#x00A0;<a
href="#XCP-logic-unp">12</a>]</span>. It is
described in <span class="cite">[<a
href="#XRig-AIIA07-IC">6</a>]</span> and <span class="cite">[<a
href="#XRig-RCRA07-IC">7</a>]</span>. It is an adaptation of the interpreter for ProbLog
<span class="cite">[<a
href="#XDBLP:conf/ijcai/RaedtKT07">3</a>]</span>.
<!--l. 32--><p class="indent" > It was proved correct <span class="cite">[<a
href="#XRig-RCRA07-IC">7</a>]</span> for range restricted acyclic programs <span class="cite">[<a
href="#XDBLP:journals/ngc/AptB91">1</a>]</span> without function
symbols.
<!--l. 34--><p class="indent" > It is also able to deal with extensions of LPADs and CP-logic: the clause bodies
can contain <span
class="cmtt-10">setof </span>and <span
class="cmtt-10">bagof</span>, the probabilities in the head may be depend on
variables in the body and it is possible to specify a uniform distribution in the head
with reference to a <span
class="cmtt-10">setof </span>or <span
class="cmtt-10">bagof </span>operator. These extended features have been
introduced in order to represent CLP(BN) <span class="cite">[<a
href="#XSanPagQaz03-UAI-IC">8</a>]</span> programs and PRM models <span class="cite">[<a
href="#XGetoor+al:JMLR02">5</a>]</span>: <span
class="cmtt-10">setof</span>
and <span
class="cmtt-10">bagof </span>allow to express dependency of an attribute from an aggregate function of
another attribute, as in CLP(BN) and PRM, while the possibility of specifying a
uniform distribution allows the use of the reference uncertainty feature of
PRM.
<!--l. 37--><p class="indent" > These extensions are work in progress: they have been implemented but there is
no paper yet that describes the semantics of the extended language.
<!--l. 41--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">2 </span> <a
id="x1-20002"></a>Installation</h3>
<!--l. 42--><p class="noindent" ><span
class="cmtt-10">cplint </span>is distributed in source code in the CVS version of Yap. Download it by
following the instruction in <a
href="http://www.ncc.up.pt/%7Evsc/Yap/downloads.html" > http://www.ncc.up.pt/%7Evsc/Yap/downloads.html
</a>.
<!--l. 44--><p class="indent" > <span
class="cmtt-10">cplint </span>requires glu (a subpackage of vis) and glib. You can download glu from <a
href="http://vlsi.colorado.edu/%7Evis/getting_VIS_2.1.html" >
http://vlsi.colorado.edu/%7Evis/getting_VIS_2.1.html </a> You can download glib from
<a
href="http://www.gtk.org/" > http://www.gtk.org/ </a>. This is a standard GNU package so it is easy to
install it using the package management software of your Linux or Cygwin
distribution.
<!--l. 50--><p class="indent" > Install glu:
<ol class="enumerate1" >
<li
class="enumerate" id="x1-2002x1">downlad <span
class="cmtt-10">glu-2.1.tar.gz</span>
</li>
<li
class="enumerate" id="x1-2004x2">decompress it
</li>
<li
class="enumerate" id="x1-2006x3"><span
class="cmtt-10">cd glu-2.1</span>
</li>
<li
class="enumerate" id="x1-2008x4"><span
class="cmtt-10">mkdir arch</span>
</li>
<li
class="enumerate" id="x1-2010x5"><span
class="cmtt-10">cd arch</span>
</li>
<li
class="enumerate" id="x1-2012x6"><span
class="cmtt-10">../configure</span>
</li>
<li
class="enumerate" id="x1-2014x7"><span
class="cmtt-10">make</span>
</li>
<li
class="enumerate" id="x1-2016x8"><span
class="cmtt-10">su</span>
</li>
<li
class="enumerate" id="x1-2018x9"><span
class="cmtt-10">make install</span></li></ol>
<!--l. 62--><p class="noindent" >This will install glu into <span
class="cmtt-10">/usr/local</span>, if you want to install to a different <span
class="cmtt-10">DIR </span>use
<span
class="cmtt-10">../configure --prefix DIR</span>
<!--l. 65--><p class="indent" > Install Yap together with <span
class="cmtt-10">cplint</span>: when compiling Yap following the instuction of
the <span
class="cmtt-10">INSTALL </span>file in the root of the Yap folder, use
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
configure&#x00A0;--enable-cplint
</div>
</td></tr></table>
<!--l. 69--><p class="nopar" > Under Windows, you have to use Cygwin (glu does not compile under MinGW),
so
<br class="newline" />
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
configure&#x00A0;--enable-cplint&#x00A0;--enable-cygwin
</div>
</td></tr></table>
<!--l. 73--><p class="nopar" > If you installed glu in <span
class="cmtt-10">DIR</span>, use <span
class="cmtt-10">--enable-cplint=DIR</span>
<!--l. 76--><p class="indent" > After having performed <span
class="cmtt-10">make install </span>you can do <span
class="cmtt-10">make installcheck </span>that will
execute a test of <span
class="cmtt-10">cplint</span>. If no error is reported you have a working installation of
<span
class="cmtt-10">cplint</span>.
<!--l. 79--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3 </span> <a
id="x1-30003"></a>Syntax</h3>
<!--l. 81--><p class="noindent" >Disjunction in the head is represented with a semicolon and atoms in the head are
separated from probabilities by a colon. For the rest, the usual syntax of Prolog is
used. For example, the CP-logic clause
<center class="math-display" >
<img
src="manual0x.png" alt="h1 : p1 &#x2228;...&#x2228; hn : pn &#x2190; b1,...,bm,<2C>c1,...,<2C>cl " class="math-display" ></center> is
represented by
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
h1:p1&#x00A0;;&#x00A0;...&#x00A0;;&#x00A0;hn:pn&#x00A0;:-&#x00A0;b1,...,bm,\+&#x00A0;c1,....,\+&#x00A0;cl
</div>
</td></tr></table>
<!--l. 87--><p class="nopar" > No parentheses are necessary. The <span
class="cmtt-10">pi </span>are numeric expressions that can involve
variables appearing in the body. It is up to the user to ensure that the numeric
expressions are legal, i.e. that they sum up to less than one for every instantiation of
the clause for which the body is true in an instance.
<!--l. 91--><p class="indent" > If the clause has an empty body, it can be represented like this
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
h1:p1&#x00A0;;&#x00A0;...&#x00A0;;hn:pn.
</div>
</td></tr></table>
<!--l. 94--><p class="nopar" > If the clause has a single head with probability 1, the annotation can be omitted and
the clause takes the form of a normal prolog clause, i.e.
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
h1:-&#x00A0;b1,...,bm,\+&#x00A0;c1,...,cl.
</div>
</td></tr></table>
<!--l. 98--><p class="nopar" > stands for
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
h1:1&#x00A0;:-&#x00A0;b1,...,bm,\+&#x00A0;c1,...,cl.
</div>
</td></tr></table>
<!--l. 102--><p class="nopar" >
<!--l. 104--><p class="indent" > The coin example of <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">11</a>]</span> is represented as (see file <span
class="cmtt-10">coin.cpl</span>)
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
heads(Coin):1/2&#x00A0;;&#x00A0;tails(Coin):1/2:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;toss(Coin),\+biased(Coin).
&#x00A0;<br />
&#x00A0;<br />heads(Coin):0.6&#x00A0;;&#x00A0;tails(Coin):0.4:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;toss(Coin),biased(Coin).
&#x00A0;<br />
&#x00A0;<br />fair(Coin):0.9&#x00A0;;&#x00A0;biased(Coin):0.1.
&#x00A0;<br />
&#x00A0;<br />toss(coin).
</div>
</td></tr></table>
<!--l. 115--><p class="nopar" > The first clause states that if we toss a coin that is not biased it has equal
probability of landing heads and tails. The second states that if the coin is biased it
is slightly more probable that it lands heads. The third states that the coin is fair
with probability 0.9 and biased with probability 0.1 and the last clause states that we
toss a coin with certainty.
<!--l. 120--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">4 </span> <a
id="x1-40004"></a>Commands</h3>
<!--l. 121--><p class="noindent" >The program must be stored in a text file with extension <span
class="cmtt-10">.cpl</span>. Suppose
you have stored the example above in file <span
class="cmtt-10">coin.cpl</span>. In order to answer
queries from this program, you have to run <span
class="cmtt-10">yap</span>, load <span
class="cmtt-10">cplint </span>by issuing the
command
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
use_module(library(cplint)).
</div>
</td></tr></table>
<!--l. 126--><p class="nopar" > at the command prompt. Then you must parse the source file <span
class="cmtt-10">coin.cpl </span>with the
command
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
p(coin).
</div>
</td></tr></table>
<!--l. 131--><p class="nopar" > if <span
class="cmtt-10">coin.cpl </span>is in the current directory, or
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
p(&#8217;path_to_coin/coin&#8217;).
</div>
</td></tr></table>
<!--l. 135--><p class="nopar" > if <span
class="cmtt-10">coin.cpl </span>is in a different directory. At this point you can pose query to the
program. You have to use the predicate <span
class="cmtt-10">s/2 </span>(for solve) that takes as its first
argument a conjunction of goals in the form of a list and returns the computed
probability as its second argument. For example, the probability of the conjunction
<span
class="cmtt-10">head(coin), biased(coin) </span>can be asked with the query
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
s([head(coin),biased(coin)],P).
</div>
</td></tr></table>
<!--l. 140--><p class="nopar" > For computing the probability of a conjunction given another conjunction you have
to use the predicate <span
class="cmtt-10">sc/3 </span>(for solve conditional) that take takes as input the query
conjunction as its first argument, the evidence conjunction as its second argument
and returns the probability in its third argument. For example, the probability of the
query <span
class="cmtt-10">heads(coin) </span>given the evidence <span
class="cmtt-10">biased(coin) </span>can be asked with the
query
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
sc([heads(coin)],[biased(coin)],P).
</div>
</td></tr></table>
<!--l. 145--><p class="nopar" > The package contains also a program <span
class="cmtt-10">semantics.pl </span>that computes the probability
of queries by using directly the semantics of LPADs (i.e. by generating all the ground
instances and then testing the query with each of them). This is provided for testing
purposes only. After having compiled the program, you can use the same commands
of <span
class="cmtt-10">cplint.pl</span>. <span
class="cmtt-10">semantics.pl </span>requires an extra file in the directory where <span
class="cmtt-10">coin.cpl</span>
is: a file with extension <span
class="cmtt-10">.uni </span>(for universe) that contains, for each variable, the list of
constants to which the variable can be instantiated. For example, in our case the
current directory will contain a file <span
class="cmtt-10">coin.uni </span>that is a Prolog file containing facts of
the form
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
universe(VarList,ConstList).
</div>
</td></tr></table>
<!--l. 149--><p class="nopar" > where <span
class="cmtt-10">VarList </span>is a list of variables names (each must be included in single quotes)
and <span
class="cmtt-10">ConstList </span>is a list of constants. <span
class="cmtt-10">semantics.pl </span>generates the grounding by
instantiating in all possible ways the variables of <span
class="cmtt-10">VarList </span>with the constants of
<span
class="cmtt-10">ConstList</span>. Note that the variables are identified by name, so a variable with
the same name in two different clauses will be instantiated with the same
constants.
<!--l. 152--><p class="indent" > You can test your installation of <span
class="cmtt-10">cplint </span>by using the program <span
class="cmtt-10">test.pl</span>: compile
<span
class="cmtt-10">cplint.pl</span>, compile <span
class="cmtt-10">test.pl </span>and exectue the query <span
class="cmtt-10">t</span>. A number of queries are
executed against the example programs and the returned probabilities are checked: if
<span
class="cmtt-10">t. </span>succeeds, then <span
class="cmtt-10">cplint </span>is working.
<!--l. 157--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">5 </span> <a
id="x1-50005"></a>Extensions</h3>
<!--l. 158--><p class="noindent" >In this section we will present the extensions to the syntax of LPADs and CP-logic
programs that <span
class="cmtt-10">cplint </span>can handle.
<!--l. 160--><p class="indent" > The first is the use of some standard Prolog predicates. The bodies can contain
the built-in predicates:
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
is/2
&#x00A0;<br />&#x003E;/2
&#x00A0;<br />&#x003C;/2
&#x00A0;<br />&#x003E;=/2
&#x00A0;<br />=&#x003C;/2
&#x00A0;<br />=:=/2
&#x00A0;<br />=\=/2
&#x00A0;<br />true/0
&#x00A0;<br />false/0
&#x00A0;<br />=/2
&#x00A0;<br />==/2
&#x00A0;<br />\=/2
&#x00A0;<br />\==/2
&#x00A0;<br />length/2
</div>
</td></tr></table>
<!--l. 177--><p class="nopar" > The bodies can also contain the following library predicates:
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
member/2
&#x00A0;<br />max_list/2
&#x00A0;<br />min_list/2
&#x00A0;<br />nth0/3
&#x00A0;<br />nth/3
</div>
</td></tr></table>
<!--l. 186--><p class="nopar" > plus the predicate
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
average/2
</div>
</td></tr></table>
<!--l. 190--><p class="nopar" > that, given a list of numbers, computes its arithmetic mean.
<!--l. 193--><p class="indent" > Moreover, the bodies can contain the predicates <span
class="cmtt-10">setof/3 </span>and <span
class="cmtt-10">bagof/3 </span>with the
same meaning as in Prolog. Existential quantifiers are allowed in both, so for example
the query
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
setof(Z,&#x00A0;(term(X,Y))^foo(X,Y,Z),&#x00A0;L).
</div>
</td></tr></table>
<!--l. 196--><p class="nopar" > returns all the instantiations of <span
class="cmtt-10">Z </span>such that there exists an instantiation of <span
class="cmtt-10">X </span>and <span
class="cmtt-10">Y</span>
for which <span
class="cmtt-10">foo(X,Y,Z) </span>is true.
<!--l. 199--><p class="indent" > An example of the use of <span
class="cmtt-10">setof </span>and <span
class="cmtt-10">bagof </span>is in the file <span
class="cmtt-10">female.cpl</span>:
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
male(C):M/P&#x00A0;;&#x00A0;female(C):F/P:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;person(C),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;setof(Male,known_male(Male),LM),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;length(LM,M),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;setof(Female,known_female(Female),LF),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;length(LF,F),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;P&#x00A0;is&#x00A0;F+M.
&#x00A0;<br />
&#x00A0;<br />person(f).
&#x00A0;<br />
&#x00A0;<br />known_female(a).
&#x00A0;<br />
&#x00A0;<br />known_female(b).
&#x00A0;<br />
&#x00A0;<br />known_female(c).
&#x00A0;<br />
&#x00A0;<br />known_male(d).
&#x00A0;<br />
&#x00A0;<br />known_male(e).
</div>
</td></tr></table>
<!--l. 220--><p class="nopar" > The disjunctive rule expresses the probability of a person of unknown sex of being
male or female depending on the number of males and females that are known. This
is an example of the use of expressions in the probabilities in the head that depend
on variables in the body. The probabilities are well defined because they always sum
to 1 (unless <span
class="cmtt-10">P </span>is 0).
<!--l. 224--><p class="indent" > Another use of <span
class="cmtt-10">setof </span>and <span
class="cmtt-10">bagof </span>is to have an attribute depend on an
aggregate function of another attribute, similarly to what is done in PRM and
CLP(BN).
<!--l. 226--><p class="indent" > So, in the classical school example (available in <span
class="cmtt-10">student.cpl</span>) you can find the
following clauses:
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
student_rank(S,h):0.6&#x00A0;;&#x00A0;student_rank(S,l):0.4:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(G,R^(registr_stu(R,S),registr_gr(R,G)),L),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;average(L,Av),Av&#x003E;1.5.
&#x00A0;<br />
&#x00A0;<br />student_rank(S,h):0.4&#x00A0;;&#x00A0;student_rank(S,l):0.6:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(G,R^(registr_stu(R,S),registr_gr(R,G)),L),
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;average(L,Av),Av&#x00A0;=&#x003C;&#x00A0;1.5.
</div>
</td></tr></table>
<!--l. 236--><p class="nopar" > where <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">registr_stu(R,S)</span></span></span> expresses that registration <span
class="cmtt-10">R </span>refers to student <span
class="cmtt-10">S </span>and
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">registr_gr(R,G)</span></span></span> expresses that registration <span
class="cmtt-10">R </span>reports grade <span
class="cmtt-10">G </span>which is a natural
number. The two clauses express a dependency of the rank of the student from the
average of her grades.
<!--l. 239--><p class="indent" > Another extension has been introduced in order to be able to represent reference
uncertainty of PRMs. Reference uncertainty means that the link structure of a
relational model is not fixed but is uncertain: this is represented by having the
instance referenced in a relationship be chosen uniformly from a set. For example,
consider a domain modeling scientific papers: you have a single entity, paper, and a
relationship, cites, between paper and itself that connects the citing paper to the
cited paper. To represent the fact that the cited paper and the citing paper are
selected uniformly from certain sets, the following clauses can be used (see file
<span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref_simple.cpl</span></span></span>):
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
uniform(cites_cited(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(Pap,paper_topic(Pap,theory),L).
&#x00A0;<br />
&#x00A0;<br />uniform(cites_citing(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;bagof(Pap,paper_topic(Pap,ai),L).
</div>
</td></tr></table>
<!--l. 246--><p class="nopar" > The first clauses states that the paper <span
class="cmtt-10">P </span>cited in a citation <span
class="cmtt-10">C </span>is selected
uniformly from the set of all papers with topic theory. The second clauses
expresses that the citing paper is selected uniformly from the papers with topic
ai.
<!--l. 251--><p class="indent" > These clauses make use of the predicate
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
uniform(Atom,Variable,List)
</div>
</td></tr></table>
<!--l. 254--><p class="nopar" > in the head, where <span
class="cmtt-10">Atom </span>must contain <span
class="cmtt-10">Variable</span>. The meaning is the following:
the set of all the atoms obtained by instantiating <span
class="cmtt-10">Variable </span>of <span
class="cmtt-10">Atom </span>with a
term taken from <span
class="cmtt-10">List </span>is generated and the head is obtained by having a
disjunct for each instantiation with probability 1<span
class="cmmi-10">&#x2215;N </span>where <span
class="cmmi-10">N </span>is the length of
<span
class="cmtt-10">List</span>.
<!--l. 258--><p class="indent" > A more elaborate example is present in file <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref.cpl</span></span></span>:
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
uniform(cites_citing(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;setof(Pap,paper(Pap),L).
&#x00A0;<br />
&#x00A0;<br />cites_cited_group(C,theory):0.9&#x00A0;;&#x00A0;cites_cited_group(C,ai):0.1:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;cites_citing(C,P),paper_topic(P,theory).
&#x00A0;<br />
&#x00A0;<br />cites_cited_group(C,theory):0.01;cites_cited_group(C,ai):0.99:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;cites_citing(C,P),paper_topic(P,ai).
&#x00A0;<br />
&#x00A0;<br />uniform(cites_cited(C,P),P,L):-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;cites_cited_group(C,T),bagof(Pap,paper_topic(Pap,T),L).
</div>
</td></tr></table>
<!--l. 271--><p class="nopar" > where the cited paper depends on the topic of the citing paper. In particular, if the
topic is theory, the cited paper is selected uniformly from the papers about theory
with probability 0.9 and from the papers about ai with probability 0.1. if
the topic is ai, the cited paper is selected uniformly from the papers about
theory with probability 0.01 and from the papers about ai with probability
0.99.
<!--l. 274--><p class="indent" > PRMs take into account as well existence uncertainty, where the existence of
instances is also probabilistic. For example, in the paper domain, the total number of
citations may be unknown and a citation between any two paper may have a
probability of existing. For example, a citation between two paper may be more
probable if they are about the same topic:
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
cites(X,Y):0.005&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,theory),paper_topic(Y,theory).
&#x00A0;<br />
&#x00A0;<br />cites(X,Y):0.001&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,theory),paper_topic(Y,ai).
&#x00A0;<br />
&#x00A0;<br />cites(X,Y):0.003&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,ai),paper_topic(Y,theory).
&#x00A0;<br />
&#x00A0;<br />cites(X,Y):0.008&#x00A0;:-
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;paper_topic(X,ai),paper_topic(Y,ai).
</div>
</td></tr></table>
<!--l. 287--><p class="nopar" > This is an example of a CP-logic program, because the probabilities in the head do
not sum up to one. The first clause states that, if the topic of a paper <span
class="cmtt-10">X </span>is
theory and of paper <span
class="cmtt-10">Y </span>is theory, there is a probability of 0.005 that there is a
citation from <span
class="cmtt-10">X </span>to <span
class="cmtt-10">Y</span>. The other clauses consider the remaining cases for the
topics.
<!--l. 291--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">6 </span> <a
id="x1-60006"></a>Parameters</h3>
<!--l. 292--><p class="noindent" >The proof procedure has two parameters that can be set with the command
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
set(parameter,value).
</div>
</td></tr></table>
<!--l. 295--><p class="nopar" > from the Yap prompt after having compiled <span
class="cmtt-10">cplint.pl</span>. The current value can be
read with
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
setting(parameter,Value).
</div>
</td></tr></table>
<!--l. 300--><p class="nopar" > from the Yap prompt. Available parameters:
<ul class="itemize1">
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_parsing</span></span></span>: if (1 - the sum of the probabilities of all the head
atoms) is smaller than <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">epsilon_parsing</span></span></span> then the clause is considered as
an LPAD clause, otherwise it is considered as a CP-logic clause. Default
value 0.00001
</li>
<li class="itemize"><span
class="cmtt-10">savedot</span>: if true a graph representing the BDD is saved in the file <span
class="cmtt-10">cpl.dot </span>in
the current directory in dot format. The variables names are of the
form <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">Xn_m</span></span></span> where <span
class="cmtt-10">n </span>is the number of the multivalued variable and <span
class="cmtt-10">m </span>is
the number of the binary variable. The correspondence of variables
to clauses can be evinced from the list printed on the screen of the
form
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
Variables:&#x00A0;[(2,[X=2,X1=1]),(2,[X=1,X1=0]),(1,[])]
</div>
</td></tr></table>
<!--l. 315--><p class="nopar" > where the first element of each couple is the clause number of the input file
(starting from 1). In the example above variable <span
class="cmtt-10">X0 </span>corresponds to clause <span
class="cmtt-10">2</span>
with the substitutions <span
class="cmtt-10">X=2,X1=1</span>, variable <span
class="cmtt-10">X1 </span>corresponds to clause <span
class="cmtt-10">2 </span>with the
substitutions <span
class="cmtt-10">X=1,X1=0 </span>and variable <span
class="cmtt-10">X2 </span>corresponds to clause <span
class="cmtt-10">1 </span>with the empty
substitution. You can view the graph with <span
class="cmtt-10">graphviz </span>(<a
href="www.graphviz.org" > www.graphviz.org </a>)
using the command
<table
class="verbatim"><tr class="verbatim"><td
class="verbatim"><div class="verbatim">
dotty&#x00A0;cpl.dot&#x00A0;&amp;
</div>
</td></tr></table>
<!--l. 324--><p class="nopar" ></li></ul>
<!--l. 328--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">7 </span> <a
id="x1-70007"></a>Additional Files</h3>
<!--l. 329--><p class="noindent" >In the directory where Yap keeps the library files (usually <span
class="cmtt-10">/usr/local/share/Yap</span>)
you can find the directory <span
class="cmtt-10">cplint </span>that contains additional files. <span
class="cmtt-10">cplint</span>
contains
<ul class="itemize1">
<li class="itemize"><span
class="cmtt-10">semantics.pl</span>: Prolog program for computing the probability according
to the semantics.
</li>
<li class="itemize"><span
class="cmtt-10">test.pl</span>: Prolog program for testing the system.
</li>
<li class="itemize">Subdirectory <span
class="cmtt-10">examples</span>:
<ul class="itemize2">
<li class="itemize"><span
class="cmtt-10">alarm.cpl</span>: representation of the Bayesian network in Figure 2 of
<span class="cite">[<a
href="#XVenVer04-ICLP04-IC">11</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">coin.cpl</span>: coin example from <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">11</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">coin2.cpl</span>: coin example with two coins.
</li>
<li class="itemize"><span
class="cmtt-10">dice.cpl</span>: dice example from <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">11</a>]</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">twosideddice.cpl,threesideddice.cpl</span></span></span> game with idealized dice
with two or three sides. Used in the experiments in <span class="cite">[<a
href="#XRig-RCRA07-IC">7</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">es.cpl</span>: first example in <span class="cite">[<a
href="#XRig-RCRA07-IC">7</a>]</span>.
</li>
<li class="itemize"><span
class="cmtt-10">esapprox.cpl</span>: example showing the problems of approximate
inference (see <span class="cite">[<a
href="#XRig-RCRA07-IC">7</a>]</span>).
</li>
<li class="itemize"><span
class="cmtt-10">esrange.cpl</span>: example showing the problems with non range
restricted programs (see <span class="cite">[<a
href="#XRig-RCRA07-IC">7</a>]</span>).
</li>
<li class="itemize"><span
class="cmtt-10">female.cpl</span>: example showing the dependence of probabilities in the
head from variables in the body (from <span class="cite">[<a
href="#XVenVer04-ICLP04-IC">11</a>]</span>).
</li>
<li class="itemize"><span
class="cmtt-10">mendel.cpl</span>: program describing the Mendelian rules of inheritance,
taken from <span class="cite">[<a
href="#XBlo04-ILP04WIP-IC">2</a>]</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref.cpl,paper_ref_simple.cpl</span></span></span>: paper citations examples,
showing reference uncertainty, inspired by <span class="cite">[<a
href="#XGetoor+al:JMLR02">5</a>]</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">paper_ref_not.cpl</span></span></span>: paper citations example showing that negation
can be used also for predicates defined by clauses with <span
class="cmtt-10">uniform </span>in
the head.
</li>
<li class="itemize"><span
class="cmtt-10">school.cpl</span>: example inspired by the example <span class="obeylines-h"><span class="verb"><span
class="cmtt-10">school_32.yap</span></span></span> from
the source distribution of Yap in the <span
class="cmtt-10">CLPBN </span>directory.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">school_simple.cpl</span></span></span>: simplified version of <span
class="cmtt-10">school.cpl</span>.
</li>
<li class="itemize"><span class="obeylines-h"><span class="verb"><span
class="cmtt-10">student.cpl</span></span></span>: student example from Figure 1.3 of <span class="cite">[<a
href="#XGetFri01-BC">4</a>]</span>.</li></ul>
<!--l. 354--><p class="noindent" >The files <span
class="cmtt-10">*.uni </span>that are present for some of the examples are used by
<span
class="cmtt-10">semantics.pl</span>. Some of the example files contain in an initial comment some
queries together with their result.
</li>
<li class="itemize">Subdirectory <span
class="cmtt-10">doc</span>: contains this manual in latex, html and pdf.</li></ul>
<!--l. 357--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">8 </span> <a
id="x1-80008"></a>License</h3>
<!--l. 362--><p class="noindent" ><span
class="cmtt-10">cplint</span>, as Yap, follows the Artistic License 2.0 that you can find in Yap CVS root
dir. The copyright is by Fabrizio Riguzzi.
<!--l. 367--><p class="indent" > The program uses the library <a
href="http://vlsi.colorado.edu/%7Efabio/" > CUDD </a> for manipulating BDDs that is included in
glu. For the use of CUDD, the following license must be accepted:
<!--l. 372--><p class="indent" > Copyright (c) 1995-2004, Regents of the University of Colorado
<!--l. 374--><p class="indent" > All rights reserved.
<!--l. 376--><p class="indent" > Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
<ul class="itemize1">
<li class="itemize">Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
</li>
<li class="itemize">Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
</li>
<li class="itemize">Neither the name of the University of Colorado nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.</li></ul>
<!--l. 393--><p class="noindent" >THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS &#8221;AS IS&#8221; AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
<!--l. 1--><p class="noindent" >
<h3 class="likesectionHead"><a
id="x1-90008"></a>References</h3>
<!--l. 1--><p class="noindent" >
<div class="thebibliography">
<p class="bibitem" ><span class="biblabel">
[1]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:journals/ngc/AptB91"></a>K.&#x00A0;R. Apt and M.&#x00A0;Bezem. Acyclic programs. <span
class="cmti-10">New Generation</span>
<span
class="cmti-10">Comput.</span>, 9(3/4):335&#8211;364, 1991.
</p>
<p class="bibitem" ><span class="biblabel">
[2]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XBlo04-ILP04WIP-IC"></a>H.&#x00A0;Blockeel. Probabilistic logical models for mendel&#8217;s experiments: An
exercise. In <span
class="cmti-10">Inductive Logic Programming (ILP 2004), Work in Progress</span>
<span
class="cmti-10">Track</span>, 2004.
</p>
<p class="bibitem" ><span class="biblabel">
[3]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XDBLP:conf/ijcai/RaedtKT07"></a>L.&#x00A0;De&#x00A0;Raedt, A.&#x00A0;Kimmig, and H.&#x00A0;Toivonen. Problog: A probabilistic
prolog and its application in link discovery. In <span
class="cmti-10">Proceedings of the 20th</span>
<span
class="cmti-10">International Joint Conference on Artificial Intelligence</span>, pages 2462&#8211;2467,
2007.
</p>
<p class="bibitem" ><span class="biblabel">
[4]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XGetFri01-BC"></a>L.&#x00A0;Getoor, N.&#x00A0;Friedman, D.&#x00A0;Koller, and A.&#x00A0;Pfeffer. Learning
probabilistic relational models. In Saso Dzeroski and Nada Lavrac, editors,
<span
class="cmti-10">Relational Data Mining</span>. Springer-Verlag, Berlin, 2001.
</p>
<p class="bibitem" ><span class="biblabel">
[5]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XGetoor+al:JMLR02"></a>L.&#x00A0;Getoor, N.&#x00A0;Friedman, D.&#x00A0;Koller, and B.&#x00A0;Taskar. Learning
probabilistic models of relational structure. <span
class="cmti-10">Journal of Machine Learning</span>
<span
class="cmti-10">Research</span>, 3:679&#8211;707, December 2002.
</p>
<p class="bibitem" ><span class="biblabel">
[6]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XRig-AIIA07-IC"></a>Fabrizio Riguzzi. A top down interpreter for lpad and cp-logic. In
<span
class="cmti-10">10th Congress of the Italian Association for Artificial Intelligence</span>. Springer,
2007.
<a
href="http://www.ing.unife.it/docenti/FabrizioRiguzzi/Papers/Rig-AIIA07.pdf" > http://www.ing.unife.it/docenti/FabrizioRiguzzi/Papers/Rig-AIIA07.pdf
</a>.
</p>
<p class="bibitem" ><span class="biblabel">
[7]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XRig-RCRA07-IC"></a>Fabrizio Riguzzi. A top down interpreter for lpad and
cp-logic. In <span
class="cmti-10">The 14th RCRA workshop Experimental Evaluation of</span>
<span
class="cmti-10">Algorithms for Solving Problems with Combinatorial Explosion</span>, 2007. <a
href="http://pst.istc.cnr.it/RCRA07/articoli/P19-riguzzi-RCRA07.pdf" >
http://pst.istc.cnr.it/RCRA07/articoli/P19-riguzzi-RCRA07.pdf </a>.
</p>
<p class="bibitem" ><span class="biblabel">
[8]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XSanPagQaz03-UAI-IC"></a>V.&#x00A0;Santos&#x00A0;Costa, D.&#x00A0;Page, M.&#x00A0;Qazi, and J.&#x00A0;Cussens. CLP(BN):
Constraint logic programming for probabilistic knowledge. In <span
class="cmti-10">Uncertainty</span>
<span
class="cmti-10">in Artificial Intelligence (UAI 2003)</span>, 2003.
</p>
<p class="bibitem" ><span class="biblabel">
[9]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XVenDenBru-JELIA06"></a>J.&#x00A0;Vennekens, M.&#x00A0;Denecker, and M.&#x00A0;Bruynooghe. Representing causal
information about a probabilistic process. In <span
class="cmti-10">10th European Conference on</span>
<span
class="cmti-10">Logics in Artificial Intelligence, JELIA 2006</span>, LNAI. Springer, September
2006.
</p>
<p class="bibitem" ><span class="biblabel">
[10]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XVenVer03-TR"></a>J.&#x00A0;Vennekens and S.&#x00A0;Verbaeten. Logic programs with annotated
disjunctions. Technical Report CW386, K. U. Leuven, 2003. <a
href="http://www.cs.kuleuven.ac.be/%7Ejoost/techrep.ps" >
http://www.cs.kuleuven.ac.be/%7Ejoost/techrep.ps </a>.
</p>
<p class="bibitem" ><span class="biblabel">
[11]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XVenVer04-ICLP04-IC"></a>J.&#x00A0;Vennekens, S.&#x00A0;Verbaeten,
and M.&#x00A0;Bruynooghe. Logic programs with annotated disjunctions. In <span
class="cmti-10">The</span>
<span
class="cmti-10">20th International Conference on Logic Programming (ICLP 2004)</span>, 2004. <a
href="http://www.cs.kuleuven.ac.be/%7Ejoost/" >
http://www.cs.kuleuven.ac.be/%7Ejoost/ </a>.
</p>
<p class="bibitem" ><span class="biblabel">
[12]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a
id="XCP-logic-unp"></a>Joost Vennekens, Marc Denecker, and Maurice Bruynooge. Extending
the role of causality in probabilistic modeling. <a
href="http://www.cs.kuleuven.ac.be/%7Ejoost/cplogic.pdf" >
http://www.cs.kuleuven.ac.be/%7Ejoost/cplogic.pdf </a>, 2006.
</p>
</div>
</body></html>