induction n; intuition; simpl in *.
omega.
inversion H0; clear H0; subst.
inversion H1; clear H1; subst.
destruct n; simpl in *.
inversion H11; clear H11; subst.
inversion H12; clear H12; subst.
eapply ratSubtract_eqRat_compat.
rewrite H15.
rewrite H1.
rewrite <- ratAdd_0_r.
eauto.
rewrite H17.
rewrite H0.
rewrite <- ratAdd_0_r.
eauto.
rewrite H15.
rewrite H17.
inversion H11; clear H11; subst.
inversion H12; clear H12; subst.
assert (ratSubtract r1 r0 == ratSubtract x1 r5).
eapply IHn.
omega.
econstructor.
eapply H11.
eapply H18.
trivial.
econstructor.
eapply H10.
eapply H16.
trivial.
trivial.
trivial.
trivial.
trivial.
trivial.
trivial.
trivial.
trivial.
assert (r3 <= r2).
eauto.
assert (r0 <= r1).
rewrite H19.
eapply leRat_trans.
2:{
eapply eqRat_impl_leRat.
symmetry.
eapply H21.
}
eapply ratAdd_leRat_compat.
eauto.
eapply series_le.
eauto.
eauto.
trivial.
rewrite ratSubtract_ratAdd_distr.
rewrite ratAdd_comm.
rewrite ratSubtract_ratAdd_assoc.
rewrite ratAdd_comm.
rewrite ratSubtract_ratAdd_assoc.
rewrite H0.
assert (r2 == r5).
eauto.
rewrite H20.
assert (x2 == r3).
eauto.
rewrite <- H22.
assert (x2 <= r5).
eauto.
assert (r5 <= x1).
eapply leRat_trans.
eapply H5.
eapply H18.
trivial.
eapply H6.
2:{
eauto.
}
2:{
eauto.
}
omega.
symmetry.
eapply ratSubtract_partition.
trivial.
trivial.
trivial.
trivial.
Qed.

(* Specifications: *)
Lemma sum_power_series : forall n (f : Rat -> Prop) a a',
n > 0 ->
(exists v, f v) ->
(forall v1 v2, f v1 -> f v2 -> v1 == v2) ->
(forall v, f v -> ~1 <= v) ->
sumList_rel (fun i : nat => expRat_rel f i) (getNats 0 n) a ->
ratMult_rel (ratSubtract_rel (eqRat 1) (expRat_rel f n))
(ratInverse_rel (ratSubtract_rel (eqRat 1) f)) a' ->
a == a'.