diff --git a/cplint/doc/manual.css b/cplint/doc/manual.css index 4cababd9d..ce87c709c 100644 --- a/cplint/doc/manual.css +++ b/cplint/doc/manual.css @@ -11,7 +11,6 @@ .cmtt-10{font-family: monospace;} .cmti-10{ font-style: italic;} p.noindent { text-indent: 0em } -td p.noindent { text-indent: 0em; margin-top:0em; } p.nopar { text-indent: 0em; } p.indent{ text-indent: 1.5em } @media print {div.crosslinks {visibility:hidden;}} diff --git a/cplint/doc/manual.html b/cplint/doc/manual.html index 674012d3b..7404f09a4 100644 --- a/cplint/doc/manual.html +++ b/cplint/doc/manual.html @@ -7,7 +7,7 @@ - + @@ -22,21 +22,21 @@ class="cmr-12">Fabrizio Riguzzi class="cmr-12">fabrizio.riguzzi@unife.it
November 17, 2007
+class="cmr-12">June 19, 2008

1 Introduction

-

cplint is a suite of programs for reasoning with LPADs [1112] and CP-logic programs [1013]. -

It consists of three Prolog modules for answering queries using goal-oriented +

It consists of three Prolog modules for answering queries using goal-oriented procedures plus three Prolog modules for answering queries using the definition of the semantics of LPADs and CP-logic. -

The modules for answering queries using using goal-oriented procedures are +

The modules for answering queries using using goal-oriented procedures are lpadsld.pl, lpad.pl and 7] and [8]. It is based on SLDNF resolution and is an adaptation of the interpreter for ProbLog [4]. -

It was proved correct [

It was proved correct [8] with respect to the semantics of LPADs for range restricted acyclic programs [1] without function symbols. -

It is also able to deal with extensions of LPADs and CP-logic: the clause +

It is also able to deal with extensions of LPADs and CP-logic: the clause bodies can contain setof and bagof, the probabilities in the head may @@ -84,7 +84,7 @@ href="#XDBLP:journals/jacm/ChenW96">3]. As a consequence, it works fo class="cmtt-10">cpl.pl: computes the probability of a query using a top-down procedure based on SLG resolution and moreover checks that the CP-logic program is valid, i.e., that it has at least an execution model. -

The modules for answering queries using the definition of the semantics of LPADs +

The modules for answering queries using the definition of the semantics of LPADs and CP-logic are semlpadsld.pl, semlpad.pl and P, i.e., and temporal precedence. It uses the definition of the semantics given in [13]. -

+

2 Installation

-

cplint is distributed in source code in the CVS version of Yap. It includes Prolog and C files. Download it by following the instruction in http://www.ncc.up.pt/~vsc/Yap/downloads.html . -

cplint requires glu (a subpackage of vis) and glib. You can download glu from -http://vlsi.colorado.edu/~vis/getting_VIS_2.1.html You can download glib from - http://www.gtk.org/ . This is a standard GNU package so it is easy to -install it using the package management software of your Linux or Cygwin -distribution. -

Install glu: +

cplint requires glu (a subpackage of vis) and glib-2.0. You can download glu +from http://vlsi.colorado.edu/~vis/getting_VIS_2.1.html You can download +glib-2.0 (version 2.0) from http://www.gtk.org/ . This is a standard GNU package +so it is easy to install it using the package management software of your Linux or +Cygwin distribution. +

Install glu:

    -
  1. downlad downlad glu-2.1.tar.gz
  2. -
  3. decompress it +
  4. decompress it
  5. -
  6. cd glu-2.1
  7. -
  8. mkdir arch
  9. -
  10. cd arch
  11. -
  12. ../configure
  13. -
  14. make
  15. -
  16. su
  17. -
  18. make install
-

This will install glu into

This will install glu into /usr/local, if you want to install to a different DIR use ../configure --prefix DIR -

Install Yap together with

Install Yap together with cplint: when compiling Yap following the instuction of the INSTALL file in the root of the Yap folder, use @@ -188,7 +190,7 @@ class="verbatim">

configure --enable-cplint
-

Under Windows, you have to use Cygwin (glu does not compile under MinGW), +

Under Windows, you have to use Cygwin (glu does not compile under MinGW), so
@@ -198,19 +200,19 @@ class="verbatim">

configure --enable-cplint --enable-cygwin
-

If you installed glu in

If you installed glu in DIR, use --enable-cplint=DIR -

