Commit 2024-10-15 22:29 341d9cfc

View on Github →

feat: use @[csimp] to use exponentiation by repeated squaring at runtime (#8885) Using a @[csimp] attribute we can replace npowRec at runtime with an algorithm that uses repeated squaring, without affecting the definitional properties of npowRec. The prototypical application is that

#eval (3 : ZMod 49999)^49998

used to stack overflow, but now runs fine. (This is an output of the "Formalization and Computer Algebra Systems" group at https://aimath.org/workshops/upcoming/cyberinfrastructure/.)

Estimated changes

added theorem npowBinRec.go_spec
added def npowBinRec
added def npowRec'
added theorem npowRec'_mul_comm
added theorem npowRec'_succ
added theorem npowRec'_two_mul
added theorem npowRec_eq
added theorem npowRec_eq_npowBinRec
added def nsmulBinRec
added def nsmulRec'
added def k
added def p