KM: The Knowledge Machine A knowledge representation and reasoning system

47
KM: The Knowledge Machine A knowledge representation and reasoning system Peter Clark Knowledge Systems Boeing Math and Computing Technology

description

KM: The Knowledge Machine A knowledge representation and reasoning system. Peter Clark Knowledge Systems Boeing Math and Computing Technology. Characteristics of KM. Inference-capable Expressive Intuitive to express knowledge in: ideosyncratic syntax - PowerPoint PPT Presentation

Transcript of KM: The Knowledge Machine A knowledge representation and reasoning system

Page 1: KM: The Knowledge Machine A knowledge representation and reasoning system

KM: The Knowledge MachineA knowledge representation and reasoning system

Peter ClarkKnowledge Systems

Boeing Math and Computing Technology

Page 2: KM: The Knowledge Machine A knowledge representation and reasoning system

Characteristics of KM• Inference-capable• Expressive• Intuitive to express knowledge in:

– ideosyncratic syntax– but very similar to other frame languages (esp KRL)– substantially more than a “simple” frame system

• Formal semantics• Deals with value sets and unification• Lazy evaluation• Reasoning with situations• Mature• Free• Reasoning: backward chaining, plus automatic classification

Page 3: KM: The Knowledge Machine A knowledge representation and reasoning system

Preview

(Buy has (superclasses (Event)))

(every Buy has (buyer ((a Agent))) (seller ((a Agent))) (object ((a Thing))) (money ((the cost of (the object of Self)))) (subevent ( (a Give with (agent ((the buyer of Self))) (object ((the money of Self))) (recipient ((the seller of Self)))))) (a Give with (agent ((the seller of Self))) (object ((the object of Self))) (recipient ((the buyer of Self)))))))

"All buy events have - a buyer and a seller

(both of type agent) - an object which is bought - some money equal to the

cost of the object - two `give' subevents, in which: 1. The buyer gives the money

to the seller 2. The seller gives the object

to the buyer.''

• An example of a frame in KM, for the “Buy” classEnglish KM

Page 4: KM: The Knowledge Machine A knowledge representation and reasoning system

KIF syntax for same knowledge:

Page 5: KM: The Knowledge Machine A knowledge representation and reasoning system

This Tutorial• Overview of the KM language and inference

– based on a detailed script of using KM– the examples are “toy”

• Not a tutorial in how to do knowledge representation!• KM Manuals give the full reference*

– details of the syntax– logical semantics for the expressions

• Tutorial works best if you ask lots of questions!!

* http://www.cs.utexas.edu/users/mfkb/km.html

Page 6: KM: The Knowledge Machine A knowledge representation and reasoning system

Interaction with KM• Interaction with KM: read-eval-print

– User gives KM an expression (assertion/query)– KM evaluates it and returns the result

USER: (km)KM> (reset-kb)Resetting KM...(t)

KM> 123(123)

Page 7: KM: The Knowledge Machine A knowledge representation and reasoning system

Instances• Two key types of objects: instances, and classes

– an instance denotes some object in the world– a class is a collection of instances*

• An instance (individual) evaluates to itself

;;; --- instances ---

;;; "Fred"KM> *Fred ; (* has no special meaning, is just a (*Fred) ; convenient character to visually distinguish ; from classes);;; "1"KM> 1(1)

*: or more precisely, has a collection of instances associated with it (the classes extension)

Page 8: KM: The Knowledge Machine A knowledge representation and reasoning system

“Creating instances”(existential quantification)

• We can “create” (assert the existence of) an instance of a particular class by the expression

• (a <class>)

;;; "A cat."KM> (a Cat)(_Cat0) ; _Cat0 is a Skolem individual denoting that cat

;;; “A black cat.”KM> (a Cat with

(color (*Black)) (parts ((a Head) (a Tail)))

Page 9: KM: The Knowledge Machine A knowledge representation and reasoning system

Slots• Slots relate instances together• Slots are themselves frames

– can specify properties of the slot on these frames

;;; --- slot declarations (optional) ---

;;; "`age' is a slot relating physical objects (Physobj) to Numbers. ;;; A physical object has at most one age."KM> (age has (instance-of (Slot)) (domain (Physobj)) (range (Number)) (inverse (is-age-of)) ; name of the inverse slot (cardinality (N-to-1))) ; one age per thing

