                            contexts/test-ctx-04,
                            contexts/test-ctx-07,
                            contexts/test-ctx-08]]
-    (is (forall [P (subsets (attributes ctx))]
-          (<=> (proper-premise? ctx P)
-               (not (empty? (proper-conclusion ctx P))))))))
+    (forall [P (subsets (attributes ctx))]
+      (<=> (proper-premise? ctx P)
+           (not (empty? (proper-conclusion ctx P)))))))
 
 (deftest test-proper-premises-for-attributes
   (with-testing-data [ctx (random-contexts 10 20),

             (impl 1 2 4 ==> 0 3)}))))

(deftest test-stem-base-with-minimal-support-constraints
  (with-testing-data [ctx [contexts/test-ctx-01,
                           contexts/test-ctx-04
                           contexts/test-ctx-07,
                           contexts/test-ctx-08]
                      mis [0 1/5 1/3 1/2 4/5 1]]
    (= (set (filter #(<= mis (support % ctx))
                    (canonical-base ctx)))

    (is (sound-implication-set? ctx irr-subset))
    (is (complete-implication-set? ctx irr-subset))))

(defvar stem-base-test-contexts [contexts/test-ctx-01,
                                 contexts/test-ctx-04
                                 contexts/test-ctx-07,
                                 contexts/test-ctx-08])

(deftest test-stem-base
  (is (= 1 (count (stem-base (one-context #{1 2 3 4 5})))))
  (doseq [ctx stem-base-test-contexts]
    (let [sb (stem-base ctx)]
      (is (minimal-implication-set? sb))
      (is (sound-implication-set? ctx sb))
      (is (complete-implication-set? ctx sb))
      (is (let [premises (map premise sb)]
            (forall [X premises]
              (forall [Y premises]
                (=> (proper-subset? Y X)
                    (proper-subset? (adprime ctx Y) X)))))))))

(deftest test-stem-base-with-background-knowledge
  ;; make sure implications with empty premise are handled correctly
