Skip to content

numthy · QadicElement

20 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.QadicElement

A fixed-cap q-adic value carrying its concrete ring or field context.

class QadicElement

noether::numthy::QadicElement · Direct Rust declaration

pub struct QadicElement { /* 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/QadicElement@1

Executable usage: validation/unit/commalg/test_context_tower_workload.py:25 · validation/unit/commalg/test_context_tower_workload.py:76 · validation/unit/commalg/test_context_tower_workload.py:77 · validation/unit/infra/test_discovery.py:41 · validation/unit/infra/test_public_api_index.py:118 · validation/unit/numthy/test_qadic_field_facade.py:13

numthy.QadicElement.__add__

Add another compatible value to this value.

Detailed contract

Returns the argument unchanged.

(self, other: QadicElement) -> QadicElement

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

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

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

numthy.QadicElement.__mul__

Multiply this value by another compatible value.

(self, other: QadicElement) -> QadicElement

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

fn mul(self, rhs: &QadicElement) -> 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/QadicElement@1

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

numthy.QadicElement.__neg__

Return the additive inverse of this value.

(self) -> QadicElement

noether::numthy::QadicElement::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
GIL attached / bounded
Semantic ID noether/numthy/QadicElement@1

numthy.QadicElement.__pow__

Raise this value to the supplied power.

(self, exponent: int, modulus: None=None) -> QadicElement

noether::numthy::QadicElement · 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/numthy/QadicElement@1

numthy.QadicElement.__sub__

Subtract another compatible value from this value.

(self, other: QadicElement) -> QadicElement

noether::numthy::QadicElement::sub · Direct Rust declaration

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

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

numthy.QadicElement.coefficients

Return the coefficients recorded by this QadicElement.

Detailed contract

Power-basis coefficients in Z_p or Q_p, matching the concrete parent context.

(self) -> list[PadicElement]

noether::numthy::QadicElement::coefficients · Direct Rust declaration

pub fn coefficients(&self) -> Vec<PadicElement>
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/QadicElement@1

Executable usage: examples/26_elliptic_descent_functions.py:11 · examples/26_elliptic_descent_functions.py:12 · examples/26_elliptic_descent_functions.py:14 · examples/26_elliptic_descent_functions.py:35 · examples/31_local_fields_and_precision.py:11 · examples/31_local_fields_and_precision.py:12

numthy.QadicElement.field

Return the field recorded by this QadicElement.

Detailed contract

Concrete unramified field containing this value, or None for a QadicRing element.

(self) -> QadicField | None

noether::numthy::QadicElement::field · Direct Rust declaration

pub fn field(&self) -> Option<&QadicField>
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/QadicElement@1

Executable usage: examples/08_finite_field_extensions.py:10 · examples/08_finite_field_extensions.py:11 · examples/08_finite_field_extensions.py:12 · examples/08_finite_field_extensions.py:13 · examples/08_finite_field_extensions.py:14 · examples/08_finite_field_extensions.py:3

numthy.QadicElement.frobenius

Compute frobenius for this QadicElement.

Detailed contract

Apply the lifted residue-field Frobenius automorphism.

(self, exponent: int) -> QadicElement

noether::numthy::QadicElement::frobenius · Direct Rust declaration

pub fn frobenius(&self, exponent: u64) -> 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/numthy/QadicElement@1

Executable usage: examples/31_local_fields_and_precision.py:23 · examples/31_local_fields_and_precision.py:24 · examples/31_local_fields_and_precision.py:27 · examples/31_local_fields_and_precision.py:38 · validation/unit/commalg/test_acceptance_workload.py:39 · validation/unit/commalg/test_context_tower_workload.py:115

numthy.QadicElement.from_json

Deserialize and revalidate a q-adic value and its parent context.

Detailed contract

Deserialize and revalidate a q-adic value and its complete parent context.

(cls, value: str) -> QadicElement

noether::numthy::QadicElement::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/QadicElement@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.QadicElement.inverse

Compute inverse for this QadicElement.

Detailed contract

Multiplicative inverse in the concrete parent context.

(self) -> QadicElement

noether::numthy::QadicElement::inverse · Direct Rust declaration

pub fn inverse(&self) -> Result<Self, UnitError>
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/QadicElement@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

numthy.QadicElement.is_unit

Test whether this QadicElement is unit.

Detailed contract

Whether this value is invertible in its concrete parent context.

(self) -> bool

noether::numthy::QadicElement::is_unit · Direct Rust declaration

pub fn is_unit(&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/QadicElement@1

Executable usage: validation/unit/commalg/test_local_algebra.py:44 · validation/unit/commalg/test_local_algebra.py:59 · validation/unit/commalg/test_prime_localization.py:25 · validation/unit/commalg/test_prime_localization.py:26 · validation/unit/commalg/test_prime_localization.py:47 · validation/unit/commalg/test_quotient_facade.py:51

numthy.QadicElement.known_absolute_precision

Return the known absolute precision recorded by this QadicElement.

Detailed contract

Known absolute precision, equal to the immutable context cap.

(self) -> int

noether::numthy::QadicElement::known_absolute_precision · Direct Rust declaration

pub fn known_absolute_precision(&self) -> u64
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/QadicElement@1

Executable usage: validation/unit/numthy/test_acceptance_workload.py:106 · validation/unit/numthy/test_padic_local_field_facade.py:67 · validation/unit/numthy/test_padic_local_field_facade.py:96 · validation/unit/numthy/test_padic_ring_facade.py:68 · validation/unit/numthy/test_qadic_ring_facade.py:55 · validation/corpus/numthy/padic-newton-cube-root.py:23

numthy.QadicElement.norm

Compute norm for this QadicElement.

Detailed contract

Norm to the coefficient p-adic ring or field.

(self) -> PadicElement

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

pub fn norm(&self) -> PadicElement
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/QadicElement@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.QadicElement.pow

Compute pow for this QadicElement.

Detailed contract

Raise this value to a nonnegative word-sized power.

(self, exponent: int) -> QadicElement

noether::numthy::QadicElement::pow · Direct Rust declaration

pub fn pow(&self, exponent: u64) -> 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/numthy/QadicElement@1

Executable usage: examples/17_weighted_power_series.py:18 · validation/unit/commalg/test_polynomial_ideal_facade.py:368 · validation/unit/commalg/test_polynomial_ideal_facade.py:369 · validation/unit/commalg/test_polynomial_ideal_facade.py:370 · validation/unit/commalg/test_polynomial_ideal_facade.py:373 · validation/unit/commalg/test_polynomial_ideal_facade.py:381

numthy.QadicElement.residue

Compute residue for this QadicElement.

Detailed contract

Residue in the explicit finite residue field, or None when this value has negative valuation.

(self) -> FiniteFieldElement

noether::numthy::QadicElement::residue · Direct Rust declaration

pub fn residue(&self) -> Option<FiniteFieldElement>
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/QadicElement@1

Executable usage: examples/11_qadic_witt_vectors.py:11 · examples/11_qadic_witt_vectors.py:12 · examples/11_qadic_witt_vectors.py:13 · examples/11_qadic_witt_vectors.py:15 · examples/13_chinese_remainder_theorem.py:3 · examples/31_local_fields_and_precision.py:10

numthy.QadicElement.ring

Return the ring recorded by this QadicElement.

Detailed contract

Concrete Witt-ring context containing this value, or None for a QadicField element.

(self) -> QadicRing | None

noether::numthy::QadicElement::ring · Direct Rust declaration

pub fn ring(&self) -> Option<&QadicRing>
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/QadicElement@1

Executable usage: examples/11_qadic_witt_vectors.py:3 · examples/13_chinese_remainder_theorem.py:10 · examples/13_chinese_remainder_theorem.py:12 · examples/13_chinese_remainder_theorem.py:9 · examples/14_weighted_polynomials.py:10 · examples/14_weighted_polynomials.py:11

numthy.QadicElement.to_json

Serialize the complete parent and canonical power-basis coordinates.

Detailed contract

Serialize the concrete parent and canonical power-basis coordinates.

(self) -> str

noether::numthy::QadicElement::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/QadicElement@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.QadicElement.trace

Compute trace for this QadicElement.

Detailed contract

Trace to the coefficient p-adic ring or field.

(self) -> PadicElement

noether::numthy::QadicElement::trace · Direct Rust declaration

pub fn trace(&self) -> PadicElement
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/QadicElement@1

Executable usage: examples/08_finite_field_extensions.py:12 · examples/08_finite_field_extensions.py:14 · examples/08_finite_field_extensions.py:3 · validation/unit/commalg/test_acceptance_workload.py:41 · validation/unit/commalg/test_context_tower_workload.py:116 · validation/unit/commalg/test_context_tower_workload.py:96

numthy.QadicElement.valuation

Compute valuation for this QadicElement.

Detailed contract

Precision-aware p-adic valuation.

(self) -> PadicValuation

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

pub fn valuation(&self) -> PadicValuation
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/QadicElement@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