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

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

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

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

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

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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/4/1465552/slides/slide_4.jpg", "name": "Event Calculus holdsat(Fluent,Time):- initially(Fluent), not(clipped(0,Fluent,Time)).", "description": "holdsat(Fluent,Time):- initiates(Action,Fluent), happens(Action,T1), not(clipped(T1,Fluent,Time)). clipped(T1,Fluent,T2):- terminates(Action), happens(Action,T), T1

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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/4/1465552/slides/slide_5.jpg", "name": "Abductive Event Calculus holdsat(Fluent,Time):- initially(Fluent), not(clipped(0,Fluent,Time)).", "description": "holdsat(Fluent,Time):- initiates(Action,Fluent), happens(Action,T1), not(clipped(T1,Fluent,Time)). clipped(T1,Fluent,T2):- terminates(Action), happens(Action,T), T1

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

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

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

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

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

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

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

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

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

Problem: Implementation (CHR) Syntax Declarative Semantics Operational Semantics Implementation

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

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

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

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)

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

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

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)

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)

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

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

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

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)

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