# Fifty Shades of J/Chapter 16

Table of Contents ... Glossary ... Previous Chapter ... Next Chapter

## Contents

### Principal Topics

- #: (anti-base) b. (Boolean), |: (transpose), syllogism, predicate, Boolean verbs, tautology, contradiction.

### Seek Truth and Expand Knowledge

Two overriding goals of scientific method are to seek truth and to expand knowledge – this article shows how do both, admittedly in the restricted context of propositions and binary relations.

### Propositions and definitions

First consider propositions such as

No Vector reader eats haggis |

All Americans are Vector readers |

No American ever rejects haggis |

Each of these has the form of a subject and a predicate connected by a copula (‘is’), for example the subject of the first is a Vector reader and the predicate is a haggis eater. Such propositions include an implicit quantifier (“For all ..”) or (“There exists ...”), and are assertions of which a clear binary judgement can be made, true or false. If three such propositions are such that the third (called the conclusion) is logically deducible from the first two (called the premisses), the resulting set is called a syllogism. In the English language the word ‘predicate’ has two meanings. Examples of the second meaning are

A | He is a Vector reader |

B | He is an American |

C | He eats haggis |

In this sense a predicate is an assertion containing a variable (in these examples ‘he’) and thus true/false judgements are variable dependent. A list of columns representing as binary digits the numbers from 0 to 2^{y} is given by

binlist=:monad : '|:#:i.2^y' ]t3=.binlist 3 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

The columns of `t3` collectively represent all possible selections of 3 binary digits with repetition allowed. In another view `t3` is a list of lists, each of which contains 2^{y} binary digits in equal proportions of 0s and 1s. Use these lists to model predicates and define verbs which select from the top level 3-list

