Logic

The zigzags a formula can draw

Let truth be any number from 0 to 1, and Łukasiewicz's connectives turn every formula in one variable into a graph. Every graph that appears is a zigzag of straight pieces with whole-number slopes, ending at 0 or 1 — and McNaughton proved in 1951 that every such zigzag appears. A logic of degrees of truth turns out to be a theory of piecewise-linear functions with integer coefficients.

Worth reading first: No table of truth values is enough · The middle that is not excluded.

Classical logic has two truth values, and every formula in it is a truth table: a function from the truth values of its variables to a truth value. With two values and one variable there are only four such functions, and all four are definable. Jan Łukasiewicz, in Warsaw in 1920, added a third value for statements about the future that are not yet settled, and by 1930, with Alfred Tarski, he had a logic in which a truth value could be any real number from 00 to 11.

The connectives of that logic are arithmetic. Negation sends pp to 1−p1 - p. Strong disjunction, p⊕qp \oplus q, adds the two values and caps the sum at 11. Strong conjunction, p⊙qp \odot q, adds them, subtracts one, and floors the result at 00. The weak connectives p∧qp \wedge q and p∨qp \vee q are the minimum and the maximum. Implication, p→qp \to q, is min⁡(1,1−p+q)\min(1, 1 - p + q), which the essay on Gödel’s chains drew beside Gödel’s own rule on the same square. Every one of these is a formula in the logic, and with negation and strong disjunction alone the others can be written.

So a formula in one variable pp is a function on the interval: put in the truth value of pp, get out the truth value of the formula. The question this essay answers is which functions occur. The answer is a theorem of Robert McNaughton’s from 1951, and it is one of the cleanest characterisations in logic: exactly the continuous functions made of finitely many straight pieces, each piece a line with whole-number coefficients.

Six formulas on the interval of truth values. Graphs on [0, 1] of six one-variable formulas of Łukasiewicz logic, each a zigzag of whole-number slopes with values 0 or 1 at the ends.
Fig. 1 Six formulas in one variable, graphed as the formula’s truth value against the truth value of pp: pp itself, its negation 1−p1 - p, strong disjunction p⊕p=min⁡(1,2p)p \oplus p = \min(1, 2p), strong conjunction p⊙p=max⁡(0,2p−1)p \odot p = \max(0, 2p - 1), a formula whose graph is a tent peaking at one half, and the weak conjunction p∧¬p=min⁡(p,1−p)p \wedge \neg p = \min(p, 1 - p). Every graph is a zigzag of straight pieces with whole-number slopes, and every one is 00 or 11 at both ends.

The six graphs show what the connectives do to shapes. Negation reflects a graph top to bottom. Strong disjunction of a formula with itself doubles its slope and cuts it off at one; strong conjunction doubles its slope and cuts it off at nought. Weak conjunction and disjunction take the lower or upper of two graphs, which creates corners where they cross. Starting from the diagonal line pp and applying these operations, every graph is built from straight pieces, and every slope is a whole number — doubling a slope of one gives two, never one and a half.

Two of the graphs deserve a closer look. The tent (p⊕p)⊙¬(p⊙p)(p \oplus p) \odot \neg(p \odot p) is 00 at both ends and 11 in the middle: it says “pp is about half true”, in the sense that it is fully true exactly when pp is exactly half true and falls away linearly on either side. The weak conjunction p∧¬pp \wedge \neg p — “pp and not pp” — is classically a contradiction, always false. Here it reaches one half at p=12p = \tfrac12. In Łukasiewicz’s logic a contradiction is not always fully false, and the law of excluded middle, p∨¬pp \vee \neg p, is not always fully true: at p=12p = \tfrac12 it is one half.

Every function a small formula draws

To see what McNaughton’s theorem says, the figure below enumerates every formula up to a size and keeps every function it finds.

Every function a small formula draws. New one-variable functions by smallest formula size, 0 to 9, on a logarithmic scale: 3002 functions, all zigzags with whole-number slopes and intercepts.
Fig. 2 Every function of one variable that a formula with up to nine connectives defines, counted by the size of its smallest formula, on a logarithmic scale: 3,002 in all. In every one, each straight piece has a whole-number slope and its line a whole-number intercept; the most pieces any has is six; and neither p/2p/2 nor the constant 12\tfrac12 ever appears.

