Day 12 · 2026.07.04

Logic & Proof

From "what is true" to "how truth is proved" — and the inner limits of formal systems
"Logic is the hygiene of mathematics." — a maxim among mathematicians: logic produces no theorems, but keeps reasoning from rotting.

Propositional Logic

The syntax of inference
Logic
Intuition

The deepest point about logic: it studies not "what is true" but "how truth necessarily yields truth." "All A are B; x is A; therefore x is B" — this inference is valid no matter what A, B, x actually mean. Strip away all the content and only the skeleton of form remains, and validity lives only in the skeleton.

The raw materials are "propositions" — statements that are true or false — and four connectives: AND ($\land$), OR ($\lor$), NOT ($\neg$), IMPLIES ($\to$). The truth table is the multiplication table of logic: given the truth of the parts, the truth of the whole is computed mechanically. Here logic first becomes something computable.

Truth table of implication p → q p q p → q TTT TFF FTT FFT
Formal definition

Propositional variables $p,q,\dots$ take values true/false. Implication can be defined as $p \to q \equiv \neg p \lor q$ — "$p$ implies $q$" is equivalent to "either $p$ is false, or $q$ is true." This explains the table's most counterintuitive row: when the premise is false, the implication is always true (an empty promise is never broken). A formula true under every assignment is a tautology — a law that always holds, in the logical sense.

Why it's beautiful

The real shock is a triple isomorphism: inference, switching circuits, and set operations are three faces of the same structure. $\land$ corresponds to series circuits and to set intersection; $\lor$ to parallel circuits and union; De Morgan's law $\neg(p\land q)\equiv\neg p\lor\neg q$ is at once a logical law, a circuit-simplification rule, and a set identity. This shared skeleton is Boolean algebra. When Boole said "the laws of thought can be operated on like algebra," he never imagined that a century later it would become the physical blueprint of every CPU.

Applications

Digital circuits: a single NAND gate can build all of logic, and a whole processor is nothing but propositional logic realized in silicon. SAT solvers — deciding whether a pile of logical constraints can all be satisfied at once — are the core engine of chip verification, software testing, and scheduling, and SAT was the first problem proved NP-complete. A compiler's type checking and a database's predicate pushdown all run propositional logic underneath.

Essence + question
Logic doesn't tell you what the world is like; it only guarantees: if the premises are true, the conclusion cannot be false.
Question: "If $2+2=5$, then the moon is made of cheese" — by the truth table, this is true. Why does this "material implication" run against the everyday causal sense of "if…then"? What does this crack reveal about the nature of formal logic?

Predicate Logic

First-Order Logic · the skeleton of mathematical language
Logic
Intuition

Propositional logic has a fatal muteness: it cannot say "for all" or "there exists." "All primes are greater than 1" is just an indivisible atom to it. Predicate logic fills this gap — it introduces quantifiers "for all $x$" ($\forall x$), "there exists $x$" ($\exists x$), and predicates $P(x)$ that carry variables ("$x$ is prime").

With just this one extension, logic can suddenly write down all of mathematics. The skeleton of a claim like "every number has a successor" is entirely a weaving of quantifiers and predicates. Predicate logic is the invisible grammar in a mathematician's head when writing rigorous statements.

Formal definition

$\forall x\,P(x)$ means "for every $x$ in the domain, $P(x)$ holds"; $\exists x\,P(x)$ means "at least one $x$ makes $P(x)$ hold." The core difficulty is the order of nested quantifiers:

$$\forall x\,\exists y\,(y>x) \quad\not\equiv\quad \exists y\,\forall x\,(y>x)$$

The left says "every number has a larger one" (true); the right says "there is a number larger than all numbers" (false over the naturals). Same symbols, swap the order, and truth flips.

Why it's beautiful

