fix: expose Array equality for kernel reduction - #14270
Draft
kim-em wants to merge 1 commit into
Draft
Conversation
This was referenced Jul 4, 2026
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
kim-em
added a commit
to kim-em/hex-dev
that referenced
this pull request
Jul 4, 2026
) * refactor(bz): migrate HexBerlekampZassenhaus to the module system Migrate the executable Berlekamp-Zassenhaus library onto the Lean 4 module system (module / public import / public section), the prerequisite for splitting the 19k-line Basic.lean monolith. Works around two lean4 module-system reduction bugs found in the process: - Array.instDecidableEqImpl is not @[expose], so decide/rfl over Array equality does not reduce in the kernel under the module system for nonempty arrays. Worked around with import all Init.Data.Array.DecidableEq (keeping the efficient Array instance); upstream fix in leanprover/lean4#14270. - Array.back? does not reduce under the module system; reimplement DensePoly.leadingCoeff as coeffs.getD (size - 1) 0 (equal, reducible). Adds public meta imports for the #guards, the backward.{proofsInPublic, privateInPublic} options, @[expose] on the executable defs exported defeq proofs reduce through, and de-privatises the leaked GcdLaws Rat instance. No runtime performance regression (only leadingCoeff's compiled body changes, equal-or-faster; DecidableEq unchanged). See progress/20260704T000000Z_bz-module-migration-phase1a.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(bench): repair leadingCoeff Monic proofs in bench/conformance drivers The DensePoly.leadingCoeff reimplementation (coeffs.getD (size-1) 0 instead of coeffs.back?.getD 0) broke the monic-witness proofs in the bench exe and emit-fixture drivers, which the module-migration commit missed because a plain `lake build` does not build the bench/conformance sub-projects (CI does). Rewrite the `change ...back?.getD 0 = 1` proofs to close the getD form via Array.getElem_push. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kim-em
force-pushed
the
expose-array-instdecidableeqimpl
branch
from
July 28, 2026 08:07
2beb9e7 to
a79caf6
Compare
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/batteries
that referenced
this pull request
Jul 28, 2026
mathlib-nightly-testing Bot
pushed a commit
to leanprover-community/mathlib4-nightly-testing
that referenced
this pull request
Jul 28, 2026
leanprover-bot
added a commit
to leanprover/reference-manual
that referenced
this pull request
Jul 28, 2026
Expose the implementation and its isEqv reduction closure so decide and rfl over nonempty Array equality reduce across module boundaries.
kim-em
force-pushed
the
expose-array-instdecidableeqimpl
branch
from
September 1, 2026 13:49
50541c4 to
81cf4b0
Compare
This was referenced Sep 1, 2026
leanprover-bot
added a commit
to leanprover/reference-manual
that referenced
this pull request
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR lets
decideandrflreduce nonemptyArrayequality in the kernel across module boundaries.Array.instDecidableEqdelegates its nonempty case toArray.instDecidableEqImpl, which was opaque downstream. That implementation evaluatesArray.isEqvandArray.isEqvAux, so expose the full reduction closure. Regression coverage includes equal and unequal nonempty arrays anddecide +kernel.The original broader PR was split into this fix, the
VectorDecidableEq fix in #14988, and theArray.ofFnfix in #14989.