Page 10: KM: The Knowledge Machine A knowledge representation and reasoning system

Instance Frames and Simple Queries• Frames describe objects in the world

– list its properties, and relationships to other objects• Queries: Form is (the <slot> of <object>)

;;; "Fred is a person."KM> (*Fred has (instance-of (Person)))

;;; "Fred's age is 32."KM> (*Fred has (age (32)))

;;; "Show me the frame representing Fred."KM> (showme *Fred)(*Fred has (instance-of (Person)) (age (32)))

;;; "What is the age of Fred?"KM> (the age of *Fred)(32)

Page 11: KM: The Knowledge Machine A knowledge representation and reasoning system

Instance Frames and Queries (cont) • Values may themselves be expressions• KM keeps track of inverse relations also

;;; "Fred owns a car."KM> (*Fred has (owns ((a Car))))

;;; "What does Fred own?"KM> (the owns of *Fred)(_Car1) ; (Skolem _Car1 created, denoting that car)

;;; "Show me the frame representing that last car."KM> (showme (thelast Car))(_Car1 has (instance-of (Car)) (owns-of (*Fred))) ; note the inverse slot (default name is "<slot>-of")

Page 12: KM: The Knowledge Machine A knowledge representation and reasoning system

Embedded Units and Access Paths • Frames can be embedded within frames• A query path may be embedded in a query path

;;; --- embedded units ---

;;; "Joe is a person, and owns a red car."KM> (*Joe has (instance-of (Person)) (owns ((a Car with (color (*Red))))))

;;; --- access paths ---

;;; "What are the color(s) of the thing(s) which Joe owns?"KM> (the color of (the owns of *Joe))(*Red)

Page 13: KM: The Knowledge Machine A knowledge representation and reasoning system

Embedded Units and Access Paths (cont) • A path will select all values on a slot.• To select a subset, can

– give a class name in the query• (the Leg parts of (a Person))

– add a filter (“generate and test”), described later• (allof (the parts of (a Person)) where (It isa Leg))

;;; "Joe is a person, and owns a red car."KM> (*Joe has (instance-of (Person)) (owns ((a Car) (a Teddy-Bear))))

;;; "What vehicles does Joe own?"KM> (the Vehicle owns of *Joe))(_Car1)

Page 14: KM: The Knowledge Machine A knowledge representation and reasoning system

Class Frames and Inheritance • Can state properties for all members of a class• Each instance of that class acquires those properties

;;; "People are physical objects" (property of the class)KM> (Person has (superclasses (Physobj)))

;;; "Every person lives in a house." (property of class members)KM> (every Person has (lives-in ((a House))))

;;; "Every house has a door and a roof."KM> (every House has (parts ((a Door) (a Roof))))

;;; "What does Joe live in?"KM> (the lives-in of *Joe)(_House3)

;;; "What are the parts of the thing which Joe lives in?"KM> (the parts of (the lives-in of *Joe))(_Door4 _Roof5)

Page 15: KM: The Knowledge Machine A knowledge representation and reasoning system

Exercises ;; "All professors have (at least) one car which is old, is;; their favorite color, and was made in USA."(Professor has (superclasses (Person)))

(every Professor has (owned-vehicle ( (a Car with (age (*Old)) (color ((the favorite-color of Self))) (made-by ((a Manufacturer with

(location (*USA)))))))))

1. Write the KM queries to find: - the vehicle which a professor owns - the age of a professor’s vehicle - the location of the manufacturer of the professor’s vehicle2. Create a KM frame describing the concept of a Car:

(every Car has …)

Page 16: KM: The Knowledge Machine A knowledge representation and reasoning system

