Download Presentation
## Artificial Intelligence (AI)

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**A.I. is the Future of Computing!**Artificial Intelligence (AI) AmanUllah Khan Revised By: Ghulam Irtaza Sheikh**Text:**• Artificial Intelligence: Structures and Strategies for Complex Problem Solvingby GEORGE F LUGER • Reference: • Practical Common Lisp by Peter Seibel • Learn Prolog Now, by Patrick Blackburn, Johan Bos and Kristina Striegnitz • CLIPS User and Reference Manuals • Various resources on the Web • CS 607 (VU)**Chapter 2**Institute of Computing**Last Lect**• The Propositional Calculus • The Predicate Calculus**Background**• Predicate calculus and prepositional Calculus as Representation Language**Today**• Quantifiers • First Order Predicate Calculus**Quantifiers**• A variable, when it appears as an argument in a sentence, it refers to unspecified objects in the domain. Predicate calculus provides two symbols, the variable quantifiers ∀ (for all) and ∃ (there exist), that constraint the meaning of sentences containing variables. • The proposition “Every human is mortal” shall be expressed as: ∀X human(X) => mortal(X). • The proposition “everybody likes ice_cream” can be expressed as : ∀Y likes(Y, ice_cream). • On the other hand, the proposition “some people likes bitter cucumber” will be expressed as: ∃Z likes(Z, bitter_cucumber). Institute of Computing**Quantification and Negation**• ~(x p(x)) equiv x ~p(x) • ~(x p(x)) equiv x ~p(x) • Quantifier duality: each can be expressed using the other • x Likes(x,IceCream) x Likes(x,IceCream) • x Likes(x,Broccoli) xLikes(x,Broccoli)**Equivalence**• For predicates p and q, and variables X and Y • Xp(X) Xp(X) • Xp(X) Xp(X) • Xp(X) Yp(Y) • Xp(X) Yp(Y) • X(p(X)q(X)) Xp(X)Yq(Y)) • X(p(X)q(X)) Xp(X)Yq(Y) )**Examples**• Everyone likes chocolate • Someone likes chocolate • Everyone likes chocolate unless they are allergic to it**Examples**• Everyone likes chocolate • X person(X) likes(X, chocolate) • Someone likes chocolate • X person(X) ^ likes(X, chocolate) • Everyone likes chocolate unless they are allergic to it • X (person(X) ^ allergic (X, chocolate)) likes(X, chocolate)**Properties of quantifiers**• x y is the same as yx • x y is the same as yx • x y is not the same as yx • x y Loves(x,y) • “There is a person who loves everyone in the world” • yx Loves(x,y) • “Everyone in the world is loved by at least one person”**First Order Predicate Calculus**Institute of Computing**First Order PC**• First-order predicate calculus allows quantified variables to refer to objects in the domain of discourse and not to predicates or functions. • For Example: (∀ likes) likes(george,kate) Is not a well-formed expression in the first-order predicate calculus. There are higher-order predicate calculi where such expressions are meaningful. Some researchers (McCarthy1968, Appelt 1985) have used higher-order languages to represent knowledge in natural language understanding programs. Institute of Computing**Many grammatically correct English sentences can be**represented in the first-order predicate calculus using the symbols, connectives, and variable symbols. • Note: There is no unique mapping of sentences into predicate calculus expressions; in fact, an English sentence may have any number of different predicate calculus representations.**First Order PC …**Examples of English sentences represented in predicate calculus are: Institute of Computing**Worked Example 1**• All dogs are animal: • ∀X (dog(X) → animal(X)). • Fido is a dog : • dog(fido). • All animals will die : • ∀Y (animal(Y) → die(Y)). • Will fido die: • die(fido). Institute of Computing**Worked Example 2**• Calculators are used to add up • (∀X)(use_calculator(X) → addup(X)) • Dolphins can not add up • (∀X)(dolphin(Y) → ~addup(Y)) • There are some dolphins which are intelligent • (∃Z)(dolphin(Z) ∧ intelligent(Z)) • Hypothesis: • (∃W)(intelligent(W) ∧ ~use_calculator(W)) Institute of Computing**Worked Example 3**• Premises: • All mammals are animals. (∀X) (mammal(X)→animal(X)). • All elephants are mammals. (∀X) (elephant(X)→mammal(X)). • Clyde is an elephant. elephant(clyde). • All sharks are animals. (∀X)(shark(X)→animal(X)). • Bonnie is a shark. shark(bonnie). • Hypothesis: • Is clyde an animal? animal(clyde). • Is Bonnie an animal? animal(bonnie). Institute of Computing**Knight’s Tour**Institute of Computing**Bridges of KÖnigsberg Problem**connect(i1,i2,b1) connect(rb1,i1,b2) onnect(rb1,i1,b3) connect(rb1,i2,b4) connect(rb2,i1,b5) connect(rb2,i1,b6) connect(rb2,i2,b7) connect(i2,i1,b1) connect(i1,rb1,b2) onnect(i1,rb1,b3) connect(i2,rb1,b4) connect(i1,rb2,b5) connect(i1,rb2,b6) connect(i2,rb2,b7) Institute of Computing**Block World**on(c,a). on(b,d). ontable(a). ontable(d). clear(b). clear(c). hand_empty. Institute of Computing**Master and Dog World**Institute of Computing**A Logic-Based Financial Advisor**• A Financial advisor helps a user to decide whether to invest in a savings account or the stock market. Some investors may desire to split their money between the two. The investment that will be recommended for individual investors depends on their income and the current amount they have saved according to the following criteria: • Individuals with an inadequate savings account should always make increasing the amount saved their first priority, regardless of their income. • Individuals with an adequate savings account and an adequate income should consider a riskier but potentially more profitable investment in the stock market. • Individuals with a lower income who already have an adequate savings account may want to consider splitting their surplus income between savings and stocks, to increase the cushion in savings while attempting to increase their income through stocks. Institute of Computing**A Logic-Based Financial Advisor …**Institute of Computing**Lucky Student**Anyone passing his history exams and winning the lottery is happy. But anyone who studies or is lucky can pass all his exams. John did not study but he is lucky. Anyone who is lucky wins the lottery. Is John happy? • Anyone passing his history exams and winning the lottery is happy : ∀X (pass(X,history) /\ win(X,lottery)) → happy(X)). • Anyone who studies or is lucky can pass all his exams: ∀X ∀Y (study(X) \/ lucky(X) → pass(X,Y)) • John did not study but he is lucky: ~study(john) /\ lucky(john). • Anyone who is lucky wins the lottery: ∀X (lucky(X) → win(X,lottery)). • Is john happy? happy(john) Institute of Computing**Exciting Life**All people who are not poor and are smart are happy. Those people who read are not stupid. John can read and is wealthy. Happy people have exciting lives. Can anyone be found with an exciting life? Assume :∀X (smart(X) ≡ stupid(X)) and ∀Y(wealthy(Y) ≡ ~poor(Y)) • All people who are not poor and are smart are happy. ∀X (~poor(X) /\ smart(X) → happy(X) • Those people who read are not stupid. ∀Y (read(Y) → smart(Y)) • John can read and is wealthy. read(john) /\ ~poor(john) • Happy people have exciting lives. ∀X (happy(Z) → exciting(Z)) • Can anyone be found with an exciting life? ∃ W (exciting(W)) Institute of Computing