The Poincaré conjecture explained for programmers

The Poincaré conjecture explained for programmers
1904Henri Poincaré asks the question
< 70pages across Perelman's three preprints (2002-2003)
$1,000,000from the Clay Institute, turned down in 2010
~3.2 Mlines of Lean in FrenzyMath's formalization, by the team's count
The Poincaré conjecture explained for programmers: the only Millennium Problem ever solved
I also explain it in this video, on my channel Articulator EN. The simulations in the video and in this post (curve shortening flow and Ricci flow) are made with NumPy.

Modeling clay shapeslink

You don't need formulas to understand the conjecture: you need to look at shapes the way a topologist does. To a topologist, shapes are made of modeling clay. You can stretch, bend and squash them as much as you like, but you can't tear them or glue pieces together. If one shape can turn into another that way, they count as the same. The classic example: push in the body of a coffee mug, thicken the handle, and you end up with a donut. In topology, a mug and a donut are the same thing.

If you write code, you already know the idea: it's graph isomorphism. Two graphs can be drawn very differently and still be the same graph, with the same nodes connected the same way. Coordinates don't matter; only structure does. Topology does that with shapes: it forgets distances, angles and curves, and keeps only how everything is connected. That's why it's sometimes called rubber sheet geometry.

So how do you know whether two shapes are the same? Trying every deformation is impossible, so mathematicians use invariants: numbers that don't change when you deform a shape. They work like a hash. If two shapes give different numbers, they're definitely different. The simplest one is counting holes: a sphere has zero, a donut one, a pretzel three. But, as with any hash, the hard question is the other way around: if two shapes give the same number, are they really the same? In other words, are there collisions?

The rubber band testlink

Poincaré proposed a very concrete test, the same one the Clay Institute uses to explain it. Put a rubber band on an orange and slide it along without lifting it off the peel: it shrinks down to a point, wherever you put it. On a sphere, every loop can shrink. Now put it around a donut, through the hole: there's no way to shrink it without breaking the band or the donut.

A sphere with smaller and smaller loops ending in a point, and a donut with a loop around the tube that can't shrink
On the sphere, the band shrinks to a point; on the donut, it gets stuck.

A shape where every loop can shrink is called simply connected. Think of it as a function that returns True or False: for every possible loop, it checks whether that loop can shrink to a point. The sphere returns True. The donut returns False, because one loop stuck in the hole is enough to fail the test. And any shape with holes, like the pretzel, fails it too.

For surfaces, this test is perfect. Since the nineteenth century we've known the complete list of closed surfaces that can be oriented: the sphere, the donut, the two-holed donut, the three-holed one, and so on forever. It's like an enum that depends on a single number, the holes. And of the whole list, the only one that passes the rubber band test is the sphere. In two dimensions, the test recognizes the sphere with no collisions.

The list of closed surfaces: sphere, donut, two-holed and three-holed donut; only the sphere passes the test
An enum with a single parameter: the number of holes.

There's one more word: closed, which means finite and without edges. A disk doesn't count, because it has an edge; an infinite plane doesn't either, because it never ends. A video game map that wraps around (you leave on the right and come back on the left) has no edges and is finite: that's a closed surface. And if it also connects the top with the bottom, it's a donut.

A universe without edgeslink

Poincaré wasn't asking about surfaces, but about three-dimensional spaces. To picture the 3D version of the sphere, drop one dimension first. Glue the ends of two line segments and you get a circle. Glue two disks along their edges and you get a sphere, like the two halves of a ball. And glue two solid balls along their surfaces and you get the 3-sphere: when you leave one ball, you go straight into the other.

You don't need to see it from outside. Imagine you live inside a universe like that, finite and without edges. You get into a spaceship with a rope tied to your house, take a trip around space and come back. Then you pull the rope. If you can always reel it in, whatever route you took, your universe passes the rubber band test. If it ever gets snagged around something, it doesn't.

The Poincaré conjecture

Every closed three-dimensional space in which any loop can shrink to a point is the 3-sphere (deformed).

Put like a programmer: does the rubber band test recognize the 3-sphere with no collisions, just like in two dimensions? It sounds like an innocent question. It took almost a hundred years to answer.

