Skip to content

commalg · PrimeIdeal

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.

commalg.PrimeIdeal

A checked prime ideal of a number-field order.

class PrimeIdeal

noether::commalg::PrimeIdeal · Direct Rust declaration

pub struct PrimeIdeal<R: CommutativeRing> { /* private fields */ }
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/PrimeIdeal@1

Executable usage: validation/unit/numthy/test_acceptance_workload.py:58 · validation/unit/numthy/test_acceptance_workload.py:9 · validation/unit/numthy/test_number_field_facade.py:212 · validation/unit/numthy/test_number_field_facade.py:228 · validation/unit/numthy/test_number_field_facade.py:8

commalg.PrimeIdeal.__contains__

Return bool(key in self).

Detailed contract

Whether an exact field element belongs to this prime ideal.

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

noether::commalg::PrimeIdeal::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, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/PrimeIdeal@1

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

commalg.PrimeIdeal.basis

Canonical integral basis.

Detailed contract

Canonical integral basis of the prime ideal.

(self) -> list[NumberFieldElement]

noether::commalg::PrimeIdeal::basis · Direct Rust declaration

pub fn basis(&self) -> &[NumberFieldElement]
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/PrimeIdeal@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

commalg.PrimeIdeal.from_json

Restore and reverify a canonical number-field prime ideal.

Detailed contract

Restore and reverify a checked number-field prime ideal.

(cls, value: str) -> PrimeIdeal[C]

noether::commalg::PrimeIdeal::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, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/PrimeIdeal@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.PrimeIdeal.ideal

Underlying ideal in number-field fractional-ideal arithmetic.

Detailed contract

The canonical ideal certified as prime.

(self) -> Ideal[C]

noether::commalg::PrimeIdeal::ideal · Direct Rust declaration

pub fn ideal(&self) -> &Ideal<R>
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/PrimeIdeal@1

Executable usage: examples/12_number_field_ideals.py:17 · examples/12_number_field_ideals.py:18 · examples/12_number_field_ideals.py:19 · examples/12_number_field_ideals.py:3 · examples/15_groebner_twisted_cubic.py:12 · examples/15_groebner_twisted_cubic.py:13

commalg.PrimeIdeal.norm

Absolute norm p^f.

Detailed contract

Absolute norm p^f.

(self) -> int

noether::commalg::PrimeIdeal::norm · Direct Rust declaration

pub fn norm(&self) -> Integer
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/PrimeIdeal@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

commalg.PrimeIdeal.order

Coefficient order of this prime ideal.

Detailed contract

The coefficient order of this prime ideal.

(self) -> C

noether::commalg::PrimeIdeal::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, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/PrimeIdeal@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

commalg.PrimeIdeal.ramification_index

Ramification index over the rational prime.

(self) -> int

noether::commalg::PrimeIdeal::ramification_index · Direct Rust declaration

pub fn ramification_index(&self) -> usize
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/PrimeIdeal@1

Executable usage: validation/unit/numthy/test_acceptance_workload.py:59 · validation/unit/numthy/test_acceptance_workload.py:68 · validation/unit/numthy/test_acceptance_workload.py:69 · validation/unit/numthy/test_acceptance_workload.py:72 · validation/unit/numthy/test_number_field_facade.py:213 · validation/unit/numthy/test_number_field_facade.py:239

commalg.PrimeIdeal.rational_prime

Positive rational prime below this ideal.

Detailed contract

The positive rational prime below this ideal.

(self) -> int

noether::commalg::PrimeIdeal::rational_prime · Direct Rust declaration

pub fn rational_prime(&self) -> Integer
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/PrimeIdeal@1

Executable usage: validation/unit/numthy/test_acceptance_workload.py:70 · validation/unit/numthy/test_acceptance_workload.py:74 · validation/unit/numthy/test_number_field_facade.py:217 · validation/corpus/numthy/quadratic-field-arithmetic.py:31 · validation/corpus/numthy/quadratic-field-arithmetic.py:43 · validation/corpus/numthy/quadratic-field-arithmetic.py:52

commalg.PrimeIdeal.residue_degree

Residue-field degree over the rational prime field.

(self) -> int

noether::commalg::PrimeIdeal::residue_degree · Direct Rust declaration

pub fn residue_degree(&self) -> usize
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/PrimeIdeal@1

Executable usage: validation/unit/numthy/test_acceptance_workload.py:59 · validation/unit/numthy/test_acceptance_workload.py:68 · validation/unit/numthy/test_acceptance_workload.py:69 · validation/unit/numthy/test_acceptance_workload.py:72 · validation/unit/numthy/test_number_field_facade.py:213 · validation/unit/numthy/test_number_field_facade.py:234

commalg.PrimeIdeal.to_json

Canonical JSON representation.

Detailed contract

Serialize this checked prime ideal to canonical JSON.

(self) -> str

noether::commalg::PrimeIdeal::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, groebner-kernel, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/PrimeIdeal@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.PrimeIdeal.verify

Recheck primality and the ramification/residue witness.

(self) -> None

noether::commalg::PrimeIdeal::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, module-core, poly-core, resolution-kernel
GIL attached / bounded
Semantic ID noether/commalg/PrimeIdeal@1

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