0% found this document useful (0 votes)
37 views24 pages

Ai Unit 4 Techknow

Ai textbook for Sppu Students TE Ai and DS

Uploaded by

Atharva Kulkarni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
37 views24 pages

Ai Unit 4 Techknow

Ai textbook for Sppu Students TE Ai and DS

Uploaded by

Atharva Kulkarni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 24
KNOWLEDGE 5 aa | Logical | i tomes Agents, The Wumpus World, Logic, Propositional Logic : A Very Simple Logic, propositional Theorem Proving, Effective Propositional Model Checking, Agents Based on Propositional Logic, First- order Logic, Representation Revisited, Syntax and Semantics of First-Order Lagic. Using First-Order Logic, Knowledge Engineering in First-Order Logic. Introduction Understanding theoretical or practical aspects of a subject is called as ea ai knowledge: We can gain knowledge through experience acquired based on the facts, information, ete. about the subject_ After gaining knowledge about i a bject_ After gaining a some subject we can apply that knowledge to derive conclusions about various p oblems related to that subject based on some renaamias - a We have studied various types of agents in Chapter 1. In this chapter we are 6018 to see what is “knowledge based agent’, with a very interesting game example, We are also going to study how do they store knowledge how do they infer next level of knowledge from the existing set. In turn, we are studying various knowledge representation and inference methods in this chapter. ‘aa A Knowledge Based (WB) Ag@M —— ‘As shown Fig, 4.11, a knowledge based agents can be described at different levels : Knowledge Base (KB) end an Inference Engine. 42 At this level, ‘Implementation level consists of domain independent Se oe — an recogni data structures used in knowledge base and sprint So ae or a Prag and resolution. (We will be learning about: logic and resolutior rtially observable environments. Before {in partially ol ble Cherng * Knowledge based agents are crucial to use action, knowledge based agents make use of the existing knowledge along with the current inj trae environment in order to infer hidden aspects of the ee ee i * As we have learnt that knowledge base is a set pl infor mation i surrounding environment (real world), Every single representation In the set 1s called as a semen Sentences are expresses with the help of formal representation language. We can say that Sentence jg, statement which is a set of words that express some truth about the real world with the help Of knowledge representation language. + Declarative approach ofbullding an agent makes use of TELL and ASK mechanism. 7 ‘TELL the agent, about surrounding environment (what it needs to know in order to perform some | action). TELL mechanism is similar to taking input for a system. Then the agent can ASK itself what action should be carried out to get desired output. ASK is similar to producing output for a system. However ASK mechanism makes use of the knowledge base to decide what it should do, # co TELLand ASK mechanism involve inference. When you run ASK function, the answer is generated with the help of knowledge base, based on the knowledge which was added with TELL function; Previously, ‘a 1. TELL(K) : Is a function that adds knowledge K to the knowledge base. 4 _ 2 ASK(K) : Isa function that queries the agent about the truth of K. * An agent carries out following operations : First, it TELLs the knowledge base about facts/information jt Percejves with the help of sensors. Then, it ASKs the knowledge base what action should be carried based on the input it has received. Lastly, it performs the selected action with the help of effectors, Architecture of a KB Agent Knowledge based agents can be implemented at three levels namely, knowledge level, logical level implementation level. 1. Knowledge level 2. Logical level 3. _ Implementation level tels the most abstract evel of agen implementation. The knowledge level describes agentby knows. That is what knowledge the agent has as the initial knowledge i sseomiel Ente . Basic data structures and procedures to access that knowledge are defined in his level, Initial. € knowledge base is called as background kenowiedge. ‘gents at the knowledge level ean ¢ an agent for which one omly need to what the ns andl what Its goals are n order to speci ia havin regelesel oo Rs tesa ty ee + _forexample : A taxi driving agent might know that the Golden Gate Bridge connects San Francisco with the marin county. 4p vogica evel? sai + Ac che logical level, the knowledge is encoded into sentences) This level uses some formal language to represent the knowledge the agent has. The two types of representations we have are propositional logic and first order or predicate logic. - parece + Both these representation techniques are discussed in detail in the further sections. + For examply 1 Links (Golden Gate Bridge, San Francisco, Marin County). 5 Implementation level describes data structures Used in knowledge base and algorithms that used for data manipulation. + Forexample: Links (Golden Gate Bridge, Sanfrancisco, Marin County}. ‘on KB - Agent (percept) returns an action static * KB, a knowledge base ‘a counter, initially o, indicating time ‘Teut (KB, Make ~ PERCEPT-SENTENCE(percept.t)) action & ASK (KB, MAKE-ACTION-QueRY(®)) ‘TeuL{KB, MAKE-ACTION-SeNTaNCE{action, )) rete + in implementation level, thy’ physical representation of logical level sentences is done)This level also returns action a % ‘5 Fig. 4.1.2 : General function of knowledge based agent < + Fig. 4:12 is the general implementation of knowledge based agent. TELL and ASK are the sub procedures implemented to perform the respective actions. - . Hhie knowledge base agent must be able to perform following tasks" i 2 Represent states, actions, etc. o Incorparate new precepts. © Update internal representations of the world © Deduce hidden properties ofthe world, 0 Deduce appropriate actions. W Artic intelligence (SPUD y You have learnt about vacuum world problem, block world problem so far Similarly we haye problem. Fig. 42.1 shows the WUMPUS world, L WUMPUS is an early computer game also known as,“Hunt the Wumpus". WUMPUS was . A Yob in 1972/1973. It was originally written in BASIC (Beginner's All-purpose Symbolic It eloped Gregory + WUMPUS is amap-based-game Let's understand the game : WUMPUS world s like a cave which represents number of rooms, rooms, which are connected by ways, We will take a 4x 4gridto understand the game. a o WUMPUS is a monster’ who lives in one of the rooms of the cave. WUMPUS eats the = thatroom (3, 1) where WUMPUS Is staying. Sem) aye (agent) comes inthe same room. Fig, 42:1 shows «Player (agent starts from any random position in cave and has 10 explore the cave We ae starting fy (1,1) position. : ‘There are various sprites in the game like pit, stench, breeze, Let's understand this one-by-one: o Few rooms have bottomless pits which trap the pl Fig 42.1 thatroom (1,3), (3,3) and (4,4) have bottomless pit Note that even. WOMPUS can fallintoapi, «Stench experienced in a room which has a WUMPUS in its neighborhood room. See the Fig. 42: bere rq, (2, 1), (3,2) and (4, 1) have Stench. ~ © Breeze is experienced in a room which has a pit in its neighborhood room. Fig, 4.2.1 shows that roam (1,2) (1,4), @.3), @,2), 3,4) and (4,3) consists of Breeze. oe Player (Agent) has arrows and he can shoot these arrows in straight line to kill WOMPUS. ° gold, and arrow. Every sprite has Some fet, ayer (agent) if he comes to that room. You can sein ° © Oneof the rooms consists of gold, this room glitters. Fig, 4.2.1 shows that room (3, 2) has Gold. re «Apart from above features player (agent) can accept two types of percepts which are: Bump and scream. A {s generated if player (agent) walks into a wall. While a sad scream created everywhere in the cave WUMPUS is killed. ————" arora Fig. 4.2.1 : The WUMPUS World {at Description of the WUMPUS World Deseribo WUMPUS WORLD Erntronment. {An agent receives percepts while exploring the ve element ist, which tench, eee ter, bump, ce ares a marae is a ‘own location. _—__ that player (agent) cannot perceive its Ur the player (agent) gets percept as (Stench, Breeze, None, None, None}. Then it means that there isa stench and abreere, but no glitter, no bump, and ‘Ro scream in the WUMPUS world at that position in the game. \.g’stake alook at the actions which can be performed by the player (agent) in WUMPUS World Move: To mave in forward direction, Turn: To turn right by 90 degrees or left by 90 degrees, Grab: To pick up gold if itis in the same roo} (agent), 9. “Shoot : To Shoot an arrow in a straight line in the direction faced by the pl These actions are repeated till the player (agent) kills the WUMPUS or if the player (agent) is killed. If the \WUMPUS is killed then itis a winning condition, else ifthe player (agent) is illed then itis a losing condition and the game is over. Game developer can keep a restriction on the number of arrows which can be used by the player (agent), So if eee we allow agent to have only one arrow, then only the first shoot action will have some effect. [Fthis shoot action ills the WUMPUS then you win the game, otherwise [reduces the probabilty of winning the game, Lastly there is a die action : It takes places automatically ifthe agent enters in a room, with a bottomless pit or in a room with WUMPUS, Die actions irreversible. Goal of the game: Main aim of the game is that player (agent) should grab the gold and return to starting room (here ts ay) without being killed ponster (WUMPUS). ‘Award and punishment points are assigned to aplayer (Agent based on sheactions it performs, Points can be given as llows: ° go pons are warded if payer (oe comes uo tecare wth hl 2° ° 1 points taken away for every action taken. — | © LOpointsaretaken away ifthe arrowis sed SO ° 5 Room with WUMPUS, + Rooms neighbouring te WUMPUS which are s * — Rooms with bottomless pits + Rooms neighbouring to bottomless pits which are breezy. * Room with gold which is glittery, ‘* Arrow to shoot the WUMPUS, + Camera.to getthe view * Odour sensor:to smell the stench ne * Audio sensor'to listen to the scream and bump, * Motor to move left, right '* Robot arm to grab the gold ‘* Robot mechanism to shoot the arrow, /UMPUS world agent has following characteristics - Fully observable 2, Deterministic 3. Episodic 4. Static 5. Discrete 6. Single agent Let's ry to understand the WUMPUS world problem in step by step manner. Keep Fig. 42.2 as a 41 | 42 | 43 | 44 | Da-agert 8 - Breeze at 32 a3 34 | G-Gitter, Goid (OK - Safe square 21 | 22 | 29 | oa | PePe Ee 'S- Stench WW 13 2 W-Wumpus- > rsfical Intelligence (SPPU) 0 Initially the player (agent) is in the room (1, 1), See Rig. 4 ‘The first percept received by the {[none, non: nt received by the player if (none, none, none, none, ee eelek a {stench breeze glitter, bump, scream)). i Son BS) CE Eee step Player can move to room (1, 2) or (2, 1) as they are safe cells, step 2: Letus move to room (1, 2), See Fig. 4.2.2(b). 44 42 43 44 [A] - Agent \ 31 32 33 34 B- Breeze =H 24 22 23 24 | G-Glitter, Gold ae a is af OK- Safe square v a Pp P-Pit ox : $-Stench V- Visited ok W- Wampus Fig, 4.2.2(b) : WUMPUS world with player in room (1, 2) + Asroom (1, 1) ts visited you can see “V" mark inthat room. The player: receives following percept : [none, Ureeze, none, none, none}. + Asbreeze percept is received room (1, 2) Is marked with °B" and it can be predicted that there is a bottomless, pitin the neighbor! . ‘voczan seo that oom (13) and room (2,2) marked with PSoroom (3)_nd 22) sot sf sma si "Thus player should return to room 41) and try to find other, safe room to move to. Step3: P ™ 4 can understand that room (2, 2) cannot have any pit, t have WUMPUS because room (1, 2) did not pie: ligence (SPPU) Artificial In ‘¢Aswe did not get breeze percept in this room, we step 2 we can understand that room (2, 2) cannot percept. © Thus room (2, 2) is safe to move in. Step 4: Player receives [none, none, none, none, none] percept when it comes to room (2, 2). From Fig. 42.2) yq, can understand that room (2, 3) and room (3,2) are safe to move 1 at 42 a3 aa 31 32 3.3 3.4 24 22 2.3 24 ALA) v OK 1 14 14 12 ae v B OK OK player moving to room (2,2) [stench, breeze, glitter, none, none] percept See Fig 4.2.2(e). Field 1 of the percept shows that room (3, 1), (3,3) and (4, 2) can have WUMPUS. Field2 of the 2) and (4, 2) can have bottomless pit. Field 3 ofthe percept shows ‘gold first. As the aim of this game is to grab the gold and Fig, 4.2.2(d) : WUMPUS world with Step 5: Let's move to room (3, 2). Here, player receives percept shows that room (3, 1), (3, 3), (2, that room (3, 2) has gold. So, the player grabs the position, without being killed by the WUMPUS. go back to the starting a 42 fag laa Pr at 32 jOK]ss aa Pp? Pp? 7 2 22 a 2.3 24 14 12 13 14 P? v 8B OK OK Fig. 4.2.2(e) : WUMPUS world with player moving to room (3, 2) ae rl megane (SPPUD a oo, we have to go ack tothe starting positon Le. room (1, 1) without geting killed by WUMPUS. From steps “23 and 4We know that room (1, 1), (1, 2), (2, 1) and (2, 2) are safe rooms. so, we can go back to room (1, 1) by slowing any ofthe two Paths: te. (2,2), (2,1), (1,1) or (2,2), (1,2), (1,1). cups Asean be seen Fig 422(0, We lg from room (22) 0 room (21) and fom rom (24) 0 oom (1, 1). Thus we won the WUMPUS World game!!! ay 42 a3 jaa OK OK Fig. 4.2.2(f) : WUMPUS world with player moving back to room (1, 1) with gold suo) — a3 a nero a Logic can be called as ‘specified task. ogee ae logical representation and tof any particular extent and when knowledge, = Artificial intelligence (5? rations represent features of the World thay _————— conf y Logical reasoning should make sure that the i ee si the old configurations repr sented. follow the features of the world that arasre Role of Reasentne In Al” knowledge re! + Fig. 4.3.2 shows how logic can be seen.as @ ge sa tional logic . There are vario presentation language. ws init es ere oy levels tothe ost fund type af logic is propos! logic and mo t fans damental type af lo gic | “ A non e ‘Mui-valved logic cas a Probablistic logic Perr no Fuzzy logic Fig. 43.2: Logic as Knowledge Representation \ where rules are values between range of and 1. New Propositional logic can be considered at fuzzy logic level, ; coal ie also called as probabilistic logic level using which first order predicate logic is implemented. «In this Fig, 4322 that there are two more levels above higher order Topic which are multi-valued and poy. monotonic logic levels and they consist of modal logic and temporal logic respectively. All these types of ogieae basic building blocks of intelligent systems and they all use reasoning in order to represent sentences. Hence reasoning plays a very important role in Al. ae 'Q. _ Explain various method of knowledge representation techniques. + Knowledge can be considered to be represented at generally two levels : () Knowledge level : This level describes the facts. ‘This level deals with using the symbols for representing the objects, which can be g (ii) Symbol level : manipulated in programs. v Knowledge can be represented using the following rules ~~ r (b) Production rule representations. (a) Logical representations (3) The logical representations are mostly concerned with truth of statements regarding the world. statements are most generally represented using statements IKE TRUE Or FALSE. Semantic networks (@) Frame representations Logic is successfully used to define ways to infer new sentences from the existing ones. There are logics that are used for the representation of information, and range in terms oftheir expressiveness, are logic that are more expressive and are more useful in translation of sentences from natural a into the logical ones. There.are several logics that are widely used : ence (SPPU) as 7, Propositional logie: These are restricted kinds that make use of propositions (sentences tha either true or false but not both) which can be either true propositional ealculs, sentetial calculus or bool or false, Proposition Jogie Is also known as All propositions are either true or false, forexample:() Leavesaregreen _(i)_Violetsareblue Sentence | Truth Value | Proposition skyisblue | true fr Roses are red | true pal 2425 false yes 2, First Order Predicate Logic : These are much more expressive and make use of variables, constants, predicates, functions and quantifiers along with the connectives explained already in previous see80n 4. Higher Order Predicate Logic: Higher order predicate logics distinguished from first order predicate logic by using additional quantifiers and stronger semantics. ‘4c Fuzzy Logic : These indicate the existence of in between TRUE and FALSE or fuzziness in all logies- | 5: Other Logic: These include multiple valued logic, modal logics and temporal logics. One of the widest used methods to represent knowledge is 0 Use P rules syntax: IF condition THEN action If premise THEN conclusion -1 and proposition p2 are true oduction rules, i also known as F-THEN | IF proposition, IE the ro: slippery, THEN driving is IR the ee W Artificial totettigence (SPPUD ides that are nam nod twork basically comprises o! one een concepts Nodes represent both types and tokens. senting relations betw : . oes semantic network in Fig. 44.1 expresses the sowed 0 PESO ean © ctrom is grey in color. ‘Tom is owned by Sam. co TomisaMammal. co Fishisan Animal. © Cats love Milk ° oA Allmammals are animals. Fig. 4.4.1 © Conceptual Graph : It is a recent scheme used for semantic network, introduced by John Sowa, BEES SEIS MSE UE RYN NCE connected, bipartite graph. The nodes represent either concepts or conceptual relations. It differs fr previous method that it does not use labelled arcs. For example : Ram, Laxman and Bharat are cat color is grey can be represented as shown in Fig. 4.4.2. Cronos) Conn) Ce) Cn) CD ‘oy Frame Representation” Fig. 4.4.2 complex and needs more structured representation. More structured the the requirement of using frames which would prove beneficial. Gene Slots can be of any size and type. The slots have names and values (subfields) c a have names or numbers too. A simple frame is shown in the Fig. 44.2 fo o (Ram) © (PROFESSION (VALUE professor) a © (AGE(VALUE50)) © (WIFE(VALUE sita)) > (CILDREN(VALIE uy kash) (ADDRESS (STREET(VALUE 4C gb road))) CITY(VALUE banaras)) {STATE(VALUE mh)) (ZIP(VALUE400615)) ontology ts study about what kind of things or entities exist in the universe. InAl, ontology is the specification of jowledge abi ut a particular domain Tn turn, conceptualizations, used to help programs and humans to shar srtslogy Wa sek of concepts ike erty, relationships among en Q ‘events thal are expressed in a uniform way swarder to Greate a vocabulary for information exchange. An Ontology Fold also enable a person to verify what symbol means. That is, given a concept, they want to be able to find the symbol, and, given the symbol, they ‘want to be ablé to determine what it means, Typically it specifies what types of individuals will be modelled, specifies what properties will he used, and gives some axioms that restrict the use of that vocabulary. Ontologies are usually written independently of a particular application and often involve @ ‘community to agree on the ‘meanings of symbols For example : Consider a map showing hotels, railway station, tutings. schools, hospitals Ina RBs? locality. In this map the symbols used to it Tce entities are enough to deseribe them. Hence = ‘community who knows the meaning of these ‘symbols can easily recognize it Hence that becomes sue that map. In this ontology, t may define -as human-cons z on the size of buildings 0 that shoeboxes cannot be buildings or that cities 1g cannot be at two geographically a4 WH Arificial nteitigence (SPPU) — bs . wrens iran atomic pemenne or can be gst of IbOnk STADE: z ~v sentence. IFA isa sentence, then ~A is a nari ih a «Propositional logic malkes use of relationships betwees POPS se oe seth meth are propositions. Connectives used in proposition logic can be seen nin F Table 4.5.1: Connectives used in Propositional logic Connective Name of the Name of the Relationship between , symbol Connective symbol Propositional symbols + Propositional symbols te % And A‘*B Conjunction % hi na AvB Disjunction = Not 2 mae as Implies A>B Implication / conditional . — is equivalent/ if and ae Biconditional only if «+ Todefine logical connectives truth tables are used. Truth Table 4.52 shows five logical connectives, Table 4.5.2 A B AAB | AvB =A False false false False true False true false True true a = True false false tue | false a we true true True false _ + Take an example, where A B, ie. Find the value of A 4 B where A is true and B is false. T Table 4.5.2 shows this condition, now see third row of the third column where, A B shows re Similarly other logical connectives can be mapped in the truth table. : Write syntax and semantics and example sentences for propo ‘* World is set of facts which we want to represent to form propositional logic. In order 2 orm propositional propositional symbols can be used where each propositional symbol's interpretation cai ; ela! 2 Semantics of a sentence is meaning of a sentence. Semantics determine the | For example : You can define semantics of each propositional symbol: 1. Ameans “Itis hot” 2. Bmeans “It is humid”, ete. sNigence (SPPU) 15 ace is considered true when its interpretation in the real world js true. Every sentence results from a finite per of usages of the rules. For example, if A and B are sentences then (A B), (A v B), (BA) ind (A +» B) vec sentences. The knowledge base i a set of sentences as we have seen in previous section. thus we can say that real world is a model of the knowledge base when the knowledge base is true for that nother words a model canbe thought ofas.a truth assignmenttothe symbols. igqrth values ofall symbols ina sentence are given then it can be evaluated for determining its truth value (Le. veo can say iFieis true or false). isa What is Propositional Logic: 2” AB and BAA should have same meaning but in natural language words and sentences may, have different peaning bot to wae Ee ——— meanings. Say for an example, 1. Radha started feeling feverish and Radha went to the doctor. >. fiadha wentto the doctor and Radha started feeling feverish. «Here, sentence 1 and sentence 2 have different meanings. «. in artificial intelligence propositional logic is a relationship between the truth value of one statement to that of the truth value of other statement. 454 PLSentence= Example” ‘Take example of a weather problem, «Semantics of each propositional symbol can be defined as follows: co Symbol A is a sentence which means “Itis hot”. o Symbol Bis asentence which means {is humid”. ° Symbol C isa sentence which means “tis raining’ . We can also choose symbots which are easy to understand, lke co HT for “Itis hot”. HM for“Itis humid”. ( WE Accifciatincotigonce (SPPU) Now, ifthe knowledge base is [HM, HM — HT, (HT 4 HM) > RNJ(Le. ["Itis humid", “If itis humid, the «fit is hot. and humid, then itis raining’] ), then “True “True - True” is the only possible valid mode), — Tautology and Contradiction is *_--‘Tautology means valid sentence. Itis a sentence which is true for all the interpretations. For example : (A> A) ("A or not A’) :“It is hot or Itis not hot" aN * Contradiction means an inconsistent sentence. Itis a sentence which is false for all the interpretations, i Forexample: As 7A (“A and not A”): “It is hot and it is not hot.” a + Xentails Y, is shown as X [= Y, Itmeans that whenever sentence X is True, sentence ¥ will be True, riya is Pooja’s Mother's Sister and Y = Priya is Pooja’s Aunty. Then X |= ¥ (X For Example : if 455 lifereneelRutes [12.__Expiairthe inference process in caso of propositional logic with suitable examples. + New sentences are formed With the logical inference. For example : If A = B and B = Cthen A= C. You mus Shas "A= Ba \ come across this example many times it implies that if knowledge base has “A = B” and ‘B=’ then that“A=C". * Inshore inference rule says that new sentence can be create by logically following the set of knowledge base. Table 4.5.3 : Inference Rules Inference Rules Premise (KB) | Conclusion Modus Ponens X,XOY %, Substitution X9Z8Y9Z X=¥ Chain rule XY, YOZ AND introduction XY Transposition * Entailmentis represented as : KB |= Q and Derivation is represented a: 2 *\ There are two types of inference rules: Sound inference Complete inference cia intelligence (St sound inference 4 Sounditess property of inference says that, if "X is derived from the ki , is 1m the knowledge base” using given set of protocols of inference, then “X is entailed by knowledge base” Sound ue i-X then KB |= * lge base". Soundness property can be represented as: «Toy Modus Ponens (MP) rule we assume that knowledge base has (A, A — B], from this we can conclude chat knowledge base can have B. See following truth table: : A B A+B | Valid? TRUE | TRUE | TRUE Yes TRUE | FALSE | FALSE | Yes FALSE | TRUE | TRUE | Yes FALSE | FALSE | TRUE | Yes Ingeneral, For atomic sentences p, pnd q, where there is substitution @ such that oy (ByAPyA Py SUBST(@,p)) = SUBST(@,p\) for alli, area, N+ 1 premises = N atomic sentences + one implication. Example : ; A: Itisrainy, 1 erate ego Hell, B+ Lwillstayathome. vaiyiehaniaall ACB + {fitis rainy, Lwill stay athome. uid sth a ae Modus Tollens: ‘When Bis known tobe false, and ifthereis arute “fA then Br 45:7 Propositional Theorem Proving WW Ariviciatinettigence (SPPU) 418 Significance of horn logic Conjunctive normal form is a conjunction of clauses and by its set of clauses it is determined upto For a horn clause conjunctive normal form can be used where, each sentence is a disjunction of tj most one non-negative literal as shown in the following formula : ”Ayv—A,V—vAy ws Vig vB. eral with ap This can also be represented as : (A > B)= (A vB) Horn sentences can be used in first order logic, Reasoning processes is simpler with horn clauses, Satisfiabity og a propositional knowledge base Is NP’complete. (Satisflability means the process of finding values for’ sym which will make it true). a For restricting knowledge base to horn sentences, satisfiability is in A. Due to this reason, first Order logic hom, sentences are the basis for prolog and datalog languages. 1 Let's take one example which gives entailment for horn formulas. Find out if following horn formula is satisfiable? (true X) a (KAY > 2) 9 (Z!W) a (ZA W- false) A» (true >Y) From the above equation, we entail if the query atom is false. Equation shows that there are clauses which st that true X and true SY, so we can assign X and ¥ to true value (i.e. true —> X AY). ‘Then we can say that all premises of X « YZ are true, based on this information we can assign Z to true. that we can see all premises of Z > Ware true, so we can assign W to true. As now alll premises of Z « W— false are true, from this we can entail that the query atom is false. horn formula is not satisfiable. Sequence of sentences form a “Proof”. A sentence can be premise or it can be a sentence derived fi sentences in the proof based on the inference rule. Whatever we want to prove is called as a query @ Query/goal is the last sentence of the theorem in the proof. Take Example of the "weather problem” which we have seen above. ° HT for“Itishot’. * © HM for“Itis humid”. © RN for“Itis raining”. HM Premise (initial sentence) [ es humid” HM HT Premise(initial sentence) HT Modus ponens(1, 2) (sentence derived from 1 and 2) (HT AHM)—RN | Premise(initial sentence) HT AHM. And introduction(1, 3) RN Modus ponens(4, 5)(sentence 19 propositional logic isa simple knowledge representation language. jrissufficient and efficient technique for solving some artificial intelligence based probl lems. fropositional logic forms the foundation for higher logics like First Order Logic (FOL, ete propositional logic is NP complete and reasoning is decidable rae ‘the process of inference can be illustrated by PL. 4s9° Disadvantages of Propositional|Logie pee ['a. __ Write a short note on : Drawbacks of propositional ogc. Propositional logics cannot express complex artificial intelligence problems. Propositional logic can be impractical for even small worlds, think about WUMPUS hunter problem. ven if we try to make use of propositional logic to express complex artificial intelligence problems, It canbe, very wordy and lengthy. + PLisa weak knowledge representation language because co With PLitis hard to identify ithe used entity is “individual”. For example : If there are entities like : Priya, Mumbai, 123, ete. PL cannot directly represent properties of individual entities or relations between individual ensies For example, Pooja istalle ‘ial 5 Pl cannot express specialization, generalizations, or patterns, ete. FOr ‘example : All rectangles have 4 sides. SS 7 . Tecause ofthe inadequacy of PL discussed abovethere was need OF OTE i pic, Thus First: Order Logic (FOL) was developed. FOLIs more expressive that PL, jf can represent information.ysing relaton ~variables and quantifiers, ez. which was not possible with propositional Hogic. ° “Gorilla is Black” can be represented as Gorillas) Blacks) sits Sunday today" can berepresente@as: Quantifiers 1._Universal Quantifier "¥.. 2. Existential Quantifier "3" «Pronounced as “there exists” “ax A” means A is true for at least one replacement of x. © Example: “There is a white dog” can be represented as, i 3 x (Dog(X) * white(X)) Note: 4: © Assuming that °X" is a domain of values, we can defi TRUE successor will be true. Ituses the implication > symbol. Rule rep! Artifical Inteigence (SPPU) rm with following rules which belongs to the domain. te a ‘Constant term : It is a term with fixed value 2. Varfabte term: {tis a term which can be assigned values in the domain. 3. Funetion : Say “f' Js @ function of ‘n" arguments, If we assume that ta, fa are terms them tpi = - 7 also called as a term. All the terms are generated by applying the above three p ‘onal logic as a base logic, so the connectives used in py. First order predicate logic makes use of propositi 3 FOPL are common, Hence, it also supports « conjunction, v disjunction, negation, = implication and” doa a implication. Ground Term : [fa term does not have any variables itis called as a ground term. A sentence in Whit a the i variables are quantified is called as a “well-formed formula”. yrotocols. © Every ground term is mapped with an object. © Every condition (predicate) is mapped to relation. A ground atom is considered as true ifthe predicate’s relation holds between the terms! obieaea parts predecessor and successor. Ifthe predecessor ev resents fthen types of se T will buy it” Will be represented as co ° Rules in FOL: In predicate logic rule has two Example : The sentence “If the bag is of blue colour, blue)>buy(bag) ‘Apart from these connectives FOPL makes use of quantifiers. AS the name suggests they quantify variables taking part in the relation or obeying the rule, " and it is applicable to all the variables in the predicate. Pronounced as “for al "gx A” means A is true for every replacement of x “Bvery Gorilla is Black” can be represented as : + Example: “wx (Gorilla(x) — Black(x)) Typically, = is the main connective with V. Example : “Everyone at MU issmart”is represented as vx At(x, MU) > smarts ci cial {ntelligence (SPPU) anti wit Knowl ax killed(x, cat) « guilty(x) + Bquality : term, = terms Is true under a give per fiven interpretation if and only if term, and terms refer to the same + Example : Richard has at least two brothers 3x, Ay Brother (x Richard) » Brother (y, Richard) n(x =) TL OSTNREY + The process of constructing a knowledge-base in first-order logic is In knowledge-engineering, someone who investigates a particular domain, learns important concept of that domain, and generates a formal representation of the objects, is known as knowledge engineer. + In this topic, we will understand the Knowledge engineering process in an electronic circuit domain, which is already familiar. This approach is mainly suitable for creating special-purpose knowledge base. Following are the steps of knowledge engineering steps : 4. Identify the task, 2° Assemble the relevant knowledge. 3. Decide on a vocabulary of predicates, functions, and constants. 4. Encode general knowledge about the domain. s. 6 Je Encode a description of the specific problem instance. Pose queries to the inference procedure and get answers. Debug the knowledge base. Using these steps, we will develop a knowledge base which will allow us to r full adder) which is given in the Fig 4.7.1. 2 Assemble the relevant knowledge : : Decide on vocabulary : Encode general knowledge about the domain : To encode the general knowledge about the logic circuit, we need some following rules : +20 Acthe second level, we will examine the circuit stricture detalls such as: Which gate is connected to the first input terminal? © Does the cireult have feedback loops? In the second step, we will assemble the relevant knowledge which is required for digital circuits. Sa for digital circuits, we have the following required knowledge : © Logie cireutts are made up of wires and gates. © Signal flows through wires to the input terminal of the gate, and each gate produces the corresponding output which flows further © Inthis logic circutt, there are four types of gates used : AND, OR, XOR, at NOT. © Allthese gates have one output terminal and two input terminals (except NOT gate, it has one input terminal), ‘The next step of the process is to select functions, predicate, and constants to represent the circuits, inals, signals, and gates. Firstly we will distinguish the gates from n each other and from other objects. cf gate is represented as an object which is named by a constant, such as, Gate(X,). The functionality of each gate is determined by its type, which is taken as constants such as AND, OR, XOR, or NOT, Circuits will bbe identified by a predicate : Circuit (C,). ‘ For the terminal, we will use predicate ; Terminal(x). For gate input, we will use the function In(1, X,) for denoting the first input terminal of the gate, and for output terminal we will use Out (1, X,). The function Arity(€, jj) s used to denote that circuit chas input, j output The connectivity between gates can be represented by predicate Connect(Out(1, X;), In, X;))- We use a unary predicate On (t), which is true ifthe signal at a terminalis on. iftwo terminals are connected then they have the same input signal, it can be represented as: Y ty, t) Terminal (t,) A Terminal (t,) A Connect (ty, £2) ~* Signal (t,) = Signal (2). Signal at every terminal will hhave either value 0 or 1, it will Y¥ (Terminal () Signal (Q)=1 Signal ()=0. : W Artificial Intelligence (SPPU) 423 Output of OR gate is 1 if and only ifany ofits inputs 1 v 8 Gate(g) A Type(g) = OR — Signal (Out(1, g))=1. 6 ‘3m Signal (In(n, 2))= 1 Output of KOR gate is 1 ifand only ifits inputs are different ¥ gGate(g) A Type(g) XOR — Signal (Out(1, g)) = 19 ‘Signal (In(2, g)) # Signal (In(2, g)). + Output of NOT gateis invert ofits input: ¥ g Gate(g) A Type(g) = NOT Signal (In(1, g)) + Signal (Out(2,g)). Al the gates in the above circuit have two inputs and one output (except NOT gate). ¥ gGate(e) AType(g)=NOT— Arity(g.3,1) ¥ gGate(g) Ar =Type(g) A (r= AND vr= OR vr= KOR) —> Arity (g, 2,1). All gates are logic circuits : V gGate(g) + Circuit (g). 5, Encode a description of the problem instance : *+ Now we encode probiem of circuit ,, firstly we categorize the circuit and its gate components. This steps. ¢asy if ontology about the problem is already thought. This step involves the writing simple atomics sentences of instances of concepts, which is known as ontology. oa For the given circuit C, we can encode the problem instance in atomic sentences as below : ane ee at ae a3 a4 as a6 a7 ae Q.10 ont Artificial Intelligence (SPPU) 24 What is Knowledge based Agent ? Describe WUMPUS WORLD Environment. Specify PEAS properties and type of environment for the same, ‘What is Logic ? Explain various knowledge representation techniques. 7 What is propositional logic ? Write syntax and semantics and example sentences for propositional logic. ; Explain the inference process in case of propositional logic with suitable examples, Explain Hom Clause with example. Explain various method of knowledge representation with example. Give PEAS descriptors for WUMPUS world. Explain backward chaining giving suitable example. Write short note on Predicate Logic. Explain various methods of knowledge representation with example. Give PEAS descriptors for WUMPUS world.

You might also like