Template:Studies of Euler diagrams/transformations/potula basori/dh
Appearance
This code uses the Python library discrete helpers. from discretehelpers.a import logic_str_vector
from discretehelpers.sig_perm import SigPerm
from discretehelpers.boolf.examples import potula, basori
potula_clan_triples = potula.ec_clan(5)
assert potula_clan_triples.get_block_from_label(basori) == [(0, 0, 5), (2, 5, 5)]
# signed permutations based on first two entries in triples
sigperm_a = SigPerm(pair=(0, 0))
sigperm_b = SigPerm(pair=(2, 5))
assert sigperm_a.sequence_string(5) == '(0, 1, 2, 3, 4)'
assert sigperm_b.sequence_string(5) == '(2, ~1, 0, 3, 4)'
# the possible combinations (3-subsets of a 5-set)
assert potula_clan_triples.glove_compartment == [
(0, 1, 2), # 0
(0, 1, 3), # 1
(0, 1, 4), # 2
(0, 2, 3), # 3
(0, 2, 4), # 4
(0, 3, 4), # 5 (this one)
(1, 2, 3), # 6
(1, 2, 4), # 7
(1, 3, 4), # 8
(2, 3, 4) # 9
]
# combination based on last entry in triples
atomvals = potula_clan_triples.glove_compartment[5]
assert atomvals == (0, 3, 4)
# signed variations (signed permutations applied on combination)
sigvar_a = sigperm_a.apply_on_vector(atomvals)
sigvar_b = sigperm_b.apply_on_vector(atomvals)
assert logic_str_vector(sigvar_a) == '[0, 3, 4]'
assert logic_str_vector(sigvar_b) == '[4, ~3, 0]'
assert potula.apply(*sigvar_a) == basori
assert potula.apply(*sigvar_b) == basori
##########################################################################################
potula_clan_pairs = potula.ec_clan(5, suppress_abbreviation=True)
assert potula_clan_pairs.get_block_from_label(basori) == [
(0, 60), (0, 84),
(2, 60), (2, 84),
(4, 60), (4, 84),
(6, 60), (6, 84),
(8, 65), (8, 89),
(10, 65), (10, 89),
(12, 65), (12, 89),
(14, 65), (14, 89)
]
example_sigperm = SigPerm(pair=(0, 60))
assert example_sigperm.sequence_string() == '(0, 3, 4, 1, 2)'
assert example_sigperm.inverse == example_sigperm
assert potula.apply_sigperm(example_sigperm) == basori
assert basori.apply_sigperm(example_sigperm) == potula
|