 (deftest test-pseudo-intents
   (with-testing-data [ctx (random-contexts 10 20)]
     (= (set (pseudo-intents ctx))
-       (set (map premise (stem-base ctx)))))
+       (set (map premise (canonical-base ctx)))))
   (is (empty? (pseudo-intents (adiag-context [0 1 2 3]))))
   (is (empty? (pseudo-intents (adiag-context [nil true adiag-context])))))
 

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

(deftest test-stem-base-with-minimal-support-constraints
  (with-testing-data [ctx stem-base-test-contexts
                      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))))

(def canonical-base-test-contexts [contexts/test-ctx-01,
                                   contexts/test-ctx-04
                                   contexts/test-ctx-07,
                                   contexts/test-ctx-08])

(deftest test-canonical-base
  (is (= 1 (count (canonical-base (one-context #{1 2 3 4 5})))))
  (doseq [ctx canonical-base-test-contexts]
    (let [sb (canonical-base ctx)]
      (is (minimal-implication-set? sb))
      (is (sound-implication-set? ctx sb))
      (is (complete-implication-set? ctx sb))
