Closures

Closure operators

In mathematics, a closure operator \(\phi\) on a set \(S\) is a function from the power set of \(S\) to itself which is extensive, increasing and idempotent: \(\phi:2^S\rightarrow 2^S\)

such that:

  • \(X \subseteq \phi(X) \subseteq S\)

  • \(X \subseteq Y \Rightarrow \phi(X) \subseteq \phi(Y)\)

  • \(\phi(\phi(X))=\phi(X)\)

Applying a closure operator

[2]:
closure = NumericalClosure(min_element=0, max_element=9)
[3]:
closure(elements={0, 1, 4})
[3]:
0..4
[4]:
list(closure(elements={0, 1, 4}))
[4]:
[0, 1, 2, 3, 4]
[5]:
a = closure(elements={3, 5})
b = closure(elements={2, 4})
[6]:
a
[6]:
3..5
[7]:
b
[7]:
2..4
[8]:
[8]:
2..5
[9]:
closure(a, b, elements={7})
[9]:
2..7

Get the universe \(S\)

[10]:
[10]:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[11]:
0 in closure()
[11]:
True
[12]:
20 in closure()
[12]:
False
[13]:
[13]:
10

Closure systems (Moore family)

In mathematics, a Moore family (or a closure system) is a family of subsets of a set \(S\) containing \(S\) and closed by set intersection. It can be defined by a closure operator. They can be seen as lattices of closed sets and in this sense, our Moore family definition class creates sub-lattices of the Moore family that would have been generated with the initial closure operator.

Defining a Moore family

[15]:
family.extend(
    [
        closure(elements={1, 2, 3}),
        closure(elements={2, 3, 4}),
    ],
)
[16]:
[16]:
[0..9, 1..4, 1..3, 2..4, 2..3]

Drawing the Hasse diagram of a Moore family

[17]:
from galactic.algebras.poset.renderer import HasseDiagram
[18]:
HasseDiagram(family)
[18]:
../../../_images/notebooks_algebras_closure_notebook_21_0.png

Note the presence of the \(1..4\) closed set which is the result of the join between \(1..3\) and \(2..4\): \(1..3 \vee 2..4\) (this Moore family is a sub-lattice of the global Moore family generated from the closure operator).

Getting the underlying closure operator of a Moore family

[19]:
family_closure = family.closure()
[20]:
family_closure(elements={1})
[20]:
1..3
[21]:
closure(elements={1})
[21]:
1..1
[22]:
family.extend([closure(elements={1})])
[23]:
HasseDiagram(family)
[23]:
../../../_images/notebooks_algebras_closure_notebook_28_0.png
[24]:
family_closure(elements={1})
[24]:
1..3
[25]:
new_family_closure = family.closure()
[26]:
new_family_closure(elements={1})
[26]:
1..1

Measuring a Moore family

[27]:
family.global_stability
[27]:
0.9766845703125
[28]:
family.global_logarithmic_stability
[28]:
0.586037538336511
[29]:
family.global_information
[29]:
1.5370318565210717
[30]:
family.global_entropy
[30]:
0.15370318565210717
[31]:
for stability in family.logarithmic_stabilities():
    print(stability.closed, round(stability.value, 3))
∅ 1.0
2..3 0.5
1..1 0.0
2..4 0.226
1..3 0.138
1..4 0.075
0..9 0.591