Skip to content

VED on Lean 4.35/4.36: bound the kernel check of u1_seq auxiliary theorems (multiloop-all memory) - #205

Merged
junjihashimoto merged 6 commits into
mainfrom
fix/lean436-full6-kernel-memory
Dec 2, 2026
Merged

junjihashimoto merged 6 commits into
mainfrom
fix/lean436-full6-kernel-memory

Conversation

@junjihashimoto

@junjihashimoto junjihashimoto commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #204: the last VED part that fails on Lean 4.35/4.36 (multiloop-all, killed on the 16 GiB runner).

Cause. On the 384-bit row synth_fp2MulC0 (Tests/Ved/U1MultiLoopFull6.lean), the first proof attempt of one u1_seq step leaves the unfolding of BitVec.extractLsb' / BitVec.ule on a symbolic 385-bit value to the kernel. On 4.36 that kernel check ran 160 s and peaked at 24 GiB (4.32.1: 3.6 GiB, because the attempt already fails in simp). The attempt fails either way and the fallback script proves the step.

Change (Tools/VedU1ScriptSeqGen.lean, withAuxKernelBudget): the kernel check of each auxiliary theorem runs synchronously (Elab.async off) under auxKernelBudget of the caller's maxHeartbeats.

  • The limit: the caller's limit capped at 20 000 (thousand). That is 7× the largest of the 2 500 auxiliary theorems of the VED checks (2 878).
    • A lower caller limit is kept, never raised.
    • 0 ("no limit") gets the cap.
    • The elaborator's own budget (Core.Context.maxHeartbeats) is not touched. The kernel reads its budget from the options at each addDecl.
  • Recursion depth: withOptions resets the context's maxRecDepth to the option's value, so the caller's context value is put back.
  • Effect on the 384-bit row: the doomed attempt now stops at 4.1 GiB and the fallback runs as before.
  • Accept/refuse: unchanged on the measured set, the VED check set on 4.32.1, 4.35.0 and 4.36.0 (full run below). Outside that set, a proof whose auxiliary theorem needs more than the cap now falls back instead. The kernel still checks every proof that is kept.

Controls (Tests/Ved/AuxKernelBudgetCheck.lean, in ved-pr and ved-full; built on 4.36.0 and 4.32.1):

  • the options seen inside, for a low (50), a normal and an unlimited (0) caller limit;
  • a maxRecDepth raised in the context only is kept;
  • the same auxiliary theorem is added under the normal budget, and refused by the kernel synchronously, with the caller's try falling back, under the low one.

Checks (review fix at eec8bdd):

  • On 4.36, every Tests.Ved target built in one run: 88 targets, 38 min.
  • Done: the full VED run on all three supported versions passed at eec8bdd, 46780102419 (48 jobs, including multiloop-all on 4.35.0 and 4.36.0). The per-PR VED run 46780103123 also passed.

For review (from #204, merged before review):

  • sparkle_clear_values (signal_lets): skips core's per-let type check; the kernel still checks the proof.
  • Ex9: the refusal example moved from depth 11 to 12, because 4.36 accepts 11 within the default limits.
  • Ex7: the axioms are checked as a subset of the standard three, instead of an exact list.
  • Three tests relaxed:
    • VedSharedRefsCheck: node count within 5%;
    • VedMemCloseCheck: tree size read from the refusal message;
    • U1StructNamedCheck: core kshape lemmas need not be rfl.

Also (38704b3): lean-compat.yml no longer runs lake check --paranoid. On the weekly run on main (46766627148) it exhausted the hosted runner, which was shut down and failed both rows; a step time limit cannot prevent that. docs/research/BuildAndCI.md now says how to run it by hand (32 GB+, before a release and after moving the pin).

…usly under a kernel heartbeat limit (20000 thousand; the largest of 2500 aux theorems needs 2878). On 4.36 the 384-bit row synth_fp2MulC0 sent a doomed first attempt into a 160 s, 24 GiB kernel check (simp skipped definitional steps on BitVec.ule over a symbolic 385-bit value); now it stops at 4.1 GiB and the fallback script runs as before
…er, which was shut down and took the row with it on the weekly run 46766627148); BuildAndCI: how to run it by hand
…lCap instead of overriding it (0 = no limit gets the cap; a lower caller limit is kept), keep the context's maxRecDepth (withOptions resets it to the option's value); AuxKernelBudgetCheck: low/normal/unlimited budgets, context-only recDepth, synchronous kernel refusal then fallback
…ll (set_option also lowered the elaborator's budget), values printed as text (tuple display differs between versions)
…the kernel instead of reusing the theorem of the normal one
@junjihashimoto
junjihashimoto merged commit b6e608e into main Dec 2, 2026
135 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