3rd Lesson

You might also like

You are on page 1of 47
Knowledge Representation hermels) knew thw shies | scat Introduction is having familiarity with language, concepts, procedures, rules, ideas, abstractions, $s, customs, facts and association coupled with an ability to use these notions effectively in ing different aspects of the world. Without this ability, the facts and concepts are aningless. The meaning of knowledge is closely related to the meaning of intelligence. ligence requires the possession of and access to knowledge. ion: Knowledge is a body of facts and principles accumulated by human kind or the act, ‘state of knowing. ge may be declarative or procedural. knowledge is compiled knowledge related to the performance of some task. e.., the ed to solve an algebraic equation are expressed as procedural knowledge. tive knowledge on the other hand, is passive knowledge expressed as statements of facts he world, Personnel data in a database is typical example of declarative knowledge. Such explicit pieces of independent knowledge. : is a special by humans to solve complex problem. Inowledge is a type of knowledge used vecon 3 are the knowledge used vo make good judgement, or the strategies tricks or rules of Used to simplify the solution of problems. Heuristics are usually acquired with 3-2 /whion Anil! inaligonce Knowledge is what we know. Think of this as the map of the world are build inside our brains, Like a physical map, it helps ‘us to know where things are but it contains more that. It also contains our beliefs and expectations, "If I do this, I will probably get that. Crucially, the brain links all these things together into a giant network of ideas, memories, predictions, beliefs etc. It is from this ‘map’ that are decide our decision, not the real world itself. Our brains constantly update this map from signal™ coming through our eyes, ears, nose, mouth and Skin. You can't currently store knowledge in anything other than a brain because brain connects it all together. Everything is inter-connected in the brain. Data: Data are facts of the world. Example, take yourself. You may be 5 ft tall, have brown hair and blue eyes. All of this is data ‘On many ways, data can be thought or as description of the world are can perceive thi Tceive i! Our senses and then brain can process this. a Seciaiaia Human beings have used data as long as have existed to form knowledge of the workd Until we started using information, all we are could use data direc - 7 ily. If Fa how tall. I was, you would have to cone and look at me our knowledge Sie noes Be, ts by our direct Desirable Properties of Knowledge \ i ‘This voluminous. ‘ii Itis hard to characterize accurately, alii“ Itis constantly changing. iv, It differs from data by being organized in a way that corresponds to the used, “sy Iwill be a age ae a . Krowedve Represenaton wisn 3-3 2, Knowledge Representations and Mapping order to solve complex problems encountered in artificial there is a need of both large amount of knowledge some mechanism for manipulating that knowledge to create to new problem. A variety of wa YS of representing ge (FACTS) have been exploited in AL. are two different kinds of entities used to represent knowledge: Fact: Fact is a truth in some Televant world. These are the things-that we want to Representation: These are the things we will actuall ly be able to manipulate. Structuring . these entities in two levels-as: @ Knowledge level: The knowledge level at which facts (including each agent’s __ behaviours and current goal) are described. ‘Symbol level: The symbol level at which representations of object at the knowledge level are defined in terms of symbols can be manipulated by program. Facts tetera representation sentations and on the two ways mapping that must exist aan aerate rie in ert oerccnn ae tation. The backward representation mapping goes another i ignigs cearenty ight steno ntation of facts is for facts that we use in @ program, we may also need to be e of the representation jon of those facts in order to facilitate getting information re ers we anst also have mapping functions from English ou system. Reasoning le —] programs 4 / when Artiicia! Inteligence sentences to representation. We are actually going to use and from it back to sentences figure) 3, shows how these three kinds of objects relate to each other. Lets look at simple example using mathematical logic as representational formalism. Ag Consider the English sentence: (a spot is a dog. r The fact represented by English sentence is represented in logic as: dog (spot) Logical representation of the fact that all dogs have tails: Fi ‘Wx: dog(x) — hastail (x) Using deductive mechanism of logic, new representation of object: hastail (spot) i Using backward mapping function, we could then generate the English sentence spot has a tail, For example, The two sentences “All dogs have tails” and “Every dog has a tail” fact, namely that every dog has atleast one tal, Or iota ee fis, ae the same either the fact that every dog has atleast one tail or the fact that each dog has one eccec tater May represent either the fat that every dog has atleast one tailor tae ann ils: The tail that every dog has. So when we try to convert English sennen that there is a representation such as logical propositions, we must fist decide wae, ‘ate some othe represent and then convert those facts into new representation, © sentence The stating link of figure 3.1 isthe key component of the design of any aka program. We need to understand the role thatthe internal representation of a gy-4°c2° based program. The manipulation results in a new structure that can also be in Plays in a representations of facts, More precisely, these structures shouldbe an internal epee, facts that correspond to the answer to the problem describes by the stating set of fact, M08 of ty % iy Knowledge Representation when \ 35 3, Approaches to Knowledge Representation ‘A good system for the representation of knowledge in a joular domain should have the following properties: Inferential adequacy: The ability to manipulate the representational structure in such a way so as to derive a new structure corresponding to new knowledge inferred from old. Inferential efficiency: The ability to incorporate into the knowledge structure additional information that can be used to focus the attention of inference mechanism in the most promising direction. Acquisitional efficiency: The ability to acquire new information easily. The simplest case involves direct insertion by a person, of new knowledge into the database. Ideally, the program itself would be able to control knowledge acquisition. There is no single system that optimizes all of the capabilities for all kinds of knowledge. So, multiple techniques for knowledge representation exit. 2. Simple relational knowledge: The simplest way to represent declarative facts is a setof relations of the same sort used in database system. Figure 3.2 shows relational system 180 Right-right 170 | Right-right 218 Left-left i Leftcright iliams_ See sor, 60 180, right-right) Figure 3.2: Simple relational knowledge ‘and sample fact ritab) 1A. set of attributes and associated values that together im ie a Fmowiedge base. Knowledge about object, their auributes describe the obj and their values need not be simple. ment the basic representation with inference mechanism Sips ious 1s is posto tne representation, One of the most useful forms of o that operate on the structure ts of specific classes inherits attributes inference i inheritance’, in which element is ‘property i which they are included. Ad values from more general classes in a 95 [wa tt vntgoce In property inheritance, objects must be organized into classes and classes. must be arranged in a generalization hierarchy. Figure 3.3 shows additional baseball knowledge lines which represent attributes. Boxed nodes represent objects and values of attributes of objects. ‘The arrow on the lines point from object to its value along with corresponding attributes line. The structure is a ‘slot-and-filler’ structure it is also called semantic network or a collection of frames. | Handed rig Height 5 vod Feyial to < Bets “( Basetal player | Battng avera handed a i Batting teas ice = oa ae Instance Cag, fam [Poe ote mit | [Peeweo]_Tean eee lines j= se] Figure 3.3: Inhertable i Baseball-Player inferential Following about base Lt ve Oceu a vx, Procedura So far, our facts. But ai specifies wi The most ce AS an exam, Reure 3.4 to itiough t does not "Presentatic The oe re Whose Basep, Knowledge Reprosentaton wien. 3-7 inerential knowledg Following examples shows use of first order predicate logic to represent additional knowledge shout base ball. , Vx: Ball (x) 4 Fly (x) 4 Fair (x) A Infield-Catchable (x) a Occupied-Base (First) » Occupied Base (Second) a (Outs <2) 4 < (Line-Drive (x) v Attempted-Bt (x)] — Infield-Fly (x) 2 Vx, y: Batter (x) “ batted (x, y) A Infield-Fly (y) — Out(x) Piocedural knowledge So far, our examples of baseball knowledge have concentrated on relatively stati, declarative fics, But another, equally useful, kind of knowledge is operational or procedural knowledge. It fpetifies what to do when. Procedural knowledge can be represented in program in many ways The most common-way is simply as code (in some programming language such as (LISP)), Asin example, compare the representation of the way to compute the value of bats as shown in 3.4 to one in LISP shown in figure 3. gh LISP one will work given a particular way of Song attributes and values in a list. oes not lend itself to being reasoned about in the same-straight-forward way as the tation of figure 3.4. LUSP representation is slightly more power since i makes explicit use ofthe name of the Whose value for handed is to be found. Baseball-player isa ‘Adult Male bats (lamda (x) (prog) u (cadar x) (etur x (eval © set, L) (cod (89 (et it)? height: batting-average: even 3-8 /whea Anica! metigence 4.1 Propositi Because of difficulty in reasoning with LISP another technique for representing procedura knowledge is the use of ‘production rule’. Formally proposit Production rule is more procedural than the other representation methods. Syntax: If: ninth inning, and symbols (Alphabet score is close, and i Constants: 1 less than 2 outs, and i, Propositions first base is vacant, and Examples, batter is better bitter than nor batter & mh ‘Then: walk the batter A ae Figure 3.8: Procedural knowledge as rules © moral TAM Se 4. Propositional Logic Sentences in Prope Propositional logic P: It is a language for symbolic reasoning. t Atomic senten Proposition: It is a statement that is either true or false, Thue, False are | Examples of proposition: 2 ortight i i. Pitt is located in Oakland section of Pittsburgh. \ Com, a France is in Europe. aa nae trains outside, x x con iv. 2s prime number and 6is prime AnBy4 How are you? It is not a proposition. 4.1 Propositional Logic, Syntax Formally propositional logic P is defined by syntax + interpretation + cievele | Constants: True, False | Propositional symbols Examples, - Fe Pitt is located in Oakland section of Pittsburgh * It rains outside etc. Set of connectives, FAV, =. In Propositional Logic "Atomic sentences: It is constructed from constants and propositional symbols. e, False are (atomic) sentences. or light in the room is on, its raining outside are (atomic) sentences. mposite sentences: It is constructed from valid sentences via connective. Bare sentences then (AAB)(AvB)(A=>B)(A@B) (A vB) a (A vB) are sentences. al Logic, Semantics meaning to the sentences es in propositional logic is defined by: aoa 24 3-10/ lion Antcilietigonce ii, Through the meaning of connectives © Meaning (semantics) of composite sentences Semantics: Propositional Symbols A statement about the world that is either true or false. Examples, i, Itrains outside, ii, Light in the room is on, An interpretation map symbols to one of the two Values; True (T) or False (F), depending on Whether the symbol is satisfied in the world E Light in room is on — True, it rains outside + false T: Light in room is on — False, it rains outside > false The meaning (values) of the propositional Symbol for specific interpretation is given by its interpretation I: Light in the room is on ~ True, It rains outside — False v (Light in the room is on, 1) = True (It rains outside, 1) = False T: Light in the room is on —> False, it Tains outside + False Y Light in the room is on, 1’) = False ‘Semantics: Constants ‘The meaning (truth) of constants: True and false constants are alwa: false values. y pes , P ty a } for any interpretation 1 “ Dz 8 (under any interpretation) assigned to the Sor sponding tu e Semantics: Composite sentences The meaning (truth value) of complex propositional sentences es sz ‘Knowledge Representation oa 311 jris determined using the standard rules ie of logic, E False | True | tue tine True ; True {alo | Fate [Fae [ Te Faso[ Fae : trace rue [True | False | True | True | False Ise | False | True [False | False | True | True ‘Assume the following sentences "+ p=itis sunny this afternoon q= itis colder than yesterday T= we will go swimming s = we will take a canoe trip t= we will be home by sunset les, Ttis not sunny this afternoon it is colder than yesterday “PQ We will go swimming only if it is sunny => P i ip=ar—s If we do not go swimming then we will take a canoe trip = 7 FF we kiss Ceabe mippenennnre willbe bore by runack= $—>* ae - (under any interpretation) evaluate to a single truth composite sentences may always Contradiction (always false) PAmP Tautology (always true) Pyap ain /efln tod anst Model, Valty and satisfy , > Qa : ; rom P « Armode in ogi): An interpretation is a model for a set of sentences if it assigns true to och sentence 288 «P70 «A sentence is satisiable if it has a model: There js at least one interpretation under which qok the sentence can evaluate to true. poR «_Assentence is valid ifit is true in all interpretations. Substitution j.e. if its negation is not satisfiable (leads to contradiction) ySis a valid s Po] eo [Pye] PyvaQane WygnnasP sentence Pv ~} ‘True | True | True False True ‘ [ine f False | Tre. True Te ay oe False | Tue | Tue False True. Fake | False | False False Te aaeieaton v v P is Satisfiable sentence Valid sentence bortadepee Inference oS From P this a proces by which concisions ae reached, The inference rales of propositional ae pee which provide the means to perform logical proofs or deductions. - Transposition ‘The problem is, given a set of sentence S= (Si, So.--S FomP 9, in Prove the truth of S that is show that Ss Formal ‘The use of truth tables to do this is a form of semantic of. Other {formal inference or deduction are also possible Peers yates senthodaaay “ements oe can uch methods do not depend on trth assignment Dut on sna relationship oaly. That is, ied Yewin ’ possible to derive new sentences which are Togical consequences of Si... Sy usi is, ng eee ncn 2 : using only “ey a ke ( © Modus Ponens le yD be From P and P > ainfer Q. ‘This is sometime written as P P+Q _ Chain rule From P > Qand Q->R, infer P+ R om P and from Q, infer P\Q system formal system is a set of axioms S and a set of inference rules L from which new ements can be logically derived. le will sometime denote formal system as < S, L> simply a KB (knowledge base) L> be a formal system we say the inference procedure L are sound if and only if ents s that can be derived from is a logical consequence of Soon ‘Then inference procedure L is complete if and only if any i ee d by can be derived using that procedure. above definitions, suppose S = {P, P -> Q) and L is modus ponens system, since Q can be derived from system. oth sound and complete for the reason given above, 2:14 /abide Avo iteigone punction! Fune «single elem prevent func rep" 8, Predicate Logie Preaticate Hogle is the generic form for aymbolle formal ayaten like fist onder loglo, second omer loglo, manyswortod logle OF {nfinitary Logie, ‘This formal aystenn is distingulehed from other systems in that {ts formulae contain variable whieh ean be ‘quantified, predicatess Pre wh ¢domain D to QUAL and MA tants, variable a co The aywiay for POPL, like PL, is determined by symbols and rulow of combinations, The ic formulas or at semantics of FOPL (First Oror Predicate Logie) are determined by interpretations asslgned y Dreticates, rather than propositions, This means that an interpretation must also aBsign value y coher terms including constant variable and functions, wnee predicates may have argumeni consisting of any of these terms, Therefore, the argumonts of predicate must be assigned befor ‘an interpretation can be made, ‘aon snytion, We often Une ip addition to the abor vid are used for pun 5.2 Representing 5.1 Syntax of FOPL We can easily represer ‘omulas (WFFs) in pro te classical sentence The symbols and rules of combination permitted in FOPL are as follows, 4. Connectives: There are five connective symbols: =: not or negation Nieraining b. &: and or & or conjunction RAINING © Vioror disjunction Vin 4, >: Implication = e > : equivalence or if and only if i, ntiflers: The two quantifier symbols aro 5 (existential q awantification) ang quantification, where (3x) means for some x oF there Is an x (Vx) moans for he a. Or all x, fil, Constants: Constants are fixed value term that belong to a 2iVen domain o they are denoted by numbers, word, small letters such as a,b, 6, f dinec John, ane tv. Variables Varies re ems tht can ase ioe value ve 8 ven doy are denoted hy words and smal eters near he on he lp sich a ini Th hua x,y and 2, Keowlede Ropresniaion fan \ 3-18 Function: Function symbols denote relati to a single element of the domain, § represent functions. Predicates: Predicate symbols denote Telations or functional mapping from the elements of domain D to the values true or false, Capital letters and capitalized words such as P, Q, EQUAL and MARRIED are used to Tepresent predicates. tants, variables and functions are referred to as ‘terms’ and predicates are referred to as a formulas or atoms’ for short. Furthermore, when we want to refer to an atom or its |. We often use the word literal. ions defined on domain D. They map n elements 'ymbols f, g, h, and words such as father of or age-of addition to the above symbols, left and right parentheses, square brackets, braces and the od are used for punctuation in symbolic expressions. Representing Simple Facts.in Logic can easily represent real world facts as logical propositions written as Well Formed (WFFs) in propositional logic. Suppose we want to represent the obvious fact stated by 3:16/ wha Ato inetgence whic! ly ot le to draw any conclusiog, ion, and we should not be abl hich should be a totally separate assertion, . about similarities between Socrates and Plato. It would be much better to represent these facts j. MAN (SOCRATES) MAN (PLATO) All men are mortal MORTALMAN But this fils to capture the relationship between any individual being a man and that individual being a mortal. To do this, we really need variables and quantification unless we are ceiling to ‘rite separate statements about the mortality of every known man, In predicate logic, we can represent real world facts as statement written as WEF (Well Formed Formulae). Consider the following set of sent knowledge representation, Marcus was aman, Marcus was a Pompeian, All Pompeians were Romans, Caesar was a ruler. Nenees 10 explore the use of predicate logic as a way of AllRomans were ether loyal to Caesar or hated him. Everyone is loyal to someone, People only try to assassinate rulers th 4 ey are not loyal to. viii, “Marcus tried to assassinate Caesar, ‘Vx: Pompeian (x) + Roman (x) ruler (Caesar) Knowledge Representation wien \ 3-17 Wx: Roman (x) — loyalto (x, Caesar) v hate (x, Caesar) Vx: > y: loyalto (x, y) Vx: Vy: person (x) A ruler (y) » tryassassinate (x, y) > loyalto (x, y) viii Try assassinate (Marcus, Caesar) Representing Instances and Is a Relationship man (Marcus) Pompeian (Marcus) Vx: Pompeian (x) > Roman(x) ruler (Caesar) x: Roman(x) —> loyalto (x, Caesar) v hate (x, Caesar) instance (Marcus, man) instance (Marcus, Pompeian) 'V x: instance (x, Pompeian) —> instance (x, Roman) instance (Caesar, ruler) Vx: instance (x, Roman) —> loyalto (x, Caesar) v hate (x, Caesar) (Marcus, man) (Marcus, Pompeian) (Pompeian, Roman) (Caesar, ruler) tance (x, Roman) -> loyalto (x, Ceesst) v hate (x, Caesar) oe (xy) Aisa, z) — instance (x, Z) Figure 3.7: Three ways of representing class membe > a6, / whee Miiticial Inteligenoe ‘instance’ and. ‘ina’ described the Important role that they play ig reasoning, property inheritance, igure 3.7 shows the firut five 4 of the last nection represented In lo ic in \ con of the | io gic in three diffe Pf 1.7 shows five nentences o es i 1 { contains the ways, ‘The first part of figure conta membership Is represented with unary predicates (such as Roman) each of which corresponds g a clans, ‘The specific attributor particularly useful form of we the instance predicate explicitely, Thy The wecond part of figure contains representations that w is an object and second argument is 4 predicate instance is a binary one, whose first argument claws to Which the object belongs, ‘The third part contains representations that use both the ‘instance’ and ‘isa’ predicate explicitely One use of ina predicate simplifies the representation of sentence 3, but it requires that one additional axiom (shows here as no, 6) is provided. The additional axiom describes how an ‘instance’ relation and ‘sa’ relation can be combined to derive a new instance relation. 5.4 Computable Functions and Predicates ‘Computable predicates greater-than(1,0) Jens-than(0,1) greater-than (2,1) —less-than (1, 2) greater-than(3,2) —_less-than (2, 3) We don’t have to write the representation of each fact individually, It shor {inefficient to store explicitly a large set of statements when we could, tld be extremely instes each one as we need I. Thus, becomes useful to augment our represent al” COmPUE predicates’, bY ‘computable ‘Computable function Itin often also useful to have computable functional as well as computable predicatey, wt (243, 1) To do this, we first compute the value of plus function given the arguments 2 and wend arguments 5 and 1 to gt. 3 and then > KoonicgeRepesonaton ion, 3-19 pe next example sana shows how the idea of computable funct id predicates can be u ions an be useful man (Marcus) Marcus was Pompeian Pompeian (Marcus) Marcus was bom in 40 A.D. born (Marcus, 40) All men are mortal Wx: man(x) — mortal(x) All Pompeians died when the volcano erupted in 79 A.D. erupted (volcano, 79) A Vx: { Pompeian (x) — died (x, 79)] No mortal lives longer than 150 years ‘x: Wty: Vtg: mortal (x) Aborn (Xt) A Bla ~ ti, 50) —> dead (Xf) Itis now 1991 now = 1991 Alive means not dead Be ve (alive (a) 9 demd (O14 [det > alive ol Tf someone dies, then he is dead at all later times. x: Vix: Vtg died (x,t) A Bt (tn i) > ded ) et’s answer the question ‘Marcus alive?” by proving alive(Marcus, now) n nil atthe end of each proof and so the proof has succeeded. es if they share the same other way they are not i ” : su gels con must be made int of em cont aasement 3 we canal ine BH indicates i i be proved indi the list of conditions remaining to nae proofs that whenever a statement of one 9-20 / when Artclinligence bor(Marcus, t,) using statement 3 by binding A to 40 but then we must also bind A to 40 in gt (now ~ t, 150) Since the two t's were the same variable in statement 4, from which the two goals came, 4 good computational proof procedure has to include both a way of determining that match exist and a way of guaranteeing uniform substitutions throughout a proof, Mechanisms for doing both those things are given below: — alive(Marcus, now) (2, substitution) dead(Marcus, now) (10, substitution) died(Marcus, t) » gtinow, t;) 1 (6, substitution) Pompelan(Marcus) gt(now, 79) @ wal 7) 1 (, substitute equals 9t(1991, 79) T (complete ot) nil Figure 3.8: One way of proving that Marcus Is dead | celles Seams Knowedge Represeraton wien 3-21 —allve(Mareus, now) (9, substitution) tie 3 now) (7, substitution) (Marcus) - bom(Marcus,t,) a gt(now~t,, 150) 1 (4, substitution) man(Marcus) “ born(Marcus, t,) 4 gt(now ~t,, 150) to born(Marcus, t,) gt(now —t,, 150) te gtinow — 40, 150) te at(1991 — 40, 180) (compute mins) t(1951, 150) (compute ot) nil Figure 3.9: Another way of proving that Marcus Is dead te between propositional logic and first-order logic. — [0ct.2017- 44) Objects, Properties and logic Variables and quantification sentences have structure: terms: father-of(mother-of(x)) Facts(P,Q) __ ‘Automatic Sentences connectives Tout ae tion, reel backward — chainir DPLL,GSAT, eee as dite a prolog,theoren ast in practice ns | NP-complete_ 322/ nse Artificial Intelligence 5.5 Resolution Resolution is a rule of inference leading to refutation theorem- proving technique for sentence in propositional logic and first order logic. iit. i In another word, iteratively applying the resolution rule in a suitable way allows for telling whether a propositional formula is satisfiable and for Proving that a first order formula is F uunsatisfiable, v Attempting to prove a satisfiable first order formula as unsatisfiable may result in a nog co terminating computation, vx 5.6 Conversion to Clause Form ae pert se oa co fa ay Romans who know Marcus either hate Caesar or think that anyone ee This should be represented in WEF as z ‘Vx: [Roman (x) » know (x, Marcus)] —> va Uhate(x, Caesar) v (Vy: 32: hate (y, 2) > thinkcrazy (x,yy) j Elim Algorithm to convert to clause form a ‘ ‘ ee caerat aa wg " i aa transformation on the WEF given above yields ‘Orming this Pod, Vx: 5 [Ror A know (x, ee pa) cee Smee MO ee hate (y, 2)) v Pas ng fi, Reduce the scope of - to a single term ah, 7 GP) =p, De-Morgan’s law says that be aA b) =a and rian ; 7@vb)=4anab nt and the standard correspondences between quantifiers ms, (5 Vx: P(x) = 3x: P(x) and 5 3(x): P(x) = V x: APC) ty ne, ist, Knowledge Roproseniaion wiea\\ 3-23 performing this transformation on WFR from step 1 vx: [> Roman (x) v — know (x, M: v thinkerazy (x, y))] + Marcus)) v {hate (x, Caesar) v (vy: Vz: —hate(y, z) Standarize variabl i es i les A that each quantifiers binds a unique variable since variables are just dummy names, this process cannot affect the truth value of the WFF. For example the formula: vx: P(x) V Wx: Q(x) converted to Wx: P(x) Vy: Q(y) Move all quantifiers to the left of the formula without changing their relative order performing this operation on step 2 we get Vx : Vy: Vz: [4 Roman (x) v 7 know (x, Marcus)] v {hate (x, Caesar) v (= hate (y, z) v thinkcrazy (x, yl This is known as ‘Prenex normal form’ Eliminate existential quantifiers. A formula that contains an existentially quantifiable exit q variable assets that there is a value that can be substituted for the variable that makes the formula true. We can eliminate the quantifier by substituting for the variable a reference to 1 function that produces the desired value, Since we do not necessarily know how to produce the value, we must create a new function name for every such replacement. We make no assertion about the functions except that they must exist. For example, 3y: President (y) can be transformed into formula as President (S1) somehow produces a value that satisfies President. ithin the scope ‘of universal quantifiers then the value that Wrexistential quantifiers occur WT value ofthe universally quantified variable. Satisfies the predicate may depend on 3:26 / when Arild iieligence For example, Vx: 3y: father - of (y, x) ‘The value of y that satisfies father-of depends on the particular value of x. segate P and co ‘Thus we must generate functions with the same number of arguments as the number of universal quantifiers in whose scope the expression occurs, This e.g., transformed into i, Repeat until eithe Vx: father-of (S3 (x), x)) 1 Select two This general function are called “Skolem function”, Resolve, th disjunction « Sometime ones with no arguments are called ‘Skolem constants’ ahi: exception: if vi. Drop the prefix clauses co - oni E-Roman(x) v— know (x, Marcus) v {hate (x, Caesar) v (= hate (y, 2) v thinkcrazy (x, both L and yl | U the x Vii. Convert the matrix into a conjuction of disjuncts. then aie it to 4m case of our example, since there are no and's itis only necessary to exploit the ¢ associative property of or. He ab) ve=(av.c) (be) and simply remove the parenthesis giving ~ Roman (x) v — know (x, Marcus) v hate (x, Caesar) vs hate (y, 2) v thinkerazy (x, y) Wil. Create a separate clause corresponding to each conjunet In order for & WFF to be tue, all the clauses that are generated from it must be true. ix, Standardize the variables in the set of clauses generated in step 8, By this, we mean rename the variable so that no two clauses makes refere ‘variable. In making this transformation, we rely on the fact that (Wx: PCR) A Q(X) = Wx: POR) A Vx: Q(x) NCE to the same 7 Resolution in Propositional Logie gorithm: Proposttional Resolution , Convert all propositions of F to clause form, r ‘convert WFF to gt P and convert the result to clause form, Add it to the set of clauses obtained in step Repeat until either a contradiction is found or no Progress can be made, a. Select two clauses call these as parent clause b. Resolve, them together. The resulting clause called ‘Resolvent’ will be the disjunction of all of the literals of both of the parent clauses with the following exception: If there are any pair of literal L and — L such that one of the parent clauses contain L and other contains + L then select one such pair and eliminate both L and — L from the resolvent. If the resolvent is the empty clause, then a contradiction has been found. If it is not then add it to the set of clauses available to the procedure. Let’s look at simple example 25 /eSea Antal hioigrce Resolution in Predicate Logic Consider the Axioms in clause form 1. man (Marcus) Pompeian (Marcus) hom (Marcus, 40) man (x;) v mortal (x3) — Pompeian (x2) v died (x2, 79) erupted (volcano, 79) 7 mortal (x3) v— born (x5, ty) v= gt (y- ty, 150) v dead (%3, tz) now = 2008 2 alive (xats) v dead (xa 'y) b. dead (Xs, ts) v alive (x, te) w dead (is, 4) VA Bt (te) v dead (14 te) To prove => — alive (Marcus, now) aire(sarcss, row) ga ‘arcs, row, —desdiMercss, ro) 10 Tharcaly ro, Bares, 1) 1 — gow, 4) rie, 70% ~fempatantsarcus) v — giro, 79) ST tateattste ecuaie — Pompaianptarcie) v — gi2008, 79) re. — Pompwanbtarcs N Figure 3.10: Using resohaion with equality and reduce Jp propositional logic it is easy to determine that two literals ‘cannot both be true at same time. Simply look L and ~L. In predicate logic this matching process is more complicated, since "finding of variables must be considered. ‘Example: man(John) and man(John) is contradiction while man(John) and man(Himalayas) is ‘not, Thus in order to determine contradiction we need a matching procedure that compares two “iterals and discovers whether there exists a set of substitution that makes them identical. There jsarecursive procedure that does this matching. Itis called unification algorithm. Innificaton algorithm each literal i represented a a lis, where first element is the name of a e and the remaining elements are arguments. The argument may be single element ) or may be another list. We can have literals as ate Marcus Caesar) Marcus(ruler of Rome)). ‘two literals, first check if their first element is same. If so proceed, otherwise they the literals ¢ Marcus Caesar) constants, functions or predicate cannot match, whereas identical ones can. {ean match another variable, any constant or function or predicate expression the condition that the function or predicate expression must not contain any m must be consistent. Substituting y for x now and then z for x later is (a substitution y for x written as yx), ee 3-26/ whos Alice Iligonce list represen The wnilewion algorithm sisted below as procedure unify ly La). etme aoe the composition of substitution that where performed during the match. Pave indicates that a match was found without any substitution. If the list contains a single , indicates that unification procedure failed. UNIFY (L;, Ly) i, If L; or L; is an atom part of same thing do IL; or L; are identical then return NIL. b. else if Ly is variable then do IfL; occurs in L, then return F else return (La 1) €, else if Ls is variable then do If 1, occurs in L, then return F else return(L La) else return F, fi, I length (L1) is not equal to length (L;) then return F. fii, Set SUBST to NIL {ibe end of procedure, SUBST wil contain all the substitutions used to unify a, Ly). iv, For1= 1 to number of elements in L, do a San UNEEY with oF clement of L1 snd clement of Ls puting te eeu ial b. if'S=F then retum F €. if S is not equal to NIL then do Apply S to the remainder of both L, and L, ‘SUBST: = APPEND (s, SUBST) retum SUBST. ud chaining is one of the two main methods of reasoning ‘using an inference engine and can be described logically as repeated application of modus ponens. Forward chaining is a implementation strategy for expert systems, business d production rule systems. rd chaining starts with the available data and uses inference rules to extract more data until is reached. An inference engine using forward chaining searches the inference rules until ‘one where the antecedent (if clause) is known to be true. When such a rule is found the ‘can conclude, or infer the consequent (then clause) resulting in the addition of new ‘that the goal is to conclude the color of Pet named Fritz, given that the Croaks and eats ad that the rule base contains the following four rules, ‘Croaks and x eats flies-Then X is a frog. chirps and sings-Then X is a canary. a frog-Then X is green. canary-Then X is yellow. forward chaining by following the pattern of a computer as it evaluates the ing facts ng, the inference engine can derive Fritz is green in a series of steps. facts indicate that “Fritz Croaks” and “Fritz eats flies” then antecedent of 3-90/ when Arica! nteligence le, 9F ituting Fritz for x and the inf wom ii. The antecedent of rule 3 is then satisfied by substituting Frit co al a= em is j ff \ 5 to des ‘The name “forward chaining comes from the facts thatthe inference engine starts withthe day ye 60% and reasons its way to the answer as opposed to backward chaining which works the other way eo around. Inthe derivation the rls are used in opposite order as compared to backward chaning 6X cr Inthis example rule 2 and rule 4 were not used in determining that Fritz is green. | x chip i Because, the data determines which rules are selected and used this method is called data driven, g 1Xis0 fro in contrast to goal driven backward chaining inference. The forward chaining approach is often y_xisn ca employed by expert systems such as CLIPS. he ‘One of the advantages of forward chaining over backward chaining is that the reception of new ata can trigger new inferences, which makes the engine better suited to dynamic situation in which conditions are likely to change. |_—— {WX croaks « i WX chirps a i ItXisa frog Backward Chaining 5X is a cana -——— 8 cana aT Its an inference method that can be described as working backward from the goals, It is used in ‘automated theorem provers, inference engines, proof assistants and other artificial intelligence . % ©roaks ay applications. WX chirps an In game theory, it's application to subgames in order to find a solution to the game is called J IX is backward induction. In chess, itis called retrograde analysis, and itis used to generate tablebases aires: for chess endgames for computer chess. Backward chaining is implemented in logic programming by based on modus pones inference rule. It is one of the two == SLD resolution, Both rules are How it works, Backward chaning stars with a list of goals and works backwards from the consequent to te fatocsdet 1o se if there is dat salable tht will sport any ofthese conseaueas, CHEM clause) that matches a desired goal Ifthe antecedent (If clause) of that rule is not known yo tre, then it is added 10 thelist of goals (in order for one’s goal to be confirmed one mur ge ‘provides data that confirm this new rule. Je, Suppose & NEW pet, Fritz, is det; vy is deliverea about in an opaque box along with two facts i Fritz croaks Fritz eats flies goal is to decide whether Fritz is green, based on a Tule base containing the following four 1/X croaks and eats flies- Then X is a frog, 1X chirps and sings- Then X is a canary, WX sa frog- Then X is green, . IfXisa canary- Then X is yellow. IfX croaks and eats flies- Then X is a frog. IfX chirps and sings- Then X is a canary. IfX is a frog: Then X is green. IfX is a canary: Then X is yellow. 1X croaks and eats flies: Then X is a frog. IfX chirps and sings: Then X is a canary. y IfX is a frog: Then X is green- IXisa : Then X is yellow. 1X croaks and eats flies: Then X is a frog: 18 chinps and sings: Then X is ¢an9"- UXis a frog: Then X is green: 1X is a canary: Then X is yellow. TX creeks and i ease fess THEN 8 0% UX chirps and X sings: Then X 18860000" IX isa frog-Then X is gree? F age four i Fritz is in UX is acanary-ThenX is yEUOW nec f seeney: ie groce With backward reasoning an infé al assertion wat (0 D> Pr : eps. To start the query is phrases * “Fiz is green’. n/ bide Avion hetero ‘w ronsequent matches the goal so the ryje ‘ Yovive ds substituted for X in rule 9” to see if its consequ ‘ beootien. Eide a frogs Then Fritz is green, : = Since the consequent matches the goal (“Fritz is green”) the rules engine now needs to sy if the antecedent ("If Fritz is a frog”) can be proved the antecedent therefore become, new goal Mit isa frog. * i, Again substituting Fritz for X rule becomes if Prits croaks and Fritz, eats flies- Then Fritz is a frog. Sinoe the consequent matches the current goal (“Fritz is a frog”). The inference enging How needs (0 seo if the antecedent (“If Fritz croaks and eats flies”) can be proved. The antecedent therefore become the new goal. Frits croaks and Fritz eats flies, iii, Singe this goal is the conjunction of two. Statements, the inference engine breaks it into (Wo subgoals, both of which must be proved. Pritz croaks: Fritz eats flies 1. To prove both of these sub-goals the inference e jiven as initial facts, Therefore conjunction is true, Fritz croaks and Fritz eats flies therefore the ant ‘must be true, Fritz is a frog, ‘Therefore the antecedent of rule 3 is true and the cor ngine see both of these subgoals Mecedent of rule is true and con sequent must Fritz is green, a This derivation therefore allows the inference engi gine to itz is and 4 were not used. Pte Wat itz i geen, Roe iS 6. Game Playing Artificial Intelligence is used in various areas i.e., computer vision, natural eee 4 Speech recognition, games etc, Games are very interesting because it hae ne es intelligence, games provide structural task in which itis very easy to measure ae to ‘The notion that computers might play games has existed at least as long as computes: anes ay Kowlage Regresentaion wSiea\ 3033 How games were invented by famous personalities, Charles Babbage, thought about programming of chess in nineteenth century. (Claude Shannon published in whi @ paper in which he has described the mechanism that in a program to play chess in 1948. ane After few years Borden built a machine to play tic-tic-toe game in 1953. Alan i i Turing described a chess playing program although he never built it in 1953, _ Arthur Samuel bad build the first significant operational game playing program in 1960. Mac Hack 6 was the frst chess program to beat a person in tournament play in 1967 at MIT, Later Deep Blue was invented as chess playing machines, it had bigger and better computing ‘game did not require large amount of knowledge, moreover it cannot be solved by straight search from starting state to winning position. For example, consider chess play, the ‘branching factor is around 35, In an average game each player might make 50 moves. In nplete game tree, we would have to examine 35™ positions. ‘be said that the straight forward search of the game tree will not be able to select even Ove during the lifetime of its opponent but it can be possible by some kind of Heuristic th procedure is used to generate test procedures, in which the generator generates entire 8 ns and then tester evaluates to improve the effectiveness of a search based e solving program two things can be done: te good paths (moves) we have to improve the generate procedure. snizing and exploring best moves we have to improve the test procedure. m of playing chess. In this there are 35 legal moves available at each move generator, then the test procedure must look at the many possibilities, so ook at each of them. It must be fast by this it cannot do very accurate job, so instead ‘generator we use a plausible move generator in which some small number of re If number of legal moves increases then it is important to apply heuristic to that have some kind of promise. Search is not the only available technique in 3-94/ wien Anil intetigence In some games direct techniques are used to play an entire game then we need both oriented an! non search oriented techniques. In game playing programs a goal state is ope which we win but in some games like chess it is not usually possible even with a good plausiy, ‘move generator, (0 search until goal state is found. We will use graphs with nodes same “States” and edges representing a move, a player moves the game from one state y Cae) Hoar) Figure 3.11 Problem of solving a game differs from other types of graph search. In many cases We want find a single state in a graph and the path from start state to that state. Canna ach We not finding a single path but we ae tying to find a winning move cera, example ofa game graph, It startin some inal state atthe oo ofthe game weve et to the next level. Player one chooses A,B, Co D to get to the second . ext Player makes a move etc, each level of the tree is called ‘ply’, a Figure 3.12: Example game graph ‘In game graph we might consider branching factor (b), ply, and depth (4). Knowodye Reprosenaton when 3-98 In Order to choose the best move the resulting board positions must be compared to discover Which is most advantageous. This is done by using static evaluation function, this function is Similar to that of heuristic function h'. In the A* algorithm: in the absence of complete information, choose the most promising position. In the evelopment of good static evaluation function many of the game playing programs are used. A simple static evaluation function for chess is proposed by Turing, In that it adds the values of black pieces (B), the values of white pieces (W), and then compute the quotient W/B. ‘The heuristic function h can be applied at terminal nodes and used to propagate values back up the search graph so that the best next move can be chosen. But it is inadequate for two person ‘games such as chess. As values are passed back up different assumptions must be made at levels where the program chooses the move and at the altemating levels where the opponent chooses. ‘There are several ways that this can be done. The most common method used is the minimax procedure. 7. The Minimax Search Procedure ‘The minimax search procedure is a depth search procedure. In search procedure we have to plausible move generator on the starting current position to generate the set of possible essor positions. Next step is to use static evaluation function to those positions and choose move. After the position is generated by the best move, we can make the next move. To good situations for use we assume that the static evaluation function retams large es, s0 our goal is to maximize the value of the static evaluation function of the next board bn, So the general methods for determining optimal move, we have t9 genera complete nee down to terminal states. Thea compute utlity of each node bottom up from leaves root. At each max node pick the move with maximum utility, At min node pick move ninimum utility. er the following figure 3.13(a) b: from -10 to 10. qums values y assuming static evaluation function that re 1-10 | aha ‘Antictel inteligence Since our goal is to maximize the value of heuristic ic function. 8. 5g; 72 Figure 3.13 (a): One ply search We choose to move B upto A, ic., A is having value 8. This is done by comparing values of nodes B, C and D as follows. In worst case max value = Ist we compare the value of node B then C and D. max (8, 0) = 8 max (3, ~20) = 3 max (~2, ~7) = -2 Therefore, from these three nodes maximum value is of node A. i.e, max(B, 3, -2) = 8 S0A=2, The static evaluation function is not completely accurate so that we would than one ply. Search further ahead In the chess game, suppose we are in the middle of piece exchange. After our ‘ would appear to be very good but if we look one move ahead, we will see thar ope ts Sustio® also gets captured and so the situation is not favourable as it seemed. Instead or of our pieces evaluation function to each of the position, we apply the plausible move spplying static shows two ply search respectively. Suppose we are made to move B then the Fig. 3.13(b) choose among E, F and G, The opponents goal is to minimize the value of fy > must opponent choose ~6, in the next step at level representing our choice the maxim eee was - — Knowiedge Regresenaton wbion\ 3-37 (2) Maximizing ply C2) D] (+4) Minimizing pty J AE J] {k ) 0 8) (2) 4) 68) Figure 3.13 (b): Backing up the values of a two ply search Sn of maximizing and minimizing at alternate ply when evaluations are being pushed Inimagha® '0 the opposing strategies of the two players and gives this method the A]K_Maximizing ply c 1D] Minimizing ply E F G H] Maximizing ply 1 J K L M N oO P Q = 2 1 1 4 a 1 0 2 6 3 Figure 3.14: Example of Minimax search procedure From the above game tree we have to find that the best move Search procedure is as follows so we have to find maximum value of root node A, the second {evel is minimum and at level — 3 i is maximize ply. Now we have to find the max value of node ‘A atthe end, so we need to know value of C and D. Similarly for node C we need to know value of node E, F. Now for node D we need to know value of node G, top. In worst case max value = -22 for max player using minimax Sinilarly we sutinizing p , H. So we start from bottom to Compare max( max( In worst case min value = oo {0M theme t In best case max value = 0» max( 1, In best case min value = -co “be san Me Ww Ist we have to find value of node E then the opponent must choose among I, 5. K then itl "4 maximizing ply so we will take max value =~, then compare Max, 1 max(~2, ~20) = -2 ™maxcy max(2, 20) = 2 Milue of " ne max(1, 20) = 1 de h K(. So from these three nodes the maximum value of the node E, Mig 1 . ey max(-2,2, 1) =2 B=? his is shown in the following tree 4) Ik ea Figure 3.15 to F node, the opponent must choose among L, M. At node F it is ‘Compare max(1, 20) = 1 max(4, 2») = 4 SS0 from these two nodes the maximum value of node F is max(I,4)=4 +. Fe4 Tithe same way we will find the value of node G, we must choose among Nand O max(-l, max(1, -29) = 1 the value of node G max(-1, 1)=1 the opponent must choose among P and Q. find the value of node H —__—_ smoot 40 /ote is sown nt fount 5. Adding Alpha Beta Cutots chose anieag Band F The cron pa in vl peminis protdue s8ep pO eee ews Se aria aco gp polis ea wy ew pe nee One polis Now we male our move 0 thes th oH File ae omcon vot we can abe vale of ‘ioe Compe in it) Sa ha refi omcaeinmesy in Stam hen ow, the ve fae Trench paral soln a ed ~ ey the doce a lt ova pi evo chat. Fort tien Similar ad ala of ae ph food fat: poet ing aes See rice siato) ot a. 6)=1 oan ae et 1 pmnint nA enn 208 ge = ee ‘Compare ‘Aiphaeta pruning is not scl & SeSrilmane ae eee Ast colo aoe Following te shows he maize au of ot ade Aby using minimax search =e 4-42 | wha Nii ieligerce It is called alpha-beta pruning because it passes 2 extra namely alpha and beta. Consider an example as shown in fig. 3.18(a). After examining node F, we know that the cpponent is guaranteed a score of -5 of less at C (since the opponent is the minimizing player) But we also know that we are guaranteed a score of 3 or greater at node A, which we can be achieved if we move to B. ‘Any other move that produces a score of less than 3 is worse than the move to B, and we cal jgnore it. After examining only F, we are sure that a move to C is worse (it wil be less than of equal to -5) regardless ofthe score of node G. Thus we are bother to explore node G at all. Of course, cutting out one node may not appear to justify the expense of keeping track of the limits ‘and checking them, but if we were exploring this tre to six ply, then we would have eliminated not a single node but an entire tree ply deep. We will consider another example of alpha-beta cutoff, in this example we see how the two thresholds alpha and beta, can both be used. Knowle ite ine Reproseriain bow \ 9:43 am x A Be ® © a ©® © Figure 3.10: Alphe-bete outott ‘The initial call starts from A. The value of alpha here ~0t and the value of beta is +0. ‘These valves are passed onto subsequent nodes in the tree, At node A maimizer must choose max of B and C, s0 A calls B firs. Node B is minimizing ply it must choose minimizing value from node D and E At node D, it looks at its left child whic! is leat node, This node returns a value of 3. Now ‘the value of alpha at node D is max(—c, 3) = 3 -To decide whether its worth looking at its right node or not, we check the condition etn <= alpha (B <= 0). This is false since B= +0 and a = 3. So we continue the search ‘Now node D returns a value of 5. AUD a= max(3,5)=5 “D=s We will move upwards to node B. ‘At node B beta = min (c, 5) = 5, The minimizer is now guaranteed a value of $ oF lesser, Node B calls E to see if it can get a lower value than 5. [Node B is having scores 6 and 9, This value we will compare to value of nade B which is 5 (le. 6 >5 and 92 5), It is found that the values 6 and 9 is greater than of f of node B Thence right side branch of node B will be totally pruned bec Fallow 6 or 9 10 be at node B(i.e. at minimizing ply). mum player will 404 / whan Ariel eligoce Following figure shows only left part move of atree, We move towards root node A, Root node has childe node C which has again two child nodes F ‘and G, Left side F node is having score 1. It will be compared to value of node A which is a = 5 {ts Jess 80 we cannot explore another branches, Hence total right side tree of node A will be pruned. Following tree shows final search tree after applying alpha-beta cutoff. 25 <— Maximizing player Knowledge Representation when 3-49 Question is Asked in Previous Exams State any two approaches to knowledge representation, Define forward i : (hoc ate ae, aor. 2016) 3. What is knowledge and data? $. Distinguish between knowledge and data. [ct 16, Aor, 161 5. State less desirable properties of knowledge. [Oct 20161 1. _ Represent each of the following sentences in FOL (First-order logic). [Apr. 2018) i. __ If it’s raining, then the ground is wet. ii. Mohan knows Radha’ father. iii, If the switch is on and the light is off then the light-bulb is broken. jy. _ All computers have a processor. Translate the following FOL (first-order logic) statements into English statements. : ‘yx: student (x) => Smart (x) [Ape. 20181 ji, 3x: student (x) Smart @) iii, Takes (Ram, computer) V Takes (Ram, mobile) iy. 7x (student (x) > ‘By(course (y) A Takes @y) the following game tree. s0/ when sl 5. 1B. i tree and indicate where i it following search & ning algorithm. to Apply alpha-beta pr cut-offs occur. Give state space representation of “water jug problem”. [Apr 2017 Where there are 2 jugs of 4L and 3L respectively we want 2L water in 4L jug. Convert following statement into WFFS: i. Marcus was aman ii, Marcus was a pompeian iii, All pompeians were Roman iv. Caesar was a ruler All romans were either loyal to caesar or hate him. Every one is loyal to someone. People only try to assassinate rulers they are not loyal to vili. Marcus tried to assassinate caesar. Explain the MINIMAX procedure. [Ape 207 Oct, 2018 Describe any two approaches of representing knowledge, Convert following WFF To CNF Vx: [Roman (x) A Caesarjv,vy:Sxhate(y, 27 thinkcrazy (x,y))]. Discuss refinements in MINIMAX. algorithm with alpha-beta cutoffs, Consider following statement and convert to Loo. 2018) Hindi”, using backword chaining, Predicate logic and prove that “Ramu k#0"* i, Ramu is soldier. Ramu is resident of pune, Pune is in India f iv. All Indian soldiers know Hindi, : Discuss in brief the various issues in, knowledge representation, tan. 208 yep Knowledge Recresenitor fa\\ 3-61 \4, Convert following statement into WEFs. i, Marcus was a man, : (or. 20161 ii, _ Marcus was a Pompeian. iii. All pompeians were Roman. iv. Caesar was a ruler. v. All romans were either loyal to Caesar or heat him. vi. _ Every one is loyal to someone. j People only try to assassinate rulers they are not loyal to. viii. Marcus tried to assassinate Caesar. 15. Explain the algorithm to convert WFF to CNF. [Aor 20161 1. Explain the algorithm to convert WFFs to CNF. [Apr. 2018) ‘Compare propositional logic and predicate logic. [Apr. 2018) Explain Unification algorithm with a suitable example. [Oct. 20171 Consider the following English statements and their WFF's equivalent. __{Apt. 20171 ‘vx: By: Dog(y) - owns(xy) = Animal lover (x)) ‘Yee Animal Lover(x) = (vy: Animal (y) = ~Kils (.¥)) the cat | kills jack, Tuna) kills(curiosity, Tuna)cat(Tuna) vx: (cat(x) = Animal (s)) Every dog owner is an animal lover No animal lover kils an animal Either Jack or curiosity kiled Tuna, Using resolution prove that curiosity did not kill Tuna. il (aor, 20171 i semantic net representation ), Black smith Marcus) Priya gave the Pink flowered vase 0 teacher. : 17 Describe Resolution algorithm with example. [oct.20161 is Resolution’ i to English statements 10 FO ame semester. homework. 3-82/ when Artificial inteligence 8. Consider following statements: [Oct 2015 i, Ravi likes all kind of food. ii, Apples and chicken are food. iii, Anything anyone eats and is not killed is food. iv. Ajay eats peanuts and is still alive. Vv. Rita eats everything that Ajay eats. ‘Convert above statements to WEF in first order Predicate calculus. 9. Apply alpha-beta pruning algorithm to following search tree. M v m M a P x D

You might also like