Skip to content

root · RationalField

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

Worked example

The complete checked program Compute and verify a Bézout certificate over the integers uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Compute and verify a Bézout certificate over the integers."""

from noether import Z


def main() -> None:
    identity = Z.extended_gcd(987_654_321, 123_456_789)
    identity.verify(Z, 987_654_321, 123_456_789)
    assert (
        identity.coefficient_a * 987_654_321 + identity.coefficient_b * 123_456_789 == identity.gcd
    )
    print(identity)


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/01_bezout_certificates.py.

RationalField

The canonical Python context for the field of rational numbers.

class RationalField

noether::RationalField · Direct Rust declaration

pub struct RationalField;
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/root/RationalField@1

Executable usage: validation/unit/commalg/test_affine_normalization_facade.py:117 · validation/unit/commalg/test_affine_normalization_facade.py:9 · validation/unit/commalg/test_construction_algebras.py:21 · validation/unit/commalg/test_construction_algebras.py:55 · validation/unit/commalg/test_construction_algebras.py:6 · validation/unit/commalg/test_kahler_differentials.py:12

RationalField.__call__

Coerce the supplied input through this context or mathematical map.

(self, value: int | _Fraction) -> _Fraction

noether::root::RationalField · 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
Semantic ID noether/root/RationalField@1

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

RationalField.extended_gcd

Return a canonical Bézout witness for two rational numbers.

(self, left: int | _Fraction, right: int | _Fraction) -> BezoutIdentity[_Fraction]

noether::root::RationalField::extended_gcd · Direct Rust declaration

fn extended_gcd( &self, a: &Self::Element, b: &Self::Element, ) -> BezoutIdentity<Self>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/root/RationalField@1

Executable usage: examples/01_bezout_certificates.py:9 · validation/unit/infra/test_public_api_index.py:154 · validation/unit/test_bezout_facade.py:22 · validation/unit/test_bezout_facade.py:41 · validation/unit/test_bezout_facade.py:49 · validation/unit/test_bezout_facade.py:53

RationalField.from_json

Deserialize and validate the singleton rational-field context.

(cls, value: str) -> RationalField

noether::root::RationalField::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
GIL attached / bounded
Semantic ID noether/root/RationalField@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

RationalField.gcd

Return the canonical field gcd: zero only for the pair (0, 0).

(self, left: int | _Fraction, right: int | _Fraction) -> _Fraction

noether::root::RationalField::gcd · Direct Rust declaration

fn gcd(&self, a: &Self::Element, b: &Self::Element) -> Self::Element
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/root/RationalField@1

Executable usage: examples/01_bezout_certificates.py:12 · validation/unit/commalg/test_polynomial_facade.py:385 · validation/unit/commalg/test_polynomial_facade.py:452 · validation/unit/commalg/test_polynomial_facade.py:469 · validation/unit/commalg/test_polynomial_facade.py:474 · validation/unit/commalg/test_polynomial_facade.py:498

RationalField.inverse

Compute inverse for this RationalField.

(self, value: int | _Fraction) -> _Fraction

noether::root::RationalField::inverse · Direct Rust declaration

fn inverse( &self, value: &Self::Element, ) -> Result<Self::Element, InversionError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/root/RationalField@1

Executable usage: examples/distributed/f2_linear_algebra.py:37 · examples/distributed/f2_linear_algebra.py:39 · validation/unit/commalg/test_context_tower_workload.py:121 · validation/unit/commalg/test_context_tower_workload.py:122 · validation/unit/commalg/test_context_tower_workload.py:75 · validation/unit/commalg/test_context_tower_workload.py:77

RationalField.one

Compute one for this RationalField.

(self) -> _Fraction

noether::root::RationalField::one · Direct Rust declaration

fn one(&self) -> Self::Element
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/root/RationalField@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

RationalField.to_json

Serialize the singleton rational-field context as canonical typed JSON.

(self) -> str

noether::root::RationalField::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
GIL attached / bounded
Semantic ID noether/root/RationalField@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

RationalField.zero

Compute zero for this RationalField.

(self) -> _Fraction

noether::root::RationalField::zero · Direct Rust declaration

fn zero(&self) -> Self::Element
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/root/RationalField@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