The census builds formulas from pp by applying the five connectives in every possible way, computes each one’s values exactly at every multiple of 1/25201/2520 — the values stay whole numbers over 25202520 under every connective, so no rounding enters — and discards a formula whose function has been seen before. With nine connectives there are 3,002 different functions.

Every one of them has the same two properties. Each straight piece of its graph has a whole-number slope, and the line containing the piece crosses the vertical axis at a whole number. That second condition is the less obvious one and the more important. It is what forces every formula to be 00 or 11 at p=0p = 0 and p=1p = 1: a line with whole-number slope and intercept takes whole-number values at whole-number inputs. And it is what rules out the function p/2p/2, whose slope is a half, and the constant function 12\tfrac12, whose intercept is a half.

McNaughton’s theorem says these conditions are not only necessary but sufficient. A function on the interval is defined by some formula of Łukasiewicz’s logic exactly when it is continuous, made of finitely many straight pieces, and each piece lies on a line with whole-number coefficients. In several variables the statement is the same, with planes in place of lines. The census confirms the easy direction on 3,002 examples; the hard direction, that every such function is reached, is McNaughton’s construction.

Why nothing else can appear

The easy half of McNaughton’s theorem is an induction, and it is short enough to give in full, because it explains why the conditions are exactly these. The variable pp is the line xx, with slope one and intercept nought. Negation turns a function ff into 1−f1 - f, which negates every slope and turns every intercept cc into 1−c1 - c — whole numbers stay whole. Weak conjunction and disjunction take the minimum or maximum of two functions, which creates new corners where the graphs cross but uses only pieces already present. Strong disjunction takes min⁡(1,f+g)\min(1, f + g): on each region where both are straight, f+gf + g is straight with slope and intercept the sums of theirs, and capping at one adds the constant piece 11. Strong conjunction does the same with max⁡(0,f+g−1)\max(0, f + g - 1).

Every operation sends pieces with whole-number coefficients to pieces with whole-number coefficients, so every formula’s graph has them. Continuity is preserved in the same way, since every operation is continuous. The induction is the whole proof of the easy direction, and it shows that the conditions are not a coincidence of the connectives chosen: they are what the arithmetic of adding, subtracting and capping at whole numbers preserves.

That is also why the logic differs so sharply from the two logics this subject looked at before. The constructive logic gives up excluded middle by changing what truth is — a statement is true when there is evidence for it — and keeps two-valued arithmetic at every stage of knowledge. Łukasiewicz’s logic keeps excluded middle as a formula and lets it be partly true. The two answer the same complaint about classical logic in incompatible ways, and the constructive system’s disjunction property has no counterpart here: a disjunction in Łukasiewicz’s logic is a value rather than a choice, and even p∨¬pp \vee \neg p is not always fully true, so there is no side to pick.

What a formula can say at a fraction

The integer condition has a consequence that can be checked point by point.

The values a formula can take at a fraction. Histograms of the values of all enumerated one-variable formulas at p = 1/2, 1/3 and 2/5: only the multiples of 1/2, 1/3 and 1/5 occur.
Fig. 3 The value at p=12p = \tfrac12, 13\tfrac13 and 25\tfrac25 of every function the census found. At p=a/bp = a/b only the multiples of 1/b1/b occur, and every one of them does. So no formula is a third true when pp is half true, and none is half true when pp is fully true.

At p=12p = \tfrac12, every formula takes one of the values 00, 12\tfrac12 or 11. At p=13p = \tfrac13, one of 00, 13\tfrac13, 23\tfrac23, 11. At p=25p = \tfrac25, a multiple of 15\tfrac15. The reason is the integer condition again: a line mx+cmx + c with whole mm and cc, evaluated at x=a/bx = a/b, gives (ma+cb)/b(ma + cb)/b, a whole number of bb-ths. So the truth values a formula can produce from a given input are fixed by that input’s denominator.

That gives the logic a curious economy of expression. There is no formula that means “half as true as pp”. There is no constant formula that is half true — the logic has names for falsehood and truth and for nothing in between, so every intermediate truth value has to come from a variable. And the values a formula can reach from p=12p = \tfrac12 are exactly 00, 12\tfrac12 and 11, which is the reason the three-valued logic Łukasiewicz began with in 1920 sits inside the infinite-valued one as the formulas’ behaviour on the points 00, 12\tfrac12, 11.

