Principles of Constraint Programming. Cambridge, Knowledge representation, reasoning and declarative problem solving. Cambridge University Press, Answer sets. Foundations of Logic Programming. Springer-Verlag, 2nd edition, Introduction to Mathematical Logic. Van Nostrand, New York, second edition, Poole, A.

Mackworth, and R. Computational Intelligence: A Logical Approach. Oxford University Press, Oxford, Sterling and E. The Art of Prolog. Pettorossi, M. Aracne Ed.

ISBN: Educational objectives The student will acquire knowlege about: logic programming, computational logic, declarative programming, with respect to both fundamental theoretical aspects and practical application. The student is expected to achieve capabilities in analyzing, interpreting, modeling, and solving problems typical in the fields of computer science and artificial intelligence, by fruitfully adopting a declarative approach.

Prerequisites Basic notions on propositional logic.

### What we do

Teaching methods Lectures on all topics of the program. With the agreement of the students, part of the lectures might be given in English. Hence, S is an answer set of the above program. The use of or in these encodings are also essential and can not be eliminated away.

## Answer Set Programming, the Solving Paradigm for Knowledge Representation and Reasoning

This also explains the added expressibility of AnsProlog or programs over AnsProlog programs. We can similarly argue that no answer set of the above program can contain any of the following sets. Thus it is interestingly to note that S is the only answer set of the above program that contains exist satisfied. Some of these interpretations are as follows:. It can now be argued similar to the arguments in Example 41 that there are no other answer sets of the above program.

Now suppose we are only given a set of objects and our goal is to establish a linear ordering among them. Since we do not have reasons to prefer one linear ordering over the other, the following program generates answer sets such that each answer set corresponds to a particular linear ordering among the objects and each linear ordering is captured by exactly one answer set. The program is divided into two parts. Following is the program where we use the predicates first and last instead of smallest and largest, and succ instead of less than.

The second makes prec a transitive relation.

In this subsection we show how aggregate computation can be done using AnsProlog. We demonstrate our program with respect to a small example.

For simplicity, we assume that the same item has not been sold for the same units. The AnsProlog program with such answer sets has the following three groups of rules: a The following three rules make sure that numbers are uniquely assigned to each pair of item, and units. Initializing and updating the aggregate operations. The aggregation starts from the.

The following three rules describe how the initialize and update predicates are used in computing the aggregation. Following are some examples of the encoding of such predicates. Here we will need an additional rule if we want to display that for some items the number of transactions is zero. One such rule could be:. Using the above program the answer sets we will obtain will contain the following:.

**modernpsychtraining.com/cache/locator/wimip-cell-tinder.php**

## Chitta Baral (Author of Knowledge Representation, Reasoning and Declarative Problem Solving)

Intuitively, the above rule means that in every answer set where the right hand side is true we would like the left hand side to be true, and unlike when we use or , we do not minimize truth. This can be achieved by the following translation to AnsProlog. Example 45 Consider the following program with classical disjunction in its head. In fact the same is also true if we allow exclusive-or in the head of rules. The following subsection gives an AnsProlog encoding for such rules. Here we require that if the right hand side is true then exactly one atom in the head should be true.

This can be achieved by the following translation to AnsProlog: 1. Cardinality and weight constraints are introduced in the logic programming implementation Smodels as an extension of AnsProlog and are given a new semantics and the complexity of the new language is analyzed to be the same as the complexity of AnsProlog. In this section and the next we show how such constraints can be expressed in AnsProlog, without any extensions. The above constraint can be expressed through the following AnsProlog rules: 1. Enumerating the possibilities:. These aggregate rules are given in Section 2. To encode such a cardinality constraint we proceed as above except that we have the following constraints instead on the one we had before.

## Knowledge Representation, Reasoning and Declarative Problem Solving

Cardinality constraints in the body can be encoded by using the aggregate and then converting the constraints in the previous section into rules. Cardinality constraints can be generalized to weight constraints. We can encode it in AnsProlog as follows: 1. We give a name to the above rule, say r. We represent the weights of the literals as follows:. We enumerate the literals in the head of the rule by having the following: We use the predicate holds so as to be able to compute the sum of the weights of the literals in the head of r, that hold.

To eliminate candidate answer sets whose aggregate weight do not satisfy the weight conditions in the head of r we have the following constraints:. We start with the representation of normative statements, and exceptions, weak exceptions and direct contradictions to those statements. A good hallmark of incorporation of such additional information is the property of elaboration tolerance. The measure of elaboration tolerance of a representation is determined by the classes of new information that can be incorporated through local changes to the original representation.

Now suppose we get additional knowledge of another class of birds, the ostriches, that are also exceptions. Again, this can be incorporated by simply adding the following rules:. Now suppose we want to represent the above information in AnsProlog: , where CWA is not hard coded in the semantics. In that case we can write explicit CWA rules about each predicate. The overall representation will then be as follows. The main advantage of having explicit CWA rules is that if for a particular predicate we do not want to have CWA, then we can simply remove the corresponding explicit CWA rule.

This can not be done in an AnsProlog representation. The following program does these to changes to our previous formulation. Now we can incorporate the new knowledge about the wounded birds by adding the following rules. Now consider the case when our information about birds, penguins and wounded birds is incomplete. By this we mean that we may know that tweety is a bird, and know that swa ; 21 is not a bird despite Southwest airlines claim that it is the state bird of Texas , and for some other objects we may not know whether it is a bird or not.

By having CWA we will be forced to conclude that these other objects are not birds. Since we do not want that we will remove the explicit CWA rule about birds, penguins and wounded birds. The resulting program is as follows:.

Now suppose we want to reason about the object et, which we know to be a bird. Since et is not known to be a penguin or an wounded bird, the above program will not entail ab et ,. In the absence of CWA about penguins and wounded birds, it is possible that et is a penguin, and in that case our conclusion would be wrong. Similarly, we change the ab rule about wounded birds to: any object that can possibly be an wounded bird i. The resulting program with these changes is as follows, with the changed rules underlined. We would like our representation to gracefully allow such additions.