Presentation on theme: "Knowledge Representation CPSC 386 Artificial Intelligence Ellen Walker Hiram College."— Presentation transcript:
Knowledge Representation CPSC 386 Artificial Intelligence Ellen Walker Hiram College
What we know… Knowledge can be represented using first- order predicate logic Several inference algorithms are useful –Forward Chaining –Backward Chaining –Resolution –(All use unification)
What we’ve ignored so far Objects in the world tend to be related to each other –Classes, superclasses & subclasses –Part / whole hierarchies –Properties are inherited across relationships The state of the world can change over time –Explicit representation of time –Frame axiom –Non-monotonic reasoning We must reason without complete knowledge Closed world assumption Not all knowledge is “black & white” (Ch 11) –Uncertainty –Statistics, fuzzy logic
Classes “I want to buy a basketball” –I want to buy BB27341 (NO) –I want to buy an object that is a member of the basketball class (YES) Objects organized into a hierarchy by class –BB27341 basketballs –Basketballs balls Facts (objects) & rules (classes) –All balls are round. –All basketballs are in diameter. –BB27341 is red, white and blue. –BB27341 is a basketball. –(Therefore BB27341 is round and in diameter).
Inheritance If a property is true of a class, it is true of all subclasses of that class If a property is true of a class, it is true of all objects that are members of that class (If a property is true of a class, it is true of all objects that are members of subclasses of that class) There are exceptions (to be dealt with later…)
Part / Whole Inheritance A cow has 4 legs –Each leg is part of the cow The cow is in the field. –All of the cow’s parts are also in the field The cow is (entirely) brown –All of the cow’s parts are brown The cow is happy –All of the cow’s parts are happy (?) Lesson: some properties are inherited by parts, others are not. This is generally made explicit by rules, such as –part-of(x,y) and location(y,z) -> location(x,z)
Stuff vs. things Some objects are “stuff” –When you divide the object, its parts are still the same: e.g. butter, snow –“stuff” cannot be referred to with “a” or “an” “Please pass a butter” (?) Other objects are “things” –When you divide them, you destroy them, e.g. aardvark, snowflake “A snowflake landed on my nose” vs. “A snow landed on my nose”
Situations and Events A state of the world is a “situation” Divide predicates into “eternal” and “fluent” –At(x,y,S) is fluent - S is the situation where it holds –Gold(g) is eternal - it is true in all situations Each action causes a result –Result(move-to(x,y),S i ) = At(x,y, S i+1 )
The Frame Problem What about everything else? –Result(move-to(x,y), S i ) = At(x,y, S i+1 ) and – z, z≠x at(z,w, S i) at(z,w, S i+1 ) This is a frame axiom Representing all frame axioms explicitly is a pain Instead: assume it’s the same if we’re not told it’s different –Fluent is true in new situation iff last action made it true, or if it was true in the previous situation Real world example: what color is Obie’s hair? –We assume it hasn’t changed, but maybe she colored it today!
Semantic Networks Semantic networks are essentially a generalization of inheritance hierarchies Each node is an object or class Each link is a relationship –IS-A (the usual subclass or element relationship) –HAS-PART or PART-OF –Any other relationship that makes sense in context Note: semantic networks predated OOP Inheritance: follow one member-of link, as many subclass or other links as necessary. Example: “Mary had a little lamb” (see board)
Algorithm for Inheritance If the current object has a value for the property, return that value Otherwise, if the current object is a member of a class, return the value of the property of the class (recursively) Otherwise, if the current object is a subclass, return the value of the property of the superclass (recursively) This is depth-first search; stop at the first one found.
Defaults and Exceptions Exception for a single object: –Set a property of the object to the (exception) value Default for a class –Set a property of the class to the (default) value –If there are multiple default values, the one “closest” to the object wins.
Default & Exception example All birds can fly. Birds with broken wings are birds, but cannot fly. Penguins are birds, but they cannot fly. Magical penguins are penguins that can fly. Who can fly? –Tweety is a bird. –Peter is a penguin. –Penelope is a magical penguin. Note that beliefs can be changed as new information comes in that changes the classification of an object.
Two Useful Assumptions Closed World Assumption –Anything that I don’t know is true, I will assume to be false –(Negation as failure in Prolog) Unique Names Assumption –Unique names refer to different objects –“Chris and the programmer …” implies Chris isn’t the programmer –Again, Prolog implements this assumption.
NonMonotonic Logic Once true (or false) does not mean always true (or false) As information arrives, truth values can change (Penelope is a bird, penguin, magic penguin) Implementations (you are not responsible for details) –Circumscription Bird(x) and not abnormal(x) -> flies(x) We can assume not abnormal(x) unless we know abnormal(x) –Default logic “x is true given x does not conflict with anything we already know”
Truth Maintenance Systems These systems allow truth values to be changed during reasoning (belief revision) When we retract a fact, we must also retract any other fact that was derived from it –Penelope is a bird.(can fly) –Penelope is a penguin.(cannot fly) –Penelope is magical.(can fly) –Retract (Penelope is magical).(cannot fly) –Retract (Penelope is a penguin).(can fly)
Types of TMS Justification based TMS –For each fact, track its justification (facts and rules from which it was derived) –When a fact is retracted, retract all facts that have justifications leading back to that fact, unless they have independent justifications. –Each sentece labeled IN or OUT Assumption based TMS –Represent all possible states simultaneously –When a fact is retracted, change state sets –For each fact, use list of assumptions that make that fact true; each world state is a set of assumptions.