 ;;; Association Rules
 
 (defn support
-  "Computes the support of the set of attributes B in context ctx. If an implications is given,
-  returns the support of this implication in the given context."
+  "Computes the support of the set of attributes B in context ctx. If an
+  implications is given, returns the support of this implication in the given
+  context."
   [thing ctx]
   (cond
-   (set? thing)
-   (if (empty? (objects ctx))
-     1
-     (/ (count (attribute-derivation ctx thing))
-        (count (objects ctx)))),
-   (implication? thing)
-   (recur (premise thing) ctx),
-   :else
-   (illegal-argument "Cannot determine support of " (print-str thing))))
+    (set? thing)
+    (if (empty? (objects ctx))
+      1
+      (/ (count (attribute-derivation ctx thing))
+         (count (objects ctx)))),
+    (implication? thing)
+    (recur (premise thing) ctx),
+    :else
+    (illegal-argument "Cannot determine support of " (print-str thing))))
 
 (defn confidence
   "Computes the confidence of the given implication in the given context."


(defn canonical-base-from-clop
  "Given a closure operator «clop» on the set «base», computes its canonical base,
   optionally using the set «background-knowledge» of implications on «base-set» as
   background knowledge.  The result will be a lazy sequence.  If «predicate» is given as
   third argument, computes only those implications whose premise satisfy this predicate.
   Note that «predicate» has to satisfy the same conditions as the one of
   «next-closed-set-in-family»."
  ([clop base]
     (canonical-base-from-clop clop base #{} (constantly true)))
  ([clop base background-knowledge]

;;; Proper Premises

(defn proper-conclusion
  "Returns all elements which are implied in context ctx by A but are neither
  contained in A or follow from a strict subsets of A."
  [ctx A]
  (difference (context-attribute-closure ctx A)
              (reduce into
