commalg · ResidueRing¶
9 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.
Worked example¶
The complete checked program Project and reconstruct a residue class by the Chinese remainder theorem uses this API directly.
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Project and reconstruct a residue class by the Chinese remainder theorem."""
from noether.commalg import ResidueRing
def main() -> None:
ring = ResidueRing(360)
decomposition = ring.crt()
decomposition.verify()
value = ring(347)
components = decomposition.project(value)
assert decomposition.reconstruct(components) == value
print(f"347 mod 360 -> {[int(component) for component in components]}")
if __name__ == "__main__":
main()
Run it with .venv/bin/python examples/13_chinese_remainder_theorem.py.
commalg.ResidueRing¶
The exact finite ring of integers modulo an arbitrary-size modulus.
noether::commalg::ResidueRing · 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/ResidueRing@1 |
Executable usage: examples/13_chinese_remainder_theorem.py:5 · examples/13_chinese_remainder_theorem.py:9 · examples/38_exact_linear_systems.py:32 · examples/38_exact_linear_systems.py:8 · validation/unit/commalg/test_context_tower_workload.py:14 · validation/unit/commalg/test_context_tower_workload.py:34
commalg.ResidueRing.__call__¶
Coerce the supplied input through this context or mathematical map.
noether::commalg::ResidueRing · Python projection
| 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/ResidueRing@1 |
| Contexts | Z/nZ |
Executable usage: validation/unit/infra/test_discovery.py:57 · validation/unit/infra/test_public_api_index.py:155 · validation/unit/infra/test_public_api_index.py:169
Example
from noether.commalg import ResidueRing
ring = ResidueRing(15)
result = ring(8) * ring(2)
assert result == ring(1)
commalg.ResidueRing.cardinality¶
Compute cardinality for this ResidueRing.
noether::commalg::ResidueRing::cardinality · 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/ResidueRing@1 |
Executable usage: examples/27_weight_characters.py:10 · validation/unit/commalg/test_residue_ring_facade.py:23 · validation/unit/groups/test_weight_characters.py:25 · validation/unit/numthy/test_finite_field_facade.py:29 · validation/unit/numthy/test_qadic_ring_facade.py:33 · validation/parity/combinatorics/test_poset_parity.py:59
commalg.ResidueRing.crt¶
Return the canonical prime-power Chinese-remainder decomposition.
Detailed contract
Decompose this ring into its canonical prime-power CRT factors.
noether::commalg::ResidueRing::crt · 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/ResidueRing@1 |
Executable usage: examples/13_chinese_remainder_theorem.py:10 · validation/unit/commalg/test_context_tower_workload.py:85 · validation/unit/commalg/test_context_tower_workload.py:86 · validation/unit/commalg/test_context_tower_workload.py:87 · validation/unit/commalg/test_context_tower_workload.py:88 · validation/unit/commalg/test_context_tower_workload.py:89
commalg.ResidueRing.from_json¶
Deserialize and revalidate a residue-ring context.
noether::commalg::ResidueRing::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/ResidueRing@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.ResidueRing.modulus¶
Return the modulus recorded by this ResidueRing.
Detailed contract
The positive arbitrary-precision modulus.
noether::commalg::ResidueRing::modulus · 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/ResidueRing@1 |
Executable usage: validation/unit/commalg/test_context_tower_workload.py:87 · validation/unit/commalg/test_residue_ring_facade.py:101 · validation/unit/commalg/test_residue_ring_facade.py:105 · validation/unit/commalg/test_residue_ring_facade.py:110 · validation/unit/commalg/test_residue_ring_facade.py:128 · validation/unit/commalg/test_residue_ring_facade.py:141
commalg.ResidueRing.one¶
Compute one for this ResidueRing.
noether::commalg::ResidueRing::one · 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/ResidueRing@1 |
Executable usage: examples/02_ball_arithmetic.py:13 · examples/11_qadic_witt_vectors.py:11 · examples/24_homology_and_persistence.py:3 · examples/31_local_fields_and_precision.py:27 · validation/unit/combinatorics/test_poset.py:3 · validation/unit/commalg/test_acceptance_workload.py:37
commalg.ResidueRing.to_json¶
Serialize the complete ring context as canonical typed JSON.
Detailed contract
Serialize the complete residue-ring context as canonical typed JSON.
noether::commalg::ResidueRing::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/ResidueRing@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.ResidueRing.zero¶
Compute zero for this ResidueRing.
noether::commalg::ResidueRing::zero · 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/ResidueRing@1 |
Executable usage: examples/08_finite_field_extensions.py:11 · examples/10_padic_hensel_lifting.py:15 · examples/40_exterior_algebra.py:26 · examples/distributed/f2_linear_algebra.py:28 · examples/distributed/f2_linear_algebra.py:29 · examples/distributed/f2_linear_algebra.py:30