Negation in Datalog and Its Semantics, Slides of Database Management Systems (DBMS)

The concept of negation in datalog, its problem in meaning, and the different semantics for handling it, such as bottom-up fixpoint evaluation, stratified negation, well-founded semantics, and 3-valued models. It also discusses the drawbacks of non-monotonic reasoning approach to negation and presents an alternative in the form of bottom-up inflationary fixpoint evaluation.

Typology: Slides

2012/2013

Uploaded on 04/24/2013

bandhula
bandhula 🇮🇳

4.7

(10)

91 documents

1 / 65

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Datalog with negation
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41

Partial preview of the text

Download Negation in Datalog and Its Semantics and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

1

Datalog with negation

2

Problem: the meaning of negation

Example 1 (propositional)

p:- NOT qq:- NOT p

Several minimal models/fixpoints:

{p}, {q}

Bottom-up fixpoint evaluation: {p,q}

4

IDB

greenPath(X,Y)

= you can get from

X

to

Y

using only Green buses.

monopoly(X,Y)

= Red has a bus from

X

to

Y

, but you can’t get there on Green, even

changing buses.

5

Rules

greenPath(X,Y) :- green(X,Y)greenPath(X,Y) :-greenPath(X,Z)

& greenPath(Z,Y)

monopoly(X,Y) :- red(X,Y) &

NOT

greenPath(X,Y)

7

Two Minimal Models

EDB + greenPath(1,2) + monopoly(2,3)

EDB + greenPath(1,2) + greenPath(2,3)

  • greenPath(1,3)

greenPath(X,Y) :- green(X,Y)greenPath(X,Y) :- greenPath(X,Z)&

greenPath(Z,Y)

monopoly(X,Y) :- red(X,Y) &

NOT greenPath(X,Y)

1

2

3

8

Syntactic restriction: safety

all variables appear in some positive

relational subgoal of the body.

Start with the join of the positive relational

subgoals and select/delete from there.

10

Semi-positive programs

Simplest case: negate

only

EDB predicates

Redonly(X,Y):- red(X,Y),NOT green(X,Y) Natural meaning:

NOT green(a,b)

is true iff

(a,b)

is not in

green

(closed world assumption)

11

Next step: stratified negation

Idea: if an IDB

R has already been

defined

, then we know what

NOT R

is

“Stratified program”: can be parsed so that each IDB relation is defined byprevious rules before its negation isneeded

13

Stratified programs

Dependency graph

describes how IDB

predicates depend negatively on eachother.

Stratified Datalog

= no recursion

involving negation.

Stratified model

is a particular model

that “makes sense” for stratifiedDatalog programs.

14

Dependency Graph

Nodes = IDB predicates.

Arc

p

q

iff there is a rule for

p

that

has a subgoal with predicate

q

Arc

p

q

labeled – iff there is a

subgoal with predicate

q

that is

negated.

16

Another Example: “Win”

win(X) :- move(X,Y) & NOT win(Y) 

Represents games like Nim where you win by forcing your opponent to a positionwhere they have no move.

17

Dependency Graph for “Win”

win

--

19

Stratified Programs

If all IDB predicates have finite strata, then the Datalog program is s

tratified

If any IDB predicate has the infinite

stratum, then the program isunstratified

, and no stratified model

exists.

20

Stratified Model

Evaluate strata 0, 1,… in order.

If the program is stratified, then any negated IDB subgoal has already beenevaluated.



Safety assures that we can “subtract itfrom something.”



Treat it as EDB.

Result is the stratified model.