Building a tent

The hard direction of McNaughton’s theorem is a construction, and its building blocks are tents.

Tents at one half and one third, built from formulas. The tent functions peaking at 1/2 and 1/3, each defined by the smallest formula the search found (4 and 8 connectives).
Fig. 4 The tent functions that rise from nought to one at p=12p = \tfrac12 and at p=13p = \tfrac13 and fall back with slope 22 and 33. The search through every formula found the smallest defining each: four connectives for the tent at one half and eight for the tent at one third.

A tent at a rational point a/ba/b is the function max⁡(0,1−∣bp−a∣)\max(0, 1 - |bp - a|): nought away from a/ba/b, rising with slope bb to 11 at a/ba/b, falling with slope bb beyond. It satisfies McNaughton’s conditions, so some formula must define it, and the search finds the smallest. The tent at one half needs four connectives, (p⊕p)⊙¬(p⊙p)(p \oplus p) \odot \neg(p \odot p). The tent at one third needs eight:

(p⊕(p⊕p))⊙¬((p⊕p)⊙(p⊕(p⊙p))).\big(p \oplus (p \oplus p)\big) \odot \neg\Big(\big(p \oplus p\big) \odot \big(p \oplus (p \odot p)\big)\Big).

McNaughton’s proof shows that every allowed zigzag is a sum of tents of this kind at suitable points — a decomposition familiar from approximation theory, where such tents are called Schauder hats — and that the sums and truncations of tents can all be expressed with ⊕\oplus, ⊙\odot and ¬\neg. The search shows what the construction costs in small cases. The tent at one third, though simple to describe, is beyond any formula of seven or fewer connectives; the formulas known for tents at points with larger denominators are larger still, and their size is the price of saying “exactly a third true” in a language that has no fractions.

Two variables: a surface of flat pieces

In two variables the formulas become surfaces over the square of truth-value pairs, and the theorem’s planes become visible.

Two formulas over the square of truth values. Shaded maps over [0,1]² of Łukasiewicz implication and of strong equivalence, 1 − |p − q|, each made of flat pieces.
Fig. 5 Two formulas in two variables over the square of truth values, shaded from pale (nought) to dark (one). Left, Łukasiewicz’s implication, which is one wherever p≤qp \le q and falls by the excess of pp over qq elsewhere. Right, the strong equivalence (p→q)⊙(q→p)(p \to q) \odot (q \to p), which comes out exactly as 1−∣p−q∣1 - |p - q|. Each surface is made of flat pieces meeting along lines with whole-number coefficients.

The implication is fully true in the upper-left half, where p≤qp \le q, and below the diagonal it is a tilted plane, 1−p+q1 - p + q. The strong equivalence of pp and qq is a roof along the diagonal: fully true when p=qp = q and falling linearly with their difference. It is 1−∣p−q∣1 - |p - q|, one minus the distance between the two truth values. The logic carries its own measure of how nearly two statements agree, and that measure is the ordinary distance on the line.

That observation is the start of the modern understanding of the logic. In 1958 Alan Rose and J. Barkley Rosser proved that Łukasiewicz’s axioms capture exactly the formulas that are fully true at every point of the interval, and Chen Chung Chang gave an algebraic proof the next year through MV-algebras, which he had just introduced — the structures that stand to Łukasiewicz’s logic as Boolean algebras stand to classical logic. Daniele Mundici showed in 1986 that MV-algebras are the same thing, in disguise, as ordered groups of real-valued functions with a distinguished positive element — which is why the formulas are piecewise linear with integer coefficients: they are the functions such an ordered group can produce from its generators.

Three ways to conjoin degrees of truth

Łukasiewicz’s strong conjunction is one of three natural ways to combine two degrees of truth into the degree of their conjunction, and the comparison clarifies what is special about it. Gödel’s way takes the minimum, so a conjunction is exactly as true as its weaker part; the chains of truth values that refuted every finite table were Gödel’s. The product way multiplies, as if the two degrees were independent probabilities. Łukasiewicz’s way adds and subtracts one, so two statements each four-fifths true make a conjunction three-fifths true: the shortfalls from full truth add up.

