assertion answer set logic program and its application

32
Assertion Answer Set Logic Program and its Application Mingyi Zhang Guizhou Academy of Science 2012-6-18

Upload: kaloni

Post on 11-Jan-2016

33 views

Category:

Documents


3 download

DESCRIPTION

Assertion Answer Set Logic Program and its Application. Mingyi Zhang Guizhou Academy of Science 2012-6-18. Motivation. Motivation. (1) Lack of intuition Noncumulativity (Brewka,1991; Giorddano and Martelli,1994) Cause : Inconsistency between justification of defaults - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Assertion Answer Set Logic Program and its Application

Assertion Answer Set Logic Program and its Application

Mingyi Zhang

Guizhou Academy of Science

2012-6-18

Page 2: Assertion Answer Set Logic Program and its Application

Motivation

(1) Lack of intuition Noncumulativity• (Brewka,1991; Giorddano and Martelli,1994) Cause : Inconsistency between justification of defaults ( does not commit to assumptions)

Example 1 Broken-arm (Pool, 1988) :Useable(x)¬Broken(x)/Useable(x) (1) Broken(Leftarm)Broken(Rithtarm)

E=Th(Broken({Leftarm)Broken(Rithtarm), Useable(Leftarm), Useable(Leftarm)})

Motivation

Page 3: Assertion Answer Set Logic Program and its Application

Motivation

Adding the information x.BROKEN(x) USABLE(x) , (3)will generate two extensions as desired. This is a type of "hard" exceptions to a default, i.e. exceptions for which the negation of the default's consequent can be proven. In this case (1) can be replaced by :Useable(x)/Useable(x)

But we hope to consider a weaker type of exception to a default: we want to block a default but we don't assert the negation of its consequent. Nonnormal defaults are needed precisely to express this weaker type of exceptions.

Page 4: Assertion Answer Set Logic Program and its Application

Motivation

Example 2 (Brewka, 1991) DOG BIRD PET DOG¬BIRD PET:DOG/DOG SINGS:BIRD/BIRD S1NGS . E=Th(W{BIRD)}) which contains PET Adding PET to the DT, we get another extension which contains DOG.

Page 5: Assertion Answer Set Logic Program and its Application

Motivation

(2) Destroy part of the additional expressiveness of nonnormal defaults CDL is cumulative and commits to assumptions. However, CDL is in the style of Lukaszewicz's default logic. It happens to be semimonotonic, which destroys part of the additional expressiveness of nonnormal defaults, for instance, it makes it impossible to represent priorities among defaults.

Page 6: Assertion Answer Set Logic Program and its Application

Motivation

Example 3 (Giorddano and Martelli,1994) student :¬ married/¬married (1) adult : married/married (2) living-in-college : student/student (3) beard : adult’adult (4) living-in-college beard

We want default (1) to have a higher priority than default (2). To achieve this purpose, default (2) can be replaced with the seminormal default:adult : married¬student/) married (2’)

Page 7: Assertion Answer Set Logic Program and its Application

Motivation

The resulting theory has a single DL extension, Th({living-in-college, beard, student, adult, ¬married}), as wanted, since applying default (3) blocks (2'). This same theory, however, has two CDL extensions:

F 1 containing (adult : (adult}), (married : (adult, married¬student} ) and:F 2 containing (student: {student}), (adult : {adult}), (¬married :{student,¬married}),

since in CDL (3) blocks (2'), but (2') blocks (3) in turn. Hence, in CDL, using seminormal defaults does not allow to enforce priorities among default rules (1) and (2), as in Reiter's default logic.

Page 8: Assertion Answer Set Logic Program and its Application

Motivation

To do this, Giorddano and Martelli introduced CADL (Commitment to Assumption Default Logic) and QDL(Quasi-Default Logic). Guaranteeing cumulativity of QDL, they imposed a condition on definition of QDL extension. Zhang (1999) gave the definition similar to Reiter’s one, algorithms for reasoning task for CADL and QDL, and a sufficient and necessary condition for cumulitiviy of QDL. (2010)

Page 9: Assertion Answer Set Logic Program and its Application

Motivation

(3) Keep trace of an inference supporting a conclusion Abduction AB, B --------------- A I. Proof in Geometry II. Diagnosis based on consistency (Reiter 1980)

Page 10: Assertion Answer Set Logic Program and its Application

Motivation

A system is a pair (SD, COMPS), where SD, the system description: a set of first-order sentences COMPS, the system components: a finite set of constants. An observation of a system is a finite set of first-order sentences

(SD, COMPS, OBS) ---- a system (SD, COMPS) with observation OBS.A diagnosis for (SD, COMPS, OBS) is a minimal set COMPS such that SD OBS {AB(c) c } {AB(c) c COMPS} is consistent.

Page 11: Assertion Answer Set Logic Program and its Application

Motivation

Proposition 1 (Zhang mingyi et al, 2004) Let (SD,Comps) be a system and OBS an observation. Given COMPS), if SDOBS{AB(c) cCOPMPS-} is consist, and for any ci , is a diagnosis for any ci, SD OBS {AB(c)c COMPS} AB(c╞ i), then is a diagnosis for (SD, COMPS, OBS).

