   "Dualizes given lattice lat."
   [lat]
   (let [order (order lat)]
-    (make-lattice-nc (base-set lat) (fn [x y] (order [y x])))))
+    (make-lattice-nc (base-set lat) (fn [x y] (order y x)))))
 
 (defn distributive?
   "Checks (primitively) whether given lattice lat is distributive or not."

  (intersection (lattice-sup-irreducibles lat)
                (lattice-inf-irreducibles lat)))


;;; FCA


    (make-lattice-nc base-set (fn [x y] (contains? order [x y])))))

(defmethod make-lattice-nc [clojure-coll clojure-fn] [base-set order]
  (let [inf (memoize (fn inf [x y]
                       (loop [elements base-set]
                         (let [z (first elements)]
                           (if (and (order z x)
                                    (order z y)
                                    (forall [a base-set]
                                      (=> (and (order a x) (order a y))
                                          (order a z))))
                             z
                             (recur (rest elements))))))),
        sup (memoize (fn sup [x y]
                       (loop [elements base-set]
                         (let [z (first elements)]
                           (if (and (order x z)
                                    (order y z)
                                    (forall [a base-set]
                                      (=> (and (order x a) (order y a))
                                          (order z a))))
                             z
                             (recur (rest elements)))))))]
    (make-lattice-nc base-set order inf sup)))

(defmethod make-lattice-nc [clojure-coll clojure-fn clojure-fn] [base-set inf sup]
  (make-lattice-nc base-set
                   (fn [x y] (= y (sup x y)))
                   inf
                   sup))

(defmethod make-lattice-nc [clojure-coll clojure-fn clojure-fn clojure-fn]
  [base-set order inf sup]
  (Lattice. (set base-set) order inf sup))

(defmethod make-lattice-nc :default [& args]
  (illegal-argument "The arguments " args " are not valid for a Lattice."))