A=:0&{ B=:1&{ C=:2&{ A t3 0 0 0 0 1 1 1 1

### The Boolean Verbs

`b.` is an unusual quantity. It is not an adverb but behaves somewhat like one, only its argument is an integer (noun) rather than a verb. `b.` is the common basis of a set of strongly related verbs which perform binary calculations. `b.` with no argument means `0 b.` , so for practical purposes a numeric argument must be present as in

and=:1 b. or=:7 b. (1 and 0);(1 or 0) ┌─┬─┐ │0│1│ └─┴─┘

Each binary verb such as `and` and `or` has a 2 by 2 truth table with four entries, e.g.

0 1 and/0 1 0 0 0 1

so that there are a total of 2^{4}=16 distinct truth tables whose ravels correspond to the binary representations of 0 to 2^{y} and provide the numbering scheme for the arguments of `b.`

binlist 4 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

A list of the regularly used binary verbs is

and=:1 b. or=:7 b. imp=:13 b. NB. implies eq=:9 b. NB. equals xor=:6 b. NB. exclusive or (same as not equal) nand=:14 b. NB. not and nor=:8 b. NB. not or

to which add the verbs

true=:15 b. NB. all 1s regardless false=:0 b. NB. all 0s regardless left=:3 b. NB. ignore right argument right=:5 b. NB. ignore left argument

Combining these with the selection verbs above gives, e.g.

(A and B)t3 0 0 0 0 0 0 1 1

which is a ravelled (that is flattened) 3-dimensional truth table for A,B and C.

### The Special Case of ‘not’

‘not’ is dealt with separately because unlike the other binary verbs it is monadic. A compound verb such as `not A` is a hook in which the result of the selection verb must be processed by monadic `-.` (not) and not by dyadic `-.` (less). Imposing such a constraint is one of the main uses of `[:` (cap)

not=:[:-.] (not A)t3 1 1 1 1 0 0 0 0

Note: without cap the meaning of `not A` is all but the list `A`

(-. A)t3 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

It is now possible to compose logical expressions such as

(B imp(not C))t3 1 1 1 0 1 1 1 0

and to define a complex predicate involving three basic predicates as a verb to be applied to `t3`

P1=.(A imp(not B))and(B imp A)and(B imp C) P1 t3 1 1 0 0 1 1 0 0

### Truth and Falsity Adverbs

It is useful to be able to obtain the columns of `t3` which correspond to 1 (truth) and 0 (falsity) through

T=:adverb : '#"1~x' NB. truth adverb F=:adverb : '#"1~(not x)' NB. falsity adverb (P1 T t3);P1 F t3 ┌───────┬───────┐ │0 0 1 1│0 0 1 1│ │0 0 0 0│1 1 1 1│ │0 1 0 1│0 1 0 1│ └───────┴───────┘

where the first box defines the A, B and C attributes of individuals for whom the three propositions which began this article are consistent, and similarly the second box gives the attributes of those for whom the joint propositions are false.

### Sorites

A sorites is a series of propositions in which the predicate of one is the subject of the next, and the final proposition (conclusion) can be inferred from the rest. Lewis Carroll delighted in constructing nonsense sequences of this sort such as

No ducks waltz |

All my poultry are ducks |

None of my poultry waltz |

As before construct predicates such as:

A | It is a duck |

B | It waltzes |

C | It is one of my poultry |

To confirm that this is a syllogism and thus a sorites, define

P2p=.(A imp(not B))and(C imp A) NB. p=premisses P2c=.C imp (not B) NB. c=conclusion

Then apply `P2c` to those elements of `t3` for which `P2p` is true

P2c P2p T t3 1 1 1 1

which establishes that the set is indeed a syllogism. However same test applied to the earlier set of propositions at the head of this article fails

P1p=.(A imp (not C)) and (B imp A) P1c=.B imp C P1c P1p T t3 1 1 1 0

and the individual which causes failure of the syllogism test is identified by

P1p T t3 0 0 1 1 0 0 0 1 0 1 0 0

that is a Vector-reading American who does not eat haggis.

### Some Technicalities

The list above covers eleven binary verbs. The remaining five in the set are less immediately interesting :

not_left=:12 b. NB. ignore right argument not_right=:10 b. NB. ignore left argument not_imp=:2 b. NB. not of (x implies y) imp_not=:11 b. NB. (not x) implies (not y) not_imp_not=:4 b. NB. not of imp_not

There are 16 fundamental arguments 0 to 15 for `b.`. To these 16 may be added or subtracted without affecting the result so that the permissible argument range covers `_16` to `31`. 32, 33 and 34 are also valid but relate specifically to bit/byte arithmetic (that is modulo two arithmetic discarding remainders), namely 32 (=rotate), 33 (shift) and 34 (signed shift).

### Advancing Knowledge

The discussions so far have been analytic, that is they have consisted in testing combinations for consistency, which does not in itself increase knowledge. However synthetic information concerning relationships which are not directly connected in a single proposition amounts to advancing knowledge from what is already known, and can be obtained by defining

AB=:0 1&{ AC=:0 2&{ BC=:1 2&{ NB. etc., and ]t2=.binlist 2 0 0 1 1 0 1 0 1

whose columns (as rows) correspond in order to the marginal value combinations in the ‘flat’ representation of any of the 16 two by two truth tables. `t2` is used to establish the presence (or absence) of its columns in pairs of rows of a larger truth table, thereby obtaining relationships between the corresponding propositions

whatrel=:monad : '2 #.t2 e.&|:y' P3p=.(A eq B) and (B eq (not C)) whatrel AC P3p T t3 6

6 is the `b.` number for not equal and so the required relation is `A eq (not C)`as is reasonably obvious anyway. For the first set of propositions the B/C relation is given by

whatrel BC P1p T t3 14

that is by `B nand C`, or equivalently

CB=:2 0&{ whatrel CB P1p T t3 13

that is `C imp B`.

### Tautology and contradiction

These are demonstrated by

P4p=.(A eq B)or (B eq (not A)) whatrel AB P4p T t2 15 P5p=.(A eq B)and (A xor B) NB.xor=synonym for not equals whatrel AB P5p T t2 0

### Further possibilities

Applying the syllogism test to

All men are good |

All men are loyal |

All women are bad |

using

A | It is a man |

B | It is good |

C | It is loyal |

gives

P6p=.(A imp B) and (A imp C) P6c=.(not A) imp (not B) P6c P6p T t3 NB. syllogism test 1 1 0 0 1

which fails for the reasonably obvious reason that the premisses say nothing about women (i.e. not-men). Also there is no explicit connection between goodness and loyalty

whatrel BC P6p T t3 15

that is, goodness and loyalty are synonymous for men (tautology). However

P6=.(A imp B) and (A imp C) and ((not A)imp(not B)) whatrel BC P6 T t3 13 NB. says goodness implies loyalty whatrel CB P6 T t3 11 NB. says disloyalty implies badness

These last two results do not rule out the possibility of badness and loyalty occurring together (in a woman) as is made explicit by

P6p T t3 0 0 0 0 1 0 0 1 1 1 0 1 0 1 1

Makes you think…!!

### Code Summary

binlist=:monad : '|:#:i.2^y' NB. bin nos to 2^y in cols A=:0&{ NB. select first B=:1&{ C=:2&{ and=:1 b. or=:7 b. imp=:13 b. NB. implies eq=:9 b. NB. equals xor=:6 b. NB. exclusive or nand=:14 b. NB. not and nor=:8 b. NB. not or true=:15 b. NB. all 1s regardless false=:0 b. NB. all 0s regardless left=:3 b. NB. ignore right argument not_left=:12 b. NB. ignore right argument not_right=:10 b. NB. ignore left argument not_imp=:2 b. NB. not of (x implies y) imp_not=:11 b. NB. (not x) implies (not y) not_imp_not=:4 b. NB. not of imp_not right=:5 b. NB. ignore left argument T=:adverb : '#"1~x' NB. truth adverb F=:adverb : '#"1~(not x)' NB. falsity adverb AB=:0 1&{ NB. select first two AC=:0 2&{ BC=:1 2&{ whatrel=:monad : '2 #.t2 e.&|:y' NB.what relation no? t2=.binlist 2