Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 1 of 48 Three-Valued Models of Program Completion.

Ähnliche Präsentationen


Präsentation zum Thema: "ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 1 of 48 Three-Valued Models of Program Completion."—  Präsentation transkript:

1 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 1 of 48 Three-Valued Models of Program Completion

2 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 2 of 48 Three-Valued Interpretation To any partial interpretation I (in 2-valued logic), there corresponds the obvious 3-valued interpretation, in which atoms missing from I are assigned the truth value.

3 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 3 of 48 Example: Problems with Completion in 2-Valued Logic p p, q. Completion: p ( p q) q. Program has no 2-valued model. p p, q. p p. Completion: p ( p q) p. q. Program has 2-valued model I={ q,p}

4 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 4 of 48 Truth Tables for 3-Valued Logic (Extensions Only!) A BBA A BBA A BBA A BBA AA Attention:: A B B A no longer holds!

5 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 5 of 48 Example: Completion and 3-Valued Logic p p, q. Completion: p ( p q) q. Program has 3-valued model for p= I={ q} p p, q. p p. Completion: p ( p q) p. q. Program has 3-valued model for p= I={ q} I={ q,p}

6 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 6 of 48 Uniqueness p p, q. q r q s r s Completion: p ( p q) q r s r s 2-Valued Models { p,q,r, s} 3-Valued Model {} Not comparable

7 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 7 of 48 Undefined Definition Literal q is called undefined in I, denoted by, if neither q nor its complement is in I. A conjunction of literals evaluates to undefined in I if no literal in the conjunction is false in I and at least one is undefined in I. (cmp. truth table).

8 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 8 of 48 Stratified Programs

9 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 9 of 48 Stratification (rep.) Definition (rep.) A normal program P is stratified, if all its predicate symbols have a level such that: – no predicate symbol positively depends on a predicate symbol of a higher level – no predicate symbol negatively depends on a predicate symbol of greater or equal level.

10 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 10 of 48 Local Stratification Definition A normal program is stratified if each atom in B P can be assigned a countable ordinal level such that no atom – positively depends of an atom of greater level – negatively depends of an atom of equal or greater level.

11 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 11 of 48 Example for Local Stratification even(s(X)) even (X). even(0). B P : {even(0) 0, even(s(0)) 1, even(s(s(0))) 2, even(…) 3, …}

12 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 12 of 48 Perfect Model Definition Let P be a normal program and I a model. I is a perfect model for a given level of B P, if for every other model J, if a positive literal p is the atom of least level in one model, but not in the other, then p is in J. In other words, atoms of higher level are preferred for the perfect model. Przymusinski: All locally stratified programs have a perfect model, which is independent of the ranking system chosen.

13 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 13 of 48 Examples for Local Stratification even(s(X)) even(X). even(0). even(0) q(X). B P : J={q(0) 0,even(0) 1, even(s(s(0))) 3, …} I={even(0) 0, even(s(s(0))) 2, …}

14 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 14 of 48 Well-Founded Semantics

15 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 15 of 48 Theorem: If a program P is locally stratified, then is has a well-founded model, which is identical to the perfect model.

16 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 16 of 48 Motivation Problems: Not all completed programs are consistent SLDNF is only complete if the refutation does not flounder. Stratification limits recursion. Technical Solution: 3-Valued Logic

17 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 17 of 48 Redefinition of Interpretation Definition: Let P be a normal program. A partial interpretation I is a consistent set of literals whose atoms are in B P. A total interpretation I is a partial interpretation containing every atom in B P or its negation. A conjunction of ground literals is true in I, if all its literals are true in I. It is false, if any of its literals is false in I.

18 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 18 of 48 Satisfied / Falsified / Weakly Falsified Definition: An ground clause is satisfied in a partial or complete interpretation I if the head is true in I or some subgoal is false in I. The clause is falsified if the head is false and all subgoal are true. If the head is false in I, but no subgoal is false in I then we say the clause is weakly falsified in I.

