You are on page 1of 40
syllabus ‘ Adversarlal Search: Games, optimal decisi i a . 5 lecisions in games, alpha- stochastic games, partially observable games, state- ts? aa oane ee eee ate base agents, the Wnmpus world, logic propositional logic, propositional theorem proving, effective propositional model checking, agent based on propositional logic. . — Syllabus Topic : Adversarial Search 31 Adversarial Search ‘Q. What is adversarial search?, _ Adversarial Search Problem is having competitive activity which involves ‘n' players and it is played according to certain set of protocols. - Game is called adversarial because there are agents with conflicting goals and the surrounding environment in a game is competitive as there are ‘n' players or agents participating. - We say that goals are conflicting and environment is competitive b Participant wants to win the game. From above explanation it is understandable that ecause every t we are dealing with a competitive multi agent environment. ~ As the actions of every agent are unpredictable there are many possible moves/acti has to first analyze the own wining or loosing. ions. In order to play a game successfully every agent in environment action of other agentsand how other agents are contributing in its After Performing this analysis agent executes. =Sem-V)_3-2 rtticial Intelligence (MU B.Sc. IT - Sem-V) i 3, Environment Types = Environment types 2 1. Competitive environment 2. Cooperative environment Fig.C3.1 : Environment types There can be two types of environments in case of multi-agent, Competitive a cooperative. > 1. Competitive environment — In this type of environment every agent makesan effort to win the game by defeating or by creating superiorityover other agents who are also trying to win the game, ~ Chess is an example of a competitive environment. > 2. Cooperative environment — In this type of environment all the agents jointly perform activities in order. achieve same goal. 3 ~ Car driving agent is an example of a cooperative environment, 3.1.2 Al Game - Features Features of Al game. Under artificial intelligence category, there are few “specialfeatures as shown Table 31.1, which make the game mor interesting, Table 3.1.1 : AI game features When there are two pponents/agents Playing the game it is called 2. play game. To increase difficulty of the game Intelligence is added to agents in AI games, Note that, in case of AT Games we must have at least two players. (ie, single Player games don't come under AT games category), Adversarial Search lon CC. meas there are two or more opponents/agents | Monopoly y playing the game it is called multi agent environment where action of every agents affects the action of other agents, 3 cooperative | When the surrounding environment is not helpful for | Card games - ment winning the game it is called as non-cooperative or ‘ competitive. jn aking In a multi-agent environment when the agent/ player | Any board performs a move and has to wait for the next player | game, Chess, to make the next move. carom, etc. ine limit One more constraint can be incorporated in a game | Time bound i.e. keeping a limitation on time. Every player will | chess games get a finite amount of time to take an action. Unpredictable In AI games action of opponent agent is fuzzy which | Card game with opponent makes the game challenging and unpredictable. multiplayer 9 ip Players are called unpredictable when the next step depends upon an input set which is generated by the other player. 44.21 Zero Sum Game Write > “Zero sum game” concept is associated with payoffs which are assigned to each player when the instance of the game is over. It is a mathematical representation of circumstances when the game is in a neutral state. (ic. agents winning or losing is evenhanded with the winning and losing of other agents). For example, if player 1 wins chess game it is marked with say +1 point and at the same time the loss of player 2 is marked with — 1 point, thus sum is zero. Another condition is When game is draw; in that case players 1 and 2 are marked with zero points. (Here +1, ~ land 0 are called payoffs). [EF antics ntatigence (MU 8.S0. IT - Sem-V) 3.1.2.2 Non-Zero Sum Game Non-zero sum game's don't have algebraic sum of payoffs as 2et0. In th one player winning the game does not necessarily mean that the other player hag There are two types of non-zero sum games : ‘Types of non-zero sum games 1. Positive sum game 2, Negative sum game Fig. C3.2 : Types of non-zero sum games eg =a 1. Positive Sum Game It is also called as cooperative game. Here, all players have same Boal ang & contribute together to play the game. For example, educational games. 2. Negative Sum Game Itis also called as competitive game. Here, every player has a different B0al 50 n0 oe really wins the game, everybody loses. Real world example of a war suits the most, 3.2 Relevant Aspects of Al Game sai] To understand game playing, we will first take look at all appropriate aspects of a gat: which give overview of the stages in a game play, See Fig. 3.2.1. Q. _ Write a short notes on: Relevant aspects of Al games. — Accessible — environments:Games with accessible environments have all the necessary information handy. For example : Chess, — Search:Also there are games which require search functionality which illustrates how players have to search through possible game Positions to play a game. For example ; minesweeper, battleships, Fig. 3.2.1 : Relevant aspects of AIO™ jctable opponent : In AI games wr ty in game play and thus game. , ems. FOr example : Scrabble. a ———— Syllabus. Topic ; Games ee Game Playing ©pponents can be unpredictable, this introduces Playing has to deal with contingency/ probability e fig. 3.3.1shows examples of two main varieties of problems faced in artificial pe eS. First type is “Toy Problems” and the other type is “Real World Problems”. Fig. 3.3.1:Example Problems Game play follows some strategies in order to mathematically analyze the game and mamnte possible outcomes. A two player strategy table can be seen in Table 3.3.1. Player 1 Wins Player 2 Wins Player 1 Wins | Draw Player 2 Wins Player 2 Wins | Player2 Wins | Draw we. T (MU B.Sc. IT - Sem-V) 3-6 Type of Game Strategies ‘The simplest mathematical description of a game is the strategic form, | troduction. For a two-person zero-sum game, the payoff function of Player tig. 8% een of Player 1, so we may restrict attention to the single Payoff fy udction og fe Poy which we call here A. The strategic form, of normal form, of a two-person zero-sum game is given any, : (X MA), where (1) Nis a nonempty set, the set of strategies of Player 1 (2) Yisa nonempty set, the set of strategies of Player I] (3) A is a real-valued function defined on X x¥ . (Thus, A(x, y) is a real number fet ty + €X and every y eY.) The interpretation is as follows. Simultaneously, Player I chooses x e¥ and Piya chooses y €¥', cach unaware of the choice of the other, Then their choices are made ty and I wins the amount A(x, y) from IL. This is « very simple definition of a game; yet itis broad enough to cocompass the finite | Combinatorial games and games such as tic-tac-t foe and chess, On the basis of how many times player I of player II is winning the game, follory strategies can be discussed a ‘hat the opponent docs is called an eq 2% Optimal Strategy : 161 has » proced the average, and II has a procedure th A(X, ¥) is called the Value of the pame, ‘ad the procedure each uses to insure this eas! called an optimal strategy or a minimax Strategy, 1. Equalizing Strategy : 4 Strategy that produces the same average winnings no mint uallzing strategy, at keeps her Average loss to at most A(x, y). Te 3. : * 1138 useful to make a distinction between #P® strategy and a mixed Strategy, We refer to | Clements of X of y as pure strategies. The complex entity that chooses amon ios 8 the pure strategies at oe called a mixed strategy. Stes at random in various yy till! F Type of Games 332 __ intoligence (MUB.Sc. IT-Sem-v) 3.7 Adversarial Search am ie Type of games 1. Deterministic 2. Probabilistic Fig.C.33 : Type of games Game can be classified under deterministic or abilistic category. Let's see what we mean by deterministic fas Probabilistic. 4 1, Deterministic It is a fully observable environment. When there are two agents playing the game alternatively and the final results of the game are equal and opposite then the game is called deterministic. - Take example of tic-tac-toe where two players play a game alternatively and when one player wins a game then other player losses game. + 2. Probabilistic - Probabilistic is also called as non-deterministic type. It is opposite of deterministic games, where you can have multiple players and you cannot determine the next action of the player. - You can only predict the probability of the next action. To understand probabilistic type you can take example of card games. - Another way of classification for games can be based on exact/perfect information or based on inexact / approximate information.Now, let us understand these terms. 1. Exact/perfect information :Games in which all the actions are known to other player is called as game of exact or perfect information. For example tic-tac-toe or board games like chess, checkers. 2, Inexact / approximate information :Game in which all the actions are not known to other players (or actions are unpredictable) is called game of inexact or approximate information. In this type of game, player's next action depends upon who played last, who won last hand, etc.For example card games like hearts. 7 Consider following games and see how they are classified into various types of games on the parameters which we have learnt in above sections : [EEF acca! ntotigence (MU B.Se_IT- SemV)_S-8 Table 3.3.2 : Types of game — Chess — Battleships — Checkers = __Card Game (Hearts) Probabilistic |_~ Ludo - Scrabble |= Monopoly = Poker Now, let us try to learn about few games mention in Table 3.3.2, 3.3.2.1 Chess — Chess comes under deterministic and exact/perfect information category, This Bame j two person, zero-sum game. mt ~ In chess both players can see chess board positions so there is no secrecy and ply don't play at the same time they play one after the other in an order. — Thus this game has perfect environment to test artificial intelligence techniques. In 1999; 4 computer Deep Blue II defeated Garry Kasparov who was world champion at thi timeThis example is given to understand how artificial intelligence can be used ia decision making. (@) Chess board () Deep Blue II vs Garry Kasparov final posi Fig. 3.3.2 aia ee nme TT Adversarlal Search Fig. 3. hess game tree 422 Checkers Checkers comes under deterministic and exact/perfect information category. This game is :two person game where both players can see board positions, so there is no secrecy and ylyers play one after the other in an order. 1n1990's a computer program name Chinook (also called draughts) was developed which «efated human world champion Marion Tinsley. Fig. 3.3.4 : Checkers board Fig. 3.35: Checkers game tree 3.3.3 What is Game Tree? “Draw game tree of tic-tac-toe problem. — We-saw game tree of chess and checkers in earlier section. ~ Game tree is defined as a directed graph with nodes and edge. Here nodes intias positions in a game and edges indicate next actions. — Let us try to understand what a game tree is with the help of Tic-Tac-Toe example. Tic-Tac-Toe is a 2-player game, it is deterministic and every player plays when his turn come. Game tree has a Root Node which give the starting position of the gant board, which is a blank 3 x3 grid. ~ _ Say in given example player 1 takes 'X’ sign. Then MAX(X) indicates the board forte best single next move, Also it indicates that it is player 1's turn, (Remember that init move is always indicated with a MAX), Ina similar way wi W a game tree fo) y 'Y we can draw a game tr for any artificial intelligence intelligence based games y talon (MUBSe.IT-Sem-v) 3.44 P Adversarial Search, yo x Cl x wo! x 5 ; x x] (ox Jo] PIx 0} eee x00 ‘| [Rati aia CMe Ons 7 Roo X[xJo] [xpJo| [xpdol I eAMINAL ofolx| folxtx| Lx! txt] [xlolol lelolx vs 1 0 co Fig. 3.3.6: ‘Tic-Tac-Toe Game Tree Syllabus Topic: Optimal Decisions In Games 4 Optimal Decisions in Game Consider games with two players (MAX, MIN). We can for roblem as follows : rmulate a game as a search hrital state It gives the starting position of the game board. Operators They define the next possible actions. ie. Returns @ list of (move, state)pairs; each a legal move and resulting state Tema ware | Which indicates that all instance of BAT? is over. “ty It displays a number which indi 1 was draw. It can be an Objective function, payoff 5 (4, 1) oF (41925192) cates if the game was WON OF lost or it function, a numeric value for the terminal states rica! Intelligence (MU. Adve derstand that for a3 x 3 ame's example you can uni f eB s relatively small (It has 9! terminal nodes), ain ey c - From Tic-Tac-To : game, where the game tree is be i ingle page. draw it completely on one sin§ Imagine how difficult it would be to create a game tree for multi player x - ithbi, id size. games withbigger gri Bames Many games have huge search space complexity. Games have limitation oye, eo ‘and the amount of memory space it can consume. Finding an opt solution i, feasible most of the times, so there is a need for approximation. ‘ — Therefore there is a need for an algorithm which will reduce the tree size and eve will help in reducing the processing time and in saving memory space of the machine, — One method is pruning where, only the required parts, which improve quality Of outp, of the tree are kept and reaming parts are removed. = Another method is heuristicmethod (it makes use of an evaluation function) it des ny require exhaustive research, This method depends upon readily available informa which can be used to control problem solving. 3.4 MiniMax Algorithm Minimax algorithm evaluatesdecision based on the Present status of the game. This algorithm needs deterministic environment with perfect/exact information. Minimax algorithm directly implements the defining equation. Every time based on te Successor state minimax value is calculated with the help of simple recursive computation. In case of minimax algorithm the selectedact equal to the best possible payoff (outcom Minimax Algorithm tion with highest minimax value should be e) against best play. Take example of tic-tac toe game to unders ini thm. We will ake? tand ithm. We a minimax algori tection 2% X|xX]O fe} x O'sTum x|x|o olo|x ° x'sTum x[xJo _x|xlo _x/x10 5 ox ~ofolx _olx]x 5 x| [o xfo of 19 ° Next action O'sTum x Fig. 3.43, xlxlo xIx|o x O}o Olofx > x ° oO Ostum xx ox ofe Dx “of a ° cH IN and MAX operator ply MI Perators on vet neillity values upward in the three," "OES ofthe present Stage and propagate xlolx 0 x | 1 jo xs Oo X|xIe x|xlo xIxlo ol xX ls\x “olx[x “ofolx xlo xo xlolo Fig. 3.45 tp4: With the max (of the min) utility value (Payoff value) select the action at the root node using minimax decision. X|X|O oe xe ° xofx =Sem-V)_3-16 Y aticial Intaligence (MULB.S2_T Ser x|x]o = h 4 Jor xislo x|x[o\ _x]xlo x xlxlo )_xfete of x]x | “of [x : 5 x6 Ojo X]O]lo Oo 1 , e xIxlo xix x[x]o _x|x]o O}O;x oO x Oo} x} x OfO/}x xlolo xfo ic Fig. 3.4.7 (In case of Steps 2 and 3 we are assuming that the opponent will play perfectly ap: our expectation) 3.4.1 Properties of Minimax Algorithm - It is considered as Complete if the Same tree size is finite, ~ _ Itis considered Optimal when it is exploration approach), ~ Forchess, b= 35, m~100 for “reasonable” Moe games, — Exact solution is completely infeasible in most of the games, DOAAUUGRSOR LECTIN 17 g) Nabue Toplot Al haeiata Pruning paniag means cutting off, Th game Souteh I rosomblos to clippingn branch in the scare ma probably which is not so fruitful, avaay choice point along the path for mux, civ considered av the value of the beat posible choice foundi.e,, highest-value. For exch, “XIX dy wore Le, leiier value shana value then, MAX will avoid it, Similarly we can define {) value for MIN, = oof pruning is an extension to minimax algorithm where, decision making proces need not consider each and every node of the game tree. ~ Only the important nodes for quality output are considered in decision making, Pruning helps in making the search more efficient. ~ Pruningkeeps only those parts of the tree which contribute in improving the quality of the rsult remaining parts of the tree are removed, ~ Consider the following game tree : MAX MIN Fig. 3.5.1 "or hich we have to calculate minimax values for root node. Minimax value of root node = Max(min(4,10,6), min(3,A,B), min(13,7,2)) ta = Max(4, C, 2) (C<=3)=4 US see how to check this step by step. Finalresults are not affected by pruning. ing of Good actions helps in improving effectiveness of pruning technique, Ordering - If there is exact/perfect ordering then we can get time complexity as Ob, ere i — Depth of search is doubled with pruning. Syllabus Topic : Stochastic Games ee 3.5.3 Stochastic Games Uncertainty is the certain part of real life. Stochastic games are those in which uncen,: is observed in the result of an action. For examples, n solitaire, next card i unknown 2 pacman, the ghosts’ next action is always random; in minesweeper, mine locations, unknown. In order to maximize the points or the average score, expectimax search algorithm can be used. In this we have “Max nodes” as we have in the minimax search and “Chae nodes”, like min nodes, except the outcome is uncertain. We can calculate expected Ulilities i. take weighted average expectation of values of children. A stochastic game can be considered as an extension of a Markov decision procs (MDP).As there are multiple agents with possibly conflicting goals, and the joint acs of agents determine state transitions and rewards. Syllabus Topic : Partially Observable Games 3.5.4 Partially Observable Games — As in the partially observable environment, the complete state of the system is not visible at any point of time; similarly, in partially observable games the entire world of the game is not visible to an external sensor. information to the observer's understanding of the sith r sigence (MU.B.Se.IT -Ser to V) 3.25 _gony apse a De used to remember the aoe e. This WAY the extra knowledge abou ii make better decisions, i is ee dealt cards that are now on the ‘unseen part of the world can be derived ast, a folly observable system would be that of pi i can observe each part to be picked up and all of pick and place robot, where the pe the bins where the paris to be kept. Syllabus Tople : State of the Art Game Prog rams gtate of the Art Game Programs sowing are the state of the art games . r pponent is achieved. games meaning that to develop a code to play with is chess __ Human world champion Gary Kasparov was defeated by Deep Blue defeated in 1997 through a six-game match. Deep Blue examined 200 million positions per second. = t used very sophisticated Solano and undisclosed methods for extending some lines of search up to 40 ply, which was a big achievement. Whereas, currently we have programs which can perform even better. Othello Incase of this game, the computerized games are so good that, human champions refuse tocompete against computers. _ Checkers: ~ Chinook used an endgame database defining perfect play. He has programmed for all eces on the board, a total of 443,748,401,247 positions involving 8 or fewer pit positions. ~ He ended 40-year-reign the Checker game is solved. Go of human world champion Marion Tinsley in 1994. Hence ; ie a Mie gram uch that human champions are beginning to ute see humans still peat the best machines on the full challenged by machines, though the best board, [7 anitictat intotigonce (MU B.Se. IT - Som: ‘As shown Fig, 3.5.2, a knowledge based agents can be described at differg, s + S524 . Knowledge Base (KB) and an Inference Engine. Domain-indopondent algorithms | AL Ne Domain-spocitic content Fig, 3.5.2 : Levels of Knowledge Base 1. Knowledge level - Knowledge level is a base level of an agent, which consists of domain-specifi, content. — _ In this|level agent has facts/information about the surrounding environment in which they are working, it does not consider the actual implementation. 2. Implementation level ~ Implementation level consists of domain independent algorithms. At ‘this lv agents can recognize the data structures used in knowledge base and algorithms which use them. For example, propositional logic and resolution. (We will te Jearning about logic and resolution in this chapter) — Knowledge based agents are crucial to use in Partially observable environments. Before choosing any action, knowledge based agents make use of the existing Knowledge along with the current inputs from the environment in order to inf hidden aspects of the current state, Tepresentation language. We can Say that words that express some truth about th representation language, Declarative approach of building an agent makes use of TELL and ASK mechaais™ an t sentence is a statement which is a S¢ : © real world with the help of knowlé the agent about surrounding eny; Adversarial Search form SOME action). TELL mechani. ironment (what it can ASK i atimnissiniie nai pen the a SK itself what action sh taking input for a system. t. AS! mechanism is simi] mn should be carri oo siso makes use of the lar to producing output f carried out to, get desired a @ ASK mechani: ie knowledge base to decide rete Pee However ASK ant mechanism i ; it should do. . js generated with involve inference. Wher 3 apswer is generated with the help of knowledge b n you run ASK function, the was added with TELL function previously. ige base, based on the knowledge which : Is a function that adds knowledge K to the knowledge bas i , . eae f s60)+ Js.a function that queries the agent about the truth mr 3. ies out followin; i . an agent COMTIES ou 1g operations : First, it - BY formation it perceives with ist, it TELLs the knowledge base about M es wit the help of sensors. Then, it ASKs the knowled; should be carried out based on the input it thas received fey ige base action with the help of effectors. ved. Lastly, it performs hat action iheselected i Architecture of a KB Agent three levels namely, knowledge level, _ Knowledge based agents can be implemented at logical level and implementation level. Three levels of Knowledge based agents 3, implementation level Three levels of knowledge based agent Fig. C34: jedge level deseribes 41. has as the initial yn, The know! knowledge the agen! Knowledge Level gent implementatio! ~ Its the most abstract level of as agent by saying what it knows: ‘That is what knowledge ar defi knowledge. wy access that ed as background kriowledge- fined in his Basic data structures and'procedures level. Initial knowledge of knowledge base i antici Inteligonco (MU 8.80, IT = Som-V)_3-20 Fig. 3. Agents at the knowledge level can be viewed as an ABENt for Whig specify what the agent knows and what its Boals are in order to apd OY reganiless of how it is to be implemented, ity ig tas For example : A taxi driving agent might know that the Gold %, en Gate Be; it i San Francisco with the marin county, dee Logical Level At the logical level, the knowledge is encoded into sentence: Ss. This levey Uses formal language to represent the knowledge the agent has, The two types of representations We have are propositional logie 24 fi cy predicate logic. ® Both these representation techniques are discussed in detail in the further secon For example : Links(Golden Gate Bridge, San Francisco, Marin County) Implementation Level In implementation level, the physical representation of done. This level also describes data structures used algorithms that used for data manipulation, logical level sentences in knowledge base ax For example : Links(Golden Gate Bridge, SanFrancisco, Marin County) function KB ~ Agent (percept) returns an action Static: KB, a knowledge base {, acounter, initially o, indicating time TELL (KB, MAKE ~ PERCEPT-SENTENCE (percept, ») action ASK (KB, MAKE-ACTION-QUERY(t)) TELL(KB, MAKE-ACTION-SENTI ENCE (action,t)) tet] Fig. 3.5.3: General function of knowledge based agent 3 isthe general implementation of knowledge based agent. TELL and ASK are the sub procedures j Adversarial Search, Ze ntal new precepts. yen : oy jnternal representations of the world, + yyce pidden properties of the world. : pe appropriate actions. ‘Syllabus Topic : The WUMPUS World The wuMPUS World Environment j arnt about vacuum World problem, block world problem so far. Similarly we yore! i 7 us world problem. Fig. 3.6.1. shows the WUMPUS world. rus is an early computer game also known as “Hunt the Wumpus”. ‘WUMPUS ‘ eveloped BY GTeEOrY Yob in 1972/1973. It was originally written in BASIC 's All-purpose Symbolic Instruction Code). xine -based game. Let's understand the game : wuMPuS is a map- WUMPUS world is like a cave which represents number ‘of rooms, ro cxanected by passage WAYS: We will take a 4 x 4 grid to understand the game. WUMPUS is a monster who lives in one of the rooms of the cave. WUMPUS eats the player (agent) if player (agent) comes in the same room. Fig. 3.6.1 shows that room 6,1) where WUMPUS is staying. Payer (agent) starts from any random position in cave aesarting from (1, 1) position. There are various sprites in the game li hussome feature. Let's understand this one-by-one = Few rooms have bottomless pits which tp the player (agent) Youcan see in the Fig. 3.6.1 that room (1,3), G3) and 44) fateven WUMPUS can fall into a pit- Setch experienced in a room which has 2 syUMPUS in its neighborhood room See the Fe.361, here room (21), 3,2) and 41) ave Stench. be is experienced in @ 100m jch has 2 PI "361 sor hat rom (2 119,22), 02. 00 a Oe Net (Agent) has arrows and be can shoot these arrows #0 straight I US. One was, the rooms consists of gold, this room) oms, which are and has to explore the cave. We ike pit, stench, breeze, gold, and arrow. Every sprite if he comes to that room. have bottomless pit. Note it in its neighborhood room. 3) consists of Breeze. ine to kill whicl glitters. Fig. 3.6.1 shows that room (3, 2) has IT = Sem-V)_3-30 (FT ante nttigonce (MU B.Sc. i t) can accept two types ' rn features player (agent) , na A bump is generated if player (agent) walks ini:

. Implies A>B Implication / condition is equivaleny if and : i ae only if ASB Biconditional To define logical connectives truth tables are u: sed. Truth table 3.9.2 shows five 08 connectives. if ake an example, Where A AB, ie, Find the va seid row of the Table 3.9.2 shows ti nat luc of A AB where A is true and B is Condition, now see third i ipge,4 0B shows result as false, Similarly other logical porenl atime sine sdhuble. “ 492 Semantics fo Write syntax and semantics and example « sentences ae - World is set of facts which we want to represent to form propositional logic. In order to represent these facts propositional symbols can be used where each propositional symbol's interpretation can be mapped to the real world feature. Semantics of a sentence is meaning of a sentence. Semantics determine the interpretation of a sentence. For example : You can define semantics of each propositional symbol in following manner : 1. Ameans “It is hot” 2. B means “It is humid”, etc. Sentence is considered true when its interpretation in the real world is tue. Every , fA and B Sentence results from a finite number of usages of the rules. For example, af ee ‘entences then (A A B), (A VB), B > A) and (A B) are sentences 2 base is a set of sentences as we have seen in previous section. leds Thus we can say that real world is 4 model of the knowledge base when ve tae. i. asa base is true for that world. In other words @ ‘model can be thought o tee are given then it can be evaluated for truth values of all symbols in 2 sentence i.e. “ve can say iit is true oF) g its truth value ( a BP arti Intolligonce (MU B.S, IT - Gem-V) 3-44 3.9.3 What Is Propositional Logic ? = AdBand BAA should have same meaning but in natural language Words ang may have different meanings, Say for an example, 1, Radha started feeling feverish and Radha went to the doctor, 2. Radha went to the doctor and Radha started feeling feverinh, Here, sentence | and sentence 2 have different meanings, ~ In attificial intelligence propositional logic isa relationship between the truth valu of statement to that of the truth value of other statement, Oe 3.9.4 PL Sentence - Example — Take example of a weather problem, ~ Semantics of each propositional symbol can be defined as follows : — Symbol A is a sentence which means “It is hot”, — Symbol B is a sentence which means “It is humid”, ~ Symbol C is a sentence which means “It is raining”. ~ We can also choose symbols which are easy to understand, like : - HT for “Itis hot”, — HM for “It is humia”, - RN for “Itis raining”, - Ifyou have HM — HT then that means « itis humid, then itis hot", ~ Tf you have (HT « HM) —> RN then it means “If tis hot and humid, then it sri’ and so on, ~ _ First we have to create the possible models for a knowledge base. To do this we need 10 Consider all the possible assignments of true or false values for Sentence A, B and C bo Werify the uth table for the validity, There can be total & possibilities as show? low : Not Valid pairs True Not Valid aificial Intelligence (MU B.So.IT - Sem-V)_3-45 ‘Adversarial Search True False False Valid True False True Valid True True False Not Valid True True True Valid 3.9.! Now, if the knowledge base is [HM, HM > HT, (HT » HM) — RNIGe. [It is humid”, “{f it is humid, then it is hot” , “If it is hot and humid, then it is raining”) ), then “True -True - True” is the only possible valid model. Tautology and Contradiction Tautology means valid sentence. It is a sentence which is true for all the interpretations. For example: (A —A)(“‘Aor notA”) : “It is hot or It is not hot” Contradiction means an inconsistent sentence. It is a sentence which is false for all the interpretations. For example : A A 7A (“A and not A”) : “It is hot and it is not hot.” X entails Y, is shown as X |= Y. It means that whenever sentence X is True, sentence Y will be True. For Example : if, X= Priya is Pooja's Mother's Sister and Y = Priya is Pooja's Aunty. Then X = ¥ (X entails Y). 5 Inference Rules a. New sentences are formed with the logical inference. For example : If A = B and B = C then A = C. You must have come across this example many times it implies that if knowledge base has “A = B” and “B = C” then we can infer that “A = C”. © Explain the inference process in case of propositional logic with suitabl zs In short inference rule says that new sentence can be create by logically following the set of sentences of the knowledge base. Table 3.! erence Rules premis Modus Ponens X, XY Yy Substitution XZ&Y OZ X=Y Chain rule XY, YOZ X3Z AND introduction X,Y XAY Transposition XY ~X7-Y tailment is represented as : KB I= Q and Derivation ig Tepresenteg En a8 KB Le ‘There are two types of Inference rules : r 1e! Types of inference rules. | 1. Sound inference 2, Complete inference Fig, C35: Types of inference rules > 1. Sound inference - Soundness property of inference says that, if “X is derived from the knowledge bays using given set of protocols of inference, then ““X is entailed by knowledge bays Soundness property can be represented as: “If KB |- X then KB lex" ~ ForModus Ponens (MP) rule we assume that knowledge base has [A, A 5 Bl fing this we can conclude that knowledge base can have B, See following truth table : Pee TRUE | TRUE | TRUE Yes TRUE | FALSE FALSE Yes FALSE | TRUE TRUE Yes FALSE | FALSE TRUE, Yes In general, For atomic sentences pi, pi, and @ Where there is a substitution ® such that SUBST @pi) = SUBST (@, Pi’) for alli, SUBST (©, g) N+1 premises = Natomic Sentences + one i Example : A B aiflal nteligence (Mu IT-Sem-V)_3-47 Adversarlal Search Modus Tollens _ When B is known to be false, and if there is a rule “if A, then B,” it is valid to conclude that A is also false. Complete inference - Complete inference is converse of soundness. Completeness property of inference says that, if “X is entailed by knowledge base” then “X can be derived from the knowledge base” using the inference protocols. — Completeness property can be represented as : “ If KB Ix Q then KB I- Q”. 39.6 Horn Clause as See Clauses are generally written as sets of literals. Horn clause is also called as horn sentence. In a horn clause a conjunction of 0 or more symbols is to the left of “—>“ and 0 or 1 symbols to the right. See following formula : A1AA2AA3 ... AAn—Bm where n >= 0 and m is in range{0,1} ‘There can be following special cases in horn clause in the above mentioned formula : : A (This condition shows that assert A is true) For n>0 and m=0: A 4 B- (This constraint shows that both A and B cannot be true) For n = 0 and m=0 : (This condition shows empty clause) For n= 0 and m= Conjunctive normal form is a conjunction of clauses and by its set of clauses it is determined up to equivalence. For a horn clause conjunctive normal form can be used where, each sentence is a disjunction of literals with at most one non-negative literal as shown in the following formula: sAlv7A2v—A3 ... v>AnvB This can also be represented as : (A > B)= (A VB) Significance of horn logic Horn sentences can be used in first order logic. Reasoning processes is simpler with horn clauses. Satisfiability of a propositional knowledge base is NP complete. (Satisfiability means the process of finding values for symbols which will make it true). For restricting knowledge base to horn sentences, satisfiability is in A. Due to this reason, first order logic horn sentences are the basis for prolog and datalog languages. Let's take one example which gives entailment for horn formulas. _—X~ (YT anole Intolll Find out if fol (aruc-> X) 0 KA Y KS from the above equation, we entail if the query atom is false, Baiatio, From Jauses which state that true 9X and true >Y, so we can assign x are claus (ive. tee 9X AY): ‘Then we can say that all premises of X A YZ are true, based on this inf. ak he s : ~ at we can see all premises of Z->W are true, ‘on assign Z to true. After thi aon a to true. ‘As now all premises of ZA W — false are true, from this we can entaij that atom is false. Therefore, the horn formula is not satisfiable. ‘Syllabus Topic : Propositional Theorem Proving a Propositional Theorem Proving lowing horn formula is satisfiable? PD AEIW AE AW false)» true sy, 2 shows and Youth aby ty 3.9.7 = Sequence of sentences form a “Proof”. A sentence can be premise or it can be a sentens derived from earlier sentences in the proof based on the inference rule. Whatever we vay to prove is called as a query or a goal. Query/goal is the last sentence of the theorem iy the proof, - Take Example of the “weather problem” which we have seen above. - HT for “It is hot”. - HM for “Itis humid”. = _ RN for “Itis raining”. 1. | HM Premise (initial sentence) “It’s humid” 2 vce(inits HM >HT. Premise(initial sentence) “Tf it’s humid, it’s hot” 3. [HT Modus ponens(1,2) (sentence derived | “It’s hot” from 1 and 2) 4. | (HT AHM)RN iseCiniti ) Premise(initial sentence) “Tf it’s hot and humid ela : it’s raining” AHM And introduction(1,3) id” 6 [RN “Tt’s hot and humi Modus ponens( 4,5) ; from 4 and 5) N(sentence derived | “t's raini 2” Q.) Write @ short note on: Drawbacks of propdallional loa fia Inollgonce (MU B.S0.IT-Somv) 9.4 19 Advorsarial Search 9% g Advantages of Propositional Logic Propositional logic is a simple knowledge rej It is sufficient and efficient techni problems. Propositional logic forms the foundation for hi ete, Propositional logic is NP Presentation language, que for solving some artificial intelligence based igher logics like First Order Logic (FOL), complete and reasoning is decidable. ‘The process of inference can be illustrated by PL. 3.9.9 Propositional logic is cannot express complex artifi Disadvantages of Propositional Logic cial intelligence problems. Propositional logic can be impractical for even small worlds, think about WUMPUS hunter problem. Even if we try to make use of propositional logic to express complex artificial intelligence problems, it can be very wordy and lengthy. PL is a weak knowledge representation language because : With PL it hard to identify if the used entity is “individual”. For example : If there are entities like : Priya, Mumbai, 123, etc. PL cannot directly represent properties of individual entities or relations between individual entiti For example, Pooja is tall. PL cannot express specialization, generalizations, or patterns, etc. For example : All rectangles have 4 sides. Syllabus Toplc : Effective Propositional Model Checking 3.10 Effective propositional model checking Lets understand the two families of efficient algorithms for general propositional inference based on model checking : 1, 2 Backtracking search, local hill-climbing search. cial Intelligence (MU B. =Sem-V) 3.53 Adversarial Search — Syllabus Topic : Agent Based on Propositional Logic 341 Agent Based on Propositional Logic __ In this section, we will learn how to construct wumpus world agents using propositional logic. In order to do the same we have to follow the steps: Step 1: Enable the agent to deduce the state of the world given its percept history. Step 2: Write down a complete logical model of “Action-Effect”. Step3 : Find out how the agent can keep track of the world efficiently without referring the percept history for each inference. Step 4: Develop logical inference to construct plans that are guaranteed to achieve goals. For example, In case of wumpus world, the starting square does not have pit, which can be represented as ~P,,, and also it does not have wumpus, which can be depicted as ~Wj,. Similarly the conditional statements like, A square is breezy if and only if, neighbouring squares have pit; and a square is smelly if and only if a neighbouring square has a Wumpus can be represented as shown below. — By =>@Pi2V Pr) : — Si4=> (Wiz V Wo) Similarly we can specify other facts about the Wumpus world. Q.1 Write a short notes on : {a) Game types (b) Zero-sum game (c) Relevant aspects of Al games (d) Features of Al game Q2 Explain minimax algorithm with an example and give it's properties. Q3° Give a-B pruning algorithm with an example and it's properties, also explain why is it called a-B pruning. Q4 Draw game tree of tic-tac-toe problem.

You might also like