Formal concept analysis #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines concept lattices. A concept of a relation r : α → β → Prop
is a pair of sets
s : set α
and t : set β
such that s
is the set of all a : α
that are related to all elements
of t
, and t
is the set of all b : β
that are related to all elements of s
.
Ordering the concepts of a relation r
by inclusion on the first component gives rise to a
concept lattice. Every concept lattice is complete and in fact every complete lattice arises as
the concept lattice of its ≤
.
Implementation notes #
Concept lattices are usually defined from a context, that is the triple (α, β, r)
, but the type
of r
determines α
and β
already, so we do not define contexts as a separate object.
TODO #
Prove the fundamental theorem of concept lattices.
References #
Tags #
concept, formal concept analysis, intent, extend, attribute
Intent and extent #
Concepts #
- to_prod : set α × set β
- closure_fst : intent_closure r self.to_prod.fst = self.to_prod.snd
- closure_snd : extent_closure r self.to_prod.snd = self.to_prod.fst
The formal concepts of a relation. A concept of r : α → β → Prop
is a pair of sets s
, t
such that s
is the set of all elements that are r
-related to all of t
and t
is the set of
all elements that are r
-related to all of s
.
Instances for concept
Equations
- concept.has_sup = {sup := λ (c d : concept α β r), {to_prod := (extent_closure r (c.to_prod.snd ∩ d.to_prod.snd), c.to_prod.snd ∩ d.to_prod.snd), closure_fst := _, closure_snd := _}}
Equations
- concept.has_inf = {inf := λ (c d : concept α β r), {to_prod := (c.to_prod.fst ∩ d.to_prod.fst, intent_closure r (c.to_prod.fst ∩ d.to_prod.fst)), closure_fst := _, closure_snd := _}}
Equations
- concept.semilattice_inf = function.injective.semilattice_inf (λ (c : concept α β r), c.to_prod.fst) concept.fst_injective concept.semilattice_inf._proof_1
Equations
- concept.lattice = {sup := has_sup.sup concept.has_sup, le := semilattice_inf.le concept.semilattice_inf, lt := semilattice_inf.lt concept.semilattice_inf, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_sup_left := _, le_sup_right := _, sup_le := _, inf := semilattice_inf.inf concept.semilattice_inf, inf_le_left := _, inf_le_right := _, le_inf := _}
Equations
- concept.bounded_order = {top := {to_prod := (set.univ α, intent_closure r set.univ), closure_fst := _, closure_snd := _}, le_top := _, bot := {to_prod := (extent_closure r set.univ, set.univ β), closure_fst := _, closure_snd := _}, bot_le := _}
Equations
- concept.complete_lattice = {sup := lattice.sup concept.lattice, le := lattice.le concept.lattice, lt := lattice.lt concept.lattice, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_sup_left := _, le_sup_right := _, sup_le := _, inf := lattice.inf concept.lattice, inf_le_left := _, inf_le_right := _, le_inf := _, Sup := has_Sup.Sup concept.has_Sup, le_Sup := _, Sup_le := _, Inf := has_Inf.Inf concept.has_Inf, Inf_le := _, le_Inf := _, top := bounded_order.top concept.bounded_order, bot := bounded_order.bot concept.bounded_order, le_top := _, bot_le := _}
Swap the sets of a concept to make it a concept of the dual context.
Equations
- c.swap = {to_prod := c.to_prod.swap, closure_fst := _, closure_snd := _}
The dual of a concept lattice is isomorphic to the concept lattice of the dual context.
Equations
- concept.swap_equiv = {to_equiv := {to_fun := concept.swap ∘ ⇑order_dual.of_dual, inv_fun := ⇑order_dual.to_dual ∘ concept.swap, left_inv := _, right_inv := _}, map_rel_iff' := _}