    [(simple-subproblem
      stub out-set terminal? ;; Note ni may have different context.
      (fn [s ni]
-       (if (= ni (input-set stub)) stub (with-subsuming-sp! s (ri-fn s ni)))))]
+       (if (= ni (input-set stub))
+         stub
+         (let [subsumed-stub (ri-fn s ni)]
+           (add-subsuming-ts! (tree-summarizer subsumed-stub) (tree-summarizer stub))
+           subsumed-stub))))]
    summaries/Summarizable (summarize [s] (summary-fn s))))
 
 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Used by stubs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn- with-subsuming-sp! [subsuming-sp stub]
  (when subsuming-sp
    (summaries/connect-subsumed! (sp-ts subsuming-sp) (tree-summarizer stub)))
  stub)

;; TODO: set stub to -inf here, simplify other code? 
;; TODO: efficiency?

        ret))))

;; Note, potential to learn about additioan lsubsumption here, however, must be taken into account.
;; TODO: name does not match wrapping names.
(defn- make-pair-stub1 [nm left-stub right-stub-fn]
  (if-let [left-sp (get-stub-output left-stub)]
    (make-pair-stub2 left-sp (right-stub-fn (output-set left-sp)))