Proposition 2 (Reiter, 1987) ---- Relation between Diagnosis and premise-free normal DL Consider a system (SD, COMPONENTS) under observation OBS, where so and OBS are sets of first-order sentences. Then E is an extension for the default theor yDT =( {:¬ AB(c)/ AB(c) c COMPS}, SD OBS) iff for some diagnosis for (SD, COMPONENTS, OBS), E = { predicts II}.

Page 12: Assertion Answer Set Logic Program and its Application

Assertion ASP

(1) ASP--– a special case of DL Assertion ASP---a special case of QDL in Reiter’s sense

Definition 1 An assertion is an expression of the form <L:S>, where L and S are a literal and a set of literals respectively. For any set of assertions W, we denote: Form(W)={L| <L:S> }, the set of literals of W. Supp(W)= , the support of W.In particular, Form(A)={L} and Supp(A)=S are the literal and support of A, for an assertion A=<L:S>.

Assertion ASP

Page 13: Assertion Answer Set Logic Program and its Application

Definition 2 A rule is an expression of the form L0←L1,L2, ...,Lm, not Lm+1, …, not Ln(m+n>0), where L0, Li (1≤i≤n) are literals respectively. For a set of rules R, we use the following notations:Head(R)={L0|L0←L1,L2, ...,Lm, not Lm+1, …, not LnR(m+n>0)}Pos(R)= {Li|L0←L1,L2, ...,Lm, not Lm+1, …, not LnR,1≤i≤m,(m+n>0)}Neg(R)= {Li|L0←L1,L2, ...,Lm, not Lm+1, …, not LnR,m+1≤i≤n,(m+n>0)}Write a rule as HedPos, not Neg. A rule r is basic if Neg(r)=∅ .

Definition 3 Π=W R is an assertion answer set program (AASP) ∪if W is a set of assertions and R is a set of rules. Π=W R is basic if ∪R is a set of basic rules. Π is finite iff W and R both are finite.

Assertion ASP

Page 14: Assertion Answer Set Logic Program and its Application

Definition 4 Let Π=W R be an AALP. A set of assertions E is an ∪answer set of if E=∪0≤iEi , Where E0=W if Form(W) is consistent, otherwise {<Lit:>}, Ei+1=Ei∪Fi if Form( ) is consistent, otherwise {<Lit:>}.where Fi={<L0:∪1≤j≤mSj>|L0←L1, L2, …, Lm∈R and <Li:Sj>∈Ei for 1≤ j≤m}.

Definition 5 Let =WR be an AASP and F a set of assertions . The F-reduct F is an AASP obtained by removing each rR if Neg(r) Form(F) .

Assertion ASP

Page 15: Assertion Answer Set Logic Program and its Application

Definition 6 Let E is an answer set of Π=W R . The set of ∪generating rules for E, GD(E,Π), is the set {L0←L1,L2, ...,Lm, not Lm+1, …, not Ln∈R,(m+n>0)|for i:1≤i ≤ m,<Li:Si>∈E and for j:m+1≤j≤n,Lj∉Form(E)}.