After having performed

After having performed make install you can do make installcheck that will execute a suite of tests of the various programs. If no error is reported you have a working installation of cplint. -

+

3 Syntax

-

Disjunction in the head is represented with a semicolon and atoms in the head are +

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

@@ -224,11 +226,11 @@ class="verbatim">
h1:p1 ; ... ; hn:pn :- b1,...,bm,\+ c1,....,\+ cl
-

No parentheses are necessary. The

No parentheses are necessary. The pi are numeric expressions. It is up to the user to ensure that the numeric expressions are legal, i.e. that they sum up to less than one. -

If the clause has an empty body, it can be represented like this +

If the clause has an empty body, it can be represented like this
h1:p1 ; ... ;hn:pn.
-

If the clause has a single head with probability 1, the annotation can be omitted and +

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.
h1:- b1,...,bm,\+ c1,...,\+ cl.
-

stands for +

stands for
h1:1 :- b1,...,bm,\+ c1,...,\+ cl.
-

-

The coin example of [

+

The coin example of [12] is represented as (see file coin.cpl) @@ -272,15 +274,15 @@ heads(Coin):1/2 ; tails(Coin):1/2:-  
toss(coin). -

The first clause states that if we toss a coin that is not biased it has equal +

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 has a slightly higher probability of landing 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. -

+

4 Commands

-

All six modules accept the same commands for reading in files and answering queries. +

All six modules accept the same commands for reading in files and answering queries. The LPAD or CP-logic program must be stored in a text file with extension .cpl. Suppose you have stored the example above in file

use_module(library(lpad)).
-

at the command prompt. Then you must parse the source file

at the command prompt. Then you must parse the source file coin.cpl with the command @@ -305,7 +307,7 @@ class="verbatim">

p(coin).
-

if

if coin.cpl is in the current directory, or
p(’path_to_coin/coin’).
-

if

if coin.cpl is in a different directory. At this point you can pose query to the program by using the predicate s/2 (for solve) that takes as its first argument a @@ -329,7 +331,7 @@ class="verbatim">

s([head(coin),biased(coin)],P).
-

For computing the probability of a conjunction given another conjunction you can +

For computing the probability of a conjunction given another conjunction you can use the predicate sc/3 (for solve conditional) that take takes as input the query conjunction as its first argument, the evidence conjunction as its second argument @@ -345,19 +347,19 @@ class="verbatim">

sc([heads(coin)],[biased(coin)],P).
-

After having parsed a program, in order to read in a new program you must restart +

After having parsed a program, in order to read in a new program you must restart Yap when using semlpadsld.pl and semlpad.pl. With the other modules, you can directly parse a new program. -

When using

When using lpad.pl, the system can print the message “Uunsound program” in the case in which an instance with a three valued well founded model is found. Moreover, it can print the message “It requires the choice of a head atom from a non ground head”: in this case, in order to answer the query, all the groundings of the culprit clause must be generated, which may be impossible for programs with function symbols. -

When using

When using semcpl.pl, you can print the execution process by using the command print. after context is a list of atoms that are true in the context. semcpl.pl can print “Invalid program” in the case in which no execution process exists. -

When using

When using cpl.pl you can print a partial execution model including all the clauses involved in the query issued with print. cpl.pl can print the messages “Uunsound program”, “It requires the choice of a head atom from a non ground head” and “Invalid program”. -

The modules make use of a number of parameters in order to control their +

The modules make use of a number of parameters in order to control their behavior. They that can be set with the command
set(parameter,value).
-

from the Yap prompt after having loaded the module. The current value can be read +

from the Yap prompt after having loaded the module. The current value can be read with
setting(parameter,Value).
-

from the Yap prompt. The available parameters are: +

from the Yap prompt. The available parameters are:

-

+

5 Semantic Modules

-

The three semantic modules need to produce a grounding of the program in order to +

The three semantic modules need to produce a grounding of the program in order to compute the semantics. They require an extra file with extension .uni (for universe) in the same directory where the .cpl file is. -

There are two ways to specify how to ground a program. The first consists in +

There are two ways to specify how to ground a program. The first consists in providing the list of constants to which each variable can be instantiated. For example, in our case the current directory will contain a file coin.uni that is a @@ -478,7 +480,7 @@ class="verbatim">

universe(var_list,const_list).
-

where

where var_list is a list of variables names (each must be included in single quotes) and const_list is a list of constants. The semantic modules generate the grounding @@ -488,7 +490,7 @@ class="cmtt-10">var_list with the constants of class="cmtt-10">const_list. 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. -

The other way to specify how to ground a program consists in using mode and +

The other way to specify how to ground a program consists in using mode and type information. For each predicate, the file .uni must contain a fact of the form @@ -499,7 +501,7 @@ class="verbatim">

mode(predicate(t1,...,tn)).
-

that specifies the number and types of each argument of the predicate. Then, the list +

that specifies the number and types of each argument of the predicate. Then, the list of constants that are in the domain of each type ti must be specified with a fact of the form @@ -510,7 +512,7 @@ class="verbatim">

type(ti,list_of_constants).
-

The file

The file .uni can contain both universe and mode declaration, the ones to be used depend on the value of the parameter grounding: with value variables, the universe declarations are used, with value modes the mode declarations are used. -

With

With semcpl.pl only mode declarations can be used. -

+

6 Extensions

-

In this section we will present the extensions to the syntax of LPADs and CP-logic +

In this section we will present the extensions to the syntax of LPADs and CP-logic programs that cplint can handle. -

The first is the use of some standard Prolog predicates. The bodies can contain +

The first is the use of some standard Prolog predicates. The bodies can contain the built-in predicates: length/2
-

The bodies can also contain the following library predicates: +

The bodies can also contain the following library predicates:
nth/3
-

plus the predicate +

plus the predicate
average/2
-

that, given a list of numbers, computes its arithmetic mean. -

When using

that, given a list of numbers, computes its arithmetic mean. +

When using lpadsld.pl, the bodies can contain the predicates setof/3 and

setof(Z, (term(X,Y))^foo(X,Y,Z), L).
-

returns all the instantiations of

returns all the instantiations of Z such that there exists an instantiation of X and Y for which foo(X,Y,Z) is true. -

An example of the use of

An example of the use of setof and bagof is in the file female.cpl: @@ -617,18 +619,18 @@ male(C):M/P ; female(C):F/P:-  
known_male(e). -

The disjunctive rule expresses the probability of a person of unknown sex of being +

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 P is 0). -

