Hacker News new | ask | show | jobs
by adrian_b 33 days ago
Nitpick: TFA discusses binary logic, i.e. logic with only 2 truth values, not Boolean logic, which is a particular form of binary logic, and which does not match the description from TFA.

The innovation brought by George Boole to logic was that he replaced the traditional logical values "true" and "false" with the numbers "1" and "0" and he identified the traditional logical operations with special cases of arithmetic operations.

This allowed him to view certain forms of logical reasoning as solvable by a kind of mechanical computation. Because of this, his work had an important influence on the development of automatic computers.

The modern fashion in computing science of calling a data type with the values "true" and "false" as "Boolean" is a misnomer that has nothing to do with George Boole, and which has its origin in the ALGOL 60 report and in its preliminary variants, which misused the term "Boolean". The IBM FORTRAN IV language did better than ALGOL 60, by calling the data type with "true" and "false" values as "logical", not "Boolean", but unfortunately most later languages used the ALGOL 60 term, not the FORTRAN IV term.

An example of a programming language with true Boolean logic is APL, where the logical truth values are the numbers "1" and "0" (which is very handy in expressing conditional operations on arrays), while all the programming languages that use "true" and "false" do not use Boolean logic, despite claiming to do so.

I agree with TFA that for dealing with most practical situations binary logic is insufficient and ternary logic is the minimal tool, if not using even more complex kinds of logic, like modal logic or probabilistic logic.

1 comments

> An example of a programming language with true Boolean logic is APL, where the logical truth values are the numbers "1" and "0" (which is very handy in expressing conditional operations on arrays), while all the programming languages that use "true" and "false" do not use Boolean logic, despite claiming to do so.

So Bash could be considered the red-headed, left-handed sibling to APL?

In APL, the fact that the truth values are also numbers is exploited by eliminating the need to create a new notation for various kinds of masked array operations, like those implemented in GPUs and in Intel/AMD AVX-512 for providing parallel conditional operations.

In APL and similar languages, applying a relational operator to a combination of vectors, matrices or other kinds of arrays will produce an array of "0" or "1" values, which can then be used in various kinds of array multiplications to select a part of the elements of an array for some kind of operation, e.g. a reduction operation.

This is just a reuse of the notation for arithmetic operations, useful to minimize the number of distinct operator symbols, because a good compiler will not do multiplications by "1" or "0", but it will use SIMD masked operations or blend instructions or conditional move instructions in order to get the same result.