And Poincaré had already gotten it wrong once. In 1900 he used a weaker test that counted holes in a different way (with what's now called homology). Then he found a space that passed it but wasn't the sphere: you build it from a dodecahedron, gluing each face to the opposite one after a tenth of a turn. A false positive. That space does fail the rubber band test, because it has loops that can't shrink. So in 1904 Poincaré proposed the stricter test and left it as an open question.

Why it's so hardlink

The funny thing is that more dimensions turned out to be easier. In 1961, Stephen Smale proved the version for five dimensions or more; in 1982, Michael Freedman did it for four. Both won the Fields Medal. That left only the case Poincaré had actually asked about: three dimensions, our own.

  • Knots and cables. On a flat surface, two cables can't cross without touching. In three dimensions they can, and that's why knots exist. In four, any knot in a piece of string comes undone, because there's room to spare to move a strand out of the way. Three dimensions is the awkward spot: plenty of room to get tangled, and very little to get untangled.
  • A graveyard of proofs. In 1934, J. H. C. Whitehead published one, found the mistake and, along the way, discovered a very strange space nobody expected. Many others went through the same thing; people even talked about "the Poincaré disease".
  • A bigger question. In 1982, William Thurston proposed that every closed three-dimensional space can be cut into pieces, each with one of eight standard geometries, as if any program were built from just eight kinds of component. Poincaré would follow as a special case. But nobody knew how to prove it.

Ricci flowlink

That same year, Richard Hamilton proposed another path: let the shape fix itself. His tool is called Ricci flow, and it works like heat. If you heat one spot of a metal bar, the heat spreads out until everything is at the same temperature. Ricci flow spreads out curvature: sharply curved regions smooth out and the shape tends to round off.

If you write code, you know this trick: it's a blur filter. Each pixel is replaced by the average of its neighbors and, repeated many times, everything smooths out. Its simplest cousin is the curve shortening flow: at each step, every point of a closed curve moves inward, faster where the curve is bent more. Gage, Hamilton and Grayson proved that, however twisted it starts, the curve becomes round and vanishes into a point. And its area always drops at the same rate, 2π per unit of time, whatever its shape.

A twisted curve rounding off at four moments, and a graph of its area dropping in a straight line
A real NumPy simulation: the curve rounds off and the area falls in a straight line (measured slope: −6.33; theory: −2π ≈ −6.28).

You can check it yourself with a few lines of NumPy. The step function is the curvature vector in finite differences, using the actual spacing on each side:

import numpy as np

def step(p, dt):
    """p: points (N, 2) of a closed curve. Each one moves with its curvature."""
    a = np.roll(p, -1, 0) - p              # toward the next neighbor
    b = p - np.roll(p, 1, 0)               # from the previous neighbor
    ha = np.linalg.norm(a, axis=1)[:, None]
    hb = np.linalg.norm(b, axis=1)[:, None]
    return p + dt * 2 * (a / ha - b / hb) / (ha + hb)

t = np.linspace(0, 2 * np.pi, 200, endpoint=False)
r = 1 + 0.3 * np.sin(2 * t) + 0.2 * np.cos(3 * t)
p = np.stack([r * np.cos(t), r * np.sin(t)], 1)
for _ in range(2000):
    p = step(p, 1e-4)

area = lambda q: 0.5 * abs(np.dot(q[:, 0], np.roll(q[:, 1], -1)) - np.dot(q[:, 1], np.roll(q[:, 0], -1)))
p0 = np.stack([r * np.cos(t), r * np.sin(t)], 1)
print(f"area: {area(p0):.3f} → {area(p):.3f}  (2π · 0.2 = {2 * np.pi * 0.2:.3f})")
# area: 3.345 → 2.089  (2π · 0.2 = 1.257)

In 1982, Hamilton proved the flow works in one case: if the space is already curved outward everywhere, like a dented sphere, it rounds it into a perfect sphere. The plan for Poincaré was obvious: take any space that passes the rubber band test, let it flow, and watch it turn into a sphere. The problem is that the flow doesn't always go smoothly.

Look at a dumbbell: two balls joined by a narrow neck. The neck gets thinner faster than the rest, until it pinches off and its width hits zero. That's a singularity: the equation stops making sense, like a program that suddenly divides by zero.

A dumbbell whose neck thins until it almost disappears and, after surgery, two separate balls
Ricci flow of a rotationally symmetric 3-sphere, computed with NumPy (the neck goes from 0.32 to 0.01 while the balls barely change). Below, the result of operating.

Hamilton's idea was to operate: just before the pinch, cut through the neck, cap each cut with half a sphere and let the flow carry on. Like catching an exception, fixing the state and continuing:

while shape:
    try:
        flow(shape)
    except Singularity as neck:
        shape = operate(shape, neck)   # cut and cap with half spheres

But for that to work you have to prove two things: that only singularities you can operate on show up, and that you won't need infinitely many operations. That's where he got stuck for years.

Perelmanlink

In November 2002, a mathematician from Saint Petersburg, Grigori Perelman, posted a paper on arXiv, the site where scientists share drafts. Over the next few months he posted two more. In total, fewer than seventy pages. He never sent them to any journal. And they contained the solution: not just to Poincaré, but to Thurston's whole conjecture.

Entropy

A quantity that, during the flow, can only move in one direction, like a loss function that never goes up. With it he proved the flow can't crush space in arbitrary ways: near every singularity, the shape always looks like one of a few known pieces, a thin cylinder or a rounded cap. Exactly the ones you can operate on.

Termination

In each stretch of time you only need a few operations and, if the space passes the rubber band test, everything ends up vanishing in finite time. It's a termination proof: the algorithm is guaranteed to halt. Every piece that vanishes is a sphere; undoing everything backwards, the starting space was a 3-sphere.

Seventy pages like that don't get accepted overnight. Several teams spent years filling in every step: Kleiner and Lott wrote detailed notes, and Morgan and Tian a book of more than five hundred pages. Like a seventy-line pull request that needs five hundred pages of comments before the reviewers can follow it. In 2006, the community accepted it.

What happened next made him famous outside mathematics. In 2006 he was awarded the Fields Medal and didn't show up to collect it. In 2010 the Clay Institute awarded him the million dollars, and he turned that down too. According to the Interfax news agency, he said the decision was unfair, because his contribution was no greater than Hamilton's.

Fall 2026link

Lean is a language that works like a compiler for proofs: you write every step of the reasoning as code and, if it compiles, the reasoning is correct, without having to trust anyone. Its big math library, Mathlib, had the Poincaré conjecture written down, but marked proof_wanted: a proof still wanted.

September 27 · Chow and team

Qin, Liao, Khaitan and Chow (Cornell, UC San Diego and Princeton) publish a Lean formalization of the Hamilton–Perelman proof: the smooth version, plus Moise's theorem, gives the topological one. According to the authors, it proves the statement Mathlib had marked as wanted. In October the same group also published one for Thurston's geometrization.

September 28 · FrenzyMath

FrenzyMath announces another complete formalization in Lean 4, following Morgan and Tian's book. By the team's count, it's about 3.2 million lines, written in half a month by AI agents guided by mathematicians, for less than $30,000, and verified both by Lean and by a separate checker that compares the statement with a reference one (paper).

What it means, with caution

Code that compiles proves the steps fit together, but someone still has to check that the statement really says what Poincaré said. What's new isn't that the conjecture is true (we've known that since 2006): it's that a proof that took years to review has been machine-checked in weeks. These are September and October 2026 results; the community is still digesting them.

Try it yourselflink

Topology shows up in more code than you'd think. The program that prepares a part for a 3D printer checks that the mesh is closed, with no holes for the plastic to leak through. And there's an invariant you can compute in one line: vertices minus edges plus faces, the Euler characteristic. For any sphere-shaped mesh it gives 2; for a donut, 0; each extra hole subtracts 2.

def euler(faces):
    vertices = {v for f in faces for v in f}
    edges = {frozenset((f[i], f[i - 1])) for f in faces for i in range(len(f))}
    return len(vertices) - len(edges) + len(faces)

cube = [(0, 1, 2, 3), (4, 5, 6, 7), (0, 1, 5, 4),
        (1, 2, 6, 5), (2, 3, 7, 6), (3, 0, 4, 7)]
n = 8   # donut: an n × n grid that wraps around both ways
donut = [(i*n + j, i*n + (j+1) % n, ((i+1) % n)*n + (j+1) % n, ((i+1) % n)*n + j)
         for i in range(n) for j in range(n)]
print("cube:", euler(cube))    # 2
print("donut:", euler(donut))  # 0
V minus E plus F: the cube gives 8 minus 12 plus 6 equals 2, any sphere gives 2 and the donut gives 0
Change the mesh as much as you like: the result only depends on the holes.

There's more. In robotics, the possible poses of an arm form a space (for an arm with two fully rotating joints it is, precisely, a donut), and its shape decides whether you can go from one pose to another without crashing. In data analysis, topology looks for holes and loops in point clouds. And in cosmology, it was proposed in 2003 that the whole universe might have the shape of that dodecahedron space of Poincaré's; it's a proposal, not something confirmed.

In shortlink

Poincaré asked whether the rubber band test is enough to recognize the three-dimensional sphere. Perelman proved it is, by letting the shape smooth itself out with Ricci flow and operating on every neck that pinches. And in 2026 that proof became code a computer checks.

Timeline of the Poincaré conjecture from 1900 to 2026
More than a century: from the 1900 false positive to the compiled proof.
In one sentence

In three dimensions, the rubber band test is a hash with no collisions: if every loop shrinks, it's a sphere.

With this one, all seven Millennium Problems are on the blog and on the channel. Which one did you like best?

Sourceslink

Continue reading

Last posts -->

Have you seen these projects?

Gymnasia

Gymnasia Gymnasia
Expo
React Native
TypeScript
OpenAI
Anthropic

Fitness app with two agents that run entirely on the device, with no backend, so the user's data never leaves the phone. A BYOK conversational coach with local tools and a remote system prompt with offline fallback, plus a food estimator that pulls macronutrients out of a photo of the plate, with barcode scanning against OpenFoodFacts.

LangGraph Deep Researcher

LangGraph Deep Researcher LangGraph Deep Researcher
Python
LangGraph
FastAPI
React
TypeScript
Docker

Multi-agent research system built with LangGraph. A supervisor breaks your question down into topics and launches search sub-agents in parallel; each one compresses its findings before handing them to a writer agent that produces the final sourced markdown report. Live streaming over WebSockets, a configurable model per role and bring-your-own API keys that are never persisted server-side.

Tau

Tau Tau
Python
LangChain

Multi-agent tutoring system for secondary school students, with one agent per subject and course material written and validated by a team of teachers. It was used with real students at a private school in Spain and at a secondary school in Colombia.

View all projects -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to watch any talk?

Last talks -->

Do you want to improve with these tips?

Last tips -->

Use this locally

Hugging Face spaces allow us to run models with very simple demos, but what if the demo breaks? Or if the user deletes it? That's why I've created docker containers with some interesting spaces, to be able to use them locally, whatever happens. In fact, if you click on any project view button, it may take you to a space that doesn't work.

Flow edit

Flow edit Flow edit

FLUX.1-RealismLora

FLUX.1-RealismLora FLUX.1-RealismLora
View all containers -->
>_ Available for projects

Do you have an AI project?

Let's talk.

maximofn@gmail.com

Machine Learning and AI specialist. I develop solutions with generative AI, intelligent agents and custom models.

Do you want to train your model with these datasets?

short-jokes-dataset

HuggingFace

Dataset with jokes in English

Use: Fine-tuning text generation models for humor

231K rows 2 columns 45 MB
View on HuggingFace →

opus100

HuggingFace

Dataset with translations from English to Spanish

Use: Training English-Spanish translation models

1M rows 2 columns 210 MB
View on HuggingFace →

netflix_titles

HuggingFace

Dataset with Netflix movies and series

Use: Netflix catalog analysis and recommendation systems

8.8K rows 12 columns 3.5 MB
View on HuggingFace →
View more datasets -->