Repository navigation
stdlib: commutative algebra; mixins for domains and fields - #1244
Merged
Merged
Conversation
strub
force-pushed
the
feat/comm-algebra
branch
from
November 24, 2026 17:00
b63770c to
5d9d4c8
Compare
New theory CommAlgebra, over an integral domain:
- `Base` is the ideal-theoretic core, with no axiom beyond the ring
structure: divisibility, the Chinese remainder theorem stated with
Bezout witnesses (`comax x y`, defined as
`exists u v, u * x + v * y = oner`), and the congruence modulo an
element (`eqm m x y`, an abbreviation for `m %| (x - y)`). An
instance can enter at this level by giving the Bezout witnesses
directly, without any division theory.
- `Euclidean` includes `Base` and adds a weight function with its
axioms, gcds, Bezout, coprimality, factorization and the coprime
form of the CRT.
Ring gains mixins, which take their parent `ComRing` as a parameter
instead of copying it, so that a ring has a single ring object:
- `IDomainMixin` carries `mulf_eq0` and the domain lemmas;
- `FieldMixin` has a single axiom, that the units are the nonzero
elements; `mulf_eq0` is derived, and its `Dom` is an `IDomainMixin`
over the same parent;
- `IDomainBundle` and `FieldBundle` package the carrier, the ring and
the mixin, so that a consumer takes a single theory parameter.
Ideal and CommAlgebra take a `ComRing` and an `IDomainMixin`.
Poly takes its coefficients as a `ComRing` plus an `IDomainMixin`.
Its units are now realized instead of being left unproved and
cleared, and its domain level `IDPoly` is a mixin over the one
`PolyComRing`. Poly also gains:
- evaluation lemmas (`pevalC`, `pevalD`, `pevalM`, `peval_sum`,
`peval_prod`, ...); `peval` now sums over `0 <= i < deg p`;
- products of monic linear factors (`mprod`), with their roots and
degree;
- `PolyField`, polynomials over a field, with Lagrange interpolation
in `PolyField.Lagrange`.
ZModP gets its field structure from the mixin `ZModpFieldMx` and the
bundle `ZModpFieldBd`, over the one ring `ZModpRing`, instead of a
second clone of `Ring.Field`. `ZModpField` remains as a packed alias,
so qualified names such as `ZModpField.mulrC` still resolve:
theory ZModpField = ZModpRing + ZModpFieldMx.
This breaks the developments that clone `ZModpField`: an alias cannot
be cloned. They clone the bundle instead, and its ring lemmas are
under `R`:
clone GP.ZModE.ZModpFieldBd as ZPF.
... ZPF.R.mulrC ...
The examples and DHIES are updated accordingly.
strub
force-pushed
the
feat/comm-algebra
branch
from
November 24, 2026 18:57
5d9d4c8 to
f0fbef8
Compare
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.
New theory CommAlgebra, over an integral domain:
Baseis the ideal-theoretic core, with no axiom beyond the ringstructure: divisibility, the Chinese remainder theorem stated with
Bezout witnesses (
comax x y, defined asexists u v, u * x + v * y = oner), and the congruence modulo anelement (
eqm m x y, an abbreviation form %| (x - y)). Aninstance can enter at this level by giving the Bezout witnesses
directly, without any division theory.
EuclideanincludesBaseand adds a weight function with itsaxioms, gcds, Bezout, coprimality, factorization and the coprime
form of the CRT.
Ring gains mixins, which take their parent
ComRingas a parameterinstead of copying it, so that a ring has a single ring object:
IDomainMixincarriesmulf_eq0and the domain lemmas;FieldMixinhas a single axiom, that the units are the nonzeroelements;
mulf_eq0is derived, and itsDomis anIDomainMixinover the same parent;
IDomainBundleandFieldBundlepackage the carrier, the ring andthe mixin, so that a consumer takes a single theory parameter.
Ideal and CommAlgebra take a
ComRingand anIDomainMixin.Poly takes its coefficients as a
ComRingplus anIDomainMixin.Its units are now realized instead of being left unproved and
cleared, and its domain level
IDPolyis a mixin over the onePolyComRing. Poly also gains:pevalC,pevalD,pevalM,peval_sum,peval_prod, ...);pevalnow sums over0 <= i < deg p;mprod), with their roots anddegree;
PolyField, polynomials over a field, with Lagrange interpolationin
PolyField.Lagrange.ZModP gets its field structure from the mixin
ZModpFieldMxand thebundle
ZModpFieldBd, over the one ringZModpRing, instead of asecond clone of
Ring.Field.ZModpFieldremains as a packed alias,so qualified names such as
ZModpField.mulrCstill resolve:This breaks the developments that clone
ZModpField: an alias cannotbe cloned. They clone the bundle instead, and its ring lemmas are
under
R:The examples and DHIES are updated accordingly.