Skip to content

root · Ring

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

Worked example

The complete checked program Certify a familiar identity with real and complex balls uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Certify a familiar identity with real and complex balls."""

from fractions import Fraction

from noether import ComplexBallField, RealBallField


def main() -> None:
    reals = RealBallField(192)
    one_third = reals(Fraction(1, 3))
    assert (3 * one_third).overlaps(reals.one())

    complexes = ComplexBallField(192)
    imaginary_unit = complexes(0, 1)
    assert (imaginary_unit**2).overlaps(complexes(-1))
    assert (1 + imaginary_unit).overlaps(complexes(1, 1))
    print(f"1/3 = {one_third}; i^2 = {imaginary_unit**2}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/02_ball_arithmetic.py.

Ring

Structural Python view of a coefficient context.

class Ring

noether::Ring · Direct Rust declaration

pub trait Ring: SemanticType + Eq { type Element: SemanticType + Clone + Eq; // Required methods fn contains(&self, value: &Self::Element) -> bool; fn zero(&self) -> Self::Element; fn one(&self) -> Self::Element; fn add( &self, a: &Self::Element, b: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>; fn sub( &self, a: &Self::Element, b: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>; fn mul( &self, a: &Self::Element, b: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>; fn neg( &self, value: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>; // Provided methods fn is_zero(&self, value: &Self::Element) -> bool { ... } fn sum_products( &self, products: &[(&Self::Element, &Self::Element)], ) -> Result<Self::Element, ContextMismatchError> { ... } }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded

Executable usage: validation/unit/commalg/test_residue_ring_facade.py:19 · validation/unit/commalg/test_residue_ring_facade.py:9 · validation/unit/linalg/test_matrix_facade.py:10 · validation/unit/linalg/test_matrix_facade.py:20 · validation/unit/numthy/test_padic_ring_facade.py:27 · validation/unit/numthy/test_padic_ring_facade.py:9

Ring.__call__

Coerce the supplied input through this context or mathematical map.

(self, value: _Element) -> _Element

noether::root::Ring · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded

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

Ring.one

Compute one for this Ring.

(self) -> _Element

noether::root::Ring · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded

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

Ring.zero

Compute zero for this Ring.

(self) -> _Element

noether::root::Ring · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded

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