knowledge representation 최윤정

Post on 18-Mar-2016

49 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

KNOWLEDGE REPRESENTATION 최윤정. Knowledge Representation Methods. Declarative Methods --knowledge is knowing WHAT Logical Approach Predicate Calculus Nonstandard Logics Fuzzy Logic Non-Logical Approach Semantic Net Frame (procedural features) Conceptual Dependency. - PowerPoint PPT Presentation

TRANSCRIPT

KNOWLEDGE REPRESENTATION

최윤정

Knowledge Representation Methods

2

Declarative Methods --knowledge is knowing

WHAT Logical Approach

Predicate Calculus Nonstandard Logics Fuzzy Logic

Non-Logical Approach Semantic Net Frame (procedural features) Conceptual Dependency

Procedural Methods --knowledge is

knowing HOW

PLANNER, CONNIVER Rule-based systems

Semantic Net(1/3) (Quillian(1968) Psychological Model)

3

Basic Constructs Node-Object, Concept Links-Relation

property inheritance-Property Inheritance is the main inference

mechanism!

Tweety Robin Bird

Wings Wings Wings

isa

isa has-part

Semantic Net(2/3)4

Example

Furniture Furniturestore

SeatChair

My-ChairPark

Person Leather Black

Sold-by

has-part

isa

isa

ownerisa cover

Color

Semantic Net(3/3)5

Internal Representation(LISP) My-Chair: ((ISA CHAIR)(COLOR BLACK) (OWNER PARK)(COVER LEATHER)) Chair: ((ISA FURNITURE)(HASPART SEAT))

