Understanding Inference in Prolog with Himalayan Club Example
Dive into the world of artificial intelligence and logic programming with an example from the Himalayan Club. Explore how Prolog is used to infer relationships and make deductions based on given facts and rules in the context of mountain climbers and skiers in the club.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 35 Himalayan Club example; introducing Prolog
Himalayan Club example 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
Example contd. Let mc denote mountain climber and sk denotes skier. Knowledge representation in the given problem is as follows: member(A) member(B) member(C) x[member(x) (mc(x) sk(x))] x[mc(x) ~like(x,rain)] x[sk(x) like(x, snow)] x[like(B, x) ~like(A, x)] x[~like(B, x) like(A, x)] like(A, rain) like(A, snow) Question: x[member(x) mc(x) ~sk(x)] We have to infer the 11thexpression from the given 10. Done through Resolution Refutation. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
Club example: Inferencing member(A) member(B) member(C) Can be written as ~ like 1. 2. 3. [ ( ) ( ( ) ( ))] x member x mc x sk x 4. ) ( x [ ( ) sk ( ( ) ( ))] member mc )] ( x lk )] rain ~ ) lk x )] , ( x B lk x mc x sk x ~ lk ( ) ( ) member , ( x ~ sk ( x lk ( ~ mc ~ x x [ ( ) x sk x snow ) ( x , 5. , ) snow [ ( ) ~ x mc x 6. ( , ) x rain [ ( , ) x like A x 7. ( , ) ~ ( , ) A x lk B x
[~ x ( , ) ( , )] lk A x lk B x 8. ( , ) ( , ) ( lk A x lk B x , ) lk A rain 9. 10. ( , ) lk A [ x snow member [~ 11. ( ) x ( ) ~ ( ( )] ~ x mc member x sk ) x x ( ) ( )] mc x sk x Negate
Now standardize the variables apart which results in the following member(A) member(B) member(C) ) ( ~ ) ( ~ x mc x member 1. 2. 3. ( lk ( B lk ) ) ) ) ~ ~ ~ ( ) ( ) ( ) member ( x sk ( x mc x lk ~ mc , 2 x x sk x 4. 1 1 1 ) ) 3 x ( snow , 3 rain 5. 2 6. ~ lk lk lk ( x rain snow , ) ~ ( ) , ) like ( A ( A ( A A ) 5 x lk x B x 7. 4 4 , , , , 8. 5 9. 10. ( ) sk x 11. 6 6 6
~ ( , ) ~ ( , ) like A x lk B x ( , ) lk A snow 10 4 4 7 ~ ( , ) ~ ( ) ( , ) lk B snow sk x lk x snow 12 5 2 2 ~ ( ) ( ) ( ) member x mc x sk x 4 ~ ( ) sk B 13 1 1 1 ~ ( ) ( ) (B ) member B mc B member 14 2 11 ~ ( ) ~ ( ) ( ) (B ) mc member x mc x sk x 15 6 6 6 ~ ( ) ~ ( ) ( ) sk B member B sk B 16 13 (B ) member 2 ~ ( ) member B 17