What is a strategy ?

A strategy is some function which maps every natural integer n (n > 4) to a natural integer p (1 < p < n).

Strategies are used as follows: If you want to compute x^n, ( n > 4), then some strategy will give you some p (1 < p < n); then if you express n as qp+r (by euclidean division), then 0 < q < n, and r < n.

The computation schemes for computing p-th, q-th, and r-th powers, using the equality x^n=(x^p)^q . x^r are obtained by a well-founded recursion (see generation.v ).

In this development, we consider only deterministic strategies, whereas in the joined paper we consider non-deterministic strategies (to each n we can associate a set of integer naturals)

In the module binary_strat, we show that integer division by 2 is a strategy, and in the module dicho_strat, we present the "dichotomic" strategy which gave us the best results.

About the implementation in Coq

We choosed to define strategies as a inductive Set.
Inductive strategy:Set :=
 mkstrat:((n:nat)(lt four n)->
          {p:nat| (lt p n)/\ (le two p)})->
         strategy.
So, the standard way to define a strategy is to type the sequence:
Lemma my_strat:strategy.
Proof.
Realizer [n:nat]<some term of type nat>.
Program_all.

... (logical goals solving ...)

Qed.

In Caml-Light ...

A strategy is represented simply as a function from int to int:
#load "Demo.ml"
##open "Demo";;

#binary;;
- : int -> int = <fun>

#binary 87;;
- : int = 43

#dicho;;
- : (int -> (int, sumbool) sigS) -> int -> int = <fun>

#dicho log2_impl;;
- : int -> int = <fun>

#dicho log2_impl 87;;
- : int = 10