Reasoning with Logic Programming

215
Reasoning with Logic Programming Luís Moniz Pereira José Júlio Alferes Utrecht, August 1999

description

Reasoning with Logic Programming. Luís Moniz Pereira José Júlio Alferes. Utrecht, August 1999. Course Aim. To provide a logic programming integrated framework and working system, for representing knowledge and reason about classical AI topics and applications, such as: taxonomies - PowerPoint PPT Presentation

Transcript of Reasoning with Logic Programming

Reasoning with Logic Programming

Luís Moniz Pereira

José Júlio Alferes

Utrecht, August 1999

Course Aim

To provide a logic programming integrated framework and working system, for representing knowledge and reason about classical AI topics and applications, such as: taxonomies hypothetical reasoning abduction paraconsistent reasoning

revision diagnosis updating actions

Course materialThe course comprises research of the last decade

on the use of Logic Programming for Knowledge Representation and Reasoning

This is now a mature area of research It presents the basic formalism, proof procedures,

and application domains It articulates work on semantics, methodologies

for KRR, belief revision, and knowledge updates It shows open areas with research opportunitiesAt the end, pointers to bibliography are provided

Course topics

Overview of Logic Programs semanticsExplicit negation semanticsParaconsistencyMethodology for KR in LPProof proceduresBelief revision and abductionUpdates of Logic ProgramsModeling actions

LP forKnowledge Representation

Due to its declarative nature, LP has become a prime candidate for Knowledge Representation and Reasoning

This has been more noticeable since its relations to other NMR formalisms were established

For this usage of LP, a precise declarative semantics was in order

LanguageA Normal Logic Programs P is a set of rules:

H A1, …, An, not B1, … not Bm (n,m 0)

where H, Ai and Bj are atoms

Literal not Bj are called default literalsWhen no rule in P has default literal, P is

called definite The Herbrand base HP is the set of all

instantiated atoms from program P.We will consider programs as possibly

infinite sets of instantiated rules.

Declarative Programming

A logic program can be an executable specification of a problem

member(X,[X|Y]).

member(X,[Y|L]) member(X,L).

Easier to program, compact codeAdequate for building prototypesGiven efficient implementations, why not

use it to “program” directly?

LP and Deductive Databases

In a database, tables are viewed as sets of facts:

),(

).,(

londonlisbonflight

adamlisbonflight

LondonLisbon

AdamLisbon

tofromflight

Other relations are represented with rules:

).,(),(

).,(),,(),(

).,(),(

BAconnectionnotBAherchooseAnot

BCconnectionCAflightBAconnection

BAflightBAconnection

LP and Deductive DBs (cont)

LP allows to store, besides relations, rules for deducing other relations

Note that default negation cannot be classical negation in:

).,(),(

).,(),,(),(

).,(),(

BAconnectionnotBAherchooseAnot

BCconnectionCAflightBAconnection

BAflightBAconnection

A form of Closed World Assumption (CWA) is needed for inferring non-availability of connections

Default Rules

The representation of default rules, such as

“All birds fly”can be done via the non-monotonic operator not

).(

).(

).()(

).()(

.)(),()(

ppenguin

abird

PpenguinPabnormal

PpenguinPbird

AabnormalnotAbirdAflies

The need for a semantics

In all the previous examples, classical logic is not an appropriate semantics In the 1st, it does not derive not member(3,[1,2]) In the 2nd, it never concludes choosing another

company In the 3rd, all abnormalities must be expressed

The precise definition of a declarative semantics for LPs is recognized as an important issue for its use in KRR.

2-valued Interpretations

A 2-valued interpretation I of P is a subset of HP

A is true in I (ie. I(A) = 1) iff A I Otherwise, A is false in I (ie. I(A) = 0)

Interpretations can be viewed as representing possible states of knowledge.

If knowledge is incomplete, there might be in some states atoms that are neither true nor false

3-valued Interpretations

A 3-valued interpretation I of P is a setI = T U not F

where T and F are disjoint subsets of HP

A is true in I iff A T A is false in I iff A F Otherwise, A is undefined (I(A) = 1/2)

2-valued interpretations are a special case, where:

HP = T U F

Models

Models can be defined via an evaluation function Î: For an atom A, Î(A) = I(A) For a formula F, Î(not F) = 1 - Î(F) For formulas F and G:

Î((F,G)) = min(Î(F), Î(G))Î(F G)= 1 if Î(G) Î(F), and = 0 otherwise

I is a model of P iff, for all rule H B of P:Î(H B) = 1

Minimal Models Semantics

The idea of this semantics is to minimize positive information. What is implied as true by the program is true; everything else is false.

)(

)(

)()(

sampaiopresident

einsteinphysicist

XphysicistXaticianableMathem

{pr(s),pr(e),ph(s),ph(e),aM(s),aM(e)} is a modelLack of information that sampaio is a physicist, should

indicate that he isn’tThe minimal model is: {pr(s),ph(e),aM(e)}

Minimal Models Semantics

D[Truth ordering] For interpretations I and J, I J iff for all atom A, I(A) J(A), i.e.

TI TJ and FI FJ

T Every definite logic program has a least (truth ordering) model.

D[minimal models semantics] An atom A is true in (definite) P iff A belongs to its least model. Otherwise, A is false in P.

TP operator

The minimal models of a definite P can be computed (bottom-up) via operator TP

D[TP] Let I be an interpretation of definite P.

TP(I) = {H: (H Body) P and Body I}

T If P is definite, TP is monotone and continuous. Its minimal fixpoint can be built by: I0 = {} and In = TP(In-1)

T The least model of definite P is TP({})

On Minimal Models

SLD can be used as a proof procedure for the minimal models semantics: If the is a SLD-derivation for A, then A is

true Otherwise, A is false

The semantics does not apply to normal programs: p not q has two minimal models:

{p} and {q}There is no least model !

The idea of completion

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

).())((

).0(

NnaturalNNsnaturalN

naturalN

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

)()(:0)( YnNYsXYXXnN

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

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

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

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)

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

Problems with completion

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

Does not correctly deal with deductive closures

edge(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

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 oneWhen defining declarative semantics,

procedural concepts should be rejected

Program stratification

Minimal models don’t have “loop” problemsBut are only applicable to definite programsGeneralize 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 …

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}

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

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.

Semantics of stratified LPs

DLet 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

Properties of Standard Model

Let MP be the standard model of stratified PMP 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)

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),…}

Problems with stratificationPerfect models are adequate for stratified LPs Newer semantics are generalization of it

But there are (useful) non-stratified LPs

even(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”

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)

Stable Models IdeaThe 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…

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)

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

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

Stable Models definition

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

Properties of SMs

Stable models are minimal modelsStable models are supportedIf P is locally stratified then its single

stable model is the perfect modelStable models semantics assign

meaning to (some) non-stratified programs E.g. the one in the example before

Importance of Stable Models

Stable Models were an important contribution: Introduced the notion of default negation

(versus negation as failure) Allowed important connections to NMR.

Started the area of LP&NMR Allowed for a better understanding of the use

of LPs in Knowledge Representation

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

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 implementation: without cumulativity, tabling methods

cannot be used

Relevance

D A directly depends on B if B occurs 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.

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}

Problems with SMs (cont)

Its computation is NP-CompleteThe 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

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}

Partial Stable Models

DA 3-valued intr. (T U not F) is a PSM of P iff:• T = 2(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

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.

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

WFS Properties

Every program is assigned a meaningEvery 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)

More WFS Properties

The WFM is supportedWFS is cumulative and relevantIts computation is polynomial (on the

number of instantiated rules of P)There are top-down proof-

procedures, and sound implementations these are mentioned in the sequel

LP and Default Theories

D 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

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.

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

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

LP and AEB

D 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

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

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 - ¬

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

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

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

ELP LanguageAn Extended Logic Program P is a set of rules:

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

where the Li are objective literalsAn objective literal is an atoms A or its explicit

negation ¬ALiterals 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.

ELP Interpretations

An interpretation I of P is a setI = 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

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