19 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 19 of 48 Partial / Total Model Definition: A total model of a program P is a total interpretation such that every instantiated clause of P is satisfied. A partial model of P is a partial interpretation that can be extended to a total model of P

20 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 20 of 48 Lemma: Let P be a normal program and I a partial interpretation. If I weakly falsifies no clause from P, then I is a partial model of P. Proof: Normal programs have B P as a model. For each atom from B P, if its negation is not in I, add the atom to I.

21 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 21 of 48 Unfounded Sets Definition Let P be a normal program and I be a partial interpretation. We say A B P is an unfounded set (of P) wrt I, if each atom p A satisfies the following: For each instantiated clause R from P, whose head is p, (at least) one of the following holds: (1) Some (positive or negative) subgoal q of the body is false in I. (2) Some positive subgoal of the body occurs in A. A literal satisfying (1) or (2) is called a witness of unusability for clause R (wrt I)

22 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 22 of 48 Example p(a) p(c), p(b). p(b) p(a). p(e) p(d). p(c). p(d) q(a), q(b). p(d) q(b), q(c). q(a) p(d). q(b) q(a). the atoms {p(d), q(a), q(b), q(c)} are an unfounded set wrt I=Ø. For the instantiated normal program P: (2): None of the heads can be derived first. There exists no definition for q(c). Thus (1) is satisfied.

23 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 23 of 48 Example the atoms {p(a), p(b)} are no unfounded set wrt I=Ø! Neither (1) nor (2) are satisfied. p(a) p(c), p(b). p(b) p(a). p(e) p(d). p(c). p(d) q(a), q(b). p(d) q(b), q(c). q(a) p(d). q(b) q(a). For the instantiated normal program P:

24 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 24 of 48 Notation: Let S be a set of literals. Then we write S for { p : p S}

25 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 25 of 48 Union of Unfounded Sets Definition The greatest unfounded set (of P) wrt I, denoted U P (I), is the union of all sets that are unfounded wrt I.

26 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 26 of 48 Union of Unfounded Sets Definition The greatest unfounded set (of P) wrt I, denoted U P (I), is the union of all sets that are unfounded wrt I. Lemma Let R be a set of literals, and let A be an unfounded set of P wrt R. For any subset S A we have that A - S is unfounded wrt R S. Lemma Let I be a partial interpretation consisting of positive literals Q and negative literals S. If I does not weakly falsify any instantiated clause of program P, then S is an unfounded set wrt Q.

27 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 27 of 48 Well-Founded Partial Models

28 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 28 of 48 Transformations A transformation is a transformation between sets of literals, whose atoms are elements of the Herbrand-base of a program P. A transformation T is called monotonic, if T(I) T(J), whenever I J.

29 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 29 of 48 Transformations Definition Let P be a normal program. Transformations T P, U P and W P are defined as follows: – p T P (I) iff there is some instantiated clause R of P, such that R has head p, and each subgoal literal in the body of R is true in I. – U P (I) is the greatest unfounded set of P wrt I. – W P (I) = T P (I) U P (I). Lemma T P, U P and W P are monotonic transformations.

30 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 30 of 48 I and I Definition The sets I ( ranges over all countable ordinals) and I, whose elements are literals in the Herbrand-base of a program P, are defined recursively by: (1)For limit ordinal, Note that 0 is a limit ordinal, and I 0 =. (2)For a successor ordinal = + 1, (3)Finally, define

31 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 31 of 48 Stufe Definition For any literal p in I, we define the stage of p to be the least ordinal such that p I. Lemma I is a monotonic sequence of partial interpretations. Proof Sketch Induction over

32 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 32 of 48 Closure Ordinal Definition The closure ordinal for the sequence I is the least ordinal such that: I = I.

