+ All Categories
Home > Documents > 603 Database Systems

603 Database Systems

Date post: 21-Jan-2016
Category:
Upload: deacon
View: 44 times
Download: 0 times
Share this document with a friend
Description:
603 Database Systems. Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 25 A First Course in Database Systems. Deductive Databases. RULES: - PowerPoint PPT Presentation
28
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 25 Lecture 25 A First Course in Database Systems
Transcript
Page 1: 603 Database Systems

603 Database Systems

Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E.

Lecture 25Lecture 25

A First Course in Database Systems

Page 2: 603 Database Systems

Deductive Databases

RULES:

Although formally all variables in a clause are universally quantified, we will sometimes refer to variables that occur in the body of the clause, but not in its head, as if they are existentially quantified inside the body.

Page 3: 603 Database Systems

Deductive DatabasesExample:

grandfather rule can be read:

“For all X and Y, X is the grandfather of Y if there exists a Z such that X is the father of Z and Z is the father of Y.”

(X,Y){(grandfather(X, Y)) ( (Z) | father (X, Z),

father (Z, Y))}.

Page 4: 603 Database Systems

Deductive Databases

Incorporate rules into our framework of logical deduction:

To incorporate rules into our framework of logical deduction, we need the law of modus ponens.

Modus ponens states that from B and A B we can deduce A.

Page 5: 603 Database Systems

Deductive DatabasesThe Law of Universal Modus Ponens:

RULE: R = (A B1 , B2 , ……….Bn )

FACTS: B’1 .

B’ 2 .

.

.

B’ n .

A’ can be deduced, if

A’ B’1 , B’2 , ……….B’n is an instance of R.

Universal Modus Ponens include identity and instantiation as a special cases.

Page 6: 603 Database Systems

Deductive DatabasesComplete definition of the concept of a logic program and its associated concept of logical consequence:

Definition: A logic program is a finite set of rules.

Definition: An existentially quantified goal G is a logical consequence of a program P if there is a clause in P with a ground instance A B1 , B2 , ……….Bn , n 0,

such that are logical consequences of P and A is an instance of G.

Page 7: 603 Database Systems

Deductive DatabasesUniversal Modus Ponens:

Consider the query son(S, haran)?

Rule: son(X,Y) father (Y,X), male(X).

The substitution {X=lot, Y=haran} applied to the rule gives the instance

son(lot, haran) father (haran,lot), male(lot).

Both goals in the body of this rule are facts in the database.

Page 8: 603 Database Systems

Deductive DatabasesUniversal Modus Ponens:

In the previous query the modus ponens implies the query with answer S=lot.

The rule for son is correct, but is an incomplete specification of the relationship.

A new rule expressing this relationship can be added, namely

son(X,Y) mother(Y,X), male(X).

Page 9: 603 Database Systems

Deductive Databases

Grandparent rules:

grandparent(X,Y) father(X,Y), father(Y,Z).

grandparent(X,Y) father(X,Y), mother(Y,Z).

grandparent(X,Y) mother(X,Y), father(Y,Z).

grandparent(X,Y) mother(X,Y), mother(Y,Z).

More precise way of expressing these rules.

Page 10: 603 Database Systems

The Deductive Databases

Rules for son and grandparent:

son(X,Y) parent(Y,X), male(X).

grandparent(X,Y) parent(X,Z), parent(X,Y).

Page 11: 603 Database Systems

Deductive Databases

parent(X,Y) father(X,Y).

parent(X,Y) mother(X,Y).

A collection of rules with the same predicate in the head, such as the pair of parent rules , is called a procedure.

Page 12: 603 Database Systems

Deductive DatabasesAn abstract interpreter for logic programs:Input: A ground query Q and a program P

Output: yes if a proof of Q form P was found,

no otherwise

Algorithm:

Initialize the resolvent to Q

while the resolvent A1 , A2 , ……….An is not empty

begin

choose a goal Ai , 1 i n, and a ground instance of a clause A B1 , B2 , ……….Bn , n 0, in P, such that

A = Ai (If no such clause exists, exit the while loop);

determine the new resolvent

A1 ,... Ai-1 , ………. , B1 , B2 , ……….Bk , Ai+1 ,... An

end

