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)
A = atoms without definitions, can be assumed
IC = Integrity constraints (usually, implications)
KB ╞═ G
KB ╞═ IC
Reasoning from effects to causes
Diagnosis
headache:- flu.
headache:- period.
headache:- hangover.
flu, vaccine -> false.
hangover -> drank.
period, sex(male) -> false.
?- headache.
Yes, flu
Yes, period
More? ;
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)
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)
}
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.
Constraint Store
headache :- hangover.
flu, vaccine -> false
?- vaccine , headache.
Constraint Solver
flu
fail
Abduction = constraint solving
[Kowalski, Toni, Wetzel 98]
headache :- flu.
Constraint Store
headache :- hangover.
headache :- period.
flu, vaccine -> false.
hangover -> drank.
period, sex(male) -> false.
?- vaccine , headache.
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
?-vaccine, headache.
flu
fail
Constraint Store
Abduction in CHR
headache :- hangover.
headache :- ...
drank.
hangover ==> drank
?-
headache.
hangover
drank
success
Constraint Store
Abduction in CHR
headache :- period.
Constraint Store
headache :- ...
sex(male).
period, sex(male) ==> false
! CHR: invalid syntax "sex(male)"
! Undeclared constraint sex/1 in head of rule
Problem:
Syntax
Implementation
(CHR)
Declarative
Semantics
Syntax
Operational
Semantics
Implementation
Operational semantics
Propagation
a(X)
a(Y), b -> c
Case analysis
(X=Y, b) -> c
Equality rewriting
p(A,B,C)=p(D,E,F)
Unfolding
p(X) -> Goal
p(X):- a.
a -> Goal.
b -> Goal
...
Constraint solving
(X=Y, b) -> c
X=Y, (b -> c)
\/
A=D, B=E, C=F
p(X):-b.
X\=Y
Abduction in CHR (SCIFF)
Constraint Store
headache :- flu.
headache :- ...
ic( vaccine, flu -> false )
?-vaccine, headache.
flu
fail
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).
Transitions
Propagation transition (+ case analysis):
abd(X), ic([abd(Y)|Rest]-> Head)
==>
copy(ic([abd(Y) |Rest ]-> Head) ,
ic([abd(Y’)|Rest’]->
Head’)),
ic([abd(vaccine),abd(flu)]->
reif_unify(X,Y’,Boolean),
ic([abd(period),sex(male)]->
(
Boolean=1, ic(Rest’->Head’)
ic([abd(hangover)]-> drank)
; Boolean=0).
abd(hangover)
false)
false)
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))
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’)),
ic([abd(vaccine,1,vaccine),abd(flu,1
reif_unify(X,Y’,Boolean),
ic([abd(period,1,period),sex(male)](
Boolean=1, ic(Rest’->Head’)
ic([abd(hangover,1,hangover)]-> dran
; Boolean=0).
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
Experiment
Auction protocol
Block world
AlLoWS Feeble
Conformance
AlLoWS nonconformant
SCIFF
2005
2.27 s
45.0 s
84.4 s
SCIFF 2011
3.7 s
3.3 s
0.37 s
15.7 s
36.8 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?
© Copyright 2026 Paperzz