33 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 33 of 48 Well-Founded Semantics Definition The well-founded semantics of a program P is the meaning represented by the least fixed point of W P or the limit I Every positive literal denotes that its atom is true. Every negative literal denotes that its atom is false. Missing atoms have no truth value assigned by the semantics.

34 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 34 of 48 Example p(a) p(c), p(b). p(b) p(a). p(e) p(d). p(c). p(d) q(a), q(b). p(d) q(b), q(c). q(a) p(d). q(b) q(a). I 0 =Ø T P (I 0 )={p(c)} U P (I 0 )={p(d),q(a),q(b),q(c)} W P (I 0 )={p(c), p(d), q(a), q(b), q(c)} T P (I 1 )={p(e),p(c)} U P (I 1 )={p(d),q(a),q(b),q(c)} W P (I 1 )={p(e),p(c), p(d), q(a), q(b), q(c)} T P (I 2 )={p(e),p(c)} …

35 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 35 of 48 Well-Founded Semantics Lemma Let I be defined as above. Then I does not weakly falsify any instantiated clause R of P. Proof Sketch The definition of W P only makes the head L of R false, which was unfounded in previous iterations. Hence either the body of R was false or some atom of R was in the unfounded set. In both cases the body of R is now wrong. The monotony of W P is important for this lemma.

36 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 36 of 48 Well-Founded (Partial) Model Theorem For every countable ordinal, I in the sequence described above is a partial model of P. Proof Using the first and the previous lemma.

37 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 37 of 48 Well-Founded (Partial) Model Definition Suppose that for each p B P, I contains either p or p, i.e. I is a total interpretation. Then by the above theorem I is a total model and we call this the well-founded model; Otherwise, we call I the well founded partial model.

38 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 38 of 48 Minimal Model Theorem Every Horn program has a well-founded model I, which is the minimum model in the sense of Van Emden and Kowalski, that is, its positive literals are contained in every Herbrand model.

39 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 39 of 48 Theorem: If a program P is locally stratified, then is has a well-founded model, which is identical to the perfect model.

40 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 40 of 48 Example: Suppose all Valid Moves From one Position to an other are in the EDB F T FF F T F T F T T F FF (a)(b)(c) winning(X) move(X,Y), not winning(Y). player 1 moves player 2 moves player 1 loses player 1 zieht player 2 loses player 2 moves

41 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 41 of 48 Example The program is not locally stratified, because the Herbrand-instantiation contains a clause, in which winning negatively depends on itself: winning(a) move(a,a), not winning(a). This destroys the perfect model, even if move(a,a) is not contained in the EDB.

42 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 42 of 48 Computational Complexity The set of statements derivable shall be reasonably computable. We need to show that the data-complexity of well-founded semantics is polynomial. Well-founded semantics is competitive with other methods, such as stratified semantics and fitting model. For logic programs without functions the Herbrand-universe is finite and its construction effective. (Class Datalog).

43 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 43 of 48 Computational Complexity Limit the discussion to logic programs without function symbols. The Herbrand universe of a program is the set of constants appearing in the program. Consider a fixed IDB P I consisting of a set inference rules, which might be applied to various EDBs or sets of facts.

44 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 44 of 48 Computational Complexity Predicates that appear as subgoals in P I, but not in the head of any rule, constitute the EDB predicates. The EDB P E is a set of positive ground literals ranging over the EDB predicates. (The constants in P E may or may not appear in P I.) given an EDB P E : – P(P E ) = P I P E is a Logic program and its well-founded partial model is denoted by I (P E ). – P I defines the transformation from P E to I (P E ).

45 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 45 of 48 Data Complexity Definition: The data complexity of an IDB is defined as the computational complexity of deciding the answer to a ground atomic query as a function of the size of the EDB. In the context of well-founded semantics, this means deciding whether the ground atom is positive in the well-founded partial model.