Definition 7 Let =W R be an AASP. For any R∪ ,. we define an operator : (R,)=∪n0 n(R,), as follows: { Head Pos, not Neg R Form(W) {Head} is consistent}, ∪ 0(R,)= {<Lit:>}, otherwise {HeadPos, not NegR Pos Form(W) Head(∪ n(R,) ) and Pos Form(W) Head(∪ n(R,)) is consistent T

n+1(R,)= {<L: >LLit} otherwise

Assertion ASP

Page 16: Assertion Answer Set Logic Program and its Application

Definition 8 Let =WR be an AASP. RR is compatible (w.r.t. ), if , for any LNeg(R), LForm(W)Head(R). R’ is strongly compatible if R’ is compatible and (R , )=R. R’ is -robust (or just robust, if A is understood), if R’ is strongly compatible and, for any R R, if R is strongly compatible, then R=R.

Corollary 1 has an inconsistent answer set iff Form(W)Head((R*,)) is inconsistent, where R*={rRNeg(r)=.

Corollary 2 E={<Lit,>} is an answer set of iff Form(W)Head((R*,)) is inconsistent.

Corollary 3 Suppose E is an answer set of . Then Form(E) =Form(W)Head(GR(E,)) , Supp(E)=Supp(W)Neg(GR(E, ))

Assertion ASP

Page 17: Assertion Answer Set Logic Program and its Application

Theorem 1. (Characterization of assertional answer sets) Let =WR be an AASP. has an answer set iff there is a strongly compatible subset R of R such that, for any rRR, Pos(r)

Form(W)⊈ Head(R) or (Form(W)Head()) Neg(r) .

Corollary 4 If R is compatible then =W∪R has a unique answer set.

Assertion ASP

Page 18: Assertion Answer Set Logic Program and its Application

Based on the characterization we can give an algorithm for computing answer sets and its complexity. Now we deal with the following problem, which we call the membership problem: Given an AASP , a robust set ' and an assertion <p:S>, determine whether <p:S> is an element of the answer set generated by '.The main reasoning tasks in AASP are skeptical reasoning (SR) and credulous reasoning.• SR: Decide whether a given assertion <p :S> occurs in all assertional answer sets of .• CR: Decide whether a given assertion <p:S> occurs in some assertional answer set of . We derive some formal results that will allow us to deal properly with supports and to solve the membership problem.

Assertion ASP

Page 19: Assertion Answer Set Logic Program and its Application

Definition 6 Let S be a support, an AASP, and F a set of assertions. Then [S] = {r Neg(r)S}, F[S] = {<L:V>F VS}

Lemma 1 Let be an AASP. If R is compatible, then it has a unique answer set E and GD(E, ) = (R,).

Lemma 2 Let E be an answer set of a finite AASP and < L:S> an assertion in E. Then the assertion <L:Supp(E)> is also an element of E. From the definition of AASP extension, one may be tempted to think that reasoning in AASP requires exponential space, due to the combinatorial explosion of the supports in the intermediately generated assertions. However, in this paper we show that AASP has the same complexity as ASP.

Assertion ASP

Page 20: Assertion Answer Set Logic Program and its Application

Theorem 2 Let be a finite AASP, ' a -robust set of rules, and <L:S> an assertion . Let S='[S]. Then <L:S> is an element of the answer set E' of generated by ' iff the following two conditions (1) and (2) are satisfied:(1) LHead(('[S],S));(2) Neg(('[S],S)) = S.

Theorem 3 Let be a finite AASP and let <p:S> be an assertion and S. (1) If Head((B)) is inconsistent, then <p:S> is not an element of any assertional answer set of ..(2) If Head((B)) is consistent, the AASP S has a unique answer set E with set of generating rules GD(E) =(S). The assertion <p:S> is an element of some extension of iff <p:S>E.

Assertion ASP

Page 21: Assertion Answer Set Logic Program and its Application

Lemma 3. Let be a finite AASP and <p:S> an assertion such that Head((B)) is consistent. Then, <p:S> belongs to some answer set of iff for every , (S)S , it holds that(1) <p:S>Head(), and(2) Neg() = R, where S='[S].

Theorem 4. In propositional AASP the reasoning tasks SR is NP-omplete, while the reasoning task CR is DP-complete.

Theorem 5 AASP is cumulative.

Assertion ASP

Page 22: Assertion Answer Set Logic Program and its Application

Splitting (Wu Maonian and Zhang Mingyi) Based on the Finest Splitting of Belief Set and the characterization of AASP answer sets we explored a method, which constructs a reduce without guessing a set of assertions.

Assertion ASP

Page 23: Assertion Answer Set Logic Program and its Application

Applications

(1) Alias analysis (Yang Bo and Zhang Ming) Find a well tradeoff between precision and computation cost of alias analysis for some programming languages. Alias in Java program is one of the main causes for program errors. Applying AASP can determine the propagation path of points-to information more accurately, and hence improve the precision of points-to analysis.

Application

Page 24: Assertion Answer Set Logic Program and its Application

Application

ASP Rules for Points-to Analysis

ref(x,o,cs,s')←pred(s,s'), ref(x,o,cs,s), not ¬ref(x,o,cs,s') (r1)reff(o,f,o',cs,s')←pred(s,s'), reff(o,f,o',cs,s), not ¬reff(o,f,o',cs,s') (r2)ref(x,os,cs,s)←new(s,os,x), call(m,c,cs,cs'), in(s,c,m), not inbranch(s) (r3)ref(x,os,cs,s)←new(s,os,x), call(m,c,cs,cs'), in(s,c,m), pred(s1,s2), if(s1), branch(s2,s1), inbranch(s), same(s2,s) (r4)¬ref(x,o',cs,s')←pred(s,s'), new(s',o,x), ref(x,o',cs,s) (r5)ref(x,oy,cs,s')←pred(s,s'), ref(y,oy,cs,s), asn(s',x,y) (r6)¬ref(x,ox,cs,s')← pred(s,s'), ref(x,ox,cs,s), asn(s',x,y), not sp(s') (r7)reff(ox,f,oy,cs,s')←pred(s,s'), ref(y,oy,cs,s), ref(x,ox,cs,s), store(s',x,f,y) (r8)¬reff(ox,f,o,cs,s')←pred(s,s'), ref(x,ox,cs,s), reff(ox,f,o,cs,s), store(s',x,f,y), not sp(s') (r9)ref(y,o,cs,s')←pred(s,s'), ref(x,ox,cs,s), reff(ox,f,o,cs,s), load(s',y,x,f) (r10)¬ref(y,oy,cs,s')←pred(s,s'), ref(y,oy,cs,s), load(s',y,x,f), not sp(s') (r11)

Page 25: Assertion Answer Set Logic Program and its Application

Application

sp(s')← pred(s,s'), ref(x,ox,cs,s), ref(y,oy,cs,s), ox=oy , asn(s',x,y) (r12)sp(s')←pred(s,s'), ref(x,ox,cs,s), reff(ox,f,o,cs,s), ref(y,oy,cs,s), o=oy, store(s',x,f,y) (r13)sp(s')←pred(s,s'), ref(y,oy,cs,s), ref(x,ox,cs,s), reff(ox,f,o,cs,s), oy=o, load(s',y,x,f) (r14)1{pred(s,s'):branch(s',s)}1←if(s) (r15)

Page 26: Assertion Answer Set Logic Program and its Application

Applications

Definition 9 Let P is a program and R a set of rules. R is sound w.r.t. a point—to relation of P if, for any statement StP with corresponding node s in a control flowchart such that <σ, σ > ′

PT[St], ∈1) for any reference x occurring in P, if σ x=ox′ , then ref(x,ox,cs,s) Rule(s)∈ ; 2) for any reference-type variable with a form x.f, if σ x=ox and σ ′ ′ox.f=o , then ref(x,ox,cs,s) Rule(s) and reff(ox,f,o,cs,s) Rule(s),∈ ∈

where PT : Stm→(PS↪PS) is a point-to semantic relation, PS is the set of all point-to states and Stm is a set of statements formed by Assignment statement , Skip, Load, Store, Sequential Compound statement, Conditional statement and While statement.

Page 27: Assertion Answer Set Logic Program and its Application

Applications

Theorem 3 The set R of rules is sound w.r.t. inference of points-to relation on a program. For a diagnosis system (SD, COMPONENTS,OBS) , we call =* C∪ ∏ the program corresponding to the diagnosis system, where *={ L0←L1,…, Lm L0L1…Lm CLOBS, m0}R and C∏= {←L1,…, Lm L1…LmCLOBS, m1}.

Definition 10 Given a diagnosis system DIS=(SD, COMPONENTS, OBS) and its corresponding standard program =* C∪ ∏ , a diagnosis for DIS if there is an answer set S of such that COMPONENT ),N(GD(S

Page 28: Assertion Answer Set Logic Program and its Application

Applications

From Theorem 1 we have

Theorem 4 is a diagnosis for DIS= (SD, COMPONENTS, OBS) iff is a minimal subset of COMPONENTS such that

I. ()=, where ={r*H(r)COMPONENTS- } and is a standard program corresponding to DIS,II. CLOBS ) is consistent.

)'(N

Page 29: Assertion Answer Set Logic Program and its Application

Applications

Deal (Chen Wu, Zhang Dongmo and Zhang Mingyi) Definition 11 A bargaining game is a pair ((1, ≿ 1),(2, ≿ 2)), where i (i=1,2) is an AASP and ≿i is a complete transitive and reflexive order (total preorder or weak order) over i that satisfies the following condition: for r, r1,…rn i, If Pos(r) and Pos(r)Head({r1,…rn}) then there is k (1kn) such that rk ≿ir.The pair (i, ≿i i) is called the prioritized demand of player i. For any r, ti, r≻i t denotes that r ≿i t and t≵i r. r≈it denotes r≿i t and t≿i r. Clearly, ≈i is an equivalent relation on i, which uniquely determines a partition of i. We use ≈i to give a hierarchy of i, that is, each equivalent class is viewed a level of the hierarchy.

Page 30: Assertion Answer Set Logic Program and its Application

Applications

Definition 12 The sets of assertions E1 and E2 are co-consistent if both Form(Ei)Form(E-i) and Form(Ei)SuppE-i) are consistent, where –i=3-i.

