Skip to content

Long proofs (LP1 to LP5, DP1 to DP6) and the chain of Lean (CL0 to CL6) - #8

Merged
Kdevos12 merged 49 commits into
mainfrom
claude/project-thread-h60gyw
Nov 20, 2026
Merged

Kdevos12 merged 49 commits into
mainfrom
claude/project-thread-h60gyw

Conversation

@Kdevos12

@Kdevos12 Kdevos12 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR is version 1.0.0-beta.2 (CHANGELOG.md). It builds three plan changes the owner approved on 2026-11-19:

  • plans/plan-change-long-proofs.md, LP1 to LP6 (Ruling 43);
  • plans/plan-change-decomposition-provers.md, DP1 to DP7 (Ruling 44), which amends it;
  • plans/plan-change-chain-of-lean.md, CL0 to CL6 (Ruling 45). Its part A, CL1 to CL4, is experimental and never on by default.

It covers Tasks 64 to 66, the arm of Task 67, and Tasks 68 to 71. Every new behaviour sits behind an option that is off by default (RunConfig.longProof, RunConfig.leanDraft, the fleet's bucketPrior and switchOnStall). v1, v2 and the existing arms are byte-identical.

Long proofs (Tasks 64 to 67)

The principle: a long proof is a chain of short proofs that Lean checks one at a time.

  • LP1: proof lengths. harness audit writes a "Length" section and a length.json file. Per problem it gives the Lean lines, aux_ lemmas, holes and their verdicts, checks, check time against size, and stop reasons. With --reference DIR it also gives the reference proof's length and success grouped by that length.
  • LP2 with DP1 to DP3: the have sketch. From an accepted informal proof, the planner writes a sketch of have ... := by sorry steps.
    • The sorry battery closes what it can in place.
    • liftHaves lifts the rest with extract_goal into aux_ holes.
    • The drafts are ranked by the holes left.
    • The repair pass uses the same lifter.
  • LP3 with DP5: frozen links. Proved links move into a locked prefix. Lean checks it whole and the certifier replays it whole. The links are recorded in accepted_lemmas, which M3 reads.
  • LP4: a long triage class, and a gate that follows the frontier's growth.
  • LP5: verdict reasons, and one continuation for a hole cut by its turns. Its depth change waits for LP6 (DP7).
  • DP4: full hole sessions. A hole session gets the battery, lean.search, M3's library and its informal step.
  • DP6: the arm solve-v2-long.

The chain of Lean (Tasks 68 to 71)

  • CL0. harness audit gains a table of output tokens by role and kind: thinking, text, and tool-call arguments. Hole sessions now save their transcripts.
  • CL5. The bucket pieces of the heuristic cards move into one module, bucket.ts, shared with the sampled settings. With bucketPrior on, mode, thinking and directive learn from the bucket as cards do.
  • CL6. With switchOnStall on, after M6's repeat rule or a stagnating claim, the next session leaves out the stalled mode and thinking level. The arm solve-v2-fleet-modes measures this.
  • CL1 and CL2 (experimental). A prompt file, lean-draft.system.txt, and RunConfig.leanDraft. Before a fresh probe, one completion is written in Lean only, at thinking off.
    • It is capped, charged to the probe's ledger, and checked by Lean.
    • It is cut at its first error, resumed once, then passed to the battery.
    • A clean draft goes through the prover's own candidate path.
    • There is no draft on long problems.
  • CL4. The arm solve-v2-long-draft.
  • CL3 is not built. It waits for CL0's number on a run made after this PR.

Review

Agents that did not write the code reviewed the long-proofs work and the chain of Lean, trust rules first. They found no trust violation, and the off-by-default behaviour holds.

Their findings are fixed, among them:

  • relock is scoped to the problem;
  • Workbench.lock refuses holes;
  • the draft's cost reaches the problem's spend and the probe's cap on resume;
  • the draft has its own audit row;
  • the gate's numbers read sessions only;
  • the README diagram and the docs are updated.

What was recorded rather than fixed is in the ledger.

Interface changes (additive)

  • RunConfig.longProof and RunConfig.leanDraft, both recorded in run.started
  • budget.gated accepts by: "progress"
  • an optional reason on hole verdicts
  • HoleSessionRequest.name
  • ProblemContext.closeSorries
  • accepted_lemmas gains lemmas and problemId
  • m12_sketch gains fromInformal, lifted and discarded
  • the allocation node gains excluded
  • Projection.attemptsOfNoTask
  • the hole sessions' request blob carries sessionId

Tests

  • CI: pnpm check green (tsc clean, 3434 tests pass, 1 skipped).
  • A real pass on a machine with Lean 4.27.0 and the Mathlib cache, at head f5d272e: 3433 tests, 3430 pass, 1 skipped, 2 fail. marathon.test.ts:182 exceeds its 30 s wall-clock bound on a slow disk, as it already did on main before this PR. server-routes.test.ts fails under load and passes alone.
  • LP1 for real: harness audit on the journals of three earlier runs.
  • LP6 for real (solve-v2-long, three long problems, $0.73): two of three certified, with statements identical to the source, a valid kernel_replay and standard axioms only. Every session ran Lean.
  • Known limit: on that run extract_goal timed out on every draft, so liftHaves lifted no hole yet. Also found: the gate is too strict after frontier progress with one attempt, every hole verdict was turns, and some accepted_lemmas nodes are empty. These go to a follow-up. Numbers are in the ledger; n = 3, so they are indicative.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD

Kdevos12 and others added 5 commits November 19, 2026 09:51
Every problem gets a row: Lean lines and characters of its certified or last failed file, aux_ lemmas, M12 holes and verdicts, checks, check time against size, stop reasons, and the reference length from --reference. A table buckets success by reference length; length.json carries the records for pooling.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…LP4)