46 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 46 of 48 Data Complexity - Since the IDB is fixed, the predicates in the well- founded model have fixed number and arity. - The Herbrand-base has a size that is polynomial in the size of the EDB. - Also since the IDB is fixed, the size of the Herbrand instantiation of the program is polynomial in the size of the EDB.

47 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 47 of 48 Data Complexity Theorem: The data complexity of the well-founded semantics for function-free programs is polynomial time. Comments: The Fitting model has polynomial data complexity for function free programs. Determining whether P has a stable model is NP- complete for general propositional logic programs.

48 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 48 of 48 Nachteile der wohl-fundierten Semantik Die wohl-fundierte Semantik hat folgenden Nachteil: Sie ist unfähig, Folgerungen zu behandeln, die nur durch Methoden wie Factoring oder ähnliche Techniken (z.B. ancestor resolution) erreichbar sind. Beispiel: a not b, b not a, p a, p b. ausgeblendet

49 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 49 of 48 Advantages of Well-Founded Semantics The well-founded semantics for normal programs extends earlier proposals and has advantages over them in that (1)it is applicable to all logic programs (2)compared to other methods a larger part of the Herbrand base tends to be classified as either true or false (3)truth values are assigned in a reasonably predictable and intuitively satisfying way.

50 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 50 of 48 Vergleiche mit Fittings Modell und mit Stable Models ausgeblendet

51 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 51 of 48 Die Transformation N P (I) Definition N P (I) wird definiert als die Transformation, die für eine dreiwertige Interpretation I die Menge der Atome p liefert, für die gilt, dass jede Klausel in der Herbrand-Instanz von P mit p als Kopf der Rumpf in I unwahr ist, d.h. irgendein Unterziel jeder Klausel mit Kopf p ist in I unwahr. Anmerkung: N P ist der Teil von U P, der durch die Bedingung (1) der Definition (von unfundierten Mengen) produziert wird.

52 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 52 of 48 Fitting Modell Theorem Eine dreiwertige Interpretation I ist genau dann ein dreiwertiges Modell des vollendeten Programms, wenn I = T P (I) N P (I). Dies führt zu der Konstruktion eines Fixpunktes für dreiwertige Modelle und dazu, dass das Fitting Modell der kleinste Fixpunkt ist.

53 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 53 of 48 I und Fitting Modell Theorem Sei I wie oben definiert, dann gilt: I = T P (I ) N P (I ). Folgerung Das Fitting Model ist eine Untermenge von I.

54 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 54 of 48 Stabile Modelle Stabile Modelle: Reproduzieren sich in der Stabilitätstransformation, einer 3 Stufen Transformation. Werden einzigartige stabile Modelle genannt, wenn ein Programm nur ein stabiles Modell besitzt. Benutzen die zweiwertige Logik. Werden in der totalen oder zweiwertigen Interpretation als Menge von Grundatomen repräsentiert.

55 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 55 of 48 Minimales Modelle Ein minimales Modell hat eine minimale Menge von positiven Literalen. (das ist die Übersetzung der früheren Verwendung von Interpretationen und Modellen in die Darstellung hier)

56 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 56 of 48 Monotone Transformation Eine monotone Transformation auf totalen Interpretationen ist eine Transformation, die monoton im Bezug auf positive Literale ist. (das ist die Übersetzung der früheren Verwendung von Interpretationen und Modellen in die Darstellung hier)

57 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 57 of 48 Notation für Mengen von positiven und negativen Atomen Definition Für jede partielle Interpretation I sei Pos(I) die Menge von positiven Literalen in I und Neg(I) die Menge von Atomen, die die negativen Literalen in I repräsentiert. Also, I = Pos(I) Neg(I).

58 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 58 of 48 Stabilitätstransformation Definition Gegeben seien ein Normal Program P und seine Herbrand-Instanziierung P H sowie eine totale Interpretation I und die zugehörige Stabilitätstransformation S(I) (eine Transformation von totalen Interpretationen zu totalen Interpretationen). Die Stabilitätstransformation S(I) wird in den folgenden 3 Schritten definiert:

