Ai 02


Published on

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Ai 02

  1. 1. AI in logic perspective    AI is the study of mental faculties through the use of computational models. It is on the premise that what brain does may be thought of as a kind of computation. Though what brain does easily takes enormous efforts to be done by a machine. Eg: vision. 12/23/13 1
  2. 2. Internal representation      In order to act intelligently, a computer must have the knowledge about the domain of interest. Knowledge is the body of facts and principles gathered or the act, fact, or state of knowing. This knowledge needs to be presented in a form, which is understood by the machine. This unique format is called internal representation. Thus plain English sentences could be translated into an internal representation and they could be used to answer based on the given sentences. 12/23/13 2
  3. 3. Properties of internal representation     Internal representation must remove all referential ambiguity. Referential ambiguity is the ambiguity about what the sentence refers to. Eg: ‘ Raj said that Ram was not well. He must be lying.’ Who does ‘he ‘ refers to…?. 12/23/13 3
  4. 4. Properties of internal representation..       Internal representation should avoid word-sense ambiguity. Word-sense ambiguity arise because of multiple meaning of words. Eg: ‘Raj caught a pen. Raj caught a train. Raj caught fever.’ 12/23/13 4
  5. 5. Properties of internal representation..     Internal representation must explicitly mention functional structure Functional structure is the word order used in the language to express an idea. Eg: ‘Ram killed Ravan. Ravan was killed by Ram.’ Thus internal representation may not use the order of the original sentence. 12/23/13 5
  6. 6. Properties of internal representation..  Internal representation should be able handle complex sentence without losing meaning attached with it. 12/23/13 6
  7. 7. Predicate Calculus     Predicate Calculus is an internal representation methodology which help us in deducing more results from the given propositions (statements). Predicate calculus accesses individual components of a proposition and represent the proposition. For example, the sentence ‘ Raj came late on Sunday’ can be represented in predicate calculus as (came-late Raj Sunday) Here ‘came-late’ is a predicate that describes the relation between a person and a day. 12/23/13 7
  8. 8. ‘ Raj came late on a rainy Sunday’ can be represented as  (came-late Raj Sunday) (inst Sunday rainy) Predicate permits us to break a statement down into component parts namely, objects, a characteristic of the object, or some assertion about the object.  12/23/13 8
  9. 9. Syntax of Predicate calculus 1. Predicate and Arguments In predicate calculus, a proposition is divided into two parts:          Arguments (or objects)                Predicate (or assertion) The arguments are the individual or objects an assertion is made about. The predicate is the assertion made about them.  12/23/13 9
  10. 10.        In an English language sentence, objects are nouns that serve as subject and object of the sentence and predicate would be the verb or part of the verb. For example the proposition: ‘Vinod likes apple’ would be stated as: (likes Vinod apple) Where ‘likes’ is the predicate and Vinod and apple are the arguments. In some cases, the proposition may not have any predicates. For example: Anita is a woman. 12/23/13 i.e. (inst Anita woman). 10
  11. 11. 2. Constants  Constants are fixed value terms that belong to a given domain.  They are denoted by numbers and words. Eg: 123,abc. 12/23/13 11
  12. 12.      3.Variables In predicate calculus, letters may be substituted for the arguments. The symbols x or y could be used to designate some object or individual. The example “Vinod likes apple “ could be expressed in variable form if x = Vinod and y = apple. Then the proposition becomes: (likes x,y) If variables are used, then the stated proposition must be true for any names substituted for the variables. 12/23/13 12
  13. 13.    Instantiation Instantiation is the process of assigning the name of a specific individual or object to a variable. That object or individual becomes an “ instance“ of that variable. In the previous example, supplying Vinod and apple for x and y is a case of instantiation. 12/23/13 13
  14. 14. 4. Connectives     There are four connectives used in predicate calculus. The are ‘not’, ‘and’, ‘or’ and ‘if’. If p and q are formulas then (and p, q), (or p, q), (not p) and (if p, q) are also formulas. They can be expressed in truth tables. 12/23/13 14
  15. 15. (not p)    12/23/13 p T F (not p) F T 15
  16. 16. (and p, q)  p  T  T  F  F 12/23/13 q T F T F (and p, q) T F T F 16
  17. 17.       (or p, q) p T T F F 12/23/13 q T F T F (or p, q) T T T F 17
  18. 18. (if p, q)      12/23/13 p T T F F q T F T F (if p, q) T F T T 18
  19. 19.     5. Quantifiers A quantifier is a symbol that permits us to state the range or scope of the variables in a predicate logic expression. Two quantifiers are used in logic: The universal quantifier –’for all’. i.e (forall (x) f) for a formula f. The existential quantifier – ‘exists’. i.e. (exists (x) f) for a formula f. 12/23/13 19
  20. 20.    6. Function applications It consists of a function which takes zero or more arguments. Eg: friend-of(x). 12/23/13 20
  21. 21.     “All Maharastrians are Indian citizens” could be expressed as: (forall (x) (if Maharastrian(x) Indiancitizen(x)). “ Every car has a wheel” could be expressed as: (forall (x) (if (Car x) (exists (y) wheel-of (x y))). 12/23/13 21
  22. 22. The predicate calculus consists of:       A set of constant terms. A set of variables. A set of predicates, each with a specified number of arguments. A set of functions, each with a specified number of arguments. The connectives- ‘if’, ‘and’, ‘or’ and ‘not’. The quantifiers- ‘exists’ and ‘forall’. 12/23/13 22
  23. 23.  The terms used in predicate calculus are:  Constant terms.  Variables.  Functions applied to the correct number of terms. 12/23/13 23
  24. 24.  The formulas used in predicate calculus are:  A predicate applied to the correct number of terms.  If p and q are formulas then (if p, q), (and p, q), or(p, q) and (not p).  If x is a variable, and p is a formula, then (exists(x) p), and (forall(x) p). 12/23/13 24
  25. 25.    In predicate calculus, the initial facts from which we can derive more facts are called axioms. The facts we deduce from the axioms are called theorems. The set of axioms are not stable and in fact change over time as new information (axioms) come. 12/23/13 25
  26. 26. Inference Rules      From a given set of axioms, we can deduce more facts using inference rules. The important inference rules are: Modus ponens: From p and (if p q ) infer q. Chain rule: From (if p q ) and (if q r ) infer (if p r ). Substitution: if p is a valid axiom, then a statement derived using consistent substitution of propositions is also valid. Simplification: From (and p q) infer p. 12/23/13 26
  27. 27.      Conjunction: From p and q infer (and p q). Transposition: From (if p q ) infer (if (not q ) (not p)) Universal instantiation: if something is true of everything, then it is true for any particular thing. Abduction: From q and (if p q ) infer p. (Abduction can lead to wrong conclusions. Still, it is very important as it gives lot explanation. For example: medical diagnosis.) Induction: From (P a), (P, b),…. infer (forall (x) (P x)).( Induction leads to learning.) 12/23/13 27
  28. 28. Express the following in predicate calculus:  Roses are red. (if (inst x rose) (color x red)). Violets are blue. (if (inst x violet) (color x blue)). Every chicken hatched from an egg.  (forall (x) (if (chicken x) (exists (y) hatched-from(x y))).  Some language is spoken by everyone in this class.  (forall (x) (if (belong-to-class x) (exists (y) speaklanguage(x y))).  If you push anything hard enough, it will fall over.  (forall (x) (if (push-hard x) (fall-over x)).  Everybody loves somebody sometime.  (forall (x) ((exists (y) loves-sometime(x y))).  Anyone with two or more spouses is a bigamist.      (forall (x) ((inst x have-more-spouse) (inst x bigamist(x))) 12/23/13 28
  29. 29.       Arun likes all kinds of food. Apples are food. Chicken is a food. Anything anyone eats and is not killed by is food. Varun eats peanuts and is still alive. Kavita eats everything Varun eats. 12/23/13 29
  30. 30.      The members of The Club are Anil, Sangita, Ajit and Vanita. Anil is married to Sangita. Ajit is Vanita’s brother. The spouse of every married person in the club is also in the club. The last meeting of the club was at Anil’s house. 12/23/13 30
  31. 31. Alternative notations 12/23/13 31
  32. 32.   Knowledge, which is represented in the internal representation technique predicate calculus, could be represented in a number of alternative notations. The important representations are:    Semantic networks Slot assertion notation. Frame notation 12/23/13 32
  33. 33. Semantic network ( Associative networks)   One of the oldest and easiest to understand knowledge representation schemes is the semantic network. They are basically graphical depictions of knowledge that show hierarchical relationships between objects. 12/23/13 33
  34. 34.   For example ‘Sachin is a cricketer’ ie. ( inst Sachin cricketer), can be represented in associative network as Cricketer inst Sachin 12/23/13 34
  35. 35.       A semantic network is made up of a number of ovals or circles called nodes. Nodes represent objects and descriptive information about those objects. Objects can be any physical item, concept, event or an action. The nodes are interconnected by links called arcs. These arcs show the relationships between the various objects and descriptive factors. The arrows on the lines point from an object to its value along the corresponding arc. 12/23/13 35
  36. 36.    From the viewpoint of predicate calculus, associative networks replace terms with nodes and relation with labeled directed arcs. The semantic network is a very flexible method of knowledge representation. There are no hard rules about knowledge in this form. 12/23/13 36
  37. 37.   Semantic networks can show inheritances in the sense that it can explain how elements of specific classes inherit attributes and values from more general classes in which they are included. The isa relation is a subset relation. The cricketers is a subset of the set of sportsman. Cricketer inst isa Sportsman Sachin 12/23/13 37
  38. 38.      Eg: (isa cricketer sportsman). The instance relation corresponds to the relation element-of. Sachin is an element of the set of cricketers. Thus he is an element of all the supersets of Indian international cricketers. The ‘isa’ relation corresponds to the relation ‘subset of’. Cricketers is a subset of sportsmen and hence cricketers inherit al the properties of sportsmen. 12/23/13 38
  39. 39. Example.. Is a Boy has a Ravi Child Goes to School Is a Anitha owns Maruti White is a Anil is a S.E a Human Is a works for plays Is a Color Woman Is Man married to Car 12/23/13 Is a Belongs to TATA Cricket made in is a India Sport TCS 39
  40. 40.   The predicate calculus lacks a backward pointer resulting a long search for retrieving information. Thus the predicate calculus along with an indexing (pointing) scheme is a much better internal representation scheme than semantic networks as it has connectives and quantifiers. 12/23/13 40
  41. 41. Slot assertion notation.       In a slot assertion notation various arguments , called slots, of predicate are expressed as separate assertions. Slot assertion notation is a special type of predicate calculus representation. For example (catch-object sachin ball) can be expressed as (inst catch1 catch-object)…. // catch1 is a one type of catching. (catcher catch1 sachin)….// sachin did the catching. (caught catch1 ball)…..// he caught the ball. 12/23/13 41
  42. 42. Frame ( Slot and Filler)notation.       Frame notation combines the different slots of the slot assertion notation. Thus we have, (catch-object catch1 (catcher sachin) (caught ball)). Here we have constructed a single structure called a frame that includes all the information. 12/23/13 42
  43. 43. Convert the following to first-order predicate logic using the predicates indicated:      swimming_pool(X) steamy(X) large(X) unpleasant(X) noisy(X) place(X) All large swimming pools are noisy and steamy places. All noisy and steamy places are unpleasant. All noisy and steamy places except swimming pools are unpleasant. The swimming pool is small and quiet. 12/23/13 43
  44. 44.         All large swimming pools are noisy and steamy places. (forall (x) (if (and large(X) swimming_pool(X)) (and noisy(X) (and (steamy(X) place(X)))). All noisy and steamy places are unpleasant. (forall (x)(and noisy(X) (and (steamy(X) place(X)) unpleasant(X))). All noisy and steamy places except swimming pools are unpleasant. (forall (x)((not swimming_pool(x)) and noisy(X) (and (steamy(X) place(X)) unpleasant(X)))). The swimming pool is small and quiet. (and swimming_pool(x) and (not large(X)) (not noisy(X))) 12/23/13 44
  45. 45. Represent in predicate calculus and then in semantic network Circus elements are elephants. Elephants have heads and trunks. Heads have mouths. Elephants are animals. Animals have hearts. Circus elephants are performers. Performers have costumes. Costumes are clothes. 12/23/13 45