Skip to content

Proofs: give omega the facts it needs at each call - #5048

Merged
alex merged 1 commit into
mainfrom
claude/vibrant-cori-6m4lfs-omega-sites
Nov 14, 2026
Merged

alex merged 1 commit into
mainfrom
claude/vibrant-cori-6m4lfs-omega-sites

Conversation

@alex

@alex alex commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

What

A plain omega collects every arithmetic fact in the context, and its proof (one auxiliary theorem per call) is what the kernel then checks. This names, at each call, the facts the goal needs:

-    rw [ifn (by omega)]
+    rw [ifn (by omega_using [hs, h])]

or omega_arith where a needed fact has no name to write.

  • 167,699 calls in 12,407 modules change: 161,941 to omega_using, 5,758 to omega_arith.
  • 498 modules gain a private import of Proof/Framework/Omega.lean (core imports only).
  • About 7,700 omega calls stay as they are (see below).
  • No statement changes. Nothing outside lean/VerifiedGarbage/Proof/: no TCB, Spec, Impl, registration, generated code or CI change.

How the edits were made

Mechanically, one module at a time, against the CI build of main:

  1. Compile the module with an instrumented omega that, at each call in the source, searches for a smallest set of context facts that still proves the goal, and records whether each has a name that can be written there (accessible, not shadowed).
  2. Rewrite the calls, and compile the module again under the project's options (warnings are errors).
  3. Where that fails, put back the calls of the failing declaration and compile again. The usual cause is the unused-variables linter: Lean's omega mentions every fact it collects, so a hypothesis only it "used" becomes unused once the call names what it needs. Those calls keep omega.

So every rewritten module has been compiled as it is here, against unchanged imports, and since only proofs change, the modules that import it are unaffected. I have not run a full local lake build of the result (it is most of the library); CI's build is that check. Three modules are left out on purpose:

  • Proof/Blake2/X86_64/Compress.lean, which main changed after the pass ran;
  • Proof/Framework/Slots.lean, a module of NativeHintSearch, which ci/check_lean_imports.py does not let import Omega;
  • Proof/Dsa/X86/WorkspaceCall.lean, where a hypothesis named depth in omega_using [depth, …] reads to ci/check_lean_speed.py as unfolding a stack depth.

The Static checks steps pass locally. ci/check_lean_public_imports.py was not run (it needs the edited modules built); the only import change is the private import above, in modules that now use omega_using.

What it buys

Measured on 29 rewritten modules chosen at random, each compiled before and after against the same imports, under the build's options (one thread, idle machine, the faster of two runs; 124.6 s of CPU before):

before → after
CPU time −4.8%
kernel (type checking) −7.6%
tactic execution −5.6%

(An earlier run of the same sample on a busy machine gave −2.8% CPU; the table is the idle rerun.)

This is a modest step, not the whole answer: with the facts named, what remains at these calls is mostly the kernel checking omega's certificate. A cheaper closer behind omega_using, in Proof/Framework/Omega.lean alone, is the follow-up this makes possible by routing the calls through omega_using; on the same sample it measures a further −2.9% CPU.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TKUFHJ8H2BZWf42YgvgLoJ

A plain `omega` collects every arithmetic fact in the context, and its
proof (one auxiliary theorem per call) is what the kernel then checks.
This names, at each call, the facts the goal needs: `omega_using [h₁, h₂]`,
or `omega_arith` where every needed fact has no name to write.

The edits are mechanical. Each module was compiled with an instrumented
`omega` that, per call, found a smallest set of context facts that still
proves the goal, then compiled again with the rewritten calls; a call
whose rewrite failed (or left a hypothesis unused) keeps `omega`.
167,699 calls in 12,407 modules change (161,941 to `omega_using`, 5,758
to `omega_arith`); 498 modules gain the import of
`Proof/Framework/Omega.lean`. No statement changes, and nothing outside
`Proof/`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHJ8H2BZWf42YgvgLoJ
@alex
alex enabled auto-merge November 14, 2026 02:29
@alex
alex added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 983bba2 Nov 14, 2026
31 checks passed
@alex
alex deleted the claude/vibrant-cori-6m4lfs-omega-sites branch November 14, 2026 04:04
alex pushed a commit that referenced this pull request Nov 14, 2026
- Registration: since #4794 an algorithm's registrations on a target are
  one file, and since #4806 a registration states no features, so the
  search joins Artifacts/Dsa/RISCV64.lean as PPC64LE's does, mapping over
  Proof.Variants.MillerRabin.RISCV64.variants.
- #5059 folded Blinded/CTBase.lean, then imported only by
  RsaKeyGen/RISCV64/Cand/CTMr.lean, into CTMr. This PR restores
  CTBase.lean (8781344^), which the restored modules and the DSA prime
  test import too, so CTMr.lean is its version before #5059 again,
  importing CTBase instead of declaring its theorems a second time.
- Blinded/Witness.lean and Search/MontPrep.lean stay byte-identical to
  8781344^, without the text merge of #5048's omega rewrites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHGhkN8REQLPW8yxN5A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants