the idea of completion

27
The idea of completion • In LP one uses “if” but mean “iff” [Clark78] This doesn’t imply that -1 is not a natural number! With this program we mean: This is the idea of Clark’s completion: Syntactically transform if’s into iff’s Use classical logic in the transformed theory to provide the semantics of the program ). ( )) ( ( ). 0 ( N naturalN N s naturalN naturalN ) ( ) ( : 0 ) ( Y nN Y s X Y X X nN

Upload: durin

Post on 14-Jan-2016

21 views

Category:

Documents


0 download

DESCRIPTION

naturalN. (. 0. ). ¬. naturalN. (. s. (. N. )). naturalN. (. N. ). (. (. ). ). Û. =. Ú. $. =. Ù. nN. (. X. ). X. 0. Y. :. X. s. (. Y. ). nN. (. Y. ). The idea of completion. In LP one uses “if” but mean “iff” [Clark78]. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The idea of completion

The idea of completion

• In LP one uses “if” but mean “iff” [Clark78]

• This doesn’t imply that -1 is not a natural number!• With this program we mean:

• This is the idea of Clark’s completion:Syntactically transform if’s into iff’sUse classical logic in the transformed theory to provide the

semantics of the program

).())((

).0(

NnaturalNNsnaturalN

naturalN

)()(:0)( YnNYsXYXXnN

Page 2: The idea of completion

Program completion

• The completion of P is the theory comp(P) obtained by: Replace p(t) by p(X) X = t, Replace p(X) by p(X) Y , where Y are the

original variables of the rule Merge all rules with the same head into a single one

p(X) 1 … n

For every q(X) without rules, add q(X) Replace p(X) by X (p(X) )

Page 3: The idea of completion

Completion Semantics

• Though completion’s definition is not that simple, the idea behind it is quite simple

• Also, it defines a non-classical semantics by means of classical inference on a transformed theory

DLet comp(P) be the completion of P where not is interpreted as classical negation: A is true in P iff comp(P) |= A A is false in P iff comp(P) |= not A

Page 4: The idea of completion

SLDNF proof procedure

• By adopting completion, procedurally we have:

not is “negation as finite failure”• In SLDNF proceed as in SLD. To prove not A:

– If there is a finite derivation for A, fail not A– If, after any finite number of steps, all derivations

for A fail, remove not A from the resolvent (i.e. succeed not A)

• SLDNF can be efficiently implemented (cf. Prolog)

Page 5: The idea of completion

SLDNF example

p p.q not p.a not b.b not c.

a

not b b

not c c

X

X

q

not p p

p

pNo success nor finite failure

• According to completion:– comp(P) |= {not a, b, not c}– comp(P) | p, comp(P) | not p– comp(P) | q, comp(P) | not q

Page 6: The idea of completion

Problems with completion

• Some consistent programs may became inconsistent: p not p becomes p not p

• Does not correctly deal with deductive closuresedge(a,b). edge(c,d). edge(d,c).reachable(a).reachable(A) edge(A,B), reachable(B).

• Completion doesn’t conclude not reachable(c), due to the circularity caused by edge(c,d) and edge(d,c)

Circularity is a procedural concept, not a declarative one

Page 7: The idea of completion

Completion Problems (cont)

• Difficulty in representing equivalencies:

bird(tweety). fly(B) bird(B), not abnormal(B).

abnormal(B) irregular(B)irregular(B) abnormal(B)

• Completion doesn’t conclude fly(tweety)!– Without the rules on the left fly(tweety) is true

– An explanation for this would be: “the rules on the left cause a loop”.

Again, looping is a procedural concept, not a declarative one

When defining declarative semantics, procedural concepts should be rejected

Page 8: The idea of completion

Program stratification

• Minimal models don’t have “loop” problems• But are only applicable to definite programs• Generalize Minimal Models to Normal LPs:

– Divide the program into strata

– The 1st is a definite program. Compute its minimal model

– Eliminate all nots whose truth value was thus obtained

– The 2nd becomes definite. Compute its MM

– …

Page 9: The idea of completion

Stratification example• Least(P1) = {a, b, not p}

• Processing this, P2 becomes:

c trued c, false

• Its minimal model, together with P1 is:

{a, b, c, not d, not p}

• Processing this, P3 becomes:

e a, truef false

p pa bb

c not pd c, not a

e a, not df not c

P1

P2

P3

P

• The (desired) semantics for P is then:

{a, b ,c, not d, e, not f, not p}

Page 10: The idea of completion

Stratification

DLet S1;…;Sn be such that S1 U…U Sn = HP, all the Si are disjoint, and for all rules of P:

A B1,…,Bm, not C1,…,not Ck

if A Si then:

• {B1,…,Bm} Ui j=1 Sj

• {C1,…,Ck} Ui-1 j=1 Sj

Let Pi contain all rules of P whose head belongs to Si. P1;…;Pn is a stratification of P

Page 11: The idea of completion

Stratification (cont)

• A program may have several stratifications:

ab ac not a

P1P2

P3

P

ab ac not a

P1

P2

Por

• Or may have no stratification:b not aa not b

DA Normal Logic Program is stratified iff it admits (at least) one stratification.

Page 12: The idea of completion

Semantics of stratified LPsDLet I|R be the restriction of interpretation I to the atoms

in R, and P1;…;Pn be a stratification of P.

Define the sequence:• M1 = least(P1)

• Mi+1 is the minimal models of Pi+1 such that:

Mi+1| (Uij=1 Sj) = Mi

Mn is the standard model of P

• A is true in P iff A Mn

• Otherwise, A is false

Page 13: The idea of completion

Properties of Standard Model

Let MP be the standard model of stratified P

MP is unique (does not depend on the stratification)

MP is a minimal model of P

MP is supported

DA model M of program P is supported iff:

A M (A Body) P : Body M

(true atoms must have a rule in P with true body)

Page 14: The idea of completion

Perfect models• The original definition of stratification (Apt et al.) was made

on predicate names rather than atoms.

• By abandoning the restriction of a finite number of strata, the definitions of Local Stratification and Perfect Models (Przymusinski) are obtained. This enlarges the scope of application:

even(0)even(s(X)) not even(X)

P1= {even(0)}P2= {even(1) not even(0)}...

• The program isn’t stratified (even/1 depends negatively on itself) but is locally stratified.

• Its perfect model is: {even(0),not even(1),even(2),…}

Page 15: The idea of completion

Problems with stratification

• Perfect models are adequate for stratified LPs– Newer semantics are generalization of it

• But there are (useful) non-stratified LPseven(X) zero(X) zero(0)even(Y) suc(X,Y),not even(X) suc(X,s(X))

• Is not stratified because (even(0) suc(0,0),not even(0)) P

• No stratification is possible if P has:pacifist(X) not hawk(X)hawk(Y) not pacifist(X)

• This is useful in KR: “X is pacifist if it cannot be assume X is hawk, and vice-versa. If nothing else is said, it is undefined whether X is pacifist or hawk”

Page 16: The idea of completion

SLS procedure

• In perfect models not includes infinite failure• SLS is a (theoretical) procedure for perfect models

based on possible infinite failure• No complete implementation is possible (how to

detect infinite failure?)• Sound approximations exist:

– based on loop checking (with ancestors)– based on tabulation techniques

(cf. XSB-Prolog implementation)

Page 17: The idea of completion

Stable Models Idea• The construction of perfect models can be done

without stratifying the program. Simply guess the model, process it into P and see if its least model coincides with the guess.

• If the program is stratified, the results coincide:– A correct guess must coincide on the 1st strata;

– and on the 2nd (given the 1st), and on the 3rd …

• But this can be applied to non-stratified programs…

Page 18: The idea of completion

Stable Models Idea (cont)• “Guessing a model” corresponds to “assuming

default negations not”. This type of reasoning is usual in NMR– Assume some default literals

– Check in P the consequences of such assumptions

– If the consequences completely corroborate the assumptions, they form a stable model

• The stable models semantics is defined as the intersection of all the stable models (i.e. what follows, no matter what stable assumptions)

Page 19: The idea of completion

SMs: preliminary examplea not b c a p not qb not a c b q not r r

• Assume, e.g., not r and not p as true, and all others as false. By processing this into P:

a false c a p falseb false c b q true r

• Its least model is {not a, not b, not c, not p, q, r}

• So, it isn’t a stable model:– By assuming not r, r becomes true

– not a is not assumed and a becomes false

Page 20: The idea of completion

SMs example (cont)a not b c a p not qb not a c b q not r r

• Now assume, e.g., not b and not q as true, and all others as false. By processing this into P:

a true c a p trueb false c b q false r

• Its least model is {a, not b, c, p, not q, r}

• I is a stable model

• The other one is {not a, b, c, p, not q, r}

• According to Stable Model Semantics:

– c, r and p are true and q is false.

– a and b are undefined

Page 21: The idea of completion

Stable Models definitionDLet I be a (2-valued) interpretation of P. The definite

program P/I is obtained from P by:• deleting all rules whose body has not A, and A I

• deleting from the body all the remaining default literals

P(I) = least(P/I)

DM is a stable model of P iff M = P(M).

• A is true in P iff A belongs to all SMs of P

• A is false in P iff A doesn’t belongs to any SMs of P (i.e. not A “belongs” to all SMs of P).

Page 22: The idea of completion

Properties of SMs

Stable models are minimal models

Stable models are supported

If P is locally stratified then its single stable model is the perfect model

Stable models semantics assign meaning to (some) non-stratified programs– E.g. the one in the example before

Page 23: The idea of completion

Importance of Stable Models

Stable Models are an important contribution:– Introduce the notion of default negation (versus negation as

failure)– Allow important connections to NMR. Started the area of

LP&NMR– Allow for a better understanding of the use of LPs in

Knowledge Representation– Introduce a new paradigm (and accompanying

implementations) of LP

It is considered as THE semantics of LPs by a significant part of the community.

But...

Page 24: The idea of completion

Cumulativity

DA semantics Sem is cumulative iff for every P:

if A Sem(P) and B Sem(P) then B Sem(P U {A})

(i.e. all derived atoms can be added as facts, without changing the program’s meaning)

• This property is important for implementations:– without cumulativity, tabling methods cannot be used

Page 25: The idea of completion

Relevance

D A directly depends on B if B occur in the body of some rule with head A. A depends on B if A directly depends on B or there is a C such that A directly depends on C and C depends on B.

DA semantics Sem is relevant iff for every P:

A Sem(P) iff A Sem(RelA(P))

where RelA(P) contains all rules of P whose head is A or some B on which A depends on.

• Only this property allows for the usual top-down execution of logic programs.

Page 26: The idea of completion

Problems with SMs

The only SM is {not a, c,b}a not b c not ab not a c not c

• Don’t provide a meaning to every program:– P = {a not a} has no stable models

• It’s non-cumulative and non-relevant:

– However b is not true in P U {c} (non-cumulative)• P U {c} has 2 SMs: {not a, b, c} and {a, not b, c}

– b is not true in Relb(P) (non-relevance)

• The rules in Relb(P) are the 2 on the left

• Relb(P) has 2 SMs: {not a, b} and {a, not b}

Page 27: The idea of completion

Problems with SMs (cont)• Its computation is NP-Complete

• The intersection of SMs is non-supported:

c is true but neither a nor b are true.a not b c ab not a c b

• Note that the perfect model semantics:– is cumulative– is relevant– is supported– its computation is polynomial