crt_step
std.elementwise.crt_step · Level L4Fold one congruence x ≡ rᵢ (mod mᵢ) into a solution x modulo M: x + M·t, with t = (rᵢ − x)·M⁻¹ mod mᵢ, and the modulus becomes M·mᵢ. The inverse comes from bezout. The body crt scans.
x′ = x + M·((rᵢ − x)·M⁻¹ mod mᵢ), M′ = M·mᵢ
Signature
crt_step(x: i64[], M: i64[], ri: i64[], mi: i64[]) → i64[], i64[]
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size.
- Equal to the reference
u = M^-1 mod mi by extended Euclid; x + M*((ri - x)*u % mi), M*miin exact rational arithmetic, on all 40 test cases. - All 80 int64 results are exact: the error is zero.
- Interpreter and NumPy backend return bit-identical results.
- At float32 too: the 40 test cases rounded to float32, and 40 of them exact, with zero error.
Accuracy in detail
- correctly rounded (the int64 nearest the exact value)
- 100%
- bit-equal to the NumPy formula in int64
- 100%
- largest error, in units in the last place
- 0
Control handle
- Symbol
- Ω:std.elementwise.crt_step · Ω:crt_step
- Pins
sha256:7f139c1ecb0e92bb295be87ccec14caffe354a9c7487fe3dcbe2c97ab0e934d0this graph and the 3 it reaches through calls- Evidence
sha256:ab9e58e364fb78969d4f429a7aacfe2b3387169822a7a8893b3c54de898d6a09the hash of its verification record- Needs
- no capability: a pure function
Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.