1 knowledge representation. 2 definitions knowledge base knowledge base a set of representations of...

22
1 1 Knowledge Knowledge Representation Representation

Upload: suzanna-hines

Post on 13-Jan-2016

241 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

11

Knowledge Knowledge RepresentationRepresentation

Page 2: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

22

DefinitionsDefinitions

Knowledge BaseKnowledge Base A set of representations of facts A set of representations of facts

about the world.about the world. Each representation is a Each representation is a

sentencesentence.. Knowledge RepresentationKnowledge Representation

Expressing knowledge in a form Expressing knowledge in a form that can be manipulated by a that can be manipulated by a computer.computer.

Inference MechanismInference Mechanism Generates new sentences that Generates new sentences that

are necessarily true given that are necessarily true given that the old sentences are true.the old sentences are true.

Page 3: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

33

Two aspects of the Knowledge Two aspects of the Knowledge Representation language:Representation language:1.1. Formal system of Formal system of

defining the worlddefining the world SyntaxSyntax

What constitutes a sentenceWhat constitutes a sentence SemanticsSemantics

Meaning. Connects sentences to facts.Meaning. Connects sentences to facts.

KB entails a (KB |= a)KB entails a (KB |= a) means means when when allall

sentences in KB are true, a is true.sentences in KB are true, a is true.

((|= means entailment)|= means entailment)

2.2. A proof theory A proof theory Rules for determining all entailments.Rules for determining all entailments.

(KB |-- a)(KB |-- a)

Page 4: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

44

KR LanguagesKR Languages

LogicLogic Propositional LogicPropositional Logic First Order LogicFirst Order Logic

Production rulesProduction rules Structured ObjectsStructured Objects

Semantic NetsSemantic Nets FramesFrames ScriptScript

Page 5: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

55

LogicLogic Logic is reasoning Logic is reasoning

technique. It is the study technique. It is the study of rules of inference and of rules of inference and the principles of sound the principles of sound argument.argument.

Much of the basis of Expert systems reasoning comes from logic

Page 6: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

66

Reasoning(inferencingReasoning(inferencing) Strategies) Strategies

DeductionDeduction

InductionInduction

AbductionAbduction

Page 7: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

77

DeductionDeduction This process takes general This process takes general

principles and applies the principles and applies the specific instances to infer a specific instances to infer a conclusionconclusion

All dogs have hairAll dogs have hair Lassie is a dogLassie is a dog

We can deduce that Lassie has We can deduce that Lassie has hair.hair.

Page 8: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

88

Deduction (cont…)Deduction (cont…) Deduction uses major and Deduction uses major and

minor premisesminor premises A major premise can have A major premise can have

many minor premisesmany minor premises All minor premises must be All minor premises must be

true for a deduction to be true for a deduction to be mademade..

This is a limitation of This is a limitation of deductiondeduction

Page 9: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

99

InductionInduction

This process uses a number of This process uses a number of established facts or premises to established facts or premises to draw some general conclusion.draw some general conclusion. 1994 Cat show all Siamese cats had 1994 Cat show all Siamese cats had

blue eyes.blue eyes. 1995 Cat show all Siamese cats had 1995 Cat show all Siamese cats had

blue eyes.blue eyes. 1996 Cat show all Siamese cats had 1996 Cat show all Siamese cats had

blue eyes.blue eyes. Conclusion all Siamese cats have Conclusion all Siamese cats have

blue eyesblue eyes

Page 10: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1010

Induction (cont…)Induction (cont…) Induction conclusions may Induction conclusions may

not be entirely accuratenot be entirely accurate only Siamese cats in Australia only Siamese cats in Australia

have blue eyeshave blue eyes

Inferred conclusions may Inferred conclusions may change as more facts are change as more facts are knownknown

Page 11: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1111

AbductionAbductionA form of deductive A form of deductive inference which uses inference which uses probability to determine most probability to determine most probable conclusion.probable conclusion.

Page 12: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1212

Abduction ExampleAbduction Example

Major PremiseMajor Premise I do not jog when the I do not jog when the

temperature exceeds 38 temperature exceeds 38 degreesdegrees

Minor PremiseMinor Premise I did not jog todayI did not jog today Conclusion Conclusion The temperature today is The temperature today is

greater than 40 degreesgreater than 40 degrees

Page 13: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1313

Propositional Logic: Propositional Logic: SyntaxSyntax

A BNF (Backus-Naur Form) grammar of A BNF (Backus-Naur Form) grammar of sentences in propositional logic.sentences in propositional logic.

Sentence Sentence Atomic Sentence Atomic Sentence Complex Complex SentenceSentence

Atomic Sentence Atomic Sentence True True FalseFalse

P P Q Q R R … …

Complex Sentence Complex Sentence (Sentence) (Sentence)

Sentence Connective SentenceSentence Connective Sentence

SentenceSentence

Connective Connective

Page 14: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1414

Propositional Logic: Propositional Logic: SemanticsSemantics

Truth tables for the five logical Truth tables for the five logical connectives.connectives.

P Q P P Q P Q P Q PQ

False False True False False True True

False True True False True True False

True False False False True False False

True True False True True True True

Page 15: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1515

Propositional Logic: Propositional Logic: Rules of InferenceRules of Inference

Modus PonensModus Ponens//Implication-Implication-Elimination:Elimination: From an implication and the premise From an implication and the premise

