Parameterize CMvPolynomial by a [FinEnum σ] type instead of n : ℕ#261
Draft
BoltonBailey wants to merge 1 commit into
Draft
Parameterize CMvPolynomial by a [FinEnum σ] type instead of n : ℕ#261BoltonBailey wants to merge 1 commit into
BoltonBailey wants to merge 1 commit into
Conversation
Switch the multivariate stack from a variable-count `n : ℕ` to a variable *type* `σ` with a `FinEnum σ` instance, mirroring Mathlib's `MvPolynomial σ R`. Monomials are stored as `Vector ℕ (FinEnum.card σ)`, indexed via `FinEnum.equiv : σ ≃ Fin (card σ)`. Work in progress: core data layer (CMvMonomial) generalized and building; remaining layers (Unlawful/Lawful/CMvPolynomial/MvPolyEquiv/Operations and the Fin-specialized downstream) still in flux. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🤖 PR Summary
Core Logic Generalization
API and Structural Changes
Status and Discrepancies
Statistics
Lean Declarations ✏️ **Removed:** 14 declaration(s)
✏️ **Added:** 7 declaration(s)
✏️ **Affected:** 231 declaration(s) (line number changed)
📋 **Additional Analysis**Style and Naming Violations
Architectural and Documentation Findings
Positive Observations
📄 **Per-File Summaries**
Last updated: 2026-06-26 23:41 UTC. |
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.
Claude draft of PR not vetted yet.
Summary
Switch the computable multivariate polynomial stack from a variable count
n : ℕto a variable typeσcarrying a[FinEnum σ]instance, mirroringMathlib's
MvPolynomial σ R, while staying computationally equivalent to thecurrent implementation (instantiating
σ := Fin nrecovers today's behavior).FinEnum σsuppliesFinEnum.card σ : ℕandFinEnum.equiv : σ ≃ Fin (card σ),which lets us keep the existing
Vector-backed,ExtTreeMap-keyed representation:CMvMonomial σ := Vector ℕ (FinEnum.card σ), indexed throughFinEnum.equiv.Design decisions
Vector ℕ (FinEnum.card σ)(keeps the currentOrd/compare/ExtTreeMaplayer essentially unchanged).extend,align,liftPoly,polyCoe, theCoe/mixed-arityHAdd/HSub/HMul,Lawful.X) has no analog for arbitrary types and is replaced with disjoint-sumanalogs:
… σ R → … τ R → … (σ ⊕ τ) Rviarename Sum.inl/rename Sum.inr,plus a general
embedDomain (f : σ ↪ τ).finSuccEquiv,isEmptyRingEquiv, and theUnivariate/Bivariate bridges instantiate
σ := Fin n.Status
🚧 Draft / work in progress. The core data layer (
CMvMonomial) is generalizedand building. Remaining layers (
Unlawful,Lawful,CMvPolynomial,MvPolyEquiv/*,Operations/Rename, and the Fin-specialized downstream) are still in flux and thefull project does not yet build.
Known follow-up
The main proof-engineering cost is that
FinEnum.card (Fin n)is onlypropositionally equal to
n(FinEnum.card_fin), not definitionally, so theFin-specialized proofs need
card_fin/equivbridging where they previously reliedon defeq.
🤖 Generated with Claude Code