Skip to content

commalg · WeilDivisor

19 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.WeilDivisor

A Weil divisor with arbitrary-precision integral coefficients.

WeilDivisor(curve: Curve[C], terms: Iterable[tuple[CurveClosedPoint[C], int]])

noether::commalg::WeilDivisor · Direct Rust declaration

pub struct WeilDivisor<R: Field> { /* 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/WeilDivisor@1

Executable usage: examples/26_elliptic_descent_functions.py:21 · examples/26_elliptic_descent_functions.py:6 · validation/unit/commalg/test_curve_facade.py:114 · validation/unit/commalg/test_curve_facade.py:125 · validation/unit/commalg/test_curve_facade.py:142 · validation/unit/commalg/test_curve_facade.py:16

commalg.WeilDivisor.__add__

Add another compatible value to this value.

Detailed contract

Returns the argument unchanged.

(self, other: WeilDivisor[C]) -> WeilDivisor[C]

noether::commalg::WeilDivisor::add · Direct Rust declaration

fn add(self, rhs: &WeilDivisor<R>) -> Self::Output
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/WeilDivisor@1

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

commalg.WeilDivisor.__mul__

Multiply this value by another compatible value.

(self, scalar: int) -> WeilDivisor[C]

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

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

commalg.WeilDivisor.__neg__

Return the additive inverse of this value.

(self) -> WeilDivisor[C]

noether::commalg::WeilDivisor::neg · Direct Rust declaration

fn neg(self) -> Self::Output
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/WeilDivisor@1

commalg.WeilDivisor.__rmul__

Multiply this value by a compatible value on its left.

(self, scalar: int) -> WeilDivisor[C]

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

commalg.WeilDivisor.__sub__

Subtract another compatible value from this value.

(self, other: WeilDivisor[C]) -> WeilDivisor[C]

noether::commalg::WeilDivisor::sub · Direct Rust declaration

fn sub(self, rhs: &WeilDivisor<R>) -> Self::Output
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/WeilDivisor@1

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

commalg.WeilDivisor.coefficient

Compute coefficient for this WeilDivisor.

Detailed contract

Coefficient of one closed point.

(self, point: CurveClosedPoint[C]) -> int

noether::commalg::WeilDivisor::coefficient · Direct Rust declaration

pub fn coefficient( &self, point: &CurveClosedPoint<R>, ) -> Result<Integer, CurveError>
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/WeilDivisor@1

Executable usage: examples/17_weighted_power_series.py:19 · examples/22_matroids_and_tutte.py:11 · examples/22_matroids_and_tutte.py:12 · examples/22_matroids_and_tutte.py:13 · examples/33_simplicial_cohomology_operations.py:31 · validation/unit/combin/test_acceptance_workload.py:45

commalg.WeilDivisor.curve

Return the curve recorded by this WeilDivisor.

Detailed contract

Owning curve.

(self) -> Curve[C]

noether::commalg::WeilDivisor::curve · Direct Rust declaration

pub fn curve(&self) -> &Curve<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/WeilDivisor@1

Executable usage: examples/26_elliptic_descent_functions.py:13 · examples/26_elliptic_descent_functions.py:17 · examples/26_elliptic_descent_functions.py:20 · examples/26_elliptic_descent_functions.py:22 · examples/26_elliptic_descent_functions.py:24 · examples/37_complete_intersection_theory.py:27

commalg.WeilDivisor.degree

Return the degree recorded by this WeilDivisor.

Detailed contract

Exact divisor degree sum n_P [k(P):K].

(self) -> int

noether::commalg::WeilDivisor::degree · Direct Rust declaration

pub fn degree(&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/WeilDivisor@1

Executable usage: examples/14_weighted_polynomials.py:16 · examples/14_weighted_polynomials.py:18 · examples/15_groebner_twisted_cubic.py:15 · examples/15_groebner_twisted_cubic.py:28 · examples/31_local_fields_and_precision.py:37 · examples/33_simplicial_cohomology_operations.py:26

commalg.WeilDivisor.from_json

Deserialize and revalidate a WeilDivisor from typed JSON.

Detailed contract

Restore every place, combine support, and reject noncanonical input.

(cls, value: str) -> WeilDivisor[CurveBase]

noether::commalg::WeilDivisor::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/WeilDivisor@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.WeilDivisor.negative_part

Compute negative part for this WeilDivisor.

Detailed contract

Effective negative part, with positive coefficients, so D=D+ - D-.

(self) -> WeilDivisor[C]

noether::commalg::WeilDivisor::negative_part · Direct Rust declaration

pub fn negative_part(&self) -> Self
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/WeilDivisor@1

Executable usage: validation/unit/commalg/test_curve_facade.py:61

commalg.WeilDivisor.positive_part

Compute positive part for this WeilDivisor.

Detailed contract

Effective positive part.

(self) -> WeilDivisor[C]

noether::commalg::WeilDivisor::positive_part · Direct Rust declaration

pub fn positive_part(&self) -> Self
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/WeilDivisor@1

Executable usage: validation/unit/commalg/test_curve_facade.py:61

commalg.WeilDivisor.pullback

Compute pullback for this WeilDivisor.

Detailed contract

Scheme-theoretic pullback along a finite checked curve morphism over Q. Scheme-theoretic pullback along a finite checked curve morphism over a finite field.

(self, morphism: CurveMorphism[C]) -> WeilDivisor[C]

noether::commalg::WeilDivisor::pullback · Direct Rust declaration

pub fn pullback( &self, morphism: &CurveMorphism<RationalField>, ) -> Result<Self, CurveError>
pub fn pullback( &self, morphism: &CurveMorphism<FiniteField>, ) -> Result<Self, CurveError>
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/WeilDivisor@1

Executable usage: validation/unit/commalg/test_curve_facade.py:69

commalg.WeilDivisor.riemann_roch_space

Compute riemann roch space for this WeilDivisor.

Detailed contract

Compute the exact Riemann–Roch space L(D) on this smooth plane curve.

(self) -> RiemannRochSpace[C]

noether::commalg::WeilDivisor::riemann_roch_space · Direct Rust declaration

pub fn riemann_roch_space(&self) -> Result<RiemannRochSpace<R>, CurveError>
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/WeilDivisor@1

Executable usage: examples/26_elliptic_descent_functions.py:28 · validation/unit/commalg/test_curve_facade.py:116 · validation/unit/commalg/test_curve_facade.py:73 · validation/unit/numthy/test_elliptic_curve_facade.py:80

commalg.WeilDivisor.scale

Compute scale for this WeilDivisor.

Detailed contract

Scale every coefficient by an arbitrary-precision integer.

(self, scalar: int) -> WeilDivisor[C]

noether::commalg::WeilDivisor::scale · Direct Rust declaration

pub fn scale(&self, scalar: &Integer) -> Self
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/WeilDivisor@1

Executable usage: validation/unit/infra/test_mpi_scale_report.py:13 · validation/bench/macaulay2_normalization.py:332 · validation/bench/macaulay2_normalization.py:333 · validation/bench/macaulay2_normalization.py:337 · validation/bench/macaulay2_normalization.py:339

commalg.WeilDivisor.support

Return the support recorded by this WeilDivisor.

Detailed contract

Closed support in deterministic order.

(self) -> list[CurveClosedPoint[C]]

noether::commalg::WeilDivisor::support · Direct Rust declaration

pub fn support(&self) -> impl Iterator<Item = &CurveClosedPoint<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/WeilDivisor@1

Executable usage: validation/unit/commalg/test_monomial_ideal_facade.py:30 · validation/unit/commalg/test_polynomial_ideal_facade.py:316 · validation/unit/commalg/test_polynomial_ideal_facade.py:317 · validation/unit/commalg/test_polynomial_ideal_facade.py:318 · validation/unit/commalg/test_polynomial_ideal_facade.py:319 · validation/unit/commalg/test_polynomial_ideal_facade.py:320

commalg.WeilDivisor.terms

Return the terms recorded by this WeilDivisor.

Detailed contract

Deterministically ordered nonzero point coefficients.

(self) -> list[tuple[CurveClosedPoint[C], int]]

noether::commalg::WeilDivisor::terms · Direct Rust declaration

pub fn terms(&self) -> &[(CurveClosedPoint<R>, 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/WeilDivisor@1

Executable usage: examples/07_integer_factorization.py:14 · examples/40_exterior_algebra.py:43 · validation/unit/combin/test_acceptance_workload.py:45 · validation/unit/combin/test_acceptance_workload.py:81 · validation/unit/combinatorics/test_boundary.py:31 · validation/unit/combinatorics/test_boundary.py:44

commalg.WeilDivisor.to_json

Serialize this WeilDivisor to its canonical typed JSON representation.

Detailed contract

Serialize this canonically ordered finite divisor.

(self) -> str

noether::commalg::WeilDivisor::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/WeilDivisor@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.WeilDivisor.verify

Replay and verify the mathematical evidence carried by this WeilDivisor.

Detailed contract

Recheck every point, coefficient normalization, ordering, and degree data.

(self) -> None

noether::commalg::WeilDivisor::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/WeilDivisor@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