of the implication, you can infer the of the implication, you can infer the conclusionconclusion

, ,

And-Elimination:And-Elimination: From a conjunction you can infer any From a conjunction you can infer any

of the conjuncts.of the conjuncts.

11 22 ... ... nn

ii

And-Introduction:And-Introduction: From a list you can infer their From a list you can infer their

conjunction.conjunction.

11, , 22 , ... , , ... , nn

11 22 ... ... n n

Page 16: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1616

Or-Introduction:Or-Introduction: From a sentence, you can infer its From a sentence, you can infer its

disjunction with anything else at all.disjunction with anything else at all.

ii

11 22 ... ... nn

Double-Negation Elimination:Double-Negation Elimination: From a doubly negated sentence, you From a doubly negated sentence, you

can infer a positive sentence can infer a positive sentence

Unit Resolution:Unit Resolution:

From a disjunction, if one of the From a disjunction, if one of the disjuncts is false, then you can infer disjuncts is false, then you can infer the other one is true.the other one is true.

, ,

Resolution:Resolution: This is the most difficult. Because This is the most difficult. Because

cannot be both true and false, one of cannot be both true and false, one of the other disjuncts must be true in the other disjuncts must be true in one of the premises. Or equivalently, one of the premises. Or equivalently, implication is transitive. implication is transitive.

, , , ,

Page 17: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1717

Propositional Logic: Propositional Logic: InferenceInference

Resolution refutation theorem Resolution refutation theorem proverprover Inference mechanism for Inference mechanism for

propositional logicpropositional logic Refutation:Refutation:

Recall that Recall that SS |= |= is defined as: is defined as: Whenever all sentences inWhenever all sentences in S S are true, are true,

than than is true as well. is true as well. This is equivalent to saying that:This is equivalent to saying that:

It impossible for It impossible for SS to be true and to be true and to to be false.be false.

OrOr It is impossible for It is impossible for SS and and to be true to be true

at the same time.at the same time.

In a refutation theorem prover, In a refutation theorem prover, in order to prove in order to prove from from SS, add , add to to SS and try to derive a and try to derive a contradiction.contradiction.

Page 18: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1818

Algorithm to prove Algorithm to prove S S |= |= ::

1.1. Rewrite Rewrite S S in clausal in clausal form.form.

2.2. Rewrite Rewrite in in clausal form.clausal form.

3.3. Using the various Using the various inference rules, derive the inference rules, derive the empty clause from the results empty clause from the results of 1. and 2.of 1. and 2.

Page 19: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

1919

Clausal Form or CNFClausal Form or CNF

Conjunctive Normal Form (CNF).Conjunctive Normal Form (CNF). Representing a sentence as a Representing a sentence as a

conjunction of disjunctions.conjunction of disjunctions. To do this:To do this:

1.1. Eliminate ImplicationsEliminate Implications Remember Remember a a b b a a b b

2.2. Push negation inwardsPush negation inwards (a (a b) b) a a b b (a (a b) b) a a b b(De Morgan’s Laws)(De Morgan’s Laws)

3.3. Eliminate double Eliminate double negationsnegations

4.4. Push disjunctions into Push disjunctions into conjunctionsconjunctions

a a (b (b c) c) (a (a b) b) (a (a c) c)

Page 20: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

2020

Example: Converting to Example: Converting to CNFCNF

Converting the following Converting the following sentence to CNF:sentence to CNF:

(a (a b) b) (c (c d) d)

Steps:Steps:1.1. Remove ImplicationRemove Implication

(a (a b) b) (c (c d) d)

2.2. Push Negations InwardsPush Negations Inwardsa a b b (c (c d) d)

3.3. Eliminate Double Eliminate Double NegationsNegations

a a b b (c (c d) d)

4.4. Push Disjunctions into Push Disjunctions into ConjunctionsConjunctions

((a a b b c) c) ( (a a b b d) d)

CNFCNF Represented in KB as the 2 Represented in KB as the 2

clauses:clauses:{{a a b b c} and { c} and {a a b b d} d}

Page 21: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

2121

Example: ResolutionExample: Resolution

Prove that Prove that rr follows from: follows from:(p (p q) q) (r (r s) - (1) s) - (1) p p s - (2) s - (2) p p q - (3) q - (3)

Solution:Solution:1.1. Clause (1) in CNFClause (1) in CNF

(p (p q) q) (r (r s) s)

{{ p p q q r r s} - (1) s} - (1)

Clause (2)Clause (2)

{{ p p s} - (2) s} - (2) Clause (3)Clause (3)

{p} - (3){p} - (3){q} - (4){q} - (4)

Page 22: 1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of

2222

Example (con’t)Example (con’t)

2.2. Clause of r is {Clause of r is { r} - (5) r} - (5)

3.3. Using inference rules:Using inference rules:

{{p p q q s} - (6) s} - (6)

from unit resolution rule of (1) and (5)from unit resolution rule of (1) and (5)

{{ q q s} s} - (7) - (7)

from unit resolution of (3) and (6)from unit resolution of (3) and (6)

{s} - (8){s} - (8)

from (4) and (7) from (4) and (7)

{{ p} - (9) p} - (9) from (2) and (8) from (2) and (8)

{} - (10){} - (10)

from (3) and (9) from (3) and (9) Therefore r follows from the original Therefore r follows from the original

clausesclauses