Under RunConfig.longProof, an accepted informal proof over the short limits whose
facts are found is triaged long, not skip, when the allowance is at least
triageUsd; the gate then counts frontier growth as progress and stops a long
problem after dryChecks finished sessions that closed no hole.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c57b9dbe-b1b1-4101-98cf-afb33a926877
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Kdevos12 and others added 16 commits November 19, 2026 10:19
…s 65 to 67

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…ce (LP5)

A too_hard hole verdict carries a reason (turns, budget, model_said), counted by the
report's Loop section and shown in harness audit. Under RunConfig.longProof, M12's new
option holeContinuation gives a hole cut by its turns one more session before a
refinement round splits it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…ush, library, informal step (DP4)

hole-session.ts passes runSession the run's sorryBattery (on the hole's own proof),
the lean.search push, and M3's Library section and library_search tool searched by
the hole's statement (ProblemLines.openHole). holePrompt shows the informal note above
the hole's lemma, quoted and said to be unchecked. sessionSorryBattery is shared with
prover.ts; run.ts builds the battery settings once.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
liftHaves in @seshat/scheduler closes the steps the sorry battery closes, prints the
rest with Mathlib's extract_goal in one Lean check, renames each statement to an aux_
lemma and rewrites the step to apply it. The simulated Lean prints extract_goal's
statements for the tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…P2, DP1)

With longProof, before the first outer session one planner call answers the target's
proof as have steps; it is checked once, lifted by liftHaves with the battery given
to M12 as ProblemContext.closeSorries, checked again and journaled as an m12_sketch
with planner, fromInformal and lifted. The draft shares askPlanner with the refinement
rounds and is not a round; a draft Lean refuses is revised in round 1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
The drafts option and the ranking came with the draft loop: this commit tests them
with three drafts of 3, 2 and 2 holes, a refused draft, a failed call and a gate
that skips, and documents the discarded records and the option.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
A hole session quotes the comment directly above the hole's lemma as the informal
step it formalizes, so liftHaves keeps the draft's step comment there.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
cutFailures cuts a failing named have at any depth to sorry and lifts it with the
one lifter, so a statement that mentions a bound name or a have inside a cases branch
is lifted instead of refused. The conservative text parser of repair.ts is deleted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…(Tasks 65, 66)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… prefix (LP3)