D Let M- be a stable model 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 }

Answer sets and Defaults

D 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

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

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

Imposing Coherence

Coherence is: ¬L T L F, for objective LAccording to the WFS definition, everything is

false that doesn’t belong to (T)To impose coherence, when applying (T)

simply delete all rules for the objective complement of literals in T

“If L is explicitly true then when computing undefined literals forget all

rules with head ¬L”

WFSX definition

D The semi-normal version of P, Ps, is obtained by adding not ¬L to every rule of P with head L

DAn interpretation (T U not F) is a PSM of ELP P iff:• T = PPs(T)

• T Ps(T)

• F = HP - Ps(T)

T The WFSX semantics is determined by the knowledge ordering least PSM (wrt )

WFSX example

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

pacifist(b)

Ps: pacifist(X) not hawk(X), not ¬pacifist(X)hawk(X) not pacifist(X ), not ¬hawk(X)¬pacifist(a) not pacifist(a) pacifist(b) ← not ¬pacifist(b) T0 = {}

s(T0) = {¬p(a),p(a),h(a),p(b),h(b)}T1 = {¬p(a)}s(T1) = {¬p(a),h(a),p(b),h(b)}T2 = {¬p(a),h(a)}T3 = T2

The WFM is:

{¬p(a),h(a), not p(a), p(b), not ¬h(a), not ¬p(b), not ¬h(b)}

Properties of WFSX

Complies with the coherence principleCoincides with WFS in normal programsIf WFSX is total it coincides with the only

answer-setIt is sound wrt answer-setsIt is supported, cumulative, and relevantIts computation is polynomialIt has sound implementations (cf. below)

Inconsistent programs

Some ELPs have no WFM. E.g. { a ¬a } What to do in these cases?

Explosive approach: everything follows from contradictiontaken by answer-setsgives no information in the presence of contradiction

Belief revision approach: remove contradiction by revising Pcomputationally expensive

Paraconsistent approach: isolate contradictionefficientallows to reason about the non-contradictory part

WFSXp definition

The paraconsistent version of WFSx is obtained by dropping the requirement that T and F are disjoint, i.e. dropping T Ps(T)DAn interpretation, T U not F, is a PSMp P iff:• T = PPs(T)

• F = HP - Ps(T)

T The WFSXp semantics is determined by the knowledge ordering least PSM (wrt )

WFSXp example

P: c not b ab a ¬ad not e

Ps: c not b, not ¬c a not ¬ab a, not ¬b ¬a not ad not e , not ¬d T0 = {}

s(T0) = {¬a,a,b,c,d}T1 = {¬a,a,b,d}s(T1) = {d}T2 = {¬a,a,b,c,d}T3 = T2

The WFM is:{¬a,a,b,c,d, not a, not ¬a, not b, not ¬b not c, not ¬c, not ¬d, not e}

Surgery situation

A patient arrives with: sudden epigastric pain; abdominal tenderness; signs of peritoneal irritation

The rules for diagnosing are: if he has sudden epigastric pain abdominal tenderness,

and signs of peritoneal irritation, then he has perforation of a peptic ulcer or an acute pancreatitis

the former requires surgery, the latter therapeutic treatment

if he has high amylase levels, then a perforation of a peptic ulcer can be exonerated

if he has Jobert’s manifestation, then pancreatitis can be exonerated

In both situations, the pacient should not be nourished, but should take H2 antagonists

LP representation

perforation pain, abd-tender, per-irrit, not high-amylase

pancreat pain, abd-tender, per-irrit, not jobert¬nourish perforation h2-ant perforation¬nourish pancreat h2-ant pancreatsurgery perforation anesthesia surgery ¬surgery pancreat

pain. per-irrit. ¬high-amylase.

abd-tender. ¬jobert.

The WFM is:{pain, abd-tender, per-irrit, ¬high-am, ¬jobert , not ¬pain, not ¬abd-tender, not

¬per-irrit, not high-am, not jobert, ¬nourish, h2-ant, not nourish, not ¬h2-ant,

surgery, ¬surgery, not surgery, not ¬surgery,anesthesia, not anesthesia, not ¬anesthesia }

Results interpretation

The symptoms are derived and non-contradictory Both perforation and pancreatitis are concluded He should not be fed (¬nourish), but take H2 antagonists The information about surgery is contradictory Anesthesia though not explicitly contradictory

(¬anesthesia doesn’t belong to WFM) relies on contradiction (both anesthesia and not anesthesia belong to WFM)

The WFM is:{pain, abd-tender, per-irrit, ¬high-am, ¬jobert , …, ¬nourish, h2-ant, not nourish,

not ¬h2-ant, surgery, ¬surgery, not surgery, not ¬surgery,anesthesia, not anesthesia, not ¬anesthesia }

A methodology for KR

WFSXp provides mechanisms for representing usual KR problems: logic language non-monotonic mechanisms for defaults forms of explicitly representing negation paraconsistency handling ways of dealing with undefinedness

In what follows, we propose a methodology for KR using WFSXp

Representation method (1)

Definite rules If A then B: B A

penguins are birds: bird(X) penguin(X)

Default rules Normally if A then B: B A, rule_name, not ¬B

rule_name not ¬rule_namebirds normally fly: fly(X) bird(X), bf(X), not ¬fly(X)

bf(X) not ¬bf(X)

Representation method (2)

Exception to default rules Under conditions COND do not apply rule RULE: ¬RULE COND

Penguins are an exception to the birds-fly rule ¬bf(X) penguin(X)

Preference rules Under conditions COND prefer rule RULE+ to RULE- : ¬RULE- COND, RULE+

for penguins, prefer the penguins-don’t-fly to the birds-fly rule: ¬bf(X) penguin(X), pdf(X)

Representation method (3)

Hypotethical rules “If A then B” may or not apply: B A, rule_name, not ¬B

rule_name not ¬rule_name ¬rule_name not rule_namequakers might be pacifists:

pacifist(X) quaker(X), qp(X), not ¬pacifist(X) qp(X) not ¬qp(X)

¬qp(X) not qp(X)For a quaker, there is a PSM with pacifist, another with not pacifist. In the WFM pacifist is undefined

Taxonomy example

Mammal are animal Bats are mammals Birds are animal Penguins are birds Dead animals are animals

Normally animals don’t fly Normally bats fly Normally birds fly Normally penguins don’t fly Normally dead animals don’t

fly

The taxonomy:

Pluto is a mammal Joe is a penguin

Tweety is a bird Dracula is a dead bat

The elements:

Dead bats don’t fly though bats do Dead birds don’t fly though birds do Dracula is an exception to the above In general, more specific information is preferred

The preferences:

The taxonomy

flies

animal

bird

penguin

mammal

bat

dead animal

plutotweety draculajoe

Definite rulesDefault rulesNegated default rules

Taxonomy representationTaxonomy

animal(X) mammal(X)mammal(X) bat(X)animal(X) bird(X)bird(X) penguin(X)deadAn(X) dead(X)

Default rules¬flies(X) animal(X), adf(X), not flies(X)adf(X) not ¬adf(X)flies(X) bat(X), btf(X), not ¬flies(X)btf(X) not ¬btf(X) flies(X) bird(X), bf(X), not ¬flies(X)bf(X) not ¬bf(X) ¬flies(X) penguin(X), pdf(X), not flies(X)pdf(X) not ¬pdf(X)¬flies(X) deadAn(X), ddf(X), not flies(X)ddf(X) not ¬ddf(X)

Factsmammal(pluto).bird(tweety). deadAn(dracula).penguin(joe). bat(dracula).

Explicit preferences¬btf(X) deadAn(X), bat(X), r1(X) r1(X) not ¬r1(X)¬bf(X) deadAn(X), bird(X), r2(X) r2(X) not ¬r2(X)¬r1(dracula)

Implicit preferences¬adf(X) bat(X), btf(X) ¬adf(X) bird(X), bf(X)¬bf(X) penguin(X), pdf(X)

Taxonomy results

Joe dracula pluto tweety

