Discrete helpers/set part comp

This class extends (SetPart) with a complement relationship between the blocks of equivalent elements.

This can be used to save equality and complement relationships between arguments of Boolean functions (Boolf).

The initial object in the following example has three blocks. The first two of them are complements.

domain
The domain is the set of integers, including the negative ones. (This is different from SetPart, where the domain can be changed, and is N  by default.) This class was developed to deal with the blight of a Boolean function. That includes blotted Boolean functions, where the arguments can be equal or complementary to the universe, which is represented by &minus;1.

In this Boolean function the set C is empty, and thus complementary to the universe. C is represented by 2. So 2 and &minus;1 are complements.

In this Boolean function the set H is equal to the universe. H is represented by 7. So 7 and &minus;1 are in the same block.

related set partition
is a derived SetPart, where complementary blocks are merged. There are related methods like.

set equal and complement
merges the blocks containing the elements a and b. makes them complementary.

This example shows how an object is changed with the  and   methods.

In the image blocks are marked with black borders, and complementary blocks are connected by (solid) red lines.

The changes are marked with dotted lines. The thick ones are the change explicitly demanded. The thin dotted lines are changes that implicitly follow. (This is because the complement of a complement must be equal.) E.g.  is shown as a thick dotted red line between the singleton 11 and the block containing 20. But the singletons 10 and 11 are already complements, and therefore the 10 must be merged into the block containing 20. This is marked by the thin dotted green line.

Boolean function
The method  returns a Boolean function (Boolf), which contains the same information. It is only blight. (Its  is the tautology.) If there are no gaps between the affected elements  is equal to.

There is a gap between 3 and 10. But the blight of a  is always a   without gaps. (There is nothing wrong with this. But it could be a source of confusion.)

integer matches
checks if the binary digits of n are equal or different in the way described by x. (This is used for the method bloatless_spotint of Boolf.)