59 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 59 of 48 Stabilitätstransformation Definition (Fortsetzung) 1.Definiere: P = T 1 (P H, I), wobei T 1 die folgende Transformation ist: Jede Regel-Instanz, die ein negatives Unterziel enthält, das mit I unkonsistent ist, wird gelöscht. Der Output dieser Transformation ist die Menge der Regel- Instanzen, die nicht gelöscht wurden.

60 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 60 of 48 Stabilitätstransformation Definition (Fortsetzung) 2.Definiere: P = T 2 (P), wobei T 2 die Transformation ist, durch die alle negativen Unterziele aus den Regeln aus P gelöscht werden (ein Hornprogramm hinterlassend). Wir nennen P die Reduktion von P hinsichtlich I.

61 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 61 of 48 Stabilitätstransformation Definition (Fortsetzung) 3.Da P ein Hornprogramm ist, kann sein minimales (zweiwertiges) Modell nach der Standard Van Emden und Kowalski Semantik gebildet werden. In diesem Kontext bedeutet das Minimum, dass die Menge positiver Literalen minimiert wird und daher die Menge der negativen Literalen maximiert wird. Wir definieren S(I) als dieses minimale Modell von P.

62 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 62 of 48 Schrumpfende Transformation Lemma: Sei M ein totales Modell vom allgemeingültigen Logikprogramm P, dann ist Pos(S( M )) Pos( M ).

63 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 63 of 48 Eindeutiges stabiles Modell (unique stable model) Definition: Ein totales Modell M vom allgemeingültigen Logikprogramm P ist stabil, wenn es ein Fixpunkt von S ist ( M = S( M )). Wenn das Programm P exakt ein stabiles Modell hat, wird dieses Modell als eindeutiges stabiles Modell von P bezeichnet.

64 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 64 of 48 Minimale stabile Modelle Es ist unmittelbar, dass ein stabiles Modell minimal ist (im Bezug auf die Menge der positiven Literale); aber nicht jedes minimale Modell ist stabil. Beispiel: Sei P 1 {a, b} und {b, a} sind stabile Modelle. Also hat P 1 kein einzigartiges stabiles Modell. a not b, b not a.

65 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 65 of 48 Stabile Modelle und wohl-fundierte Modelle Stabile Modelle und wohl-fundierte (partielle oder totale) Modelle stehen in folgender Beziehung zueinander: Behauptung: Wohl-fundierte totale Modelle sind einzigartige stabile Modelle. Aus dieser Behauptung folgt, dass das einzigartige stabile Modell direkt generiert werden kann.

66 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 66 of 48 Verhältnis zwischen S und U P sowie zwischen S und T P Lemma: Sei M ein totales Modell eines Programms P, dann ist Neg(S( M )) = U P ( M ). Lemma: Sei M ein totales Modell eines Programms P, dann ist Pos(S( M )) T P ( M ).

67 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 67 of 48 Stabiles Modell und Fixpunkt von W P Theorem: Sei M ein totales Modell von P. M ist genau dann stabil, wenn es ein Fixpunkt von W P ist.

68 ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 68 of 48 Folgerungen - Sei I eine totale Interpretation von P. Dann ist I ein Fixpunkt von S genau dann, wenn sie ein Fixpunkt von W P ist. - Wenn zu P ein wohl-fundiertes totales Modell existiert, dann ist dieses Modell das einzigartige stabile Modell. (Die Umkehrung dieser Folgerung ist nicht notwendigerweise wahr) - Das wohl-fundierte partielle Modell von P ist eine Untermenge von jedem stabilen Modell von P.


Herunterladen ppt "ISWeb - Information Systems & Semantic Web Steffen Staab Foundations of Logic Programming 1 of 48 Three-Valued Models of Program Completion."

Ähnliche Präsentationen


Google-Anzeigen