Sei sulla pagina 1di 93

Artificial Intelligence Lecture 5

JSS/LEC006/ITT/R000/V001/DT 240704

/41

Knowledge Representations
1. First Order Predicate Calculus

2. Skolemization
3. Resolution principal & Unification 4. Inference Mechanisms 5. Horns Clauses 6. Semantic Networks

Next
JSS/LEC006/ITT/R000/V001/DT 240704

End

/41

Knowledge Representations
7. Frame System and Value Inheritance 8. Scripts 9. Conceptual Dependency

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

/41

knowledge Representation
Assumption of (traditional) AI work is that: Knowledge may be represented as symbol structures (essentially, complex data structures) representing bits of knowledge (objects, concepts, facts, rules, strategies..). E.g., red represents colour red. car1 represents my car. red(car1) represents fact that my car is red. Intelligent behaviour can be achieved through manipulation of symbol structures

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

/41

Knowledge Representation
Knowledge Representation Language A KR language should allow you to: represent adequately the knowledge you need for your problem (representational adequacy) do it in a clear, precise and natural way. allow you to reason on that knowledge, drawing new conclusions.

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

/41

Knowledge Representation
Representational adequacy:

Consider the following facts:

John believes no-one likes brussel sprouts. Most children believe in Santa. John will have to finish his assignment before he

Can all be represented as a string! But hard then to manipulate and draw conclusions. How do we represent these formally in a way that can be manipulated in a computer program?

JSS/LEC006/ITT/R000/V001/DT 240704

can start working on his project.

Previous

Next

End

/41

Knowledge Representation
Some notations/languages only allow you to represent certain things.
Time, beliefs, uncertainty, all hard to

represent.

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

/41

Knowledge Representation
In other word through knowledge representation we are representing facts. there are few entities which must be discussed:
Facts-Truths

in some relevant world.these are the things we want to represent.


Representation

formalism

of facts in some chosen

JSS/LEC006/ITT/R000/V001/DT 240704

/41

Knowledge Representation
we can structure these entity in two
levels: 1.The knowledge level, at which facts are described. 2.the symbol level,at which representation of object at the knowledge level are defined in terms of symbol that can be manipulated by program

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

/41

Knowledge Representation

Facts

*
* English

Internal Representaion Reasoning

Programs

understanding

English Representation English


generation

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

10

/41

Knowledge Representation
Approaches to Knowledge Representation Representation Adequacy-the ability to represent all kind of knowledge that are needed in that domain. Acquisitional Efficiency-the ability to acquire new information easily .

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

11

/41

Knowledge Representation(cont..)
Inferential Adequacy
Representing knowledge not very interesting unless you can use it to make inferences: Draw new conclusions from existing facts. If its raining John never goes out + Its raining today so.. Come up with solutions to complex problems, using the represented knowledge. Inferential adequacy refers to how easy it is to draw inferences using represented knowledge. Representing everything as natural language strings has good representational adequacy and naturalness, but very poor inferential adequacy.
Previous Next End
12 /41

JSS/LEC006/ITT/R000/V001/DT 240704

Knowledge Representation
Logic as a Knowledge Representation Language A Logic is a formal language, with precisely defined syntax and semantics, which supports sound inference. Independent of domain of application. Different logics exist, which allow you to represent different kinds of things, and which allow more or less efficient inference.
propositional logic, predicate logic, temporal

logic, modal logic, description logic..

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

13

/41

Knowledge Representation(continue)

But representing some things in logic may not be very natural, and inferences may not be efficient. More specialised languages may be better..

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

14

/41

First Order Predicate Calculus


we use the following symbols for whole topic: Material implication= Not Or = =

And
for all there exits

=
= =

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

15

/41

First Order Predicate Calculus


Predicate calculus sentences
Every atomic sentence is a sentence. 1. If s is a sentence, then so is its negation, s. If s1 and s2 are sentences, then so is their 2. Conjunction, s1 s2 . 3. Disjunction, s1 s2 . 4. Implication, s1 s2 .

JSS/LEC006/ITT/R000/V001/DT 240704

16

/41

First Order Predicate Calculus


If X is a variable and s is a sentence, then so are

6. X s. 7. X s.

Remember that logic sentences evaluate to true or false, therefore only such objects are atomic sentences. Functions are not atomic sentences.

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

17

/41

First Order Predicate Calculus


How to compute the truth value of predicate calculus expressions.
Assume an expression E and an interpretation I over E over a nonempty domain D. The truth value for E is determined by:
1. The value of a constant is the element of D it is assigned to by I. 2. The value of a variable is the set of elements of D it is assigned to by I.

