       (sg/connect! (sp-ts sp) (sp-ts child-sp))
       (schedule-increase! (sp-ts sp)))    
     (channel/publish! (:child-channel sp) child-sp)))
+
 (defn list-children        [s] (channel/publications (:child-channel s)))
+
 (defn subscribe-children!  [s w] (channel/subscribe! (:child-channel s) w))
 
+
 (defn subsuming-sps        [s] (keys (:subsuming-sp-set s)))
+
 (defn add-subsuming-sp! [s subsuming-sp]
   (util/assert-is (canonical? s))
   (util/assert-is (canonical? subsuming-sp))                     

(defn sp-ts [sp]
  (let [ts-atom (:ts-atom sp)]
    (or @ts-atom (reset! ts-atom (make-tree-summarizer sp)))))
;; Canonical SPs are Atomic and Pair; wrappers use TS of inner SP.
(defn- canonicalize [sp] (:ts-sp (sp-ts sp)))
(defn- canonical? [sp] (identical? sp (canonicalize sp)))

(defn publish-child! [sp child-sp]
  (when child-sp			

              (fn [subsuming-child]
                (let [can-subsuming-child (canonicalize subsuming-child)]
                  (when (= (:name can-child) (:name can-subsuming-child))
                    (add-subsuming-sp! can-child can-subsuming-child))))))))))))


(defn refine-input    [s ni]
  (when-let [ret ((:ri-fn s) s ni)]
    (util/assert-is (= (:name s) (:name ret)))
    (when (canonical? s) (add-subsuming-sp! ret s))
    ret))
  

(defn- terminal? [sp]
  (and (empty? (list-children sp))
       (not (summary/live? (sg/summary sp)))))
