← Adversarial Mathematics: From First Principles

When Every Group Says Yes

One treatment wins in every group of patients, yet loses overall. Two published tables, checked exactly with two proof checkers: Simpson's own example, where the difference vanishes, and the kidney-stone study, where it reverses.

A treatment is tested on two groups of patients. In the first group it wins. In the second group it also wins. Then all the patients are counted together — and it loses.

The numbers are as published. The arithmetic is exact, and two proof checkers confirm the seven comparisons in the contract. The paradox is real, and it has a precise mathematical explanation: a combined rate is a weighted average, and the weights differ between the two arms.

The question

Suppose treatment A succeeds more often than treatment B for small stones, and also more often for large stones. Must A succeed more often overall? Most people’s first answer is yes. It is wrong — not because the data are corrupt, but because “overall” mixes groups in different proportions for the two arms.

There are two published tables in this chapter, and they must not be confused:

  1. Simpson’s own 1951 table, in which the within-group advantage disappears on aggregation: both combined rates are exactly one half.
  2. The kidney-stone study (Charig and colleagues, 1986), in which the within-group advantage genuinely reverses: the arm that wins both groups loses overall.

The phenomenon carries Simpson’s name, but his own table shows no reversal. One of the formal statements in this investigation exists precisely to enforce that distinction.

The setup

Simpson’s table: an advantage that vanishes

Table 4 of E. H. Simpson’s 1951 paper sets out a medical example: treated and untreated patients, split by sex, counted as surviving or not:

Treated Untreated
Men 8 of 13 survive 4 of 7 survive
Women 12 of 27 survive 2 of 5 survive
Combined 20 of 40 survive 6 of 12 survive

Compare the fractions. Among men, 8/13 ≈ 0.615 beats 4/7 ≈ 0.571. Among women, 12/27 ≈ 0.444 beats 2/5 = 0.4. The treated arm wins in both groups. Combined: 20/40 = 1/2 on both sides. The advantage does not reverse — it evaporates.

Why? The treated arm’s patients are concentrated in the low-survival group (women: 27 of 40 treated patients), while the untreated arm’s are concentrated in the high-survival group (men: 7 of 12). Aggregation weights each arm by its own group sizes, so the two combined rates weight the same four numbers differently.

The kidney-stone table: an advantage that reverses

The second table compares two real treatments for kidney stones, as reported by Charig and colleagues in the British Medical Journal (1986), Tables I and II on page 880:

  • Arm A is “all open procedures”: three kinds of open surgery pooled together (this pooling matters, and we return to it).
  • Arm B is percutaneous nephrolithotomy, a less invasive procedure.
  • Group 1 is stones with mean diameter under 2 cm; group 2 is stones of 2 cm or more, or multiple stones — the paper’s own definition, slightly broader than “large stones”.
  • Success means no stones at three months, or fragments under 2 mm.
Open surgery (A) Percutaneous (B)
Group 1 (under 2 cm) 81 of 87 (93.1%) 234 of 270 (86.7%)
Group 2 (2 cm+, or several) 192 of 263 (73.0%) 55 of 80 (68.8%)
Combined 273 of 350 (78.0%) 289 of 350 (82.6%)

Open surgery wins group 1 (81/87 > 234/270) and wins group 2 (192/263 > 55/80), yet loses combined (273/350 < 289/350). This time the reversal is genuine, and both proof checkers confirm all three comparisons exactly, as rational numbers — no decimals, no rounding, no sampling.

The mechanism is the same weighting effect, now visible in the group sizes. Percutaneous treatment handled 270 of its 350 cases (77%) in the easier group 1; open surgery handled only 87 of 350 (25%) there. Group 1 has the higher success rate for both arms, so the arm that treated mostly group-1 patients gets a combined rate pulled toward the easy group — and overtakes.

Run it

Fractions like 192/263 cannot be checked in floating point without rounding, so the investigation uses exact rational arithmetic everywhere:

  • Lean, with Mathlib’s rational numbers ℚ, checks seven statements: the two Simpson within-group comparisons, the Simpson combined equality, the explicit non-reversal, the two kidney-stone within-group comparisons, and the combined reversal.
  • Rocq, with its rational library QArith, checks the same seven.
  • Python recomputes every comparison with Fraction, sharing no code with either checker.

In the pinned environment (see “Running the investigations” in the introduction to Part I):

math-engine proof simpson

Without Docker, the exact computation runs with plain Python: python -m math_engine.proofs.simpson_compute. The recorded run is in experiments/investigations/p07-simpson/kernel-runs/2026-11-13-v2-pinned/; start with its notebook.md.

