0% found this document useful (0 votes)
86 views

AI

Techmax MCA textbook sem III

Uploaded by

willaim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
86 views

AI

Techmax MCA textbook sem III

Uploaded by

willaim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 101
i spe tense 4 goon oF Knowledge Representation & ge Rep Artificial Intelligence: ML, DL For MCA (Management) : Semester - III [Course Code - IT-34: Credits - 03] CBCS Pattern| As Per New Syllabus, Effective from Academic Year 2020-22 Ms. Dipalee Borse M.Sc. (CS), UGC NET, SET Asst. Proféssor Haribhai V. Desai College of Commerce, Arts and Science Pune 411002 Dr. Shveti Sejpal MCA, PhD (CS) Asst. Professor Haribhai V. Desai College of Commerce, Arts and Science Pune 411002, Price = 250.00 NIRALI PRAKASHAN Syllabus ... Unit No. Topics Weightage in% Number of | Sessions 1 11 1.10 Knowledge Representation Issues 1.11 AND-OR Graph 1.12 The Wumpus World Artificial Intelligence and Knowledge Representation Introduction to Artificial Intelligence and its ial Intell it es elligence i What is Intelligence and Artificial Intelligence? How Alis affecting on real life? Different branches of Al Limitations of Al Need of Knowledge Representation Knowledge Representation and Mapping Schemes Properties of Good Knowledge-Based System Types of Knowledge 15 3 Propositional Logic 21 22 23 2.9 2.10 The Tableau Method 2.11 The Resolution Refutation Method Mathematical Logic and Inference First Order Logic : Syntax and Semantic, Inference in FOL Forward Chaining, Backward Chaining Language Semantics and Reasoning Syntax and Truth Values Valid Arguments and Proof Systems Rules of Inference and Natural Deduction Axiomatic Systems and Hilbert Style Proofs 15 Machine Learning 3.1 3.2 3.3 3.4 3.5 History of Machine Learning Machine Learning Vs Statistical Learning 3 Type of Machine Learning - Supervised, Unsupervised Learning, Reinforcement Learning 3.3.1 Linear Regression 3.3.2. Logistic Regression 3.3.3. Support Vector Machines 3.3.4 Random Forest 3.3.5 Naive Bayes Classification 3.3.6 Ordinary Least Square Regression 3.3.7 K-means Essentials of Data and its Analysis 30 Framework of Data Analysis 15 Topics aa ig dane ag fie TE cn apron igen Pangpa Ersement Analysis, Singular Value Decompésition, ert of smvsipeited Wace Leong, Independent Component Analysis | Deep Lexring £1 facet of Deep Networks and Defining Deep Learning | [42 deep teaming Problem Types j 421 ANN 422 CNN 423 RNN 424 GAN 425 NP 43 Building Blocks of Deep Learning 44 Classification and Detection Algorithms should be taught using Python Library ~ Pytorch Extra Reading: DNN, Transfer Learning, Architectural Principals of Deep Networks - AlexNet, VGG 16, Inception, MobileNet, 4.4-4.20 Machine Learning 4. Deep Learning 44-467 Hardware and Software for Al 5.1 Data Center 52 Gateway Edge Computing 53 Keyprocessor for Al 54 CPU and GPU 55 Field Programmable Gate Array (FPGA) Hardware and Software for Al 54-540 6. | Application of AI 61 Robotics Process Automation - Chatbot 62 NLP | 63 Image Processing 6. Application of Al * Question Paper PA-P : 64 Speech Recognition Ded Artificial Intelligence and Knowledge Representation Objectives... Alter teacing ths chapter, you willbe able to: Understand the basic building block of Alicia inteligence. Understand the Knowledge Representation, INTRODUCTION TO ARTIFICIAL INTELLIGENCE AND ITs EVOLUTION * Artificial intelligence is a branch of Computer Science that pursues creating the computers or machines as intelligent as human beings.’Al started evolving after 1950's. Evolution: Early history: * Various philosophers and scientists explored the idea of creating Artificial Intelligence, from Leonardo da Vinci's designs for humanoid robots to the development of mechanical calculators in the 19" century, * In 1956, a group of researchers gathered for the conference at Dartmouth College, coined the term “artificial intelligence” and laid the foundations for the field. The 1950s-1960s: * During this period, AI research focused on creating programs such as playing chess, solving mathematical problems, General Problem Solver (GPS) and ELIZA. In this Period, early theories of Artificial Intelligence, such as the Turing test were developed. ‘The 1970s-1980s: * uring this period, more practical applications such as Expert Systems and Natural Language Processing (NLP) were created. Expert systems were able to provide expert- evel advice on specific tasks or problems. * During this period, investment and development in AI slowed down due to the Jmitations of early Al systems and the failure of some high-profile AI projects to deliver on their set goals. 1K] Knowledge Representation & Artificial Intelligence: ML. DL (MCA. Sem I] ‘The 1990s-2000s: * The field of At experienced rebirth during this period, and developments in Ma Learning and the availablity of large data sets. Machine learning is a type of Al enables computers to “learn” from data, without being explicitly programmed. + First successful Al applications, such ‘as self-driving cars and intelligent. person assistants like Apple's Siri were developed. + The rise of the imernet and the increase of Big Data also played a key role, as th Provided researchers with large amounts of data that could be used to trai Machigg Learning Algorithms ‘The 2010s-Present: * im recent Years, Al has continued to evolve rapidly. Some of the significant developments are the growth of Deep Learning, the development of A powerey medical diagnostic tools, and the widespread adoption of AI These amprovements have enabled machines to perform tasks such as image. aed speech recognition with supreme accuracy, leading to an increase of Al-powered products and services, 1.2_| WHAT IS INTELLIGENCE AND ARTIFICIAL INTELLIGENCE ? + Intelizence relates (o tasks involving higher mental processes, eg, crealvity, Problems, pattern recognition, classification, learning, induction, guages, aptimization, language processing, knowledge and many more. Intelligence is the computational part of the ability to achieve goals. + Anifcal intelligence is a branch of Computer Science that pursues creating the computers or machines as intelligent as human beings. ‘The Definition © Artificial Intelligence is the study of how moment, people do better. © According to the father of Artificial Intelligence, John McCarthy, Artifical Inteligence is “The science and engineering of making intelligent machines especially intelligent computer programs”, ei * Beds accomplished by studying how human brain thinks and how humans learns ecide, and work while trying to solve a problem, and then using the results of thig study as.a basis of developing intelligent software and systems. * {Ls gained quality due to Big Data, or the increase in speed, size and variety of data being collected, AI can perform tasks such as identifying patterns in the dice more efficently than humans, enabling businesses to gain more insight out of their data HOW ALIS AFFECTING ON REAL LIFE? * SEAT most changes in life there will be postive and negative Impacts on socey os A Continues to transform the world we live in, * [Here are some of the challenges that might be faced and several of the positive Ampacts Al will have on society, © fruficial intelligence can totaly improve the efficiencies of work, laces and can increase the work that humans can de, moe 12 (0 make computers do things, which, at the Alana ey With better monitoring and diagnostic capabilities, artificial intelligence can Intensely influence healthcare. Our society will gain countless hours of productivity with just the introduction of autonomous transportation and Al influencing our traffic congestion issues not only to mention the other ways but also it will improve on the-job productivity. ‘The method we used to uncover criminal activity and solve crimes will be ‘enhanced with Artificial Intelligence, + Artificial intelligence will have a big impact on our life unless we decide to live ely and don’t wish to connect with the modern worl DIFFERENT BRANCHES OF AI *+ Artificial Intelligence can be used to solve real-world problems by implementing the following processes! techniques: Machine Learning Deep Learning Natural Language Processing Robotics Expert Systems Fuzzy Logic Machine Leaming Branches ‘al Natural Language Processing Robotics Fig. 1.1: Branches of Artificial Intelligence 13 tin & Arial teience: ML DL [MCA. Som tm) sonedgeReprsetati 1. Machine Learning: ung is @ branch of Al that involves devetoping and Machine learning ing that enable computer software to perform tasks through an gaara Machine learning fs provides solutc and interpreting data tt allows machines to learn, and execute funct past events The three subcategories of machine Reinforcement Machine Learning, In supervised machine learning, labeled training data ig feline specific algorithms for analyzing data and making pedals, cere tat armings & type of machine learning where unlabel | unspecified data is used to train the system : eee Seafercement Learning isa type of machine learning that wo aechions between negative and positive signals ‘ae w ‘mechanism of trial and error interactions, 2. Expert Systems; * An Expert System is knowledge-based Problems using heuristics and stored data, * Wider decision-making, expert systems are designed to imitate hus behaviors, in terms of correlating datasets and i patterns. The mechanism, by which expert systems work, is a Fesult-oriented mechanism, These systems do not rely on conventional Programming methods, but rather on the outcome, in response to an input, applying algorithms f° process, 1s £0 reallife problems by processing, given in the system to r rks based on making sed on a repetitive man cognitive | lentifying similarities and repetitive | * 3. Neural Networks: + Neural networks are solve real-wor datasets, * With neural networks, a structuy Correlations effectively. detection i aPPU cation ofthis type of artificial intelligence technology int ; fi clude fraud digital assistants, and market analysis, oe. sensed after human neurological systems, and are used tof 2 "14 problems by identifying relational links betewn variables. in al approach is utilized to classify data and draw guage Processing (NLP): : guage processing deals wit the ii _ ihe textoraudie fern 1B vith the extraction of information data in either In NLP, the computer system is Faecammed to identity human interaction patterns, ‘a and ft uses these patterns to simulate or analyze such human interactions. cations of NLP include Chatbots, and Personal Assistants, oe 5. Robotics: oowindge Representation & Atl in - sa LEENA nce: ML DL IM.CA. Sem The knowledge of various fields, applicable in Robotics. Pee Pals are designed to handle tasks that are commonly handled by humans, ‘These tasks are mostly monotonous and heavy or dangerous. TRS atvancement of artificial intelligence has widened the scope of utilization of Fobots to include more complicated tasks. {including Computer Science and Engineering, are 15 a branch of artificial intelligence that works by assessing the credibility of data, to classify the data as either true ot false. Fuzzy logic follows human logical cognitive processes, roving or disproving a hypothesis or uncertain data, Tee ais goal to give users a reasonable amount of Mexiblty when dealing with The Mochine henry uPportive technology to other branches of artificial intelligence like Machine Learning, 1 ruzzy Logic, data is resolved into true or false results, where true results are Fepresented numerically a5 1.0, while false results are represented as 0.0. branch of At deals with [2.5 [umrrations oF at Data Utilization: Tor any program in Artificial Intelligence, execution stage. The software robots need intelligent with time. There are likewise (gat utilize technologies like Machine Learning (ML), Optical Chorence Recognition seme auttal Language Processing (NLP) and Robotic Process Automation (abr eg remove the significance of data restricted in the documents Bias: ‘Shrouded bias is available in both individuals and data, and periodically bias is given ace (0 Gata tn light of people. The data may have a bias in ft. Begin with a bases {age Bounded in client insights from behavioral analytics and: market surveying instead of executing AI directly. Ensure you have the data ana thinking first and then execute. : Emotional Intelligence: At lacks emotional inteligence as it cannot clasify human thoughts and mindsets into one of a kind data points or profiles, Shortage of Strategic Approach: While organizations are widely adopting AI innovation, they fil to approach it froma Strategic point of view. This suggests completely understanding the points and goals of all aspects of Al operations, from data gathering to how the experiences revesied are informed over the workforce and set to work. 1s ation & Arif Intetignnce: ML OL IM.CA. Sem) Koonedge Repreventaton 8 5. igh Cost: + Metardvarean stare requirement of AL ery cosy besuse i requ maintenance fo meet current world requirements of [26 ] NEED OF KNOWLEDGE REPRESENTATION Rooney an important ree Aes in order to sole complex pal To caat slong new problems one needs both large amount of owed and "e mechanisms for manipulating that knowledge. * # becomes clear trough knowledge representation thatthe spec representation models permit the use of more precise, methods KNOWLEDGE SCHEMES * A variety of ways of representing knowl Programs. There are two types of entities : J. Facts: Truths in some relevant world which we want to represent, 2 ‘Representation: Representation of facts in some format wiach ve Will be able to ‘manipulate. 5 Structuring these entities as two levels: 1. The Knowledge level, at whi and current goals. 2 The Symbol level, at which representation of obj defined in terms of symbols that can be manip “s Ss iy ] ‘fic knowledge ore powerful problem solving REPRESENTATION AND MAPPING ledge (facts) have been exploited in Al ch facts are described. Facts include agent's behavior Jects at knowledge level are ulated by programs, Knowindge Representation 8 Artifical Iteligence: ML, DL IM.CA. Sem Alsod xo entation kAriicaltnatigence: ML DLIMCA Sem) Land + Te forward representation mapping maps from facts to representations. The backward representation mapping maps ftom representation eee eae Fepresentaton of fats is natural language or Engi representation, Example: +> Consider the following English sentence: Spot is a dog @. The fact can also be represented in logic 28: dog(Spot) © Suppose the logieal representation ofthe fact, “All dogs have alls" vx: dogts) "> hasta) + Using deductive mechanism, we may generate new representation object: Iastal(Spot + Using backward mapping, we could generate a sentence: "Spot haya tail 1,8 | PROPERTIES OF GOOD KNOWLEDGE-BASED SYSTEM * A good system for the representation of, knowledge in a particular domain mut possess the following four properties: 3. Representational Adequacy: I is ability to represent the required knowledge. 2 Inferential Adequacy: Itis ability to develop knowledge representation strcccures such as symbols when new knowledge is inferred from old knowledge. 3. Inferential Efficiency: The ability to include additional infermation into Ghowedge structures which may help inference process to move in promising direction. ‘4 Acquisitional Efficiency: The KR system must be able to obtain new information Furiurry. {@) Select an unexpanded node from the most Promising path from INIT (call it NODE) Example: _knovadge Representation Artificial Intetigence: ML, DL (MCA. Sem I) (o) Propagate she newly discovered information up the graph by doing the follo have values propagated back to their parents, Initialize S to Node Until § i Compute the cost of each of the ares emerging from CURRENT. Assign minimyg Costin step i (iv) Mark CURRENT as SOLVED if all arc have been labeled SOLVED (0) H CURRENT has been labeled SOLVED oF its cost was Just changed, propagate new cost back up through the graph. So add all of the ancestors of CURRENT to Ar Step 1, Node A isthe only node so its expanded Yielding nodes B, Cand D. Node. {sa most promising node which costs 6 compared to Nodes B & C costs 3+4+2= are with single successor has cost 1), ‘Betore step + [A] Tig. 15 (a) 1m Step 2, Node D is chosen and produces new estimated cost 10(4+4+2) so update fo 10, Betore step 2 (ate to Nodes E & F with combined | ‘This requires updating cost of AND arc B-C to 12(6+4+2), Now are D is ‘again a better path from A so record this as current best path, ‘Before step 4 Fig.15(0 tinues until either solution is four ree aeumPus world is a cave consisting of rooms connecled By passage ways, Lurking somewhere inthe cave is the terrible Wumpus, a beset thar eae anyone who enters its room, sae avumbus can be shot by an agent, but the agent has only one arrow. soos een asin bottomless pits that wil rap anyone who wonders into these rooms (except for the Wumpus, which is too big to fallin, he only modifying feature of this bleak environment fs the Possibility of finding a {eae of gold. Although the Wumpus world is rather tame by rodery computer game ‘Standards, i illustrates some important points about intelligence, 4 | S855 1 2 | $8855 BRE 7 2 3 4 Fig. 1.6: 4 Typical Wumpus World Lis Ml, DL IMCA. Sem I) “The Agent is in the bottom left corner, facing right. iy observable, a some aspects of he state are not rely perceivabe + itis partially observable, se oston te Wompuss sate o esl and the avalabitg ee «Tepetie definition ofthe akenvronment i given by PEAS description, eros pls for climbing out othe cave wth he ol “00 for ating into itor being eaten bythe Wumpus. “Aor eschaction taken “ofor sing up the arrow Knowledge Representation & Aria tte i ©The game ends either when the Agent dies or when the Agent climbs out of Environment: A4 «4 grid of rooms. ©The Agent always starts inthe square labeled [1,1], facing to the right. ©The locations of the gold and the Wumpus are chosen randomly, with a unify distribution, from the squares other than the start square. 2 en siiition- each square other than the start can be a Pit, with probability 0.2 ‘Actuators: © The Agent can move forward, turn left by 90°, o Turn Right by 90°, © Meakgent dies a miserable death if it enters @ square containing a Pit or al ‘Wwumpus. © Man agent tiesto move forward and bumps into a wall, then the agent does n move. © The action Grab can be used to agent. © The action Shoot can be used to fire pet i facing, The arrow continues until it either hits (or kills) the Wumpus hits a wall. The agent has only one arrow, so only the fret Shoot action has effect. © Finally, the action Climb can be used to climb out of the cave, but only from squ: ‘Sensors: The agent has five sensor rs, each gives a single bit of information: Inthe square containing the Wumpus and in the dire an ‘tly (not diagonally) adjac ___S4uaTeS, the agent will perceive a stench, cere ate! © Inthe squares directly adjacent toa Pit, © Inthe square where the golds, the ager 2 When an agent walks into a wali will the agent will perceive a Breeze, nt will perceive a Glitcer, perceive a Bump, 1i6 + The Pit cannot be in (1,1), b Pick up the gold if itis in the same square as the an arrow ina straight line in the direction the * The agent perceives a stench in (1,2), Knowledge Representation & Artic int Mi, DL IMA. Sem Bm Atanas © When the Wumpus is killed, it emits a woeful Scream that can be perceived anywhere in the cave. ©The percepts will be given tothe agent program in the form of alist of five symbol: Example: (Stench, Breeze, None, None, None], + For an Agent in the environment, the main challenge is its initial ignorance of the configuration ofthe environment; overcoming this ignorance seems to require logical reasoning, + [most instances ofthe Wurmpus world, itis possible for the agent to retrieve the gold safely. About 21% ofthe environments the gold isin a Pit or surrounded by Pits. Lee us watch a knowledge-based Wumpus agent exploring the environment shown in the Figure 1.6. +The agents initial knowledge base contains the rules of the environment, it knows that itis in [1,1] ands a safe square. We denote that with an “A* and “OK respectively, in square (1, 1. * The first percept is [None, None, None, None, Nonel, from which the ‘Agent can conclude that its neighboring squares, {1, 2} and (2, 1), are free of dangers—they are OK. + Accautious Agent will move only into a square that it knows to be OK. the agent decides to move forward to [2, 1]. The A; “B")in (2,11, so there must be a Pit in a neighbor: Let us suppose gent perceives a Breeze (denoted by ing square. ¥ the rules of the game, so there must be a Pit in (2.2) or 13] or both. The notation *P2* in Figure 1.7(b) indicates a Possible Pit in those squares. * At ihis point, there is only one known square that is OK and that has not yet been tisled. So the prudent agent will turn around, go back to [1, 1, and then Proceed to (21, Tesulting in the state of knowledge shown in Figure 1.8 ), The Stench in 1,2] means that there must be a ‘Wumpus nearby. But the Wurpus cannot bein [1,1] and (2,2), by the rules of the game. ‘Therefore, the agent can infer that the Wumpus isin [1,3]. The notation WI indicates this inference. Moreover, the lack of a Breeze in (1, 2] implies that there is no Pit in (2,21. : » 2] oF (3, 1], so because it combines 'es in different places and relies on the lack of a Percept to make one crucial step, lay | nueigence: ML, DL IMA. Ser ‘he agent has now proved to itself that there Is neither a Pit nor a Wumpys in tis OK to move there. We do not show the agent’ state of knowledge at f2, 2 ygent turns and moves to [2, 3, giving us Figure 1.8 (b) tn an + Note that in each case for which the agent draws a conclusion from the By oowladge Reprrenaon& rifilintipnce: ML, LIMA. Se Alensee SUMMARY > Antificialinteligence is a branch of Computer Science that pursues creating the computers or machines as intelligent as humnan beings. > Alprogram mainly based in datarknowledgebase. assume thatthe a Agent detects glitter, soit should grab the gold and then return home, ll information, tha conclusion i guaranteed tobe correct if the available informays Knowledge can be represented in such a ways that it ean be used for problem solving correct. This is a fundamental property of logical reasoning.“ 4 Knowledge can be simple relational, inferential, procedural, inheritable knowledge. Pe PE | meme fp apap pe] Skies CHECK YOUR UNDERSTANDING | Oc Ste re : 41, One of the definitions of Artificial Intelligence focuses on various problem-solving v2 [22 [32 [42] S=Stench 72 (2: methods used in processing: i ce [Po ee oe pone [‘B a1 [at far ut Patmgst faa (©) smell (@) symbols o | &loe} Pt | 2. Natural language processing has two subfields, namely: ry 7 (@) algorithmic and heuristic (©) time and motion "6-175 (4 The nal situation aftr percep None, None, None, None, None, (3) After og | (© understanding and generation (4) symbolic and numeric ‘move with percept [None, Breeze, None, None, None) 3. Which ofthe folowing is the branch of Artificial Intelligence? (@) Machine Learning () Cyber forensics 14 [24 [a4 [aa Br Agent 14 [24 [aa (©) Full-Stack Developer (a) Network Design apa pss G2 te cou ls 4. Which of the following machine requires input from the humans but can interpret we OK = Sate square the outputs themselves? 72 g za_|az fa] $2 iene (@) Actuators (6) Sensor | OF We Wumpus (© Agents * (@) Al system ge evel ae 5. Which of the following is not an actuator in Wumpus world problern? a (a) Breeze (©) Grab a ©) (6) shoot (@ Pit TE 18 () After third move with percep Stench, None, None, None, None], (b) After fifth Answers 138 19 PRACTICE QUESTIONS Q.1 Answer the following questionsin short. 1. Define artificial Intelligence. 2. What are the properties of Good Knowledge based System? 3. State different limitations of artificial intelligence, 4. What is the need of knowledge based? 5. What is Procedural Knowledge? @. 1 Answer the following questions. 1, Explain different types of knowledge? 2. Describe AND-OR Graph algorithm with example. 3. Describe PEAS description in Wumpus world problem. 4, Explain any three knowledge representation issues? 5. Which are limitations of AI? Qu Writea short note on: 1, Machine Learning 2. Procedural Knowledge 3. Branches of AI 4. Wumpus World Problem 1.20 Propositional Logic Objectives... Aller reading this chopter. you wit be obie to: + Apply Propositional Logic for knowiedge representation + Apply Predicate Logic tor knowledge representation, 2.1_| MATHEMATICAL LOGIC AND INFERENCE ‘+ Inference means generating new conclusions from old facts and evidence. In artificial intelligence, the inference engine applies logical rules to the knowledge base to evaluate and analyze new conclusions. Machine learning includes two phases. First, is the training phase where recording, storing, and labeling of data is done. Second, is the inference phase where the machine uses the data gathered in the training phase to generate new data. ‘+ Inference learning can be used to improve human deci machines the ability to learn, ion making and provides Inference rules are applied to derive proofs in artificial intelligence, and the proof is a sequence of the conclusion that leads to the desired goal. Terminologies related to inference rules: ‘+ Following are some terminologies related to inference rules: (© Implication: It is represented as AB. © Converse: The converse of implication. It can be written as B A. © Contrapositive: Contrapositive is the negation of converse, and it can be Tepresented as +B» 7A. © Inverse: The negation of implication is called inverse. It can be represented as ASB. Propositional Logic (PL): + Propositional logic (PL) is the simplest form of logic where the statements are represented by propositions written as Well Formed Formula (wff) in propositional logic. A proposition is a declarative statement which can either be true or false. + Itrepresents knowledge in logical and mathematical form. Example: Some simple facts in propositional logic: “Itis raining” represented as “RAINING” Ga OL MA. Sem - Arif nttigence: Mt, OL MEA namdedge Repreentton & Ari Fr ee) Dojneen). Conkneton(), txaaegt ae oniuon formula which is always true is called tautology, and itis also cay FIRST ORDER LOGIC: SYNTAX AND SEMANTIC} INFERENCE IN FOL _Komledge Representation & Artcll nteligence: ML. OL IMA. Sem IB Propontons tage Functions: Function symbols denote relations defined on domain D. They map n, elements to a single element of domain. An n place function is written as fle 2, ..tn) where the ti are terms such as constants, variable, or functions defined over some domain. Connectives: The five connective symbols are ~ (not or negation), A(and oF conjunction), Vior or disjunction), -s (implication), ¢+ (equivalance or ifand only i, = Quantifiers: fal when itis simple to deal with and a decisi . 1. Universal Quantification: mney ina more convenes Proce + (9PG) means ‘olds for all values of x in the domain associated with order to raw conclusions, facts ae represented in amore convenient wayae ot) PR) means that P holds forall val ss 1. Mareus isa man. that variable. Example: (¥ x) dolphin(x) -» mammal(x) 2. Existential Quantification: 2. Plato isa man, 3. All men are mortal, + ropostona loge fl to describe the relationship benveen an individual beng ‘man and that individual being a morta. + First Order Logic or First Order Predicate Logic was developed by logicians to ex, the expressiveness of propositional logic. « _Itis. away of representing real world facts as statements written as wff's. 1 (3 21P00 means that P holds for some value of x in the domain associated with that variable, Example: (= x) mammal(x) A lays-eggs(x) 3, Nested Quantifiers: + We will often want to express more complex sentences using multiple Predicate Logic: 4 ‘quantifiers. The simplest case is where the quantifiers are of the same type. + First Order Predicate logic (FOPL).or First Order Logie (FOL) models the world j eat terms of: 4 41, “Brothers are siblings” can be written as, WY x ¥ y Brother (x, y) > Siblingts, y) 2. “Everybody loves somebody" can be written as, Vx By Lovestx,y) Atomie Sentences: Objects, which are things with individual identities. Properties of objects that distinguish them from other objects. Relations that hold among sets of objects. Functions, which are a subset of relations where there is only one “value” for an siven “input” 2.2.1 Syntax of FOPL ‘The syntax of FOL determines which collection of symbols is a logical expression in | first Order Logic. The basic syntactic elements of First Order Logie are symbol. We Write statements in short-hand notation in FOL. ‘Symbols and Rules of combination in FOL: + Constants: Constants are fixed + An atomic sentence is formed from a predicate symbol optionally followed by parenthesized list ofterms such as, Brother (Tom, John) ‘+ Atomic sentences can have complex terms as arguments. Complex Sentences: + The Logical connectives are used to construct more complex sentences, Constants, value terms belong to the given domain of discourse | variables, and functions are referred to as terms, and predicates are referred to as, denoted by numbers, words, and small letters, atomic formulas. © Example: a, b, 6, john or name a specific object Brother (Richard, John) ABrother (John, Richard) * Variables: Variables can have different values over a gi Example: a" given domain, It refers to at object without naming it. tis denoted by words and small letters. Consider the following example that shows the use of predicate logic as knowledge © Example: x,y. representation technique. 2 2 — ob MCA Semin sion Ai netigents Mi Marcus was man. Marcus was a Pompeian ere Romans. {All Pompeians were ROT caesar was a Fuler wrest pompeians were ether 1oyal (0 Caesar or hated him Sara yunroassssinate urs they are not loyal ‘The facts described by these sentences can be represented as a set of wellfor formulas (ff) as follows: rnaiarcus) 2. MarceswasaPorpelas Pompeian (Marcus) 4. All Pompeians were Romans. ‘yx Pompetantx) + Roman(a) 4 caesar wasa rer. ruler(Caesar) 5. All Pompeians were either loyal to Caesar or hated him. Inclusivear: Vx: Roman(x) — loyalto(x, Caesar) V hate(x, Caesar) exclusive-or: 9 ‘Vx: Roman(x) — (loyalto(x, Caesar) \> hate(x, Caesar)) V (-loyalto(x, Caesar) N hate(x, Caesar) 6. Everyone is loyal to someone. Vx: Ay: loyaltotx, y) 7. People only try to assassinate rulers they are not loyal to. Wx: Wy: person(x) A ruler(y) | tryassassinate(x, y)—+ sloyalto(x, y) 8 Marcus tried to assassinate Caesar tryassassinate (Marcus, Caesar) 1 2 3 4 Interpretati Arial totetigans: ML DL IMCA. Ser Proposons tage © Amapping from constants and all the elements or objects of D Le. Dis a set of atl the elements from which fixed assignments are made to constants and from which, the range of functions are defined. ‘The domain of each n-place predicate is also defined over D. Each n-place predicate is mapped onto exactly one set of ordered n-tuples of elements ofp. ‘That means each predicate of degree 2 is mapped onto a set of ordered pairs of elements of D. A predicate or wif with 0 variables are called ground atom. reveratont Interpretation is given to wff, when an assignment of values is given to each term and to each predicate symbol in w/f. Literals evaluate to elther true or false under an, interpretation, the value of any given w/f can be determined by the Truth Table 2.1 which gives truth values for subexpressions of wff. Consider A and B are predicates: ‘Truth Table 2.1 A B AVB | _AAB | ASB | AGB ] Tatse | Tatse | False | Tate | true | true | te | Fatse | True | true | Fate [rote | rete | tree | True | Tae | True | False | true | ate | rave | Troe [True | true | true | true | true | rane | ‘The Truth value af compound expression is determined by evaluating predicates that have variable arguments, since they evaluate to true only if they are true for appropriate values of the variable. ‘+ Asentence Sis a logical truth iff Sis true under every interpretation. A sentence S is logically false iff Sis false under every interpretation. The truth values for two different wit’s are the same under every interpretation and are said to be equivalent. Example: Consider the expression: Es ¥ (ACG, x) V B(ECO) & CO) + DX) Since the whole expression E is quantified with Vx it will evaluate to true only if it evaluates true for all x in domain D. Define D= (1,2) and from D assign following values: 2.2.2 Semantic for FOL a2 + An interpretation ofa formal language consists o fl) =2,f2)=1 © Non-empty domain D; if not stated explicitly D will be unde AQ) = true, AQ,2)= false stood. context. eto BCA) = true, B(2) = false 2S 4 iin. scpresson Fevaluatesto false, 2.2.3 Inference in FOL alate tg true for ay 2 Aha has property P ie. Pla) and all objects that have ue. ¥s POX) > Q(x) then by. ie. Oa). A key inference rule in FOL is modus ponens. + For atomic sentences p, p,, and q, SUBST (6, p.)= SUBST (0, p), for all, Property P also have Propg substituting a for x we conclude that ‘a’ has Propery Where there is a substitution © such Pye Po on Pip iA Be AP, => QUSUBST (0, p) *Substiulon isan important part of the inference process A substitution i define a set of pair’ tiand vi are di. Substitution is a basic operation occurs in all inference systems in Firstorder Logie, | Zhe substitution is complex inthe presence of quantifiers in FOL: If we write F laf itmeans to substitute a constant “a* in place of variable “x” : Example: x, y(Parent(x, y) A Male(x) -> Father(x, y)) 2. Parent (Tom, John) 3. Male (Tom) 6 =(x/Tom, y/John) 4. Father (Tom, John) Generalized Modus Ponens is a sound inference rule, Firs, sentence p (whose variables are assumed to substitution 0, P [= SUBST (8, p) a We observe that, for ay be universally quantified) anid for Holds by Universal Instantiation. If holds for a 0 that Satisfies the conditions of. Generalized Modus Ponens rule. Thus, from py’py'..p,' we can infer SUBST (0, p:') A. ASUBST (0, p,}) 26 a. Knowledge Rapreentton& Arial Bgwnce ML DL (WEA. Sam «and from the implication pi’, SURST(, pr) 5 make inferences in response to newly First Order Definite Clauses: A Gaus which is disjunctios of Wteras of having at most one postive literal scaled as horn clause. Disiunctions of iterals of having exactly one postive itera is called as frst order definite clauses or strict horn clause. A definite clause either is atomic or is an implication whose ancestor is a ‘conjunction of positive literals and results in single positive literal Example: King(x) A Greedy (x) > Evil(x) King(John) Greedy (y) tches the premise of the second exactly, ‘Response are especially useful for systems that arrived information. First-order literals can include variables, be universally quantified. Universal quantifiers are omitted while writing definite clauses. Not all knowledge bases can be converted into a set of definite clauses because of the single positive literal restriction. Example: in which case those variables are assumed to ‘The law says that itis a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American, Prove that “West is a criminal” using Forward Chaining. 27 ML OL IMEA. Sem, seal maigeae: snonladge Repmetstion aa these into first order definite clauses, constant Mi: Owns (Nono, B11) ~ (2) Missite(M11)—~ (3) 4. “Allofie ussles were sold to ity Colonel Wests Aisles) Owns (Nono, x)= Sells West, x, Nona) (4) 4 Weuillalso need to know that msites are weapons Missile(x) > Weapon(x) — (5) 5 ani we must know that an enemy of America counts as “hostile”; Enemy (x, America) — Hostiletx) — (6) 6 “West, who is American .,»: American (West) (7) % "The country Nono, an enemy of America . Enemy (Nono, America) (8) Simple Forward Chaining Algorithm: * A Simple Forward Chaining Algorithm starts wi rules whose premises are satisfied; adq their conel Process Fepeats until the solution is found, or no new fi * The two facts are identical except the y Algorithm: function FOL-FC-ASK(K8,a) returns 9 Substitution or false {nputs: KB, the knowledge base. s Set of First the query, an atomic sentence Jocal variables: new, the new sentence repeat until new is enpty 2 ei new 6) for each rule tn xB éo (PLA... for each @ such that suasr( (pn => @) «= STANOAROIZE- VARIABLES rule) + Be An ae Apa) = suesTe, for sone pv, . ate suBst(9, q) Af a Goes not unify with sone sentence already 4n KB or new then add g°to new 4 = UnEY( ) AF @ 45 not fal then return @ add new to xe return false Frample: Consider clauses in the above example, To prove “Wests eximinal” we need clauses 1,2,3,4,5, 6. ‘Om the first iteration, Rute (1) has unsatistied premises Role is satisfied with tx/u), and Sells (West MI, Nono) is added, Rule () is satisfied with (x2M1}, and Weapon (M1) is added, Rule (6)is satisfied with (x/Nono}, and Hostile (Nono) is added, On the second iteration, Rule (1) sSaisfed with (xWest, yt, zNono}, and Criminal (West is added. Following diagram shows the proof using Forward Chaining, Step: Consider the facts having no inpleaone evenore | [Lissean | Loman] [fermen] i240) | Step2; vx Missiletx) AOwns(Nono, 3) Sells(West, x, Nono)) ern [soso [wena] fewton re] [FT ane] [Torreon] [Epes a] Fig. 2.1.00) 2 Weapon tt) _ | [Sete (Westitt.Nonoy | ‘Missile (M1) ‘Owner (Nono,t44) Fig. 2.1 (6) : / | Hoste (Nonay Properties of Forward Chaining: 1. Forward Chaining is sound and complete for first order di inference is application of generalized modus ponens. 2. Its complete for definite clause knowledge bases. 3: roof of completeness is easy for data log knowledge bases having first order det Clauses without functions lefinite clauses as 4. The algorithm fails to terminate for knowledge bases having Peano axioms, Example: Yn NaturalNo(n) > NaturalNo(S(n)) é& NaturalNo(o) Results in NaturalNo (5(0)), NaturalNo (S(S(S(0)))), NaturalNo (S(S(0))) & so on. Efficiency of Forward Chaining: * No need to match a rule om iteration k if @ premise wasn't added on iteration k That means match each rule whose premise contains a newly added literal, Pattern matching itself can be very expensiv Database indexing allows O(1) retrieval of known facts. For example, query Missile(x) retrieves Missile(M1) * Matching conjunctive premises against known facts is NP-hard Missile(x) / Owns(Nono, x) > Sells(West, x, Nono) Instead of finding all objects owned by nono and they find all missiles and then check whether they Forward chaining is widely used in deductive 2.3.2 Backward Chai * Backward Chaining is kind of AND/OR search. Ia 'n check if it is a missile, we can} are owned by Nono. databases, ‘Function FOL-BC-ASK(KE, goals,@ ) returns a set of substitutions inputs: KB, 9 knowledge base foals, 9 1st oF consuncts forming » query (0 already applied) 8, the current substitution, initially the eapty substitution Jocal variables: answers, a set of substitutions, initially empty AF goals 1s empty then return (0) © SuBst(@, Frrst(goais)) for each sentence © in Ke where STANDAROIZE-APART(r) = (py /\ APs = 4) and 6'& UNIFY(a, 4°) succeeds mew Hoals © (pi... py | RESTCgoals)} ‘answers €FOL-BC-ASK(KB, new_ goals ,COHPOSE(O*, 6)) U answers return answers Example: Consider above example and prove “West is a criminal” using Backward chaning selon: sien: inlay] tees rea) Step 2: cnr Anarcn 0] [tenon [samo | ear Fig. 2.2.(h) fae ietigence: MLO (MCA. Sem on sf ri _Hrowindge Repreventtion & Aria Steps: Scorictr errretnion& itll wtigence MLD 1M CA. tem Properties of Backward Chaining: + Depth-first reeursiy Incomplete due toi Fix by checking cu Inefficient due to re Previous results (extra space! TAnsUaRE ts a Pale of sec of connectives and econ formulas, wma) Language = « Connectives, Formulas » 5 Let fs set of formulay/ sentences in natural language, Fig. 22¢) P's given set of atomic formulas = (PLQ.R, “ST e F Where-4T are constants Mae Pthenae P Wace Fthen ae F Ha.BeFthen (aA Ble tay per, The set of formulas roo! search because space is linear in size of proof infinite loops, i Step 4: American (West) Sentence with respect to a specifi A model in propositional to; om Proposition symbol, ” + For example, followin, », m ic sentence. SIC decides the Truth Value (true of false) for 1s one possible model with proposition symbols P,P Piz false, Ps, =false, Py, =true), {With three proposition symbols, there are 2" =p Possible models. The semantics must specify how to compute the truth value of any ‘model. This is done recursively, All sentences are constructed fr sentence, given a sentences formed with each of the five Atomic sentences are easy: © True is true in every model The truth value of every ot model. + For example, in the model m, given earlier, Py zis false. and False is false in every model. ° her proposition symbol must be specified directly in the 2a Anica tteigonce: ML DL MCA. Sem I} Knowledge Representation 1 rive rates for complex se Fee eit Psa am 2. PAQistrueiff both P and Q are true in m. rg ine fenher Por Oisrue in m : eicia ails is true and Q is false in m. t fogis true? and Qare both true or both fase in m, Truth vale any sentences canbe computed By a recutave evaluation, 2 Rareeimple he sentence “uz AtPre Vig true) SYNTAX AND TRUTH VALUES + In Propositional Logic, syntax defines the allowable sentences, Tic atomic sentences consist of only proposition symbol. Each such a symbol a {for a proposition that can be true or false, + Complex sentences are constructed from sim connective. true true = true, “evaluated in mt, gives true jg ple sentences connected using tg Common Logical connectives used are as follows: Negation (-): A sentence such as ~ A is called negation of A © Conjunction (A); AA Bis conjunction where A & Bare conjuncts. Example: “Its raining today, and street is wet.* A= Itis raining today Be Street is wet So it can be represented as AAB Disjunction (\/): Fe propositions, as If-Then statement. AB Is an ‘onclusion or consequent, AV Bis called disjunction where A & Ba Implication (+ or >) implication where a is pre It is also knows ‘mise and B is its ¢ Bi-conditional (+); Ae Bis be P True | False | P/Q] Ry. fence» (Sentence | { Sentence } AtomicSentence -, Complexsent | >Sentence [Sentence A sentence Example: “John will be at the the party if i's on Friday or Sat _Koemleige Repreventatin & Aria nteigence: ML, DL {MCA Sem ‘Truth values for Propositional Logic: ‘Table 2.2 r =P. PVQ | PaQ | False Unie ise_| True Talse True True _| True [alse —|Talse True [True | Talse True | True © A proposition formu 12 which Is always true fs called tautology, and ite also called a valid sentence. + AProposition formula which is always false is called Contradiction. A proposiion formula is true in some valuations is called Contingency, 2.7_| VALID ARGUMENTS AND PROOF SYSTEMS ‘An Argument Is a sequence of Statements In wi hypotheses implies the conclusion, An argument can be represented as : (Py AP Mere Py, P..., Pais the premise We need to focus on the rel knowledge about conclusion Q, For example, Pi: All men are mortal P2; Marcus was a man Conclusion: Marcus is mortal An argument is valid if whi be true. That is (Py\Py/\,,, hich The conjunction of premises or A su \Py) 9 Q ‘and Q indicates the conclusion, lationship of the conclusion to premise, ot just any never the hypotheses are all true, Px) ~» Q is a tautology, party if Mary is there and Bi wurday, If Bill is at the party, at the party if itis on Friday. The party is on Friday, arty." wf for this example are: 4: Jobn will be at the party m: Mary is there b: Bill is not there t: Tom will be there party is on Friday s: Party is on Saturday the conclusion must also I is not there. Mary will be at ‘Tom will be there. Tom will not ‘Therefore, John will be at the 1. (mAb) +} I Sentence V Sentence 3 2 = { Sentence > Sentence ‘ to | Sentence +9 Sentence : Z : Sperator Precedence: A, V6 hom at 25 nowieds Totest whether (Py/\P: ule vation rules, © Build a tru applying derivat roof sequence by appl © Generatea pr Hrouedge ePeetentation & Artifical Inaigence: Ml, DL IMA. Sem) sermiten Se Aritcalinigonce MILPLIMEA Semi _____ropesional gic Inference rules are used to generate new premises using the existing ones, ‘Table 2.4: Inference Rules eves esa 98 uth ae rows exponent Rute inference Tautology | Example i doer esto generate a proof sequence é Rule Let P:Itis snowing wwe can use dervavon quence of wis in which each Wt is eiter a pre twit study math + Prasf of seauenee: J ont formal system's devivaiton rile \o existing wits, R: Iwill get A grade at of applying one of the formal sy ‘Modus ponens [PF APIO [PaO “Ut itis snowing Wen es is valid as the proof shows: wall study mathe ample, conelusi. P29 Sumeeeteter re oa P:Itis Snowing fe 1Sai = prem Hil study math ae premise Modus tollens |= CEA a> [PQ ein itis snowing ThenT ee a ENO F PRGA sg anette piel Em -0:"I will not study maths® 5. -b derived from 4 and 3 (modus tollens) zt “Itis not snowing” & {Vs derived from2 [ Conjunctions | F (PAM >EA@ | Pitwil study mane 2. (tVsiom_ premise 9 1 il study hind & om derived from 6 and 7 (modus ponens) ‘ “FAQ Uwe suds mish und bina Se at aed nae eas Simplification [Pag @A@=>p PAQ: It is snowing and | am Tf =P studying math 10. (eaA-b)-9j premise 2: Tis snowing ) nj from 10 and 9 (modus ponens) Peete ; valid argu ld be provable and e + Informa ogy oly the valid argument should be “envi [Hypothetical | Pq (@>O A> | Pog: “Itt snows hen TT argument should be provable to make it manageable. Sylogiset wo ee ea + Derivation rule are equivalence and inference rules. rary QuR: “ICT study math then 1 + Equivalence rules are certain pair of wff that is equivalent. Sige gre’ Table 2.3: Equivalence Rules ESM snows, 1 val get A rade. NameofRule_| Expression | Equivalent to Disjunctive | PVQ (®V@ACPIHQ_[PVQ at is snowing oF Twin AAB BAA Syllogism |p study math Commutative 7 Fra q “Pr Itis not snowing | ame BNA ©. will study math AB AC |AABAO ‘Addition p PoeV@ Wis snowing or will tudy [aso maveaIvaTS maths Ea CMAN Y Contraposition | ~ p= P5Q>0Q5-h «vey [war nD De Morgans law =9ac Qo SPS e (AABy ave 3 no (25F> P39) Implication ASB AVB Selfreference | Py P P Double negation | A ay - p PVP Distributed |PA(@VR) | @Agy Equivalence [AaB (9B) A 5) (PAR) 26 2a7

You might also like