assert (forall n, C (S n) = n + 2 * Ravg (map C (nats 0 (S n)))).
intros.
rewrite Ceq.
simpl pred...
assert (forall n, C n * n = n * pred n + 2 * Rsum (map C (nats 0 n))).
destruct n0.
simpl. field.
rewrite H.
unfold Ravg.
rewrite map_length, nats_length.
unfold Rdiv.
rewrite Rmult_plus_distr_r.
rewrite Rmult_assoc.
rewrite Rmult_assoc.
rewrite Rinv_l...
rewrite Rmult_1_r...
assert (forall n, C (S n) * S n = S n * n + 2 * C n - n * pred n + C n * n).
intros.
rewrite H0.
rewrite H0.
simpl pred.
rewrite nats_Sw'.
rewrite map_app.
rewrite Rsum_app.
simpl Rsum at 2.
rewrite Rplus_0_r.
rewrite plus_0_r.
field.
assert (forall n, C (S n) * S n = (2+n) * C n + 2 * n).
destruct n0.
simpl.
rewrite Ceq.
simpl.
rewrite Ravg_single.
rewrite Ceq.
field.
rewrite H1.
simpl pred.
repeat rewrite S_INR.
field.
destruct n.
simpl.
rewrite Ceq.
repeat rewrite Rmult_0_r.
unfold Rdiv.
rewrite Rmult_0_l...
simpl pred.
apply Rmult_eq_reg_l with (S n)...
rewrite Rmult_comm.
rewrite H2.
repeat rewrite S_INR.
field...
Qed. (* todo: get rid of ugly asserts *)

(* Specifications: *)
Lemma C_le_compat n m: le n m -> C n <= C m.
Proof with auto with real.