Reading, Chapter 10, pp. 297-298 pp. 304-top 305 pp. 310-311, 313 pp. 313-321; 323-325 Logical Reasoning Systems ========================== We have been building toward agents as reasoning systems Explicitly represent and reason with knowledge High modularity: Control structure isolated from knowledge Easier to experiment with system, modify knowledge, use knowledge for different things, explain workings to another agent, (learning) Actual Systems Theorem provers -- resolution (or other inference procedure) used to prove sentences in full first-order logic -- mathematical/scientific reasoning tasks; answer questions Logic Programming Languages often restrict the logic (no full treatment of negation, disjunction, equality) -- often use backward chaining; add non-logical PL features (such as I/O) Production systems -- As above, implication is the primary representation -- Consequent of an implication is an action rather than a conclusion (e.g., additions, deletions from KB; I/O) Frame systems/Semantic Nets -- Objects -- nodes in a graph; Edges/links --- relationships between objects Frames: the binary relations are slots in one frame filled by another frame (nested boxes) Semantic nets: the binary relations are arrows between nodes (graphs) Meaning and implementation can be identical Description logic (terminological logic) systems: Semantic nets, focusing on defnitions of terms Russell & Norvig: 310-313 -- read on your own Forward-Chaining Production Systems (R&N p 313) Could implement production systems in a general theorem prover. But, if we use a more restricted language, can design a more efficient system (general theme). Match phase ----------- Assuming: w element in working memory r rules, each with n elements in the left-hand-side solving a problem requires c cycles Straightforward solution is too inefficient: c * r * w * n matches: For each cycle (c): For each rule (r): Consider all possible matches between the w elements in WM and the n elements in the LHS: w*n Rete algorithm; OPS-5 (still used) Compile the rule memory into a network that is traversed during execution. In figure 10.6, what does A=B mean? That there is some i such that A(i) and B(i) are in working memory. The rectangles at the right are short for, e.g., add E(i). The circles are fetches to working memory. (Note: there is a missing square node on the bottom -- B=E) Rules share common parts of the network After an update, change is localized, as possible Adding D(2) results in Add E(2); no further changes are needed But adding or deleting an A or B will require changes to be propogated through the network Conflict resolution ------------------- Among all the rules that match, choose one (read on your own in R&N) ================================================== Note about rules in expert systems: Often, they are ``heuristic''. From evidence/observations, infer a hypothesis/cause. If the engine does not turn over and the lights do not come on Then the problem is battery or cables But what if the car's starter motor is bad and its lights are all burned out? Under the ``intended interpretation,'' this implication is false. However, the converse is true (under the ``intended interpretation''): If the problem is battery or cables Then the engine does not turn over, and the lights do not come on Is this useful? We have observations/evidence/symptoms; we DON'T KNOW the cause/hypothesis. So, forward reasoning won't work. And backward reasoning just begs the question! What we want to do: given observed symptoms, hypothesize a cause. Let P = the problem is battery or cables Let Q = the engine does not turn over and the lights do not come on P --> Q Q -------- P An unsound, but useful, rule of inference Reasoning using this rule is called ``abduction'' Hypothesize causes to ``explain'' observations/evidence ``Where there's smoke, there's fire'' Deduction? P --> Q P -------- Q How about induction? (approximately) P, Q ------ P-->Q There are non-monotonic, symbolic systems that perform abduction. And, we will see the same idea of choosing a hypothesis based on observed evidence later when we get to probabilistic systems. FRAME systems and semantic networks ----------------------------------- Mainly variants of FOPC (what does FOPC mean?) Can be easier to understand SNePS (in addition to CYC) contains different kinds of interfaces. (SNePSLOG; SNePSUL) More efficient than full theorem-provers? Let's ask that question later. Bottom of page 318 (R&N): How many legs does Opus have? Following Path from Opus to Penguins to Birds, Opus ``inherits'' rel(legs,bird,2). But what if there are two different paths with two different answers? ``Ironically, semantic networks sometimes lack a clear semantics.'' This book specifies the meaning/semantics by showing the translation into FOPC. Figure 10.8: What kinds of logical symbols are A, B, R, x, y? subset, member? What do the following mean? pat -name-> ``pat'' name(pat,"pat") bats -[flies]-> T If something, say x, is a member of the set of all bats, then flies(x,t). forall X if x is in bats then flies(x,t), where t is true. what other logical sentences are expressed in figure 10.7(a) where would the last example in figure 10.8 go in the diagram? What would the network look like as a semantic net? In this version, which does not allow for exceptions, what contradition can you draw? Pat has 2 legs and Pat has 4 legs. How? Because: pat in bats forall (x) x in bats --> legs(x,2) and pat in bats bats subset mammals forall (x,y,z) ((x in y) and (y subset z) --> x in z) ** NEW forall (x) x in Mammals --> legs(x,4) To infer a contradiction between having 2 legs and having 4, what should be added? forall (x,n1,n2) legs(x,n1) and legs(x,n2) --> equal(n1,n2) ~equal(2,4) One fix: the values stored ``closer'' win. We need to change the FOPC version. Let's change the scheme to reify the predicate symbols. val(r,x,b) is the old x--r-->b forall x,i,p intervening(x,i,p) <--> (x in i) and (i subset p) ; forall objects x and classes i and p, i is an intervening class ; between x and p if x is in i and i is a subset of p. forall(x,p,r) interveningrel(x,p,r) <--> exists(i) intervening(x,i,p) and exists (b') rel(r,i,b'). ; there is a class that is an intervening class between x and p ; for which an "r-fact" involving that class is known. forall(r,x,b) holds(r,x,b) <--> ; either you know this specific fact already val(r,x,b) or ; or there is some class p such that x is in p and ps have relation ; r to bs and there is no intervening fact concerning r (exists (p) (x in p) and rel(r,p,b) and ~interveningrel(x,p,r)) Closure axioms are needed. Suppose we are trying to find the n such that holds (legs, pat, n). We know rel(legs,mammals,4) and that pat is a mammal But we need to prove there is no interveningRel(pat,mammals,legs) For this, need to prove there is no class between pat and mammals for which there is a "legs fact". In the diagram, the candidate that has to be ruled out is bats. See the axioms at the topic of 320: the only rel and val propositions that are true are the ones explicitly represented. A knowledge-base facility could keep track. =================================== Of course, we could do all this in a theorem prover, but the semantic network/frame can be easier to understand and more efficient. =================================== Multiple inheritance. Can produce conflicts. The Nixon diamond is the classic example: Nixon was a Republican, Republicans are not pacifists. Nixon was a Quaker, Quakers are pacifists. No magic solution. You need more knowledge, including, perhaps, an estimate of which is more probable. ================ Is the knowledge base in figure 10.7, assuming the axioms on page 319, monotonic or non-monotonic? non-monotonic! If you add knowledge, you might not be able to infer, e.g., rel(opus, legs, 2). But I thought FOPC was non-monotonic?!? The axioms on top of page 320 would *change* if you added knowledge, so we are starting over with a different set of axioms. Thus, we aren't just adding knowledge, we are changing the old knowledge. (the closed world assumption introduces non-monotonicity, however it is implemented...why? Once you add, e.g., santa(fat), you can no longer infer ~santa(fat))