J-ottings 15
Vector 14:3, page 56
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 56
And now for something totally logical — meaningless maybe, but logicians don’t give a toss about that! I am indebted to Eddie Clough for setting me off on a trail through one of the more entrancing by-roads of J.
This piece is about sorties into sorites, which, in case you didn’t know, is a word which means a string of related premises, for example:
No Vector reader eats porridge.
All Englishmen are Vector readers.
No devolutionist ever declines porridge.
Sorites are much associated with Lewis Carroll who published a stream of delightful nonsense in the format, the gist of which is: given the truth or falsity of a compound premise such as "p1 and p2 and p3" where p1, p2 and p3 are simple premises such as those above,
(i) what combinations of truth and falsity in the elementary propositions which underlie the premises are required to legitimise the sorites?
(ii) what further true premises can be made?
A nice feature of J is b. which, in spite of being called an adverb, takes as its argument an integer in the range 0 to 15 (actually _15 to 15 with modulo 16 conversion) and produces the corresponding logical binary verbs. The most familiar binary verbs are
complemented with the unary operator
The argument of b. when rendered as a four-bit binary number can be read as the truth table of the corresponding verb, interpreting 0/1=false/true, and reading the truth table entries as corresponding to the proposition value pairs 00, 01, 10 and 11. (The b. verbs can also be used monadically, in which case the result is the same as for a left argument of zero in the binary case.)
The complete set of sixteen logical operations is given in the following table in which ' represents "not", ∧ represents "and", and alternative meanings are given in some cases, for example 7 and 11.
| 0 False | 4 a′∧b | 8 nor, a′∧b′ | 12 a′ |
| 1 and, a∧b | 5 b | 9 eq, = | 13 imp, a=>b, b′=>a′ |
| 2 a∧b′, (a=>b)′ | 6 xor, not= | 10 b′ | 14 a=>b′, b=>a′ |
| 3 a | 7 or, b′=>a, a′=>b | 11 b=>a, a′=>b′ | 15 True |
Observe the distinction between the verbs False and True and the values false and true. The former always return the latter, regardless of their arguments.
Symbolically the premises in the above sorites, in terms of elementary propositions are:
A: is a Vector reader
B: is an Englishman
C: favours devolution
D: eats porridge
and using this condensation, the sorites can be summarised
A imp not D
B imp A
C imp D
Write the compound proposition
Now ask question (i) above, namely — what combinations of true/false values of A, B, C and D are consistent with the truth of s1? At this point digress to consider a verb which generates a list of the first i.2^y. binary numbers:
For presentation purposes it is more convenient to transpose this, hence the verb bintab:
bintab=.|:@binlis NB. binary numbers in ordered columns
]b4=.bintab 4 NB. list of (i.2^4) as 4-digit binary numbers
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
b4 is not only a representation in binary form of the integers i.16, it is also an array whose columns in order are the truth tables as described above for the sixteen logical verbs, and whose rows correspond to four propositions, all of whose combinations of truth and falsity are represented in the array. Remembering that b. provides all possible logical verbs, the truth of any logical operation involving two propositions can be obtained by selecting two rows, and applying the required operation. For example the logical "and" of the first and third rows is given by
A nice device is to define
so that the above operation is simply A and C, and s1 above now becomes a directly executable verb:
which can be extended to include the proposition combinations by using a hook with ,
(,s1) b4
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 1 0 1 0 0 0 0 1 0 0 0 1 0 0 0
It is useful also to be able to select only those columns for which s1 is true, or alternatively only those for which s1 is false. Recalling that s1 is a verb, this suggests the following adverbs to qualify such premise verbs:
true=.1 : '#"1~x.' NB. adverb gives cols for which x. true
false=.1 :'#"1~(not x.) NB. adverb gives cols for which x. false
s1 true b4
0 0 0 1 1
0 0 0 0 1
0 0 1 0 0
0 1 1 0 0
which says in substantive terms that s1 is confirmed provided Vector readers neither favour devolution nor eat porridge (cols. 4/5), porridge eaters are neither English nor read Vector (cols. 2/3), and there are no English devolutionists.
Question (ii) concerns what further information can be deduced. Confining attention to pairs of propositions, the original three premises connected AD, CD and AB respectively. In order to make statements about the other three proposition pairs, namely AC, BC and BD (glimmerings perhaps of artificial intelligence here!), first convert a string such as 'AB' into numerical indices, and then apply these to the columns of s1 true b4. Upper-case characters are selected by
and the conversion and indexing processes by
Now determine which of the columns of the truth table for two propositions are represented in the above columns:
Converting this binary number to a decimal integer gives the index of the logical verb which applies to A and C, which can be incorporated into a verb which locates the truth table number for a given pair of propositions:
that is A=>C', or in words, no Vector readers are devolutionists. For the record, the other conclusions are that Englishmen don’t favour devolution either, nor do they eat porridge.
It is a minor irritation that the array b4 has to be set up in advance, since as far as I am aware, there is no mechanism in J which allows the body of a verb to be analysed as a text string. One possible way around this is to duplicate the premise as a character string and count the number of capitals:
Here is another sorites:
There is no sense in this article.
Whatever is not sensible is intolerable.
J users are invariably tolerable.
for which the elementary propositions can be represented:
A : uses J
B : is this article
C : is intolerable
D : is sensible
The compound premise defining the above is:
from which it can be concluded that:
which is perhaps better not translated!