3. The value of a function expression is that element of D obtained by evaluating the function for the parameter values assigned by the interpretation.
JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

18

/41

First Order Predicate Calculus


4. The value of the truth symbol true is T, and false is F. 5. The value of an atomic sentence is either T or F, as determined by the interpretation I. 6. The value of the negation of a sentence is T if the value of the sentence is F, and F if the value of the sentence is T. 7. The value of the conjunction of two sentences is T, if the value of both sentences is T and F otherwise.

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

19

/41

First Order Predicate Calculus


Finally, for a variable X and a sentence S containing X: 11. The value of X S is T if S is T for all assignments to X under I, and it is F otherwise. 12. The value of X S is T if there is an assignment to X under I such that S is T, and it is F otherwise

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

20

/41

First Order Predicate Calculus


Revisit and
A persons mother is that persons parent. X person (X) parent(mother-of(X),X) vs. X person (X) parent(mother-of(X),X) I: joe, jane are people fido is a dog person (joe) is T, person (jane) is T person (fido) is F, dog (fido) is T mother-of (joe) is jane

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

21

/41

First Order Predicate Calculus


First-order predicate calculus allows quantified
variables to refer to objects in the domain of discourse and not to predicates or functions. John likes to eat everything. X food(X) likes (john,X) John likes at least one dish Jane likes. F food(F) likes (jane, F) likes (john, F)

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

22

/41

First Order Predicate Calculus

In predicate logic ,we can represent real world facts as statements written as well form formulas.

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

23

/41

First Order Predicate Calculus


one more example consider the following sentences; 1.Marcus was a man 2.Marcus was a Pompeian

3.All Pompeians were Romans


4.Caesar was a ruler

5.All Romans were either loyal to Caesar or hated him


JSS/LEC006/ITT/R000/V001/DT 240704
24 /41

First Order Predicate Calculus


6.Everyone is loyal to someone 7.people only try to assassinate rulers they are not loyal to. 8.Marcus tried to assassinate Caesar.

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Continue

End

25

/41

First Order Predicate Calculus


The facts can be represented as a set of wffs in predicate logic as follows: 1.Marcus was a man. man(Marcus) 2.Marcus was a Pompeian. Pompeian(Marcus) 3. All Pompeians were Romans. x:pompeians(x) Roman(x)

4.Caesar was a ruler.


ruler(Caesar)
JSS/LEC006/ITT/R000/V001/DT 240704
26 /41

First Order Predicate Calculus


5.All Romans were either loyal to Caesar or hated him.

x:Roman(x) loyalto(x,Caesar) v hate(x,Caesar) OR x:Roman(x) [(loyalto(x,Caesar) v hate(x,Caesar))


(loyalto(x,Caesar) hate(x,Caesar)) ]

JSS/LEC006/ITT/R000/V001/DT 240704

27

/41

First Order Predicate Calculus


6.Everyone is loyal to someone.

x: y:loyalto(x,y)
7.people only try to assassinate rulers they are not loyal to.

x: y:person(x) ruler(y) tryassassinate(x,y) loyalto(x,y)


8.Marcus tries to assassinate Caesar. tryassassinate(Marcus,Caesar)

JSS/LEC006/ITT/R000/V001/DT 240704

28

/41

First Order Predicate Calculus


now suppose that we want to use these sentences to answer the question.

Was Marcus loyal to Caesar?


means loyalto(Marcus,Caesar) we know that Marcus was a man but we do not have any way to conclude that Marcus was a person.we need to add one more sentence namely

9.All men are people.

x:man(x)person(x)
JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Next

End

29

/41

First Order Predicate Calculus


An attempt to prove loyalto(Marcus,Caesar)
loyalto(Marcus,Caesar) (7) person(Marcus) ruler(Caesar) tryassassinate(Marcus,Caesar) (4) person(Marcus) tryassassinate(Marcus,Caesar) (8) person(Marcus)

JSS/LEC006/ITT/R000/V001/DT 240704

30

/41

First Order Predicate Calculus


Representing Instance and Isa Relationship three ways to represent class membership 1.man(Marcus) 2.Pompeian(Marcus) 3.x:Pompeian(x) Roman(x) 4.ruler(Caesar) 1.instance(Marcus,man) 2.instance(Marcus,Pompeian)

JSS/LEC006/ITT/R000/V001/DT 240704

31

/41

