Skip to content

commalg · GradedCommutativePolynomial

12 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.

Worked example

The complete checked program Calculate in a fixed-cap multivariate weighted power-series ring uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Calculate in a fixed-cap multivariate weighted power-series ring."""

from noether import Z
from noether.commalg import PowerSeriesRing, SeriesTruncation


def main() -> None:
    ring = PowerSeriesRing(
        Z,
        ["x", "y", "z"],
        SeriesTruncation.weighted_degree([1, 2, 3], 6),
    )
    x, y, z = ring.generators()
    assert (x**6).is_zero()
    assert not (x**2 * z + y * z).is_zero()
    value = (1 + x + y).pow(4)
    print(f"{value}; coefficient capacity <= {ring.coefficient_capacity_bound()}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/17_weighted_power_series.py.

commalg.GradedCommutativePolynomial

A sparse exact graded-commutative polynomial.

class GradedCommutativePolynomial

noether::commalg::GradedCommutativePolynomial · Direct Rust declaration

pub struct GradedCommutativePolynomial { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/commalg/test_graded_commutative_facade.py:31 · validation/unit/commalg/test_graded_commutative_facade.py:5

commalg.GradedCommutativePolynomial.__add__

Add another compatible value to this value.

Detailed contract

Exact sum in the shared context.

(self, other: GradedCommutativePolynomial) -> GradedCommutativePolynomial

noether::commalg::GradedCommutativePolynomial::add · Direct Rust declaration

pub fn add(&self, other: &Self) -> Result<Self, GradedCommutativeError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/infra/test_discovery.py:211 · validation/unit/infra/test_public_api_index.py:293

commalg.GradedCommutativePolynomial.__mul__

Multiply this value by another compatible value.

Detailed contract

Koszul-sign product in canonical generator order.

(self, other: GradedCommutativePolynomial) -> GradedCommutativePolynomial

noether::commalg::GradedCommutativePolynomial::mul · Direct Rust declaration

pub fn mul(&self, other: &Self) -> Result<Self, GradedCommutativeError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/infra/test_public_api_index.py:214

commalg.GradedCommutativePolynomial.__neg__

Return the additive inverse of this value.

Detailed contract

Additive inverse.

(self) -> GradedCommutativePolynomial

noether::commalg::GradedCommutativePolynomial::neg · Direct Rust declaration

pub fn neg(&self) -> Result<Self, GradedCommutativeError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

commalg.GradedCommutativePolynomial.__sub__

Subtract another compatible value from this value.

Detailed contract

Exact difference in the shared context.

(self, other: GradedCommutativePolynomial) -> GradedCommutativePolynomial

noether::commalg::GradedCommutativePolynomial::sub · Direct Rust declaration

pub fn sub(&self, other: &Self) -> Result<Self, GradedCommutativeError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/infra/test_discovery.py:212

commalg.GradedCommutativePolynomial.from_json

Deserialize and revalidate a GradedCommutativePolynomial from typed JSON.

Detailed contract

Deserialize and revalidate a polynomial.

(cls, value: str) -> GradedCommutativePolynomial

noether::commalg::GradedCommutativePolynomial::from_json · Direct Rust declaration

pub fn from_json(value: &str) -> Result<Self, NoetherError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/category/test_category.py:14 · validation/unit/combin/test_acceptance_workload.py:65 · validation/unit/combin/test_acceptance_workload.py:86 · validation/unit/combin/test_graph_facade.py:106 · validation/unit/combin/test_graph_facade.py:25 · validation/unit/combinatorics/test_kashiwara_crystal.py:32

commalg.GradedCommutativePolynomial.homogeneous_degree

Compute homogeneous degree for this GradedCommutativePolynomial.

Detailed contract

The common degree, None for zero or a nonhomogeneous polynomial.

(self) -> int | None

noether::commalg::GradedCommutativePolynomial::homogeneous_degree · Direct Rust declaration

pub fn homogeneous_degree(&self) -> Result<Option<u32>, GradedCommutativeError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/commalg/test_polynomial_facade.py:260 · validation/unit/commalg/test_polynomial_facade.py:261 · validation/unit/commalg/test_polynomial_facade.py:262 · validation/unit/commalg/test_polynomial_facade.py:305 · validation/unit/homalg/test_exterior_algebra.py:90 · validation/unit/homalg/test_finite_group_cohomology.py:163

commalg.GradedCommutativePolynomial.is_zero

Test whether this GradedCommutativePolynomial is zero.

Detailed contract

Whether the polynomial is zero.

(self) -> bool

noether::commalg::GradedCommutativePolynomial::is_zero · Direct Rust declaration

pub fn is_zero(&self) -> bool
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: examples/17_weighted_power_series.py:16 · examples/17_weighted_power_series.py:17 · examples/39_kahler_differentials.py:20 · validation/unit/commalg/test_graded_commutative_facade.py:26 · validation/unit/commalg/test_kahler_differentials.py:113 · validation/unit/commalg/test_kahler_differentials.py:38

commalg.GradedCommutativePolynomial.ring

Return the ring recorded by this GradedCommutativePolynomial.

Detailed contract

Owning graded-commutative context.

(self) -> GradedCommutativePolynomialRing

noether::commalg::GradedCommutativePolynomial::ring · Direct Rust declaration

pub fn ring(&self) -> &GradedCommutativePolynomialRing
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: examples/11_qadic_witt_vectors.py:3 · examples/13_chinese_remainder_theorem.py:10 · examples/13_chinese_remainder_theorem.py:12 · examples/13_chinese_remainder_theorem.py:9 · examples/14_weighted_polynomials.py:10 · examples/14_weighted_polynomials.py:11

commalg.GradedCommutativePolynomial.scale

Compute scale for this GradedCommutativePolynomial.

Detailed contract

Scalar multiplication by a coefficient in the base field.

(self, scalar: FiniteFieldElement) -> GradedCommutativePolynomial

noether::commalg::GradedCommutativePolynomial::scale · Direct Rust declaration

pub fn scale( &self, scalar: &FiniteFieldElement, ) -> Result<Self, GradedCommutativeError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/infra/test_mpi_scale_report.py:13 · validation/bench/macaulay2_normalization.py:332 · validation/bench/macaulay2_normalization.py:333 · validation/bench/macaulay2_normalization.py:337 · validation/bench/macaulay2_normalization.py:339

commalg.GradedCommutativePolynomial.terms

Return the terms recorded by this GradedCommutativePolynomial.

Detailed contract

Canonically ordered nonzero terms.

(self) -> list[tuple[FiniteFieldElement, list[int]]]

noether::commalg::GradedCommutativePolynomial::terms · Direct Rust declaration

pub fn terms(&self) -> &BTreeMap<GradedMonomial, FiniteFieldElement>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: examples/07_integer_factorization.py:14 · examples/40_exterior_algebra.py:43 · validation/unit/combin/test_acceptance_workload.py:45 · validation/unit/combin/test_acceptance_workload.py:81 · validation/unit/combinatorics/test_boundary.py:31 · validation/unit/combinatorics/test_boundary.py:44

commalg.GradedCommutativePolynomial.to_json

Serialize this GradedCommutativePolynomial to its canonical typed JSON representation.

Detailed contract

Serialize the complete context and sparse terms.

(self) -> str

noether::commalg::GradedCommutativePolynomial::to_json · Direct Rust declaration

pub fn to_json(&self) -> Result<String, NoetherError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/GradedCommutativePolynomial@1

Executable usage: validation/unit/category/test_category.py:14 · validation/unit/category/test_category.py:15 · validation/unit/combin/test_acceptance_workload.py:30 · validation/unit/combin/test_acceptance_workload.py:65 · validation/unit/combin/test_acceptance_workload.py:86 · validation/unit/combin/test_graph_facade.py:106