Another use of

Another use of setof and bagof is to have an attribute depend on an aggregate function of another attribute, similarly to what is done in PRM and CLP(BN). -

So, in the classical school example (available in

So, in the classical school example (available in student.cpl) you can find the following clauses: @@ -644,7 +646,7 @@ student_rank(S,h):0.6 ; student_rank(S,l):0.4:-  
    average(L,Av),Av =< 1.5. -

where

where registr_stu(R,S) expresses that registration R refers to student S and @@ -654,7 +656,7 @@ class="cmtt-10">R reports grade G which is a natural number. The two clauses express a dependency of the rank of the student from the average of her grades. -

Another extension can be used with

Another extension can be used with lpadsld.pl 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 @@ -676,13 +678,13 @@ uniform(cites_cited(C,P),P,L):-  
    bagof(Pap,paper_topic(Pap,ai),L). -

The first clauses states that the paper

The first clauses states that the paper P cited in a citation C 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. -

These clauses make use of the predicate +

These clauses make use of the predicate
uniform(Atom,Variable,List)
-

in the head, where

in the head, where Atom must contain Variable. The meaning is the following: the set of all the atoms obtained by instantiating ∕N where N is the length of List. -

A more elaborate example is present in file

A more elaborate example is present in file paper_ref.cpl:     cites_cited_group(C,T),bagof(Pap,paper_topic(Pap,T),L).
-

where the cited paper depends on the topic of the citing paper. In particular, if the +

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. -

PRMs take into account as well existence uncertainty, where the existence of +

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 @@ -750,7 +752,7 @@ cites(X,Y):0.005 :-  
    paper_topic(X,ai),paper_topic(Y,ai). -

This is an example where the probabilities in the head do not sum up to one so the +

This is an example where the probabilities in the head do not sum up to one so the null event is automatically added to the head. The first clause states that, if the topic of a paper X is theory and of paper X to Y. The other clauses consider the remaining cases for the topics. -

+

7 Additional Files

-

In the directory where Yap keeps the library files (usually

In the directory where Yap keeps the library files (usually /usr/local/share/ Yap) you can find the directory cplint that contains the files: @@ -773,11 +775,13 @@ class="cmtt-10"> testlpadsld_gbfalse.pl, testlpad.pl, testcpl.pl, testsemcpl.pl: Prolog programs for testing the modules. - They are executed when issuing the command make installcheck during - the installation. To execute them afterwords, load the file and issue the - command  testsemlpadsld.pl, testsemlpad.pl testsemcpl.pl: + Prolog programs for testing the modules. They are executed when issuing + the command make installcheck during the installation. To execute + them afterwords, load the file and issue the command t.

  • Subdirectory invalid.cpl: programs taken from [13]. invalid.cpl is an example of a program that is invalid but sound.
  • -

    The files

    The files *.uni that are present for some of the examples are used by the semantical modules. Some of the example files contain in an initial comment some queries together with their result. @@ -871,18 +875,18 @@ class="cmtt-10">*.uni that are present for some of the examples are used

  • Subdirectory doc: contains this manual in latex, html and pdf.
  • -

    +

    8 License

    -

    cplint, as Yap, follows the Artistic License 2.0 that you can find in Yap CVS root dir. The copyright is by Fabrizio Riguzzi. -

    The program uses the library

    The program uses the library CUDD for manipulating BDDs that is included in glu. For the use of CUDD, the following license must be accepted: -

    Copyright (c) 1995-2004, Regents of the University of Colorado -

    All rights reserved. -

    Redistribution and use in source and binary forms, with or without modification, +

    Copyright (c) 1995-2004, Regents of the University of Colorado +

    All rights reserved. +

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    -

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS +

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
    AND CONTRIBUTORS ”AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -909,7 +913,7 @@ INTERRUPTION) HOWEVER CAU-SED 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. -

    lpad.pl, semlpad.pl and cpl.pl are based on the SLG system by +

    References

    -

    +

    -

    +

    [1]   K. R. Apt and M. Bezem. Acyclic programs. New Generation Comput., 9(3/4):335–364, 1991.

    -

    +

    [2]   H. Blockeel. Probabilistic logical models for mendel’s experiments: An exercise. In Inductive Logic Programming (ILP 2004), Work in Progress Track, 2004.

    -

    +

    [3]   Weidong Chen and David Scott Warren. Tabled evaluation with delaying for general logic programs. J. ACM, 43(1):20–74, 1996.

    -

    +

    [4]   L. De Raedt, A. Kimmig, and H. Toivonen. Problog: A probabilistic prolog and its application in link discovery. In Proceedings of the 20th class="cmti-10">International Joint Conference on Artificial Intelligence, pages 2462–2467, 2007.

    -

    +

    [5]   L. Getoor, N. Friedman, D. Koller, and A. Pfeffer. Learning probabilistic relational models. In Saso Dzeroski and Nada Lavrac, editors, Relational Data Mining. Springer-Verlag, Berlin, 2001.

    -

    +

    [6]   L. Getoor, N. Friedman, D. Koller, and B. Taskar. Learning probabilistic models of relational structure. Journal of Machine Learning Research, 3:679–707, December 2002.

    -

    +

    [7]   Fabrizio Riguzzi. A top down interpreter for lpad and cp-logic. In h .

    -

    +

    [8]   Fabrizio Riguzzi. A top down interpreter for lpad and cp-logic. In Algorithms for Solving Problems with Combinatorial Explosion http://pst.istc.cnr.it/RCRA07/articoli/P19-riguzzi-RCRA07.pdf .

    -

    +

    [9]   V. Santos Costa, D. Page, M. Qazi, and J. Cussens. CLP(BN): Constraint logic programming for probabilistic knowledge. In Uncertainty in Artificial Intelligence (UAI 2003), 2003.

    -

    +

    [10]   J. Vennekens, M. Denecker, and M. Bruynooghe. Representing causal information about a probabilistic process. In 10th European Conference on class="cmti-10">Logics in Artificial Intelligence, JELIA 2006, LNAI. Springer, September 2006.

    -

    +

    [11]   J. Vennekens and S. Verbaeten. Logic programs with annotated disjunctions. Technical Report CW386, K. U. Leuven, 2003. ~joost/techrep.ps .

    -

    +

    [12]   J. Vennekens, S. Verbaeten, and M. Bruynooghe. Logic programs with annotated disjunctions. In ~joost/ .

    -

    +

    [13]   Joost Vennekens, Marc Denecker, and Maurice Bruynooge. Extending the role of causality in diff --git a/cplint/doc/manual.pdf b/cplint/doc/manual.pdf index c61b7d757..878568114 100644 Binary files a/cplint/doc/manual.pdf and b/cplint/doc/manual.pdf differ