First Order Predicate Calculus(cont..)


3. x:instance(x,Pompeian) instance(x,Roman) 4.instance(Caesar,ruler) 5.

x:instance(x,Roman) hate(x,Caesar)

loyalto(x,Caesar) v

1. instance(Marcus,man) 2.instance(Marcus,Pompeian) 3.isa(Pompeian,Roman) 4.instance(Caesar,ruler) 5.

x:instance(x,Roman) hate(x,Caesar)

loyalto(x,Caesar) v
32 /41

JSS/LEC006/ITT/R000/V001/DT 240704

5. 6.

First Order Predicate Calculus(cont..)

x:instance(x,Roman) hate(x,Caesar)

loyalto(x,Caesar) v

x:y:z:instance(x,y) isa(y,z)

instance(x,z)

JSS/LEC006/ITT/R000/V001/DT 240704

33

/41

Skolemization
Introduction of constants or functions when

removing existential quantifier. There exists an x such that P(x) becomes: P(A) for some new constant symbol A. example Everyone has someone who loves him For all x, Loves(F(x),x) where F(x) is a new function.

JSS/LEC006/ITT/R000/V001/DT 240704

34

/41

Resolution principle

resolution is such a procedure which gain its efficiency from the fact that it operates on the statement that have been converted to a very convenient standard form. means resolution attempts to show that the negation of the statement produces contradiction with the known statement

JSS/LEC006/ITT/R000/V001/DT 240704

35

/41

Resolution principle

Conversion to Clause Form

All Romans who know Marcus either hate Caesar or think that anyone who hates anyone is crazy

Algorithm: Eliminate ,using the fact a b is equivalent to a v b ex- x : [Roman(x) know(x,Marcus)] v[hate(x,Caesar) v (y: z:hate(y,z) v thinkcrazy(x,y))]

x :[Roman(x) know(x,Marcus)] [hate(x,Caesar) v (y: z:hate(y,z) thinkcrazy(x,y))]

JSS/LEC006/ITT/R000/V001/DT 240704

36

/41

Resolution principle
2.Reduce the scope of to a single term,using the fact that (p)=p.

x:[Roman(x) v know(x,Marcus)] [hate(x,Caesar) v (y:z: hate(y,z) v


thinkcrazy(x,y))]

3.Standardize variables so that each quantifier binds a unique variable. ex- x:P(x)v x:Q(x) would be converted to x:P(x)v y:Q(y)

JSS/LEC006/ITT/R000/V001/DT 240704

37

/41

Resolution principle
4.Move all quantifier to the left of the formula without changing their relative order. x: y:z:[Roman(x) v know(x,Marcus)] v [hate(x,Caesar) v(hate(y,z) v thinkcrazy(x,y))] 5.Eliminate essential quantifiers. ex1- y:President(y) can be transformed into the formula President(S1) where S1 is the formula with no argument. ex12- x:y: father-of(y,x) can be transformed into x :father-of(S2(x),x)
38 /41

JSS/LEC006/ITT/R000/V001/DT 240704

Resolution principle
6.Drop the prefix. [Roman(x) v know(x,Marcus)] v [hate(x,Caesar) v(hate(y,z) v thinkcrazy(x,y))] 7.Convert the matrix into conjunction of disjunction. Roman(x) v know(x,Marcus) v hate(x,Caesar) v hate(y,z) v thinkcrazy(x,y) 8.Create a separate clause for each conjunct. 9.Standardize apart the variable in the set of clause generated in step 8. (x:P(x)

Q(x))= x:P(x) x:Q(x)


39 /41

JSS/LEC006/ITT/R000/V001/DT 240704

Unification
Contradiction
man(john) and man(john) In order to determine contradiction,we need a matching procedure that compares two literals and discovers whether there exits a substitution that make them identical,there is straightforward recursive procedure unification algorithm that does this .

JSS/LEC006/ITT/R000/V001/DT 240704

40

/41

Unification
Algorithm:unify(L1,L2) 1.If L1 or L2 are both variable and constant, then (a)if L1 and L2 are identical then return NIL.

(b)Else if L1 is a variable ,then if L1 occurs in L2 then return {FAIL},else return(L2\L1).


(c)Else if L2 is a variable then if L2 occurs in L1 then return {FAIL},else return(L1\L2). (d)Else return {FAIL}.
JSS/LEC006/ITT/R000/V001/DT 240704
41 /41