deadAn not r not notbat not r not notpenguin r not not notmammal not r r notbird r not not ranimal r r r r

adf r ¬ r ¬btf r ¬ r rbf ¬ r r rpdf r r r rddf r ¬ r rr1 r ¬ r rr2 r ¬ r r

flies ¬ r ¬ r

SLX:Proof procedure for WFSXp

SLX (SL with eXplicit negation) is a top-down procedure for WFSXp Here we only present an AND-trees

characterization The proof procedure details are in [AP96]

Is similar to SLDNF Nodes are either successful or failed Resolution with program rules and resolution of

default literals by failure of their complements are as in SLDNF

In SLX, failure doesn’t mean falsity. It simply means non-verity (i.e. false or undefined)

Success and failure

A finite tree is successful if its root is successful, and failed if its root is failed

The status of a node is determined by:

A leaf labeled with an objective literal is failed

A leaf with true is successful

An intermediate node is successful if all its children are successful, and failed otherwise (i.e. at least one of its children is failed)

Negation as Failure?

As in SLS, to solve infinite positive recursion, infinite trees are (by definition) failed

Can a NAF rule be used? YES

True of not A succeeds if true-or-undefined of A fails

True-or-undefined of not A succeeds if true of A fails

This is the basis of SLX. It defines: T-Trees for proving truth TU-Trees for proving truth or undefinedness

T and TU-trees

They differ in that literals involved in recursion through negation, and so undefined in WFSXp, are failed in T-Trees and successful in TU-Trees

a not b

b not a

b

not a

TU

b

not a

TUa

not b

T

a

not b

T

Explicit negation in SLX

¬-literals are treated as atomsTo impose coherence, the semi-normal

program is used in TU-trees

a not b

b not a¬a

b

not a

a

not b not¬a

¬a

true

b

not a

¬a

true

a

not b not ¬a

Explicit negation in SLX (2)In TU-trees: L also fails if ¬L succeeds trueI.e. if not ¬L fails as true-or-undefined

c not c

b not c¬ba b

not a

¬b

true

c

not c

¬a

b

not c not¬b

a

not ¬a

c

not c

c

not c

c

not c

c

not c

Paraconsistent example

b not a

¬aa

b

not ¬b

not b

not a

a

true

a

true not ¬a

¬ a

true

b

not a

T and TU-trees definition

D T-Trees (resp TU-trees) are AND-trees labeled by literals, constructed top-down from the root by expanding nodes with the rules• Nodes labeled with objective literal A

• If there are no rules for A, the node is a leaf• Otherwise, non-deterministically select a rule for A

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

• In a T-tree the children of A are L1,…,Lm, not Lm+1,…, not Ln

• In a TU-tree A has, additionally, the child not ¬A

• Nodes labeled with default literals are leafs

Success and Failure

All infinite trees are failed. A finite tree is successful if its root is successful and failed if its root is failed. The status of nodes is determined by:• A leaf node labeled with true is successful• A leaf node labeled with an objective literal is failed• A leaf node of a T-tree (resp. TU) labeled with not A is

successful if all TU-trees (resp. T) with root A (subsidiary tree) are failed; and failed otherwise

• An intermediate node is successful if all its children are successful; and failed otherwise

After applying these rules, some nodes may remain undetermined (recursion through not). Undetermined nodes in T-trees (resp.TU) are by definition failed (resp. successful)

Properties of SLX

SLX is sound and (theoretically) complete wrt WFSXp.

Even ignoring rules concerning explicit negation, SLX is sound and (theoretically) complete wrt WFS.

See [AP96] for the definition of a refutation procedure based on the AND-trees characterization, and for all proofs and details

Infinite trees example

s not p, not q, not r

p not s, q, not r

q r, not p

r p, not q

WFM is {s, not p, not q, not r}

not p not q not r

s

p

q not s

r

not q

not r

r not p

p

q not s not r

r not p

p not q

q

r not p

p not q

q not s not r

Negative recursion example

q not p(0), not s

p(N) not p(s(N))

s true

WFM = {s, not q}

s

not p(0)

not q

p(0)

not p(1)

q

not s

p(1)

not p(2)

p(2)

not p(3)

true

not p(0) … p(0)

not p(1)

p(1)

not p(2)

p(2)

not p(3)

Guaranteeing termination

The method is not effective, because of loopsTo guarantee termination in ground programs:

Local ancestors of node n are literals in the path from n to the root, exclusive of n

Global ancestors are assigned to trees:the root tree has no global ancestorsthe global ancestors of T, a subsidiary tree of leaf n of T’,

are the global ancestors of T’ plus the local ancestors of nglobal ancestors are divided into those occurring in T-trees

and those occurring in TU-trees

Pruning rules

For cyclic positive recursion:

Rule 1If the label of a node belongs to its local ancestors, then the node is marked failed, and its children are ignored

For recursion through negation:

Rule 2If a literal L in a T-tree occurs in its global T-ancestors then it is marked failed and its children are ignored

Pruning rules (2)

L

L

Rule 1

L

L

Rule 2

Other sound rules

Rule 3If a literal L in a T-tree occurs in its global TU-ancestors then it is marked failed, and its children are ignored

Rule 4If a literal L in a TU-tree occurs in its global T-ancestors then it is marked successful, and its children are ignored

Rule 5If a literal L in a TU-tree occurs in its global TU-ancestors then it is marked successful, and its children are ignored

Pruning examples

a not b

b not a¬a

b

not a

a

not b not ¬a

¬a

true

c not c

b not c¬ba b

not a

¬b

truec

not c

¬a

b

not c not ¬b

a

not ¬a

Rule 3

bRule 2

Non-ground case

The characterization and pruning rules apply to allowed non-ground programs, with ground queries

It is well known that pruning rules do not generalize to general programs with variables:

p(X) p(Y)

p(a)

p(X)

p(Y)

What to do?• If “fail”, the answers are incomplete• If “proceed” then loop

p(Z)

Tabling

To guarantee termination in non-ground programs, instead of ancestors and pruning rules, tabulation mechanisms are required when there is a possible loop, suspend the literal

and try alternative solutions when a solution is found, store it in a table resume suspended nodes with new solutions in the

table apply an algorithm to determine completion of the

process, i.e. when no more solutions exist, and fail the corresponding suspended nodes

Tabling example

We’ve implemented SLX with tabulation mechanisms

We’ve made use of the XSB-Prolog tabling implementation

SLX with tabling is available with XSB-Prolog Version 2.0

Try it at:

p(X) p(Y)

p(a)

p(X)

p(Y)1) suspend X = a

X = a

2) resume

Y = a

X = _

Table for p(X)http://www.cs.sunysb.edu/~sbprolog/xsb-page.html

Floundering

Another (well known) problem when generalizing for non-ground LPs is floundering

Tabling doesn’t help here

a not p(X)

p(a)

p(X)

X = a

a

not p(X)

Incorrect!

To solve floundering we’ve been working on constructive negation methods

A preliminary implementation existsBut a lot remains to be done!

LP for KRR (review)

Much work has been done:Semantics of LP (allow LPs to be viewed

as NMR formalisms)Extensions with: explicit negation,

abduction, paraconsistency, disjunction, ICs, epistemic operators, …

Formal relations to other formalisms (e.g. default logic, AEL, …)

Techniques to represent and reason about knowledge using LPs

LP and Non-Monotonicity

These works focus on non-monotonicity: LP includes a non-monotonic form of default

negationnot L is true if L cannot (now) be proven

This feature is used for representing incomplete knowledge:

With incomplete knowledge, assume hypotheses, and jump to conclusions.

If (later) the conclusions are proven false, withdraw some hypotheses to regain consistency.

Typical exampleAll birds fly. Penguins are an exception:flies(X) bird(X), not ab(X). bird(a) .

ab(X) penguin(X).

If later we learn penguin(a): Add: penguin(a). Goes back on the assumption not ab(a). No longer concludes flies(a).

This program concludes flies(a), by assuming not ab(a).

LP representing a static world

The work on LP allows the (non-monotonic) addition of new knowledge.

But: Much of the work does not consider this

