Unformatted text preview: Local Strati cation
Instantiate rules; i.e., substitute all possible constants for variables, but reject
instantiations that cause some EDB subgoal
to be false.
3 Ground atom = atom with no variables.
Build dependency graph at the level of ground
atoms by instantiating the rules.
Whether program + EDB is locally strati ed
depends not only on program, but on EDB.
Program + EDB is locally strati ed i no
negative cycles in dependency graph. Example Win program with boards f1; 2; 3g and moves 1 !
2, 2 ! 3, and 1 ! 3.
1 2 3 The following three instantiations are the only
ones that cannot be ruled out immediately by
a false move subgoal:
r1: win1 : move1,2 & NOT win2
r2: win1 : move1,3 & NOT win3
r3: win2 : move2,3 & NOT win3 The Dependency Graph
win1 ,
win2 ,
,
win3 move1,2 move1,3 move2,3 The three move ground atoms and win3
are in stratum 0; win2 is in stratum 1, and
win1 is in stratum 2.
1 Computing the Locally Strati ed Model Compute locally strati ed perfect" model
bottomup, deciding on the truth or falsehood of
atoms by computing the LFP of each stratum in
turn. Example
Stratum 0: We nd win3 is false.
Stratum 1: That lets us use r3 to infer win2 is
true.
Stratum2: We then use r2 to infer win1 is true. Stable Models Intuitively, model M is stable" if when you apply
the rules to M you get exactly M back. Example Win" rule:
winX : moveX,Y & NOT winY with EDB 1 ! 2, 2 ! 3, 1 ! 3.
1 2 3 M = EDB + fwin1; win2g is stable.
The three useful instantiations are
r1: win1 : move1,2 & NOT win2
r2: win1 : move1,3 & NOT win3
r3: win2 : move2,3 & NOT win3
M makes only the bodies of r2 and r3 true,
letting us infer exactly M .
Note you get the EDB facts for free" in this
process. GelfondLifschitz Transform Formal notion of applying rules to a model M .
1. Instantiate rules in all possible ways.
2. Delete instantiated rules with a nonnegated
EDB subgoal that is not in M or with a false
arithmetic subgoal.
3 Remember, EDB is part of M .
2 3. Delete instantiated rules with a subgoal
NOT px, where px is in M .
3 In 3 and 4, p can be either EDB or
IDB.
4. Delete any subgoal NOT px if px is not in
M.
5. Delete any EDB subgoal in M and any true
arithmetic subgoal.
What's left? Rules with zero or more
nonnegated, relational subgoals with IDB
predicates.
3 Note that a rule with empty body is an
assertion that the head is true.
GLM = EDB + result of inferring IDB with
the remaining rules. Bottom Line on GL Transform You can use negative EDB or IDB facts in M i.e.,
atoms missing from M to help infer facts, and
you use positive EDB facts, but you don't use the
positive IDB facts in M unless you derive them
from other facts. Formal De nition of Stable Models
If GLM = M , then M is stable.
The stable semantics" for a program + EDB
is the unique stable model with that EDB, if
there is one.
3 Sometimes it is interesting to look at the
set of stable models, as well. Example
M = fmove1; 2, move1; 3, move2; 3, win1,
win2g formal version of previous example.
After step 2:
r1: win1 : move1,2 & NOT win2
r2: win1 : move1,3 & NOT win3
r3: win2 : move2,3 & NOT win3 After step 3:
r2: win1 : move1,3 & NOT win3
r3: win2 : move2,3 & NOT win3
After step 4:
3 r2: win1 : move1,3
r3: win2 : move2,3
After step 5:
r2: win1 :r3: win2 :Thus, GLM = fwin1; win2g + EDB =
M.
M is a stable model. Example Consider the program":
pX : pX ; is the only stable model. Why? The only instantiated rules are of the
form pa : pa.
3 The GL transform doesn't a ect these, no
matter what M is.
3 Thus, there is no way to infer any pa. Example For any Datalog program without negation, the
unique LFP is the only stable model.
Why? To test whether M is stable, we
compute GLM .
3 Since there is no negation in bodies, the
surviving instantiated rules are exactly
the ones with true EDB subgoals.
3 Thus, GL infers exactly the LFP for the
EDB portion of M , regardless of what M
is.
3 If we start with the LFP, we infer it,
so that model is stable; if we start with
another model, we still infer the LFP, so
that model is not stable. Propositional Stable Models It is often useful to nd propositional examples.
No EDB in propositional logic.
Thus, only steps 3 and 4, plus the nal
inference, are relevant for the GL transform.
4 Example
p : q; q : NOT r; r : s; s : NOT p M = fp; qg.
After step 3:
p : q; q : NOT r; r : s After step 4:
p : q; q : ; r : s Inference: GLM = fp; qg = M . Multiple Stable Models Possible
Notice that fr; sg is also a stable model of the
above rules. 5 ...
View
Full Document
 Spring '09
 Logic, LFP, EDB, stable models, EDB subgoal

Click to edit the document details