 (defn- connect-and-watch-ts! [p c out-f]
   (summaries/connect! p (sp-ts c))
   (if (get-output-set c)
-    (do (out-f c) false)
+    (do (out-f) false)
     (do (add-output-watcher! c out-f) true)))
 
 (defn- add-sp-child! [sp child-sp up?]

    (when (canonical? s)
      (summaries/connect! (sp-ts s) (sp-ts c))
      (when (get-output-set s) (summaries/summary-changed! (sp-ts s)))) ;; TODO: remove this overhead from atomic.   
    (when (get-output-set s) (doseq [w (doall (seq child-watchers))] (swap! *out-count* inc) (w s c))))

  (subsuming-sps [s] (keys subsuming-sp-set))
  (add-subsuming-sp! [s subsuming-sp]
    (util/assert-is (= nm (sp-name subsuming-sp)))                 
    (when-not (.containsKey subsuming-sp-set subsuming-sp)
      (.put subsuming-sp-set subsuming-sp true)

  (util/assert-is (= (state/current-context s1) (state/current-context s2)) "%s" [s1 s2])
  (= s1 s2))

;; Note: must always wrap (at least with SA), or we lose context.
;; TODO: only :Atomic or :Pair inside, when SA off 
;;(defn wrapper? [sp] (#{:OC :SA} (first (sp-name sp))))
;; (comment  (if (wrapper? child-sp) child-sp (make-output-collecting-subproblem fs child-sp)))


(defn atomic-name-fs [n] (util/match [[:Atomic ~fs] n] fs))
(defn log-input [fs inp-set] (if *state-abstraction* (fs/get-logger fs inp-set) inp-set))
