*** DLV To get started, have a look at the online documentation available at http://www.dbai.tuwien.ac.at/proj/dlv/ Note that: To work with integers you have to specify a maximum integer. This is done, e.g., by including the following line in your program: #maxint=30. Arithmetic equality is =, non-equality is <>, addition is +. All can be written in infix notation. Note: you cannot use + and <> within the same atom. *** 1 Consider the following facts: p(7). p(3). p(14). p(11). p(15). p(16). Write a straightforward implementation in DLV of a predicate solution(X,Y,Z) that succeeds if X, Y, Z are three consecutive numbers satisfying predicate p. *** 2 Same as 1, but this time use integrity constraints. Proceed as follows: - state that every triple of values in p is either a solution or a non-solution - impose constraints on the properties of a solution (2 constraints) and of a non-solution (1 constraint) *** 3 You are given the following (partial) map of Europe, expressed as a set of pairs of neighboring countries. (italy,switzerland), (italy,austria), (austria, germany), (austria, switzerland), (italy, france), (france, spain), (spain, portugal), (france, belgium) Find a color assignment for each country (red, green, or blue) so that no two neighboring countries have the same color and knowing that Italy and Belgium are blue, France is red, and Spain is not green. Color the map with as much green as possible. *** 4 Below you are given a list of food and wine items with some properties. Food and wine are in agreement if they are both persistent, or both sweet, or both light. There is a good contrast when bitter food is eaten with a sweet wine or when fat food is eaten with a wine rich in acid. A lunch consists of a food item and a wine item such that they are either in agreement or in good contrast, provided that persistent food (wine) is not associated with a light wine (food) item. Use the technique from exercise 2 to generate all feasible lunches, so that each solution corresponds to a feasible lunch. food(sole). food(pie). food(braised_beef). food(foie_gras). wine(barolo). wine(vermentino). wine(sauternes). wine(beaujolais). sweet(sauternes). sweet(pie). light(vermentino). light(beaujolais). light(sole). acid(beaujolais). acid(barolo). tannic(barolo). persistent(barolo). persistent(braised_beef). bitterish(foie_gras). fat(braised_beef).