Skip to content

Commit

Permalink
Implemented Function for Generating Sublattice from Generators. (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikNordmeyer authored Jun 6, 2024
1 parent 3a64bf3 commit 3492d4b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/clojure/conexp/fca/lattices.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3492d4b

Please sign in to comment.