Skip to content

homalg · ChainReduction

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

Worked example

The complete checked program Reduce and specialize an exact rational function uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Reduce and specialize an exact rational function."""

from fractions import Fraction

from noether import Q
from noether.commalg import RationalFunctionField


def main() -> None:
    functions = RationalFunctionField(Q, "x")
    x = functions.polynomial_ring.generator("x")
    reduced = functions.fraction(x**2 - 1, x - 1)
    assert reduced == functions(x + 1)
    assert (reduced + Fraction(1, 2)).specialize(2) == Fraction(7, 2)
    print(f"(x^2-1)/(x-1) = {reduced}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/16_rational_functions.py.

homalg.ChainReduction

Replayable algebraic Morse reduction of a based chain complex.

class ChainReduction

noether::homalg::ChainReduction · Direct Rust declaration

pub struct ChainReduction<R: Ring> { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, m4rst, m4rste, module-core, resolution-kernel, sparla
GIL attached / bounded

Executable usage: validation/unit/homalg/test_chain_complex.py:13 · validation/unit/homalg/test_chain_complex.py:77 · validation/unit/topology/test_simplicial_set_facade.py:10 · validation/unit/topology/test_simplicial_set_facade.py:130

homalg.ChainReduction.cancellations

Elementary cancellations in replay order.

(self) -> list[ChainCancellation]

noether::homalg::ChainReduction::cancellations · Direct Rust declaration

pub fn cancellations(&self) -> &[ChainCancellation]
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, m4rst, m4rste, module-core, resolution-kernel, sparla
GIL attached / bounded

Executable usage: validation/unit/homalg/test_chain_complex.py:82 · validation/unit/homalg/test_chain_complex.py:83 · validation/unit/homalg/test_padic_homology_facade.py:238 · validation/unit/homalg/test_padic_homology_facade.py:239 · validation/unit/homalg/test_padic_homology_facade.py:240 · validation/unit/homalg/test_padic_homology_facade.py:270

homalg.ChainReduction.reduced

Chain-homotopy-equivalent reduced complex.

(self) -> ChainComplex[R]

noether::homalg::ChainReduction::reduced · Direct Rust declaration

pub const fn reduced(&self) -> &ChainComplex<R>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, m4rst, m4rste, module-core, resolution-kernel, sparla
GIL attached / bounded

Executable usage: examples/16_rational_functions.py:14 · examples/16_rational_functions.py:15 · examples/16_rational_functions.py:16 · examples/16_rational_functions.py:17 · examples/32_poset_core_and_morse.py:19 · examples/distributed/f2_linear_algebra.py:50

homalg.ChainReduction.removed_pairs

Number of contractible basis pairs removed.

(self) -> int

noether::homalg::ChainReduction::removed_pairs · Direct Rust declaration

pub const fn removed_pairs(&self) -> usize
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, m4rst, m4rste, module-core, resolution-kernel, sparla
GIL attached / bounded

Executable usage: validation/unit/homalg/test_chain_complex.py:79 · validation/unit/homalg/test_padic_homology_facade.py:231 · validation/unit/homalg/test_padic_homology_facade.py:236 · validation/unit/homalg/test_padic_homology_facade.py:254 · validation/unit/infra/test_concurrency.py:162 · validation/unit/topology/test_simplicial_set_facade.py:132

homalg.ChainReduction.source

Original based chain complex.

Detailed contract

Original based complex.

(self) -> ChainComplex[R]

noether::homalg::ChainReduction::source · Direct Rust declaration

pub const fn source(&self) -> &ChainComplex<R>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, m4rst, m4rste, module-core, resolution-kernel, sparla
GIL attached / bounded

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

homalg.ChainReduction.verify

Replay the cancellation log and recheck the reduced complex.

Detailed contract

Replay every cancellation and recheck the resulting chain complex.

(self) -> None

noether::homalg::ChainReduction::verify · Direct Rust declaration

pub fn verify(&self) -> Result<(), VerificationError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core, groebner-kernel, m4rst, m4rste, module-core, resolution-kernel, sparla
GIL attached / bounded

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