Presentation is loading. Please wait.

Presentation is loading. Please wait.

April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.1 Tabling Abduction José Alferes and Luís Moniz Pereira Univ. Évora and CENTRIA CENTRIA Univ. Nova Lisboa.

Similar presentations


Presentation on theme: "April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.1 Tabling Abduction José Alferes and Luís Moniz Pereira Univ. Évora and CENTRIA CENTRIA Univ. Nova Lisboa."— Presentation transcript:

1 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.1 Tabling Abduction José Alferes and Luís Moniz Pereira Univ. Évora and CENTRIA CENTRIA Univ. Nova Lisboa Portugal

2 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.2 Abductive procedures One of the main issues in abductive procedures is: –How to collect abduced literals to prove a goal? i.e. –Which consistent set of abducibles, if added as facts, prove the goal

3 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.3 In XSB-Prolog When a tabled goal G succeeds its table may contains suspended goals due to loops over negation - The residue of G This residue can be accessed by predicate get_residual/2

4 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.4 Naïve approach Table abducible predicates Force calls to them to suspend every time Produce an abductive solution as a residue of the top-goal In general the naïve approach does not work. We generalize the naïve approach to implement an abductive procedure based on tabling in XSB- Prolog

5 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.5 Summary Review of XSB residue Naïve approach Dealing with default negation Dealing with loops Further topics

6 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.6 Tabling negation –Whenever there are loops over negation, two tabled calls may depend on each other so that neither of which can be completed Literals involved in such loops are delayed If, in the end, some calls are not completely evaluated, they’ll have an associated list of delays - the residue We assume some knowledge of SLG resolut.

7 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.7 Delayed literals For tabled literals, answers are rules with delayed literals in the body :- table r/0, s/0, p/1. p(X) :- tnot(r). r :- tnot(s). p(X) :- a(X). a(a). s :- tnot(r). The answers are: p(X) :- tnot(r). r :- tnot(s). p(a). a(a). s :- tnot(r).

8 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.8 Combinatorial explosion To avoid combinatorial explosion, delayed literals in the body are not propagated over tabled literals Tabled literals act as place holders for propagating delays :- table r/0, s/0, p/1, q/0. p(X) :- q. r :- tnot(s). q :- tnot(r). s :- tnot(r).

9 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.9 Residual program get_residual(Goal,Res) –Returns in Res the body of an answer rule for Goal –It does not produce the residue itself –It only accesses the already built residue

10 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.10 Naïve approach Table abductive literals q  p p  a, b p  c Abd = {a,b,c} q :- p. p :- abd(a), abd(b). p :- abd(c). abd(X) :- tnot(abd(X)). :- table abd/1,q/0. abd_sol(q,Ab) :- q,fail; get_residual(q,Ab). Make sure that they are suspended Guarantee that the table is complete before calling get_residual Obtain the abductive solutions via the residue Table the top-goal Translate abducible L into abd(L)

11 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.11 Naïve approach example q :- p. p :- abd(a), abd(b). p :- abd(c). abd(X) :- tnot(abd(X)). :- table abd/1,q/0. abd_sol(q,Ab) :- q,fail; get_residual(q,Ab). ?- abd_sol(q,Ab). Ab = [abd(a),abd(b)]; Ab = [abd(c)]; no.

12 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.12 Problems If the program has default negation, the failure mechanism makes it impossible to pass arguments (abductions) to the top- goal –Other problems arise: abducing falsity; consistency checking;... If other predicates are tabled, the residue may come in terms of those (and not of the abducibles). –Tabling of others is needed because of loops

13 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.13 Negation Example q  a, tnot p. p  a,b. p  c. The desired abd. solution is: {a, not b, not c} With the naïve approach (with not tabled): [abd(p), tnot(p)]. How to pass abductions up through negation? Generate rules for negation and replace negative call by (positive) calls to these rules Rules for negatives form a dual program (c.f. [PAA91])

14 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.14 Dual (ground) program Turn all rules for a predicate A into one (by using disjunction in bodies) The rule for not_A is obtained by interchanging, in the rule for A, conjunction and disjunction, plus positive and negative literals a  b, not c a  d, not e a  b, not c ; d, not e not_a  (not_b; c), (not_d; e)

15 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.15 Dual example q :- abd(a), not_p. p :- abd(a), abd(b). p :- abd(c). abd(X) :- tnot(abd(X)). :- table abd/1,q/0. abd_sol(q,Ab) :- q,fail; get_residual(q,Ab). ?- abd_sol(q,Ab). Ab = [abd(a),abd(not_a),abd(not_c)]; Ab = [abd(a),abd(not_b), abd(not_c)]; no. not_q :- abd(not_a); p. not_p :- (abd(not_a); abd(not_b)), abd(not_c).

