Paradoxal Code
A Cabinet of Impossible Logic

Permanent Exhibition № 7 · Ten Specimens · Verdicts Open

Paradoxal
Code

Ten working contradictions from logic, computation, and identity — each one rendered as code that compiles in the mind and then refuses to run. Read the specimen. Then rule on it.

Every specimen ends in a question with two answers: resolved or unresolvable. Your verdict is counted and kept. The running tally is itself a paradox — the more people who declare a thing settled, the less settled it sounds.

Curated for those who like the floor to fall away.

On the method

A paradox is not a mistake. It is a place where two true-looking paths arrive at opposite destinations — and the map was never wrong. We do not resolve them here. We exhibit them.

The Collection

Fig. 01 — 10
01LOGIC

The Liar

Eubulides of Miletus · c. 400 BCE

This statement is false.

A sentence that asserts its own falsehood cannot be assigned either truth value without immediately implying the other. It is the oldest crack in the foundation — proof that a language able to talk about its own truth can tie itself into a knot that no rule of inference will untie.

Cast your verdict

truth-table
s := "this statement is false"

if s is true:
    then s is false   // by what it asserts
if s is false:
    then s is true    // by what it denies

assert truth(s) ∈ { true, false }   // ✗ neither holds

fig. 01 — the contradiction, rendered

02COMPUTATION

The Halting Problem

Alan Turing · 1936

No program can decide whether every program halts.

Assume a perfect oracle that, given any program, decides whether it halts. Feed it a program built to do the opposite of whatever the oracle predicts. The oracle is now wrong about a program it was asked to judge. The contradiction kills the oracle — undecidability is not a gap in our cleverness but a wall in the structure of computation itself.

Cast your verdict

python
def paradox():
    if halts(paradox):   # does paradox() stop?
        while True:       # ...then loop forever
            pass
    else:
        return            # ...then stop

# halts() must answer wrong about paradox()
# therefore halts() cannot exist

fig. 02 — the contradiction, rendered

03LOGIC

Russell's Set

Bertrand Russell · 1901

The set of all sets that do not contain themselves.

Consider the set of all sets that are not members of themselves. Ask whether it contains itself, and either answer entails its opposite. Russell mailed this to Frege as his life's work on the foundations of arithmetic went to press; Frege replied that arithmetic totters. It forced mathematics to rebuild its ground floor.

Cast your verdict

set-theory
R = { x : x ∉ x }

R ∈ R  ⟺  R ∉ R

// if R contains itself, it must not
// if R does not, it must
// naive set theory collapses here

fig. 03 — the contradiction, rendered

04IDENTITY

Ship of Theseus

Plutarch · c. 100 CE

Replace every plank, one by one. Is it the same ship?

A ship has each of its planks swapped for new timber over the years, until nothing original remains. Is it the same ship? Now reassemble the discarded planks into a second ship — which one is the original? Identity over time turns out to have no clean definition, only conventions we agree to honor.

Cast your verdict

javascript
let ship = original
for (const plank of ship.planks) {
  ship = ship.replace(plank, newPlank())
}
// every atom is now different
ship === original   // ?? identity has no operator

fig. 04 — the contradiction, rendered

05COMPUTATION

The Quine

after W.V.O. Quine · 1960

A program whose only output is its own source code.

A quine is a program that takes no input and prints itself exactly. It is not a trick of file-reading — the source is reconstructed from a description of itself held inside itself. Self-reference, the same engine behind the Liar and the Halting Problem, here turns constructive: the paradox of describing yourself, made to compile.

Cast your verdict

python
s = 's = %r\nprint(s %% s)'
print(s % s)

# output is character-for-character
# identical to the source above
# the snake eats precisely its own tail

fig. 05 — the contradiction, rendered

06LANGUAGE

The Heap

Eubulides of Miletus · c. 350 BCE

One grain is not a heap. Adding one never makes a heap. Yet heaps exist.

A single grain of sand is no heap. Adding one grain to a non-heap surely leaves a non-heap. By induction, no number of grains is ever a heap — yet heaps plainly exist. Vague predicates have no sharp boundary, and classical logic, which insists every statement is true or false, cannot model a word like "heap."

Cast your verdict

haskell
isHeap 1            = False
isHeap n | isHeap (n-1) = True   -- +1 grain
         | otherwise    = False

-- induction says nothing is ever a heap
-- the sand on the floor disagrees

fig. 06 — the contradiction, rendered

07LANGUAGE

Berry's Number

G.G. Berry & Russell · 1906

"The smallest number not nameable in fewer than twelve words."

There are finitely many phrases of eleven words or fewer, so some smallest number escapes them all. But "the smallest number not nameable in fewer than twelve words" is itself an eleven-word name for that number. Naming and counting, mixed carelessly, produce a number that defines and undefines itself in the same breath.

Cast your verdict

definition
n := the smallest positive integer
     not definable in under
     twelve English words

// that phrase has eleven words
// and just defined n
// so n is definable in eleven words

fig. 07 — the contradiction, rendered

08IDENTITY

The Bootstrap

after Heinlein · 1941

Information that exists, but was never created.

A traveler carries a theorem into the past and hands it to her younger self, who later grows up to carry it back. The theorem is never derived — it simply circulates, uncaused. Causally consistent, yet it violates the intuition that everything has an origin. A loop that is perfectly closed and perfectly without a beginning.

Cast your verdict

javascript
function loop() {
  const idea = future.receive()
  past.send(idea)          // same idea, sent back
  return idea
}
// where did 'idea' originate?
// it is its own author. no first draft exists.

fig. 08 — the contradiction, rendered

09LOGIC

The Surprise Exam

Lennart Ekbom (attrib.) · 1948

A surprise exam, announced in advance, that logic proves impossible — then happens.

A teacher promises an exam next week on a day the students cannot predict. The students "prove" by backward induction that no such day exists — so they expect nothing, and the Wednesday exam catches them completely off guard. The flawless-looking argument is refuted by the world, and to this day no one agrees on exactly where the reasoning breaks.

Cast your verdict

reasoning
exam ∈ { Mon..Fri }, and "you won't expect it"

not Fri  // last day would be no surprise
not Thu  // by the above, Thu is now last
... eliminate every day ...
∴ no exam possible

// teacher gives it Wednesday. total surprise.

fig. 09 — the contradiction, rendered

10LOGIC

Curry's Sentence

Haskell Curry · 1942

"If this sentence is true, then anything you like is true."

Take a sentence that says "if I am true, then X" — where X is any claim at all, however absurd. A few innocent steps of logic prove the sentence true, and then prove X. Without ever mentioning falsehood, Curry's sentence lets self-reference manufacture arbitrary conclusions from nothing. It is why systems that allow naive self-reference can prove everything, and so prove nothing.

Cast your verdict

lambda
C := "if C is true, then ⊥"

assume C true
  → (C → ⊥) is true
  → ⊥                  // detach
∴ C is true → ⊥ is true   // prove anything

fig. 10 — the contradiction, rendered