CSC 480 Artificial Intelligence Dr Franz J Kurfess






































![Examples of Objects, Relations u “The smelly wumpus occupies square [1, 3]” u objects: Examples of Objects, Relations u “The smelly wumpus occupies square [1, 3]” u objects:](https://slidetodoc.com/presentation_image_h/0ea6d08ed08213d084c36fae94af0760/image-39.jpg)




































- Slides: 75
CSC 480: Artificial Intelligence Dr. Franz J. Kurfess Computer Science Department Cal Poly © 2000 -2008 Franz Kurfess Logic 1
Course Overview u Introduction u Intelligent Agents u Search u u problem solving through search informed search u Games u games as search problems u Knowledge u u and Reasoning reasoning agents propositional logic predicate logic knowledge-based systems u Learning u u learning from observation neural networks u Conclusions © 2000 -2008 Franz Kurfess Logic 2
Chapter Overview Logic u Motivation u u u Objectives u Propositional u u u u Predicate Logic Principles u Logic syntax semantics validity and inference models inference rules complexity imitations Wumpus agents © 2000 -2008 Franz Kurfess u u u Syntax Semantics Extensions and Variations Usage u Logic and the Wumpus World u u objects relations properties reflex agent change Important Concepts and Terms Chapter Summary Logic 3
Logistics u Midterm Exam © 2000 -2008 Franz Kurfess Logic 4
Motivation u formal methods to perform reasoning are required when dealing with knowledge u propositional logic is a simple mechanism for basic reasoning tasks u it allows the description of the world via sentences v v simple sentences can be combined into more complex ones new sentences can be generated by inference rules applied to existing sentences u predicate logic is more powerful, but also considerably more complex u u it is very general, and can be used to model or emulate many other methods although of high computational complexity, there is a subclass that can be treated by computers reasonably well © 2000 -2008 Franz Kurfess Logic 7
Objectives u know the important aspects of propositional and predicate logic u syntax, semantics, models, inference rules, complexity u understand the limitations of propositional and predicate logic u apply simple reasoning techniques to specific tasks u learn about the basic principles of predicate logic u apply predicate logic to the specification of knowledge-based systems and agents u use inference rules to deduce new knowledge from existing knowledge bases © 2000 -2008 Franz Kurfess Logic 8
Logical Inference u also referred to as deduction u implements the entailment relation for sentences u validity ua sentence is valid if it is true under all possible interpretations in all possible world states independent of its intended or assigned meaning v independent of the state of affairs in the world under consideration v valid sentences are also called tautologies v u satisfiability ua sentence is satisfiable if there is some interpretation in some world state (a model) such that the sentence is true a sentence is satisfiable iff its negation is not valid v a sentence is valid iff its negation is not satisfiable v © 2000 -2008 Franz Kurfess Logic 10
Computational Inference u computers cannot reason informally (“common sense”) u they don’t know the interpretation of the sentences u they usually don’t have access to the state of the real world to check the correspondence between sentences and facts u computers can be used to check the validity of sentences u “if the sentences in a knowledge base are true, then the sentence under consideration must be true, regardless of its possible interpretations” u can be applied to rather complex sentences © 2000 -2008 Franz Kurfess Logic 11
Computational Approaches to Inference u model checking based on truth tables u generate all possible models and check them for validity or satisfiability u exponential complexity, NP-complete v all combinations of truth values need to be considered u search u use inference rules as successor functions for a search algorithm u also exponential, but only worst-case in practice, many problems have shorter proofs v only relevant propositions need to be considered v © 2000 -2008 Franz Kurfess Logic 12
Propositional Logic ua relatively simple framework for reasoning u can be extended for more expressiveness at the cost of computational overhead u important aspects u syntax u semantics u validity and inference u models u inference rules u complexity © 2000 -2008 Franz Kurfess Logic 13
Syntax u symbols u u u logical constants True, False propositional symbols P, Q, … logical connectives v v v u u conjunction , disjunction , negation , implication , equivalence parentheses , sentences u u constructed from simple sentences conjunction, disjunction, implication, equivalence, negation © 2000 -2008 Franz Kurfess Logic 14
BNF Grammar Propositional Logic Sentence Atomic. Sentence | Complex. Sentence Atomic. Sentence True | False | P | Q | R |. . . Complex. Sentence (Sentence ) | Sentence Connective Sentence | Sentence Connective | | | ambiguities are resolved through precedence or parentheses e. g. P Q R S is equivalent to ( P) (Q R)) S © 2000 -2008 Franz Kurfess Logic 15
Semantics u interpretation of the propositional symbols and constants u symbols u can stand for any arbitrary fact sentences consisting of only a propositional symbols are satisfiable, but not valid u u u the value of the symbol can be True or False must be explicitly stated in the model constants True and False have a fixed interpretation u True indicates that the world is as stated u False indicates that the world is not as stated u specification u frequently of the logical connectives explicitly via truth tables © 2000 -2008 Franz Kurfess Logic 16
Truth Tables for Connectives P Q False True P P Q P Q True False © 2000 -2008 Franz Kurfess False True True False True Logic 17
Validity and Inference u truth tables can be used to test sentences for validity u one row for each possible combination of truth values for the symbols in the sentence u the final value must be True for every sentence u a variation of the model checking approach u not very practical for large sentences u sometimes used with customized improvements in specific domains, such as VLSI design © 2000 -2008 Franz Kurfess Logic 18
Validity Example u known u u facts about the Wumpus World there is a wumpus in [1, 3] or in [2, 2] there is no wumpus in [2, 2] u question u (hypothesis) is there a wumpus in [1, 3] u task u prove or disprove the validity of the question u approach u construct a sentence that combines the above statements in an appropriate manner v u so that it answers the questions construct a truth table that shows if the sentence is valid v incremental approach with truth tables for sub-sentences © 2000 -2008 Franz Kurfess Logic 19
Validity Example P Q False True False True W 13 False True W 22 False True W 13 W 22 False True Interpretation: W 13 Wumpus in [1, 3] W 22 Wumpus in [2, 2] Facts: • there is a wumpus in [1, 3] or in [2, 2] © 2000 -2008 Franz Kurfess Logic 20
Validity Example P Q False True False True W 13 W 22 False True W 22 True False Interpretation: W 13 Wumpus in [1, 3] W 22 Wumpus in [2, 2] Facts: • there is a wumpus in [1, 3] or in [2, 2] • there is no wumpus in [2, 2] © 2000 -2008 Franz Kurfess Logic 21
Validity Example W 13 W 22 False True P Q False True True False True W 22 True False (W 13 W 22 ) W 22 False True False W 13 False True Question: • can we conclude that the wumpus is in [1, 3]? © 2000 -2008 Franz Kurfess Logic 22
Validity Example W 13 W 22 False True W 22 True False (W 13 W 22 ) W 22 Valid Sentence: For all possible combinations, the value of the sentence is true. False True False W 13 False True ((W 13 W 22 ) W 13 True © 2000 -2008 Franz Kurfess Logic 23
Validity and Computers u the computer has no access to the real world, and can’t check the truth value of individual sentences (facts) u humans often can do that, which greatly decreases the complexity of reasoning u humans also have experience in considering only important aspects, neglecting others u if a conclusion can be drawn from premises, independent of their truth values, then the sentence is valid u usually too tedious for humans u may exclude potentially interesting sentences v some, but not all interpretations are true © 2000 -2008 Franz Kurfess Logic 24
Models u if there is an interpretation for a sentence such that the sentence is true in a particular world, that world is called a model u refers u models to specific interpretations can also be thought of as mathematical objects u these mathematical models can be viewed as equivalence classes for worlds that have the truth values indicated by the mapping under that interpretation u a model then is a mapping from proposition symbols to True or False © 2000 -2008 Franz Kurfess Logic 25
Models and Entailment sentence is entailed by a knowledge base KB if the models of the knowledge base KB are also models of the sentence ua KB |= © 2000 -2008 Franz Kurfess Logic 26
Inference and Derivation u inference rules allow the construction of new sentences from existing sentences u notation: a sentence can be derived from |- or u an inference procedure generates new sentences on the basis of inference rules u if all the new sentences are entailed, the inference procedure is called sound or truth-preserving © 2000 -2008 Franz Kurfess Logic 27
Inference Rules u modus v ponens from an implication and its premise one can infer the conclusion u and-elimination v from a conjunct, one can infer any of the conjuncts u and-introduction v from a list of sentences, one can infer their conjunction u or-introduction v from a sentence, one can infer its disjunction with anything else © 2000 -2008 Franz Kurfess , 1 2 . . . n i 1, 2, … , n 1 2 . . . n i 1 2 . . . n Logic 28
Inference Rules u double-negation elimination v a double negations infers the positive sentence u unit v resolution if one of the disjuncts in a disjunction is false, then the other one must be true u resolution cannot be true and false, so one of the other disjuncts must be true v can also be restated as “implication is transitive” v © 2000 -2008 Franz Kurfess , Logic 29
Complexity u the truth-table method to inference is complete u enumerate the 2 n rows of a table involving n symbols u computation time is exponential u satisfiability for a set of sentences is NP-complete u so most likely there is no polynomial-time algorithm u in many practical cases, proofs can be found with moderate effort u there is a class of sentences with polynomial inference procedures (Horn sentences or Horn clauses) P 1 P 2 . . . Pn Q © 2000 -2008 Franz Kurfess Logic 30
Wumpus Logic u an agent can use propositional logic to reason about the Wumpus world u knowledge base contains percepts v rules v S 1, 1 S 2, 1 S 1, 2 B 1, 1 B 2, 1 B 1, 2 R 1: S 1, 1 R 2: S 2, 1 R 3: S 1, 2 R 4: S 1, 2 W 1, 1 W 1, 2 W 2, 1 W 1, 1 W 2, 2 W 3, 1 W 1, 2 W 2, 2 W 1, 3 W 1, 1 W 1, 2 W 2, 2 W 1, 3 . . . © 2000 -2008 Franz Kurfess Logic 31
Finding the Wumpus u two options u construct v rather tedious u use v truth table to show that W 1, 3 is a valid sentence inference rules apply some inference rules to sentences already in the knowledge base © 2000 -2008 Franz Kurfess Logic 32
Action in the Wumpus World u additional rules are required to determine actions for the agent RM: A 1, 1 East. A W 2, 1 Forward. A RM + 1: . . . u the agent also needs to Ask the knowledge base what to do u must v ask specific questions Can I go forward? u general questions are not possible in propositional logic v Where should © 2000 -2008 Franz Kurfess I go? Logic 33
Propositional Wumpus Agent u the size of the knowledge base even for a small wumpus world becomes immense u explicit statements about the state of each square u additional statements for actions, time u easily reaches thousands of sentences u completely unmanageable for humans u efficient methods exist for computers u optimized variants of search algorithms u sequential circuits combinations of gates and registers v more efficient treatment of time v effectively a reflex agent with state v can be implemented in hardware v © 2000 -2008 Franz Kurfess Logic 34
Exercise: Wumpus World in Propositional Logic u express important knowledge about the Wumpus world through sentences in propositional logic format u u u status of the environment percepts of the agent in a specific situation new insights obtained by reasoning v v u u decisions made by the agent actions performed by the agent v u changes in the environment as a consequence of the actions background v u rules for the derivation of new sentences general properties of the Wumpus world learning from experience v general properties of the Wumpus world © 2000 -2008 Franz Kurfess Logic 35
Limitations of Propositional Logic u number of propositions u since everything has to be spelled out explicitly, the number of rules is immense u dealing with change (monotonicity) u even in very simple worlds, there is change u the agent’s position changes u time-dependent propositions and rules can be used v even more propositions and rules u propositional logic has only one representational device, the proposition u difficult to represent objects and relations, properties, functions, variables, . . . © 2000 -2008 Franz Kurfess Logic 36
Bridge-In to Predicate Logic u limitations of propositional logic in the Wumpus World u enumeration of statements u change u proposition u usefulness as representational device of objects and relations between them u properties u internal structure u arbitrary relations u functions © 2000 -2008 Franz Kurfess Logic 38
Knowledge Representation and Commitments u ontological u describes commitment the basic entities that are used to describe the world v e. g. facts in propositional logic u epistemological u describes v commitment how an agent expresses its believes about facts e. g. true, false, unknown in propositional logic © 2000 -2008 Franz Kurfess Logic 40
Formal Languages and Commitments Language Ontological Commitment Epistemological Commitment Propositional Logic facts true, false, unknown First-order Logic facts, objects, relations true, false, unknown Temporal Logic facts, objects, relations, times true, false, unknown Probability Theory facts degree of belief [0, 1] Fuzzy Logic facts with degree of truth [0, 1] known interval value © 2000 -2008 Franz Kurfess Logic 41
Commitments in FOL u ontological commitments u facts v same as in propositional logic u objects v corresponds to entities in the real world (physical objects, concepts) u relations v connects objects to each other u epistemological u true, v commitments false, unknown same as in propositional logic © 2000 -2008 Franz Kurfess Logic 42
Predicate Logic u new concepts u complex v objects terms u relations predicates v quantifiers v u syntax u semantics u inference rules u usage © 2000 -2008 Franz Kurfess Logic 43
Examples of Objects, Relations u “The smelly wumpus occupies square [1, 3]” u objects: wumpus, square 1, 3 u property: smelly u relation: occupies u “Two plus two equals four” u objects: two, four u relation: equals u function: plus © 2000 -2008 Franz Kurfess Logic 44
Objects u distinguishable things in the real world u e. g. people, cars, computers, programs, . . . u the set of objects determines the domain of a model u frequently includes concepts u colors, stories, light, money, love, . . . u in contrast to physical objects u properties u describe v specific aspects of objects green, round, heavy, visible, u can be used to distinguish between objects © 2000 -2008 Franz Kurfess Logic 45
Relations u establish u unary relations refer to a single object v v u e. g. mother-of(John), brother-of(Jill), spouse-of(Joe) often called functions binary relations relate two objects to each other v u e. g. twins(John, Jill), married(Joe, Jane) n-ary relations relate n objects to each other v e. g. triplets(Jim, Tim, Wim), seven-dwarfs(D 1, . . . , D 7) u relations u u can be defined by the designer or user neighbor, successor, next to, taller than, younger than, … u functions u connections between objects are a special type of relation non-ambiguous: only one output for a given input often distinguished from similar binary relations by appending -of v e. g. brothers(John, Jim) vs. brother-of(John) © 2000 -2008 Franz Kurfess Logic 46
Syntax u based on sentences u more v complex than propositional logic constants, predicates, terms, quantifiers u constant symbols A, B, C, Franz, Square 1, 3, … u stand for unique objects ( in a specific context) u predicate symbols Adjacent-To, Younger-Than, . . . u describes relations between objects u function symbols Father-Of, Square-Position, … u the given object is related to exactly one other object © 2000 -2008 Franz Kurfess Logic 47
Semantics u relates u sentences to models in order to determine their truth values u provided u by interpretations for the basic constructs usually suggested by meaningful names (intended interpretations) u constants u the interpretation identifies the object in the real world u predicate u u the interpretation specifies the particular relation in a model may be explicitly defined through the set of tuples of objects that satisfy the relation u function u u symbols identifies the object referred to by a tuple of objects may be defined implicitly through other functions, or explicitly through tables © 2000 -2008 Franz Kurfess Logic 48
BNF Grammar Predicate Logic Sentence Atomic. Sentence | (Sentence Connective Sentence) | Quantifier Variable, . . . Sentence | Sentence Atomic. Sentence Predicate(Term, …) | Term = Term Function(Term, …) | Constant | Variable Connective | | | Quantifier | Constant A, B, C, X 1 , X 2, Jim, Jack Variable a, b, c, x 1 , x 2, counter, position Predicate Adjacent-To, Younger-Than, Function Father-Of, Square-Position, Sqrt, Cosine ambiguities are resolved through precedence or parentheses © 2000 -2008 Franz Kurfess Logic 49
Terms u logical expressions that specify objects u constants and variables are terms u more complex terms are constructed from function symbols and simpler terms, enclosed in parentheses u basically a complicated name of an object u semantics is constructed from the basic components, and the definition of the functions involved u either through explicit descriptions (e. g. table), or via other functions © 2000 -2008 Franz Kurfess Logic 50
Atomic Sentences u state facts about objects and their relations u specified through predicates and terms u the predicate identifies the relation, the terms identify the objects that have the relation u an atomic sentence is true if the relation between the objects holds u this can be verified by looking it up in the set of tuples that define the relation © 2000 -2008 Franz Kurfess Logic 51
Examples Atomic Sentences u u u Father(Jack, John), Mother(Jill, John), Sister(Jane, John) Parents(Jack, Jill, John, Jane) Married(Jack, Jill) Married(Father-Of(John), Mother-Of(John)) Married(Father-Of(John), Mother-Of(Jane)) Married(Parents(Jack, Jill, John, Jane)) © 2000 -2008 Franz Kurfess Logic 52
Complex Sentences u logical connectives can be used to build more complex sentences u semantics is specified as in propositional logic © 2000 -2008 Franz Kurfess Logic 53
Examples Complex Sentences u u u Father(Jack, John) Mother(Jill, John) Sister(Jane, John) Sister(John, Jane) Parents(Jack, Jill, John, Jane) Married(Jack, Jill) Older-Than(Jane, John) Older-Than(John, Jane) Older(Father-Of(John), 30) Older (Mother-Of(John), 20) Attention: Some sentences may look like tautologies, but only because we “automatically” assume the meaning of the name as the only interpretation (parasitic interpretation) © 2000 -2008 Franz Kurfess Logic 54
Quantifiers u can be used to express properties of collections of objects u eliminates u predicate the need to explicitly enumerate all objects logic uses two quantifiers quantifier u existential quantifier u universal © 2000 -2008 Franz Kurfess Logic 55
Universal Quantification u states that a predicate P is holds for all objects x in the universe under discourse x P(x) u the sentence is true if and only if all the individual sentences where the variable x is replaced by the individual objects it can stand for are true © 2000 -2008 Franz Kurfess Logic 56
Example Universal Quantification u assume that x denotes the squares in the wumpus world x Is-Empty(x) Contains-Agent(x) Contains-Wumpus(x) is true if and only if all of the following sentences are true: Is-empty(S 11) Contains-Agent(S 11) Contains-Wumpus(S 11) Is-empty(S 12) Contains-Agent(S 12) Contains-Wumpus(S 12) Is-empty(S 13) Contains-Agent(S 13) Contains-Wumpus(S 13). . . Is-empty(S 21) Contains-Agent(S 21) Contains-Wumpus(S 21). . . Is-empty(S 44) Contains-Agent(S 44) Contains-Wumpus(S 44) u beware the implicit (parasitic) interpretation fallacy! © 2000 -2008 Franz Kurfess Logic 57
Usage of Universal Qualification u universal quantification is frequently used to make statements like “All humans are mortal”, “All cats are mammals”, “All birds can fly”, … u this can be expressed through sentences like x Human(x) Mortal(x) x Cat(x) Mammal(x) x Bird(x) Can-Fly(x) u these sentences are equivalent to the explicit sentence about individuals Human(John) Mortal(John) Human(Jane) Mortal(Jane) Human(Jill) Mortal(Jill) . . . © 2000 -2008 Franz Kurfess Logic 58
Existential Quantification u states that a predicate P holds for some objects in the universe x P(x) u the sentence is true if and only if there is at least one true individual sentence where the variable x is replaced by the individual objects it can stand for © 2000 -2008 Franz Kurfess Logic 59
Example Existential Quantification u assume that x denotes the squares in the wumpus world x Glitter(x) is true if and only if at least one of the following sentences is true: Glitter(S 11) Glitter(S 12) Glitter(S 13). . . Glitter(S 21). . . Glitter(S 44) © 2000 -2008 Franz Kurfess Logic 60
Usage of Existential Qualification u existential quantification is used to make statements like “Some humans are computer scientists”, “John has a sister who is a computer scientist” “Some birds can’t fly”, … u this can be expressed through sentences like x Human(x) Computer-Scientist(x) x Sister(x, John) Computer-Scientist(x) x Bird(x) Can-Fly(x) u these sentences are equivalent to the explicit sentence about individuals Human(John) Computer-Scientist(John) Human(Jane) Computer-Scientist(Jane) Human(Jill) Computer-Scientist(Jill) . . . © 2000 -2008 Franz Kurfess Logic 61
Multiple Quantifiers u more complex sentences can be formulated by multiple variables and by nesting quantifiers u the order of quantification is important u variables must be introduced by quantifiers, and belong to the innermost quantifier that mention them u examples x, y Parent(x, y) Child(y, x) x Human(x) y Mother(y, x) x Human(x) y Loves(x, y) x Human(x) y Loves(y, x) © 2000 -2008 Franz Kurfess Logic 62
Connections between and u all statements made with one quantifier can be converted into equivalent statements with the other quantifier by using negation u u u is a conjunction over all objects under discourse is a disjunction over all objects under discourse De Morgan’s rules apply to quantified sentences x P(x) u strictly x P(x) speaking, only one quantifier is necessary u using both is more convenient © 2000 -2008 Franz Kurfess Logic 63
Equality u equality indicates that two terms refer to the same object u the equality symbol “=“ is an (in-fix) shorthand u e. g. Father(Jane) = Jim u equality by reference and equality by value sometimes the distinction between referring to the same object and referring to two objects that are identical (indistinguishable) can be important v e. g. Jim is Jane’s and John’s father v e. g. the individual sheets of paper in a ream v © 2000 -2008 Franz Kurfess Logic 64
Domains ua section of the world we want to reason about u assertion u u a sentence added to the knowledge about the domain often uses the Tell construct v u e. g. Tell (KB-Fam, (Father(John) = Jim)) sometimes Assert, Retract and Modify construct are used to make, withdraw and modify statements u axiom u u a statement with basic, factual, undisputed information about the domain often used as definitions to specify predicates in terms of already defined predicates u theorem u u statement entailed by the axioms it follows logically from the axioms © 2000 -2008 Franz Kurfess Logic 65
Example: Family Relationships u objects: people u properties: gender, … v expressed as unary predicates Male(x), Female(y) u relations: v parenthood, brotherhood, marriage expressed through binary predicates Parent(x, y), Brother(x, y), … u functions: motherhood, fatherhood Mother(x), Father(y) v because every person has exactly one mother and one father v there may also be a relation Mother-of(x, y), Father-of(x, y) v © 2000 -2008 Franz Kurfess Logic 66
Family Relationships m, c Mother(c) = m w, h Husband(h, w) x Male(x) g, c Grandparent(g, c) x, y Sibling(x, y) Female(m) Parent(m, c) Male(h) Spouse(h, w) Female(x) p Parent(g, p) Parent(p, c) (x=y) p Parent(p, x) Parent(p, y) . . . © 2000 -2008 Franz Kurfess Logic 67
Logic and the Wumpus World u representation u suitability of logic to represent the critical aspects of the Wumpus World in a suitable way u reflex agent u specification of a reflex agent for the Wumpus World u change u dealing with aspects of the Wumpus World that change over time u model-based u specification © 2000 -2008 Franz Kurfess agent using logic Logic 70
Wumpus World Representation u interface between the agent and the environment u percepts v must include time to distinguish percepts Percept([Stench, Breeze, Glitter, None], 5) u actions Turn(Right), Turn(Left), Forward, Shoot, Grab, Climb u queries v ask for a possible action at a given time a, t Action(a, t) © 2000 -2008 Franz Kurfess Logic 71
Reflex Agent in the Wumpus World u rules that directly connect percepts to actions b, g, u, c, t u Percept([s, b, Glitter, u, c], t) Action(Grab, t) requires many rules for different combinations of percepts at different times u can be simplified by intermediate predicates s, b, g, u, c, t Percept([Stench, b, g, u, c], t) Stench(t) s, b, g, u, c, t Percept([s, Breeze, g, u, c], t) Breeze(t) s, b, g, u, c, t Percept([s, b, Glitter, u, c], t) At. Gold(t) s, b, g, u, c, t Percept([s, b, g, Bump, c], t) Bump(t) s, b, g, u, c, t Percept([s, b, g, u, Scream], t) Scream(t) t At. Gold(t) Action(Grab, t). . . u u mainly abstraction over time is it still a reflex agent? © 2000 -2008 Franz Kurfess Logic 72
Limitations of Reflex Agents u the agent doesn’t know its state u it doesn’t know when to perform the climb action because it doesn’t know if it has the gold, nor where the agent is u the agent may get into infinite loops because it will have to perform the same action for the same percepts © 2000 -2008 Franz Kurfess Logic 73
Change in the Wumpus World u in principle, the percept history contains all the relevant knowledge for the agent u by writing rules that can access past percepts, the agent can take into account previous information u this is sufficient for optimal action under given circumstances u may be very tedious, involving many rules u it is usually better to keep a set of sentences about the current state of the world u must be updated for every percept and every action © 2000 -2008 Franz Kurfess Logic 74
Agent Movement u it is also helpful to provide constructs that help the agent keep track of its location, and how it can move u essentially constructs a simple map for the agent u current location of the agent At(Agent, [1, 1], S 0) uses a Situation parameter S 0 to keep track of changes independent of specific time points u orientation of the agent Orientation(Agent, S 0) u arrangement x, y of locations, i. e. a map Location. Toward([x, y], 0) = [x+1, y] Location. Toward([x, y], 90) = [x, y+1] . . . © 2000 -2008 Franz Kurfess Logic 75
Model-Based Agent u such u u an agent knows about locations through its map it can associate properties with the locations this can be used to reason about safe places, the presence of gold, pits, the wumpus, etc. l, s At(Agent, l, s) Breeze(s) Breezy(l). . . l 1, l 2, s. . . At(Wumpus, l 1, s) Adjacent(l 1, l 2) Smelly(l 2) l 1, l 2 , s Smelly(l 1) ( l 2 At(Wumpus, l 2, s) (l 1 = l 2) (Adjacent(l 1, l 2)). . . l 1, l 2 , x, t u u At(Wumpus, x, t) (l 1 = l 2) Pit(x) ) OK(x) such an agent will find the gold provided there is a safe sequence returning to the exit with the gold is difficult © 2000 -2008 Franz Kurfess Logic 76
Goal-Based Agent u once exit the agent has the gold, it needs to return to the s Holding(Gold, s) Goal. Location([1, 1], s) u the agent can calculate a sequence of actions that will take it safely there u through inference computationally rather expensive for larger worlds v difficult to distinguish good and bad solutions v u through v e. g. via the best-first search method u through v search planning requires a special-purpose reasoning system © 2000 -2008 Franz Kurfess Logic 77
Utility-Based Agent u can distinguish between more and less desirable states u different v goals, pits, . . . pots with different amounts of gold u optimization of the route back to the exit u performance measure for the agent u requires the ability to deal with numbers in the knowledge representation scheme v possible in predicate logic, but tedious © 2000 -2008 Franz Kurfess Logic 78
Evaluation u Criteria © 2000 -2008 Franz Kurfess Logic 80
Important Concepts and Terms u u u u u u agent and atomic sentence automated reasoning completeness conjunction constant disjunction domain existential quantifier fact false function implication inference mechanism inference rule interpretation knowledge representation logic model object or © 2000 -2008 Franz Kurfess u u u u u u predicate logic property propositional logic propositional symbol quantifier query rational agent reflex agent relation resolution satisfiable sentence semantics sentence soundness syntax term true universal quantifier valid sentence variable Logic 81
Chapter Summary u logic can be used as the basis of formal knowledge representation and processing u u syntax specifies the rules for constructing sentences semantics establishes a relation between the sentences and their counterparts in the real world simple sentences can be combined into more complex ones new knowledge can be generated through inference rules from existing sentences u propositional logic encodes knowledge about the world in simple sentences or formulae u predicate logic is a formal language with constructs for the specifications of objects and their relations u models of reasonably complex worlds and agents can be constructed with predicate logic © 2000 -2008 Franz Kurfess Logic 82
© 2000 -2008 Franz Kurfess Logic 83











































