Under longProof (key freeze, default true) M12 locks a proved hole, or an aux_
lemma of the outer file that a check accepted, into a prefix of the problem's
file. Lean checks and the certifier replays the whole file; the models read the
prefix by statement only; an edit to it is refused as an edit outside the
regions. The record is the accepted_lemmas node (optional lemmas field, DP5):
a resumed run locks the prefix again from it. Replaces the WIP m12_frozen node.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
Under longProof, M3's option fromFrozen takes its candidates from the lemmas
M12 locked into the file, recorded in the accepted_lemmas nodes, failed
attempts included, and judges them at afterProblem. recordCandidates and the new
recordFrozenCandidates share one function for turning lemmas into candidates.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…lly closed draft through validate

A have draft whose battery closes every step has no hole to lift: it goes
through validate (Lean decides) instead of being recorded as not healthy only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… lock, journal late lemmas, escape the hole name

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…tion (DP6)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…e-v2-long

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
@Kdevos12 Kdevos12 changed the title Long proofs, first part: proof lengths in harness audit, and a gate that follows the frontier (LP1, LP4) Long proofs: proof lengths, the have sketch lifted by Lean, frozen links, a frontier gate, full hole sessions (LP1 to LP5, DP1 to DP6) Nov 19, 2026
Kdevos12 and others added 7 commits November 19, 2026 16:40
…), Ruling 45, Tasks 68 to 71

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… transcripts

harness audit gains one table, "Output tokens by role and kind": per role, calls and
output tokens, then thinking, text outside tool calls and tool-call arguments (tokens
and shares) and the prose share. A session's usage.output is split across its message
parts by characters; a one-shot call's text is min(outputTokens, chars / 4) and the
rest is thinking not stored (CHARS_PER_TOKEN, one named constant). The computation is
in output-kinds.ts (one function, read-only, called by audit.ts) so that audit.ts,
already long, gets no second concern; the table is markdown only because length.json
holds per-problem records.

Hole sessions saved no transcript. HoleSessionDeps gains an optional transcript writer
(the prover's signature); run.ts's one writer is now defined once at run level and
passed to the lines, so there is no second writer. The hole's request blob carries its
sessionId so the audit finds the transcript; older journals read "not recorded".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… bucket.ts, with no change of behaviour

The prior of w pseudo-sessions at a mean, the per-value means of a keyed setting, and the effect of one value against the others (with its deactivation, never of every value) are now shared; drawCard and cardEffect call them and draw and decide exactly as before.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…on bucketPrior, off by default)

A value's posterior on the claim starts from familyPriorWeight pseudo-sessions at its mean in the bucket, and a value M5's rule turns off in the bucket is not drawn while another is left. The bucket is computed once and shared with the cards; the attempt records heuristicBucket even with no cards.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…d the arm solve-v2-fleet-modes

After M6's repeat rule stops a prover's attempt, or the claim stagnates, the next draw leaves out the mode and thinking level that attempt had, while another is left; the allocation records what was left out. The arm solve-v2-fleet-modes sets the fleet line with two modes, three cheap thinking levels, bucketPrior and switchOnStall against solve-v2.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
A prompt file next to the prover's, lean-draft.system.txt, with its own version
record: write only Lean 4 as a have-sketch (the form of DP1, so that liftHaves
and the sorry battery read it unchanged), at most one comment of five words, no
prose, and three worked examples. Loaded and versioned as prover.system.txt is
(prompt.ts), screened by the same strict screen (LEAN_DRAFT_TARGET); not listed
in PROMPT_TARGETS, because the optimizer measures a candidate through
RunConfig.prompts.proverSystem, which does not reach the draft. Documented in
prompts.md. Nothing calls it yet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… (CL2)

