anchor.diff:  
   
   (defun make-rule-tree (rules)
  -  (recursively ((rules (mapcar #'sort-body rules)))
  +  (recursively ((rules (mapcar #'sort-body rules))
  +                (accumulated-heads nil))
       (let* ((heads (-<> rules
                       (remove-if-not #'rule-empty-p <>)
                       (mapcar #'rule-head <>)
  -                    (remove-duplicates <> :test #'equal)))
  -           (next-rules (remove-if (lambda (rule)
  -                                    (member (rule-head rule) heads :test #'equal))
  -                                  rules)))
  +                    (remove-duplicates <> :test #'equal)
  +                    (union accumulated-heads <> :test #'equal))) ; slow
  +           (next-rules (remove-if
  +                         (lambda (rule)
  +                           (member (rule-head rule) heads :test #'equal))
  +                         rules)))
         (if (null next-rules)
           (leaf heads)
           (multiple-value-bind (term low high both)
               (partition-rules next-rules)
             (node term
  -                (recur (append (mapcar #'drop-first low) both))
  -                (recur (append (mapcar #'drop-first high) both))
  -                heads))))))
  +                (recur (append (mapcar #'drop-first low) both) heads)
  +                (recur (append (mapcar #'drop-first high) both) heads)))))))
   
   
   ;;;; GraphViz
  
positive.code: 
  
  (adt:defdata rule-tree
    (node t rule-tree rule-tree list)
    (leaf list))
  
  
  
negative.code:   (make-instance 'cl-dot:node
                   :attributes (adt:match rule-tree object
                                 ((leaf heads)
                                  `(:label ,(structural-string heads)
                                    :shape :ellipse))
                                 ((node term _ _)
                                  `(:label ,(structural-string term)
                                    :shape :box)))))
  
  (defmethod cl-dot:graph-object-points-to ((graph (eql 'rule-tree))
                                            (object rule-tree))
    (adt:match rule-tree object
      ((leaf _) nil)
      ((node _ low high)
       (list (attrs high :style :solid)
             (attrs low :style :dashed)))))
  
  