Skip to content

Variants are lists; generic callers are ordinary registration files - #4654

Merged
alex merged 1 commit into
mainfrom
claude/vg-variant-lists
Nov 8, 2026
Merged

alex merged 1 commit into
mainfrom
claude/vg-variant-lists

Conversation

@alex

@alex alex commented Nov 8, 2026

Copy link
Copy Markdown
Member

Part of #4548. There are no trust changes: nothing under TCB/ or Spec/ changes.

The emitter used to find variants and generic callers by their file paths, with one file per implementation at Variants/<Iface>/<Target>/<Name>.lean. Each Generic/<Iface…>/<Target>/<Alg>.lean was applied to every variant, or to every combination of variants. Both are now plain Lean.

What changes

  • Variant lists: the implementations of an interface on a target are one list, variants, in Proof/Variants/<Iface>/<Target>.lean. That is 53 files in place of 170 one-line variant files.
  • Generic files: each one is now part of the registration file for its algorithm and target, Artifacts/<Alg>/<Target>.lean. That file's artifacts applies it to each element of those lists, exactly as the emitter did:
    • nested flatMaps for a caller of several interfaces;
    • the list itself for an All<Iface> caller.
  • Merged sources: where an algorithm's functions came from several files, each source is a namespace of the one file. The sources were an existing registration file and/or generic files over different interfaces; for example, x86-64 AES-GCM came from four.
  • The emitter: it now finds no file under Generic/ or Variants/. Deleting the trusted code that searched for them is a separate PR, together with ranking dispatchers by list order instead of by Dispatch.lean.
  • Checks and docs: ci/check_registrations.py, check_lean_speed.py, lit_imports.py, check_lean_public_imports.py, trim_lean_imports.py, CLAUDE.md, lean/README.md and the adding-a-primitive skill now name Artifacts/ and Proof/Variants/.

Generated crates

45 generated files change, and only in the order of their items: their artifacts now come from a different file. Splitting every changed file at its top-level items, each file has exactly the same items as before. Every dispatcher, including the order of its arms, is unchanged.

Checks

  • lake build passes on every changed module.
  • Emit.lean regenerates the crates and passes its audits.
  • Every step of the Static checks job passes.
  • ci/check_lean_public_imports.py passes on the 224 changed modules.

Generated by Claude Code

The emitter found variants and generic callers by their files' paths
(`Variants/<Iface>/<Target>/<Name>.lean`, one file per implementation, and
`Generic/<Iface…>/<Target>/<Alg>.lean`, applied to every variant or
combination of variants). Both are now plain Lean:

* the implementations of an interface on a target are one list,
  `variants` in `Proof/Variants/<Iface>/<Target>.lean` (53 files for 170
  one-line variant files);
* each generic file is part of the registration file of its algorithm and
  target, `Artifacts/<Alg>/<Target>.lean`, whose `artifacts` applies it to
  each element of those lists (nested `flatMap`s for several interfaces;
  the list itself for an `All<Iface>` one), as the emitter did. Where an
  algorithm's functions came from several files (an existing registration
  file, or generic files over different interfaces), each is a namespace of
  the one file.

The emitter now finds no file under `Generic/` or `Variants/` (the trusted
code that did goes in a change of its own). The generated crates have the
same items, in another order where their artifacts now come from another
file; every dispatcher is unchanged. The checks and documentation that named
the two directories name `Artifacts/` and `Proof/Variants/`.

Part of #4548.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHFjAR7Byf513R4zuFy
@alex
alex enabled auto-merge November 8, 2026 17:59
@alex
alex added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit 43cd12d Nov 8, 2026
47 checks passed
@alex
alex deleted the claude/vg-variant-lists branch November 8, 2026 18:08
alex pushed a commit that referenced this pull request Nov 8, 2026
Since #4654 the emitter reads no registration file under Generic/, so the
search's registration moves to Artifacts/DsaParameters/RISCV64.lean, as
PPC64LE's, mapping over Proof.Variants.MillerRabin.RISCV64.variants. The
RISC-V crate's generated dispatch/dsa.rs conflicted: it takes main's side
and is regenerated with the full emitter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHGhkN8REQLPW8yxN5A
alex pushed a commit that referenced this pull request Nov 15, 2026
`vg_ffdh_generate_key_cached` is internal on main (#4875, #4876): the
registration drops its artifact and its proofs name
`Proof.Ffdh.cachedGenerateKeyContract`. Generic callers are ordinary
registrations (#4654), so the sieved parameter search is registered in
`Artifacts/Ffdh/RISCV64.lean` over `Proof.Variants.MillerRabin.RISCV64`,
as on PPC64LE. `Shape.lean` uses the shared `RsaKeyGen.wv_half` that
replaced FFDH's `WordHalf` (#5059).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKUFHHEKNw8eCDhgbwoFBL
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