Skip to content

numthy · PadicElement

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

Worked example

The complete checked program Calculate trace and norm in a concrete quadratic finite field uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Calculate trace and norm in a concrete quadratic finite field."""

from noether.numthy import FiniteField


def main() -> None:
    field = FiniteField.extension(5, 2)
    generator = field.generator()
    assert generator**2 + field(4) * generator + field(2) == field.zero()
    assert generator.trace() == field(1)
    assert generator.norm() == field(2)
    print(f"{field}: Tr(a)={generator.trace()}, Nm(a)={generator.norm()}")


if __name__ == "__main__":
    main()

Run it with .venv/bin/python examples/08_finite_field_extensions.py.

numthy.PadicElement

A p-adic integer carrying its fixed (p, N) context.

class PadicElement

noether::numthy::PadicElement · Direct Rust declaration

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

Executable usage: validation/unit/commalg/test_context_tower_workload.py:22 · validation/unit/commalg/test_context_tower_workload.py:74 · validation/unit/commalg/test_context_tower_workload.py:75 · validation/unit/infra/test_discovery.py:37 · validation/unit/infra/test_public_api_index.py:114 · validation/unit/numthy/test_padic_field_facade.py:12

numthy.PadicElement.__add__

Add another compatible value to this value.

Detailed contract

Returns the argument unchanged.

(self, other: PadicElement) -> PadicElement

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

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

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

numthy.PadicElement.__int__

Compute int for this PadicElement.

(self) -> int

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

numthy.PadicElement.__mul__

Multiply this value by another compatible value.

(self, other: PadicElement) -> PadicElement

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

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

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

numthy.PadicElement.__neg__

Return the additive inverse of this value.

(self) -> PadicElement

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

numthy.PadicElement.__pow__

Raise this value to the supplied power.

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

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

numthy.PadicElement.__sub__

Subtract another compatible value from this value.

(self, other: PadicElement) -> PadicElement

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

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

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

numthy.PadicElement.field

Return the field recorded by this PadicElement.

Detailed contract

Concrete fixed-cap p-adic field containing this value, when it is a field element rather than an integral-ring element.

(self) -> PadicField | None

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

pub fn field(&self) -> Option<&PadicField>
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/PadicElement@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.PadicElement.from_json

Deserialize and revalidate a p-adic value and its fixed-precision parent.

(cls, value: str) -> PadicElement

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

Compute inverse for this PadicElement.

Detailed contract

Multiplicative inverse in the concrete parent context.

(self) -> PadicElement

noether::numthy::PadicElement::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/PadicElement@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.PadicElement.is_unit

Test whether this PadicElement is unit.

Detailed contract

Whether this value is invertible in its concrete parent context.

(self) -> bool

noether::numthy::PadicElement::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/PadicElement@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.PadicElement.known_absolute_precision

Return the known absolute precision recorded by this PadicElement.

Detailed contract

Known absolute precision, equal to the immutable context cap.

(self) -> int

noether::numthy::PadicElement::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/PadicElement@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.PadicElement.pow

Compute pow for this PadicElement.

Detailed contract

Raise this value to a nonnegative word-sized power.

(self, exponent: int) -> PadicElement

noether::numthy::PadicElement::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/PadicElement@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.PadicElement.representative

Return the representative recorded by this PadicElement.

Detailed contract

Canonical representative in [0, p^N).

(self) -> int | None

noether::numthy::PadicElement::representative · Direct Rust declaration

pub fn representative(&self) -> Option<Integer>
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/PadicElement@1

Executable usage: validation/unit/commalg/test_residue_ring_facade.py:101 · validation/unit/commalg/test_residue_ring_facade.py:110 · validation/unit/commalg/test_residue_ring_facade.py:129 · validation/unit/commalg/test_residue_ring_facade.py:26 · validation/unit/commalg/test_residue_ring_facade.py:80 · validation/unit/groups/test_acceptance_workload.py:125

numthy.PadicElement.residue

Compute residue for this PadicElement.

Detailed contract

Residue in F_p, or None when the value has negative valuation.

(self) -> FiniteFieldElement

noether::numthy::PadicElement::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/PadicElement@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.PadicElement.ring

Return the ring recorded by this PadicElement.

Detailed contract

Concrete fixed-cap p-adic ring containing this value, or None when the value belongs to a PadicField.

(self) -> PadicRing | None

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

pub fn ring(&self) -> Option<&PadicRing>
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/PadicElement@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.PadicElement.to_json

Serialize the concrete parent and canonical FLINT coordinates as typed JSON.

(self) -> str

noether::numthy::PadicElement::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/PadicElement@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.PadicElement.valuation

Compute valuation for this PadicElement.

Detailed contract

Precision-aware p-adic valuation.

(self) -> PadicValuation

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