Almost the entire secret of mathematical rigor hides in quantifier order. The $\varepsilon$–$\delta$ definition of a limit, $\forall\varepsilon\,\exists\delta\,\forall x\,(\dots)$, took two centuries for Cauchy and Weierstrass to polish precisely because human intuition struggles with three order-dependent quantifiers: "first give me any small $\varepsilon$, then I find $\delta$." Reading quantifier order precisely is nearly the same as reading mathematics — the difference between continuity and uniform continuity is just two quantifiers changing places.

Applications

SQL queries are essentially predicate logic: `WHERE` is a predicate, `EXISTS`/`ALL` are quantifiers, and relational database theory is built directly on first-order logic. Prolog lets you "write facts and rules, and the machine reasons automatically." Proof assistants Lean and Coq use first-order (and higher-order) logic to formalize all of mathematics. AI knowledge representation, automated theorem proving, and program specifications (pre/postconditions) all take predicate logic as their lingua franca.

Essence + question
Add "for all" and "there exists," and logic leaps from judging single sentences to writing all of mathematics.
Question: "Everyone loves someone" — is it $\forall x\,\exists y\,\text{loves}(x,y)$ or $\exists y\,\forall x\,\text{loves}(x,y)$? The two readings (each has their own beloved / there is one universal darling) differ by a hair. Can you feel that the ambiguity of natural language is exactly what formal logic aims to abolish?

Gödel's Incompleteness Theorems

The ceiling of formal systems
Metamathematics
Intuition

Picture the sentence: "This sentence cannot be proved." If it can be proved, it is false — the system has proved a falsehood and collapses. If it cannot be proved, it is exactly right — so it is true, yet the system cannot prove it. What Gödel did in 1931 was translate this self-referential sentence into a pure arithmetic statement about integers.

The trick is "Gödel coding": assign every symbol, formula, and proof a unique number. Then "some formula is provable" becomes "some number has a certain arithmetic property." The system is forced to begin talking about itself — the liar paradox acquires, for the first time, a mathematical body.

Formal definition

First incompleteness theorem: any consistent formal system $T$ that can express basic arithmetic and whose axioms can be mechanically enumerated contains a sentence $G$ such that $T$ can prove neither $G$ nor $\neg G$ — $G$ is undecidable (while, metamathematically, it is true).
Second incompleteness theorem: such a $T$ cannot prove its own consistency $\mathrm{Con}(T)$ from within. A system that could prove "I am consistent" would thereby already be inconsistent.

Why it's beautiful

This is the deepest "look in the mirror" in the history of mathematics. Hilbert's grand dream was to mechanize all of mathematics: one set of axioms proving every truth and proving its own freedom from contradiction. Gödel shattered that dream from inside the system — "true" always exceeds "provable." The real beauty is not that it's a failure, but its revelation: incompleteness is not anyone's lack of cleverness, but an inborn limit of any sufficiently rich formal system. It is one of three faces of a single coin, along with Turing's halting problem and Tarski's undefinability of truth — once self-reference is strong enough, a system cannot fully grasp itself.

Applications

Its direct descendant is the halting problem: no program can decide whether an arbitrary program halts — so there is no "perfect universal bug detector," and programs cannot fully verify themselves, drawing a hard boundary on decidability in software engineering. In AI, the split between "true" and "provable" reminds us: however powerful a formal system (or model), there are true statements it cannot in principle reach; interpretability and alignment cannot expect a system to give complete formal guarantees about itself.

Essence + question
Any formal system rich enough to talk about itself cannot be both complete and consistent — there are always truths it can state but not prove.
Question: we seem able to "see" that $G$ is true, yet the system cannot prove it. Penrose and Lucas argue from this that "the mind transcends machines." But is our "seeing" just standing inside a stronger system — which then has its own $G$? Is this really transcendence, or merely moving the ceiling up one floor?

Formalization & Machine Proof

When a proof becomes the mechanical manipulation of symbols
Foundations
Intuition

A mathematical proof is usually "an argument that convinces one's peers" — carrying intuition, omissions, and "clearly it follows." Formalization pushes this to the extreme: a proof becomes a string of symbols, each step either an axiom or mechanically derived by explicit rules from earlier steps. Meaning is stripped away entirely, leaving only form — and the proof thereby becomes an object a machine can check character by character.

