1 / 28

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 25 A First Course in Database Systems. Deductive Databases. RULES:

deacon
Télécharger la présentation

603 Database Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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.

  3. Deductive Databases Example: 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))}.

  4. 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.

  5. Deductive Databases The 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.

  6. Deductive Databases Complete 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.

  7. Deductive Databases Universal 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.

  8. Deductive Databases Universal 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).

  9. 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.

  10. 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).

  11. 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.

  12. Deductive Databases An 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 , ……….Anis 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.

  13. Deductive Databases Simple 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? Deductive Database Rule Facts Query Resultant fact(answers)

  14. Deductive Databases Resolution Process(rule of inference): Applied to a pair of parent clauses Produce a derived clause (inferred clause)

  15. Deductive Databases Conversion 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)

  16. 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.

  17. Deductive Databases Once 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

  18. Deductive Databases When we get NIL, The answer is provided.

  19. 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?

  20. 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)

  21. Deductive Databases ~At (John, X) At(John, School) (Axiom 2) Refutation TREE(negate the goal): ~At (Fido, X) ~At (John, X) # At(Fido, X) (negation of conjecture) (Axiom 1) (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) NIL ~At (John, X) + At(John, School) becomes NIL

  22. Deductive Databases ~At (John, X) # At(Fido, X) ~At (Fido, X) # At(Fido, X) ~At (John, X) # At(Fido, X) Extracting the Answer: At (John, School) X get bound to School At (Fido, School)

  23. 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). ...

  24. 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)?

  25. Deductive Databases franklin jennifer The supervisory TREE: james john ramesh joyce alicia ahmad

  26. Deductive Databases Fact: supervise predicate Rules: superior predicate superior predicate subordinate predicate head :- body conclusion premise

  27. Deductive Database Queries: superior (james, Y)? superior (james, joyce)? NOTE: predicate with constant as argument => ground or instantiated predicate!!

  28. Deductive Databases Next Lecture MORE Deductive Databases

More Related