16 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.16 Checking consistency To avoid inconsistent solutions, add a call to consistent/1 after get_residual/2 abd_sol(q,Ab) :- q_cons,fail; get_residual(q_cons,Ab), consistent(Ab). q_cons :- q, not_false. To deal with denials include them as rules for false, and conjoin any top-goal with not_false abd_sol(q,Ab) :- q,fail; get_residual(q,Ab), consistent(Ab).

17 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.17 Tabling non-abducibles Till now only abducibles and the top-goal are tabled With other tabled predicates, the residue is given in terms of these, not in terms of the abducibles below q :- p. p :- abd(a), abd(b); abd(c). abd(X) :- tnot(abd(X)). :- table abd/1,q/0, p/0. abd_sol(q,Ab) :- q,fail; get_residual(q,Ab). ?- abd_sol(q,Ab). Ab = [p]; no

18 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.18 Tabling non-abducibles After a call to a tabled predicate, com- plete its table, and get its residue info (R) abd_sol(q,Ab) :- q(_), fail ; get_residual(q(R),RR), filter(RR,Ab). filter/3 filters out non-abducibles, and checks consistency q :- p, fail ; get_residual(p,R). Pass up the info via an extra argument

19 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.19 Example p :- a, q. p :- not t. t :- not s, c. s :- b. q :- not r. r :- not q. p :- a, q; not t. not_p :- not_a, not_q; t. t :- not s, c. q :- not r. not_t :- s; not_c. not_q :- r. s :- b. r :- not q. not_s :- not_b not_r :- q. p :- abd(a), q; not t. not_p :- abd(not_a), not_q; t. t :- not s, abd(c). q :- not r. not_t :- s; abd(not_c). not_q :- r. s :- abd(b). r :- not q. not_s :- abd(not_b). not_r :- q. p(RR) :- (abd(a), (q(_),fail; get_residual(q(R),RR))); not t. not_p(RR) :- abd(not_a), (not_q(_),fail; get_res(R,RR)); t. q(RR) :- not_r(_), fail; get_residual(not_r(R),RR). not_q(RR) :- r(_), fail; get_residual(r(R),RR). r(RR) :- not_q(_), fail; get_residual(not_q(R),RR). not_r(RR) :- q(_), fail; get_residual(q(R),RR). t :- not s, abd(c). not_t :- s; abd(not_c). s :- abd(b). not_s :- abd(not_b). :- table abd/1, p/1, not_p/1, q/1, not_q/1, r/1, not_r/1. abd(X) :- tnot(abd(X)). abd_sol(p,Ab) :- p(_), fail; get_residual(p(R),Ab), filter(R,RR,Ab). abd_sol(not_p,Ab) :- not_p(_), fail; get_residual(not_p(R),Ab), filter(R,RR,Ab). p(RR) :- (abd(a), (q(_),fail; get_residual(q(R),RR))); not t. not_p(RR) :- abd(not_a), (not_q(_),fail; get_res(R,RR)); t. q(RR) :- not_r(_), fail; get_residual(not_r(R),RR). not_q(RR) :- r(_), fail; get_residual(r(R),RR). r(RR) :- not_q(_), fail; get_residual(not_q(R),RR). not_r(RR) :- q(_), fail; get_residual(q(R),RR). t :- not s, abd(c). s :- abd(b). not_t :- s; abd(not_c). not_s :- abd(not_b).

20 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.20 Abductive solutions p :- a, q. p :- not t. q:- not r. r :- not q. t :- not s, c. s :- b ?- abd_sol(p,Ab). Ab = [abd(b)]; Ab = [abd(not(c))]; no. ?- abd_sol(not_p,Ab). Ab = [abd(not_a),abd(not_b),abd(c)]; no.

21 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.21 One solution at a time The L, fail; get_residual/2 construct com- putes all solutions before showing one In the paper we explain how to avoid this, by adding an extra argument to predicates

22 April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.22 Conclusions We have fostered a new method to implement abduction The method relies on the XSB tabling mechanism In the paper we briefly sketch: –viewing constraints as abduction and treating them with this method; –dealing with non-ground negative goals via constructive negation as constraints


Download ppt "April 3rd, 1998TAPD'98. Paris 2-3 April, 1998.1 Tabling Abduction José Alferes and Luís Moniz Pereira Univ. Évora and CENTRIA CENTRIA Univ. Nova Lisboa."

Similar presentations


Ads by Google