(get `My-CHAIR `COLOR)= `BLACK

Action and Event(1/2)6

“John gave the book to Mary.”

Event

EV-1 BK-1 BookJohn

Mary

Give Past

isaobject isaagen

t

beneficiary

action

time

Action and Event(2/2)7

“John is taller than Bill.”

John Bill

John Bill

H1 Number H2

Is-taller

height

isa isa

height

greater-than

Reasoning with Semantic Nets(1/2)

8

Spreading Activation

“What is the relation between John and Mary?”

John ? Mary

Reasoning with Semantic Nets(2/2)

9

Matching

Fact Goal Net

Direct Match vs. Semantic Match What is Tweety?

Tweety Robin Bird

Tweety ?

isa isa

isa

isa

Problems of Semantic Net(1/2)10

1. Different people use different nets to represent the same thing.

John Mary

Marriage

Event

M1John Mary

married

isa

isa

femalemale

Problems of Semantic Net(2/2)11

2. Same Net interpreted differently by different person.

3. Quantification

Jack TomFather-of

Dealing with Exceptions(1/2)

12

Fly

Bird

Ostrich

Henry

Exception node

CAN

ISA

ISA

Dealing with Exceptions(2/2)

13

Inferential Distance(Touretzky)

Grey

Elephant

Royal Elephant

Circus Elephant

Clyde

isa

COLOR

ISA

ISA

ISA

Frame (1/2) -Minsky14

Slot-Filler Concept : Typical Expected Situation

[frame: Vehicle ISA: Object Slots: (Weight (a wt-measure)) (color (a color(default black))) (number-of-wheel (a integer))]

[frame: Trailer-Truck ISA: Vehicle Slots: (trailer-size (a length-measure)) (weight (default 8)) (number-of-wheel (default 18))]

[frame: Sedan ISA: Vehicle Slots: (number-of-

wheel 4)]

[frame: My-truck instance-of: Trailer-

Truck Slots: (trailer-size = 12) (color red)]

Frame(2/2)15

Object

Vehicle

Trailer-truck

My-Truck

weight=color= blackwheel=

weight=8trailer-size=wheel=18Color=black

Weight=8Trailer-size=12Wheel=18Color=red

ISA

ISA

ISA

Procedural Attachment(1/2)-Procedural knowledge is attached to slots

16

If-Added: Triggered to fill in If-Needed: Triggered when filled in If-Modified: Triggered when changed

Employee: ISA: Person Sex: (M, F) Birthday: Date

Age: integer If-Needed: CALC-AGE

Skill: code If-Added: ADD-TO-SKILL-FILE

Procedural Attachment(2/2)17

Proc CALC-AGE; x:= get-current-year; y:= get-birth-year; age:= x-y end;

Proc ADD-TO-FILE; c:= get-code; open-file(skill); put-file(c, skill) end;

LOGICAL PRELIMINARIES18

LOGIC- ARTIFICIAL LANGUAGE TALKING ABOUT “TRUTH”

LOGIC AS LANGUAGE SYNTAX(GRAMMAR) -Symbol -WFF(Well Formed Formula) -Deductive Closure -Proof Theory SEMANTICS -Meaning -Model -Validity, Consistency -Model Theory

LOGIC AS A PROGRAMMING LANGUAGE SYNTAX SEMANTICS

LOGIC - LANGUAGE and its MEANING19

LOGIC LANGUAGE MODEL

PROPOSITIONALLOGIC

PREDICATECALCULUS

MODAL LOGIC

P, Q, P->Q(P->((-Q->R) ∨P))

Variables x,yFunctions f, gPredicates P,QQuantifiers ∀,∃

ᄆ P, ◇P

Truth Assignment

First Order Structure<D,C,F,P>

Kripke Structure<W, R, V>

Possible WorldSemantics

PROPOSITIONAL LOGIC (1/2)20

(P∧Q)R

P Q R P∧Q (P∧Q)->R F F FF F TF T F

F T T T F F T F TT T FT T T

F TF TF TF TF TF T

T [F]T T

Falsifying Model

PROPOSITIONAL LOGIC (2/2)21

((PQ)∧~Q)~P

VALID TRUE in Every Model(Tautology) INCONSISTENT FALSE in Every Model CONSISTENT TRUE in at least ONE Model

VALID INVALID INCONSISTENT CONSISTENT (Unsatisfiable) (Satisfiable)

P Q P->Q (P->Q)∧~Q ((P->Q) ∧~Q)->~PF FF TT FT T

T T T T F T F F T T F T

FORMAL SYSTEM22

Well Formed Formula Language

AXIOM + THEOREM ├ AINFERENCE RULES

VALID ╞ A

PROOF THEORY MODEL THEORY

THEOREM VALID SOUNDNESS (→) COMPLETENESS (←)

Types of Logical Reasoning23

Deduction Given A, AB infer B Induction Given A, B find the rule AB Abduction (Not logically valid!) Given AB, B infer A Refutation Proof

Proof by Cases24

Is there a Red Box right next to a Non-Red Box?

?

Refutation Proof25

A, AB want to prove B

Assume ¬B and find a contradiction

Most Common Method using Computer- Resolution, Tableau Method etc.

PROVING VALIDITY in PROPOSITIONAL LOGIC

26

1. TRUTH TABLE 2. TABLEAU METHOD 3. SEQUENT CALCULUS 4. RESOLUTON

TABLEAU METHOD27

Refutation Method(Assuming FALSE and draw CONTRADICTION)

(( P Q) ∧ -Q ) -P

F T F

T T TT F CONTRADICTION

RESOLUTION (Robinson)28

A B, B C, A C?

-A ∨ B A-B ∨ C -C

-A ∨ C

C

Example 1 (1/2)29

“Head I win, Tail you lose.”Prove I win.H: headT: tail H WW: I win T LL: You lose(Hidden information)H ∨ TW LL W

Example 1 (2/2)30

-H∨W -T∨L H∨T -W∨L -L∨W -W

HW

~T

~L

Example: Lion Sleeps Tonight31

Lion always sleeps except when he is hunting.

Lion cannot sleep when he is hungry. When he is tired he cannot hunt. Lion is tired when he does not sleep. Prove Lion is not hungry.

Resolution Strategies (1/4)32

1. UNIT RESOLUTION (Wos) Not complete

UNIT PREFERENCE RESOLUTION Unit clause always reduces the size!

P ∨ Q P ∨ -Q -P ∨ Q

P

Q -Q

-P ∨ -Q

Resolution Strategies (2/4)33

2. INPUT RESOLUTION Not complete

INPUT CLAUSES HAVE MEANINGFUL INFORMATION

P

Q -Q

INPUT CLAUSES

P ∨ Q P ∨ -Q -P ∨ Q -P ∨ -Q

Resolution Strategies (3/4)34

3. LINEAR RESOLUTION(Loveland) Chain of Reasoning

Depth First COMPLETE

P

Q-P

P ∨ Q P ∨ -Q -P ∨ Q -P ∨ -Q

Resolution Strategies (4/4)35

4. LOCK RESOLUTION(BOYER) COMPLETE Index every literal (Lock) : consider smallest

P1 Q2 P3 -Q4 -P6 Q5

-P6

Q2 -Q4

-P8 -Q7

Predicate Calculus36

Variable : object x, y, z, .. Constant : a, b, c, tom, 1, 2, .. Function : f, g, h, father(tom),… Predicate : P, Q, R Quantifier : ∀, ∃

Well Formed Formula37

Term constant, variable, f(t1, .. tn): ti term Atom P(t1,..tn) Formula(wff) 1. atom 2. F∨G, -F, FG 3. (∀x)F, (∃x)F

Nested Quantifiers38

Describe each statement ∀x ∀y Love(x, y)

∀x ∃y Love(x, y)

∃x ∀y Love(x, y)

∃x ∃y Love(x, y)

∀x ∃y Love(y, x)

∃x ∀y Love(y, x)

Negation of these?

Symbolize the Statement39

Every rational number is a real number. There exists a number that is prime. For every number x, there exists a number y such that x<y. Not every real number is a rational number. Everybody has somebody who loves him. There is someone whom everybody loves. Mimi loves only those who is younger than her. Everyone who eats BigMac listens Jazz music.

Clausal Form Conversion40

1. Eliminate 2. Reduce the scope of ~ 3. Rename the variables 4. Move quantifiers to the left

(prenex normal form) 5. Eliminate ∃ : Skolemize 6. Eliminate ∀ 7. Conjunctive Normal Form

Reducing the Scope of ~41

~ (p ∧ q) = ~p ∨ ~q ~ (p ∨ q) = ~p ∧ ~q

~ Q1Q2..Qn P(x,y,..) = Q’1Q’2..Q’n ~P(x,y,..) where Q’ = ∃ if Q=∀ ∀ if Q= ∃

Prenex Normal Form42

Prenex normal form:

Q1Q2..Qn P(x,y,..) where Q i = ∀, ∃

∀x (P(x) ∨ ∀y (Q(y)))

= ∀x ∀y (P(x) ∨ Q(y))

∀x (P(x) ∨ ∃y (Q(x, y)))

= ∀x ∃y (P(x) ∨ Q(x, y))

Skolem Function43

Eliminating ∃’s

∃x P(x) P(sk1) : sk1 is skolem constant ∃x ∀y P(x,y) ∀y P(sk1, y) ∀y ∃x P(x,y) ∀y P(sk1(y),y) ∀x ∃y ∀z ∃w P(x,y,z,w) ∀x ∀z P(x,sk1(x),z,sk2(x,z))

Example : Clausal Form44

∀x((∀y P(x,y) ~∀y(Q(x,y) R(x,y)))

∀x( ~∀y P(x,y) ∨ ~∀y (~Q(x,y) ∨ R(x,y))) … (1)

∀x( ∃y ~P(x,y) ∨ ∃y (Q(x,y) ∧~R(x,y))) … (2)

∀x( ∃y ~P(x,y) ∨ ∃z (Q(x,z) ∧~R(x,z))) … (3)

∀x∃y∃z (~P(x,y) ∨((Q(x,z) ∧~R(x,z))) … (4)

∀x(~P(x,s1(x))∨((Q(x,s2(x))∧~R(x,s2(x)))) … (5)

~P(x,s1(x))∨((Q(x,s2(x))∧~R(x,s2(x))) … (6)

(~P(x,s1(x))∨Q(x,s2(x)))∧(~P(x,s1(x))∨~R(x,s2(x)))

Matching45

Rule : Mother(x, y) Like(x, y)

“Every Mother Like their Son” Fact

Like(Joe, Jack), Like(Kim, Mary)

Mother(Judy, Jack), Mother(Mary, Jay) Query

Like(Judy Jack)?

Like(Mary, ?)

Unification(2-way Matching)46

Find a substitution σ(unifier) which makes two clause equal

Essential step for Resolution of Predicate Calculus Usually unification tries to find a most general unifier

Most General Unifier (mgu)47

Substitution : σ C = Like(x, father(x)) σ = {jack/x} C • σ = Like(Jack, father(Jack)) C, D are unifiable iff there is σ s.t. C • σ = D • σ (σ is called unifier) Mgu least specific unifier Like(x, y), Like(Jack, y) σ1={Jack/x}, σ2={Jack/x, Mary/y}

Unification - Examples48

Like(x, y) Like(joe, father(joe))Like(jack, y) Like(x, father(x))Like(x, father(x)) Like(joe, y)Like(x, father(joe)) Like(jack, father(y))Like(x, father(x)) Like(jack, father(joe)) Like(x, father(x)) Like(father(y),z)Like(x, x) Like(father(z), z) ?

Factoring49

If 2 literals in a clause C have mgu σ then C • σ is called a factor of C If C = P(x) ∨ P(f(y)) ∨ ~Q(x) Then σ = {f(y)/x} P(f(y))∨P(f(y))∨~Q(f(y)) P(f(y))∨~Q(f(y)) : factor of C

Subsumption50

Clause C subsumes D iff

∀ C D

(A ∧ B) subsumes A

A subsumes A ∨ B Subsumed clause can be deleted C=P(x) D=P(a) delete P(a) Note: factoring – within a clause

subsumption – between two clauses

Example51

1. All KU students are handsome&pretty.

2. Kim only likes an intelligent girl.

3. Pretty girls do not read books.

4. Intelligent girls are either good reader or music lovers.

5. Kim likes Mimi who attends to KU.

* Prove that Mimi is a music lover

E(x): KU students P(x): Pretty

B(x): Book reader M(x): Music lover

Like(x, y): x likes y I(x): intelligent

Example - Skolemize52

Customer officials search everyone who entered the country who is not a VIP

Some of the drug dealers entered the country and they were only searched by drug dealers.

No drug dealer was a VIP Conclusion: Some of the officials were drug dealers.

E(x) : x entered the country V(x): VIP

C(x) : custom official D(x): drug dealer

S(x,y): x searched y

Types of Question - Resolution53

Type1: Yes/No Question “Is Mimi a Music Lover?” Type2: Short Answer “Who is a Music Lover?” Use special predicate: Ans(x) Type3: How to type Question

Type2 Question54

Every Pompeian died in 79. Marcus was a Pompeian. When was Marcus died?

~Died(marcus, x) ∨ Ans(x)

Type3:Monkey Banana Problem

55

P(x, y, z, s) : x: monkey y: banana z: chair s: state R(s) : monkey reachable to banana at s Functions walk(l1, l2, s) : at state s, monkey walk from l1 to l2 carry(l1, l2, s) : carry chair from l1 to l2 climb(s) : at s, monkey climb to the chair

Monkey – continue56

P(x,y,z,s) P(z,y,z, walk(x,z,s))P(x,y,x,s) P(y,y,y, carry(x,y,s))P(kit,kit,kit,s) R(climb(s))P(liv, kit, din, s1)R(x) Ans(x)-----Ans(climb(carry(din,kit,(walk(liv,din,s1)))))

Merit of using Logic as KR57

Flexible (Rich) Representation Natural Language > Logic Formula Note: flexibility is also a weak point of logic

Powerful Inference Mechanism Resolution, Graphical methods

Theoretical Background Solid

Weak Points of Logic a KR58

Too Rigid (Not Flexible) - no contradiction - no exception - no change

Complexity - NP-complete Horn-clause (restricted form)

Spin-off Products of Logic59

Prolog Language - Specification Language - Horn clause

Knowledge-base Systems - Rules & Inference Engine

New Breed of Logics

Real World vs Logic World60

Dynamic - Static

- keeps on changing Incomplete Knowledge

- implicit vs explicit, Default Rules, Closed World Assumption

Belief vs Truth Non-monotonic vs Monotonic Uncertainty – Statistical Reasoning

TMS (1/2)61

Truth Maintenance System - Doyle

Intended to Model Belief Changes Information is linked together by its justifications Dependency-directed backtracking Basic Data Structure

Node: belief Justification: reason to believe http://www.aistudy.com/problem/exercise/%

EC%A7%84%EB%A6%AC%EA%B0%92%20%EC%9C%A0%EC%A7%80%20%EC%8B%9C%EC%8A%A4%ED%85%9C.htm

http://www.aistudy.com/ai/logic_rich.htm

TMS (2/2)62

2 states of node IN – current belief OUT – not believed (cf. believed to be not true)

A node is assigned a justification set A node is IN iff there is at least one valid

justification A node is OUT iff there is no valid justification

SL justification (1/3)63

(SL (list of IN-nodes)(list of OUT-nodes)) SL-justification is valid if all the nodes in the IN-node list

are currently IN, and those in the OUT-node list are OUT.

Statement-1: (SL (x)(y)) Meaning:

If x is believed and y is not believed, the statement-1 is believed.

SL justification (2/3)64

Special nodes: Premise – nodes with (SL ()()) always IN Assumption – nodes with nonempty OUT-list which is

currently IN. (Default Rule) eg. 1. There is other schedule 2. I will be at the party. (SL ()(1))

“Unless there is other schedule, I will be at a party.”

SL justification (3/3)65

1. X : (SL (2)()) : If Y Then X (normal rule) 2. Y

1. X : (SL ()(2)) : X unless Y (strong default rule – CWA)

2. Y 1. X: (SL (2)(3)) : If Y Then X Unless Z (default

rule) 2. Y 3. Z

Example 1- Dream66

If I win Lotto, I’ll be Rich unless it is a Dream.

1. Rich : (SL (2)(3)) 2. Lotto Win! 3. Dream I win Lotto!!!

1. Rich : (SL (2)(3)) 2. Lotto Win! ------------- (SL ()()) 3. Dream I pinched myself, and woke up.. 1. Rich : (SL (2)(3)) 2. Lotto Win! (SL()()) 3. Dream -----------------(SL ()())

Example 267

1. It is winter OUT 2. It is cold (SL(1)(3)) OUT 3. It is warm (SL(4)(2)) IN 4. It is summer (SL()(1)) IN

It is winter. 1. It is winter (SL()()) IN 2. It is cold (SL(1)(3)) ? 3. It is warm (SL(4)(2)) ? 4. It is summer (SL()(1)) ?

It is warm outside. 1. It is winter (SL()()) IN 2. It is cold (SL(1)(3)) ? 3. It is warm (SL(4)(2)) (SL()()) IN 4. It is summer (SL()(1)) ?

Example 3 (1/5)68

This is how Mimi likes to see as her marriage partner. Not OK unless she really likes him. She likes a rich man as long as he doesn’t have a problem. She likes a man if he is healthy and kind as long as he does not

have a problem and is not the eldest son. A man is problematic if he is older than 35 unless he is

exceptional. Married man is problematic Love is an exception.

Example 3(2/5)69

Nodes: 1. Not OK (SL()(2)) OUT IN 2. She likes him (SL(3)(4)) (SL(5,6)(4,7)) OUT 3. He is rich OUT 4. He has a problem (SL(8)(9)) (SL(10)()) OUT 5. He is healthy OUT 6. Kind OUT 7. The eldest son OUT 8. Older than 35 OUT 9. Exception (SL(11)()) OUT10. Married OUT11. Love OUT

Example 3(3/5)70

He looks healthy and kind 1. Not OK (SL()(2)) IN -- OUT 2. She likes him (SL(3)(4)) (SL(5,6)(4,7)) OUT -- IN 3. He is rich OUT 4. He has a problem (SL(8)(9)) (SL(10)()) OUT 5. He is healthy(SL()())IN 6. Kind (SL()())IN 7. The eldest son OUT 8. Older than 35 OUT 9. Exception (SL(11)()) OUT10. Married OUT11. Love OUT

Currnet belief:He is healthy and kindShe likes him --- OK

Example 3(4/5)71

His age is 38! 1. Not OK (SL()(2)) OUT -- IN 2. She likes him (SL(3)(4)) (SL(5,6)(4,7)) IN -- OUT 3. He is rich OUT 4. He has a problem (SL(8)(9)) (SL(10)()) OUT -- IN 5. He is healthy IN 6. Kind IN 7. The eldest son OUT 8. Older than 35 (SL()())IN 9. Exception (SL(11)()) OUT10. Married OUT11. Love OUT

Example 3(5/5)72

Mimi finds herself that she is in love with him. 1. Not OK (SL ()(2)) IN -- OUT 2. She likes him (SL(3)(4)) (SL(5,6)(4,7)) OUT -- IN 3. He is rich OUT 4. He has a problem (SL(8)(9)) (SL(10)()) IN -- OUT 5. He is healthy IN 6. Kind IN 7. The eldest son OUT 8. Older than 35 (SL()())IN 9. Exception (SL(11)()) OUT -- IN10. Married OUT11. Love (SL()())IN

-- So they married, and happily there

after …

Cyc : KB for Commonsense73

Lenat,D (MCC) Limitation of Logic

Predicate Symbol – No Semantics

Need More Background Knowledge Build a Huge Knowledgebase to cover human everyday

commonsense Enough to Understand –

Newspaper Article or Encyclopedia

Cyc: Structure74

Cyc KB – Knowledgebase CycL – Representation Language Environment (UE, MUE) Interface Editing/BrowsingUE: Spread Sheet TypeMUE: Museum Type (Graphic)(Note: Cyc Needs Lot of Update/Expansion)

CycL : Cyc Language75

CycL is Frame-Based Slot-Value Texas capital: (Austin) residents: (Fred Tom Park) stateOf: (UnitedStatesOfAmerica)

CycL (2)76

Constraint Language (on Top of Frame) Predicate Calculus Type (#%ForAll x #%Number (#%LogImplication (#%GreaterThan x 1) (#%GreaterThan (#%NumOfDiv x) 1)))

Constraint Language77

First Order Logic ‘All of Fred’s Friends are artists’(#%ForAll x(#%Fred #%friends) (#%allInstanceOF x #%Artist))

‘Some of Fred’s Friends are artists’(#%ThereExists x(#%Fred #%friends) (#%allInstanceOF x #%Artist))

Frame Types of Cyc78

Normal Texas, Fred, Red, Walking.. Etc. SlotUnit Frames to Define Slots SeeUnit Meta-level Info for certain slot of a unit SlotEntryDetail SeeUnit for a member of slot entry (eg. Park of resident slot of Texas frame)

Slot Unit79

Slot Frame is a Frame about a Slot Define, Constraints, Interrelationships among SlotsResidents instanceOf: (Slot) inverse: (residentOf) entryIsA: (Person) …..

SeeUnit80

Metalevel Information for particular slot for particular unit (footnote)

Texas capital: (Austin) *residents: (Tom Jack Park..) … SeeUnitFor-residents.Texas instanceOf: (SeeUnit) modifiesUnit: (Texas) *rateOfChange: ..

SlotEntry-Details81

Similar to SeeUnit except it talks about single entry of a slot

Texas capital: (Austin) residents: (Tom Jack *Park..) … SeeUnitFor-Park∈residents.Texas instanceOf: (SlotEntryDetailTypeofSeeUnit) modifiesUnit: (Texas) modifiesSlot: (residents) modifiesEntry: (Park) …

Inference in CycL82

What Does Cyc “Do”? More than 20 Special Purpose Inference

Schemes Inheritance Automatic Classification Constraint Maintenance TMS Guessing by Closed World Assumption Analogy Reasoning

Meta-Level Inference83

Inference Schemes are Divided into Several Levels

Simple and Fast Schemes are Used before more Slow and Complex Ones

Level1: Simply Access the Data Structure Level2: Inheritance Level3: Subsumption, Classification Level4: Constraint …. Level n : Analogy, Guess, etc.

Cyc Review84

First Attempt for Global Ontology Frame-based Mixture of Inference Reference: ‘Building Large Knowledge-Based Systems’ by

Lenat & Guha

top related