Formal concept analysis #
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 #
- [Davey, Priestley Introduction to Lattices and Order][davey_priestley]
- [Birkhoff, Garrett Lattice Theory][birkhoff1940]
Tags #
concept, formal concept analysis, intent, extend, attribute
Lower and upper polars #
Intent and extent #
A set is an extent when either of the following equivalent definitions holds:
- The
lowerPolarof itsupperPolaris itself. - The set is the
lowerPolarof some other set.
The latter is used as a definition, but one can rewrite using the former via IsExtent.eq.
Equations
- Order.IsExtent r s = (s ∈ Set.range (lowerPolar r))
Instances For
Alias of the forward direction of Order.isExtent_iff.
A set is an intent when either of the following equivalent definitions holds:
- The
upperPolarof itslowerPolaris itself. - The set is the
upperPolarof some other set.
The latter is used as a definition, but one can rewrite using the former via IsIntent.eq.
Equations
- Order.IsIntent r t = (t ∈ Set.range (upperPolar r))
Instances For
Alias of the forward direction of Order.isIntent_iff.
Concepts #
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.
- extent : Set α
The extent of a concept.
- intent : Set β
The intent of a concept.
The intent consists of all elements related to all elements of the extent.
The extent consists of all elements related to all elements of the intent.
Instances For
Define a concept from an extent, by setting the intent to its upper polar.
Equations
- Concept.ofIsExtent r s hs = { extent := s, intent := upperPolar r s, upperPolar_extent := ⋯, lowerPolar_intent := ⋯ }
Instances For
Define a concept from an intent, by setting the extent to its lower polar.
Equations
- Concept.ofIsIntent r t ht = { extent := lowerPolar r t, intent := t, upperPolar_extent := ⋯, lowerPolar_intent := ⋯ }
Instances For
Note that if r' is the ≤ relation, this theorem will often not be true!
Equations
Alias of Concept.extent_max.
Alias of Concept.intent_min.
Equations
Equations
Equations
- Concept.instLattice = { toSemilatticeSup := Concept.instSemilatticeSup, inf := SemilatticeInf.inf, inf_le_left := ⋯, inf_le_right := ⋯, le_inf := ⋯ }
Equations
- Concept.instBoundedOrderConcept = { top := Concept.ofIsExtent r Set.univ ⋯, le_top := ⋯, bot := Concept.ofIsIntent r Set.univ ⋯, bot_le := ⋯ }
Equations
- Concept.instInfSet = { sInf := fun (S : Set (Concept α β r)) => Concept.ofIsExtent r (⋂ i ∈ S, i.extent) ⋯ }
Equations
- Concept.instSupSet = { sSup := fun (S : Set (Concept α β r)) => Concept.ofIsIntent r (⋂ i ∈ S, i.intent) ⋯ }
Equations
- One or more equations did not get rendered due to their size.
Swap the sets of a concept to make it a concept of the dual context.
Equations
Instances For
The dual of a concept lattice is isomorphic to the concept lattice of the dual context.
Equations
- Concept.swapEquiv = { toFun := Concept.swap ∘ ⇑OrderDual.ofDual, invFun := ⇑OrderDual.toDual ∘ Concept.swap, left_inv := ⋯, right_inv := ⋯, map_rel_iff' := ⋯ }