intuition.
destruct H0.
assert (sumList_rel (fun i => ratMult_rel f (expRat_rel f i)) (getNats O n) (x * a)).
eapply ratMult_sumList_rel_distrib.
eapply H3.
unfold expRat_rel.
intuition.
rewrite H5; eauto.
rewrite H6; eauto.
intuition.
trivial.
trivial.
assert (ratSubtract a (x * a) == ratSubtract 1 (expRat x n)).
eapply ratSubtract_series_map; eauto.
intuition.
unfold expRat_rel, ratMult_rel in *.
simpl in *.
rewrite H6; eauto.
rewrite H7; eauto.
eapply eqRat_refl.
intuition.
eapply expRat_eqRat_compat; eauto.
unfold expRat_rel.
intuition.
simpl.
intuition.
unfold ratMult_rel, expRat_rel; intuition.
rewrite H7; eauto.
destruct n; try omega.
simpl.
eauto using ratMult_eqRat_compat, expRat_eqRat_compat.
unfold ratMult_rel, expRat_rel.
intuition.
rewrite H6; eauto.
rewrite H7; eauto.
eapply eqRat_refl.
intuition.
eapply expRat_eqRat_compat; eauto.
intuition.
eapply expRat_eqRat_compat; eauto.
unfold ratMult_rel, expRat_rel.
intuition.
rewrite H6; eauto.
rewrite H7; eauto.
eapply eqRat_refl.
intuition.
eapply expRat_eqRat_compat; eauto.
intuition.
eapply expRat_eqRat_compat; eauto.
intuition.
unfold expRat_rel, ratMult_rel in *.
rewrite H7.
2:{
eauto.
}
2:{
intuition.
}
rewrite ratMult_comm.
eapply ratMult_small_le.
case_eq (bleRat x 1); intuition.
exfalso.
eapply H2.
eauto.
eapply bleRat_total.
trivial.
unfold expRat_rel; intuition.
eapply leRat_trans.
eapply eqRat_impl_leRat.
eapply H8.
eauto.
eapply leRat_trans.
2:{
eapply eqRat_impl_leRat.
symmetry.
eapply H7.
eauto.
}
eapply expRat_le.
case_eq (bleRat x 1); intuition.
exfalso.
eapply H2.
eauto.
eapply bleRat_total; trivial.
omega.
unfold ratMult_rel, expRat_rel.
intuition.
eapply leRat_trans.
eapply eqRat_impl_leRat.
eapply H8.
eauto.
intuition.
eapply expRat_eqRat_compat.
eauto.
eapply leRat_trans.
2:{
eapply eqRat_impl_leRat.
symmetry.
eapply H7.
eauto.
intuition.
eapply expRat_eqRat_compat.
eauto.
}
eapply ratMult_leRat_compat.
intuition.
eapply expRat_le.
case_eq (bleRat x 1); intuition.
exfalso.
eapply H2.
eauto.
eapply bleRat_total; trivial.
omega.
unfold expRat_rel; intuition.
simpl.
intuition.
unfold ratMult_rel, ratSubtract_rel, expRat_rel, ratInverse_rel in *.
intuition.
rewrite H7; eauto.
destruct n; try omega.
simpl.
eapply ratMult_eqRat_compat; eauto.
eapply expRat_eqRat_compat; eauto.
unfold ratMult_rel, ratSubtract_rel, expRat_rel, ratInverse_rel in H4.
rewrite H4.
2:{
intuition.
rewrite H8.
rewrite <- H7.
eapply eqRat_refl.
eauto.
}
2:{
intuition.
eapply ratInverse_eqRat_compat.
2:{
rewrite H7.
eapply eqRat_refl.
eapply eqRat_refl.
eauto.
}
intuition.
eapply H2.
eauto.
apply ratSubtract_0_inv.
trivial.
}
rewrite <- (ratMult_1_l a) in H6 at 1.
eapply (@eqRat_ratMult_same_r (ratSubtract 1 x)).
intuition.
eapply H2; eauto.
eapply ratSubtract_0_inv; trivial.
rewrite ratMult_assoc.
rewrite ratInverse_prod_1.
rewrite ratMult_1_r.
rewrite ratMult_comm.
rewrite ratMult_ratSubtract_distrib_r.
trivial.
intuition.
eapply H2.
eauto.
eapply ratSubtract_0_inv; trivial.
Qed.

(* Specifications: *)
Lemma sumList_rel_le : forall (A : Set)(ls : list A)(f1 f2 : A -> Rat -> Prop) r1 r2,
sumList_rel f1 ls r1 ->
sumList_rel f2 ls r2 ->
(forall a v1 v2, In a ls -> f1 a v1 -> f2 a v2 -> v1 <= v2) ->
r1 <= r2.