1 / 47

Three-Valued Models of Program Completion

Three-Valued Models of Program Completion. 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 . p   p,  q. p  p. Completion:

zona
Télécharger la présentation

Three-Valued Models of Program Completion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Three-Valued Models of Program Completion

  2. 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. p p, q. p  p. Completion: p(pq)p. q. Program has 2-valued model I={q,p} Example: Problems with Completion in 2-Valued Logic p p, q. Completion: p(pq) q. Program has no 2-valued model.

  4. Truth Tables for 3-Valued Logic (Extensions Only!) A A A B A  B A B A  B A B AB   0  0 0   0   1   1   1  1      1  0 1  1    1 A B AB 0   1  1    Attention::AB BA no longer holds!

  5. p p, q. p  p. Completion: p(pq)p. q. Program has 3-valued model forp=, I={q} I={q,p} Example: Completion and 3-Valued Logic p p, q. Completion: p(pq) q. Program has 3-valued model for p= , I={q}

  6. 2-Valued Models {p,q,r,s} {p,q,r,s} {p,q,r,s} 3-Valued Model {} Uniqueness p p, q. q  r q  s r  r s  s Completion: p(pq) qrs rr ss Not comparable

  7. Undefined DefinitionLiteral 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. Stratified Programs

  9. 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. Local Stratification Definition A normal program is stratified if each atom inBP 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. 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, …}

  12. Perfect Model Definition Let P be a normal program and I a model. I is a perfect model for a given level ofBP, 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. 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, …}

  14. Well-Founded Semantics

  15. Theorem:If a program P is locally stratified, then is has a well-founded model, which is identical to the perfect model.

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

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

  21. Unfounded Sets DefinitionLet 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)

  22. 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). p(d)  q(b), q(c). q(a)  p(d). q(b)  q(a). (2): None of the heads can be derived first. 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.

  23. 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). p(d)  q(b), q(c). q(a)  p(d). q(b)  q(a). Neither (1) nor (2) are satisfied. the atoms {p(a), p(b)} are no unfounded set wrt I=Ø!

  24. Notation: Let S be a set of literals. Then we write S for {p : pS}

  25. Union of Unfounded Sets DefinitionThe greatest unfounded set (of P) wrt I, denoted UP(I), is the union of all sets that are unfounded wrt I.

  26. Well-Founded Partial Models

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

  28. Transformations DefinitionLet P be a normal program.Transformations TP, UP and WP are defined as follows: • pTP(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). LemmaTP, UP and WP are monotonic transformations.

  29. 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: • For limit ordinal ,Note that 0 is a limit ordinal, and I0 = . • For a successor ordinal  =  + 1, • Finally, define

  30. Stufe DefinitionFor any literal p in I, we define the stage of p to be the least ordinal  such that p  I. LemmaI is a monotonic sequence of partial interpretations. Proof SketchInduction over 

  31. Closure Ordinal DefinitionThe closure ordinal for the sequence Iis the least ordinal  such that: I = I.

  32. Well-Founded Semantics DefinitionThe 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.

  33. Example 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)} … 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).

  34. Well-Founded Semantics LemmaLet I be defined as above. Then Idoes not weakly falsify any instantiated clause R of P. Proof SketchThe definition ofWP 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.

  35. Well-Founded (Partial) Model TheoremFor every countable ordinal , I in the sequence described above is a partial model of P. ProofUsing the first and the previous lemma.

  36. Well-Founded (Partial) Model DefinitionSuppose that for each pBP, 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.

  37. Minimal Model TheoremEvery Horn program has a well-founded modelI, which is the minimum model in the sense of Van Emden and Kowalski, that is, its positive literals are contained in every Herbrand model.

  38. Theorem:If a program P is locally stratified, then is has a well-founded model, which is identical to the perfect model.

  39. Example: Suppose all Valid Moves From one Position to an other are in the EDB winning(X)  move(X,Y), not winning(Y). F  F player 1 moves T T  player 2 moves player 2 moves T T F F F T player 1loses player 1loses player 1 zieht F F F F player 2loses (a) (b) (c)

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

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

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

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

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

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

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

  47. Advantages of Well-Founded Semantics The well-founded semantics for normal programs extends earlier proposals and has advantages over them in that • it is applicable to all logic programs • compared to other methods a larger part of the Herbrand base tends to be classified as either true or false • truth values are assigned in a reasonably predictable and intuitively satisfying way.

More Related