
mathcase-fractions
io.github.DarthCeltic/mathcase-fractions
Check Egyptian-fraction identities and replay the exact result on the MathCase board.
Documentation
MathCase
MathCase lets you test a mathematical claim, inspect a proof that Lean checked, and reuse it in a second problem.
Devpost judges · Open the proof walkthrough · Watch the 2:57 demo · View the Devpost submission
Try the six-dot puzzle in your browser. Color the lines red or blue and see whether three dots form a triangle of one color. For a proof example, open the saved attempt Lean rejected and the correction it accepted.
Browse all cases for more puzzles, checked proofs, and instructions for repeating the checks. The aiXiv subject map matches 155 listed categories to MathCase cases, supporting artifacts, and proposals; its evidence labels describe MathCase work, not aiXiv submissions.
Open MathCase and start a case · Explore saved proofs · Open in GitHub Codespaces · Download the source ZIP
Work with MathCase
To suggest a question, reproduce a result, or review a proof, use MathCase collaboration issue #68. For project or hiring questions, use the portfolio contact page. Include the command, platform, exit code, and receipt with a reproduction report so another person can check the same bytes.
Work on your own proof
Open the visitor workbench and start with the worked 4-and-2 counterexample. It saves your cases in this browser. If you only have a plain-language idea, Copy for my AI now prepares a review prompt asking for an interpretation, assumptions, an exact Lean proposition, and draft source; review that translation before filling the technical fields. Choose Open Lean editor below to load the source, plus an exact-target check when you have filled in its proposition and theorem name, into the embedded public Lean editor. Press the editor's own Run control to see Lean's output on the same page. A collapsed Prefer a separate window? option is available if you want it. The public editor chooses its own Lean/Mathlib version, which may differ from MathCase's pinned Lean 4.33.1 local checker, and it does not create a MathCase receipt. You can also copy the case for your own model, download the Lean file, or export the full case packet.
If the embedded editor says No connection to Lean or stays on Updating…, the online checker has not checked the proof. Reconnect from draft reloads the code currently in the workbench; copy any edits from the embedded editor back first. If the hosted worker still cannot connect, use the pinned local-check instructions below the editor. The online editor follows its own release, so its Lean/Mathlib version can differ from MathCase’s pinned Lean 4.33.1 check.
The stronger local check uses the exported case packet. It asks the pinned Lean compiler to prove the exact proposition from the named declaration, prints the theorem's axiom dependencies, and writes a receipt binding the plain claim, target, source, and generated check. The hashes preserve which bytes were checked; a human still needs to verify that the English claim matches the Lean proposition. To run this locally with Lean 4.33.1 installed, use:
python scripts/check_visitor_case.py --case-packet MyCase.mathcase.json --receipt MyCase.receipt.json
From the visitor workbench, Save the whole claim downloads the packet and Load checker receipt compares it with the current browser draft. The imported record remains visitor-supplied evidence, not a MathCase signature. To run the same command through the public case launcher, use python scripts/run_public_case.py visitor --case-packet MyCase.mathcase.json.
Check a saved arithmetic receipt without Lean
If someone sends you a MathCase prime-envelope receipt, you can check the saved finite arithmetic without installing Lean or calling a model. From the repository root, run:
python -B research/number-theory/egyptian-fractions/prime-envelope-v1/check_input.py --verify PATH_TO_RECEIPT.json
REPLAY_MATCH means the receipt's inputs, source version, digest, and recorded
finite result agree with the checker in this checkout. A damaged or mismatched
file is rejected. This does not prove that the English question matches the
formal statement, does not create a new Lean proof, and does not turn a
finite cap into a claim about all primes. The same instructions are available
as the repository's portable verification skill.
The older source-only command remains available: python scripts/check_visitor_case.py MyCase.lean --receipt MyCase.receipt.json. It checks whether Lean accepts that source, but it does not bind a displayed claim or target and it does not report axioms. For a source that imports Mathlib, provide --lake-project PATH for an already prepared local Lean 4.33.1 project with its manifest and dependencies present. The checker does not install Lean, update Lake, or fetch packages. A Codespace can install the pinned Lean Core toolchain; it does not include Mathlib by default. GitHub may charge for Codespaces usage under the account's plan. To keep a proof and receipt in Git, fork MathCase, use a Codespace on your fork, and commit the files there.
MathCase makes a mathematical claim inspectable from first example through formal proof and reuse. In the public saved-case walkthrough, test why 4 ∣ n² → 4 ∣ n fails at n = 2 and inspect a recorded NVIDIA Nemotron proposal and Lean rejection for the corrected prime-divisor theorem. The local Case Desk also shows how the saved √2 infinite-descent case uses that checked parent lemma. The separate Tavily card is labeled as a saved source-search result; it did not feed that prime proof.
This repository includes the actual Case Desk frontend and Python backend used to read the saved proof story, plus the forkable Go CLI/provider core, a bounded BYOK Tavily command, a read-only MCP connector, and selected Lean examples. The Case Desk opens without an API key or paid call. Its public reader currently exposes two saved cases; new provider work is a separate explicit CLI action.
Open the Case Desk — Python only
Install Python 3.11 or later. Clone this repository, or download the source ZIP above and extract it. Open a terminal in the extracted MathCase-main folder (or your clone), then run:
python -B scripts/start_public_case_desk.py
Open the local Case Desk. No package install, API key, Go, Lean, model request, or compilation is needed to read these saved cases. The launcher removes inherited provider keys from the server environment. Use --port 8000 if the default port is occupied.
Try this short path:
- Open Counterexample and test
d = 4, n = 2. - Open Prime lemma, choose Chalkboard, and follow the mathematical steps.
- Open History: inspect the rejected attempt and the correction Lean accepted, then expand the exact proof and receipts.
- Choose Build on it: √2, inspect the compiled child, and follow its link back to the exact checked parent.
These are saved executions. The public Case Desk rejects writes and new model/search requests. Independent meaning and exposition review remain pending. Reading position, ink and board style are browser preferences; proof records remain unchanged. See the Case Desk guide for evidence checks and fork development.
The public homepage offers both Make a case and Open a saved case. To open the counterexample directly, use the saved case reader. To export it for your own static host, follow the static Case Desk guide. The source checkout also retains the lightweight reader at its root: run python -m http.server 8000 and open http://127.0.0.1:8000/.
Public math results and reproduction
Browse the datasets for original downloads, SHA-256 digests, and replay instructions.
See the research roadmap for the current demonstrated scope, open limits, and next measurable milestones.
What MathCase has demonstrated so far
MathCase can state a precise mathematical question, test its checker against
bad input, and preserve a bounded result with source hashes and receipts. It
has reproduced selected Lean, arithmetic, graph, coloring, geometry, and finite
Ising results, and it has a clean public-clone replay for the large M15–M20
bundle. The remaining research-lab steps are deliberately visible: an
independent mathematical review, a held-out transfer comparison, and a new
general bound or breakthrough have not yet been established. A bounded search
miss is recorded as UNKNOWN, never as an impossibility proof.
A bounded Collatz proof you can rerun
For every start n ≥ 3, if at most 14 of its first 23 accelerated Collatz steps begin on an odd number, an ordinary iterate is below n by step 37. Lean checked the exact count: 7,507,638 of 8,388,608 residue classes modulo 2^23 meet that condition. This is a bounded first-drop theorem and a demonstration of proof checking; it is not a new Collatz discovery and does not prove that every sequence reaches 1.
The package now includes a separate 23/14-only source runner and a recorded pass from an anonymous public clone at MathCase commit 343e9e9. From the repository root, with Lean 4.33.1 available, use the normal case action:
python -B scripts/run_public_case.py collatz-parity-envelope-23-14 --lean PATH_TO_LEAN_4_33_1
A fresh public checkout passed this command on Windows in 14.251 seconds using the official Lean 4.33.1 distribution. See the recorded run and the plain-language worked example.
The case catalog documents local commands. They are runnable routes, not a count of independently established results. Finite parity-class percentages are counts for a stated modulus and horizon; they do not measure the share of Collatz trajectories that converge or imply progress toward convergence. The public reproduction index separates recorded Lean checks from arithmetic checks and external source-identity checks.
A second bounded Collatz filter: 13 of 22
The newer 13/22 package checks a different finite parity condition: if at most 13 of the first 22 accelerated inputs are odd, Lean proves a first drop by ordinary step 35 for every start n ≥ 3. Exactly 3,593,934 of 4,194,304 residue classes modulo 2^22 qualify (85.6861%). This is a bounded descent statement with a fresh four-module replay route; it is not a convergence proof, a claim that 85.6861% of integers converge, or a novelty claim.
The finite 14/23 arithmetic control independently checks all 2^23 parity classes using three positive representatives per class: 7,507,638 of 8,388,608 qualify, with zero endpoint failures across the three representative passes. A separate scalar cross-check samples 8,423 residues and 25,269 representatives. It is an exact finite control, not a Lean theorem, convergence result, or priority claim; it does not promote a residue-class count into a percentage of all Collatz trajectories.
The Dahan Theorem 3.9 replay has now been extended to 1,000,000 eligible primes with zero row failures and an independent identity audit. It remains a finite replay of a published criterion, not an Erdős–Straus proof or an asymptotic claim. See the 1,000,000-row receipt, with the 500,000-row receipt and earlier 300,000-row receipt preserved.
Three newer frontier results are easy to miss from the front door: the Weak Schur 65-position DRAT anchor shows that any valid five-coloring of 1..208 must change at least one of 65 specified positions in the known 207-coloring (not a minimality claim); the Ising width-16 threshold is an exact finite coefficient calculation, not a thermodynamic-limit theorem; and the latest C7 368-word search remains UNKNOWN after a bounded miss, with the published 367-word construction unchanged.
Additional source audits, small worked examples for upstream results, exploratory finite searches, and records whose independent replay remains open are collected in Diagnostics and lab notes. Their original source files, records, and URLs remain available. The proof library is an optional reference, not a substitute for replaying a theorem.
The bounded prime-denominator case is also available through the normal launcher. Run python -B scripts/run_public_case.py prime-envelope --prime 881 --offset 3 to create and verify a source-bound receipt; the result is exact arithmetic over the existing Lean-classified rule, not a fresh Lean proof for each input.
The 2,652-family M20 result and its replay status remain documented in MathCase results and limits and the reproduction index. Two runner-bound full source replays completed on Nov. 26: a Linux-container run and a separate native Windows run, each compiling 363 modules and completing 23 axiom groups over 4,262 declarations. A Nov. 27 Windows attempt also preserves a status-publication failure and a run-local recovery of all 386 stages; it is supplemental evidence because it reused its own completed outputs. The native run matched all 363 Nov. 18 Phase 2 output hashes; its same-host artifact audit passed. A clean public-clone replay is also recorded in the 2026-11-28 receipt. The remaining open item is an actually independent reviewer run; the native replay was not recorded as OS-level network-isolated. See the native Windows receipt and the preserved failure/recovery record.
A new finite bridge audit checks that every one of those 2,652 listed rows satisfies the separately Lean-checked 12-of-20 parity condition and reaches its recorded base endpoint by both step conventions. It combines with that broader theorem but does not replace or complete the historical 363-module replay. See the bridge explanation and command.
The case catalog separates visitor examples, exact Lean replays, finite arithmetic checks, and external source checks. Each runner ID names an action, not a proved theorem. The bounded research tracks have a separate frontier evidence package, runner, and plain-language page; a completed bounded search can still return UNKNOWN and does not prove impossibility.
For a compact human review route, use the independent-review checklist. It names the commands, controls, exact claim boundaries, and evidence to preserve for the main public cases.
The public R(5,5) Lean bundle records a known lower-bound witness compiled with a warm cache; a fresh-checkout rebuild remains unverified. The public repository also documents its narrowly scoped historical scanner exceptions and fail-closed future-finding gate.
Self-host a classroom (local prototype)
The browser-based classroom file handoff needs no server. If you want local accounts and assignments stored on your own machine, install Go and run go run ./cmd/mathcase classroom-serve. It binds to 127.0.0.1:55136 by default and prints the path to a one-time teacher setup token; open that file locally to create the first teacher account. The service stores password hashes, assignments, and submissions under your user configuration directory. Keep that directory private. For the full setup and security limits, see the self-hosted classroom guide.
This is a local prototype. It does not send data to MathCase, call a model, run Lean, or create proof receipts. Do not expose it directly to the public internet. The file handoff remains the simplest option when separate accounts and shared local storage are not needed.
Optional CLI and Lean setup
Run the public test suite
From a clean checkout, run the provider-free repository tests with Python's isolated import path:
python -I -B -m unittest discover -s tests -t . -p 'test_*.py' -v
python -I -B -O -m unittest discover -s tests -t . -p 'test_*.py' -v
Both commands should report 45 passing tests. The suite uses only local
fixtures and rejects malformed receipts; it does not call a model provider,
Tavily, Lean, or any paid service. The -O run is a second control with
assertions removed.
Requirements: Go 1.27 or later, Lean 4.33.1 via elan/lake, and PowerShell 7 on Windows:
.\scripts\setup-public.ps1
This builds bin/mathcase.exe and runs the separate local R0b Lean proof with its axiom audit. It does not contact a model provider, Tavily, or any paid service.
An optional Collatz descent appendix includes agent-authored Lean proofs covering 7,825 of 8,192 residue classes within 21 steps, a separate 96-step family, and a fresh DeepSeek proof that passed unchanged after receiving a checked worked example. It records all fifteen provider-call outcomes and $0.473748 in provider cost. These are partial descent results, not full Collatz convergence or a novelty claim, and are separate from the saved Case Desk story.
The CLI is also available directly with go run ./cmd/mathcase. Use go run ./cmd/mathcase solve-provider -h to inspect the BYOK command. Provider dispatch is a separate explicit action and requires user-supplied authorization, item-level input clearance, price ceilings, a pinned Lean verification environment, and an API key in an environment variable. No key, grant, provider profile, corpus, or private run archive is included here. A route can use an OpenAI-compatible endpoint such as Nebius when the user supplies its exact endpoint, model, key variable, authorization, and clearance. Dispatch was not used for this release check.
The optional MathCase MCP fraction demo runs a local exact check and returns a receipt that reopens on Your board. The same local connector now has a coordinate-midpoint demo, backed by the public midpoint board and an exact integer receipt; its hosted endpoint and installable fraction bundle remain fraction-only. The setup guide includes configurations for Codex, Antigravity, and Kiro.
Optional Tavily search (BYOK)
The separate Python command searches one operator-supplied, single-line math statement. From the repository root, with Python 3.11+:
$env:TAVILY_API_KEY = Read-Host "Tavily API key" -MaskInput
python -m mathcase.tavily --statement-file .\my-statement.txt
Remove-Item Env:TAVILY_API_KEY
The statement file is your own UTF-8 file. --statement "..." also works for short public statements. The command sends the exact trimmed statement as one Tavily basic search, limited to 400 characters, six results, an eight-second timeout, and a one-megabyte response. It requests credit usage and refuses output unless Tavily confirms one credit. The output is bounded JSON on stdout with a statement SHA-256, provider request ID, credit count, URLs, snippets, and an untrusted-reference boundary. It does not write a result file or save the key. Redirect stdout yourself only if you intend to keep the returned snippets and URLs.
This command does not check your plan or remaining balance before dispatch. A basic search consumes one Tavily credit under Tavily's current pricing; timeouts and transport failures may leave usage uncertain, so do not retry blindly. Tavily results are leads for manual source review, not proof or novelty evidence. This command is independent of the static demo, the MCP connector, and Go proof workflows.
What the demo shows
The site presents two saved cases: a checked arithmetic counterexample and a known prime-divisibility theorem checked in Lean, with the rejected attempt and accepted correction shown together. Opening the site makes no model, Lean, or Tavily call. The separate Tavily panel shows a saved summary and six title-and-URL source cards, without search excerpts; those results were not used to generate or verify the proof. Nebius supplied historical proof candidates in the saved prime example; Lean's kernel and axiom audit determined the saved check result. The √2 child remains a separate source-replay artifact, not a third saved reader case.
The saved examples demonstrate these specific records. They do not establish novel mathematics, broad problem-solving ability, measured model performance, independent exposition review, or corpus clearance. The root NOTICE covers the static Case Desk subset; SOURCE_NOTICE.md covers the additional source-edition files, including the connector. saved-demo/site-manifest.json records the saved demo file hashes.
Public-edition scope
This repository includes the real Case Desk frontend and backend with a bounded public read-only profile, MathCase's Go solver and provider orchestration code, Python routing primitives, the standalone BYOK Tavily command, the read-only MCP connector, provider and authorization schemas, and a Lean-core local proof. The public profile selects two saved cases through an explicit file/route manifest. Campaign data and endpoints, private corpora and source catalogs, unrelated machine-local receipts, and uncleared explanation/dossier JSON remain excluded. There is no bundled training or evaluation dataset.
The provider integration supports explicit OpenAI Chat Completions, Anthropic Messages, and Google Gemini request protocols. Compatible endpoints may be configured by the user. The public edition has no automatic provider selection or fallback. The Python model router is an injected-adapter foundation; the Tavily command is a separate research route. See docs/public-edition.md for the support and evidence boundaries.
Research notes and collaboration
Fixed-density Ising paper gives a uniform half-filled result, exact finite checks, and a standalone Lean receipt.
Boundary counts on half-filled triangular tori gives exact finite replays and a three- and four-row proof draft. The fixed-height extension proposes an explicit sufficient circumference for every fixed height of at least three, adds an independent coefficient cross-check at heights nine through twelve, and remains a review draft pending independent proof and priority review. The separate 4×66 boundary case is a dependency-free finite counterexample to extending one adjacent-bin log-concavity pattern to every even width.
Fixed-cardinality Ising boundary counts includes a 35-shape classification, a general proof draft, and a one-command offline replay.
Public question catalog · Cite MathCase · Collaborate or report a reproduction
License
MathCase-authored source and proofs are licensed under Apache-2.0 except where NOTICE or a file-specific term says otherwise. Go, Python, Lean, and other dependencies retain their own licenses. No external corpus or third-party excerpt is bundled in this source edition.
https://github.com/DarthCeltic/MathCase/releases/download/mathcase-fractions-v1.0.1/mathcase-fractions.mcpb# mcpb: https://github.com/DarthCeltic/MathCase/releases/download/mathcase-fractions-v1.0.1/mathcase-fractions.mcpb