8 A Multitasking Application

8.6 A sample session

Assume that the file/u/susan/lisp-code/example.rules contains the following information:

(defvar *test-rules*
        '((elephant.rule (if (elephant ?x) 
                             then (the color of ?x is grey)))
          (canary.rule (if (canary ?x) then (bird ?x)))
          (bird.rule (if (bird ?x) then (wings ?x)
                                 (flies ?x )))
          (pigeon.rule (if (pigeon ?x) 
                            then (the color of ?x is grey)
                                 (the color of ?x is white)
                                 (wings ?x)))
          (rule1 (if (a ?x) then (b ?x)))
          (rule2 (if (b ?y) then (c ?y)))
          (rule3 (if (c ?z) then (d ?z)))
          (rule4 (if (a1 ?x) then (a2 ?x)))
          (rule5 (if (a2 ?x) then (a3 ?x)))
          (rule6 (if (a3 ?x) then (a ?x)))
          (or.rule (if (or  (d ?x) (wings ?who)) 
                       then (the or.rule works)))
          (or.rule1 (if (or (d abc) (d rich)) then 
                        (the second or.rule works)))
          (or.rule2 (if (or 2 (d ?x) (wings ?y))
                        then (the third rule works)))))

(defun setup () (clear-facts) (add-fact '(canary tweety)) (add-fact '(elephant clyde)) (add-fact '(pigeon penny)) (add-fact '(a pp)) (add-fact '(a dd)) (add-fact '(d abc)) (add-fact '(a1 rich)))

The file"/u/susan/lisp-code/bc.lisp" contains the application functions that are presented in the section "The Code." Then, the following sample session could result:

> (load "/u/susan/lisp-code/bc.lisp")
;;; Loading source file "/u/susan/lisp-code/bc.lisp"
#P"/u/susan/lisp-code/bc.lisp"

> (load "/u/susan/lisp-code/example.rules") ;;; Loading source file "/u/susan/lisp-code/example.rules" #P"/u/susan/lisp-code/example.rules"

> *fact-tree* (ROOT)

> (add-fact '(it is early morning)) ((IT (IS (EARLY (MORNING)))))

> (lookup-bindings '(it is early ?what)) (((?WHAT . MORNING)))

> (setup) ((A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))

> (pprint *fact-tree*) (ROOT (A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))

> (lookup-bindings '(a ?x)) (((?X . PP)) ((?X . DD)))

> (pprint *test-rules*) ((ELEPHANT.RULE (IF (ELEPHANT ?X) THEN (THE COLOR OF ?X IS GREY))) (CANARY.RULE (IF (CANARY ?X) THEN (BIRD ?X))) (BIRD.RULE (IF (BIRD ?X) THEN (WINGS ?X) (FLIES ?X))) (PIGEON.RULE (IF (PIGEON ?X) THEN (THE COLOR OF ?X IS GREY) (THE COLOR OF ?X IS WHITE) (WINGS ?X))) (RULE1 (IF (A ?X) THEN (B ?X))) (RULE2 (IF (B ?Y) THEN (C ?Y))) (RULE3 (IF (C ?Z) THEN (D ?Z))) (RULE4 (IF (A1 ?X) THEN (A2 ?X))) (RULE5 (IF (A2 ?X) THEN (A3 ?X))) (RULE6 (IF (A3 ?X) THEN (A ?X))) (OR.RULE (IF (OR (D ?X) (WINGS ?WHO)) THEN (THE OR.RULE WORKS))) (OR.RULE1 (IF (OR (D ABC) (D RICH)) THEN (THE SECOND OR.RULE WORKS))) (OR.RULE2 (IF (OR 2 (D ?X) (WINGS ?Y)) THEN (THE THIRD RULE WORKS))))

> (insert-rule-conclusions-into-tree *test-rules*) NIL

Note that the system appends numbers to the variable names so that each rule has its own copy of the variables.

> (pprint *rule-tree*)
(ROOT (A (?X<10 (*RULES* RULE6)))      
      (A3 (?X<9 (*RULES* RULE5)))      
      (A2 (?X<8 (*RULES* RULE4)))       
      (D (?Z<7 (*RULES* RULE3)))        
      (C (?Y<6 (*RULES* RULE2)))
      (B (?X<5 (*RULES* RULE1)))
      (FLIES (?X<3 (*RULES* BIRD.RULE)))
      (WINGS (?X<4 (*RULES* PIGEON.RULE))
             (?X<3 (*RULES* BIRD.RULE)))
      (BIRD (?X<2 (*RULES* CANARY.RULE)))
      (THE (THIRD (RULE (WORKS (*RULES* OR.RULE2))))
           (SECOND (OR.RULE (WORKS (*RULES* OR.RULE1))))
           (OR.RULE (WORKS (*RULES* OR.RULE)))
           (COLOR
             (OF
               (?X<4
                 (IS (WHITE (*RULES* PIGEON.RULE))
                     (GREY (*RULES* PIGEON.RULE))))
               (?X<1 (IS (GREY (*RULES* ELEPHANT.RULE))))))))

> (query '(wings ?who)) #<Process bc-scheduler 8679BB>

> applying rule PIGEON.RULE from #<Process (SOLVED ((?WHO . PENNY)))-487F8EB> Deduced facts added to database: (THE COLOR OF PENNY IS GREY) (THE COLOR OF PENNY IS WHITE) (WINGS PENNY) ****** TOP LEVEL RESULT : (WINGS PENNY) ********** applying rule CANARY.RULE from #<Process (SOLVED ((?WHO . TWEETY)))-5 88122B> Deduced facts added to database: (BIRD TWEETY) applying rule BIRD.RULE from #<Process (SOLVED ((?WHO . TWEETY)))-5 88122B> Deduced facts added to database: (WINGS TWEETY) (FLIES TWEETY) ****** TOP LEVEL RESULT : (WINGS TWEETY) ********** ;; You must enter an empty list to see the prompt. () NIL

The functionderivation-tree shows the tree of decision processes. The number appended to the end of the process name indicates the order in which the process was created. The item preceding that number is the top goal in the process's goal stack. If that goal stack is empty, the process is labeled"solved", and the instance bindings occupy the position of the top goal in the process name.

> (derivation-tree)
("root"
  (#<Process top-goal 862F1B>
    (#<Process PIGEON.RULE-(PIGEON ?WHO)-2 8788D3>
      (#<Process (SOLVED ((?WHO . PENNY)))-4 87F8EB>))
    (#<Process BIRD.RULE-(BIRD ?WHO)-1 877183>
      (#<Process CANARY.RULE-(CANARY ?WHO)-3 87AA3B>
        (#<Process (SOLVED ((?WHO . TWEETY)))-5 88122B>)))))

> (lookup-bindings '(wings ?who)) (((?WHO . PENNY)) ((?WHO . TWEETY)))

> (query '(the color of ?who is grey)) #<Process bc-scheduler 88A13B>

> ****** TOP LEVEL RESULT : (THE COLOR OF PENNY IS GREY) ********** applying rule ELEPHANT.RULE from #<Process (SOLVED ((?WHO . CLYDE)))-9 930CD3> Deduced facts added to database: (THE COLOR OF CLYDE IS GREY) ****** TOP LEVEL RESULT : (THE COLOR OF CLYDE IS GREY) ********** applying rule PIGEON.RULE from #<Process (SOLVED ((?WHO . PENNY)))-10 93010B> Deduced facts added to database: "already stored" (THE COLOR OF PENNY IS GREY) "already stored" (THE COLOR OF PENNY IS WHITE) "already stored" (WINGS PENNY) ****** TOP LEVEL RESULT : (THE COLOR OF PENNY IS GREY) ********** ;; You must enter an empty list to see the prompt. () NIL

The numbers appended to the process names indicate their creation order. The BC scheduler ensures that the tree of processes grows by only one level at a time.

> (derivation-tree)
("root"
  (#<Process top-goal 930673> 
    (#<Process (SOLVED ((?WHO . PENNY)))-8 93020B>)
    (#<Process PIGEON.RULE-(PIGEON ?WHO)-7 93006B>
      (#<Process (SOLVED ((?WHO . PENNY)))-10 93010B>))
    (#<Process ELEPHANT.RULE-(ELEPHANT ?WHO)-6 931773>
      (#<Process (SOLVED ((?WHO . CLYDE)))-9 930CD3>))))

> (lookup-bindings '(the color of ?who is ?what)) (((?WHAT . GREY) (?WHO . PENNY)) ((?WHAT . WHITE) (?WHO . PENNY)) ((?WHAT . GREY) (?WHO . CLYDE)))

> (pprint *) (((?WHAT . GREY) (?WHO . PENNY)) ((?WHAT . WHITE) (?WHO . PENNY)) ((?WHAT . GREY) (?WHO . CLYDE))) > (lookup-bindings '(flies ?who)) (((?WHO . TWEETY)))

> (pprint *fact-tree*) (ROOT (FLIES (TWEETY)) (BIRD (TWEETY)) (WINGS (TWEETY) (PENNY)) (THE (COLOR (OF (CLYDE (IS (GREY))) (PENNY (IS (WHITE) (GREY)))))) (A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))

> (lookup-bindings '(d ?x)) (((?X . ABC))) > (query '(d ?x)) #<Process bc-scheduler 8259AB>

> ****** TOP LEVEL RESULT : (D ABC) ********** applying rule RULE1 from #<Process (SOLVED ((?X . PP)))-16 82D0CB> Deduced facts added to database: (B PP) applying rule RULE2 from #<Process (SOLVED ((?X . PP)))-16 82D0CB> Deduced facts added to database: (C PP) applying rule RULE3 from #<Process (SOLVED ((?X . PP)))-16 82D0CB> Deduced facts added to database: (D PP) ****** TOP LEVEL RESULT : (D PP) ********** applying rule RULE1 from #<Process (SOLVED ((?X . DD)))-17 82DB13> Deduced facts added to database: (B DD) applying rule RULE2 from #<Process (SOLVED ((?X . DD)))-17 82DB13> Deduced facts added to database: (C DD) applying rule RULE3 from #<Process (SOLVED ((?X . DD)))-17 82DB13> Deduced facts added to database: (D DD) ****** TOP LEVEL RESULT : (D DD) ********** applying rule RULE4 from #<Process (SOLVED ((?X . RICH)))-20 836AB3> Deduced facts added to database: (A2 RICH) applying rule RULE5 from #<Process (SOLVED ((?X . RICH)))-20 836AB3> Deduced facts added to database: (A3 RICH) applying rule RULE6 from #<Process (SOLVED ((?X . RICH)))-20 836AB3> Deduced facts added to database: (A RICH) applying rule RULE1 from #<Process (SOLVED ((?X . RICH)))-20 836AB3> Deduced facts added to database: (B RICH) applying rule RULE2 from #<Process (SOLVED ((?X . RICH)))-20 836AB3> Deduced facts added to database: (C RICH) applying rule RULE3 from #<Process (SOLVED ((?X . RICH)))-20 836AB3> Deduced facts added to database: (D RICH) ****** TOP LEVEL RESULT : (D RICH) ********** ;; You must enter an empty list to see the prompt. () NIL

> (derivation-tree) ("root" (#<Process top-goal 82582B> (#<Process (SOLVED ((?X . ABC)))-12 8276DB>) (#<Process RULE3-(C ?X)-11 826DB3> (#<Process RULE2-(B ?X)-13 828D33> (#<Process RULE1-(A ?X)-14 82A82B> (#<Process (SOLVED ((?X . DD)))-17 82DB13>) (#<Process (SOLVED ((?X . PP)))-16 82D0CB>) (#<Process RULE6-(A3 ?X)-15 82C2DB> (#<Process RULE5-(A2 ?X)-18 82FCAB> (#<Process RULE4-(A1 ?X)-19 8348D3> (#<Process (SOLVED ((?X . RICH)))-20 836AB3>) ))))))))

> (lookup-bindings '(d ?x)) (((?X . ABC)) ((?X . PP)) ((?X . DD)) ((?X . RICH)))

> (pprint *fact-tree*) (ROOT (A3 (RICH)) (A2 (RICH)) (C (RICH) (DD) (PP)) (B (RICH) (DD) (PP)) (FLIES (TWEETY)) (BIRD (TWEETY)) (WINGS (TWEETY) (PENNY)) (THE (COLOR (OF (CLYDE (IS (GREY))) (PENNY (IS (WHITE) (GREY)))))) (A1 (RICH)) (D (RICH) (DD) (PP) (ABC)) (A (RICH) (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))

> (lookup-bindings '(the color of ?who is grey)) (((?WHO . PENNY)) ((?WHO . CLYDE)))

> (lookup-bindings '(the color of penny is ?what)) (((?WHAT . GREY)) ((?WHAT . WHITE)))

> (lookup-bindings '(the color of ?who is ?color)) (((?COLOR . GREY) (?WHO . PENNY)) ((?COLOR . WHITE) (?WHO . PENNY)) ((?COLOR . GREY) (?WHO . CLYDE)))

> (pprint *) (((?COLOR . GREY) (?WHO . PENNY)) ((?COLOR . WHITE) (?WHO . PENNY)) ((?COLOR . GREY) (?WHO . CLYDE)))

> (setup) ((A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))

> (pprint *fact-tree*) (ROOT (A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))

> (query '(d ?x) 1) #<Process bc-scheduler 840023>

> ****** TOP LEVEL RESULT : (D ABC) ********** (4 VICTIMS) (KILLING #<Process top-goal 83FEA3>) (KILLING #<Process RULE3-(C ?X)-21 84142B>) (KILLING #<Process RULE2-(B ?X)-23 8433AB>) (KILLING-SELF #<Process (SOLVED ((?X . ABC)))-22 841D53>) ;; You must enter an empty list to see the prompt. () NIL

> (derivation-tree) ("root" (#<Process top-goal 83FEA3> (#<Process (SOLVED ((?X . ABC)))-22 841D53>) (#<Process RULE3-(C ?X)-21 84142B> (#<Process RULE2-(B ?X)-23 8433AB>))))

> (lookup-bindings '(d ?x)) (((?X . ABC)))

> (query '(d ?x) 2) #<Process bc-scheduler 84663B>

> ****** TOP LEVEL RESULT : (D ABC) ********** applying rule RULE1 from #<Process (SOLVED ((?X . PP)))-29 84DD5B> Deduced facts added to database: (B PP) applying rule RULE2 from #<Process (SOLVED ((?X . PP)))-29 84DD5B> Deduced facts added to database: (C PP) applying rule RULE3 from #<Process (SOLVED ((?X . PP)))-29 84DD5B> Deduced facts added to database: (D PP) ****** TOP LEVEL RESULT : (D PP) ********** (9 VICTIMS) (KILLING #<Process top-goal 8464BB>) (KILLING #<Process RULE3-(C ?X)-24 847A43>) (KILLING #<Process (SOLVED ((?X . ABC)))-25 84836B>) (KILLING #<Process RULE2-(B ?X)-26 8499C3>) (KILLING #<Process RULE1-(A ?X)-27 84B4BB>) (KILLING #<Process RULE6-(A3 ?X)-28 84CF6B>) (KILLING #<Process (SOLVED ((?X . DD)))-30 84E7A3>) (KILLING #<Process RULE5-(A2 ?X)-31 85093B>) (KILLING-SELF #<Process (SOLVED ((?X . PP)))-29 84DD5B>) ;; You must enter an empty list to see the prompt. () NIL

> (lookup-bindings '(d ?x)) (((?X . ABC)) ((?X . PP)))

> (setup) ((A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))

> (query '(d ?x) 3) #<Process bc-scheduler 854813>

> ****** TOP LEVEL RESULT : (D ABC) ********** applying rule RULE1 from #<Process (SOLVED ((?X . PP)))-37 85BF33> Deduced facts added to database: (B PP) applying rule RULE2 from #<Process (SOLVED ((?X . PP)))-37 85BF33> Deduced facts added to database: (C PP) applying rule RULE3 from #<Process (SOLVED ((?X . PP)))-37 85BF33> Deduced facts added to database: (D PP) ****** TOP LEVEL RESULT : (D PP) ********** applying rule RULE1 from #<Process (SOLVED ((?X . DD)))-38 85C97B> Deduced facts added to database: (B DD) applying rule RULE2 from #<Process (SOLVED ((?X . DD)))-38 85C97B> Deduced facts added to database: (C DD) applying rule RULE3 from #<Process (SOLVED ((?X . DD)))-38 85C97B> Deduced facts added to database: (D DD) ****** TOP LEVEL RESULT : (D DD) ********** (9 VICTIMS) (KILLING #<Process top-goal 854693>) (KILLING #<Process RULE3-(C ?X)-32 855C1B>) (KILLING #<Process (SOLVED ((?X . ABC)))-33 856543>) (KILLING #<Process RULE2-(B ?X)-34 857B9B>) (KILLING #<Process RULE1-(A ?X)-35 859693>) (KILLING #<Process RULE6-(A3 ?X)-36 85B143>) (KILLING #<Process (SOLVED ((?X . PP)))-37 85BF33>) (KILLING #<Process RULE5-(A2 ?X)-39 85EB13>) (KILLING-SELF #<Process (SOLVED ((?X . DD)))-38 85C97B>) ;; You must enter an empty list to see the prompt. () NIL

> (derivation-tree) ("root" (#<Process top-goal 854693> (#<Process (SOLVED ((?X . ABC)))-33 856543>) (#<Process RULE3-(C ?X)-32 855C1B> (#<Process RULE2-(B ?X)-34 857B9B> (#<Process RULE1-(A ?X)-35 859693> (#<Process (SOLVED ((?X . DD)))-38 85C97B>) (#<Process (SOLVED ((?X . PP)))-37 85BF33>) (#<Process RULE6-(A3 ?X)-36 85B143> (#<Process RULE5-(A2 ?X)-39 85EB13>))))))) > (lookup-bindings '(d ?x)) (((?X . ABC)) ((?X . PP)) ((?X . DD)))

> (setup) ((A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY))) > (query '(the or.rule works)) #<Process bc-scheduler 864603>

> (KILLING-CHILDREN (#<Process RULE2-(B ?X)-47 87328B> #<Process PIGEON.RULE-(PIGEON ?WHO)-46 8715F3> #<Process BIRD.RULE-(BIRD ?WHO)-45 870C2B> #<Process (SOLVED ((?X . ABC)))-44 86F6F3> #<Process RULE3-(C ?X)-43 86E953> #<Process (WINGS ?WHO)-42 86D193> #<Process (D ?X)-41 86CCEB>) FROM #<Process (SOLVED ((?X . ABC)))-44 86F6F3>) (KILLING #<Process RULE2-(B ?X)-47 87328B>) (KILLING #<Process PIGEON.RULE-(PIGEON ?WHO)-46 8715F3>) (KILLING #<Process BIRD.RULE-(BIRD ?WHO)-45 870C2B>) (KILLING #<Process RULE3-(C ?X)-43 86E953>) (KILLING #<Process (WINGS ?WHO)-42 86D193>) (KILLING #<Process (D ?X)-41 86CCEB>) (KILLING-PARENT #<Process OR.RULE-(OR (D ?X) (WINGS ?WHO))-40 865A3B>) (KILLING-SELF #<Process (SOLVED ((?X . ABC)))-44 86F6F3>) applying rule OR.RULE from #<Process (SOLVED (NIL (?X . ABC)))-48 87B313> Deduced facts added to database: (THE OR.RULE WORKS) ****** TOP LEVEL RESULT : (THE OR.RULE WORKS) ********** ;; You must enter an empty list to see the prompt. () NIL

A process trying to achieve anOR will create a subprocess for each disjunct. TheOR process waits until the required number of instances of its disjuncts have been achieved; the default number is one. At that point, the entire subtree, starting at theOR process, is killed, and a new node is created to carry on.

> (derivation-tree)
("root"
  (#<Process top-goal 864283>
    (#<Process OR.RULE-(OR (D ?X) (WINGS ?WHO))-40 865A3B>
      (#<Process (SOLVED (NIL (?X . ABC)))-48 87B313>)
      (#<Process (WINGS ?WHO)-42 86D193>
        (#<Process PIGEON.RULE-(PIGEON ?WHO)-46 8715F3>)
        (#<Process BIRD.RULE-(BIRD ?WHO)-45 870C2B>))
      (#<Process (D ?X)-41 86CCEB> 
                 (#<Process (SOLVED ((?X . ABC)))-44 86F6F3>)
                 (#<Process RULE3-(C ?X)-43 86E953>
                 (#<Process RULE2-(B ?X)-47 87328B>))))))

> (lookup-bindings '(d ?x)) (((?X . ABC)))

> (lookup-bindings '(wings ?x)) NIL

> (query '(the second or.rule works)) #<Process bc-scheduler 87D9B3>

> (KILLING-CHILDREN (#<Process RULE2-(B ABC)-55 885BA3> #<Process RULE3-(C RICH)-54 883F3B> #<Process (SOLVED NIL)-53 882A23> #<Process RULE3-(C ABC)-52 881F23> #<Process (D RICH)-51 88066B> #<Process (D ABC)-50 8801D3>) FROM #<Process (SOLVED NIL)-53 882A23>) (KILLING #<Process RULE2-(B ABC)-55 885BA3>) (KILLING #<Process RULE3-(C RICH)-54 883F3B>) (KILLING #<Process RULE3-(C ABC)-52 881F23>) (KILLING #<Process (D RICH)-51 88066B>) (KILLING #<Process (D ABC)-50 8801D3>) (KILLING-PARENT #<Process OR.RULE1-(OR (D ABC) (D RICH))-49 87F2FB>) (KILLING-SELF #<Process (SOLVED NIL)-53 882A23>) applying rule OR.RULE1 from #<Process (SOLVED (NIL))-56 886B03> Deduced facts added to database: (THE SECOND OR.RULE WORKS) ****** TOP LEVEL RESULT : (THE SECOND OR.RULE WORKS) ********** ;; You must enter an empty list to see the prompt. () NIL

> (derivation-tree) ("root" (#<Process top-goal 87D833> (#<Process OR.RULE1-(OR (D ABC) (D RICH))-49 87F2FB> (#<Process (SOLVED (NIL))-56 886B03>) (#<Process (D RICH)-51 88066B> (#<Process RULE3-(C RICH)-54 883F3B>)) (#<Process (D ABC)-50 8801D3> (#<Process (SOLVED NIL)-53 882A23>) (#<Process RULE3-(C ABC)-52 881F23> (#<Process RULE2-(B ABC)-55 885BA3>))))))

> (lookup-bindings '(d ?x)) (((?X . ABC)))

> (query '(the third rule works)) #<Process bc-scheduler 888E8B>

> ****** TOP LEVEL RESULT : (THE THIRD RULE WORKS) ********** applying rule PIGEON.RULE from #<Process (SOLVED ((?Y . PENNY)))-66 82484B> Deduced facts added to database: (THE COLOR OF PENNY IS GREY) (THE COLOR OF PENNY IS WHITE) (WINGS PENNY) (KILLING-CHILDREN (#<Process (SOLVED ((?Y . TWEETY)))-68 827B1B> #<Process RULE1-(A ?X)-67 8264EB> #<Process (SOLVED ((?Y . PENNY)))-66 82484B> #<Process CANARY.RULE-(CANARY ?Y)-65 8233AB> #<Process RULE2-(B ?X)-64 821CAB> #<Process PIGEON.RULE-(PIGEON ?Y)-63 95F53B> #<Process BIRD.RULE-(BIRD ?Y)-62 95F61B> #<Process (SOLVED ((?X . ABC)))-61 9606AB> #<Process RULE3-(C ?X)-60 96079B> #<Process (WINGS ?Y)-59 95F4CB> #<Process (D ?X)-58 9608BB>) FROM #<Process (SOLVED ((?Y . PENNY)))-66 82484B>) (KILLING #<Process (SOLVED ((?Y . TWEETY)))-68 827B1B>) (KILLING #<Process RULE1-(A ?X)-67 8264EB>) (KILLING #<Process CANARY.RULE-(CANARY ?Y)-65 8233AB>) (KILLING #<Process RULE2-(B ?X)-64 821CAB>) (KILLING #<Process PIGEON.RULE-(PIGEON ?Y)-63 95F53B>) (KILLING #<Process BIRD.RULE-(BIRD ?Y)-62 95F61B>) (KILLING #<Process (SOLVED ((?X . ABC)))-61 9606AB>) (KILLING #<Process RULE3-(C ?X)-60 96079B>) (KILLING #<Process (WINGS ?Y)-59 95F4CB>) (KILLING #<Process (D ?X)-58 9608BB>) (KILLING-PARENT #<Process OR.RULE2-(OR 2 (D ?X) (WINGS ?Y))-57 95F7BB>) (KILLING-SELF #<Process (SOLVED ((?Y . PENNY)))-66 82484B>) applying rule OR.RULE2 from #<Process (SOLVED (NIL (?X . ABC)))-70 82A083> Deduced facts added to database: (THE THIRD RULE WORKS) ****** TOP LEVEL RESULT : (THE THIRD RULE WORKS) ********** applying rule OR.RULE2 from #<Process (SOLVED ((?X<4 . PENNY) NIL (?Y . PENNY)))-69 829A6B> Deduced facts added to database: "already stored" (THE THIRD RULE WORKS) ****** TOP LEVEL RESULT : (THE THIRD RULE WORKS) ********** ;; You must enter an empty list to see the prompt. () NIL

> (derivation-tree) ("root" (#<Process top-goal 95F8C3> (#<Process OR.RULE2-(OR 2 (D ?X) (WINGS ?Y))-57 95F7BB> (#<Process (SOLVED (NIL (?X . ABC)))-70 82A083>) (#<Process (SOLVED ((?X<4 . PENNY) NIL (?Y . PENNY)))-69 829A6B>) (#<Process (WINGS ?Y)-59 95F4CB> (#<Process PIGEON.RULE-(PIGEON ?Y)-63 95F53B> (#<Process (SOLVED ((?Y . PENNY)))-66 82484B>)) (#<Process BIRD.RULE-(BIRD ?Y)-62 95F61B> (#<Process CANARY.RULE-(CANARY ?Y)-65 8233AB> (#<Process (SOLVED ((?Y . TWEETY)))-68 827B1B>)))) (#<Process (D ?X)-58 9608BB> (#<Process (SOLVED ((?X . ABC)))-61 9606AB>) (#<Process RULE3-(C ?X)-60 96079B> (#<Process RULE2-(B ?X)-64 821CAB> (#<Process RULE1-(A ?X)-67 8264EB>)))))))

> (lookup-bindings '(d ?x)) (((?X . ABC)))

> (lookup-bindings '(wings ?x)) (((?X . PENNY)))

> (pprint *fact-tree*) (ROOT (WINGS (PENNY)) (THE (THIRD (RULE (WORKS))) (COLOR (OF (PENNY (IS (WHITE) (GREY))))) (SECOND (OR.RULE (WORKS))) (OR.RULE (WORKS))) (A1 (RICH)) (D (ABC)) (A (DD) (PP)) (PIGEON (PENNY)) (ELEPHANT (CLYDE)) (CANARY (TWEETY)))


The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker