Skip to content

refactor(bz): migrate HexBerlekampZassenhausMathlib to the module system - #8600

Merged
kim-em merged 1 commit into
mainfrom
issue-8598
Jul 4, 2026
Merged

refactor(bz): migrate HexBerlekampZassenhausMathlib to the module system#8600
kim-em merged 1 commit into
mainfrom
issue-8598

Conversation

@kim-em

@kim-em kim-em commented Jul 4, 2026

Copy link
Copy Markdown
Owner

This PR migrates the Mathlib-side Berlekamp-Zassenhaus correspondence library (the 13 files under HexBerlekampZassenhausMathlib/ plus the umbrella) onto the Lean 4 module system, the Phase-1b follow-up to #8597 ("refactor(bz): migrate HexBerlekampZassenhaus to the module system") and the prerequisite for the Phase-2 split of the 22k-line Basic.lean. Per file it prepends module, rewrites import X to public import X, appends public section plus the backward.{proofsInPublic,privateInPublic} crutch where private decls are referenced in public, and leaves existing private decls private.

The bridge proves correctness by unfolding executable and Mathlib-side defs, so it needs a large @[expose] pass (89 defs, driven outward from each "not an exposed body" / "not unfolded because not exposed" / "not an inductive datatype" error until green) spanning the executable HexBerlekampZassenhaus/HexHensel layers, the HexBerlekampMathlib/HexPolyZMathlib bridges, and the library's own defs.

The irreducible_cert tactic and its tests need their elaboration-time helpers marked meta (with public meta import for the reifier), and the certificate kernel replay reduces checkIrreducibleCertLinear and its Berlekamp pow-chain plus Array/DensePoly == through import all of the executable checker modules and Init.Data.Array.DecidableEq (the recipe's kernel-reduction tool, mirroring the executable side).

Two proof-text repairs in the monicModPImage-zero branch adapt to module reduction (a simp that started leaving a spurious SemigroupWithZero metavariable, and a dvd_zero on toMathlibPolynomial 0); no theorem statements change.

Verified: full lake build green (4088 jobs, 0 sorries in the diff), HexBerlekampZassenhausMathlib green, HexConformance green, BZ bench/emit exes green, python scripts/check_dag.py exit 0, and no sorry/axiom/native_decide added.

Closes #8598.

🤖 Prepared with Claude Code

Migrate the Mathlib-side Berlekamp-Zassenhaus correspondence library (the 13
files under `HexBerlekampZassenhausMathlib/` plus the umbrella) onto the Lean 4
module system, the Phase-1b follow-up to #8597 and the prerequisite for the
Phase-2 split of the 22k-line `Basic.lean`.

Per file: `module`, `public import`, `public section`, and the
`backward.{proofsInPublic,privateInPublic}` crutch where private decls are
referenced in public. The bridge proves correctness by unfolding executable
and Mathlib-side defs, so it needs a large `@[expose]` pass (89 defs, driven
outward from each "not an exposed body" / "not unfolded because not exposed"
error until green) spanning the executable `HexBerlekampZassenhaus`/`HexHensel`
layers, the `HexBerlekampMathlib`/`HexPolyZMathlib` bridges, and the library's
own defs.

The `irreducible_cert` tactic and its tests need their elaboration-time helpers
marked `meta` (`public meta import` for the reifier), and the certificate
kernel replay reduces `checkIrreducibleCertLinear` and its Berlekamp pow-chain
plus `Array`/`DensePoly` `==` through `import all` of the executable checker
modules and `Init.Data.Array.DecidableEq`.

Two proof-text repairs in the `monicModPImage`-zero branch adapt to module
reduction (a `simp` that started leaving a spurious `SemigroupWithZero`
metavariable, and a `dvd_zero` on `toMathlibPolynomial 0`); no theorem
statements change.

See progress/20260704T141029Z_bz-mathlib-module-migration-phase1b.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kim-em
kim-em merged commit b5bcd8f into main Jul 4, 2026
1 check passed
@kim-em
kim-em deleted the issue-8598 branch July 4, 2026 23:30
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.

refactor(bz): migrate HexBerlekampZassenhausMathlib to the module system

1 participant