Skip to the proof exchange
MathCase

MathCase · Interactive math workbench

Check a math claim. See why it holds.

Try a fraction on the board, change one number, and share a receipt someone else can check. For a proof, follow a saved example through Lean, the program that checks each mathematical step.

Three-minute proof walkthrough

MathCase pairs an AI proof attempt with Lean’s response. Use the saved prime-divisibility case for a short, evidence-first walkthrough.

  1. Read the claim and the rejected attempt. The prompt included a proof hint using both assumptions. The candidate supplied divisibility where Lean expected primality.
  2. Inspect the repaired proof in the same record. It uses the known Lean theorem Nat.Prime.dvd_of_dvd_pow.
  3. Remove the prime assumption. The saved arithmetic example shows what fails when the divisor is 4.

The exchange, step by step

What the AI said, what Lean said, and what it means

  1. You ask

    If a prime divides n², does it have to divide n?

  2. MathCase → AI

    The first request includes the statement, the Mathlib lemma’s signature and a proof hint that applies the lemma using both assumptions. Read the saved request on GitHub.

    ∀ (p n : ℕ), p.Prime → p ∣ n ^ 2 → p ∣ n
  3. AI proposes
    exact Nat.Prime.dvd_of_dvd_pow h
  4. Lean rejects
    Application type mismatch: the argument h
    has type p ∣ n ^ 2 but is expected to have
    type Nat.Prime ?m

    In plain words: the right lemma, but the AI handed it the divisibility fact where it needed proof that p is prime.

  5. MathCase → AI

    Returns Lean's exact error message, marked as untrusted feedback.

  6. AI corrects
    exact Nat.Prime.dvd_of_dvd_pow hp h
  7. Lean verifies

    The proof compiles. The axiom audit shows only Lean's three standard axioms, and no sorry.

  8. Why it's true

    This is Euclid's lemma: a prime that divides a product divides one of the factors. Here both factors are n.

  9. Reused

    The verified proof is imported unchanged into a proof that √2 is irrational. If p² = 2q², then p is even, so q is even too. Halving both gives a smaller solution, so no solution can exist.

The record preserves both model requests, both proposed proofs and Lean’s verdicts. The result shows how MathCase caught and repaired a mistake on a known theorem with a supplied proof hint. Inspect the record →

Check the evidence yourself

What a receipt contains, and how to replay one

Use the published source and checker to reproduce the result.

Excerpt from the Lean receipt above (full SHA-256 bindings)

{
  "schema_version": "mathcase-lean-verification-v3",
  "problem_id": "hero-prime-divisibility-r1",
  "input_proof": "by intro p n hp h; exact Nat.Prime.dvd_of_dvd_pow hp h",
  "problem_statement_sha256": "a4847b7914de65538472cdef088ad69b39d59f66e9e2af81ad852ad836321832",
  "proof_sha256": "03602b73efcddecf3f025c5bf6e5b8cfaac5abedc065a9b8c3e0626e4a3e26ca",
  "generated_source_sha256": "34b5edc1d9b5bbd5b750e23184edcfaa481de195ed504a28f379b059497caaa9",
  "toolchain": "leanprover/lean4:v4.33.1",
  "imports": ["Mathlib.Data.Nat.Prime.Basic"],
  "allowed_axioms": ["Classical.choice", "Quot.sound", "propext"],
  "observed_axioms": ["propext", "Classical.choice", "Quot.sound"],
  "kernel_passed": true,
  "status": "PASSED"
}
Read the full receipt on GitHub →

Replay the 23-step Collatz proof · Lean core only

Use Git, Python 3 and elan. In a new directory, fetch the checked source and install its Lean version.

git clone https://github.com/DarthCeltic/MathCase.git
cd MathCase
git checkout --detach 491bd436227044a5f6d6b202120e33fa1cefc7fc
elan toolchain install leanprover/lean4:v4.33.1

Windows PowerShell

$env:ELAN_TOOLCHAIN = 'leanprover/lean4:v4.33.1'
python -B scripts/run_public_case.py collatz-parity-envelope-23-14 --lean "$(elan which lean)"

macOS or Linux

python3 -B scripts/run_public_case.py collatz-parity-envelope-23-14 --lean "$(ELAN_TOOLCHAIN=leanprover/lean4:v4.33.1 elan which lean)"

A successful replay checks four Lean files. The download and compile time depend on your machine.

Replay the prime and √2 proofs (fetches pinned Mathlib 0df444a360eaa60ab8c11dca51a86af692955474; needs several GB)

python -B reproduction/prime-sqrt2-source-replay-v1/verify_prime_sqrt2.py --bootstrap ./mathlib4-v4.33.1 --repo . --output ./replay.json

What the hashes do: SHA-256 makes the record tamper-evident and ties each verdict to exact bytes. It does not prove anything by itself; the Lean kernel's check is the proof. A replay recompiles the pinned source with the same toolchain and prints the axioms again, so you can compare the result with the receipt.

Two kinds of evidence, never mixed

What is proved in Lean, and what is computed

Kernel-checked proofs

The Lean 4.33.1 kernel accepted the exact theorem statement, and the axiom report was audited: only propext, Quot.sound, and where noted Classical.choice. The sources of the results below contain no sorry, admit, or native_decide.

You trust: the Lean kernel, and that the statement says what the English claims.

Pinned computations