What happened

The recorded run (claim contract v2) printed:

  Lean + Mathlib   7/7 statements accepted as written in the contract   [passed]
  Rocq             7/7 statements accepted as written in the contract   [passed]
  Python (exact rational arithmetic): patterns_as_published   [passed]
  Failure controls 8/8 rejected as expected

The kernels accepted every statement. Eight deliberate mistakes were each rejected where they were made: a changed cell (8 survivors becomes 7), a claim that Simpson’s table reverses, a denial of the kidney-stone reversal, and a proof bound to a changed statement, in the kernels and in the computation. The formal statements are tied to the prose claim by the investigation’s contract; whether they capture it is a separate judgement.

The investigation’s most valuable control is the one against the textbook telling. A formal statement asserts that Simpson’s own combined rates are not a reversal, and a control demands that any claim that they reverse be refused. Had the chapter followed the common secondary-source description, this check would have failed. The error it guards against is ours, the retellers’ — not Simpson’s.

Why

Write each arm’s combined rate as a weighted average of its group rates. For open surgery:

$$\frac{273}{350} = \frac{87}{350}\cdot\frac{81}{87} + \frac{263}{350}\cdot\frac{192}{263},$$

and similarly for percutaneous treatment with weights 270/350 and 80/350. The group rates of A exceed those of B term by term — but the weights differ, because they come from each arm’s own patient mix. Two weighted averages of the same direction of inequality can come out in the opposite order when the weights differ enough. That is the whole paradox, and it is a theorem of arithmetic, not a quirk of medicine.

Kidney-stone success rates by group and combined. Open surgery wins group 1 (93.1 vs 86.7 percent) and group 2 (73.0 vs 68.8 percent) but loses combined (78.0 vs 82.6 percent), because 77 percent of percutaneous cases are in the easier group 1 against 25 percent for open surgery.

Why the reversal is arithmetic. Open surgery wins each group bar, but its combined bar is weighted toward the harder group 2, while percutaneous treatment’s is weighted toward the easier group 1. The heights are the exact published fractions; no rounding, no sampling. The figure shows the kidney-stone reversal — Simpson’s own table, where the advantage vanishes rather than reverses, is the distinction the chapter’s controls enforce.

A useful control on intuition: if both arms had treated the same numbers of patients in each group, no reversal would be possible — term-by-term advantage with common weights always survives aggregation. The paradox needs the group mix to differ between arms. In the kidney-stone data it differs enormously: 77% of percutaneous cases are in group 1, against 25% of open-surgery cases. The paper does not let us say why, and this chapter does not guess.

What was actually checked

Seven statements, each in both Lean and Rocq, all about exact rationals: the two within-group comparisons and the combined equality in Simpson’s table, the statement that his table is not a reversal, the two within-group comparisons in the kidney-stone table, and the combined reversal. The independent computation repeats them with Python’s exact fractions.

What the kernels check is arithmetic about these numbers. That the numbers are the published counts rests on the transcription (Simpson’s table from a scan of the 1951 paper; Charig’s Tables I and II from the PubMed Central scan), and reading the source carefully turned up four things the chapter must get right:

  1. “Small” and “large” are shorthand. Group 2 contains every patient with multiple stones whatever their size. The chapter follows Charig’s definition, not the re-analysts’ labels.
  2. Arm A is not one operation. It is the row Charig’s own Table II calls “All open procedures”, pooling three operations. All 43 ureterolithotomies (stones in the ureter, every one a success) sit in group 1, and they carry open surgery’s group-1 lead. Without them, open surgery’s group-1 rate is 38/44 ≈ 86.4%, just below percutaneous treatment’s 234/270 ≈ 86.7%, and the “wins every group” half of the paradox disappears. That last comparison is our own arithmetic on Charig’s Table II; it is not part of the checked run.
  3. One of Charig’s arms is left out. The paper’s main interest was ESWL (301 of 328 successful); the comparison here uses only open surgery versus percutaneous nephrolithotomy. Presenting it as a two-treatment trial would misdescribe the source.
  4. The study was not randomised. Treatment groups formed in practice, which is exactly what lets the group mix differ, and exactly why no clinical conclusion follows. The contract rules out any causal reading.

Contract v2. The source check changed how the claim is described, not what is proved: arm A is named as “all open procedures”, group 2 is defined as Charig defines it, and the counts are recorded as checked against the original tables. No formal statement changed. The v1 run is kept beside the v2 run.

What this establishes

