Upload
jack-riley
View
214
Download
0
Embed Size (px)
Citation preview
Steffen [email protected]
Advanced Data Modeling1 of 32
WeST
Häufungspunkte Bifurkation: xn+1 = r xn (1-xn)
Startwert x0 = 0,25
Web Science & Technologies
University of Koblenz ▪ Landau, Germany
Implementing DLV
Steffen [email protected]
Advanced Data Modeling4 of 32
WeST
RULE HANDLING AND INTELLIGENT GROUNDING
Steffen [email protected]
Advanced Data Modeling5 of 32
WeST
Intelligent Grounding
Ground Programm has exactly the same answer sets as the original programme
For some syntactically restricted classes of programs (e.g. stratified programs), the “Intelligent Grounding” module already computes the corresponding answer sets.
We assume “safe programmes”, i.e. no variables in the head that are not bound by positive literals in the body.
We assume function-free programmes here.
Thomas Eiter, Nicola Leone, Cristinel Mateis, Gerald Pfeifer, Franceseo Scarcello. A Deductive System for Non-Monotonic Reasoning. In: Logic Programming And Nonmonotonic Reasoning. Lecture Notes in Computer Science, 1997, Volume 1265/1997, 363-374, Springer.
Steffen [email protected]
Advanced Data Modeling6 of 32
WeST
Rules and Graphs Handler
Motivation: Overall problem of EDLP is co-NP hard, BUT many of its parts are much easier (e.g. stratified programms are polynomially computable)
Steffen [email protected]
Advanced Data Modeling7 of 32
WeST
Ground Dependency Graph (GG)
Nodes: atoms Edges: E+, E-, E Ground Programme:
p(2,3) :-
t(2) :-
q(1) q(3) :- p(2,3), NOT t(2).
t(3) :- q(3), p(2,3).
Steffen [email protected]
Advanced Data Modeling8 of 32
WeST
Ground Collapsed Positive Dependency Graph (GG+)
Strongly connected components form modules and become one node (not in the example here)
Steffen [email protected]
Advanced Data Modeling9 of 32
WeST
Non-Ground Collapsed Positive Dependency Graph (G+ P)
Steffen [email protected]
Advanced Data Modeling10 of 32
WeST
Summarizing Steps for Analyzing Rules
Given programme P, it computes G+ P for the intelligent
grounding module (IGM) Given from IGM it computes GG
From and GG it sets apart
the modules, syntactical properties (e.g. stratification)
for the Model Generator
It computes GG+ for Model Checker to reduce search
space For each component of GG+
it analyzes syntactical properties (e.g. headcycle-freeness) for use by Model Checker
Steffen [email protected]
Advanced Data Modeling11 of 32
WeST
Grounding
Init
NF = EDBP % Grounded facts initially= DB extension
= % Grow grounded program from G+
P % Analyze the collapsed ng rule graph
Key steps of procedure:
1.Grow rule grounding from node C in G+P without incoming
edges (i.e. non-recursive)
2.Grow rule grounding using positive literals (and remove them from the grounded rules!)
Steffen [email protected]
Advanced Data Modeling14 of 32
WeST
Example Programme
Programme P
p(1,2) p(2,3) :-
t(X) :- a(X).
q(X) q(Z) :- p(X,Y), p(Y,Z), NOT t(Y).
t(X) :- q(X), p(Y,X)
a(2) :-
Grounded Programme p(1,2) p(2,3) :-
t(2) :-
q(1) q(3) :- p(1,2), p(2,3), NOT t(2).
t(3) :- q(3), p(2,3)
a(2) :-
Note: ground(P) contains 40 rule instances, but Instantiate generates only 4.
Steffen [email protected]
Advanced Data Modeling15 of 32
WeST
Theorem
Let P be a safe disjunctive datalog program, and be the ground program generated by Instantiat(P). Then, P and have the same stable models.
Steffen [email protected]
Advanced Data Modeling16 of 32
WeST
Summary
Grounding is a bit like forward chaining (applying immediate consequence operator).
However, because of disjunction in the heads it is overgenerating and it is also not retracting implications that fail because of negation.
Steffen [email protected]
Advanced Data Modeling18 of 32
WeST
Model Generator
1. Derive what is definitely derivable,
2. Make ‘educated’ guess for one of those literals which have not been decided yet.
3. IF further guesses can be madeTHEN GOTO 2ELSE Call MODEL-CHECKER
If candidate model is inconsistent or not stable then
backtrack, taking knowledge about previous guesses
into account to avoid redundancies
Nicola Leone, Pasquale Rullo, Francesco Scarcello. Disjunctive Stable Models: Unfounded Sets, Fixpoint Semantics, and Computation. In: Information and Computation, 135(2): 69-112, 1997.
Steffen [email protected]
Advanced Data Modeling19 of 32
WeST
Note
The number of candidate models can be exponential Smart generation of candidate models is crucial
Prune the search space! Special algorithms for:
• Polynomial-time algorithm for normal stratified programs
• Special algorithm for headcycle-free disjunctive programs
• General algorithm
Steffen [email protected]
Advanced Data Modeling20 of 32
WeST
Unfounded Sets
IntuitivelyAn unfounded set for a disjunctive program P w.r.t. an interpretation I is a set of positive literals that cannot be derived from P assuming the facts in I.
[generalization of a technique from well-founded semantics!]
Steffen [email protected]
Advanced Data Modeling21 of 32
WeST
Unfounded Sets
Formally:Let I be an interpretation for a program P. A set X of ground atoms is an unfounded set for P w.r.t. I if, for each a∈X,
for each rule r∈ground(P) such that a∈H(r), at least one of the following conditions holds:
• B(r) ∩ .I ≠ , that is, the body of r is false w.r.t. I
• B+(r)∩ X ≠ , that is, some positive body literal belongs to X
• (H(r)-X) ∩ I ≠ , that is, an atom in the head of r, distinct from a and other elements in X, is true w.r.t. I
[generalization of a technique from well-founded semantics!]
Steffen [email protected]
Advanced Data Modeling22 of 32
WeST
Unfounded Sets: Example
Program P:
a b :-
I = {b}
Then {a} is an unfounded set of P wrt I
(criterion 3 applies)
Intuitively: there is no reason to believe that a is true given I
Steffen [email protected]
Advanced Data Modeling23 of 32
WeST
Unfounded Sets: Example
Program P:
a b :-
I = {a,b}
Then both {a} and {b} are unfounded sets of P wrt I
(i.e. we should not believe both!)
However, {a,b} is not an unfounded set!
Steffen [email protected]
Advanced Data Modeling24 of 32
WeST
Unfounded Sets: Example
Program P:
a b :-
a :- b.
b :- a.
I = {a,b}
Then is the only unfounded set of P wrt I
Steffen [email protected]
Advanced Data Modeling25 of 32
WeST
Definition & Proposition
DefinitionLet I be an interpretation for a program P.I is unfounded-free if I ∩ X = for each unfounded set X for P w.r.t. I.
Proposition: Let I be an unfounded-free interpretation for a program P. ThenP has the greatest unfounded set GUSP(I)
GUSP(I) is computable in polynomial time
Steffen [email protected]
Advanced Data Modeling26 of 32
WeST
Monotonic Operator WP
Plan:Compute WP
()
Either this is a unique stable model Otherwise move from WP
() towards the stable models
Steffen [email protected]
Advanced Data Modeling27 of 32
WeST
Immediate Consequence Operator TP
Definition:TP(I) = {a∈BP | ∃ r∈ground(P)
s.t. a∈H(r), H(r) – {a} ⊆.I, and B(r) ⊆ I}
Note: TP is deterministic!
Definition:WP (I) = TP(I) .GUSP(I)
Steffen [email protected]
Advanced Data Modeling28 of 32
WeST
Theorem
TheoremLet M be a total interpretation for program P. M is a stable model for P iff M is a fixpoint of WP.
Proposition: Given a propositional program P, WP
() is computable in polynomial time.
Steffen [email protected]
Advanced Data Modeling29 of 32
WeST
Examples
Program P:
a b :-
WP() = , i.e. not a model!
Program P:
b :- NOT c.
a b :-
WP() = {NOT c, b, NOT a},
i.e. total, i.e. stable model
Steffen [email protected]
Advanced Data Modeling30 of 32
WeST
Computing the Stable Models: Main
Possibly true literals
Steffen [email protected]
Advanced Data Modeling31 of 32
WeST
Computing the Stable Models: Compute-Stable
Steffen [email protected]
Advanced Data Modeling32 of 32
WeST
FINISThis slide deck is not part of the material for examinations