math-nt-arithmetic
The groupant beside math/src/nt.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | approximant |
| ast | partial | ../syntax.json |
| descriptant | present | descriptant |
| invariant | partial | invariant |
| tests | executed bounded checks | tests |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
multiplicative_formula | multiplicative_formula | partial source derived model | multiplicative_formula |
divisor_materialization | divisor_materialization | partial source derived model | divisor_materialization |
prime_search | prime_search | partial source derived model | prime_search |
zero_digits | zero_digits | partial source derived model | zero_digits |
wave39-canonical_sign_fiber | canonical_digit_sign_preimage | partial source derived model | ../model.md |
wave39-positional_carry_kernel | fixed_length_integer_kernel | partial source derived model | ../model.md |
wave39-base_admission_partition | typed_base_admission_partition | partial source derived model | ../model.md |
wave39-magnitude_normalizer | idempotent_magnitude_retraction | partial source derived model | ../model.md |
Model text
descriptant
math-nt-arithmetic
phi/tau/sigma/mobius require positive complete-factor inputs; divisors accepts signs, rejects zero and checks count before sorted materialization. Prime count/rank sieve is capped, next_prime unbounded. digits strips sign; from_digits accepts arbitrary Horner coefficients. Canonical restrictions are needed for inversion.
Epoch 2026-10-31: complete source read, parent AST reused; partial finite evidence only.
Wave39 reviews integer digit/Horner transport and its own typed model sections. Finite checks, dependent formula derivations and algebraic claims retain separate scopes; no production speed or universal source proof is inferred.
approximant
Scoped forward and cost
phi/tau/sigma/mobius require positive complete-factor inputs; divisors accepts signs, rejects zero and checks count before sorted materialization. Prime count/rank sieve is capped, next_prime unbounded. digits strips sign; from_digits accepts arbitrary Horner coefficients. Canonical restrictions are needed for inversion.
No executable percent surrogate claimed.
invariant
Scoped invariant
phi/tau/sigma/mobius require positive complete-factor inputs; divisors accepts signs, rejects zero and checks count before sorted materialization. Prime count/rank sieve is capped, next_prime unbounded. digits strips sign; from_digits accepts arbitrary Horner coefficients. Canonical restrictions are needed for inversion.
Source range[17881,22233) bound by manifest digest. Parent domain applies, not arbitrary public states.
models
Source-scoped typed relations
behavior_complement
phi/tau/sigma/mobius reject nonpositive n; divisors first takes magnitude and rejects zero but accepts negative values. digits base<2 rejects, from_digits imposes no such gate.
reverse_reconstruction
digits(n,b) loses sign: n and -n share output. Canonical digits and known base recover abs(n); from_digits with arbitrary coefficients admits carrying transformations and leading zeros.
multiplicative_formula
Given complete factors, phi=product p^(e-1)(p-1), tau=product(e+1), sigma_k=product sum(j=0..e)p^(kj), mobius=0 if repeated factor else(-1)^count.
divisor_materialization
Count product(e+1) in u128 is checked against max before allocation, then products are enumerated and sorted. Count arithmetic itself is unchecked; complete probable factors remain accepted.
prime_search
prime_pi caps n at2e8; nth_prime k in1..1e7 chooses analytic sieve bound and indexes k-1. next_prime/prev_prime step one integer at a time and accept prime-like values, with no iteration cap.
zero_digits
digits0=[0], including nondecimal base; from_digits([],b)=0 for any b. Decimal path converts magnitude text, others repeatedly divide and reverse remainders.
tests
Evidence
See ../tests.md for actual checks and source mutant; this fragment adds no runtime test.
phi/tau/sigma/mobius require positive complete-factor inputs; divisors accepts signs, rejects zero and checks count before sorted materialization. Prime count/rank sieve is capped, next_prime unbounded. digits strips sign; from_digits accepts arbitrary Horner coefficients. Canonical restrictions are needed for inversion.
This page in Markdown โ https://md.groupants.elamur.ai/free/en/mova/math/src/nt.rs.groupant/arithmetic.groupant/