Definition 13 Given a prioritized demand set (, ) for an agent, ≿its hierarchy {(j)}j1 is defined as follows: 1={rt (r t)}; ≿ 1=1. for k1 k+1={rktk (r t)}; ≿ k+1=k k+1. It is easy to see that 1={ rPos(r)=}. In the sequent, we write k to denote {(j)}1jk..

Page 31: Assertion Answer Set Logic Program and its Application

Applications

Definition 14 Let G=((1, ≿ 1),(2, ≿ 2)) be a bargaining game, where i= WiRi (i=1,2). A deal of G is a pair (D1,D2) satisfying the following conditions: for each i=1,2 1.W1W2 Di. 2.Di =Form(Ei), where Ei is an answer set of i=(Vi,Ti) such that Ti =GD(Ei, i). 3.Vi is a maximal subset of Wi s.t. Vi and E-I is co-consistent. 4.for each k(k=1,2…), Ti Ri

k is a maximal subset of Rik in the following

sense:(1) Vi 1jk {<L:S>Ei LHead(Ti Ri

j ), Neg((Ti Rij))} and E-i are co-

consistent . (2) There is no ri Ri

k- Ti such that I. i

k=(Vi, 1jkTi {ri})) has an answer set F(I,k) with GD(F(I,k), ik)= 1jk (TiRi

k ){ri}. II. Vi 1jk {<L:S>Ei LHead((Ti Ri

j){r}), Neg((Ti Rij){r}))} and E-i are

co- consistent.where {Ri

j}j1 is the hierarchy of Ri. The set of all deals of G is denoted by (G), called the feasible set of the game.

Page 32: Assertion Answer Set Logic Program and its Application

Applications

Definition 15 i, Gi as before (i=1,2). A pair of sets of literals Oi=( Di, Pi) implements gi* Gi, where DiB+(i){ gi }, PiB+(-i){ g-i }, giGi , g-iG-i (B+

represents the positive body of a program)if 1. SiANS(i{l l DiPi} s.t. gi* Si, i=1,2 2.gi* g-i* is consistent, i=1,2 3.For i=1,2, gi* are maximal goals satisfying conditions 1 and 2, i.e. there are no gi’ Gi s.t. conditions 1 and 2 hold for gi’ and s.t. gi’ Si and gi*i gi’. (3) Approach for Handling Conflicts in Authorization (Zhang Mingsheng and Zhang Mingyi)