Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Enrico Franconi
franconi@cs.man.ac.uk http://www.cs.man.ac.uk/franconi
Department of Computer Science, University of Manchester
(1/27
Knowledge bases
Inference engine Knowledge base
Knowledge base = set of sentences in a formal language = logical theory Declarative approach to building an agent (or other system): T ELL it what it needs to know
Then it can A SK itself what to doanswers should follow from the KB Agents can be viewed at the knowledge level i.e., what they know, regardless of how implemented
Or at the implementation level i.e., data structures in KB and algorithms that manipulate them
(2/27
Logic in general
Logics are formal languages for representing information such that conclusions can be drawn
Syntax denes the sentences in the language Semantics dene the meaning of sentences; i.e., dene truth of a sentence in a world
x + 2 y is a sentence; x2 + y > is not a sentence x + 2 y is true iff the number x + 2 is no less than the number y x + 2 y is true in a world where x = 7, y = 1 x + 2 y is false in a world where x = 0, y = 6 x + 2 x + 1 is true in every world
(3/27
(4/27
Types of logic
Logics are characterized by what they commit to as primitives Ontological commitment: what existsfacts? objects? time? beliefs? Epistemological commitment: what states of knowledge?
Ontological Commitment (What exists in the world) facts facts, objects, relations facts, objects, relations, times facts degree of truth Epistemological Commitment (What an agent believes about facts) true/false/unknown true/false/unknown true/false/unknown degree of belief 01 degree of belief 01
Language Propositional logic First-order logic Temporal logic Probability theory Fuzzy logic
(5/27
E.g., the KB containing Manchester United won and Manchester City won entails Either Manchester United won or Manchester City won
(6/27
Models
Logicians typically think in terms of models, which are formally structured worlds with respect to which truth can be evaluated
or
(7/27
KB
Soundness:
Completeness:
We will dene a logic (rst-order logic) which is expressive enough to say almost anything of interest, and for which there exists a sound and complete inference procedure.
(8/27
The block is red The proof of the pudding is in the eating It is raining
and logical connectives and, or, not, by which we can build propositional formulas.
(9/27
|=
can we dene deduction in such a way that deduction and entailment coincide?
(10/27
a, b, c, . . ..
atomic formula false true
, a | |
Propositional formulas:
| | | | |
implication equivalence
(11/27
Semantics: Intuition
Atomic statements can be true T or false F. The truth value of formulas is determined by the truth values of the atoms (truth value assignment or interpretation).
Example:
(a b) c
If a and b are wrong and c is true, then the formula is not true. Then logical entailment could be dened as follows:
(12/27
Semantics: Formally
A truth value assignment (or interpretation) of the atoms in is a function I :
I: {T, F}.
Instead of I(a) we also write aI . A formula is satised by an interpretation I (I
|= ) or is true under I :
I |= I |= I |= a I |= I |= I |=
iff iff iff iff
(13/27
Example
a T b F c F d T . . .
I:
(14/27
Exercise
Find an interpretation and a formula such that the formula is true in that interpretation (or: the interpretation satises the formula).
Find an interpretation and a formula such that the formula is not true in that interpretation (or: the interpretation does not satisfy the formula).
Find a formula which cant be true in any interpretation (or: no interpretation can satisfy the formula).
(15/27
I |=
A formula is
satisable, if there is some I that satises , unsatisable, if is not satisable, falsiable, if there is some I that does not satisfy , valid (i.e., a tautology), if every I is a model of .
), if for all I :
I |= iff I |=
(16/27
Exercise
Satisable, tautology?
(((a b) a) b) (( ) ( )) (a b c) (a b d) (a b d)
Equivalent?
( ( )) (( ) ( )) ( )
(17/27
Consequences
Proposition:
Proposition:
Theorem: If and are equivalent, and results from replacing in by , then and are equivalent.
(18/27
Entailment
Extension of the entailment relationship to sets of formulas :
|= ):
(19/27
= A B and KB = (A C) (B C) |= ?
AC
B C
KB
(20/27
= A B and KB = (A C) (B C) |= ?
B C
KB
(20/27
= A B and KB = (A C) (B C) |= ?
KB
(20/27
= A B and KB = (A C) (B C) |= ?
(20/27
= A B and KB = (A C) (B C) |= ?
(20/27
Properties of Entailment
{} |= iff |=
(Deduction Theorem)
{} |= iff {} |=
(Contraposition Theorem)
{} is unsatisable iff |=
(Contradiction Theorem)
(21/27
Equivalences (I)
Commutativity
Associativity
( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )
Idempotence
Absorption
Distributivity
(22/27
Equivalences (II)
Tautology Unsatisability Negation
Neutrality
Double Negation De Morgan
( ) ( )
Implication
(23/27
Normal Forms
Other approaches to inference use syntactic operations on sentences, often expressed in standardized forms Conjunctive Normal Form (CNF) conjunction of disjunctions of literals: clauses E.g., (A B) (B
n i=1 ( m j=1 li,j )
C D)
n i=1 ( m j=1 li,j )
C) (B D)
(24/27
1 positive literal)
C D)
B A and (C D) B
Theorem For every formula, there exists an equivalent formula in CNF and one in DNF.
(25/27
We can transform propositional formulas, in particular, we can construct their CNF and DNF.
DNF tells us something as to whether a formula is satisable. If all disjuncts contain or complementary literals, then no model exists. Otherwise, the formula is satisable.
CNF tells us something as to whether a formula is a tautology. If all clauses (= conjuncts) contain or complementary literals, then the formula is a tautology. Otherwise, the formula is falsiable.
But:
the transformation into DNF or CNF is expensive (in time/space) it is only possible for nite sets of formulas
(26/27
Syntax: formula, atomic formula, literal, clause Semantics: truth value, assignment, interpretation Formula satised by an interpretation Logical implication, entailment Satisability, validity, tautology, logical equivalence Deduction theorem, Contraposition Theorem Conjunctive normal form, Disjunctive Normal form, Horn form
(27/27