       (when (canonical? s) (add-subsuming-sp! ret s))
       ret)))))
 
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Utils  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn- connect-and-watch! [p c out-f child-f]
-  (summaries/connect! p c)
-  (when out-f (add-output-watcher! c out-f))
-  (add-child-watcher! c child-f))
-
-(defn- connect-and-watch-ts! [p c out-f]
-  (summaries/connect! p (sp-ts c))
-  (add-output-watcher! c out-f))
-
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  Constructors  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defn noeval [s] (throw (RuntimeException. (print-str s "not evaluable!"))))
-
-(defn make-wrapped-subproblem [nm inp-set prefix-set inner-sp output-wrap child-watch ri-fn]
-  (util/assert-is (contains? prefix-set (first (sp-name inner-sp))))
-  (let [ret (make-subproblem nm inp-set (sp-ts inner-sp) noeval ri-fn summaries/or-summary)]
-    (connect-and-watch! ret inner-sp
-      (fn [o] (set-output-set! ret (output-wrap o)))
-      (fn [inner-child] (child-watch ret inner-child)))
-    ret))
-
-;; Note: summary-fn should take subsuming-bound into account.
-(defn- make-simple-subproblem [nm inp-set ri-fn eval-fn summary-fn]
-  (make-subproblem nm inp-set nil eval-fn (fn [s ni] (if (= ni inp-set) s (ri-fn s ni))) summary-fn))
-
-;; Get a fresh subproblem with the given name and input.
 (defmulti get-subproblem (fn get-subproblem-dispatch [nm inp] (first nm)))
-
-
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;     Core Subproblems     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;

     (let [nm (pair-name (sp-name left-sp) right-name)
           right-sp (delay (right-sp-fn (get-output-set! left-sp)))
           right?-atom (atom false) ;; Expand on right            
           ri-fn    (fn [s ni] (make-pair-subproblem (refine-input left-sp ni) right-name #(refine-input @right-sp %)))
           ss (summaries/make-sum-summarizer nil)
           go-right! (fn [s] 
                       (reset! right?-atom true)                          

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;     Wrappers     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn make-wrapped-subproblem [nm inp-set prefix-set inner-sp output-wrap child-watch ri-fn]
  (util/assert-is (contains? prefix-set (first (sp-name inner-sp))))
  (let [ret (make-subproblem nm inp-set (sp-ts inner-sp)
                             (fn [_] (throw (RuntimeException.)))
                             ri-fn summaries/or-summary)]
    (connect-and-watch! ret inner-sp
      (fn [o] (set-output-set! ret (output-wrap o)))
      (fn [inner-child] (child-watch ret inner-child)))
    ret))

;;;;;;;;;;;;;;;;;;;;;;;;;;;     Output Collection     ;;;;;;;;;;;;;;;;;;;;;;;;;;

