asp vs. prolog like programming asp is adequate for: –np-complete problems –situation where the...

27
ASP vs. Prolog like programming • ASP is adequate for: – NP-complete problems – situation where the whole program is relevant for the problem at hands If the problem is polynomial, why using such a complex system? If only part of the program is relevant for the desired query, why computing the whole model?

Post on 21-Dec-2015

220 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

ASP vs. Prolog like programming

• ASP is adequate for:– NP-complete problems– situation where the whole program is relevant for the

problem at hands

If the problem is polynomial, why using such a complex system?

If only part of the program is relevant for the desired query, why computing the whole model?

Page 2: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

ASP vs. Prolog

• For such problems top-down, goal-driven mechanisms seem more adequate

• This type of mechanisms is used by Prolog– Solutions come in variable substitutions rather

than in complete models– The system is activated by queries– No global analysis is made: only the relevant

part of the program is visited

Page 3: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Problems with Prolog

• Prolog declarative semantics is the completion– All the problems of completion are inherited by

Prolog

• According to SLDNF, termination is not guaranteed, even for Datalog programs (i.e. programs with finite ground version)

• A proper semantics is still needed

Page 4: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Well Founded Semantics

• Defined in [GRS90], generalizes SMs to 3-valued models.

• Note that:– there are programs with no fixpoints of – but all have fixpoints of 2

P = {a not a} ({a}) = {} and ({}) = {a}• There are no stable models

• But: ({}) = {} and ({a}) = {a}

Page 5: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Partial Stable ModelsDA 3-valued intr. (T U not F) is a PSM of P iff:

• T = P2(T)

• T (T)

• F = HP - (T)

The 2nd condition guarantees that no atom is both true and false: T F = {}

P = {a not a}, has a single PSM: {}

a not b c not ab not a c not c

This program has 3 PSMs:

{}, {a, not b} and {c, b, not a}

The 3rd corresponds to the single SM

Page 6: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

WFS definition

T [WF Model] Every P has a knowledge ordering (i.e. wrt ) least PSM, obtainable by the transfinite sequence:

T0 = {}

Ti+1 = 2(Ti)

T = U< T, for limit ordinals

Let T be the least fixpoint obtained.

MP = T U not (HP - (T))

is the well founded model of P.

Page 7: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Well Founded Semantics

• Let M be the well founded model of P:

– A is true in P iff A M

– A is false in P iff not A M

– Otherwise (i.e. A M and not A M) A is

undefined in P

Page 8: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

WFS Properties

• Every program is assigned a meaning

• Every PSM extends one SM– If WFM is total it coincides with the single SM

• It is sound wrt to the SMs semantics– If P has stable models and A is true (resp. false) in

the WFM, it is also true (resp. false) in the intersection of SMs

• WFM coincides with the perfect model in locally stratified programs (and with the least model in definite programs)

Page 9: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

More WFS Properties

• The WFM is supported

• WFS is cumulative and relevant

• Its computation is polynomial (on the number of instantiated rule of P)

• There are top-down proof-procedures, and sound implementations– these are mentioned in the sequel

Page 10: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

LP and Default TheoriesD Let P be the default theory obtained by transforming:

H B1,…,Bn, not C1,…, not Cm

into: B1,…,Bn : ¬C1,…, ¬Cm

H

T There is a one-to-one correspondence between the SMs of P and the default extensions of P

T If L WFM(P) then L belongs to every extension of P

Page 11: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

LPs as defaults

• LPs can be viewed as sets of default rules

• Default literals are the justification:– can be assumed if it is consistent to do so– are withdrawn if inconsistent

• In this reading of LPs, is not viewed as implication. Instead, LP rules are viewed as inference rules.

Page 12: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

LP and Auto-Epistemic Logic

D Let P be the AEL theory obtained by transforming:

H B1,…,Bn, not C1,…, not Cm

into:

B1 … Bn ¬ L C1 … ¬ L Cm H

T There is a one-to-one correspondence between the SMs of P and the (Moore) expansions of P

T If L WFM(P) then L belongs to every expansion of P

Page 13: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

LPs as AEL theories

• LPs can be viewed as theories that refer to their own knowledge

• Default negation not A is interpreted as “A is not known”

• The LP rule symbol is here viewed as material implication

Page 14: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

LP and AEBD Let P be the AEB theory obtained by transforming:

H B1,…,Bn, not C1,…, not Cm

into:

B1 … Bn B ¬C1 … B ¬CmH

T There is a one-to-one correspondence between the PSMs of P and the AEB expansions of P

T A WFM(P) iff A is in every expansion of P

not A WFM(P) iff B¬A is in all expansions of P

Page 15: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

LPs as AEB theories

• LPs can be viewed as theories that refer to their own beliefs

• Default negation not A is interpreted as “It is believed that A is false”

• The LP rule symbol is also viewed as material implication

Page 16: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

SM problems revisited