Unification
2.if the initial predicate symbol in L1 and L2 are not identical ,then return {FAIL}. 3.if L1 and L2 have different number of argument ,then return {FAIL}. 4.set SUBST to NIL (at the end of this procedure,SUBST will contain all the substitution used to unify L1 and L2) 5.For i 1 the number of the arguments in L1: (a) Call Unify with the ith argument of L1 and ith argument of L2,putting result in S. (b) If S contain FAIL then return {FAIL}
JSS/LEC006/ITT/R000/V001/DT 240704
42 /41

Unification
c)if S is not equal to NIL then: i.apply S to the remainder of both L1 and L2. ii. SUBST:=APPEND(S,SUBST). 6.Return SUBST.

JSS/LEC006/ITT/R000/V001/DT 240704

43

/41

Unification
Make sentences look alike. Unify p(a,X) and p(a,b) Unify p(a,X) and p(Y,b) Unify p(a,X) and p(Y, f(Y)) Unify p(a,X) and p(X,b) Unify p(a,X) and p(Y,b) Unify p(a,b) and p(X, X)

JSS/LEC006/ITT/R000/V001/DT 240704

44

/41

Unification
Unify

p(a,X) and p(a,b) answer: b/X p(a,b) Unify p(a,X) and p(Y,b) answer: a/Y, b/X p(a,b) Unify p(a,X) and p(Y, f(Y)) answer: a/Y, f(a)/X p(a,f(a))

JSS/LEC006/ITT/R000/V001/DT 240704

45

/41

Unification
Unify

p(a,X) and p(X,b) failure Unify p(a,X) and p(Y,b) answer: a/Y, b/X Unify p(a,b) and p(X,X) failure

p(a,b)

JSS/LEC006/ITT/R000/V001/DT 240704

46

/41

Inference Mechanisms

JSS/LEC006/ITT/R000/V001/DT 240704

47

/41

Horn Clause
A horn clause is a clause that has at most one positive literal. example: p, p v q and p q p q does not look like horn clause but we know that any logical expression can be converted into clause form so after conversion the resulting clause is p v q horn clauses are written in PROLOG program.
JSS/LEC006/ITT/R000/V001/DT 240704
48 /41

Semantic Network
Information is represented as a set of nodes connected to each other by set of labeled arcs,which represent the relationship among the nodes. Semantic nets is that meaning of the concept comes from the ways in which it is connected to the other concepts.

JSS/LEC006/ITT/R000/V001/DT 240704

49

/41

Semantic Network

JSS/LEC006/ITT/R000/V001/DT 240704

50

/41

Semantic Network
Mammal
isa

Person

has-part

Nose

instance

Blue

uniform-color

Pee-Wee-Reese
team

Brooklyn-Dodgers
JSS/LEC006/ITT/R000/V001/DT 240704
51 /41

Semantic Network
Intersection Search
Semantic nets were used was to find relationship among objcts by spreading activation out from each of two nodes and seeing where the activation met. ex-what is the relation between the Brooklyn Dodgers and blue?

JSS/LEC006/ITT/R000/V001/DT 240704

52

/41

Semantic Network
Representing Nonbinary Predicates
Semantic nets are a natural way to represent relationships that would appear as a ground instance of binary predicate in predicate logic ex-isa(Person,Mammal) instance(Pee-Wee-Reese,person) team(Pee-Wee-Reese,Brooklyn-Dodgers) uniform-color(Pee-Wee-Reese,Blue)

JSS/LEC006/ITT/R000/V001/DT 240704

53

/41

Semantic Network
Making some important distinction
There should be a difference between a link that defines a new entity and one that relates two existing entities. ex- consider the net height john
72

Both node represent objects that exits independently of their relationship to each other.
JSS/LEC006/ITT/R000/V001/DT 240704
54 /41

Semantic Network
suppose we want to show the fact that john is taller than Bill,using the net
John Bill

height H1 greater than

height
H2

JSS/LEC006/ITT/R000/V001/DT 240704

55

/41

Semantic Network
H1=Johns height and H2=Bills height . Using these concept ,it is possible to represent such a facts as that Johns height increased.

JSS/LEC006/ITT/R000/V001/DT 240704

56

/41

Frame System
A frame is a collection of attributes and associated values that describe some entity in the world A single frame taken alone is rarely useful. we build frame systems out of collections of frame that are connected to each other by virtue of the fact that the value of an attribute of one frame may be another frame.

JSS/LEC006/ITT/R000/V001/DT 240704

57

/41

Frame Systems
Also

