pow_mod_step
std.elementwise.pow_mod_step · Level L4One step of binary exponentiation modulo m: if k is odd, multiply the result by the base; square the base; halve k. Each product is reduced modulo m at once, so nothing grows past m². The body that pow_mod runs.
Signature
pow_mod_step(base: i64[n], k: i64[n], acc: i64[n], m: i64[n]) → i64[n], i64[n], i64[n]
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
acc*base % m if k odd; base*base % m; k // 2in exact rational arithmetic, on all 40 test cases. - All 501 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.
- 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
Identity
sha256:7cbec4d7f31ddd2ec29eb6f71631fff115dea36c870cb6250e2c1ffb94152710The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.
Control handle
- Symbol
- Ω:std.elementwise.pow_mod_step · Ω:pow_mod_step
- Pins
sha256:818507ea7b4f3632fc2aa1fa9c113c476db79f6fea9a84ce14666d927b67f624this graph alone- Evidence
sha256:4cbb40a37aa76e4acac9da89ae68dee0dd17e1fb8c53d57471d76451df44be36the 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.