evolution of knowledgeLPs represent a static knowledge of a given

world in a given situation.The issues of how to add new information to a

logic program are less studied.

Knowledge EvolutionIn real situations knowledge evolves by: completing it with new information (revision) changing it according to the changes in the

world itself (updates)

I know that I have a flight booked for London (either for Heathrow or for Gatwick).

I learn that it is not for Heathrow (revision)

I conclude my flight is for Gatwick

I learn that flights for Heathrow were canceled (update)

Either I have a flight for Gatwick or no flight at all

Logic Programs RevisionThe problem: A LP represents

consistent incomplete knowledge;

New factual information comes.

How to incorporate the new information?

The solution: Add the new facts to

the program If the union is

consistent this is the result

Otherwise restore consistency to the union

The new problem: How to restore consistency to an

inconsistent program?

Simple revision example (1)P: flies(X) bird(X), not ab(X). bird(a) .

ab(X) penguin(X).• We learn penguin(a).

P {penguin(a)} is consistent. Nothing more to be done.• We learn instead ¬flies(a).

P {¬flies(a)} is inconsistent. What to do?

Since the inconsistency rests on the assumption not ab(a), remove that assumption (e.g. by adding the fact ab(a), or forcing it undefined with ab(a) u) obtaining a new program P’.

If an assumption supports contradiction, then go back on that assumption.

Simple revision example (2)P: flies(X) bird(X), not ab(X). bird(a) .

ab(X) penguin(X).

If an assumption supports contradiction, then go back on that assumption.

If later we learn flies(a).

P’ {flies(a)} is inconsistent.

The contradiction does not depend on assumptions.

Cannot remove contradiction!

Some programs are non-revisable.

What to remove?

Which assumptions should be removed?normalWheel not flatTyre, not brokenSpokes.

flatTyre leakyValve. ¬normalWheel wobblyWheel.

flatTyre puncturedTube. wobblyWheel .

Contradiction can be removed by either dropping not flatTyre or not brokenSpokes

We’d like to delve deeper in the model and (instead of not flatTyre) either drop not leakyValve or not puncturedTube.

Revisables

Revisables = not {leakyValve, punctureTube, brokenSpokes}

Revisions in this case are {not lv}, {not pt}, and {not bs}

Solution: Define a set of revisables:

normalWheel not flatTyre, not brokenSpokes.

flatTyre leakyValve. ¬normalWheel wobblyWheel.

flatTyre puncturedTube. wobblyWheel .

Integrity Constraints

For convenience, instead of:¬normalWheel wobblyWheel

we may use the denial: normalWheel, wobblyWheel

We’ve further generalized ICs into:L1 … Ln Ln+1 … Lm

where Lis are literals (possibly not L).

ICs and Contradiction

In an ELP with ICs, add for every atom A: A, ¬A

A program P is contradictory iff P

where is the paraconsistent derivation of SLX

Algorithm for 3-valued revision

Find all derivations for , collecting for each one the set of revisables supporting it. Each is a support set.

Compute the minimal hitting sets of the support sets. Each is a removal set.

A revision of P is obtained by adding{A u: A R}

where R is a removal set of P.

ExampleRev = not {a,b,c}

p, q

p not a.

q not b, r.

r not b.

r not c.

p q

not a r not b

not b not c

Support sets are:{not a, not b}and {not a, not b, not c}.

Removal sets are: {not a} and {not b}.

Simple diagnosis exampleinv(G,I,0) node(I,1), not ab(G).inv(G,I,1) node(I,0), not ab(G).node(b,V) inv(g1,a,V).node(a,1).¬node(b,0).

%Fault modelinv(G,I,0) node(I,0), ab(G).inv(G,I,1) node(I,1), ab(G).

a=1 b0g1

The only revision is:P U {ab(g1) u}

It does not conclude node(b,1).

In diagnosis applications (when fault models are considered) 3-valued revision is not enough.

2-valued Revision

In diagnosis one often wants the IC:ab(X) v not ab(X)

With these ICs (that are not denials), 3-valued revision is not enough.

A two valued revision is obtained by adding facts for revisables, in order to remove contradiction.

For 2-valued revision the algorithm no longer works…

Example

In 2-valued revision: some removals must be deleted; the process must be iterated.

p. a. b, not c.p not a, not b.

a

X

p

not a not bb not c

XThe only support is {not a, not b}.Removals are {not a} and {not b}.

• P U {a} is contradictory (and unrevisable).• P U {b} is contradictory (though revisable).

But:

Algorithm for 2-valued revision

1 Let Revs={{}}2 For every element R of Revs: Add it to the program and compute removal sets. Remove R from Revs For each removal set RS: Add R U not RS to Revs

3 Remove non-minimal sets from Revs4 Repeat 2 and 3 until reaching a fixed point of Revs. The revisions are the elements of the final Revs.

• Choose {b}. The removal set of P U {b} is {not c}. Add {b, c} to Rev. • Choose {b,c}. The removal set of P U {b,c} is {}. Add {b, c} to Rev.

• Choose {}. Removal sets of P U {} are {not a} and {not b}. Add them to Rev.

Example of 2-valued revision p. a. b, not c.p not a, not b.

Rev0 = {{}}

Rev1 = {{a}, {b}}

• Choose {a}. P U {a} has no removal sets.

Rev2 = {{b}}

Rev3 = {{b,c}}

•The fixed point had been reached. P U {b,c} is the only revision.

= Rev4

REVISEThe algorithm with various optimizations

had been implemented - REVISE system. Revise also has:

The possibility of defining a partial ordering of preferences among revisables.

Associate probabilities to revisables.Also computes revisions with minimal cardinality.

Try it at:Try it at: http://www.soi.city.ac.uk/homes/msch/revise/revise.htmlhttp://www.soi.city.ac.uk/homes/msch/revise/revise.html

Optimizations include:Pruning of the search space.Making use of preferences and probabilities.

GeneralizationsThe framework was generalized to

encompass: General ICs Mixed 2 and 3-valued revisions (according

to ICs)This required: Notion of program state (revisables literals

may change) Complex notion of distance between two

states, for minimal change

Revision and DiagnosisIn model based diagnosis one has: a program P with the model of a system (the

correct and, possibly, incorrect behaviors) a set of observations O inconsistent with P (or

not explained by P).The diagnoses of the system are the

revisions of P U O.We’ve shown how to perform mixed

consistency and abduction based diagnosis.

Diagnosis Example

1

1

1

10

c1=0

c3=0

c6=0

c7=0

c2=0

0

1

g10

g11

g16

g19

g22

g23

Diagnosis Program Observablesobs(out(inpt0, c1), 0).obs(out(inpt0, c2), 0).obs(out(inpt0, c3), 0).obs(out(inpt0, c6), 0).obs(out(inpt0, c7), 0).obs(out(nand, g22), 0). obs(out(nand, g23), 1). Predicted and observed values cannot be different

obs(out(G, N), V1), val(out(G, N), V2), V1 V2.

Connectionsconn(in(nand, g10, 1), out(inpt0, c1)).conn(in(nand, g10, 2), out(inpt0, c3)).…conn(in(nand, g23, 1), out(nand, g16)).conn(in(nand, g23, 2), out(nand, g19)).

Value propagationval( in(T,N,Nr), V ) conn( in(T,N,Nr), out(T2,N2) ), val( out(T2,N2), V ).val( out(inpt0, N), V ) obs( out(inpt0, N), V ). Normal behaviorval( out(nand,N), V ) not ab(N), val( in(nand,N,1), W1), val( in(nand,N,2), W2),

nand_table(W1,W2,V). Abnormal behaviorval( out(nand,N), V ) ab(N), val( in(nand,N,1), W1), val( in(nand,N,2), W2),

and_table(W1,W2,V).

Run

Diagnosis Example

c1=0

c3=0

c6=0

c7=0

c2=0

0

1

g10

g11

g16

g19

g22

g23

Revision are:{ab(g23)}, {ab(g19)}, and {ab(g16),ab(g22)}

1

1

1

