method of repeated squaring
Theorem 1.
Given a semigroup and an then the function defined by has an SLP representations ofcomputational length . Inparticular, if we can compute using only multiplications.
Proof.
Let be the map and be defined by . So far werecognize that evaluates to and evaluates to . But we caution thatwe do not define these functions with exponents because we wantto demonstrate that from an algorithm to multiply we can createan efficient algorithm to exponentiate.
For define (recalling that may use the outputof any previous evaluation)
Evidently, evaluates to . By induction, evaluates to and thus evaluates to. Therefore we establish that for all nonnegative integers . Furthermore, to evaluate uses multiplications.
Now write in binary: with for . Let bethe indices for which , . Then define
Thus, evaluates to:
Because each uses the output of , the cost ofevaluating is the cost of evaluating plus the finalcost of multiplying . Thus, evaluating uses multiplications. As it follows thatevaluating uses no more than multiplications.∎