• The mentioned problems of SM are not necessarily problems:– Relevance is not desired when analyzing global

problems– If the SMs are equated with the solutions of a problem,

then some problems simple have no solution– Some problems are NP. So using an NP language is not

a problem.– In case of NP problems, the efficient gains from

cumulativity are not really an issue.

Page 17: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

SM versus WFM• Yield different forms of programming and of representing

knowledge, for usage with different purposes• Usage of WFM:

– Closer to that of Prolog– Local reasoning (and relevance) are important– When efficiency is an issue even at the cost of expressivity

• Usage of SMs– For representing NP-complete problems– Global reasoning– Different form of programming, not close to that of Prolog

• Solutions are models, rather than answer/substitutions

Page 18: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Extended LPs• In Normal LPs all the negative information is implicit. Though

that’s desired in some cases (e.g. the database with flight connections), sometimes an explicit form of negation is needed for Knowledge Representation

• “Penguins don’t fly” could be: noFly(X) penguin(X)

• This does not relate fly(X) and noFly(X) in:

fly(X) bird(X)

noFly(X) penguin(X)

For establishing such relations, and representing negative information a new form of negation is needed in LP:

Explicit negation - ¬

Page 19: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Extended LP: motivation

• ¬ is also needed in bodies:“Someone is guilty if is not innocent”

– cannot be represented by: guilty(X) not innocent(X)

– This would imply guilty in the absence of information about innocent

– Instead, guilty(X) ¬innocent(X) only implies guilty(X) if X is proven not to be innocent

• The difference between not p and ¬p is essential whenever the information about p cannot be assumed to be complete

Page 20: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

ELP motivation (cont)

• ¬ allows for greater expressivity:“If you’re not sure that someone is not innocent, then further

investigation is needed”

– Can be represented by:

investigate(X) not ¬innocent(X)

• ¬ extends the relation of LP to other NMR formalisms. E.g– it can represent default rules with negative conclusions and

pre-requisites, and positive justifications

– it can represent normal default rules

Page 21: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Explicit versus Classical ¬• Classical ¬ complies with the “excluded middle”

principle (i.e. F v ¬F is tautological)– This makes sense in mathematics

– What about in common sense knowledge?

• ¬A is the the opposite of A.• The “excluded middle” leaves no room for

undefinednesshire(X) qualified(X)reject(X) ¬qualified(X)

The “excluded middle” implies that every X is either hired or rejected

It leaves no room for those about whom further information is need to determine if they are qualified

Page 22: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

ELP Language• An Extended Logic Program P is a set of rules:

L0 L1, …, Lm, not Lm+1, … not Ln (n,m 0)

where the Li are objective literals

• An objective literal is an atoms A or its explicit negation ¬A

• Literals not Lj are called default literals

• The Extended Herbrand base HP is the set of all instantiated objective literals from program P

• We will consider programs as possibly infinite sets of instantiated rules.

Page 23: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

ELP Interpretations• An interpretation I of P is a set

I = T U not F

where T and F are disjoint subsets of HP and

¬L T L F (Coherence Principle)

i.e. if L is explicitly false, it must be assumed false by default

• I is total iff HP = T U F

• I is consistent iff ¬ L: {L, ¬L} T– In total consistent interpretations the Coherence Principle is

trivially satisfied

Page 24: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Answer sets• It was the 1st semantics for ELPs [Gelfond&Lifschitz90]• Generalizes stable models to ELPs

D Let M- be a stable models of the normal P- obtained by replacing in the ELP P every ¬A by a new atom A-. An answer-set M of P

is obtained by replacing A- by ¬A in M-

• A is true in an answer set M iff A S

• A is false iff ¬A S

• Otherwise, A is unknown

• Some programs have no consistent answer sets:– e.g. P = {a ¬a }

Page 25: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Answer sets and DefaultsD Let P be the default theory obtained by transforming:

L0 L1,…,Lm, not Lm+1,…, not Ln

into: L1,…,Lm : ¬Lm+1,…, ¬Ln

L0

where ¬¬A is (always) replaced by A

T There is a one-to-one correspondence between the answer-sets of P and the default extensions of P

Page 26: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

Answer-sets and AEL

D Let P be the AEL theory obtained by transforming:

L0 L1,…,Lm, not Lm+1,…, not Ln

into:

L1 L L1… Lm L Lm

¬ L Lm+1 … ¬ L Lm L0 L L0

T There is a one-to-one correspondence between the answer-sets of P and the expansions of P

Page 27: ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf

The coherence principle• Generalizing WFS in the same way yields unintuitive

results:pacifist(X) not hawk(X)hawk(X) not pacifist(X)¬pacifist(a)

– Using the same method the WFS is: {¬pacifist(a)}

– Though it is explicitly stated that a is non-pacifist, not pacifist(a) is not assumed, and so hawk(a) cannot be concluded.

• Coherence is not satisfied... Coherence must be imposed