(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
(* ---                           develop.v                              --- *)
(*                                                                          *)
(* Author: Pierre Casteran.                                                 *)
(*    LABRI, URA CNRS 1304,                                                 *)
(*    Departement d'Informatique, Universite Bordeaux I,                    *)
(*    33405 Talence CEDEX,                                                  *)
(*    e-mail:  casteran@labri.u-bordeaux.fr                                 *)
(*  This file contains some important lemmas used in the "generation" module. It tells how to compose abstract machine code (with append) to build code for Call_M, Call_C and Call_K calls (see the module "spec") *)
(******************************)
(* A sequence for computing the (2^q)-th power of some m in M; this is a sequence of q SQRs  *)
(**********************************************)
(* code generation  for (Call_M p) from the code for (Call_C p q) (it's the same!) *)
(****************************************)
(***********************************************)
(* code generation for  (Call_C qp+r p) from cpr (code for (Call_K p r)) and cq (code for (Call_M q)) (it's cpr, followed by cq then a MUL statement                       *)

Lemma KMC :
forall p q r : nat,
gencode (Call_K p r) -> gencode (Call_M q) -> gencode (Call_C (q * p + r) p).