Skip to content

commalg · CrtDecomposition

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

Worked example

The complete checked program Compute a fast Smith form without transformation matrices uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Compute a fast Smith form without transformation matrices."""

from noether import Z
from noether.linalg import Matrix


def main() -> None:
    matrix = Matrix.from_rows(Z, [[2, 4, 4], [6, 6, 12], [10, 4, 16]])
    smith = matrix.smith_normal_form()
    smith.verify()
    assert all(
        right % left == 0
        for left, right in zip(smith.invariant_factors, smith.invariant_factors[1:])
    )
    print(f"invariant factors: {smith.invariant_factors}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/04_smith_normal_form.py.

commalg.CrtDecomposition

A verified Chinese-remainder decomposition into prime-power rings.

class CrtDecomposition

noether::commalg::CrtDecomposition · Direct Rust declaration

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

Executable usage: validation/unit/commalg/test_context_tower_workload.py:6 · validation/unit/commalg/test_context_tower_workload.py:89 · validation/unit/commalg/test_residue_ring_facade.py:10 · validation/unit/commalg/test_residue_ring_facade.py:126 · validation/unit/commalg/test_residue_ring_facade.py:132 · validation/unit/commalg/test_residue_ring_facade.py:133

commalg.CrtDecomposition.factors

Return the factors recorded by this CrtDecomposition.

Detailed contract

Canonical prime-power factor rings in increasing-prime order.

(self) -> list[ResidueRing]

noether::commalg::CrtDecomposition::factors · Direct Rust declaration

pub fn factors(&self) -> &[ResidueRing]
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/CrtDecomposition@1

Executable usage: examples/04_smith_normal_form.py:17 · examples/07_integer_factorization.py:12 · validation/unit/commalg/test_context_tower_workload.py:87 · validation/unit/commalg/test_polynomial_facade.py:126 · validation/unit/commalg/test_polynomial_facade.py:147 · validation/unit/commalg/test_polynomial_facade.py:158

commalg.CrtDecomposition.from_json

Deserialize and revalidate a CrtDecomposition from typed JSON.

Detailed contract

Deserialize and revalidate a canonical CRT decomposition.

(cls, value: str) -> CrtDecomposition

noether::commalg::CrtDecomposition::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/CrtDecomposition@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.CrtDecomposition.project

Project one residue class to its canonical prime-power CRT components.

Detailed contract

Project one source value to every prime-power component.

(self, value: ResidueClass) -> list[ResidueClass]

noether::commalg::CrtDecomposition::project · Direct Rust declaration

pub fn project( &self, value: &ResidueClass, ) -> Result<Vec<ResidueClass>, CrtError>
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/CrtDecomposition@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.CrtDecomposition.reconstruct

Compute reconstruct for this CrtDecomposition.

Detailed contract

Reconstruct the unique source value with the supplied components.

(self, components: Iterable[ResidueClass]) -> ResidueClass

noether::commalg::CrtDecomposition::reconstruct · Direct Rust declaration

pub fn reconstruct( &self, components: &[ResidueClass], ) -> Result<ResidueClass, CrtError>
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/CrtDecomposition@1

Executable usage: examples/13_chinese_remainder_theorem.py:14 · examples/13_chinese_remainder_theorem.py:3 · validation/unit/commalg/test_context_tower_workload.py:88 · validation/unit/commalg/test_polynomial_ideal_facade.py:1158 · validation/unit/commalg/test_polynomial_ideal_facade.py:1302 · validation/unit/commalg/test_polynomial_ideal_facade.py:1329

commalg.CrtDecomposition.source

Return the source recorded by this CrtDecomposition.

Detailed contract

The residue ring being decomposed.

(self) -> ResidueRing

noether::commalg::CrtDecomposition::source · Direct Rust declaration

pub fn source(&self) -> &ResidueRing
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/CrtDecomposition@1

Executable usage: examples/09_finite_field_isomorphisms.py:11 · examples/09_finite_field_isomorphisms.py:13 · examples/09_finite_field_isomorphisms.py:9 · examples/30_modules_and_resolutions.py:34 · examples/30_modules_and_resolutions.py:37 · validation/unit/category/test_acceptance_workload.py:25

commalg.CrtDecomposition.to_json

Serialize this CrtDecomposition to its canonical typed JSON representation.

Detailed contract

Serialize the source and canonical factor rings.

(self) -> str

noether::commalg::CrtDecomposition::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/CrtDecomposition@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.CrtDecomposition.verify

Replay and verify the mathematical evidence carried by this CrtDecomposition.

Detailed contract

Verify factor order, prime-power structure, and exact reconstruction modulus.

(self) -> None

noether::commalg::CrtDecomposition::verify · Direct Rust declaration

pub fn verify(&self) -> Result<(), CrtError>
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/CrtDecomposition@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