diff --git a/src/main/clojure/conexp/fca/lattices.clj b/src/main/clojure/conexp/fca/lattices.clj index 3d9e43ac..4dcd0dd6 100644 --- a/src/main/clojure/conexp/fca/lattices.clj +++ b/src/main/clojure/conexp/fca/lattices.clj @@ -461,6 +461,18 @@ (let [B+D (intersection B D)] [(attribute-derivation ctx B+D) B+D])))))) +(defn generated-sublattice [lat generators] + "Computes the sublattice of the specified lattice with the specified set of generators." + (let [lat-join (sup lat) + lat-meet (inf lat)] + (loop [X generators] + (let [X-new (clojure.set/union (into #{} (for [a X b X] (lat-join a b))) + (into #{} (for [a X b X] (lat-meet a b))))] + (if (= X X-new) (make-lattice X lat-meet lat-join + (recur X-new))))) +) + + ;;; nil