Each choice has its own implication — the largest value whose conjunction with pp stays below qq — and its own logic, and Petr Hájek showed in 1998 that all three are extensions of one basic logic of continuous conjunctions. Among the three, only Łukasiewicz’s has a negation that undoes itself, ¬¬p=p\neg\neg p = p, and only Łukasiewicz’s makes every formula a continuous function; Gödel’s implication jumps along the diagonal. Lotfi Zadeh’s fuzzy sets of 1965 brought all three into engineering, where they are used to blend rules stated in words, and the debate over which conjunction is right for which purpose is a debate about which accounting of partial truth fits the application.

The surprising connection: a guessing game with lies

The most unexpected place this logic turns up is a parlour game. Stanisław Ulam asked in his autobiography of 1976 how many yes-or-no questions are needed to find a number between one and a million if the answerer may lie once, or twice. With no lies the answer is twenty, by halving. With lies, each answer must be treated as provisional, and the questioner has to keep track not of which numbers are possible but of how many answers each number would have to have been lied about.

Mundici showed in 1992 that the questioner’s state of knowledge in Ulam’s game with kk lies is exactly a valuation in Łukasiewicz’s logic with k+2k + 2 truth values. Each number carries a truth value measuring how many lies it would require — nought lies is fully true, too many is fully false, and in between the values step down by 1/(k+1)1/(k + 1) — and each answer updates every number’s value by a strong conjunction with the answer’s truth function. The rules of the logic, which look like an arbitrary choice of arithmetic for an arbitrary choice of connective, are the bookkeeping of a game in which information arrives with a bounded amount of error. The strong conjunction, adding and subtracting one, is exactly the act of charging a number one more lie.

So a logic invented to give future contingents a third truth value, extended by Łukasiewicz and Tarski to a continuum for no reason except that it could be, turns out to be the native logic of searching with errors — and the reason its connectives are what they are is the reason a sum of lies is a sum.

The easy half of McNaughton’s theorem, checked on 3,002 functions

The census reaches nine connectives; McNaughton’s theorem is about all formulas. Every one of the 3,002 functions satisfies the integer conditions, which confirms the easy half of the theorem on examples. The hard half — that every function satisfying the conditions is reached by some formula — is visible only for the two tents the search found, and for the rest it is the construction in McNaughton’s paper, not anything a finite search can show.

The functions are sampled at multiples of 1/25201/2520. Formulas with up to nine connectives have their corners at rational points with small denominators, and the sampling grid catches all of them that matter for the census, but a corner at a point like 1/111/11 falls between grid points. The census treats such a corner as a one-step transition and checks the straight pieces on either side; a reader wanting certainty about every corner would compute the breakpoints exactly, as the theorem does.

A truth value between nought and one is not a probability. The interval of truth values invites the reading that a statement half true is a statement with a fifty per cent chance of being true. Łukasiewicz’s logic is not a theory of chance: the truth value of p∧¬pp \wedge \neg p at one half is one half, whereas the probability of a statement and its negation both holding is always nought. The pictures draw degrees of truth, and the arithmetic of degrees is not the arithmetic of probabilities.

Still open: what the formulas cost

McNaughton’s theorem settles which functions are definable. It does not settle how large the defining formulas must be, and that question is still being worked out. The search found that the tent at one third needs eight connectives where the tent at one half needs four; for a tent at a point with denominator bb, the smallest formula’s size is not known exactly, and the known constructions use formulas whose size grows with bb in ways that are not known to be optimal. More generally, given a zigzag with many pieces, the smallest formula that defines it — the logic’s version of the circuit-size questions of classical logic — has no formula of its own, and good bounds are known only for special families. It is the many-valued counterpart of asking how many gates a truth table needs, and like that question it is far easier to pose than to answer.

There is also a question one level up. Łukasiewicz’s logic is decidable, and deciding whether a formula is always fully true is a hard problem in the sense of complexity — Mundici proved in 1987 that it is exactly as hard as the classical question of whether a formula is a tautology — a harder problem in principle than its two-valued look suggests, and no harder than the search through finite algebras that decides constructive logic. What lies between this logic and classical logic is a family of intermediate logics, each a class of MV-algebras, and while those between Łukasiewicz’s and classical logic are classified, the full picture of how the many-valued logics fit around the constructive and classical ones has not been drawn.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A dashed tag is an object no other essay names yet.

AlgebraCharacterisationCompletenessExhaustive searchExpressive powerMany valued logicNormal formPiecewise-linearTruth functionTruth table