Two exact arithmetic facts about two published tables: Simpson’s 1951 example shows a within-group advantage vanishing on aggregation (combined rates both one half), and Charig’s 1986 kidney-stone counts show a within-group advantage reversing on aggregation (273/350 against 289/350). Both were checked by two independent proof kernels and an exact computation, with eight failure controls rejected at the point of mutation.

It establishes nothing about which treatment a doctor should choose, nothing about significance, and nothing beyond these counts.

What remains open

  • Source readings. The counts were transcribed from the scans and have not been independently checked against the page images. A 13-row checklist records what such a check would cover.
  • The ureterolithotomy comparison (38/44 against 234/270) is our own arithmetic, outside the checked run. It is not part of the kernel-checked statements.
  • Nothing clinical. The study was not randomised, and arm A pools three operations; no conclusion about treatments follows, and none is drawn.

Try it yourself

  1. Run the investigation and open the notebook it writes. Change one cell — treated men survivors from 8 to 7 — and rerun: the within-group advantage disappears, and the run must report the broken pattern.
  2. Compute both arms’ combined rates from the group rates and group sizes by hand, using the weighted-average formula above. Verify that equal group sizes would preserve the order.
  3. Remove the 43 ureterolithotomies from arm A (13 + 31 = 44 patients and 12 + 26 = 38 successes in group 1) and compare with 234/270. Which half of the paradox survives?
  4. Find the tipping point: holding group 2 fixed and open surgery’s group-1 success rate at 81/87, how many group-1 patients would it have needed for its combined rate to stay ahead? (Treat 81/87 as a rate, not as a whole number of survivors; the worked solution finds the first attainable count.)
  5. Read Charig’s Table I and confirm the denominators 87 and 263 as sums of the three open procedures (13 + 31 + 43, and 218 + 45).

Worked answers: Chapter 35 — Appendix A: Solutions to the Exercises (Part IV, Appendix A)#chapter-7-when-every-group-says-yes.

Evidence record

Investigation P07-SIMPSON-01, claim contract v2 (sha256 f768af57…)
Run 20261113T155438Z-ea1fcdd4, on the pinned math-env image (Lean 4.35.0 + Mathlib, Rocq 9.0.1)
Result result.json in experiments/investigations/p07-simpson/kernel-runs/2026-11-13-v2-pinned/
What it establishes The kernels accepted the formal statements and the exact computation reproduces the published patterns. Whether those statements capture the prose claim is a separate judgement.
Record v1 pinned run kept alongside; changed no formal statement

Sources

  • E. H. Simpson, “The interpretation of interaction in contingency tables”, Journal of the Royal Statistical Society B 13 (1951), 238–241, Table 4.
  • C. R. Charig, D. R. Webb, S. R. Payne, J. E. A. Wickham, “Comparison of treatment of renal calculi by open surgery, percutaneous nephrolithotomy, and extracorporeal shockwave lithotripsy”, BMJ 292 (1986), 879–882, Tables I–II (p. 880). Counts transcribed from the scan; not independently checked against the page images.
  • Repository: experiments/investigations/p07-simpson/investigation.json, formal/lean/SimpsonParadox.lean, formal/rocq/SimpsonParadox.v.

Further Reading

For deeper study; not sources for the chapter’s claims.

  1. P. J. Bickel, E. A. Hammel, J. W. O’Connell. “Sex Bias in Graduate Admissions: Data from Berkeley.” Science 187(4175) (1975), 398–404. DOI. Why read it: The classic real-world example in which aggregation reverses a comparison, together with a careful discussion of why the causal conclusion is not automatic.
  2. Judea Pearl. “Comment: Understanding Simpson’s Paradox.” The American Statistician 68(1) (2014), 8–13. DOI. Why read it: A compact modern analysis that separates the arithmetic reversal from the causal question of which table should guide a decision.
  3. Miguel A. Hernán, David Clayton, Niels Keiding. “The Simpson’s paradox unraveled.” International Journal of Epidemiology 40(3) (2011), 780–785. DOI. Why read it: Explains when a Simpson reversal reflects a genuine causal effect and when it is an artifact of conditioning, exactly the distinction the chapter refuses to blur.

The mathematics behind this chapter: Chapter 13 — Exact Numbers and Misleading Aggregates (Part II, Chapter 4) (exact comparison and weighted averages) and Chapter 19 — Mathematics and the World (Part II, Chapter 10) (what the numbers cannot say about causes).

Next: Chapter 9, a horn with finite volume and infinite surface, and a proof whose link to geometry is a stated assumption.