Abductive logic programming: Difference between revisions

Content deleted Content added
Example 4: better colorize Prolog code in text, to improve optical distinction between e.g. "normal(X)" and "in normal logic programming"; BTW: I guess, the new predicate abnormal(X) is obtained by suitably renaming the abduction result? - this should be explained in text
Example 4: Change to a more general treatment of the relationship between ALP and NAF.
Line 91:
Once an explanation has been chosen, then this becomes part of the theory, which can be used to draw new conclusions. The explanation and more generally these new conclusions form the solution of the problem.
 
==Default reasoning in ALP==
===Example 4===
 
The following example shows how abduction can be to simulate [[negation as failure]]:<ref>Eshghi, K. and Kowalski, R.A., 1989, June. Abduction Compared with Negation by Failure. In ICLP (Vol. 89, pp. 234-255).</ref>
As shown in<ref>{{cite report | url=https://www.cs.ubc.ca/~poole/papers/Theorist-CS-86-06.pdf |first1=David |last1=Poole |first2=Randy |last2=Goebel |first3=Romas |last3=Aleliunas | title=Theorist: A Logical Reasoning System for Defaults and Diagnosis | institution=Univ. Waterloo | type=Research Report | number=CS-86-06 | date=Feb 1986 }}</ref><ref>{{cite book | url= |first1=David |last1=Poole |first2=Randy |last2=Goebel |first3=Romas |last3=Aleliunas | contribution=Theorist: A Logical Reasoning System for Defaults and Diagnosis | pages=331&ndash;352 | doi=10.1007/978-1-4612-4792-0 | isbn=978-1-4612-9158-9 | editor1=Nick J. Cercone | editor2= Gordon McCalla | title= The Knowledge Frontier &ndash; Essays in the Representation of Knowledge | ___location=New York, NY | publisher=Springer | series=Symbolic Computation | volume= | edition=1st | year=1987 |s2cid=38209923 }}</ref>, abduction can also be used for [[default reasoning]].
 
Consider the classic example of reasoning by default that a bird can fly if it is consistent to assume that the bird can fly. The example can be formulated naturally as an abductive logic program. Here is a variant of the example:
 
<syntaxhighlight lang="prolog">
canfly(X) :- bird(X), normalnormal_flying_bird(X).
false :- normalnormal_flying_bird(X), wounded(X).
bird(john).
bird(mary).
Line 101 ⟶ 105:
</syntaxhighlight>
 
Here the predicate <syntaxhighlight inline lang="prolog">normalnormal_flying_bird(_)</syntaxhighlight> is abducible,. andIt theis abduciblepossible to conditionconclude <syntaxhighlight inline lang="prolog">normalcanfly(Xmary)</syntaxhighlight> corresponds tounder the negative literalassumption <syntaxhighlight inline lang="prolog">not(abnormalnormal_flying_bird(X)mary)</syntaxhighlight>. inThe normalassumption logicand programming.conclusion Theare constraintacceptable because it cannot be shown that <syntaxhighlight inline lang="prolog">false :- normal(X), wounded(Xmary).</syntaxhighlight> ensuresIn thatcontrast, the abducible conditionit is not assumedpossible when theto conditionconclude <syntaxhighlight inline lang="prolog">woundedcanfly(Xjohn),</syntaxhighlight> alsobecause holds.the This is like ensuring thatassumption <syntaxhighlight inline lang="prolog">notnormal_flying_bird(abnormal(X)john)</syntaxhighlight> succeedstogether with the whenfact <syntaxhighlight inline lang="prolog">wounded(Xjohn)</syntaxhighlight> violates failsthe integrity constraint.
 
The example can be reformulated in normal logic programming without abduction, by using [[negation as failure]] with a non-abducible predicate <syntaxhighlight inline lang="prolog">abnormal_flying_bird(_),</syntaxhighlight> which is the contrary of the abducible predicate <syntaxhighlight inline lang="prolog">normal_flying_bird(_)</syntaxhighlight>:
 
The goal of explaining the observation <syntaxhighlight inline lang="prolog">canfly(mary)</syntaxhighlight> has the solution <syntaxhighlight inline lang="prolog">normal(mary)</syntaxhighlight>. The same solution justifies the answer <syntaxhighlight inline lang="prolog">X = mary</syntaxhighlight> for the goal:
<syntaxhighlight lang="prolog">
canfly(X) :- bird(X), not(abnormal_flying_bird(X)).
-? canfly(X).
abnormal_flying_bird(X):- wounded(X).
bird(john).
bird(mary).
wounded(john).
</syntaxhighlight>
 
TheIn followinggeneral, examplereasoning showsby howmeans of abduction canin beALP tosimulates reasoning by simulate [[negation as failure]]: in normal logic programming.<ref>Eshghi, K. and Kowalski, R.A., 1989, June. Abduction Compared with Negation by Failure. In ICLP (Vol. 89, pp. 234-255).</ref> Conversely, negation as failure with the [[stable model semantics]] can simulate abduction in ALP.
 
In the general case, abduction in ALP can be simulated by adding, for every abducible predicate <syntaxhighlight inline lang="prolog">p,</syntaxhighlight> a pair of clauses:
 
<syntaxhighlight lang="prolog">
p :- not(abp).
abp :- not(p).
</syntaxhighlight>
 
where <syntaxhighlight inline lang="prolog">abp</syntaxhighlight> is a predicate representing the contrary of <syntaxhighlight inline lang="prolog">p,</syntaxhighlight> and neither <syntaxhighlight inline lang="prolog">abp</syntaxhighlight> nor <syntaxhighlight inline lang="prolog">p</syntaxhighlight> are abducible.<ref>Kakas, A.C., Kowalski, R.A. and Toni, F., 1992. Abductive logic programming. Journal of logic and computation, 2(6), pp.719-770.</ref>
 
==Formal semantics==