Skip to content

commalg · FreeAbelianGrading

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

Worked example

The complete checked program Decompose a polynomial by a nonstandard positive grading uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Decompose a polynomial by a nonstandard positive grading."""

from noether import Z
from noether.commalg import PolynomialRing, WeightedGrading


def main() -> None:
    ring = PolynomialRing(Z, ["x", "y", "z"], grading=WeightedGrading([1, 2, 3]))
    x, y, z = ring.generators()
    sparse = ring.from_terms([([0, 0, 0], 1), ([2, 0, 0], 1), ([0, 1, 0], 1)])
    polynomial = sparse + z
    assert sparse * (x + y) == (1 + x**2 + y) * (x + y)
    components = polynomial.homogeneous_components()
    assert [degree for degree, _ in components] == [0, 2, 3]
    assert x**2 + y == components[1][1]
    print(f"weighted homogeneous degrees: {[degree for degree, _ in components]}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/14_weighted_polynomials.py.

commalg.FreeAbelianGrading

Degrees of ordered variables in one free abelian group Z^r.

FreeAbelianGrading(rank: int, variable_degrees: Sequence[Degree])

noether::commalg::FreeAbelianGrading · Direct Rust declaration

pub struct FreeAbelianGrading { /* 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/FreeAbelianGrading@1

Executable usage: validation/unit/commalg/test_monomial_ideal_facade.py:12 · validation/unit/commalg/test_monomial_ideal_facade.py:76 · validation/unit/commalg/test_polynomial_facade.py:11 · validation/unit/commalg/test_polynomial_facade.py:318 · validation/unit/homalg/test_module_facade.py:14 · validation/unit/homalg/test_module_facade.py:198

commalg.FreeAbelianGrading.arity

Return the arity recorded by this FreeAbelianGrading.

Detailed contract

Number of ordered variables receiving degrees.

(self) -> int

noether::commalg::FreeAbelianGrading::arity · Direct Rust declaration

pub fn arity(&self) -> usize
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/FreeAbelianGrading@1

Executable usage: validation/unit/commalg/test_polynomial_facade.py:197 · validation/unit/commalg/test_polynomial_facade.py:205 · validation/unit/commalg/test_polynomial_ideal_facade.py:259 · validation/unit/commalg/test_power_series_facade.py:65 · validation/bench/groebner_compare.py:120 · validation/bench/groebner_compare.py:121

commalg.FreeAbelianGrading.certify_positive

Compute certify positive for this FreeAbelianGrading.

Detailed contract

Certify finite graded pieces using an exact integral functional. The functional must have the grading rank and pair positively with the degree of every variable. This is independently rechecked when the certificate is deserialized.

(self, functional: Degree) -> PositiveGrading

noether::commalg::FreeAbelianGrading::certify_positive · Direct Rust declaration

pub fn certify_positive( &self, functional: Degree, ) -> Result<PositiveGrading, GradingError>
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/FreeAbelianGrading@1

commalg.FreeAbelianGrading.degree

Compute degree for this FreeAbelianGrading.

Detailed contract

Degree of a monomial with arbitrary-precision nonnegative exponents.

(self, exponents: Sequence[int]) -> Degree

noether::commalg::FreeAbelianGrading::degree · Direct Rust declaration

pub fn degree(&self, exponents: &[Integer]) -> Result<Degree, GradingError>
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/FreeAbelianGrading@1

Executable usage: examples/14_weighted_polynomials.py:16 · examples/14_weighted_polynomials.py:18 · examples/15_groebner_twisted_cubic.py:15 · examples/15_groebner_twisted_cubic.py:28 · examples/31_local_fields_and_precision.py:37 · examples/33_simplicial_cohomology_operations.py:26

commalg.FreeAbelianGrading.from_json

Deserialize and revalidate a FreeAbelianGrading from typed JSON.

Detailed contract

Deserialize and revalidate a free abelian grading.

(cls, value: str) -> FreeAbelianGrading

noether::commalg::FreeAbelianGrading::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/FreeAbelianGrading@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.FreeAbelianGrading.rank

Return the rank recorded by this FreeAbelianGrading.

Detailed contract

Rank of the free abelian grading group.

(self) -> int

noether::commalg::FreeAbelianGrading::rank · Direct Rust declaration

pub fn rank(&self) -> usize
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/FreeAbelianGrading@1

Executable usage: examples/38_exact_linear_systems.py:78 · examples/distributed/f2_linear_algebra.py:34 · examples/distributed/f2_linear_algebra.py:54 · examples/distributed/f2_linear_algebra.py:55 · examples/distributed/f2_linear_algebra.py:60 · validation/unit/combin/test_acceptance_workload.py:74

commalg.FreeAbelianGrading.standard

Construct a FreeAbelianGrading using standard.

Detailed contract

Standard rank-one grading on the requested number of variables.

(cls, arity: int) -> FreeAbelianGrading

noether::commalg::FreeAbelianGrading::standard · Direct Rust declaration

pub fn standard(arity: usize) -> Self
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/FreeAbelianGrading@1

Executable usage: validation/unit/commalg/test_monomial_ideal_facade.py:57 · validation/unit/commalg/test_polynomial_facade.py:34 · validation/unit/commalg/test_polynomial_facade.py:42 · validation/unit/commalg/test_polynomial_facade.py:43 · validation/unit/commalg/test_polynomial_facade.py:44 · validation/unit/commalg/test_polynomial_facade.py:45

commalg.FreeAbelianGrading.to_json

Serialize this FreeAbelianGrading to its canonical typed JSON representation.

Detailed contract

Serialize the complete grading context as typed JSON.

(self) -> str

noether::commalg::FreeAbelianGrading::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/FreeAbelianGrading@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

commalg.FreeAbelianGrading.trivial

Construct a FreeAbelianGrading using trivial.

Detailed contract

Trivial rank-zero grading on the requested number of variables.

(cls, arity: int) -> FreeAbelianGrading

noether::commalg::FreeAbelianGrading::trivial · Direct Rust declaration

pub fn trivial(arity: usize) -> Self
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/FreeAbelianGrading@1

Executable usage: examples/26_elliptic_descent_functions.py:40 · validation/unit/groups/test_acceptance_workload.py:140 · validation/unit/groups/test_acceptance_workload.py:141 · validation/unit/groups/test_acceptance_workload.py:149 · validation/unit/groups/test_acceptance_workload.py:151

commalg.FreeAbelianGrading.variable_degrees

Return the variable degrees recorded by this FreeAbelianGrading.

Detailed contract

Degree of every variable, in variable order.

(self) -> list[Degree]

noether::commalg::FreeAbelianGrading::variable_degrees · Direct Rust declaration

pub fn variable_degrees(&self) -> &[Degree]
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/FreeAbelianGrading@1

Executable usage: validation/unit/commalg/test_construction_algebras.py:44 · validation/bench/macaulay2_quotient.py:191 · validation/bench/macaulay2_quotient.py:229 · validation/bench/macaulay2_quotient.py:271 · validation/bench/macaulay2_quotient.py:276 · validation/bench/macaulay2_quotient.py:362

commalg.FreeAbelianGrading.weighted_view

Compute weighted view for this FreeAbelianGrading.

Detailed contract

Return the positive rank-one weighted view when it exists.

(self) -> WeightedGrading | None

noether::commalg::FreeAbelianGrading::weighted_view · Direct Rust declaration

pub fn weighted_view(&self) -> Option<WeightedGrading>
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/FreeAbelianGrading@1

Executable usage: validation/unit/homalg/test_module_facade.py:200 · validation/unit/homalg/test_module_facade.py:204