1 1

0

1

1

0

1 1

0

1

1

1

0 1

0

Revision and Debugging

Declarative debugging can be seen as diagnosis of a program.

The components are: rule instances (that may be incorrect). predicate instances (that may be uncovered)

The (partial) intended meaning can be added as ICs.

If the program with ICs is contradictory, revisions are the possible bugs.

Debugging Transformation

Add to the body of each possibly incorrect rule r(X) the literal not incorrect(r(X)).

For each possibly uncovered predicate p(X) add the rule:

p(X) uncovered(p(X)).

For each goal G that you don’t want to prove add: G.

For each goal G that you want to prove add: not G.

Debugging example

a not b

b not c

WFM = {not a, b, not c}

b should be false

a not b, not incorrect(a not b)

b not c, not incorrect(b not c)a uncovered(a)b uncovered(b)c uncovered(c) bRevisables are incorrect/1 and uncovered/1

Revision is:

{incorrect(b not c)}

{uncovered(c)}

BUT a should be false!

Add a

Revisions now are:

{inc(b not c), inc(a not b)}

{unc(c ), inc(a not b)}

BUT c should be true!

Add not c

The only revision is:

{unc(c ), inc(a not b)}

Abduction as Revision

For abductive queries:

Declare as revisable all the abducibles If the abductive query is Q, add the IC:

not Q The revision of the program are the

abductive solutions of Q.

Current and Future Work

Much has to be done regarding algorithms for computing revisions, and their implementations. Interleave the computation of supports

and removals. Add tabulation Heuristics in the computation of removals Distribute the algorithm (?)

ExampleRev = not {a,b,c}

p, q

p not a. r not b.

q not b, r. r not c.

p

not a

q

r not b

not b not cRemoval sets are:{not a{not b

}}

What if there were several suspended? Which one to resume first? (heuristics) How to traverse the tree?

Ongoing Implementation

Implemented with PVM-Prolog on a “farm” of alphas.

Quite preliminary

RevisionModule

TabulationManager

.

.

.

resume node

(parts of) the tree

revisions

Distributedtabulation system

Knowledge EvolutionIn real situations knowledge evolves by: completing it with new information (revision) changing it according to the changes in the

world itself (updates)

I know that I have a flight booked for London (either for Heathrow or for Gatwick).

I learn that it is not for Heathrow (revision)

I conclude my flight is for Gatwick

I learn that flights for Heathrow were canceled (update)

Either I have a flight for Gatwick or no flight at all

Model Updates

Updates are usually performed model by model.Marek and Truszczynski defined a language for

defining updates:

in(A0) | out(A0) in(A1), …, out(An)

Given an update program and a model of the current situation, produce model(s) of the new situation.

If several models of the current situation exist, one has to proceed model by model.

Updates of Logic Programs

We’ve defined a program transformation to directly obtain Pu

P

M1

...

Mn

M1,1

M1,n1

Mn,nn

Mn,1

...

...

U

Pu

?

U

We’ve generalized MT’s approach to the 3-valued case

Updates of LPs by LPsWhen updating LPs, doing it model by

model is not desired. It loses the directional information of the LP arrow.

P: sleep not tv_on.watch tv_on.tv_on.

U: not tv_on p_failure.p_failure.

U2: not p_failure.

M = {tv,w}

Mu = {pf,w} vs

Mu2 = {w} vs

{pf,s}

{tv,w}

Bodies are evaluated in the last state.

Generalized LPs

A generalized logic program P is a set of propositional Horn clauses

L L1 ,…, Ln

where L and Li are atoms from LK , i.e. of the

form A or ´not A´.

Program P is normal if no head of the clause in P

has form not A.

Generalized LP semantics

A set M is an interpretation of LK if for every atom A in K exactly one of A and not A is in M.

Definition:

An interpretation M of LK is a stable model of a generalized logic program P if M is the least model of the Horn theory P {not A: A M}.

Generalized LPs example

Example: K = { a,b,c,d,e} P : a not b c b e not d not d a, not c d not e

this program has exactly one stable model: M = Least(P not {b, c, d}) = {a, e, not b, not c, not d}

N = {not a, not e, b, c, d} is not a stable model since N Least(P {not a, not e})

Relation to stable models

Proposition:

An interpretation M of LK is a stable model of a generalized logic program P iff for every A LK

if P/M |- A then A M if A K M then P/M |- A

where P/M denotes Gelfond-Lifschitz transform of P wrt M Conclusion:

The class of stable models of generalized logic programs extends the class of stable models of normal programs.

Drawbacks of Interpretation Updates

How to update a logic program P by a logic program U obtaining as a result a new, updated logic program P U.

Interpretation update approach (H.Katsuno and A.Mendelzon,

M.Winslett) : models of DB’ = updated models of DB

Drawbacks of this approach: all the models of DB have to be computed and updated

separately no natural way to compute DB’ (DB’ may not exist) produces counter-intuitive results when intensional part of DB

is allowed to be updated.

Update Example

Example:P : sleep not tv_on

watch_tv tv_on

tv_on

the only stable model is M = {tv_on, watch_tv} U : not tv_on power_failure

power_failure

the only update is MU = {power_failure, watch_tv}

the intended model is MI = {power_failure, sleep}

U2 : not power_failure

Update Example (2)

Example:

P : innocent not found_guilty

the only stable model is M = {innocent}

U : found_guilty

the only update is MU = {innocent, found_guilty}

the intended model is MI = {found_guilty}

Dynamic Program Updates Program P is semantically equivalent to the

programP’ : innocent the model MU = {innocent, found_guilty} is the only

reasonable model of the update of P’ by U.

DB’ depends not only on semantics of DB and update U (interpretation updates) but also on their syntax.

We propose a new approach to the problem of updating knowledge bases represented by logic programs that attempts to eliminate the drawbacks of the previous approaches

Dynamic Program Updates

How to update a logic program with another:A B1 , … , Bm , not C1, … , not Cn

not A B1 , … , Bm , not C1, … , not Cn

Program Update

Definition: Let P and U be generalized logic programs in the language L. By the update of P by U we mean the generalized logic program P U, consisting of the clauses:

(RP) Rewritten original program clauses:

AP B1 , … , Bm , C’1, … , C’n

A´P B1 , … , Bm , C’1, … , C’n

(RU) Rewritten updating program clauses:

AU B1 , … , Bm , C’1, … , C’n

A´U B1 , … , Bm , C’1, … , C’n

Translation into LP

(UR) Update rules:

A AU and not A A´U

(IR) Inheritance rules:

A AP , not A´U and A´ A´P , not AU

(DR) Default rules:

A´ not AP , not AU and not A A´

Example

Example:P : sleep not tv_on

watch_tv tv_on

tv_on U : not tv_on power_failure

power_failure

P U = (RP) (RU) (UR) (IR) (DR)

RP : sleepP tv_on´ RU : tv_on´U power_failure

watch_tvP tv_on power_failureU tv_onP

M = {power_failure, sleep} is the only stable model of P U

Semantic characterization

Definition: Let M be a model of the program U in the language L.

Def [M] = {not A : M |= Body, (A Body) P U}

Rej [M] =

{A Body P : (not A Body’) U and M |= Body’}

{not A Body P : (A Body’) U and M |= Body’}

Res [M] = P U – Rej [M].

Equivalence to LP translation

Theorem:

An interpretation N is a stable model of the update program P U iff N is an extension of a model M of U such that:

M = Least(Res [M] Def [M]) Conclusion:

If N is a stable model of P U then its restriction M to the language L is a stable model of Res [M].

Properties

Proposition:

If M is a stable model of the union P U of programs P and U , then its extension N is a stable model of the update program P U.Thus, the semantics of the program P U is always weaker than or equal to the semantics of P U.

If either P or U is empty, or if both P and U are normal programs, then semantics of P U and P U coincide.

Relation to interpretation updates

Theorem: Program updates generalize interpretation updates

Let I be any interpretation and U any updating

program in the language L.

An interpretation J is an update of I by U (in the

sense of W.Marek and M.Truszczynski) iff J is a stable

