Recently, Brandon Wilson posted a nice article discussing a nice article discussing a way in which APL's algebraic properties absolutely shine.
A table is presented in the article, where the sixteen — or twelve(1) — Boolean functions are mixed with the four functions 0∘⍪
, 1∘⍪
, ⍪∘0
and ⍪∘1
and used in a pairwise reduction, which has the effect of identifying certain properties of groups in a Boolean vector. Some of the entries, however, appear quite redundant after considering the relations that the sixteen Boolean functions have between each other.
Here are the entries from the article's table which I consider important, with descriptions changed to be more —er— descriptive, formatted as a Dyalog session.
_F_←{2⍵⍵⌿⍺⍺ ⍵}
⊢Y←(0 1 1 1 0 0 0 0)(0 1 1 1 0 0 0 1)(1 1 1 1 0 0 0 0)(1 1 1 1 0 0 0 1)
0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1
0∘⍪_F_<¨Y
0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1
1∘⍪_F_<¨Y
0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
⍪∘1_F_>¨Y
0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0
⍪∘0_F_>¨Y
0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1
0∘⍪_F_∧¨Y
0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0
1∘⍪_F_∧¨Y
0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
⍪∘0_F_∧¨Y
0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0
⍪∘1_F_∧¨Y
0 1 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 1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1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0
0∘⍪_F_=¨Y
1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 0
⍪∘1_F_=¨Y
0 1 1 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 0 1
⍪∘0_F_=¨Y
0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 0
⍪∘0_F_⊢¨Y
1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 0
⍪∘1_F_⊢¨Y
1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1
0∘⍪_F_⊣¨Y
0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0
1∘⍪_F_⊣¨Y
1 0 1 1 1 0 0 0 1 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0
"Head", "last", "tail" and "init" are used here to mean the first, last, all but first and all but last elements of a group respectively. [a] and [b] respectively indicate that the functions ignore either 0s or 1s at the beginning/end (as appropriate) of the sequence.
The sixteen Boolean that I have been talking about are these (left argument first column, right argument first row)
The entries are suggestively numbered according to the base-2 decode of the ravel of the 2x2 result matrix.
Some of these functions have matching operators in TMN(2). Obviously there's ∧ (∧
) and ∨ (∨
), and the complementary (with symbols somewhat uncommon in TMN) ∧ or ↑ (⍲
) and ∨ or ↓ (⍱
), then there is ⊻ or ⊕ (≠
acting as an exclusive or) and the opposite ⇔ or ↔ (=
acting as the biconditional), but also ⇒ or → (≤
, which is equivalent to logical implication).
Because of the nature of Booleans, each of these functions can be constructed by negating another (specifically, the negated N-th function is the same as the (15 - N)-th function). This means that, for example, 2∘(>⌿)1∘⍪
, the function that finds the heads of 0-groups, negates to 2∘(≤⌿)0∘⍪
, what Wilson calls "not 0-group head". This allows for a great simplification of the big table that appears in the article, equipped with the knowledge of the sixteen Boolean functions and their relations.
Of course, there are many more relations to be found. The possibility of negating each of the two arguments, as well as the result, gives 7 different relation types, ignoring the identity, of which today I only considered one. Finding the numerical relation is trivial, but linking it back to the group-identifying algorithms we have been considering throughout the article may not be. Other possibilities might involve combining both two Boolean functions and their result on groups with a third function.