Back to Index Page

On Wilson's "On Hsu's Suggestivity and Idioms"

#apl#idioms

Madeline Vergani

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 ⍝ head of 1-groups
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 ⍝ head of 1-groups, except at start
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 ⍝ last of 1-groups
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 ⍝ last of 1-groups, except at end
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 ⍝ tail of 1-groups
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 ⍝ tail of 1-groups, including start
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 ⍝ init of 1-groups
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 ⍝ init of 1-groups, including end
0 1 1 0 0 0 0 0  0 1 1 0 0 0 0 1  1 1 1 0 0 0 0 0  1 1 1 0 0 0 0 1

      1_F_>¨Y ⍝ head of 0-groups
1 0 0 0 1 0 0 0  1 0 0 0 1 0 0 0  0 0 0 0 1 0 0 0  0 0 0 0 1 0 0 0 
      0_F_>¨Y ⍝ head of 0-groups, except at start
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 0 0 1 0 0 0 
      1_F_<¨Y ⍝ last of 0-groups
1 0 0 0 0 0 0 1  1 0 0 0 0 0 1 0  0 0 0 0 0 0 0 1  0 0 0 0 0 0 1 0 
      0_F_<¨Y ⍝ last of 0-groups, except at end
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 0 
      1_F_¨Y ⍝ tail of 0-groups
0 0 0 0 0 1 1 1  0 0 0 0 0 1 1 0  0 0 0 0 0 1 1 1  0 0 0 0 0 1 1 0 
      0_F_¨Y ⍝ tail of 0-groups, including start
1 0 0 0 0 1 1 1  1 0 0 0 0 1 1 0  0 0 0 0 0 1 1 1  0 0 0 0 0 1 1 0 
      1_F_¨Y ⍝ init of 0-groups
0 0 0 0 1 1 1 0  0 0 0 0 1 1 0 0  0 0 0 0 1 1 1 0  0 0 0 0 1 1 0 0 
      0_F_¨Y ⍝ init of 0-groups, including end
0 0 0 0 1 1 1 1  0 0 0 0 1 1 0 0  0 0 0 0 1 1 1 1  0 0 0 0 1 1 0 0

      0_F_¨Y ⍝ head of groups [a]
0 1 0 0 1 0 0 0  0 1 0 0 1 0 0 1  1 0 0 0 1 0 0 0  1 0 0 0 1 0 0 1 
      1_F_¨Y ⍝ head of groups [b]
1 1 0 0 1 0 0 0  1 1 0 0 1 0 0 1  0 0 0 0 1 0 0 0  0 0 0 0 1 0 0 1 
      0_F_¨Y ⍝ last of groups [a]
1 0 0 1 0 0 0 0  1 0 0 1 0 0 1 1  0 0 0 1 0 0 0 0  0 0 0 1 0 0 1 1 
      1_F_¨Y ⍝ last of groups [b]
1 0 0 1 0 0 0 1  1 0 0 1 0 0 1 0  0 0 0 1 0 0 0 1  0 0 0 1 0 0 1 0 
      1_F_=¨Y ⍝ tail of groups [a]
0 0 1 1 0 1 1 1  0 0 1 1 0 1 1 0  1 1 1 1 0 1 1 1  1 1 1 1 0 1 1 0 
      0_F_=¨Y ⍝ tail of groups [b]
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 ⍝ init of groups [a]
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 ⍝ init of groups [b]
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 ⍝ shift left, insert 0
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 ⍝ shift left, insert 1
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 ⍝ shift right, insert 0
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 ⍝ shift right, insert 1
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)

0: 0⍨01
000
100
1: 01
000
101
2: >01
000
110
3: 01
000
111
4: <01
001
100
5: 01
001
101
6: 01
001
110
7: 01
001
111
8: 01
010
100
9: =01
010
101
10: ~⊢01
010
110
11: 01
010
111
12: ~⊣01
011
100
13: 01
011
101
14: 01
011
110
15: 1⍨01
011
111

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 \land () and \lor (), and the complementary (with symbols somewhat uncommon in TMN) \overline\land or \uparrow () and \overline\lor or \downarrow (), then there is \veebar or \oplus ( acting as an exclusive or) and the opposite \Leftrightarrow or \leftrightarrow (= acting as the biconditional), but also \Rightarrow or \rightarrow (, 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.

Footnotes

  1. Wilson excludes the two constant functions and the two negated identities up until the very end of the article.

  2. Traditional math notation, that is, the syntax generally used in mathematics.