simple induction n.
intros.
inversion i.
inversion in_range_prf.
intros.
destruct i.
destruct index as [| n1].
apply Trans with (sum (a;; Seqtl v)); auto with algebra.
apply Trans with (sum (hdtl v) +' (min head v) +' a).
apply Trans with (a +' sum (Seqtl v)); auto with algebra.
apply Trans with (sum (Seqtl v) +' a); auto with algebra.
apply SGROUP_comp; auto with algebra.
unfold hdtl in |- *.
apply Trans with (head v +' sum (Seqtl v) +' (min head v)); auto with algebra.
apply Trans with (sum (Seqtl v) +' head v +' (min head v)); auto with algebra.
apply Trans with (sum (Seqtl v) +' (head v +' (min head v)));
auto with algebra.
apply Trans with (sum (Seqtl v) +' (zero AG)); auto with algebra.
apply SGROUP_comp; auto with algebra.
apply SGROUP_comp; auto with algebra.
apply Trans with (sum (hdtl (modify_seq v (Build_finiteT in_range_prf) a)));
auto with algebra.
unfold hdtl in |- *.
apply
Trans
with
(head (modify_seq v (Build_finiteT in_range_prf) a) +'
sum (Seqtl (modify_seq v (Build_finiteT in_range_prf) a)));
auto with algebra.
apply
Trans
with (head v +' sum (Seqtl (modify_seq v (Build_finiteT in_range_prf) a)));
auto with algebra.
apply Trans with (sum (hdtl v) +' (min v (Build_finiteT in_range_prf)) +' a);
auto with algebra.
unfold hdtl in |- *.
apply
Trans
with (head v +' sum (Seqtl v) +' (min v (Build_finiteT in_range_prf)) +' a);
auto with algebra.
apply
Trans
with
(head v +' (sum (Seqtl v) +' (min v (Build_finiteT in_range_prf)) +' a)).
apply SGROUP_comp; auto with algebra.
apply
Trans
with
(sum (modify_seq (Seqtl v) (Build_finiteT (lt_S_n _ _ in_range_prf)) a));
auto with algebra.
apply
Trans
with
(sum (Seqtl v) +' (min Seqtl v (Build_finiteT (lt_S_n _ _ in_range_prf))) +'
a); auto with algebra.
apply
Trans
with
(head v +' (sum (Seqtl v) +' (min v (Build_finiteT in_range_prf))) +' a);
auto with algebra.
Qed.

Lemma sum_of_zeros :
forall (M : monoid) (n : Nat) (v : seq n M),
v =' const_seq n (zero M) in _ -> sum v =' (zero M) in _.