Exact-arithmetic results such as the Ising boundary counts, fraction checks, and residue-class censuses come from pinned scripts with recorded inputs and outputs. They are replayable, and many are cross-checked by a second implementation, but they are not Lean proofs.

You trust: the pinned code and environment, which you can rerun yourself.

Kernel-checked results

Each result: the exact Lean statement, the idea in words, and why it's true

Collatz · Lean-checked

Which starting numbers drop within 37 ordinary steps?

theorem at_most_fourteen_of_twenty_three_descend
  (n : Nat) (hn : 3 ≤ n) (ho : odds n 23 ≤ 14) :
  ordinaryIter n (23 + odds n 23) < n

Descent axioms: propext, Quot.sound · the residue count also uses Classical.choice · no sorry, admit, or native_decide

Take 23 shortcut steps from a whole number n ≥ 3. For an even input, halve it. For an odd input, triple it, add one and halve. If at most 14 inputs are odd, the ordinary sequence falls below its start by step 37. Exactly 7,507,638 of the 8,388,608 remainder classes modulo 2²³ meet this condition.

The parity pattern bounds both the repeated multiplications and the additions. For starts at least 677, that bound forces the endpoint below the start. Lean checks the smaller qualifying starts directly.

Lothar Collatz’s question asks whether every positive start eventually reaches 1. This proof gives one strict drop for the stated classes. Its parity argument follows Terras (1976). Historical overview.

Collatz · Lean-checked

One drop proves infinitely many

theorem collatz_iterate_pow2_lift (n k d : Nat) :
  collatzIter (n + 2 ^ d * k) d =
    collatzIter n d + 6 ^ (collatzOddInputs n d) * k

Axioms: propext, Quot.sound · no sorry, admit, or native_decide

If a number drops after d steps, the drop carries over to every larger number with the same last d binary digits, provided 6^a < 2^d, where a counts the odd steps. One check covers an infinite family of numbers.

Adding 2^d × k keeps the first d steps' parities the same. Each even step halves the difference and each odd step triples it. After d steps the difference is 6^a × k.

The lemma is applied to 860 explicit families. Together they cover only a small fraction of all numbers.

Ramsey theory · Lean-checked

A 101-person party with no group of six

theorem ramsey_number_six_six_lower_bound_candidate :
  ∃ G : SimpleGraph (Fin 101),
    G.CliqueFree 6 ∧ (Gᶜ).CliqueFree 6

Axioms: propext, Classical.choice, Quot.sound · no sorry, admit, or native_decide

There is a way to arrange 101 people so that no six of them all know each other and no six are all strangers. So the Ramsey number R(6,6) is at least 102.

Join two people when the difference of their numbers is a nonzero square modulo 101. This Paley graph is so symmetric that one connection checked exhaustively with decide covers every other connection, and multiplying by a non-square turns the graph into its complement.

Kalbfleisch’s 101-vertex construction gives this known lower bound. MathCase checked its Lean formalization with Mathlib 0df444a. The suffix _candidate is part of the saved declaration name. Radziszowski’s Small Ramsey Numbers.

Collatz · Lean-checked · 363 modules replayed

2,652 families, each proved to drop

theorem descent_mod1048576_239 : ∀ k : Nat,
  iterate (1048576 * k + 239) 32 = 531441 * k + 122 ∧
  531441 * k + 122 < 1048576 * k + 239

Axioms: propext, Quot.sound · no sorry, admit, or native_decide

For each of 2,652 listed remainders r, every number 2²⁰k + r falls below its start after exactly 32 Collatz steps, for every k. The theorem shown is one of the 2,652.

Each family follows the same path: 12 odd steps that triple and 20 halvings. The start grows by 2²⁰ = 1,048,576 per unit of k, but the endpoint grows by only 3¹² = 531,441, so the endpoint stays below the start for every k.

The full source has been replayed on Linux, Windows, and a clean public clone. Independent review is still open.

Open for review · pinned computation · November 30, 2026

How narrow can the wrapped grid be?

In the Ising count check now open for review, the three boundary-count formulas for a 12-row triangular grid start at 16 columns. The packet includes the argument, exact counts near the boundary, and Python replay commands. Finding an error is a welcome result.

How it works

From a question to a receipt

  1. Pin the statementThe question becomes an exact Lean proposition, and a person confirms that it means what was asked.
  2. ProposeAn AI model, a search, or a person supplies a candidate proof. Until it is checked, it is only a proposal.
  3. CheckLean compiles the proof with a pinned toolchain, and the axiom report is audited.
  4. RecordInputs, outputs, and the verdict are saved by SHA-256 hash. Failed attempts are kept too.
  5. Explain and reuseA verified result gets a plain explanation and can be imported by later proofs.

Straight answers

What MathCase does not claim

A warm-up you can try · Ramsey’s triangle puzzle

Can six dots avoid a one-color triangle?

Every pair of dots is connected. Can you color the lines so that every triangle uses both red and blue?

Tap a line to switch its color, then check your work. You can also edit each line by number.

Work on your own claim

Another exact check: Try your own denominator

0 of 15 lines colored. Tap a line or load a sample to begin.

Edit lines by number
Why is a triangle unavoidable?

Pick any dot. At least three of its five lines share a color. Suppose that color is red.

Look at the three dots on the other ends of those red lines. If any two are joined by red, they make a red triangle with your first dot. Otherwise all three lines between them are blue, so those three dots make a blue triangle.

The same argument works with the colors reversed.

Go deeper