What is DEFT?
DEFT for Defeasible Datalog+/- is an open source software for Defeasible Reasonning based on Graal. It is still under active developpment and offers a working API for defeasible reasonning in Datalog+/-.
For installation instructions and more, go to our github page for DEFT
Examples
Defeasible Reasoning allows us to express statements whose truth can be challenged. To express claims that can be contested we use defeasible atoms and rules labelled with [DEFT]
following the Datalog+/- format DLGP.
Can Kowalski Fly?
%----------------- Rules --------------------
bird(X) :- penguin(X).
nofly(X) :- penguin(X).
[DEFT] fly(X) :- bird(X).
%----------- Negative Constraints -----------
! :- nofly(X), fly(X).
%----------------- Facts --------------------
penguin(kowalski).
% Can kowalski Fly?
Generally all birds can fly [DEFT] fly(X) :- bird(X)
, penguins are birds bird(X) :- penguin(X)
that cannot fly nofly(X) :- penguin(X)
, and Kowalski is a penguin.
The answer to query "Can kowalski fly?" ?(X) :- fly(kowalski)
is: No, even though we can reach the defeasible conclusion that he can fly fly(kowalski)
, we can also deduce that without a doubt he cannot fly nofly(kowalski)
.
The Power Of Existential Variables!
Defeasible Datalog+/- is very expressive thanks to the introduction of Existential variables, they allows us to deduce the existence of instances (also called "nulls" or "fresh varialbes") that might not be present in the knowledge base. The price to pay for this expressiveness is the possibility to wrongfuly make inquestionnable facts questionable.
In this example the fact u(a)
is challenged by two facts s(a, Y_1)
and s(a,Y_2)
.
%----------------- Rules --------------------
s(X,Y) :- p(X).
[DEFT] s(X,Y), t(Y) :- q(X).
[DEFT] u(X) :- r(X).
%----------- Negative Constraints -----------
! :- u(X), s(X,Y).
%----------------- Facts --------------------
p(a).
q(a).
[DEFT] r(a).
% Is u(a) entailed?
Installation
See github page for DEFT.
Usage
Documentation comming soon. In the mean while, you can download the code and take a look at the examples and work from there.
- Express your knowledge base using the DLGP format. e.g. kowalski.dlgp
- in your code, create a KB object using the dlgp file, and saturate the knowledge base
- Transform your atomic query to an atom
- Set the preference function to use
- Get its entailment status
KB kb = new KB("path/to/kowalski.dlgp");
kb.saturate();
Atom atom = kb.getAtomsSatisfiyingAtomicQuery("?(X) :- nofly(kowalski).").iterator().next();
kb.setPreferenceFunction(new GeneralizedSpecificityPreference());
int entailment = kb.EntailmentStatus(a);
/* the KB class contains constants explaining the entailement status:
NOT_ENTAILED, STRICTLY_ENTAILED, DEFEASIBLY_ENTAILED */
Next Versions TODO list
- Add detailed documentation.
- Add preference on rules.
- Add support for default negation.
- Add a graphical tool for dialectical tree visualisation.
Use our github page for DEFT if you have a specific request to be prioritized in the upcoming versions.
Theoretical Background
DEFT is based on the theoretical work of [1] and [2]. If your knowlege base does not need existential variables, please check the excellent DeLP program (until DEFT catches up ;) ).
[1] Martinez, Maria Vanina, et al. "Inconsistency-Tolerant Reasoning in Datalog+/- Ontologies via an Argumentative Semantics." Ibero-American Conference on Artificial Intelligence. Springer International Publishing, 2014.
[2]GarcĂa, Alejandro J., and Guillermo R. Simari. "Defeasible logic programming: An argumentative approach." Theory and practice of logic programming 4.1+ 2 (2004): 95-138.