model of the program update PI U, where

PI = { A : A I } { not A : not A I }

Dynamic Program Updates

Definition:Let P = { Ps : s S } be a finite or infinite sequence

of generalized logic programs. The dynamic program update over the sequence of programs P and at the state s S is a logic program s P consisting of:

(RP) Rewritten program clauses:

APs B1 , … , Bm , C’1, … , C’n

A´Ps B1 , … , Bm , C’1, … , C’n

(UR) Update rules:

As Aps and A´s A´Ps

Translation into LPs

(IR) Inheritance rules:

As As-1 , not A´Ps and A´s A´s-1 , not APs

(DR) Default rules:

A´0

(CS) Current state rules:

A As and not A A´s

Dynamic LP example

Example: P = { P1, P2, P3}

P1 : sleep not tv_on

watch_tv tv_on

tv_on

P2 : not tv_on power_failure

power_failure

P3 : not power_failure

M1 = {tv_on, watch_tv} is the unique stable model of program 1 P

Dynamic LP example (2)

M2 = {sleep, power_failure} is the unique stable model of the program 2P.

M3 = {tv_on, watch_tv} is the unique stable model of the program 3P.

Program 2P is semantically equivalent to

P1 P2.

Dynamic LP example (3)

Example: P = { P1, P2, P3, P4}

P1 : not fly(X) animal(X) P4 : animal(X) bird(X)

P2 : fly(X) bird(X) bird(X) penguin(X)

P3 : not fly(X) penguin(X) animal(pluto)

bird(duffy)

penguin(tweety)

Program 4 P has a unique stable model in which

fly(duffy) is true and both fly(pluto) and fly(tweety) are false.

Properties

Theorem: Let P1 and P2 be arbitrary generalized logic programs and let S = {1,2}. The dynamic program update 2{P1, P2} at state s=2 is semantically equivalent to the program update P1 P2.

Dynamic program updates describe the evolution of a logic program which undergoes a sequence of modifications.

This opens up the possibility of incremental design and evolution of logic programs, leading to the paradigm of dynamic logic programming.

Current and future work

Explore applicability of dynamic logic programming for:

Representing the evolution of software specifications Reasoning about concurrent actions and

active and temporal databases.

Preference based approaches to knowledge representation.

Current and future work

Implementation available at:http://www-ssdi.di.fct.unl.pt/~jja/updates/

Generalizations to: 3-valued case (W.F. Semantics) Active rules:

( A B ) Cwhenever C, add A B to the update

program Mixing revision and updatesIn some cases an update may require

revision of previous knowledgeE.g. when an observation changes its value.

Current and Future Work (2)

The current implementation already has: 3-valued semantics querying states other than the last one background rules

Implementational issues: garbage collection re-use of results from previous stages

Equivalent 2-valued semantics

Definition:

Let P- be the normal program obtained from the generalized P by replacing every negative head not A by the new atom A-.

Let I- be such that I-=P-(I) and for no A, {A,A-} I-.

Then the interpretation I, obtained from I- by removing all the new atoms, is a stable model of P.

Generalization to 3-values

The same technique doesn’t work in this casea not b b not a not a

With that technique the WFM would be {not a}One has to guarantee that, when A- holds,

default not A must also hold In the alternating fixpoint definition of WFS,

this is achieved by, while calculating non-false atoms, removing all rules for A when A- holds.

3-valued semantics

Definition:The semi-normal version Ps

- of program P- is obtained by adding not A- (resp. not A) to the body of every rule with head A (resp. A-).

Definition:Let I be such that: I = P-(Ps-(I)) and I Ps-(I).

Let M = T U not F, where T is obtained from I by removing atoms of the form A-, and F is the set of atoms A not in Ps-(I).

Then M is a Partial Stable Model of P.The knowledge-least M is the Well Founded Model of P

Application Domains

A program has knowledge true at a state.Different states may represent: different time points - reasoning about time different priorities - preferences different viewpoints - combining knowledge

Maintenance of software specifications LP for software specification Dynamic LP for representing evolution of

software specification

LUPS update language - Syntax

The language L in which our object-level knowledge is expressed is called the object language. Its formulae are generalized logic program rules of the form:

A B1 Bknot C1 not Cm

not A B1 Bknot C1 not Cm

where A’s and B’s are objective atomic formulae.

Queries also have the form of logic program queries:

holds {B1 Bk not C1 not Cm } ?

Knowledge states

Knowledge states KS represent dynamically evolving states

of our knowledge. They undergo change due to update

actions.

In the initial, default knowledge state KS0 all predicates are

false by default, i.e., KS0 semantically implies not A, for all

objective A’s.

Knowledge state updating

Given the current knowledge state KS, its successor knowledge state KS[U] is produced as a result of the occurrence of a non-empty set U of parallel updates. Each of the updates can be viewed as a (parallel) action. Thus consecutive knowledge states are obtained as:

KSn = KS0[U1][U2]...[Un],

where Un represents consecutive sets of updates. We denote this state by:

KSn =U0 U1 ... Un .

using the meta-language extending the object language L.

Knowledge state updating An update (defined precisely below) is either an assertion or a

retraction of some formula (clause)

A B1Bk not C1 not Cm

not A B1 Bk not C1 not Cm .

An update action may be subject to some preconditions being true in the current knowledge state KSn = U0 U1 ... Un.

Update actions do NOT modify the current or any of the previous knowledge states. They only affect future states, beginning with the successor state KS[U].

It is assumed we always know what the current state is.

Queries

Our goal has been to provide both declarative as well as procedural semantics for dynamic updates, allowing us to answer both declaratively and procedurally any query about either the current or any of the ancestor knowledge states.

Queries involving a knowledge state KS -- either the current one KSn = U0 U1 ... Un or one of the ancestor states KSm = U0 U1 ... Um, where m<n -- are of the form:

holds {B1 Bk not C1 not Cm } at KS ?

If the query involves the current state we skip the state reference and ask: holds {B1 Bk not C1 not Cm } ?

Update actionsThey cause changes to the current knowledge state, leading to a successor state. They are called assertions, with form:

assert{A B1Bk notC1notCm}

when {D1Dn notE1notEp}

assert{notA B1Bk notC1notCm}

when {D1Dn notE1notEp}

The meaning of the assert rule is that if the precondition

when {D1 Dn notE1 notEp}

is true in the current knowledge state then the rule

A B1Bk notC1notCm

is true in the next state, and persists from then on byinertia, until defeated by some future update or retracted.

Update actions

A B1Bk notC1 notCm

can be preceded with the keyword “event”, indicating that the added rule is non-inertial, i.e. a one-time event that is not assumed to hold true by inertia after the successor state, viz.:

assert event {A B1Bk} when {C1Cm}.

When the set of preconditions is empty then we just skip the whole keyword: when {...}

assert [event] {A B1Bk}

Persistent update actions While many updates represent newly incoming information such as:

assert {republican-congress}

and thus are one-time, non-persistent actions, many of them are likely to be persistent, i.e., to remain in force till cancelled. For example, an update like:

assert {wake-up} when {alarm-sounds}or

assert {jail <- abortion} when {rep_congress & rep_president}

may be always true, or at least true until cancelled. Such updates allow our system to dynamically change without any truly new updates being received.

Persistent update actions

For example, the update:

assert {set_hands(time)}

when {get_hands(htime) & get_time(time) & (time - htime)>}

defines a perpetually operating clock whose hands move to the correct time position whenever the difference between their actual position and the current time is sufficiently large.

Persistent updates

In order to be able to specify such persistent updates (laws) we introduce the syntax:

always [event] {A B1 Bk} when {C1Cm}

coupled with:

cancel {A B1 Bk} when {C1Cm}

The first statement means that, in addition to any newly arriving updates, we are supposed to also keep firing this persistent update. The second one cancels this persistent update.It cancels both inertial and non-inertial updates.

Persistent updates

For example we may have:

always {set_hands(time)}

when {get_hands(htime)& get_time(time) &

(time-htime)>}.