This seems to squeeze the soul out of mathematics; in fact the opposite: it gives "is this proof correct?" its first verdict that depends on no authority. The judge of truth passes from human conviction to the checking of rules.

Formal definition

A formal system = an alphabet + a syntax of well-formed formulas + some axioms + finitely many inference rules (the classic being modus ponens: from $p$ and $p\to q$, infer $q$). A proof is a finite sequence of formulas in which each item is either an axiom or follows from earlier items by some rule; the last item is the theorem proved. Deciding "is this sequence a valid proof?" is a purely syntactic, mechanically executable process.

Why it's beautiful

The deepest beauty is the Curry–Howard correspondence: a proof is a program, a proposition is a type. "Proving $A\to B$" and "writing a function that turns an input of type $A$ into an output of type $B$" are the same thing; running a program corresponds to simplifying a proof. Logic, computation, and types — three domains seemingly belonging to philosophy, engineering, and linguistics — are isomorphic at the bottom. This is why modern proof assistants are also programming languages: to them, checking a proof and running code were never different.

Applications

Lean and Coq have fully mechanically verified giant proofs "hard for humans to check line by line," such as the four-color theorem and the Kepler sphere-packing conjecture; Terence Tao is using Lean to formalize frontier papers. In engineering, the OS kernel seL4 and the C compiler CompCert have been formally verified to "mathematically guarantee the absence of certain bugs," for zero-tolerance settings. Blockchain smart contracts and cryptographic protocols increasingly rely on formal verification to plug costly logical holes.

Essence + question
Turn a proof into a machine-checkable symbol game and the certainty of mathematics reaches its peak — at the cost of leaving "understanding" and "belief" outside the door for now.
Question: a machine verifies a hundred-thousand-line proof you could never finish reading, and declares it flawless. Do you "know" the theorem is true? Is that "knowing" the same as the "knowing" you get from deriving it line by line yourself? Can certainty and understanding be divorced?

Deeper Reflections

Open Questions · pushing the boundary
Why can "true" exceed "provable" — isn't that a contradiction?
"Provable" is a syntactic fact inside the system: there exists a rule-abiding sequence of formulas. "True" is a semantic fact about a model (e.g. the standard naturals). The Gödel sentence $G$ is true in the standard model, but the axioms can't grasp it syntactically — because there also exist "non-standard models" that satisfy all axioms yet make $G$ false, and the system can't rule out these ghost models. Truth exceeding provability is, at bottom, semantics being richer than syntax.
Are Gödel's, Turing's, and Tarski's three "impossibilities" the same thing?
They share one engine: diagonalization plus self-reference. Gödel — an unprovable true statement; Turing — an undecidable halting problem; Tarski — a system cannot define its own "truth" predicate internally. All three make a system talk about "everything that can talk about itself," then construct an object that escapes that range, forcing a contradiction. Cantor's proof that the reals are uncountable uses the very same move.
Do large language models "reason"? How do they relate to formal logic?
An LLM's reasoning is statistical: it has learned the shape of reasoning, with no built-in reliability guarantee — it will output "proofs" that look rigorous but skip steps. Formal systems are the opposite: every step is mechanically verifiable, but they won't "think of" the next step themselves. The two are naturally complementary — use an LLM to generate candidate proofs and intuition, and Lean/Coq for zero-tolerance checking. This replays the issue's main theme: discovery (by intuition) and verification (by form) are two different abilities.
If consistency can't be self-proved, why trust that mathematics won't collapse?
The second incompleteness theorem cuts off the path of "a system proving its own consistency from within." We can still prove a weaker system's consistency in a stronger one (Gentzen 1936 proved arithmetic's consistency using transfinite induction). But this only pushes trust up a level — the strongest layer can never self-certify. In the end our confidence in consistency is partly empirical (over a century of intense use with no contradiction), not purely logical: certainty has its humble bottom line.