lean-draft.ts, one module and one function: one completion with no tools at
thinking off, capped, charged to the probe's ledger (made before the draft and
shared with the probe's session, so no new budget path); Lean checks the whole
draft through Workbench.check; a clean draft is a candidate through validate and
the certifier; an error cuts the draft at its first break, the cut file is
checked to read the sorry's goal, and one continuation is asked (resumes); the
run's sorry battery runs once on what is left. RunConfig.leanDraft is its own
entry (status experimental), checked, recorded in run.started and read back by
resume. run.ts adds one line at the fresh probe, for a problem that is neither
resumed nor triaged long (BudgetGate.long).

The attempt's lifecycle is journaled by the module itself with the same events
and helpers the prover uses (attempt.started with settings.mode lean_draft,
attempt.charged, attempt.finished through outcomeOf, chargedTotals, the
transcript), not through runSession: a session is a tool loop with a wrap-up
request and per-check hooks, and this is two completions and some checks, which
is the smaller and clearer code. The gate's price of a session leaves the draft
out, and the workbench notes the attempt only when it found the candidate, so
the gate's numbers are what they were. Small exports: dedent (core), textOf
(llm.ts), outcomeOf (prover.ts).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
Kdevos12 and others added 14 commits November 19, 2026 17:13
…CL2, CL6 b)

scheduler.md: when the draft runs, what it is shown, how it is cut and resumed,
what it records, its budget (the probe's ledger), the order battery, draft,
sampled session, and what has not run. trust.md lists no path to a candidate by
name, so it is unchanged: the draft adds none, its candidate is the workbench's.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… the experimental Lean draft (CL4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
The draft attempt belongs to no task, so the problem's spend (joined through tasks) missed it: a resumed problem's ledger was seeded without it, and the probe's slice-resume and extension counted only the probe's own task.
Chosen: the spend readers count the attempts of the problem's claim that no task owns (Projection.attemptsOfNoTask, used by problemSpend and by BudgetGate.probeSpentUsd), not a taskId on the draft, because a task id would make proverResumeOf and the session count read the draft as session 1 and skip the probe after a resume. With no draft there is no such attempt, so every number is as before.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…he research-flow diagram

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
…raft left out by one predicate

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… continues its step, no extractProof wrapper

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
… against a baseline, the fleet's options absent

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
@Kdevos12 Kdevos12 changed the title Long proofs: proof lengths, the have sketch lifted by Lean, frozen links, a frontier gate, full hole sessions (LP1 to LP5, DP1 to DP6) Long proofs (LP1 to LP5, DP1 to DP6) and the chain of Lean (CL0 to CL6) Nov 19, 2026
Kdevos12 and others added 7 commits November 19, 2026 20:09
…on a timeout

On LP6's real run no draft was lifted: Mathlib prints an extracted
statement as `theorem _example.extracted_1 ... := sorry`, which the
lifter did not read (it wanted `:= by sorry`), and the extractions of
one draft together ran out of the declaration's heartbeats. Both forms
are read now, and when the probe of every step gives no statement for
each, one probe per step follows. The simulated Lean prints the real
form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
On LP6's real run a problem with frozen links was skipped at the wave by
one Thompson draw (0.002) from a posterior of one attempt. Long proofs
follow the frontier: under RunConfig.longProof a probe with Lean
progress widens by progress, within the allowance. The journal accepts
a wave widened by progress with progress true.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
The bound of 30 s failed on unchanged code on a workstation with a slow
disk (58 s; 13 s on a cloud machine). It guards against a cost that grows
with the run's age, which would take minutes: 120 s keeps that guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q6fEz5iDpWkPAMxFAudQKD
@Kdevos12
Kdevos12 merged commit e8deb16 into main Nov 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant