<is web> Three-Valued Models of Program Completion ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 1 of 48 <is web> 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 . ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 2 of 48 <is web> Example: Problems with Completion in 2-Valued Logic p p, q. p p, q. p p. Completion: p(pq) q. Completion: p(pq)p. q. Program has no 2-valued model. Program has 2-valued model I={q,p} ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 3 of 48 <is web> Truth Tables for 3-Valued Logic (Extensions Only!) A A A B AB A B AB A B AB 0 0 0 0 1 1 1 1 1 0 1 1 1 ISWeb - Information Systems & Semantic Web A B AB 0 1 1 Attention:: AB BA no longer holds! Steffen Staab [email protected] Foundations of Logic Programming 4 of 48 <is web> Example: Completion and 3-Valued Logic p p, q. p p, q. p p. Completion: p(pq) q. Completion: p(pq)p. q. Program has 3-valued model for p= , I={q} Program has 3-valued model for p=, I={q} I={q,p} ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 5 of 48 <is web> Uniqueness p p, q. qr qs rr ss 2-Valued Models {p,q,r,s} Not comparable {p,q,r,s} {p,q,r,s} 3-Valued Model {} Completion: p(pq) qrs rr ss ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 6 of 48 <is web> 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). ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 7 of 48 <is web> Stratified Programs ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 8 of 48 <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 9 of 48 <is web> Local Stratification Definition A normal program is stratified if each atom in BP 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 10 of 48 <is web> Example for Local Stratification even(s(X)) even(X). even(0). BP: {even(0)0, even(s(0))1, even(s(s(0)))2, even(…)3, …} ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 11 of 48 <is web> Perfect Model Definition Let P be a normal program and I a model. I is a perfect model for a given level of BP, 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 12 of 48 <is web> Examples for Local Stratification even(s(X)) even(X). even(0). even(0) q(X). BP: J={q(0)0,even(0)1, even(s(s(0)))3, …} I={even(0)0, even(s(s(0)))2, …} ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 13 of 48 <is web> Well-Founded Semantics ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 14 of 48 <is web> Theorem: If a program P is locally stratified, then is has a well-founded model, which is identical to the perfect model. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 15 of 48 <is web> 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 ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 16 of 48 <is web> Redefinition of „Interpretation“ Definition: Let P be a normal program. A partial interpretation I is a consistent set of literals whose atoms are in BP. A total interpretation I is a partial interpretation containing every atom in BP 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 17 of 48 <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 18 of 48 <is web> 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 ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 19 of 48 <is web> 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 BP as a model. For each atom from BP, if its negation is not in I, add the atom to I. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 20 of 48 <is web> Unfounded Sets Definition Let P be a normal program and I be a partial interpretation. We say A BP 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) ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 21 of 48 <is web> Example For the instantiated normal program P: p(a) p(c), p(b). p(b) p(a). p(e) p(d). p(c). p(d) q(a), q(b). (2): p(d) q(b), q(c). None of the heads can be derived first. q(a) p(d). q(b) q(a). the atoms {p(d), q(a), q(b), q(c)} are an unfounded set wrt I=Ø. There exists no definition for q(c). Thus (1) is satisfied. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 22 of 48 <is web> Example For the instantiated normal program P: p(a) p(c), p(b). Neither (1) nor (2) are satisfied. 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(a), p(b)} are no unfounded set wrt I=Ø! ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 23 of 48 <is web> Notation: Let S be a set of literals. Then we write S for {p : pS} ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 24 of 48 <is web> Union of Unfounded Sets Definition The greatest unfounded set (of P) wrt I, denoted UP(I), is the union of all sets that are unfounded wrt I. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 25 of 48 <is web> Well-Founded Partial Models ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 27 of 48 <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 28 of 48 <is web> Transformations Definition Let P be a normal program. Transformations TP, UP and WP are defined as follows: – pTP(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. – UP(I) is the greatest unfounded set of P wrt I. – WP(I) = TP(I) UP(I). Lemma TP, UP and WP are monotonic transformations. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 29 of 48 <is web> 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 , I I Note that 0 is a limit ordinal, and I0 = . (2) For a successor ordinal = + 1, I 1 WP I (3) Finally, define I I ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 30 of 48 <is web> 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 ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 31 of 48 <is web> Closure Ordinal Definition The closure ordinal for the sequence I is the least ordinal such that: I = I. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 32 of 48 <is web> Well-Founded Semantics Definition The well-founded semantics of a program P is the “meaning” represented by the least fixed point of WP 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 33 of 48 <is web> 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). ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] I0=Ø TP(I0)={p(c)} UP(I0)={p(d),q(a),q(b),q(c)} WP(I0)={p(c),p(d),q(a), q(b), q(c)} TP(I1)={p(e),p(c)} UP(I1)={p(d),q(a),q(b),q(c)} WP(I1)={p(e),p(c),p(d), q(a),q(b),q(c)} TP(I2)={p(e),p(c)} … Foundations of Logic Programming 34 of 48 <is web> 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 WP 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 WP is important for this lemma. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 35 of 48 <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 36 of 48 <is web> Well-Founded (Partial) Model Definition Suppose that for each pBP, 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 37 of 48 <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 38 of 48 <is web> Theorem: If a program P is locally stratified, then is has a well-founded model, which is identical to the perfect model. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 39 of 48 <is web> Example: Suppose all Valid Moves From one Position to an other are in the EDB winning(X) move(X,Y), not winning(Y). F player 1 moves T T player 2 moves F F F player 1 loses player 1 loses T T F player 1 zieht F (a) ISWeb - Information Systems & Semantic Web player 2 moves Steffen Staab [email protected] F player 2 loses T F F (b) Foundations of Logic Programming 40 of 48 (c) <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 41 of 48 <is web> 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). ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 42 of 48 <is web> 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 PI consisting of a set inference rules, which might be applied to various EDBs or sets of facts. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 43 of 48 <is web> Computational Complexity • Predicates that appear as subgoals in PI, but not in the head of any rule, constitute the EDB predicates. • The EDB PE is a set of positive ground literals ranging over the EDB predicates. (The constants in PE may or may not appear in PI.) • given an EDB PE: – P(PE) = PI PE is a Logic program and its well-founded partial model is denoted by I(PE). – PI defines the transformation from PE to I(PE). ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 44 of 48 <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 45 of 48 <is web> Data Complexity - Since the IDB is fixed, the predicates in the wellfounded 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 46 of 48 <is web> 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 NPcomplete for general propositional logic programs. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 47 of 48 <is web> 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. ISWeb - Information Systems & Semantic Web Steffen Staab [email protected] Foundations of Logic Programming 49 of 48
© Copyright 2026 Paperzz