   (:use [conexp.base :only (not-yet-implemented, def-)]
         [conexp.fca.implications :only (premise conclusion)]))
 
-;;;
+;;; Implementation
 
-(defn implication-graph [base-set implications]
+(defn implication-graph [implications]
   (let [implications     (vec implications),
         where-in-premise (reduce (fn [map [i impl]]
                                    (reduce (fn [map m]

              _ (println numargs)]
          (recur queue numargs (into result new)))))))

;;;

(do

  (def- testing-implications #{(make-implication '#{p_3 p_4} '#{p_5})
                               (make-implication '#{p_1} '#{p_2})
                               (make-implication '#{p_2} '#{p_1})
                               (make-implication '#{p_3} '#{p_4})
                               (make-implication '#{}    '#{p_3})})

  (def- network (implication-graph '[p_1 p_2 p_3 p_4 p_5]
                                   testing-implications))

  nil)

;;;


                                       (map (comp count premise) implications)))]
    [implications where-in-premise numargs]))

(defn close-with-downing-gallier [[implications in-premise numargs] input-set]
  (let [numargs                    (reduce (fn [numargs i]
                                             (update-in numargs [i] dec))
                                           numargs
                                           (mapcat in-premise input-set))
        empty-premise-implications (map first
                                        (filter (fn [[i c]] (zero? c))
                                                numargs))]
    (loop [queue   (into (clojure.lang.PersistentQueue/EMPTY)
                         empty-premise-implications),
           numargs numargs
