Skip to content

Variants and registrations list their implementations best first - #4682

Merged
alex merged 2 commits into
mainfrom
claude/vg-variants-best-first
Nov 8, 2026
Merged

alex merged 2 commits into
mainfrom
claude/vg-variants-best-first

Conversation

@alex

@alex alex commented Nov 8, 2026

Copy link
Copy Markdown
Member

Part of #4548. This prepares the next PR, which makes each dispatcher try a function's implementations in the order its registration file lists them, and deletes Dispatch.lean's suffix ranking. There are no trust changes here: nothing under TCB/ or Spec/ changes.

What changes

  • Variant lists: each list in Proof/Variants/<Iface>/<Target>.lean is now ordered best first, matching Dispatch.lean's ranking.
  • Hand-written registration files: the files with several implementations of one function now list them best first. These are the x86-64 files for AES blocks, 3DES-ECB and X25519; they used to list the baseline first.
  • Ed25519 on x86-64: the field arithmetic is listed IFMA, then ADX, then the baseline.
  • FFDH on x86-64: the registration nests its two lists so that the combined order is the one the ranking gave.
  • AES-GCM-SIV on x86-64:
    • It lists its AVX2 copies before the instances without them.
    • It no longer emits an instance that the dispatcher never chose: one without the copies that needs every feature its copy needs (hasNarrow), or one for an AES-GCM variant that differs from an earlier one only in what AES-GCM-SIV doesn't call (sivImpls).
    • Each of these was emitted only as another name (alias) of the function its dispatcher calls. That removes ten functions, none of which the Rust code names.

Generated crates

218 generated files change: the same items in a different order, minus those ten AES-GCM-SIV functions. Every dispatcher is unchanged, including the order of its arms; I compared each dispatcher with main's.

Checks

  • lake build and Emit.lean pass.
  • Every step of the Static checks job passes.
  • check_lean_public_imports.py passes.
  • cargo clippy --all-targets -- -D warnings and cargo test pass.

Generated by Claude Code

Each list of variants (`Proof/Variants/<Iface>/<Target>.lean`) and each
registration file with several implementations of a function now lists
them in the order `Dispatch.lean` ranks them, best first, so that the
dispatchers can try them in that order instead (the trusted change that
does so comes next). Where a product of two lists gives an order of its
own (FFDH on x86-64), the nesting is the one that keeps it.

AES-GCM-SIV on x86-64 lists its AVX2 copies before the instances without
them, and emits neither an instance without them that needs every feature
its copy needs (`hasNarrow`), nor those of an AES-GCM variant that differs
from one before it only in what AES-GCM-SIV does not call (`sivImpls`): the
dispatcher never chose them, and each was another name of the function it
chose (an `alias`).

Part of #4548.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHFjAR7Byf513R4zuFy
The same items, in the order their registration files now list them, and
without AES-GCM-SIV's ten unreachable instances on x86-64 (each was another
name of the function its dispatcher chose). Every dispatcher is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHFjAR7Byf513R4zuFy
@alex
alex added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit 38dc6d8 Nov 8, 2026
46 checks passed
@alex
alex deleted the claude/vg-variants-best-first branch November 8, 2026 20:40
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