CS621: Artificial Intelligence

Post on 05-Jan-2016

25 views 0 download

description

CS621: Artificial Intelligence. Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 34– Predicate Calculus and Himalayan Club example (lectures 32 and 33 were on HMM+Viterbi combined AI and NLP). Resolution - Refutation. man(x) → mortal(x) Convert to clausal form - PowerPoint PPT Presentation

Transcript of CS621: Artificial Intelligence

CS621: Artificial Intelligence

Pushpak BhattacharyyaCSE Dept., IIT Bombay

Lecture 34– Predicate Calculus and Himalayan Club example

(lectures 32 and 33 were on HMM+Viterbi combined AI and NLP)

Resolution - Refutation

man(x) → mortal(x) Convert to clausal form ~man(shakespeare) mortal(x)

Clauses in the knowledge base ~man(shakespeare) mortal(x) man(shakespeare) mortal(shakespeare)

Resolution – Refutation contd Negate the goal

~man(shakespeare) Get a pair of resolvents

)(~ eshakespearmortal )()(~ eshakespearmortaleshakespearman

)(~ eshakespearman )(~ eshakespearman

Resolution Tree

1Re solvent 2Re solvent

soluteRe

Search in resolution

Heuristics for Resolution Search Goal Supported Strategy

Always start with the negated goal Set of support strategy

Always one of the resolvents is the most recently produced resolute

Inferencing in Predicate Calculus

Forward chaining Given P, , to infer Q P, match L.H.S of Assert Q from R.H.S

Backward chaining Q, Match R.H.S of assert P Check if P exists

Resolution – Refutation Negate goal Convert all pieces of knowledge into clausal form (disjunction of

literals) See if contradiction indicated by null clause can be derived

QP

QP

1. P

2. converted to

3.

Draw the resolution tree (actually an inverted tree). Every node is a clausal form and branches are intermediate inference steps.

QP QP ~

Q~

Q~

QP ~

P~ P

Terminology

Pair of clauses being resolved is called the Resolvents. The resulting clause is called the Resolute.

Choosing the correct pair of resolvents is a matter of search.

Predicate Calculus

Introduction through an example (Zohar Manna, 1974): Problem: A, B and C belong to the

Himalayan club. Every member in the club is either a mountain climber or a skier or both. A likes whatever B dislikes and dislikes whatever B likes. A likes rain and snow. No mountain climber likes rain. Every skier likes snow. Is there a member who is a mountain climber and not a skier?

Given knowledge has: Facts Rules

Predicate Calculus: Example contd. Let mc denote mountain climber and sk denotes skier.

Knowledge representation in the given problem is as follows:

1. member(A)2. member(B)3. member(C)4. ∀x[member(x) → (mc(x) ∨ sk(x))]5. ∀x[mc(x) → ~like(x,rain)]6. ∀x[sk(x) → like(x, snow)]7. ∀x[like(B, x) → ~like(A, x)]8. ∀x[~like(B, x) → like(A, x)]9. like(A, rain)10. like(A, snow)11. Question: ∃x[member(x) ∧ mc(x) ∧ ~sk(x)]

We have to infer the 11th expression from the given 10. Done through Resolution Refutation.

Club example: Inferencing1. member(A)

2. member(B)

3. member(C)

4. – Can be written as –

5. –

6. –

7. –

))]()(()([ xskxmcxmemberx

))]()(()([ xskxmcxmember )()()(~ xskxmcxmember )],()([ snowxlkxskx

),()(~ snowxlkxsk )],(~)([ rainxlkxmcx

),(~)(~ rainxlkxmc )],(~),([ xBlkxAlikex

),(~),(~ xBlkxAlike

8. –

9.

10.

11. – Negate–

)],(),([~ xBlkxAlkx

),(),( xBlkxAlk

),( rainAlk

),( snowAlk

)](~)()([ xskxmcxmemberx

)]()(~)([~ xskxmcxmemberx

Now standardize the variables apart which results in the following

1. member(A)

2. member(B)

3. member(C)

4.

5.

6.

7.

8.

9.

10.

11.

)()()(~ 111 xskxmcxmember

),()(~ 22 snowxlkxsk ),(~)(~ 33 rainxlkxmc

),(~),(~ 44 xBlkxAlike

),(),( 55 xBlkxAlk

),( rainAlk

),( snowAlk)]()(~)([~ 666 xskxmcxmemberx

),(~),(~ 44 xBlkxAlike ),( snowAlk

),(~ snowBlk ),()(~ 22 snowxlkxsk

)()()(~ 111 xskxmcxmember )(~ Bsk

)()(~ BmcBmember )(Bmember

)(Bmc)]()(~)([~ 666 xskxmcxmemberx

)()(~ BskBmember )(~ Bsk

)(~ Bmember )(Bmember

710

12 5

13 4

14 2

1115

16 13

17 2

Assignment Prove the inferencing in the Himalayan club

example with different starting points, producing different resolution trees.

Think of a Prolog implementation of the problem

Prolog Reference (Prolog by Chockshin & Melish)

Problem-2

From predicate calculus

A “department” environment1. Dr. X is the HoD of CSE2. Y and Z work in CSE3. Dr. P is the HoD of ME4. Q and R work in ME5. Y is married to Q6. By Institute policy staffs of the same

department cannot marry7. All married staff of CSE are insured by LIC8. HoD is the boss of all staff in the

department

Diagrammatic representation

Dr. X

Y Z

Dr. P

Q R

married

CSE ME

Questions on “department”

Who works in CSE? Is there a married person in ME? Is there somebody insured by LIC?

Text Knowledge Representation

A Semantic Graph

in: modifiera: indefinite

the: definite

student

past tense

agent

bought

objecttime

computer

new

June

modifier

The student bought a new computer in June.

UNL representation

Ram is reading the newspaper

Representation of Knowledge

UNL: a United Nations project

Started in 1996 10 year program 15 research groups across continents First goal: generators Next goal: analysers (needs solving various

ambiguity problems) Current active language groups

UNL_French (GETA-CLIPS, IMAG) UNL_Hindi (IIT Bombay with additional work on

UNL_English) UNL_Italian (Univ. of Pisa) UNL_Portugese (Univ of Sao Paolo, Brazil) UNL_Russian (Institute of Linguistics, Moscow) UNL_Spanish (UPM, Madrid)

Dave, Parikh and Bhattacharyya, Journal of Machine Translation, 2002

Knowledge Representation

Ram

read

newspaper

agt obj

UNL Graph - relations

Knowledge Representation

Ram(iof>person)

read(icl>interpret)

newspaper(icl>print_media)

UNL Graph - UWs

agt obj

Knowledge Representation

Ram(iof>person)

read(icl>interpret)

newspaper(icl>print_media)

@entry@present@progress

@def

Ram is reading the newspaper

UNL graph - attributes

agt obj

The boy who works here went to school

plt

agt@ entry @ past

school(icl>institution)

go(icl>move)

boy(icl>person)

work(icl>do)

here

@ entry

agt plc

:01

Another Example

What do these examples show? Logic systematizes the reasoning process Helps identify what is

mechanical/routine/automatable Brings to light the steps that only human

intelligence can perform These are especially of foundational and

structural nature (e.g., deciding what propositions to start with)

Algorithmizing reasoning is not trivial

About the SA/GA assignments

Key points 1. SA and GA are randomized search algorithms;

     (a) why does one do randomized search?      (b) To QUICKLY find a solution even if the the solution is not FULLY accurate

2. For example, TSP is NP hard; so any algorithm that purports to give the correct tour ALWAYS is going to take exponential amount of time.

3. But it may be alright to get the solution certain percentage of time. Then one can use SA/GA.

4. For sorting , consider getting the sorted sequences for any set of of numbers of any sequence length, say 200,000 numbers.

Key points cntd

5. It may be OK to get an ALMOST sorted sequence QUICKLY; so see if SA and GA can be used

6. SO what is coming out strongly is TIME vs. ACCURACY TRADE-OFF

7. ***THE ABOVE HAS TO COME OUT IN YOUR ASSIGNMENT

8. What about 8 puzzle? Optimal path is not needed.

Key points cntd 9. But you HAVE TO demonstrate randomness. That means Ther

are times when the goal state will not be reached;

10. The above will be the case when randomness is INTRODUCED in the system by making the tempearure HIGH.

11. Thus a key point of the assignment is the EFFECT OF HIGH TEMPERATURE on the system.

12. Another point about the next state: make sure you pick it up RANDOMLY and not deterministically.

13. Think about the connection between BFS and random search. The former will guarantee finding the goal state, the latter not. But there may be gain in time complexity.