Exercise (every Electrophoresis has (sample ((a Chemical))) (equipment ((a Separation-unit) (a Syringe))) (subevents ( (a Remove with (object ((the sample of Self))) (location ((the delivery-medium of (the sample of Self))))) (a Insert with (object ((the sample of Self))) (destination ((the Separation-unit equipment of Self))) (equipment ((the Syringe equipment of Self)))))

(Albumin has (superclasses (Chemical)))(every Albumin has (delivery-medium ((a Bottle))) (storage-medium ((a Fridge))))

3. What is the result of the query: KM> (the location of (the Remove subevents of (a Electrophoresis with

(sample ((a Albumin))))

Page 17: KM: The Knowledge Machine A knowledge representation and reasoning system

Answers to Exercises1a. (the owned-vehicle of (a Professor))1b. (the age of (the owned-vehicle of (a Professor)))1c. (the location of (the made-by of (the owned-vehicle of (a Professor))))

2. For example... (every Car has (color ((a Color))) (parts ((a Chassis) (a Engine) (a Fuel-Tank with (supplies ((the Engine parts of Self)))))))

3. _Bottle1 (i.e., a Skolem instance of Bottle).Explanation: The location of the Remove is the delivery-medium of the sample. In this case, the sample is an instance of Albumin. From the Albumin frame, the delivery-medium would be an instance of Bottle.

Page 18: KM: The Knowledge Machine A knowledge representation and reasoning system

Tracing Inference KM> (trace)

;;; "What are the parts of the thing which Joe lives in?"KM> (the parts of (the lives-in of *Joe))1 -> (the parts of (the lives-in of *Joe))2 -> (the lives-in of *Joe)2 (1) Local value(s): _House32 (2) From inheritance: (a House)2 (1-2) Combine 1-2 together3 -> ((_House3) && ((a House)))3 <- (_House3) "((_House3) && ((a House)))"2 <- (_House3) "(the lives-in of *Joe)"2 -> (the parts of _House3)2 (1) Local value(s): (:set _Door4 _Roof5)3 -> (:set _Door4 _Roof5)3 <- (_Door4 _Roof5) "(:set _Door4 _Roof5)"2 (2) From inheritance: (:set (a Door) (a Roof))2 (1-2) Combine 1-2 together3 -> ((_Door4 _Roof5) && ((a Door) (a Roof)))3 <- (_Door4 _Roof5) "((_Door4 _Roof5) && ((a Door) (a Roof)))"2 <- (_Door4 _Roof5) "(the parts of _House3)"1 <- (_Door4 _Roof5) "(the parts of (the lives-in of *Joe))"(_Door4 _Roof5)

KM> (untrace)

Page 19: KM: The Knowledge Machine A knowledge representation and reasoning system

The Taxonomy (Inheritance Hierarchy)

KM> (*Fred has (instance-of (Person)))

KM> (Person has (superclasses (Physobj)))

KM> (Physobj has (superclasses (Thing)))

;;; "Show me the concept taxonomy." KM> (taxonomy)Thing Number Physobj Car Cat House PersonI *FredI *Joe…. etc…..

• Classes can themselves be subclasses of (multiple) other classes

• (taxonomy) shows the entire taxonomy

Thing

Physobj Number

Car Person ….

Page 20: KM: The Knowledge Machine A knowledge representation and reasoning system

Rules

;;; "A person is a voter if he/she is older than 18."KM> (every Person has (is-voter ((if ((the age of Self) >= 18) then *Yes else (if ((the age of Self) < 18) then *No)))))

;;; "Is Fred a voter?" [Fred is 32, asserted earlier]KM> (the is-voter of *Fred)(*Yes)

;;; "Joe is 12 years old."KM> (*Joe has (age (12)))(*Joe)

;;; "Is Joe a voter?"KM> (the is-voter of *Joe)(*No)

• The expression for a slot-value may be a rule• The rule is evaluated when the slot-value is queried• The tests and result of the rule are themselves KM expressions

Page 21: KM: The Knowledge Machine A knowledge representation and reasoning system

Self

;;; --- Self ---

;;; "Every person likes their favorite color(s)."KM> (every Person has (likes-color ((the favorite-color of Self))))(Person)

;;; "Fred's favorite color is blue."KM> (*Fred has (favorite-color (*Blue)))(*Fred)

;;; "What color(s) does Fred like?"KM> (the likes-color of *Fred)(*Blue)

• For inherited information, ‘Self’ refers to the instance inheriting the information.

Page 22: KM: The Knowledge Machine A knowledge representation and reasoning system

Exercise4. Complete the expression on the “brightness” slot for the concept of a Light, so that the result depends on the light’s switch position.

(every Light has (switch ((a Switch with (position ((a Position))))) (brightness (…..)))

(*Up has (instance-of (Position)))(*Down has (instance-of (Position)))

(*Bright has (instance-of (Brightness)))(*Dark has (instance-of (Brightness))))

Page 23: KM: The Knowledge Machine A knowledge representation and reasoning system

Answers to Exercises4. (every Light has (switch ((a Switch with

(position ((a Position)))))) (brightness ( (if ((the position of (the switch of Self)) = *Up) then *Bright else (if ((the position of (the switch of Self)) = *Down) then *Dark)))))

Note that if the position is unknown, then the brightness will be unknown also (which is what we want).

Page 24: KM: The Knowledge Machine A knowledge representation and reasoning system

Arithmetic

;;; --- arithmetic ---

;;; "What is 1 + 1?"KM> (1 + 1)(2)

;;; "A person's age in days is their age [in years] times 365."KM> (every Person has (age-in-days (((the age of Self) * 365))))(Person)

;;; "What is Fred's age in days?"KM> (the age-in-days of *Fred)(11680)

• KM has infix operators +, -, *, /, ^• Also has arithmetic slots: (the sum of ….), etc.

– sum, difference, product, quotient, and others

Page 25: KM: The Knowledge Machine A knowledge representation and reasoning system

Set Expressions

;;; --- set expressions ---

;;; "Show me every person [in the KB so far]?"KM> (every Person)(*Joe *Fred)

;;; "Which people are over 18?"KM> (allof (the all-instances of Person) where ((the age of It) > 18))(*Fred)

;;; "What is the favorite color(s) of the people over 18?"KM> (forall (the all-instances of Person) where ((the age of It) > 18) (the favorite-color of It))(*Blue)

• Procedurally, KM iterates over a set of values• Keyword “It” denotes the value in each iteration

Page 26: KM: The Knowledge Machine A knowledge representation and reasoning system

Multiple Inheritance and Unification

;;; Unify these two sets togetherKM> (((a Cat) (a Dog)) && ((a Cat) (a Rabbit)))(_Cat1 _Dog2 _Rabbit3)

;;; Unify these two objects togetherKM> ((a Pet) & (a Fish))(_Pet1)

KM> (showme _Pet1)(_Pet1 has (instance-of (Pet Fish)))

• If several frames contribute to a slot’s values, KM will unify the different sets of values together– set unification is heuristic, not deductive– goal is to assess which objects are the same (coreferential)

• The set unification operator is “&&”• Also, “&” unifies two individuals together

Page 27: KM: The Knowledge Machine A knowledge representation and reasoning system

Inheritance and Unification: Example;;; "Every big car has a large engine."KM> (every Big-Car has (parts ((a Engine with (size (*Large))))))

;;; "Every powerful car has a powerful engine."KM> (every Powerful-Car has (parts ((a Engine with (power (*Lots))))))

;;; "Suburbans are both big and powerful cars."KM> (Suburban has (superclasses (Big-Car Powerful-Car)))

;;; "What are the parts of a Suburban?"KM> (the parts of (a Suburban))(COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)(_Engine7)

KM> (showme (thelast Engine))(_Engine7 has (size (*Large)) (instance-of (Engine)) (power (*Lots)) (parts-of (_Suburban6)))

Here KM decides the 2 enginesare coreferential as (i) same class (or one’s classes subsumes the others’) (ii) unification doesn’t violate constraints

Note result of unification: Engine is both large and has lots of power.

Page 28: KM: The Knowledge Machine A knowledge representation and reasoning system

Inheritance & Unification: Another Example

;;; "Every person has two legs and a head."KM> (every Person has (parts ((a Head) (a Leg) (a Leg))))(Person)

;;; "Fred has a leg."KM> (*Fred has (parts ((a Leg))))(*Fred)

;;; "What are the parts of Fred?";;; [Note: two legs -- KM unifies one of the two legs on Person with the leg on Fred] KM> (the parts of *Fred)(_Leg9 _Head10 _Leg11)

• Again, the different contributing value sets are unified together.

Page 29: KM: The Knowledge Machine A knowledge representation and reasoning system

Constraints• Can attach constraints to a slot

– constrains the allowed values on that slot– checked when that slot is queried

• Two types:– value constraints: applies to each value in turn

• (must-be-a Cat with (color (*Black)))• (mustnt-be-a Dog)• (<> 3)• (constraint ((the color of TheValue) = *Black))

– set constraints: applies to the set of values• (at-least 2 Leg)• (at-most 2 Leg)• (exactly 2 Leg)• (set-constraint ((the number of TheValues) = 3))

Page 30: KM: The Knowledge Machine A knowledge representation and reasoning system

Value Constraints

;;; "A person's friends must all be of class Person."KM> (every Person has (friends ((must-be-a Person))))

;;; "A person cannot marry him/herself." (<> means "cannot equal")KM> (every Person has (spouse ((<> Self))))

;;; "Fred's spouse is himself."KM> (*Fred has (spouse (*Fred)))

;;; "Who is Fred's spouse?" [The constraint violation is detected at query time]KM> (the spouse of *Fred)ERROR! Constraint violation! Discarding value *Fred (conflicts with (<> *Fred))

• Checks each value in turn, when the slot is queried• keyword ‘TheValue’ denotes the value being tested• must-be-a constraints are enforced (not just checked)

Page 31: KM: The Knowledge Machine A knowledge representation and reasoning system

Set Constraints

;;; "Every Airplane has exactly two wings."KM> (every Airplane has (parts ((exactly 2 Wing))))(Airplane)

;;; General value constraints: TheValue denotes the value being checked.KM> (every Person has (leg-parts ((constraint (TheValue isa Leg))))

;;; General set constraints: TheValues denotes the set of values being checked.KM> (every Person has (leg-parts ((set-constraint ((the number of TheValues) <= 2))))

• Checks the entire set of values on a slot• Keyword ‘TheValues’ denotes the set being tested• Useful for at most / at least constraints

Page 32: KM: The Knowledge Machine A knowledge representation and reasoning system

Defined Classes and Automatic Classification

;;; "A Mexican is a person who lives in Mexico,;;; AND every person living in Mexico is a Mexican."KM> (every Mexican has-definition (instance-of (Person)) (lives-in (*Mexico)))

;;; "Every Mexican is happy."KM> (every Mexican has (mood (*Happy)))

;;; "Fred lives in Mexico.” [Note Fred is thus classified as a Mexican]KM> (*Fred has (lives-in (*Mexico)))(COMMENT: *Fred satisfies definition of Mexican,)(COMMENT: so changing *Fred's classes from (Person) to (Mexican))(*Fred)

• Defining properties of a class: – IF object has these properties THEN it is in that class

• If new info found about an instance, its classes are re-checked

Page 33: KM: The Knowledge Machine A knowledge representation and reasoning system

Exercise

5. Create KM frames defining– the concept of a RedWine (a red wine)– a bachelor– a square

Page 34: KM: The Knowledge Machine A knowledge representation and reasoning system

Answers to Exercise5a. (every RedWine has-definition (instance-of (Wine)) (color (*Red)))

5b. (every Bachelor has-definition (instance-of (Man)) (spouse ((exactly 0 Thing))))

5c. (every Square has-definition (instance-of (Rectangle)) (length ((the width of Self))) (width ((the length of Self))))

Page 35: KM: The Knowledge Machine A knowledge representation and reasoning system

Text Generation

KM> (every Remove has (text ((:seq "Remove" (the object of Self) "from" (the location of Self)))))

;;; "What is are the text for a remove of a sample from a box?”KM> (the text of (a Remove with (object ((a Sample))) (location ((a Box)))))((:seq "Remove" _Sample14 "from" _Box15))

;;; "Make a sentence from these fragments."KM> (make-sentence (the text of (a Remove with (object ((a Sample))) (location ((a Box))))))("Remove the sample from the box.")

• A special type of instance is a sequence– (:seq v1 … vn)

• Text strings can be built up as a sequence of fragments

Page 36: KM: The Knowledge Machine A knowledge representation and reasoning system

Slot Hierarchies

;;; --- slot hierarchies ---

;;; "parts has subslots mechanical-parts."KM> (parts has (instance-of (Slot)) (subslots (mechanical-parts)))(parts)

;;; "Every airplane has a jet engine as one of its mechanical parts."KM> (every Airplane has (mechanical-parts ((a Jet-Engine))))(Airplane)

;;; "What are the parts of an airplane?"KM> (the parts of (a Airplane))(_Jet-Engine23)

• Slots can have subslots• Values of subslots are also values of the superslot

– values “propogate up”)

Page 37: KM: The Knowledge Machine A knowledge representation and reasoning system

Situations• A situation is a partition of the knowledge base

– Mainly to represent “snapshots” of the world at different times• Facts can differ in each situation• But each situation acquires all the facts of the global situation• Situations can be temporally ordered• Can define actions which change a situation, and thus perform

simulation

Page 38: KM: The Knowledge Machine A knowledge representation and reasoning system

Situations: Fluents and Non-Fluents

;;; --- situations ---

;;; "Mike was born in 1963."KM> (*Mike has (birthdate (1963)))(*Mike)

;;; "birthdate is a constant (`non-fluent')"KM> (birthdate has (instance-of (Slot)) (fluent-status (*Non-Fluent)))

;;; "age may vary, but by default will remain unchanged."KM> (age has (instance-of (Slot)) (fluent-status (*Inertial-Fluent)))

• Non-fluent: Fact is universally true• Inertial-fluent: Fact can propogate from one situation to the next• (Non-inertial) fluent: Fact does not propogate

Page 39: KM: The Knowledge Machine A knowledge representation and reasoning system

Situations: Projection (example);;; "Create a new situation."KM> (new-situation)(COMMENT: Changing to situation _Situation24)

;;; "In this situation, Mike is 27 years old."[_Situation24] KM> (*Mike has (age (27)))

;;; "What is Mike's age [in this situation]?"[_Situation24] KM> (the age of *Mike)(27)

;;; "Create and goto a new situation, which is the temporal successor of this one.”[_Situation24] KM> (next-situation)(COMMENT: Changing to situation _Situation25)

;;; "What is Mike's age [in this situation]?"[_Situation25] KM> (the age of *Mike)(COMMENT: Projected *Mike age = (27) from _Situation24 to _Situation25)(27)

Page 40: KM: The Knowledge Machine A knowledge representation and reasoning system

Situations: Projection (cont)

[_Situation25] KM> (next-situation)(COMMENT: Changing to situation _Situation26)(_Situation26)

;;; "In this situation, Mike is 28 years old."[_Situation26] KM> (*Mike has (age (28)))(*Mike)

;;; "What is Mike's age [in this situation]?";;; [Note `27' is not projected, as `28' overrides it and this slot cannot;;; have multiple values.][_Situation26] KM> (the age of *Mike)(28)

• For “inertial fluents”, facts only propogate from one situation to the next if it is consistent to do so.

Page 41: KM: The Knowledge Machine A knowledge representation and reasoning system

Querying Situations from the Global Situation

;;; "Exit this situation, and return to the `global situation'."[_Situation26] KM> (global-situation)(COMMENT: Changing to situation *Global)(t)

;;; "In the last situation created, what was Mike's age?"KM> (in-situation (thelast Situation) (the age of *Mike))(28)

;;; "In which situations was Mike 27?"KM> (allof (the all-instances of Situation) where (in-situation It ((the age of *Mike) = 27)))(_Situation25 _Situation24)

• Can also query one situation from another– (in-situation <situation> query)

• KM remembers each situation (so can query over them all)

Page 42: KM: The Knowledge Machine A knowledge representation and reasoning system

Specifying Actions

;;; "Every switching on is an Action."KM> (Switching-On has (superclasses (Action)))(Switching-On)

;;; "Every switching on changes a switch's position from down to up."KM> (every Switching-On has (object ((a Switch))) (del-list ((:triple (the object of Self) position *Down))) (add-list ((:triple (the object of Self) position *Up))))(Switching-On)

• Actions define how a event changes the world• They specify

• preconditions: facts which must be true for the action to be performable

• add-list, del-list: facts which become true/false as a result of the action

• Facts are stated as “triples” (frame-slot-value structures)

Page 43: KM: The Knowledge Machine A knowledge representation and reasoning system

Simulation

;;; "Create a new situation."KM> (new-situation)

;;; "There is a switch whose position [in this situation] is down."[_Situation27] KM> (*MySwitch == (a Switch with

(position (*Down))))(*MySwitch)

;;; "Create and enter the situation resulting from switching that switch on."[_Situation27] KM> (do-and-next (a Switching-On with (object (*MySwitch))))(_Situation30)

;;; "What is the position [in this new situation] of that switch?"[_Situation30] KM> (the position of *MySwitch)(*Up)

• do-and-next will ‘execute’ an action in a situation– creates a new situation– updates the facts in it, according to the action

Page 44: KM: The Knowledge Machine A knowledge representation and reasoning system

Simulation (cont)

;;; --- previous situations are preserved ---

;;; "In the previous situation, what was the position of the switch?"[_Situation30] KM> (in-situation (the prev-situation of (curr-situation)) (the position of *MySwitch))(*Down)

;;; "In which situations was the switch down?"[_Situation30] KM> (allof (the all-instances of Situation) where (in-situation It ((the position of *MySwitch) = *Down)))(_Situation27)

• again, previous situations can be queried and quantified over

Page 45: KM: The Knowledge Machine A knowledge representation and reasoning system

(Twin-Jet-Airplane has (superclasses (Airplane)))

(every Twin-Jet-Airplane has (parts ((a Fuselage)

(a Wing with (parts ((a Engine))) (connects ((the Fuselage parts of Self))))(a Wing with (parts ((a Engine))) (connects ((the Fuselage parts of Self))))

(propulsion ((the Engine parts of (the Wing parts of Self)))))

Prototypes• From a KM frame, we can compute a “graph” of

objects and relationships which that frame asserts (i.e., a representative example of that frame)

• Prototypes: Use that graph as the representation itself!

_ProtoTwin-Jet-Airplane01

_ProtoWing03 _ProtoWing04

_ProtoEngine05 _ProtoEngine06

_ProtoFuselage07

parts parts

parts parts

connects

propulsion

Page 46: KM: The Knowledge Machine A knowledge representation and reasoning system

Reasoning with Prototypes

_Twin-Jet-Airplane31

_ProtoTwin-Jet-Airplane01

_ProtoWing03 _ProtoWing04

_ProtoEngine05 _ProtoEngine06

_ProtoFuselage07

parts parts

connects

parts parts

propulsion(Twin-Jet-Airplane has (prototypes (_ProtoTwin-Jet-Airplane01)))

_Twin-Jet-Airplane31

_Wing33 _Wing34

_Engine35 _Engine36

_Fuselage37

parts parts

connects

parts parts

propulsion

1. Clone the prototype

_Wing33 _Wing34

_Engine35 _Engine36

_Fuselage37

parts parts

connects

parts parts

propulsion

2. Unify clone with instanceparts = ?

KB:

Query:

• Inheritance is replace with “clone and unify”

Page 47: KM: The Knowledge Machine A knowledge representation and reasoning system

KM: Some Outstanding Issues• Reasoning can get complex, and hard to debug• No full truth maintenance• Need for “defaults” – added during RKF• Heuristic unification can sometimes get it wrong

– Knowledge engineer can provide guidance• Use of prototypes important for KM in Shaken• Explanations:

– store which rule derived which fact– being extended to store the “proof tree” for a fact