380 likes | 543 Views
Computational Logic Lecture 3. Knowledge Model. Michael Genesereth Autumn 2001. Knowledge Model. Data expresses relationships between objects. Knowledge expresses relationships between relations, notably definitions and constraints.
E N D
Computational Logic Lecture 3 Knowledge Model Michael Genesereth Autumn 2001
Knowledge Model Data expresses relationships between objects. Knowledge expresses relationships between relations, notably definitions and constraints. In this course, knowledge is synonymous with logic. father(x,y) :- parent(x,y) male(x) NB: In this course, we concentrate only on data integration, not knowledge integration. However, as we shall see, logic is useful for encoding mapping knowledge.
Databases Each row in a relation can be represented as an atomic sentence. A database is an arbitrary set of atomic sentences in which all arguments are constants.
Rule Bases • A rule base is a set of logical expressions, called rules. • Types of Rules • Simple Rules • Functional Rules • Negative Rules • Disjunctive Rules • Semantics • Evaluative Semantics - whether database satisfies rule • Constructive Semantics - consequences of rules on partial databases to produce more complete databases
Simple Rules A simple rule is an expression in the following form. subgoal … subgoal head body where p is a relation constant xi and xijare constants or variables
Rule Instances An instance of a rule is an expression obtained by consistently replacing variables with constants from a Herbrand universe (the set of constants used in a database). Sample Rule: Universe of Discourse: Instances: Non-Instances:
Single Rule Semantics A database D satisfies a simple rule if and only if, for every instance, if all of the subgoals are in D, then the head is in D. Sample Rule: Databases that does not satisfy this rule: Databases that satisfy this rule:
Multiple Rule Semantics A database satisfies a set of rules if and only if it satisfies each of the rules in the set. Sample Rules: Database that satisfies the rules: Database that does not satisfy the rules:
Functional Rules A functional rule is one containing functional terms. A database D satisfies a functional rule if and only if functional constants name functions on the universe of discourse such that, for every instance, when functional terms are replaced by their values, if all of the subgoals are in D, then the head is in D. Database that satisfies this rule: Database that does not satisfy this rule
Negative Rules A negative rule is one with a negation in the head or body. A database D satisfies a negative rule if and only if, for every instance, if all of the positive subgoals are in D and none of the negative subgoals are in D, then the head is in D if positive or the head is not in D if negative. Database that satisfies this rule:
Disjunctive Rules A disjunctive rule is one with more than one element in the head. A database D satisfies a disjunctive rule if and only if, for every instance, if all of the subgoals are in D, then at leastone of the consequences from the is in D. Database that satisfies this rule:
Negation and Disjunction Disjunction Conjunctive Normal Form Negation
Extensional and Intensional Relations Typical database applications start with a partial database,i.e. tables for some relations (the extensional relations) and not others (the intensional relations). Rules are then written to define the intensional relations in terms of the extensional relations. rules Extensional Intensional
Closure Given an extensional database D and a knowledge base K, we can obtain the corresponding closure by computing all supersets of D that satisfies the rules and taking their intersection. Note the closure of D and K does not necessarily satisfy K. Database: Satisfiers: Rulebase: Closure:
Safety A rule is safe if and only if every variable in the head appears in some subgoal in the body. Safe Rule: Unsafe Rule: In this course, we look only at rules that are safe.
Dependency Graph The dependency graph for a set of rules is a directed graph in which (1) the nodes are the relations mentioned in the head and bodies of the rules and (2) there is an arc from a node p to a node q whenever p occurs with the body of a rule in which q is in the head. t s r p q A set of rules is recursive if it contains a cycle. Otherwise, it is non-recursive.
Single Rule The value of a single non-recursive rule on a database D is the set of all rule heads obtained by consistently substituting constants from D for variables in such a way that the substituted subgoals are all in D. Sample Rule: Sample Database: Value:
Multiple Rules The value of a set ofrules with a common relation on a database D is the union of the values on the individual rules. Sample Rules: Sample Database: Value:
Multiple Relations The value of a set of non-recursive rules with different head relations is obtained by evaluating rules in order in which their head relations appear in the corresponding dependency graph. Sample Rules: Value Computation:
Recursion To compute the value of a recursive rule, start with the empty relation. Compute the value using multiple rule computation. Iterate till no new tuples are added. Sample Rules: Value Computation:
Functional Rules Computation is the same as for simple rules. However, the occurrence of a functional term in the head of a rule means that functional terms may appear in the value of the rule. Sample Rule: Sample Database: Value:
Utility of Functional Rules Definition: Definition: Expansion of gggp(x,z):
Negation There are various ways to compute the value of negative rules. In negation as failure, a negation is true if and only if the negated sentence is not known to be true. This is the norm in database systems. In classical negation, a negation is true only if the negated sentence is known to be false (i.e. there must be rules concluding negated sentences). This is the norm in computational logic systems. In semipositive negation, the negation of an extensional relation is treated using negation as failure and the negation of an intensional relation is treated as classical negation.
Negation as Failure Definition: Value Computation:
Negation as Failure Definition: Value Computation:
Classical Negation Definition: Value Computation:
Classical Negation Definition: Value Computation:
Semipositive Negation Definition: Value Computation:
Knowledge Interchange Format Simple Prefix Notation (teaches jennifer cs145) (teacher mike cs157) (teacher mike cs246) (teacher zohar cs157) Mathematical Notation, aka Epilog/Prolog teaches(jennifer, cs145) teaches(mike, cs157) teaches(mike, cs246) teaches(zohar, cs157)
Multiple Rule Formats Epilog/Prolog QBE KIF