followed by, if the clock gets broken:

cancel {set_hands(time)}

when {get_hands(htime)& get_time(time) &

(time-htime)>}.

Persistent updates

The existence of persistent actions requires that we also need a “trivial” update action NO_UP (no update), which does not define any truly new updates but simply signifies the click of the clock and thus triggers all the already defined persistent updates to fire thus resulting in a modified knowledge state.

Such “no-operation” update is needed to ensure that the system continues to evolve even when no truly new updates are specified.

Such a trivial update may be represented by:

assert {true}.

Persistent updates

Consequently, the set U of updates is effectively a union of two sets UN and UP.

UN represents a non-empty set of new updates (possibly just a NO_UP), while UP represents the set of all currently active persistent updates, i.e. those persistent updates that were not cancelled until now, from the time they were asserted:

U = UN + UP, where UN <> 0.

Non-empty UN triggers the update transformation and leads to a successor knowledge state.

Retraction Actions

For syntactic sugar, we also add a retraction statement:

retract [event] {A B1 Bk} when {D1 Dn}

Its semantic meaning is that, subject to the precondition D1 Dn, the update of A B1 Bk is either retracted from now on,

or just retracted temporarily in the next state (a non-inertial retract).

Retraction Actions

Its procedural meaning is that anytime an update:

assert {A B1 Bk} when {C1 Cn}

occurs, it is augmented with an additional premise:

not retract{A B1 Bk},

so that what is actually asserted is:

assert {A B1 Bk not retract{A B1 Bk}} when {C1 Cn}

and its addition is coupled with the update:

assert {not retract{A B1 Bk}}.

Retraction Actions

The statement

retract [event] {A B1 Bk} when {D1 Dn}

is then equivalent to the assertion:

assert [event] {retract{A B1 Bk} } when {D1 Dn}.

Having such retractions is not just convenient, but demonstrates we are providing a rigorous declarative and procedural semantics to assert/retract operations.

Retraction Actions Canceling an update is not equivalent to retracting an

update. Canceling simply means it will no longer be added to UP but it does not cancel the effect of its previous application(s).

However, retracting an update causes any of its persistent updates to be cancelled as well. Otherwise, a contradiction would result.

Also, note that “retract event ...” does not mean retracting of an event, because events persist only for one time and thus do not require retraction. It represents a temporary removal of an update from the successor state (i.e. a temporary retraction event).

Implementation of LUPS

A translation into Dynamic Logic Programming has been defined

With this, a translation into Extended Logic Programming is obtained

Both the translation and an interpreter for LUPS have been implemented.

The implementation is available at:http://centria.di.fct.unl.pt/~jja/lups.p

An Update Scenario

1. Once Republicans take over both Congress and the Presidency they establish the law stating that abortions are punishable by jail.

2. Once Democrats take over both Congress and the Presidency they abolish such a law.

3. In the meantime, there are no changes in the law because always either the president or the congress vetoes such changes.

4. Performing an abortion is an event, i.e., a non-inertial update.

An Update Scenario - update history

(1) A democratic congress and republican president (Reagan)

(2) Event: Mary performs abortion.

(3) Republican Congress is elected.

Republican President remains in office: Bush.

(4) Event: Kate performs abortion.

(5) Clinton is elected president.

(6) Event: Ann performs abortion.

(7) Gore is elected president and Democratic Congress is in

place (year 2000?)

(8) Event: Susan performs abortion.

An Update Scenario - specification Specification in the language of dynamic updates (LUPS):

(a) Persistent update rules:

always {Jail(X) Abn(X)} when {(RepC & RepP)} always {not Jail(X) Abn(X)} when {notRepC & notRepP}

Alternatively, instead of the second clause we can use a retract statement:

retract {Jail(X) Abn(X)} when {notRepC & notRepP}.

They state that we are always supposed to update the current state with the rule Jail(X) <- Abn(X) provided RepC and RepP holds true and that we are supposed to assert the opposite or just retract this rule provided notRepC and notRepP holds true.

An Update Scenario - specification Sequence of non-persistent update actions:

1. assert {RepP}. assert {not RepC}. % can be skipped; true by default

2. assert event{Abn(Mary)}. assert {RepC}.

4. assert event{Abn(Kate)}. assert {not RepP}. % or, retract {RepP}

6. assert event{Abn(Ann)}.7. assert {not RepC}. % or, retract {RepC}8. assert event{Abn(Susan)}.

In the meantime we could have a lot of NO_UP update events, representing clicks of the clock or any other irrelevant updates.

Declarative and Procedural Semantics - meta-language

We define the declarative and procedural semantics by describing a translation of the statements of LUPS into a GLP written in the meta-language. Using a specific declarative semantics with such GLP programs, leads to the precise declarative semantics for our dynamic updates.

The translation uses the meta-language employing the following symbols:

A(s), A(s,t), -A(s,t), A*(s,t), -A*(s,t).

These symbols are to be defined for any propositional symbol A in the objective language L.

Declarative and Procedural Semantics - meta-language

In addition, they should be available for the special propositional symbols:

retract{A B1 Bk} and cancel{A B1 Bk}

that are not used in the objective language and are defined for all generalized LP clauses A B1Bk in the objective language.

They therefore represent clause labels and are used for retraction and cancellation of updates.

As usual, we assume that all of the above symbols are mutually distinct.

Declarative and Procedural Semantics - the GLP translation

The Generalized Logic Program U0

Describing the Default Knowledge State KR0

The program consists of the following clauses:

Inertia rules (for any s>=0 and t>=s):

A(s,t) A* (s, t)

-A(s,t) -A* (s, t)

A(s,t) A (s-1, t) , not -A* (s, t)

-A(s,t) -A (s-1, t) , not A* (s, t)

Declarative and Procedural Semantics - the GLP translation

Current state rules (for any s):

A(s) A(s,s)

not A(s) -A(s,s) .

Note: we are assuming that all states are consistent.

Default knowledge state rules:

-A(0,t), for all A’s and t>=0.

Declarative and Procedural Semantics - the GLP translation

The dynamic update program U0 U1 ... Us Us+1

describing the successor knowledge state KRs+1 :

The update program U0 U1 ... Us Us+1 is obtained from the program U0 U1 ... Us describing KRs by augmenting it with the following additional rules, corresponding to each of the newly received update actions.

Declarative and Procedural Semantics - assert rules

A. Translation of assert rules:

assert {A B1Bk} when {C1Cm}

is translated into two GLP clauses in the meta-language:

(1) A*(s+1,t) B1(t,t),...,Bk(t,t), -retract{A B1 Bk}(t,t), C1(s,s),..., Cm(s,s).

The update A B1Bk is added at s+1 provided the condition C1Cm is true at s. It will remain in force by inertia for all t >= s+1 unless the predicate retract{A B1

Bk}(t,t) becomes true.

(2) -retract*{A B1 Bk}(s+1,t) C1(s,s),..., Cm(s,s).

Beginning with s+1 the predicate -retract{A B1 Bk}(t,t) is true and will remain true by inertia for all t >= s+1.

Declarative and Procedural Semantics - retract rules

B. Translation of retract rules:

retract {A B1Bk} when {C1Cm}

into the two GLP clauses in the meta-language:

(1) retract*{A B1 Bk}(s+1,t) C1(s,s),…,Cm(s,s).

The update A B1Bk is retracted at state s+1 provided the condition C1Cm is true at the state s. It will remain retracted by inertia for all t >= s+1.

(2) cancel*{A B1 Bk}(s+1,t) C1(s,s),…, Cm(s,s).

Retractions also cancel persistent update rules (i.e., retractions take precedence over persistence).

Declarative and Procedural Semantics - persistent rules

C. Translation of persistent assert rules:always {A B1Bk} when {C1Cm}

is translated into three GLP clauses in the meta-language:(1) -cancel*

{A B1 Bk}(s+1,v).

the update rule persists from for all v >= s+1 by inertia.(2) A*(q+1,t)B1(t,t),…,Bk(t,t),-retract{A B1 Bk}(t,t),

