Fairtally

cslib-frontier #4322, Milestone 4

Milestone 4 proof map

A refuter takes a circuit that is too small to compute a hard function and finds an input where the circuit gets it wrong. cslib-frontier already has that algorithm for its 4n - 9d circuit lower bound, proved correct in Lean. Milestone 4 turns the proved algorithm into proved machine code: a Word-RAM program with a counted number of instructions.

Why it matters: a correctness proof says nothing about speed, so this milestone has Lean check an instruction count as well, in the library's Word-RAM cost model, for a concrete program proved to give the same answer as the proved algorithm.

  • The pull requests on this map are ours: Sentria Inc., written with AI agents and disclosed on every one. AI disclosure.
  • No running time for the whole refuter is claimed yet. Every instruction bound below is for one step or one routine.

Last updated 2026-11-29. The pull requests for 6 of 9 checklist items are merged upstream. Counts below are checklist items, not lines of proof.

6items with merged pull requests
1in review upstream, not merged
2to do

What is left

1 2 3 4 5 6 7 8 9

The 9 checklist items in order: 6 merged upstream, 1 in review upstream, 2 to do. Select a number to find the item in the tree.

  • Item 5: 4 of 14 pull requests merged (#9166, #9167, #9247, #9278); the rest follow one or two at a time
  • Item 8: about 6 pull requests (estimate); the largest piece still to write, includes the step-choice code; no code yet
  • Item 9: small: one pull request (estimate)

Next up: open the next pull request of the item 5 stack and get it reviewed, as each one merges.

Estimate, not a promise: best case late December 2026, most likely early to mid January 2027.

Happening now

  • Item 5 (block 2) is in review upstream: 4 of 14 pull requests are merged (#9166, the callable elimination; #9167, the packed primitive operations; #9247, the packed deletion steps and affine representation; and #9278, the packed step proved equal to applyStep). The next one is not open yet. The rest is complete on our machines: build green, reviewed by us.
  • Item 8's design is written and reviewed by us. One design point (the step-choice code) is still open. No code yet.
  • #9166, #9167, #9247 and #9278 each had an upstream review before they merged; the local blocks have had none.

Next

  • Keep opening item 5 as small pull requests, one or two at a time, as each merges.
  • Then build item 8: about 6 pull requests (estimate), the largest piece still to write. It includes the step-choice code.
  • Then item 9, which is small.

What it means

  • When item 5 merges, 7 of 9 checklist items are done.
  • Item 8 makes the whole refuter one checked program: input setup, the step loop and the final search.
  • Item 9 is the final theorem: a counted Word-RAM instruction bound for that program, in the library's cost model. The library's refuter file says its poly(n, 2^d) running time "is not formalized" there; item 9 would make it a checked statement about a concrete program, with the cost of evaluating f kept as a parameter. Refuter.lean

Scenarios estimates, not promises

  • Best case: item 5 merged in early December, items 8 and 9 land by about December 20 to 24.
  • Most likely: early to mid January 2027.
  • Worst case: late January or later, if item 8's main proof (matching the candidate list on machine words) needs a redesign, if holiday review slows merges, or if the library's toolchain moves again.
  • The work could also stall if a step proves much harder than planned. The merged parts would still stand.

Also on Fairtally: the pilot review of 25 claimed solves.

The map

One tree, read from the top: the goal, then what has to be finished before it, down to the merged foundations. The numbered boxes are the 9 items of the Milestone 4 checklist on cslib-frontier #4322, numbered in the checklist's order. A box that several others need is drawn once, with a line to each. Select a box for its bound and its record.

  • merged upstream
  • in review upstream
  • proved locally
  • to do
14 of 21 boxes under the goal are not merged yet.

Lines are computed from the recorded built-from data. A line that two others already imply is left out. Item 5 is drawn as its 6 groups; the 6 parts of item 8 (8a to 8f) are a plan with no code yet. Every box says where its record is: a pull request, "local only" or "planned".

Detailed gridAll 9 checklist items and the 32 parts inside item 5, one block each, with every recorded built-from line.

Merged upstream

6 of 9 items
feeds

Open: in review upstream or proved locally

1 of 9 items
Inside item 5: block 232 parts: 2 merged upstream, 30 proved locally. The local parts are not merged: each one becomes a pull request in turn.

Pure layer

Functions on words, no program. A work-in-progress copy is public on our fork, with no pull request.

Callable elimination

Word-RAM code: the elimination program of item 2 with a frame, so other programs can call it
each program below is proved equal to its pure definition

State operations as Word-RAM code

One certificate per operation, from the memory image of a state to the image of the operated state

Searches as Word-RAM code

Scans and the affine-representation oracle
called by

Step programs

A fixed program for each of the 11 refuter steps (D1 and D3 share one), each certified against the pure step pApplyStep
selected by

Dispatch

to be composed into

To do

2 of 9 items

Table view

Every block of the map as text. Bounds are copied from the Lean statements, character for character, with the definitions they name underneath. They count instructions in the library's Word-RAM cost model, per step or per routine; the one exception is item 1, which counts refuter steps. No running time is claimed for the refuter as a whole.

BlockStatusWhat it doesProved boundRecord
Checklist items
1. Step count and state-size bounds merged upstreamBounds how many steps the refuter loop takes and how large every state and equation name can get.refute_steps: 5 * n + 7 * C.sizea count of refuter steps, not of instructions (#8971); n is the number of inputs and C.size the circuit sizePR #8971, PR #8972
2. Dense F2 elimination merged upstreamGaussian elimination over F2 as a Word-RAM program, one matrix row per machine word.computesInTime_decide: 30 * (q.val.rows.length + 1) * (q.val.width + 1)as stated on upstream main on 2026-11-28; word instructions for a system q with that many rows and columnsPR #8920
3. Candidate list for the final search merged upstreamOne candidate construction as the specification of the refuter's final search, with a short-circuiting search.nonePR #9000
4. Packed state and its invariant merged upstreamBlock 1: the refuter state as machine words (masks, gate table, equation words, pairs, phi rows) and the relation Rep that says what the words mean. No program.nonePR #9055
5. Reusable step code proved equal to applyStep in review upstream (in review upstream: 4 of 14 PRs merged (#9166, #9167, #9247, #9278))Block 2: Word-RAM code for one refuter step, opened upstream as a stack of 14 small pull requests (trickle mode, at most 2 open). 4 of 14 are merged: #9166 (the callable elimination), #9167 (the packed primitive operations), #9247 (packed deletion steps and affine representation) and #9278 (the packed step proved equal to applyStep). The next pull request of the stack is not open yet. The remaining blocks (the rest of the state operations, the searches, programs for all 11 refuter steps and the dispatch) are proved on our machines (targeted build green) and are not pull requests yet.nonePR #9166 (merged), PR #9167 (merged), PR #9247 (merged), PR #9278 (merged)
6. Circuit input layout merged upstreamThe input circuit as a word list (three words per line) and a fixed program that decodes it and stores the packed initial state.exec_initCode: initTime CinitTime C := 6 * n + 73 * C.size + 50merged 2026-11-28 (PR #9097); n is the circuit's input count and C.size its sizePR #9097
7. Evaluator contract merged upstreamWhat one call of the hard function f costs and what it may touch: a fixed program with a per-call instruction bound, a workspace window and a frame.FramedEvaluator.exec_loop: (N - s.regs index) * (tPrep + E.cost + tCont + 2) + 2a counting loop of evaluator calls from the start index up to N (here N is the loop limit and E the evaluator, not the letters used inside item 5); E.cost is the contract's per-call bound, tPrep and tCont the caller's own code around each callPR #9101
8. Iterator and evaluator composition to do (planned in 6 parts)Checklist line: packed BitString n output plus a separate success flag, with success guaranteed under the refuter hypotheses. Not started. Our plan splits it into six parts, 8a to 8f (about 6 pull requests, an estimate). It is larger than the checklist line suggests: choosing the step has no code yet, so the plan adds it (8b, 8c).nonechecklist
9. Final bound to do (planned, small)Checklist line: refuter overhead plus candidate count times (evaluation plus setup). Not started. Planned as one small pull request (150 to 300 lines, an estimate): arithmetic on the time of item 8's program, no new program.nonechecklist
Inside item 8: planned parts (a plan, no code yet)
8a. Pure search specification to doThe refuter's search as one function on code that is already merged: the final search on the terminal state of the run. Planned theorems: a returned point is an actual disagreement, and the search succeeds under the refuter hypotheses. Also lemmas about the run (terminal state, step budget, fresh equation name) and the index order of the candidate assignments.noneplanned; no code yet
8b. Packed step choice, pure to dochooseStep? on machine words: every search of the step choice as a function on the packed state, to be proved equal to chooseStep? on a represented valid state. Planned through precomputed masks, so that the code of 8c can mirror it.noneplanned; no code yet
8c. Packed step choice, code to doA Word-RAM program that computes the step choice and leaves it in the registers that stepCode reads, with tag 11 for no step. Nothing chooses the step in code today: item 5's stepCode takes the step as an input. The plan calls the step choice (8b and 8c) the largest part of item 8, and it was not visible in the checklist line.noneplanned; no code yet
8d. Run loop to doThe input setup of item 6, then the loop: choose a step, run stepCode, until no step is chosen. To be certified to reach the packed image of the refuter's terminal state within a counted number of instructions. The step count comes from item 1.noneplanned; no code yet
8e. Packed candidates, pure to doThe candidate list of the final search as functions on machine words, to be proved equal to the candidate list of item 3. The plan names this the main proof risk of item 8.noneplanned; no code yet
8f. Search code, composition and runner to doWord-RAM code for the final search: a circuit evaluator, the candidate family, the point, and a loop over all 2^d candidates that calls the evaluator of item 7. Composed with the run of 8d into one program. Output: one result word, bit 0 the success flag and bits 1 to n the packed point. This is where the item 8 statements are planned.noneplanned; no code yet
Inside item 5: Pure layer
Packed operations merged upstreamThe state primitives of applyStep as functions on words (subst, deleteGate, restrictAvoid, deleteEqn, dropEqn, moveAffine, swap, addPair), each with a Rep transport theorem (the one for subst is private).nonePR #9167
Pure packed step proved locallypApplyStep performs one refuter step on the packed state. Rep.pApplyStep proves it represents applyStep at every step that chooseStep? takes on a valid state, under the hypothesis S.freshEqn < E (the fresh equation name is below E; used only by a move).nonelocal; WIP copy on our fork (950b2fae, no pull request)
Inside item 5: Callable elimination
Callable elimination merged upstreamThe elimination program of #8920 with a frame, so other programs can call it in their own memory window, plus its row pass as a public routine.exec_elimPass: 14 * W.length + 3W is the list of words in the windowexec_elimCode_words: 30 * (W.length + 1) * (n + 1)W.length words, each with n columns (here n is the column count of the system)PR #9166
Inside item 5: State operations as Word-RAM code
Substitution proved locallySubstitutes a literal for a name in every gate row, every equation word and the output.exec_substStateCode: 37 * N + 14 * E + 49exec_substPass: 14 * W.length + 9W is the list of words in the windowexec_gatePass: 37 * R.length + 7R is the list of gate rows in the windowlocal only
deleteGate proved locallyDeletes a gate: substitution, then clears its bit in the gate mask.exec_deleteGateCode: 37 * N + 14 * E + 60local only
restrictAvoid proved locallyRestricts a parameter to a literal: substitution, the parameter rows, the parameter bit, and a filter that drops pair records naming it.exec_restrictCode: 37 * N + 14 * E + 14 * n + 20 * P.pairs.length + 93P.pairs.length is the number of pair recordsexec_pairFilterCode: 20 * m + 17with the hypothesis P.pairs.length = mlocal only
deleteEqn proved locallyDeletes an equation by substituting for one of its variables, then drops the equation word.exec_deleteEqnCode: 37 * N + 14 * E + 68local only
dropEqn, dropTrivialEqn proved locallyClears an equation word, with or without clearing an auxiliary bit.exec_dropEqnCode: 18exec_dropTrivialEqnCode: 8local only
moveAffine (operation) proved locallyTurns an affine gate into an equation word and updates the gate and auxiliary masks.exec_moveAffineCode: 73local only
swap proved locallyExchanges a parameter and an auxiliary name: four mask updates and a substitution pass on the parameter rows.exec_swapCode: 14 * n + 57local only
addPair proved locallyAppends one pair record.exec_addPairCode: 18local only
Constraint deletion proved locallyDeletes the gate or equation named by a child code. Shared by D1, D3 and Cases 2, 3, 4 and 5a.exec_deleteConstraintCode: deleteConstraintTime N EdeleteConstraintTime N E := pDeleteEqnTime N E + 3exec_pDeleteEqnCode: pDeleteEqnTime N EpDeleteEqnTime N E := 65 * N + 14 * E + 103local only
Inside item 5: Searches as Word-RAM code
Scan loop, fresh equation name proved locallyA generic scan loop that the other searches are built on, and its first client: the largest alive equation name plus one.exec_freshEqnCode: 13 * E + 12exec_scanCode: N * (T + 8) + 6generic scan over N indices with a test of cost Tlocal only
Term searches proved locallyThe two term searches of equation deletion: the least common bit of two words, and the least bit other than a given name.exec_bothBitsCode: 13 * N + 6exec_otherBitCode: 15 * N + 6local only
Reader search proved locallyFinds a gate that reads a given gate.exec_readerCode: 28 * N + 12local only
rowLit proved locallyReads a gate row as a literal (argument code and negation bit), straight-line code.exec_rowLitCode: 25local only
Pair search proved locallyFinds the pair record that contains a given name: one flat scan with an inner loop over the k records.exec_pairSearchCode: 8 * N * (12 * k + 32) + 39with the hypothesis P.pairs.length = klocal only
Children search proved locallyFinds the first two children (gates or equations) of a name, in two scans.exec_childrenCode: (N + E) * 61 + 21local only
Evaluation oracle proved locallyEvaluates an auxiliary name under one assignment: copies the system's rows to a scratch window, then calls the elimination program.exec_evalAuxCode: evalAuxTime N EevalAuxTime N E := 18 * (E + N) + 30 * (E + N + 2) * (N + 1) + 34local only
findAffineRepCode proved locallyComputes the affine representation of an auxiliary name over the parameters: N + 1 calls of the evaluation oracle.exec_findAffineRepCode: findAffineRepTime N EfindAffineRepTime N E := (N + 1) * evalAuxTime N E + 11 * N + 6local only
Inside item 5: Step programs
D1: delete a constant gate proved locallyThe step deleteConstantGate J. pApplyStep_deleteConstantGate shows it is constraint deletion of the child code J.exec_deleteConstraintCode: deleteConstraintTime N EdeleteConstraintTime N E := pDeleteEqnTime N E + 3pDeleteEqnTime N E := 65 * N + 14 * E + 103local only
D2: delete a dead gate proved locallyThe step deleteDeadGate J: delete the gate as the constant 0.exec_deleteDeadGateCode: 37 * N + 14 * E + 62local only
D3: delete a short equation proved locallyThe step deleteShortEqn e. pApplyStep_deleteShortEqn shows it is constraint deletion of the child code N + e.exec_deleteConstraintCode: deleteConstraintTime N EdeleteConstraintTime N E := pDeleteEqnTime N E + 3pDeleteEqnTime N E := 65 * N + 14 * E + 103local only
moveAffine proved locallyThe step moveAffine J: find a fresh equation name, then move the affine gate into the system.exec_moveAffineStepCode: 13 * E + 87local only
D4: unit deletion proved locallyThe step deleteUnitParam x e: a guarded search over names with the affine representation, then swap and dropEqn.exec_pUnitDeleteCode: pUnitDeleteTime N E npUnitDeleteTime N E n := (N + 1) * (findAffineRepTime N E + 17) + 14 * n + 74local only
Pair creation proved locallyThe step pairCreation G: load the row, find the reader, add the pair, delete two gates.exec_pairCreationCode: pairCreationTime N EpairCreationTime N E := 102 * N + 28 * E + 220local only
Case 2: degenerate pair proved locallyThe step degeneratePair p: pair search, children, then one of three outcomes.exec_degeneratePairCode: degeneratePairTime N E n P.pairs.lengthdegeneratePairTime N E n k := 8 * N * (12 * k + 32) + (N + E) * 61 + 167 * N + 42 * E + 14 * n + 20 * k + 420local only
Case 3: partners share a child proved locallyThe step partnersShareChild p: an equation child or a gate child, each with its own decision tree.exec_partnersShareChildCode: partnersShareChildTime N E n P.pairs.lengthpartnersShareChildTime N E n k := 8 * N * (12 * k + 32) + 61 * (N + E) + 102 * N + 28 * E + 14 * n + 20 * k + 320local only
Case 4: pair in the system proved locallyThe step pairInSystem p: pair search, children, restriction, deletion of the partner's child, then unit deletion.exec_pairInSystemCode: pairInSystemTime N E n P.pairs.lengthpairInSystemTime N E n k := 8 * N * (12 * k + 32) + 183 * (N + E) + 102 * N + 28 * E + 14 * n + 20 * k + pUnitDeleteTime N E n + 400local only
Case 5a: AND on a pair proved locallyThe step andOnPair G p: two pair searches, children, the reader, then restrictions and deletions in one of two sequences.exec_andOnPairCode: andOnPairTime N E n P.pairs.lengthandOnPairTime N E n k := 2 * (8 * N * (12 * k + 32)) + 122 * (N + E) + 310 * N + 98 * E + 42 * n + 60 * k + 1000local only
swapAuxIn proved locallyThe step swapAuxIn G: the affine representation of the gate's auxiliary argument, then a gate deletion or an exchange with an unpaired parameter.exec_swapAuxInCode: swapAuxInTime N E nswapAuxInTime N E n := findAffineRepTime N E + 65 * N + 14 * E + 14 * n + 210local only
Inside item 5: Dispatch
Dispatch: stepCode proved locally (build green, our review done)One program that branches on the step tag to the step programs. exec_stepCode certifies it against pApplyStep with the per-step bound stepTime, for a state with at most N pair records. Rep.exec_stepCode lifts that to applyStep on a represented valid state, at the step that chooseStep? picks, when S.freshEqn < E. Choosing the step and the loop around it are not in this block. The build is green on our machines at fd09ed42. Our own fresh-context review of this block is done: 7 findings, fixed except style items kept for the pull requests. No upstream review.exec_stepCode: stepTime N E n P.pairs.length cc is the step; stepTime adds the dispatch instructions to the bound of that step's programstepTime_le: stepTime N E n k c ≤ stepTimeBound N E n kstepTimeBound N E n k := 2 * (8 * N * (12 * k + 32)) + 183 * (N + E) + 310 * N + 98 * E + 42 * n + 60 * k + pUnitDeleteTime N E n + 1030one bound for every step choice; it bounds a single step, not the refuter runlocal only

How to read it

merged upstream
Merged into cslib-frontier's main branch after upstream CI and an approving review there. Upstream approving reviews are signed by the project's reviewer or coordinator agents.
in review upstream
An upstream pull request that is open and not merged yet. It has had no approving review unless its row says so, and it can still change before it merges.
proved locally
The Lean proof builds on our machines with axiom guards (propext, Classical.choice, Quot.sound only). It is not a pull request and has had no upstream review.
to do
Not started.

Symbols in the bounds

N
name bound: every gate, parameter and auxiliary name is below N
E
number of equation words
n
number of parameter rows
k
number of pair records in the state; the theorems instantiate it with P.pairs.length
m
in exec_pairFilterCode, the number of pair records
W.length, R.length
number of words or gate rows in the window a pass works on
c
the step choice (a StepChoice)

These letters apply to the blocks inside the step code, unless a block's note says otherwise. Bounds of other items name their own quantities.

Local work is on the branch m4-block2 at fd09ed42. Names and bounds of the local blocks were read from the Lean statements at 48e76361. The head adds a cleanup of Case 5a and of the tests that leaves the public statements as they were. The same work is rebased onto upstream main (Lean v4.37.0-rc1) on a second local branch, m4-block2-rebased at ff263442, with a green targeted build there. Builds are targeted: the library's root module and lint are left to hosted CI when the pull requests open. A work-in-progress copy of the pure layer (Pure packed step) is public on our fork ryananderson60/cslib-frontier, branch m4-block2-wip at 950b2fae. It is not a pull request and has had no upstream review, and the local branch has moved on since. The Word-RAM code (every other block inside item 5) is on our machines only.

The parts of item 8 are our plan, written and reviewed by us before any code. Names, sizes and the split can change. Sizes are estimates from the density of item 5, not measurements.

Sources and refresh

  • Upstream items link to their pull requests in cslib-frontier. Their status is what GitHub showed on the date above. The checklist is our own restatement, posted on the issue, of the guidance we got there. Its boxes are not all ticked upstream, so "merged" here means that the item's pull requests are merged.
  • Local items carry no pull request link. The pure layer has a public work-in-progress copy on our fork, linked in the table and in the note above. It is not a pull request and has had no upstream review. The Word-RAM code is on our machines only. Names and bounds are copied from the Lean statements on the local branch and will be re-checked against the pull request when it opens.
  • Bounds count Word-RAM instructions of one step or one routine, in the library's cost model (item 1 counts refuter steps of a run, not instructions). Nothing here is a running time for the whole refuter: that is the last two checklist items, which are not started.
  • The tree's lines are computed from the same built-from data as the grid; the six parts of item 8 and their sizes are our plan, with no code yet, and can change. Dates and pull request counts under "What is left" are estimates, not commitments.
  • The page is generated from data/m4-map.json by python -I tools/build_m4_map.py, both in the Fairtally repository. "Proved bound" means the bound in the Lean statement at the status shown: for an open pull request it can still change, and for local work nobody upstream has checked it.

AI disclosure

The proofs, this map and its data file are written with Claude agents for Sentria Inc. Every pull request says so, and a separate reviewer agent of ours checks each one. Upstream, the library's CI runs on every pull request; the approving reviews there are signed by the project's reviewer or coordinator agents, and the project decides what merges.

Want your Lean statements or code checked? Request a check on the Checks page. A request opens a GitHub issue and is queued, best effort.