called schemas Similar to semantic networks, but all the information relevant to an object is held inside the node Frames have two main parts:
Slots which hold variable data Fixed parts which hold static data

Data

inside the frame can be of any kind, including proceedures


58 /41

JSS/LEC006/ITT/R000/V001/DT 240704

Frame Systems
b

Panda
Colour: black and white NoEars: 2 Food: Bamboo EatFunc: .. Name: Height: Age: 0 Fixed part

Slot

JSS/LEC006/ITT/R000/V001/DT 240704

59

/41

Frame Systems

Panda Bamboo Type: Plant GrowFunc: .. Location: Height: 2 Type: Animal Colour: Black and white Food: EatFunc: .. Name: Height: Age: 0 Sibling

Jenny

Name: Jenny Height: 1.6 Age: 5 Sibling:


Vicky Name: Vicky Height: 0.7 Age: 1 Sibling:

JSS/LEC006/ITT/R000/V001/DT 240704

60

/41

Frame Systems
For a knowledge representation system to represent a changing world, it must be able to change itself Archetypes of frames exist, when the system finds a new object it searches the archetypes for something that looks like the new object When a suitable archetype is found, a new instantiation of that archetype is made

For instance Jenny and Vicky are instantiations of

the Panda archetype

JSS/LEC006/ITT/R000/V001/DT 240704

61

/41

Frame Systems

Frames are often said to be nested


E.g. the Vicky frame is nested within the Panda

frame, and the Bamboo frame is nested within the Panda frame

The data inside a frame can come from various places:


By inheritance from a super-class, or a nested

class From default values from the super-class By the execution of proceedures within frames

When a frame is instantiated it attempts to fill all its slots, using the above methods
62 /41

JSS/LEC006/ITT/R000/V001/DT 240704

It is difficult to implement some logical relationships between concepts How could you represent the fact that a panda is either male OR female? Or that a person prefers either trains Or aeroplanes What about the there exists relationship there exists a person who does not like chocolate? For frames, instantiating new frames by matching to archetypes is very difficult How closely must a new concept match an archetype before it is instantiated?

JSS/LEC006/ITT/R000/V001/DT 240704
63 /41

Semantic Networks and Frames Some Problems

Conceptual Dependency

JSS/LEC006/ITT/R000/V001/DT 240704

64

/41

JSS/LEC006/ITT/R000/V001/DT 240704

65

/41

JSS/LEC006/ITT/R000/V001/DT 240704

66

/41

JSS/LEC006/ITT/R000/V001/DT 240704

67

/41

JSS/LEC006/ITT/R000/V001/DT 240704

68

/41

JSS/LEC006/ITT/R000/V001/DT 240704

69

/41

JSS/LEC006/ITT/R000/V001/DT 240704

70

/41

JSS/LEC006/ITT/R000/V001/DT 240704

71

/41

JSS/LEC006/ITT/R000/V001/DT 240704

72

/41

JSS/LEC006/ITT/R000/V001/DT 240704

73

/41

JSS/LEC006/ITT/R000/V001/DT 240704

74

/41

JSS/LEC006/ITT/R000/V001/DT 240704

75

/41

JSS/LEC006/ITT/R000/V001/DT 240704

76

/41

JSS/LEC006/ITT/R000/V001/DT 240704

77

/41

JSS/LEC006/ITT/R000/V001/DT 240704

78

/41

JSS/LEC006/ITT/R000/V001/DT 240704

79

/41

JSS/LEC006/ITT/R000/V001/DT 240704

80

/41

JSS/LEC006/ITT/R000/V001/DT 240704

81

/41

JSS/LEC006/ITT/R000/V001/DT 240704

82

/41

JSS/LEC006/ITT/R000/V001/DT 240704

83

/41

JSS/LEC006/ITT/R000/V001/DT 240704

84

/41

JSS/LEC006/ITT/R000/V001/DT 240704

85

/41

JSS/LEC006/ITT/R000/V001/DT 240704

86

/41

JSS/LEC006/ITT/R000/V001/DT 240704

87

/41

JSS/LEC006/ITT/R000/V001/DT 240704

88

/41

JSS/LEC006/ITT/R000/V001/DT 240704

89

/41

JSS/LEC006/ITT/R000/V001/DT 240704

90

/41

JSS/LEC006/ITT/R000/V001/DT 240704

91

/41

JSS/LEC006/ITT/R000/V001/DT 240704

92

/41

End of This Session

JSS/LEC006/ITT/R000/V001/DT 240704

Previous

Quit

93

/41

Potrebbero piacerti anche