Gottlob: Write Code in Frege's Concept Notation

In 1879, Gottlob Frege wrote the Begriffsschrift, an attempt at a logically perfect language. Begriffsschrift is often translated to "concept-script," essentially a formula language, an arithmetic for pure thought. It was intended as a "system of evaluation that will make it a mechanical task, once an inference is expressed, to determine whether or not it is correct and gapless," as Joan Weiner puts it in Frege Explained.

This new system clarified and dispelled ambiguities of language that had seeped into logical analysis, making it easier to differentiate logical relationships apart from the content of the specific claim being investigated, more or less founding the movement of analytical philosophy. However, where Frege's legacy was huge, his notation system was never widely adopted. Frege saw it as simple, but others found the bars and the mix of German and Greek characters overly ornate. Only a few disassociated symbols from Frege's system are still in use, such as the turnstile ⊢ operator in symbolic logic, meaning "provable." But there it has been stripped of its context: in Frege's system, it sits at the upper left of all his diagrams (see the two images above), serving as an entry point to an assertion and the propositions used to evaluate it. So granular was Frege's design, he ascribed meaning to both its marks. A horizontal line alone refers to a combination of ideas, it's the vertical mark that indicates that the resulting combination can hold a truth value.

While the notation system may not been practical, it is a Turing Complete system that could theoretically work as a programming language. Matthew Dockrey, intrigued by its aesthetic while investigating Frege for a book, decided to actually implement this concept-script as a runnable language. He named it Gottlob, continuing the tradition established by Piet of adopting its subject's first name, when their last name has already used for a rather boring, non-esoteric language. Dockrey describes it as if from an alternate computer history:

To not only watch someone inventing a modern logic system from scratch, but to come up with such a unique formalism in the process really captivated me. I immediately started thinking about what it would have been like if his notation had caught on... I really wanted this to feel like something from a different timeline, so I tried to stay as faithful to Frege's paper as possible... Even when it came to quote marks for strings, I went with the central European chevrons instead of English "inverted commas", just to make as clean a break from established conventions as possible.

The basic unit of expression in a Gottlob program is a judgment, hewing close to Frege's intent for the script. As the Gottlob documentation explains:

All statements, when evaluated in a logical context, result in a judgment. This judgment can only ever be one of two values: affirmed, or denied. This would be called a "truth value" in our universe, being either true or false.

A language describing a problem rather than listing steps to execute points to a functional model, but Gottlob is still very different from any language designed for practical programming. Asked what problems Gottlob might be particularly suited to solve, Dockrey suggests it may work better for more investigatory research tasks ("in a kind of Matlab/R type way") than straight-up programming.

The representation of logic is quite unusual. Frege, unlike his contemporary Boole, gives us only two logical operators to work with: the material conditional (if) and negation. The material conditional is expressed like so:

In modern notation, this is B ⊃ A, "if B then A". Note that the base, in the bottom branch (B) supports the assertion (A).

It is also essential to not get confused about the meaning of "if" here. The material conditional is used as a logical operator, not to conditionally run commands. If B is not true, the B ⊃ A assertion cannot be denied, as the lack of B does not conflict with B ⊃ A. It is only denied if A is true and B isn't. This makes the expression equivalent to !B || A.

We can apply the other logical operator, Negation, (or ¬B in modern symbolic logic), the unary NOT. Frege expresses this with a short vertical mark. The following means ¬B ⊃ A (and is equivalent to B || A):

Negation can also be applied to A itself, or to the expression as a whole:

B ⊃ ¬A or !(B && A) ¬(B ⊃ ¬A) or B && A

In this way, conditionality and negation supply the whole range of boolean logical conditions. When one visualizes the entire program as relationships between individual judgments, this approach becomes more intuitive.

The equivalent of variables are Letters, which are always represented in German Fraktur typeface, to differentiate with Greek letters, which are in a plainer typeface and used only for functions. Gottlob's program editor has a menu to insert each expression and helpfully puts the input into the correct typeface, presenting the program back to the user as a png.

The other language features are explained clearly in the language specification, but for a taste of how a complete program looks, this is the preset "Generality demo", which builds a matrix with the first five multiples of five:

Its output:

1

2

3

4

5

[5,10,15,20,25]

affirmed

True to the Begriffsschift, the program ends with an affirmation of the claim at stake.

There is a deeper irony at work in making a programming language from Frege's concept-script. Frege extended his logical system in the two-volume Grundlagen, situating mathematics on axiomatic assertions. Just before publishing the second volume of this work, Bertrand Russell found a weakness in the system which would haunt Frege for the rest of his life. Russell showed that one could construct a version of the Liar's Paradox in it, a self-contradictory statement, essentially the "set of all sets that don't include themselves as a member," which includes itself if it is excluded, or excludes itself if it is included: rejecting both assertion or denial.

Gödel would later show that any such system, including the one Russell co-designed with Whitehead, had the same flaw, in his infamous Incompleteness Theorem. Gödel leads us to Turing, whose "On Computable Numbers" describes a universal machine in order to prove that not only is mathematics incomplete and/or inconsistent (as Gödel had proven), but undecidable; i.e. there are problems that can not be solved through mechanical means. As M Beatrice Fazi puts it, "The founding paradox of computer science is that it is a field defined by what it cannot do, rather than by what it can do."

Frege's system is thus a remnant of a more idealistic era, where mathematics was safely ensconced in logic. Yet Dockrey, in implementing it as a programming language, brings it into a world of programming that would be very different if its ambitions had not been proven illusory. Dockrey gives us a glimpse into an alternate world where Frege's notation had become the norm, and perhaps his idealism had remained so.