If the resolvent is empty, output yes, otherwise output no.

Page 13: 603 Database Systems

Deductive DatabasesSimple Problem :

If Fido goes wherever John goes and if John is at

School, where is Fido?

Rule: (X ) [At (John, X) At(Fido, X)]

Fact: At(John, School)

Query: ( X ) At (Fido, X)?

Where is Fido?

Rule

Facts

QueryResultant fact(answers)

Deductive Database

Page 14: 603 Database Systems

Deductive DatabasesResolution Process(rule of inference):

Applied to a pair of parent clauses

Produce a derived clause (inferred clause)

Page 15: 603 Database Systems

Deductive DatabasesConversion of Predicate Calculus Formula into clausal form includes the following steps:

Step 1. Remove Implications

X [X, man(X) human(X)]

becomes X [X, ~ man(X) # human(X)]

Step 2. Moving negations inward

~ (human (caesar) & living (caesar))

becomes ~ human(caesar) # ~ living (caesar)

Page 16: 603 Database Systems

Deductive Databases

Conversion of Predicate Calculus Formula into clausal form includes the following steps(continued):

Step 3. Skolemising - removing existential

quantifiers

X (X, female(X) & mother of (X, eve))

etc.

Page 17: 603 Database Systems

Deductive DatabasesOnce we have the PC formula in clausal form we can then apply the resolution process to prove the goal!!

In resolution refutation, we first negate the goal and then add the negation to the set.

The set is then converted to a set of clauses and resolution is used to derive a contradiction, represented by an empty clause, NIL

Page 18: 603 Database Systems

Deductive Databases

When we get NIL,

The answer is provided.

Page 19: 603 Database Systems

Deductive Databases

Fact 1: (X ) [At (John, X) At(Fido, X)] =>Axiom 1

Fact 2: At(John, School)=> Axiom 2

Query:( X ) At (Fido, X)? => conjecture

Where is Fido?

Page 20: 603 Database Systems

Deductive Databases

Resolution Refutation:

Conjecture: ( X ) At (Fido, X)?

Negation of conjecture: ( X ) ~At (Fido, X)?

( X ) ~At (Fido, X) in clausal form is ~At (Fido, X)

Page 21: 603 Database Systems

Deductive DatabasesRefutation TREE(negate the goal):~At (Fido, X) ~At (John, X) # At(Fido, X)

(negation of conjecture) (Axiom 1)

~At (John, X) At(John, School)

(Axiom 2)

NIL (X ) [At (John, X) At(Fido, X)]

in clausal form becomes ~At (John, X) # At(Fido, X) and ~At (Fido, X) + ~At (John, X) # At(Fido, X) becomes ~At (John, X)

~At (John, X) + At(John, School)

becomes NIL

Page 22: 603 Database Systems

Deductive DatabasesExtracting the Answer:

~At (Fido, X) # At(Fido, X) ~At (John, X) # At(Fido, X)

~At (John, X) # At(Fido, X)

At (John, School)

At (Fido, School)

X get bound to School

Page 23: 603 Database Systems

Deductive Databases

Company Database:

Facts: supervise(franklin, john).

supervise(franklin, ramesh).

supervise(franklin, joyce).

supervise(jennifer, alicia).

supervise(jennifer, ahmad).

supervise(james, franklin).

supervise(james, jennifer).

...

Page 24: 603 Database Systems

Deductive Databases

Rules:

superior(X,Y):- supervise(X,Y).

superior(X,Y):- supervise(X,Z), superior(Z,Y).

subordinate(X,Y):-superior(Y,X).

Queries:

superior(james, Y)?

superior(james,joyce)?

Page 25: 603 Database Systems

Deductive Databases

The supervisory TREE:

james

franklin jennifer

john ramesh joyce alicia ahmad

Page 26: 603 Database Systems

Deductive DatabasesFact: supervise predicate

Rules: superior predicate

superior predicate

subordinate predicate

head :- body

conclusion premise

Page 27: 603 Database Systems

Deductive DatabaseQueries:

superior (james, Y)?

superior (james, joyce)?

NOTE: predicate with constant as

argument => ground or instantiated predicate!!

Page 28: 603 Database Systems

Deductive Databases

Next Lecture

MORE Deductive

Databases


Recommended