(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
Local Open Scope R_scope.
Definition A1 (x:R) (N:nat) : R :=
sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k)) * x ^ (2 * k)) N.
Definition B1 (x:R) (N:nat) : R :=
sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k + 1)) * x ^ (2 * k + 1))
N.
Definition C1 (x y:R) (N:nat) : R :=
sum_f_R0 (fun k:nat => (-1) ^ k / INR (fact (2 * k)) * (x + y) ^ (2 * k)) N.
Definition Reste1 (x y:R) (N:nat) : R :=
sum_f_R0
(fun k:nat =>
sum_f_R0
(fun l:nat =>
(-1) ^ S (l + k) / INR (fact (2 * S (l + k))) *
x ^ (2 * S (l + k)) * ((-1) ^ (N - l) / INR (fact (2 * (N - l)))) *
y ^ (2 * (N - l))) (pred (N - k))) (pred N).
Definition Reste2 (x y:R) (N:nat) : R :=
sum_f_R0
(fun k:nat =>
sum_f_R0
(fun l:nat =>
(-1) ^ S (l + k) / INR (fact (2 * S (l + k) + 1)) *
x ^ (2 * S (l + k) + 1) *
((-1) ^ (N - l) / INR (fact (2 * (N - l) + 1))) *
y ^ (2 * (N - l) + 1)) (pred (N - k))) (
pred N).
Definition Reste (x y:R) (N:nat) : R := Reste2 x y N - Reste1 x y (S N).

Lemma pow_sqr : forall (x:R) (i:nat), x ^ (2 * i) = (x * x) ^ i.