Proof with auto.
set (length l).
assert (n = length l)...
clearbody n.
revert H. revert l.
induction n.
intros.
destruct l.
simpl.
unfold IndexSeq_above.
apply IndexSeq_nil.
discriminate.
intros.
assert (l <> nil). intro. subst l. discriminate.
destruct (IndexSeq_uncons H0 H1).
destruct H2.
destruct H2.
subst b.
cut (IndexSeq_above (x0 + S n) (filter (fun f: Index => unsum_bool (cmp_cmp (Ecmp T (subscript f) (subscript e)) Gt)) (x0 :: x))).
unfold IndexSeq_above.
intro.
rewrite length_filter in *.
rewrite <- (count_perm_simple _ H3).
apply IndexSeq_perm with (filter (fun f: Index => unsum_bool (cmp_cmp (Ecmp T (subscript f) (subscript e)) Gt)) (x0 :: x))...
apply filter_perm.
repeat intro...
apply Permutation.Permutation_sym...
simpl filter.
replace n with (length x) in *.
Focus 2.
cset (Permutation.Permutation_length H3).
simpl in H2.
rewrite <- H in H2.
inversion H2...
assert (IndexSeq_above (x0 + S (length x)) (filter (fun f: Index => unsum_bool (cmp_cmp (Ecmp T (subscript f) (subscript e)) Gt)) x)).
rewrite <- plus_Snm_nSm.
apply IHn...
apply IndexSeq_cons_inv.
apply IndexSeq_perm with l...
case_eq (Ecmp T (subscript x0) (subscript e)); intro...
simpl.
unfold IndexSeq_above.
assert (IndexSeq (S x0) x).
apply IndexSeq_cons_inv.
apply IndexSeq_perm with l...
rewrite filter_all.
simpl @length.
rewrite plus_comm.
rewrite minus_plus.
apply IndexSeq_perm with l...
intros.
replace (Ecmp T (subscript x1) (subscript e)) with Gt...
rewrite Ecmp_sym.
replace (Ecmp T (subscript e) (subscript x1)) with Lt...
assert (In x1 l).
cut (In x1 (x0 :: x)).
intro.
apply (Permutation.Permutation_in _ H3 H7).
right...
cset (IndexSeq_base_lowest_value' x0 H0 x1 H7).
unfold Ele, UE in H8. simpl in H8.
fold (@Ele T (subscript x0) (subscript x1)) in H8.
symmetry.
apply Ecmp_lt_le_trans with (subscript x0)...
rewrite Ecmp_sym.
rewrite H4...
Qed.

(* Specifications: *)
Lemma InvIndexSeq_filterGt' e l b:
IndexSeq b (e :: l) -> IndexSeq_above (b + S (length l)) (filter (fun f => unsum_bool (cmp_cmp (Ecmp UE f e) Gt)) l).