-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededphase 1 - theoryPhase 1 of the roadmap, focusing on theory completenessPhase 1 of the roadmap, focusing on theory completeness
Description
Implement computable versions of degreeLT, degreeLE, and related membership lemmas
Summary
Implement computable versions of Mathlib's Polynomial.degreeLT, Polynomial.degreeLE, and their membership characterization lemmas for CPolynomial R. These are commonly used in Mathlib and important for ZK verification where bounded-degree polynomials are frequently needed.
Context
This is part of Phase 1: Foundation Completion (API completeness) as outlined in ROADMAP.md. These functions are listed in the roadmap but were deferred due to typechecking challenges that need to be resolved.
What to Implement
Core Definitions
-
degreeLT (n : ℕ) : Submodule R (CPolynomial R)- Submodule of polynomials with degree < n
- Provides type-safe way to work with bounded-degree polynomials
- Matches Mathlib's
Polynomial.degreeLTAPI
-
degreeLE (n : WithBot ℕ) : Submodule R (CPolynomial R)- Submodule of polynomials with degree ≤ n
- Uses
WithBot ℕto handle the zero polynomial case - Matches Mathlib's
Polynomial.degreeLEAPI
Membership Lemmas
-
mem_degreeLT {n : ℕ} {p : CPolynomial R} : p ∈ degreeLT n ↔ p.degree < n- Characterization of membership in
degreeLT - Essential for proofs involving bounded-degree polynomials
- Characterization of membership in
-
mem_degreeLE {n : WithBot ℕ} {p : CPolynomial R} : p ∈ degreeLE n ↔ p.degree ≤ n- Characterization of membership in
degreeLE - Essential for proofs involving bounded-degree polynomials
- Characterization of membership in
Linear Equivalence
degreeLTEquiv (n : ℕ) : degreeLT n ≃ₗ[R] Fin n → R- Linear equivalence between
degreeLT R nandFin n → R - Provides direct access to the first
ncoefficients - Matches Mathlib's
Polynomial.degreeLTEquivAPI - Useful for evaluation formulas and coefficient extraction
- Linear equivalence between
Why This Matters
- Commonly used in Mathlib: These are frequently used in polynomial proofs and constructions
- Type safety: Provides compile-time guarantees about polynomial degrees
- ZK verification: Many ZK protocols work with polynomials of bounded degree
- Coefficient access:
degreeLTEquivenables efficient coefficient extraction - Proof ergonomics: Membership lemmas simplify proofs involving degree bounds
Mathlib References
Mathlib.RingTheory.Polynomial.Basic-Polynomial.degreeLT,Polynomial.degreeLEPolynomial.mem_degreeLT,Polynomial.mem_degreeLE- Membership characterizationsPolynomial.degreeLTEquiv- Linear equivalence
Implementation Notes
- Location:
CompPoly/Univariate/Basic.lean(afternatDegreedefinition) - Dependencies:
Submodulefrom Mathlib (may needMathlib.Algebra.Module.Submodule.Basic)WithBot ℕfordegreeLE(likely already available)CPolynomial.degree(already exists)
- Challenges encountered: Typechecking issues with
Submodule- may need to ensure proper module structure onCPolynomial Rfirst
Related
- Part of Phase 1 API completeness (see
ROADMAP.mdlines 50-52) - Related to
restrictDegreefor multivariate polynomials (already TODO) - May need
Moduleinstance onCPolynomial R(see Phase 1 plan)
Success Criteria
-
degreeLTanddegreeLEare defined and typecheck -
mem_degreeLTandmem_degreeLEare proven -
degreeLTEquivis defined and proven to be a linear equivalence - All definitions match Mathlib's API where applicable
- Basic properties are proven (e.g., monotonicity, relationships between
degreeLTanddegreeLE)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededphase 1 - theoryPhase 1 of the roadmap, focusing on theory completenessPhase 1 of the roadmap, focusing on theory completeness