(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2019       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \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 ConstructiveReals.
(** Definition and properties of finite sums and powers.  WARNING: this file is experimental and likely to change in future releases. *)
Fixpoint CRsum {R : ConstructiveReals}
(f:nat -> CRcarrier R) (N:nat) : CRcarrier R :=
match N with
| O => f 0%nat
| S i => CRsum f i + f (S i)
end.

(* Specifications: *)
Lemma CRsum_eq :
forall {R : ConstructiveReals} (An Bn:nat -> CRcarrier R) (N:nat),
(forall i:nat, (i <= N)%nat -> An i == Bn i) ->
CRsum An N == CRsum Bn N.
Lemma sum_eq_R0 : forall {R : ConstructiveReals} (un : nat -> CRcarrier R) (n : nat),
(forall k:nat, un k == 0)
-> CRsum un n == 0.