Skip to content

commalg · MonomialOrder

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

Worked example

The complete checked program Reduce a module element and certify a minimal free resolution uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Reduce a module element and certify a minimal free resolution."""

from noether import Q
from noether.commalg import Degree, MonomialOrder, PolynomialRing
from noether.homalg import (
    FreeModule,
    ModuleElement,
    ModuleHomomorphism,
    ModuleMonomialOrder,
    PresentedModule,
    Submodule,
)
from noether.linalg import Matrix, Vector


def main() -> None:
    ring = PolynomialRing(Q, ["x", "y", "z", "w"])
    x, y, z, w = ring.generators()
    order = ModuleMonomialOrder.term_over_position(MonomialOrder.GREVLEX)

    ambient = FreeModule(ring, 2)
    first = ModuleElement(ambient, Vector.from_values(ring, [x, y]))
    second = ModuleElement(ambient, Vector.from_values(ring, [y, 1]))
    submodule = Submodule.from_generators(ambient, [first, second])
    basis = submodule.groebner_basis(order)
    reduction = basis.reduce(first + second * x)
    basis.verify()
    reduction.verify()
    assert reduction.is_member()

    target = FreeModule(ring, 1, grading_rank=1, degree_shifts=[Degree([0])])
    source = FreeModule(ring, 3, grading_rank=1, degree_shifts=[Degree([-2])] * 3)
    twisted_cubic = PresentedModule(
        ModuleHomomorphism(
            source,
            target,
            Matrix.from_rows(ring, [[x * z - y**2, x * w - y * z, y * w - z**2]]),
        )
    )
    resolution = twisted_cubic.minimal_free_resolution(order)
    resolution.verify()
    betti = resolution.graded_betti_table()
    betti.verify()
    assert betti.entries == [
        (0, Degree([0]), 1),
        (1, Degree([2]), 3),
        (2, Degree([3]), 2),
    ]
    print(f"module member certified; minimal Betti entries={betti.entries}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/30_modules_and_resolutions.py.

commalg.MonomialOrder

One admissible monomial order.

MonomialOrder(name: str)

noether::commalg::MonomialOrder · Direct Rust declaration

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

Executable usage: examples/30_modules_and_resolutions.py:21 · examples/30_modules_and_resolutions.py:6 · validation/unit/commalg/test_base_change.py:10 · validation/unit/commalg/test_base_change.py:22 · validation/unit/commalg/test_integer_groebner_facade.py:5 · validation/unit/commalg/test_integer_groebner_facade.py:9

commalg.MonomialOrder.block

Construct an order from (variable_indices, component_order) blocks.

Detailed contract

Construct a block order on an ordered partition of variable indices. Each component order must be one of the three standard orders. Empty blocks, repeated indices, and nested block orders are rejected here; the eventual polynomial-ring context additionally checks range and coverage.

(cls, blocks: Iterable[tuple[Iterable[int], MonomialOrder | Literal['lex', 'grlex', 'grevlex']]]) -> MonomialOrder

noether::commalg::MonomialOrder::block · Direct Rust declaration

pub fn block<I, J>(blocks: I) -> Result<Self, MonomialOrderError>where I: IntoIterator<Item = (J, Self)>, J: IntoIterator<Item = 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/MonomialOrder@1

Executable usage: validation/unit/commalg/test_polynomial_facade.py:271 · validation/unit/commalg/test_polynomial_facade.py:71 · validation/unit/commalg/test_polynomial_facade.py:72 · validation/unit/commalg/test_polynomial_facade.py:73 · validation/unit/commalg/test_polynomial_facade.py:74 · validation/unit/commalg/test_polynomial_facade.py:75

commalg.MonomialOrder.blocks

Return the blocks recorded by this MonomialOrder.

Detailed contract

Ordered block specifications, or None for a standard global order.

(self) -> list[tuple[list[int], MonomialOrder]] | None

noether::commalg::MonomialOrder::blocks · Direct Rust declaration

pub fn blocks(&self) -> Option<Vec<(Vec<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/MonomialOrder@1

Executable usage: validation/unit/commalg/test_polynomial_facade.py:73 · validation/bench/macaulay2_core.py:325 · validation/bench/macaulay2_core.py:337 · validation/bench/macaulay2_core.py:343 · validation/bench/macaulay2_core.py:344 · validation/bench/macaulay2_core.py:352

commalg.MonomialOrder.elimination

Put selected variables in a leading lexicographic elimination block.

Detailed contract

Construct the standard two-block elimination order. The selected variables form a leading lexicographic block; all other variables form a trailing graded-reverse-lexicographic block. Variable order within each block is their ambient order.

(cls, variable_count: int, eliminated: Iterable[int]) -> MonomialOrder

noether::commalg::MonomialOrder::elimination · Direct Rust declaration

pub fn elimination<I>( variable_count: usize, eliminated: I, ) -> Result<Self, MonomialOrderError>where I: IntoIterator<Item = 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/MonomialOrder@1

Executable usage: examples/15_groebner_twisted_cubic.py:21 · examples/15_groebner_twisted_cubic.py:22 · examples/15_groebner_twisted_cubic.py:23 · examples/15_groebner_twisted_cubic.py:29 · validation/unit/commalg/test_base_change.py:22 · validation/unit/commalg/test_polynomial_facade.py:74

commalg.MonomialOrder.from_json

Deserialize and validate one admissible monomial order.

(cls, value: str) -> MonomialOrder

noether::commalg::MonomialOrder::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/MonomialOrder@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.MonomialOrder.name

Return the name recorded by this MonomialOrder.

Detailed contract

Stable short name accepted by the Python constructor.

(self) -> Literal['lex', 'grlex', 'grevlex', 'block']

noether::commalg::MonomialOrder::name · Direct Rust declaration

pub fn name(&self) -> &'static str
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/MonomialOrder@1

Executable usage: examples/12_number_field_ideals.py:12 · validation/unit/commalg/test_polynomial_facade.py:345 · validation/unit/commalg/test_polynomial_facade.py:44 · validation/unit/commalg/test_polynomial_facade.py:61 · validation/unit/commalg/test_polynomial_facade.py:65 · validation/unit/commalg/test_polynomial_facade.py:72

commalg.MonomialOrder.to_json

Serialize the stable order name as canonical typed JSON.

Detailed contract

Serialize this order’s stable name as canonical typed JSON.

(self) -> str

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