KMs Inference Algorithm Peter Clark Knowledge Systems Boeing
KM’s Inference Algorithm Peter Clark Knowledge Systems Boeing Math & Computing Technology
The Top-Level KM Algorithm • An atomic value returns itself • Otherwise, apply a set of rewrite rules to decompose the expression • Decomposing a KM expression corresponds to breaking up its equivalent logical expression KM: (the age of (the spouse of Pete)) -> find x, (the spouse of Pete) -> find (the age of x) LOGIC: {y | spouse(Pete, x), age(x, y)} -> find x in spouse(Pete, x) -> find y in age(x, y) • Eventually, decomposed to KM’s basic operations • If an instance changes, re-check its classification
The Top-Level KM Algorithm PROCEDURE km(expr) -> values If expr is an atomic value, return expr Else: REWRITES: PATTERN: REWRITE AS: (the slot of expr) km(expr) -> f, km(the slot of f) (allof expr where test) km(expr) -> set, return i in set if km(test) (if test then expr) km(test) -> boolean, if boolean then km(expr). . . PRIMITIVES: (instance has slotsvals) : Assert in KB (every class has slotsvals) : Assert in KB (a class has slotsvals) : Generate Skolem, then assert in KB (the slot of frame) (frame 1 & frame 2) (set 1 && set 2) PROCEDURE classify(instance) If instance’s properties change then check its classification
1. Computing the value of a slot • Corresponds to: – find all the x where slot(instance, x) is true – (or, can think of slot as a function on instance) • Algorithm: – Collect all the information about instance’s slot • local • inherited – Evaluate and combine that information
1. Computing the value of a slot ; ; ; Working on an individual clause PROCEDURE: (the slot of frame) -> values Person age: (a Number) *Fred 1. Find the set of "local" values on frame's slot age: 32 [projection, subslots, global situation] 2. a. Find all the classes of frame b. For each class, find the set of values on the class's slot 3. Set-unify the sets together km(set 1 && set 2 &&. . ) [For single-valued slots, do km(set 1 & set 2 & set 3. . . )] 4. a. Find the local and inherited constraints on the slot b. Check and enforce those constraints 5. Assert the resulting values on the frame's slot 6. Return the final set of values
2. Unification (asserting equality) • The syntactic process of merging two data structures corresponds to the semantic process of asserting equality – if x = y, then • all things true of x will be true of y, and vice versa • so the data structure denoting things true of x will also be part of the data structure denoting things true of y, and vice versa
2. Unification (asserting equality) PROCEDURE: (frame 1 & frame 2) -> frame 12 1. Choose a name for the unified frame 12 *Fred 2. For the slots used in frame 1 and frame 2: age: 32 a. Find the values vals 1 of slot on frame 1 owns: _Car 1 b. Find the values vals 2 of slot on frame 2 & c. Create a new structure (slot ((vals 1 && vals 2))) _Person 2 d. Find constraints on slot (in vals 1, vals 2, and inherited) owns: _Car 2 Check that vals 1, vals 2, and (vals 1 && vals 2) don't violate constraints 3. Assemble these pieces together (frame 12 has *Fred age: 32 (slot 1 ((vals 1 && vals 2))) owns: ((_Car 1) && (_Car 2)) (slot 2 ((vals 1 && vals 2))). . . ) 4. Assert it in the KB 5. "Bind" frame 1 and frame 2 to frame 12 Binding List: _Person 2 -> *Fred
3. Set Unification • Goal is to “sensibly” combine information from different frames together • Can think of this as: – non-deductive inference step – deductive based on an additional coreference algorithm
3. Set Unification PROCEDURE: (set 1 && set 2) -> set 12 1. For each value v in set 1 a. Find a value v' in set 2 a. whose classes are equal/generalization/specialization of v's b. which can be consistently unified with v b. If there is a v' then add (v & v') to set 12, and remove v' from set 2 else add v to set 12 2. Add remaining values in set 2 to set 12 3. Return set 12 (_Cat 1 _Dog 1) && ((a Cat) (a Dog)) -> (_Cat 1 _Dog 1)
The next level of detail • • • Situations, projection Caching Explanation Automatic classification Text generation Defaults KB loading/saving/checking Loop detection Recursive calls Prototypes
Further Reading • The KM Manuals • The KM Tutorial – powerpoint • “Building Knowledge Bases from Reusable Components” AAAI’ 97 – paper, describes an example of the interleaving of backward chaining (path following) and automatic classification • “Using Access Paths to Guide Inference with Conceptual Graphs”, ICCS’ 97 – paper and animated powerpoint. Describes KM’s top-level algorithm in detail, along with a worked example. – The powerpoint gives an animation of this inferencing in operation. • Short note on the implementation of situations – technical note All available at: http: //www. cs. utexas. edu/users/mfkb/km. html
- Slides: 11