-cancel{A B1 Bk}(q+1,q+1),C1(q,q),…,Cm(q,q).

Rule AB1Bk is added for any q+1>=s+1 if it persists at q+1 and C1Cm

is satisfied at q. It remains true by inertia for t>=q+1.(3)-retract*

{A B1 Bk}(q+1,t) -cancel{A B1 Bk}(q+1,q+1), C1(q,q),…,Cm(q,q).

If these conditions are met at q+1>=s+1 they also cause-retract{A B1 Bk}(t,t) to become true by inertia for t>=q+1.

Declarative and Procedural Semantics - cancellation rules

D. Translation of cancellation rules:

cancel {A B1Bk} when {C1Cm}

is translated into a GLP clause in the meta-language:

cancel*{A B1 Bk}(s+1,t) C1(s,s),…, Cm(s,s).

The persistent update rule is cancelled at the state s+1 and will remain cancelled by inertia for all t >= s+1.

Declarative and Procedural Semantics - event rules

E. Translation of (non-retractable) assert event rules:

assert event {A B1Bk} when {C1Cm}

is translated into a GLP clause in the meta-language:(1) A*(s+1,s+1) B1(s+1, s+1),…,Bk(s+1, s+1),

C1(s, s),…, Cm(s, s).

F. Translation of retract event rules:retract event {A B1Bk} when {C1Cm}

is translated into two GLP clauses in the meta-language:

(1) retract*{A B1 Bk}(s+1,s+1) C1(s,s),…,Cm(s,s).

(2) cancel*{A B1 Bk}(s+1,s+1) C1(s,s),…,Cm(s,s).

Declarative and Procedural Semantics - persistent event rules

G. Translation of persistent assert event rules:

always event {A B1Bk} when {C1Cm}

is translated into two GLP clauses in the meta-language:

(1) -cancel*{A B1 Bk}(s+1,v).

The update rule from now on for all v >= s+1 by inertia.

(2) A*(q+1,q+1)B1(q+1,q+1),…,Bk(q+1,q+1),

-cancel{A B1 Bk}(q+1,q+1), C1(q,q),…,Cm(q,q).

An event update A B1Bk is added at any q+1>=s+1 if the rule remains persistent at q+1 and condition C1Cm is satisfied at q. It will not remain true by inertia.

LUPS examples

Now we present a variety of examples of application of LUPS to the representation of updates, and of actions as updates. Indeed, actions can be described by persistent updates (laws) which relate the state where the actions happened with the successor state where the consequences hold.

In the examples we assume all persistent commands not explicitily linked to a knowledge state to belong to U1.

Whenever a knowledge state Ui is referred, which was not previously defined, it is assumed equal to assert(true).

LUPS examples - Twice fined

A car-driver looses his licence after a second fine. He can regain the licence if he undergoes a refresher course at the drivers school. To represent this problem it is necessary to introduce a new predicate, probation, which holds after the first fine takes place. The fine action is represented by two persistent update commands:

always {probation} when {fined}.

always {not licence} when {fined,probation}.

The first means probation is true after a fine, and the second that the driver looses his licence after a fine, if on probation.

LUPS examples - Twice fined The attend_school action is represented by the two persistent update commands:

always {licence} when {attend_school}.

always {not probation} when {attend_school}.

meaning that after attending school the driver has a licence and he is not in a probation state.

Imagine the sequence of non-persistent update commands: U1 : assert event {attend_school}U2 : assert event {fine}U3 : assert event {fine}U4 : assert event {attend_school}

As intended, licence holds in states 2,3,5 and not licence in state 4 (after two fines).

LUPS examples - Timers

Timers are started by action on_for(N), meaning the timer will be on for the next N states. This notion is captured by the three persistent rules:

always event {on_for(M)} when {on_for(N), N>0, minus(N,1,M)}

the timer is on for M states if it was on for N=M+1 states in the previous one. Timers are on if they are on_for(N), where N>0 :

always {on <- on_for(N),N>0}

and switched off when N=0, i.e.: always {not on <- on_for(0)}

Consider the sequence of updates: U1 : assert event {on_for(2)}

As intended, on holds in state 1, 2 and not on holds in state 3.

LUPS examples - Suitcase

The suitcase has two latches, opens whenever both are up, and there is an action of toggling applicable to each latch. This is represented by three persistent commands:

always {open <- up(l1), up(l2)}

always {up(L)} when {not up(L), toggle(L)}

always {not up(L)} when {up(L), toggle(L)}

Initially l1 is down, l2 is up, and the suitcase is closed:

U1= { assert{not up(l1)}, assert{up(l2)}, assert{not open} }

LUPS examples - Suitcase

Suppose there are now two simultaneous toggling actions:

U2 = { assert event {toggle(l1)}, assert event {toggle(l2)} }

and afterwards there is yet another l2 toggling action:

U3 = { assert event {toggle(l2)} }

In knowledge state 3 we'll have up(l1), not up(l2) and the

suitcase is not open.

Only after 3 will latch l2 be up and the suitcase open.

LUPS examples - Contradictory advice --- 3-valued updating

An agent receives advice from two sources, father and mother. The agent's expected behaviour is to perform an action, unless contradicted by other advice. These persistent update commands model the desired behaviour:

always {do(A) <- father_advises(A), not dont(A)}always {dont(A) <- mother_advises(no A), not do(A)}

Suppose father advises buying stocks, but mother not to: U1= { assert event {father_advises(buy)},

assert event {mother_advises(no buy)} }

In this situation, do(buy) and do(no buy) become undefined, and the agent does not perform any action.

LUPS examples - Conscientious objector --- a rule update example

A person is conscripted if he is draftable and healthy. He is draftable when he reaches a certain age. Then the law changes: he is not conscripted if a conscientious objector.U1 : always {draftable(X)} when {of_age(X)}

assert { conscripted(X) <- draftable(X), healthy(X) }

U2 : assert {healthy(a)}. assert {conscientious_objector(a)}.

assert {healthy(b)}. assert {conscientious_objector(b)}.

assert {of_age(b)}.

U4 : assert { not conscripted(X)<- draftable(X),conscientious_objector(X) }.

U5 : assert {of_age(a)}.

In state 3, b is conscripted, but after U4 his situation changes and not conscripted takes hold. But a is never conscripted.

Bibliography (1)

Most of the work covered by this course is detailed in: [AP96] J.J. Alferes and L.M. Pereira. Reasoning with Logic

Programming. Springer LNAI 1111, 1996

See references there for the original definitions For more on semantics of normal LPs see:

[PP90] H. Przymusinska and T. Przymusinski. Semantic issues in deductive databases and logic programs. In R. Banerji ed, Formal Techniques in AI, a Sourcebook. North Holland, 1990

For more on derivation procedures: [AB94] K. Apt and R. Bol. Logic Programming and Negation: A

survey. In Journal of L.P., 1994

Bibliography (2)

For more on LP for KRR: [BG94] C. Baral and M. Gelfond. Logic Programming and

Knowledge Representation. In Journal of L.P., 1994

For relation with NMR e structural properties: [BDK97] G. Brewka, J. Dix and K. Konolige.

Nonmonotonic Reasoning: an overview. CSLI Publications, 1997

More on our LP belief revision approach in: [ADP95] J. J. Alferes and C. V. Damásio and L. M. Pereira,

A Logic Programming System for Non-monotonic Reasoning, Journal of Automated Reasoning (14), 1995

Bibliography (3)

For more on LP update: [MT96] V. Marek and M. Truszczynski. Revision

specifications by means of programs. In JELIA’94, Springer LNAI 838, 1994

[ALPPP98] J.J. Alferes, J. Leite, L.M. Pereira, H. Przymusinska and T. Przymusinski. Dynamic Logic Programming. In KR’98, Morgan Kaufmann, 1998

Another good entry point for these questions is: [DPP97] J. Dix, L.M. Pereira, T. Przymusinski. Prolegomena

to Logic Programming and Non-Monotonic Reasoning. In Non-Monotonic Extensions of Logic Programming. Springer LNAI 1216, 1997