Presentation is loading. Please wait.

Presentation is loading. Please wait.

Marco Gavanelli – Università di Ferrara, Italy Marco Alberti – Universidade nova de Lisboa, Portugal Evelina Lamma – Università di Ferrara, Italy.

Similar presentations


Presentation on theme: "Marco Gavanelli – Università di Ferrara, Italy Marco Alberti – Universidade nova de Lisboa, Portugal Evelina Lamma – Università di Ferrara, Italy."— Presentation transcript:

1 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 = logic program (set of clauses) A = atoms without definitions, can be assumed IC = Integrity constraints (usually, implications) KB GKB 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, fluMore? ; 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(a,2)happens(b,4) happens(c,7)

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(a,2)happens(b,4) happens(c,7) ={ }

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 flu Constraint Solver 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 ?-, headache.vaccine flu Constraint Solver fail

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 flu fail

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

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: Implementation (CHR) Syntax Declarative Semantics Operational Semantics Implementation

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

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

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

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

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

21 No hashing Does not use CHRs 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))

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). Requires the first two arguments identical

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

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

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

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

27 Results ExperimentSCIFF 2005 SCIFF 2011 Auction protocol2.27 s0.37 s Block world45.0 s15.7 s A l LoWS Feeble Conformance 84.4 s36.8 s A l LoWS non- conformant 3.7 s3.3 s

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

29 Thank you for your attention! Questions?


Download ppt "Marco Gavanelli – Università di Ferrara, Italy Marco Alberti – Universidade nova de Lisboa, Portugal Evelina Lamma – Università di Ferrara, Italy."

Similar presentations


Ads by Google