1 / 28

The CHR-based Implementation of the SCIFF Abductive System

The CHR-based Implementation of the SCIFF Abductive System. Marco Gavanelli – Università di Ferrara, Italy Marco Alberti – Universidade nova de Lisboa, Portugal Evelina Lamma – Università di Ferrara, Italy. Abductive Logic Programming. ALP = < KB, A, IC > KB = logic program (set of clauses)

cera
Download Presentation

The CHR-based Implementation of the SCIFF Abductive System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The CHR-based Implementation of the SCIFFAbductive System Marco Gavanelli – Università di Ferrara, Italy Marco Alberti – Universidade nova de Lisboa, Portugal Evelina Lamma – Università di Ferrara, Italy

  2. Abductive Logic Programming • ALP = < KB, A, IC > • KB = logic program (set of clauses) • A = atoms without definitions, can be assumed • IC = Integrity constraints (usually, implications) KB   ╞═ G KB   ╞═ IC • Reasoning from effects to causes

  3. Diagnosis headache:- flu. headache:- period. headache:- hangover. flu, vaccine -> false. hangover -> drank. period, sex(male) -> false. ?- headache. Yes, flu More? ; Yes, period

  4. Event Calculus holdsat(Fluent,Time):- initially(Fluent), not(clipped(0,Fluent,Time)). holdsat(Fluent,Time):- initiates(Action,Fluent), happens(Action,T1), not(clipped(T1,Fluent,Time)). clipped(T1,Fluent,T2):- terminates(Action), happens(Action,T), T1<T<T2. initially(f1). initially(f2). happens(c,7) happens(a,2) happens(b,4)

  5. Abductive Event Calculus holdsat(Fluent,Time):- initially(Fluent), not(clipped(0,Fluent,Time)). holdsat(Fluent,Time):- initiates(Action,Fluent), happens(Action,T1), not(clipped(T1,Fluent,Time)). clipped(T1,Fluent,T2):- terminates(Action), happens(Action,T), T1<T<T2. initially(f1). initially(f2). happens(c,7) ={ happens(a,2) happens(b,4) }

  6. Sound negation p(1). p(f(X)):- q(X). q(2). • ?- not(p(Y)). yes, Y\=1, Y\=f(2)

  7. Abduction = constraint solving[Kowalski, Toni, Wetzel 98] • headache :- flu. • headache :- hangover. • flu, vaccine -> false Constraint Store ?- , headache. vaccine Constraint Solver flu fail

  8. Abduction = constraint solving[Kowalski, Toni, Wetzel 98] • headache :- flu. • headache :- hangover. • headache :- period. • flu, vaccine -> false. • hangover -> drank. • period, sex(male) -> false. Constraint Store Constraint Solver ?- , headache. vaccine fail flu

  9. Constraint Handling Rules (CHR) • Declarative language for defining constraint solvers • Simplification rules: c1, c2, ..., cn <=> guard | body • activated if some constraints in the store match with c1, c2, ..., cn and guard is true • removes c1, c2, ..., cn from the store and executes body • Propagation rules: c1, c2, ..., cn ==> guard | body • activated if some constraints in the store match with c1, c2, ..., cn and guard is true • executes body

  10. Example: leq (less or equal) reflexivity@leq(X,X) <=> true. antisymmetry@leq(X,Y), leq(Y,X) <=> X=Y. transitivity@leq(X,Y), leq(Y,Z) ==> leq(X,Z). leq(A,B), leq(B,C), leq(C,A) leq(A,B), leq(B,C), leq(C,A), leq(A,C) leq(A,B), leq(B,A), A=C A=B, A=C

  11. Abduction in CHR [Abdennadher, Christiansen, Dahl] • Abducibles mapped to CHR constraints • headache :- flu. • headache :- hangover. • flu, vaccine -> false

  12. Abduction in CHR • headache :- flu. • headache :- ... • flu, vaccine ==> false Constraint Store ?- , headache. vaccine fail flu

  13. Abduction in CHR • headache :- hangover. • headache :- ... • drank. • hangover ==> drank Constraint Store ?- headache. hangover drank success

  14. Abduction in CHR • headache :- period. • headache :- ... • sex(male). Constraint Store • period, sex(male) ==> false ! CHR: invalid syntax "sex(male)" ! Undeclared constraint sex/1 in head of rule

  15. Problem:

  16. Operational semantics • Propagation • a(X) a(Y), b -> c (X=Y, b) -> c • Case analysis • (X=Y, b) -> c X=Y, (b -> c) \/ X\=Y • Equality rewriting • p(A,B,C)=p(D,E,F) A=D, B=E, C=F • Unfolding • p(X) -> Goal p(X):- a. p(X):-b. • a -> Goal. b -> Goal • ... • Constraint solving

  17. Abduction in CHR (SCIFF) Constraint Store • headache :- flu. • headache :- ... ic( flu -> false) ic( ) vaccine, flu -> false ?- , headache. vaccine fail flu

  18. Transitions • Propagation transition (+ case analysis): abd(X), ic([abd(Y)|Rest]-> Head) ==> copy(ic([abd(Y) |Rest ]-> Head) , ic([abd(Y’)|Rest’]-> Head’)), reif_unify(X,Y’,Boolean), ( Boolean=1, ic(Rest’->Head’) ; Boolean=0).

  19. Transitions • Propagation transition (+ case analysis): abd(X), ic([abd(Y)|Rest]-> Head) ==> copy(ic([abd(Y) |Rest ]-> Head) , ic([abd(Y’)|Rest’]-> Head’)), reif_unify(X,Y’,Boolean), ( Boolean=1, ic(Rest’->Head’) ; Boolean=0). ic([abd(vaccine),abd(flu)]-> false) ic([abd(period),sex(male)]-> false) ic([abd(hangover)]-> drank) abd(hangover)

  20. No hashing • Does not use CHR’s hashing • Solution: abducibles are represented with redundant information: abd(Functor, Arity, Atom) • So to abduce atom X: abd(X):- functor(F, A, X), abd(F, A, X). • E.g., if I abduce atom mother(X,john), the constraint store contains abd(mother, 2, mother(X,john))

  21. Hashing • Propagation transition (+ case analysis): abd(F,A,X), ic([abd(F,A,Y)|Rest]-> Head) ==> copy(ic([abd(Y) |Rest ]-> Head) , ic([abd(Y’)|Rest’]-> Head’)), reif_unify(X,Y’,Boolean), ( Boolean=1, ic(Rest’->Head’) ; Boolean=0). Requires the first two arguments identical

  22. Hashing • Propagation transition (+ case analysis): abd(F,A,X), ic([abd(F,A,Y)|Rest]-> Head) ==> copy(ic([abd(Y) |Rest ]-> Head) , ic([abd(Y’)|Rest’]-> Head’)), reif_unify(X,Y’,Boolean), ( Boolean=1, ic(Rest’->Head’) ; Boolean=0). ic([abd(vaccine,1,vaccine),abd(flu,1,flu)]-> false) ic([abd(period,1,period),sex(male)]-> false) ic([abd(hangover,1,hangover)]-> drank) abd(hangover,1,hangover)

  23. Postpone choices • new CHR constraint nondeterministic(Goal) says that Goal can open a choice point, so should be called as late as possible. • Two phases, declared by a CHR constraint phase/1: • phase(deterministic): only deterministic goals are executed • phase(nondeterministic): exactly ONE nondeterministic goal can be executed switch2det @ phase(nondeterministic), nondeterministic(G) <=> call(G), phase(deterministic). switch2nondet @ phase(deterministic) <=> phase(nondeterministic)

  24. Postponing nondet. • Propagation transition (+ case analysis): abd(F,A,X), ic([abd(F,A,Y)|Rest]-> Head) ==> copy(ic([abd(Y) |Rest ]-> Head) , ic([abd(Y’)|Rest’]-> Head’)), reif_unify(X,Y’,B), ( B=1, ic(Rest’->Head’) ; B=0).

  25. Postponing nondet. • Propagation transition (+ case analysis): abd(F,A,X), ic([abd(F,A,Y)|Rest]-> Head) ==> copy(ic([abd(Y) |Rest ]-> Head) , ic([abd(Y’)|Rest’]-> Head’)), reif_unify(X,Y’,B), (B == 1 -> ic(Rest’, Head’) ; B == 0 -> true ; nondeterministic((B#=1,ic(Rest’,Head’)) ; B#=0)) ).

  26. Results

  27. Conclusions • CHR implementation of an abductive proof-procedure • Sound, complete, sound treatment of negation • Well integrated with constraint solving, CLP(FD), CLP(R), universally quantified variables, quantifier restrictions, etc. • Easy to extend for other features (see other talk after coffee break)

  28. Thank you for your attention! Questions?

More Related