commalg · PositiveGrading¶
8 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.PositiveGrading¶
Exact evidence that a free-abelian grading has finite graded pieces.
noether::commalg::PositiveGrading · Direct Rust declaration
| 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/PositiveGrading@1 |
Executable usage: validation/unit/commalg/test_polynomial_facade.py:17 · validation/unit/commalg/test_polynomial_facade.py:323 · validation/unit/commalg/test_polynomial_facade.py:331
commalg.PositiveGrading.from_json¶
Deserialize and revalidate a PositiveGrading from typed JSON.
Detailed contract
Deserialize and independently recheck positivity.
noether::commalg::PositiveGrading::from_json · Direct Rust declaration
| 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/PositiveGrading@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.PositiveGrading.functional¶
Return the functional recorded by this PositiveGrading.
Detailed contract
Exact integral functional witnessing positivity.
noether::commalg::PositiveGrading::functional · Direct Rust declaration
| 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/PositiveGrading@1 |
commalg.PositiveGrading.grading¶
Return the grading recorded by this PositiveGrading.
Detailed contract
Certified grading.
noether::commalg::PositiveGrading::grading · Direct Rust declaration
| 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/PositiveGrading@1 |
Executable usage: examples/14_weighted_polynomials.py:10 · examples/14_weighted_polynomials.py:3 · validation/unit/commalg/test_base_change.py:23 · validation/unit/commalg/test_base_change.py:34 · validation/unit/commalg/test_construction_algebras.py:44 · validation/unit/commalg/test_context_tower_workload.py:42
commalg.PositiveGrading.project¶
Compute project for this PositiveGrading.
Detailed contract
Apply the positive functional to one degree.
noether::commalg::PositiveGrading::project · Direct Rust declaration
| 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/PositiveGrading@1 |
Executable usage: examples/13_chinese_remainder_theorem.py:13 · validation/unit/commalg/test_context_tower_workload.py:86 · validation/unit/commalg/test_quotient_facade.py:3 · validation/unit/commalg/test_residue_ring_facade.py:124 · validation/unit/commalg/test_residue_ring_facade.py:144 · validation/unit/infra/test_public_api_index.py:166
commalg.PositiveGrading.to_json¶
Serialize this PositiveGrading to its canonical typed JSON representation.
Detailed contract
Serialize the grading and its exact positivity witness.
noether::commalg::PositiveGrading::to_json · Direct Rust declaration
| 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/PositiveGrading@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.PositiveGrading.verify¶
Replay and verify the mathematical evidence carried by this PositiveGrading.
Detailed contract
Independently recheck this certificate.
noether::commalg::PositiveGrading::verify · Direct Rust declaration
| 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/PositiveGrading@1 |
Executable usage: examples/01_bezout_certificates.py:10 · examples/01_bezout_certificates.py:3 · examples/03_exact_linear_systems.py:13 · examples/03_exact_linear_systems.py:3 · examples/04_smith_normal_form.py:12 · examples/06_shortest_lattice_vectors.py:12
commalg.PositiveGrading.weights¶
Return the weights recorded by this PositiveGrading.
Detailed contract
Positive scalar weights induced on the ordered variables.
noether::commalg::PositiveGrading::weights · Direct Rust declaration
| 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/PositiveGrading@1 |
Executable usage: examples/23_kashiwara_crystals.py:16 · validation/unit/commalg/test_polynomial_facade.py:330 · validation/unit/commalg/test_polynomial_facade.py:435 · validation/unit/commalg/test_power_series_facade.py:111 · validation/unit/commalg/test_power_series_facade.py:115 · validation/unit/commalg/test_power_series_facade.py:221