Skip to content

numthy · FractionalIdeal

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

Worked example

The complete checked program Reproduce Fisher's order-five elliptic-function normalization uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Reproduce Fisher's order-five elliptic-function normalization."""

from noether import Q
from noether.commalg import RationalFunctionField, WeilDivisor
from noether.numthy import EllipticCurve, NthPowerClassGroup


def main() -> None:
    coefficients = RationalFunctionField(Q, "lambda")
    parameter = coefficients.generator()
    curve = EllipticCurve(
        coefficients,
        [1 - parameter, -parameter, -parameter, 0, 0],
    )
    point = curve.point(0, 0)
    point.verify_exact_order(5)

    miller = curve.miller_function(point, 5)
    divisor = WeilDivisor(
        curve.underlying_curve,
        [
            (curve.origin().underlying_curve_point.as_closed_point(), 5),
            (point.underlying_curve_point.as_closed_point(), -5),
        ],
    )
    function = divisor.riemann_roch_space().basis[0]
    assert (function / miller.function).as_constant() is not None

    evaluation_at_two = function.evaluate_at((2 * point).underlying_curve_point)
    evaluation_at_four = function.evaluate_at((4 * point).underlying_curve_point)
    assert evaluation_at_two.value is not None
    assert evaluation_at_four.value is not None
    classes = NthPowerClassGroup(coefficients, 5)
    normalization = classes.class_of(evaluation_at_two.value) ** -2 * classes.class_of(
        evaluation_at_four.value
    )
    assert normalization.is_identity()
    print("order 5 verified; Riemann--Roch and Miller agree; normalization is trivial")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/26_elliptic_descent_functions.py.

numthy.FractionalIdeal

A canonical nonzero fractional ideal of a number-field order.

FractionalIdeal(order: NumberFieldOrder, generators: Sequence[int | Fraction | NumberFieldElement | Sequence[int | Fraction]])

noether::numthy::FractionalIdeal · Direct Rust declaration

pub struct FractionalIdeal { /* private fields */ }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: validation/unit/infra/test_discovery.py:119 · validation/unit/numthy/test_acceptance_workload.py:13 · validation/unit/numthy/test_acceptance_workload.py:84 · validation/unit/numthy/test_number_field_facade.py:10 · validation/unit/numthy/test_number_field_facade.py:174 · validation/unit/numthy/test_number_field_facade.py:176

numthy.FractionalIdeal.__add__

Add another compatible value to this value.

Detailed contract

Sum of two fractional ideals of the same order. Returns the argument unchanged.

(self, other: FractionalIdeal) -> FractionalIdeal

noether::numthy::FractionalIdeal::add · Direct Rust declaration

pub fn add(&self, other: &Self) -> Result<Self, FractionalIdealError>
fn add(self, rhs: &FractionalIdeal) -> Self::Output
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: validation/unit/infra/test_discovery.py:211 · validation/unit/infra/test_public_api_index.py:293

numthy.FractionalIdeal.__contains__

Return bool(key in self).

Detailed contract

Whether an exact field element lies in this fractional ideal.

(self, value: int | Fraction | NumberFieldElement | Sequence[int | Fraction]) -> bool

noether::numthy::FractionalIdeal::contains · Direct Rust declaration

pub fn contains(&self, element: &NumberFieldElement) -> bool
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: validation/unit/infra/test_discovery.py:200

numthy.FractionalIdeal.__mul__

Multiply this value by another compatible value.

Detailed contract

Product of two fractional ideals of the same order.

(self, other: FractionalIdeal) -> FractionalIdeal

noether::numthy::FractionalIdeal::mul · Direct Rust declaration

pub fn mul(&self, other: &Self) -> Result<Self, FractionalIdealError>
fn mul(self, rhs: &FractionalIdeal) -> Self::Output
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: validation/unit/infra/test_public_api_index.py:214

numthy.FractionalIdeal.basis

Canonical Z-basis of this fractional ideal.

Detailed contract

Canonical Z-basis of this fractional ideal.

(self) -> list[NumberFieldElement]

noether::numthy::FractionalIdeal::basis · Direct Rust declaration

pub fn basis(&self) -> Vec<NumberFieldElement>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: examples/26_elliptic_descent_functions.py:28 · examples/30_modules_and_resolutions.py:27 · examples/30_modules_and_resolutions.py:28 · examples/30_modules_and_resolutions.py:29 · examples/33_simplicial_cohomology_operations.py:26 · examples/33_simplicial_cohomology_operations.py:27

numthy.FractionalIdeal.factor

Complete signed prime-ideal factorization.

Detailed contract

Complete signed prime-ideal factorization in this maximal order. The result is reconstructed exactly after moving negative powers to the left side, so no unchecked factor list can escape this method.

(self) -> list[tuple[PrimeIdeal[NumberFieldOrder], int]]

noether::numthy::FractionalIdeal::factor · Direct Rust declaration

pub fn factor( &self, ) -> Result<Vec<(PrimeIdeal<NumberFieldOrder>, i64)>, IdealFactorizationError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL released
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: examples/07_integer_factorization.py:10 · examples/07_integer_factorization.py:5 · examples/12_number_field_ideals.py:3 · validation/unit/commalg/test_context_tower_workload.py:87 · validation/unit/commalg/test_polynomial_facade.py:120 · validation/unit/commalg/test_polynomial_facade.py:134

numthy.FractionalIdeal.from_json

Restore and revalidate a canonical fractional ideal.

Detailed contract

Restore and validate an exact fractional ideal from canonical JSON.

(cls, value: str) -> FractionalIdeal

noether::numthy::FractionalIdeal::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/numthy/FractionalIdeal@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

numthy.FractionalIdeal.is_integral

Whether the ideal is contained in its coefficient order.

Detailed contract

Whether this fractional ideal is contained in its coefficient order.

(self) -> bool

noether::numthy::FractionalIdeal::is_integral · Direct Rust declaration

pub fn is_integral(&self) -> bool
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: validation/unit/numthy/test_number_field_facade.py:181 · validation/unit/numthy/test_number_field_facade.py:193 · validation/unit/numthy/test_padic_local_field_facade.py:225 · validation/unit/numthy/test_padic_local_field_facade.py:245 · validation/corpus/numthy/quadratic-field-arithmetic.py:40

numthy.FractionalIdeal.norm

Exact absolute ideal norm.

Detailed contract

Exact absolute ideal norm, extended multiplicatively to fractional ideals.

(self) -> Fraction

noether::numthy::FractionalIdeal::norm · Direct Rust declaration

pub fn norm(&self) -> Rational
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: examples/06_shortest_lattice_vectors.py:15 · examples/08_finite_field_extensions.py:13 · examples/08_finite_field_extensions.py:14 · examples/08_finite_field_extensions.py:3 · examples/12_number_field_ideals.py:16 · examples/12_number_field_ideals.py:18

numthy.FractionalIdeal.order

Coefficient order of this ideal.

Detailed contract

The coefficient order of this ideal.

(self) -> NumberFieldOrder

noether::numthy::FractionalIdeal::order · Direct Rust declaration

pub fn order(&self) -> &NumberFieldOrder
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: examples/11_qadic_witt_vectors.py:14 · examples/12_number_field_ideals.py:13 · examples/12_number_field_ideals.py:14 · examples/12_number_field_ideals.py:17 · examples/15_groebner_twisted_cubic.py:18 · examples/19_permutation_groups.py:13

numthy.FractionalIdeal.to_json

Canonical JSON representation.

Detailed contract

Serialize this exact ideal to canonical JSON.

(self) -> str

noether::numthy::FractionalIdeal::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/numthy/FractionalIdeal@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

numthy.FractionalIdeal.valuation

Signed valuation at a checked prime ideal of the same maximal order.

Detailed contract

The signed P-adic valuation of this fractional ideal.

(self, prime: PrimeIdeal[NumberFieldOrder]) -> int

noether::numthy::FractionalIdeal::valuation · Direct Rust declaration

pub fn valuation( &self, prime: &PrimeIdeal<NumberFieldOrder>, ) -> Result<i64, IdealFactorizationError>
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, flint-core
GIL attached / bounded
Semantic ID noether/numthy/FractionalIdeal@1

Executable usage: examples/31_local_fields_and_precision.py:37 · validation/unit/commalg/test_context_tower_workload.py:121 · validation/unit/commalg/test_context_tower_workload.py:122 · validation/unit/numthy/test_number_field_facade.py:244 · validation/unit/numthy/test_number_field_facade.py:245 · validation/unit/numthy/test_number_field_facade.py:255