![Page 1: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/1.jpg)
Marco Gavanelli – Università di Ferrara, ItalyMarco Alberti – Universidade nova de Lisboa,
PortugalEvelina Lamma – Università di Ferrara, Italy
![Page 2: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/2.jpg)
Abductive Logic ProgrammingALP = < KB, A, IC >
KB = logic program (set of clauses)A = atoms without definitions, can be
assumedIC = Integrity constraints (usually,
implications)
KB ╞═ G KB ╞═ ICReasoning from effects to causes
![Page 3: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/3.jpg)
Diagnosisheadache:- flu.headache:- period.headache:- hangover.flu, vaccine -> false.
hangover -> drank.
period, sex(male) -> false.
?- headache.Yes, flu More? ;Yes, period
![Page 4: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/4.jpg)
Event Calculusholdsat(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)
![Page 5: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/5.jpg)
Abductive Event Calculusholdsat(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)={ }
![Page 6: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/6.jpg)
Sound negationp(1).
p(f(X)):- q(X).
q(2).
?- not(p(Y)).
yes, Y\=1, Y\=f(2)
![Page 7: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/7.jpg)
Abduction = constraint solving[Kowalski, Toni, Wetzel 98]headache :- flu.headache :- hangover.
flu, vaccine -> false
Constraint Store
?- , headache.vaccine
fluConstraint Solver
fail
![Page 8: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/8.jpg)
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
![Page 9: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/9.jpg)
Constraint Handling Rules (CHR)Declarative language for defining constraint solversSimplification rules:
c1, c2, ..., cn <=> guard | bodyactivated 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
![Page 10: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/10.jpg)
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).
leqleq(A,B), (A,B), leqleq(B,C), (B,C), leqleq(C,A)(C,A)
leqleq(A,B), (A,B), leqleq(B,C), (B,C), leqleq(C,A), (C,A), leqleq(A,C)(A,C)
leqleq(A,B), (A,B), leqleq(B,A), A=C(B,A), A=C
A=B, A=CA=B, A=C
![Page 11: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/11.jpg)
Abduction in CHR [Abdennadher, Christiansen, Dahl]Abducibles mapped to CHR constraintsheadache :- flu.headache :- hangover.
flu, vaccine -> false
![Page 12: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/12.jpg)
Abduction in CHRheadache :- flu.headache :- ...
flu, vaccine ==> false
Constraint Store
?- , headache.vaccine
flufail
![Page 13: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/13.jpg)
Abduction in CHRheadache :- hangover.headache :- ...drank.hangover ==> drank
Constraint Store
?- headache.
hangover
success
drank
![Page 14: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/14.jpg)
Abduction in CHRheadache :- period.headache :- ...sex(male).
Constraint Store
period, sex(male) ==> false
! CHR: invalid syntax "sex(male)"! Undeclared constraint sex/1 in head of rule
![Page 15: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/15.jpg)
Problem:
![Page 16: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/16.jpg)
Operational semanticsPropagation
a(X) a(Y), b -> c (X=Y, b) -> cCase 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
Unfoldingp(X) -> Goal p(X):- a. p(X):-b.a -> Goal. b -> Goal
...Constraint solving
![Page 17: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/17.jpg)
Abduction in CHR (SCIFF)headache :- flu.headache :- ...
Constraint Store
?- , headache.vaccine
flufail
ic( )vaccine, flu -> false
ic( flu -> false)
![Page 18: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/18.jpg)
TransitionsPropagation 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).
![Page 19: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/19.jpg)
TransitionsPropagation 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)
![Page 20: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/20.jpg)
No hashingDoes not use CHR’s hashingSolution: 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 containsabd(mother, 2, mother(X,john))
![Page 21: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/21.jpg)
HashingPropagation 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
![Page 22: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/22.jpg)
HashingPropagation 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)
![Page 23: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/23.jpg)
Postpone choicesnew 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 executedphase(nondeterministic): exactly ONE nondeterministic goal
can be executed
switch2det @ phase(nondeterministic), nondeterministic(G) <=>
call(G), phase(deterministic).
switch2nondet @ phase(deterministic) <=> phase(nondeterministic)
![Page 24: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/24.jpg)
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).
![Page 25: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/25.jpg)
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))
).
![Page 26: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/26.jpg)
ResultsExperiment SCIFF
2005SCIFF 2011
Auction protocol 2.27 s 0.37 sBlock world 45.0 s 15.7 sAlLoWS Feeble Conformance
84.4 s 36.8 s
AlLoWS non-conformant
3.7 s 3.3 s
![Page 27: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/27.jpg)
ConclusionsCHR implementation of an abductive proof-
procedureSound, complete, sound treatment of
negationWell 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)
![Page 28: The CHR-based Implementation of the SCIFF Abductive System](https://reader036.vdocument.in/reader036/viewer/2022062323/568158dd550346895dc62423/html5/thumbnails/28.jpg)
Thank you for your attention!
Questions?