Proof with auto with arith.
unfold UE.
simpl.
induction n.
intros.
destruct l.
simpl.
apply IndexSeq_nil.
discriminate.
intros.
assert (l <> nil). intro. subst. discriminate.
destruct (IndexSeq_uncons H0 H1).
destruct H2.
destruct H2.
subst b.
replace n with (length x) in *.
Focus 2.
cset (Permutation.Permutation_length H3).
simpl in H2.
unfold Index in H, H2.
rewrite H in H2.
inversion H2...
apply IndexSeq_perm with (filter (fun f => unsum_bool (cmp_cmp (Ecmp T (subscript f) (subscript e)) Lt)) (x0 :: x))...
Focus 2.
apply filter_perm.
repeat intro...
apply Permutation.Permutation_sym...
assert (In x0 (x0 :: x)).
left...
cset (IndexSeq_base_lowest_value' _ (IndexSeq_perm H0 H3) ).
simpl.
case_eq (Ecmp T (subscript x0) (subscript e)); intro.
rewrite (proj1_conj (filter_none (fun f: Index => unsum_bool (cmp_cmp (Ecmp T (subscript f) (subscript e)) Lt)) x))...
intros.
case_eq (Ecmp T (subscript x1) (subscript e))...
intros.
elimtype False.
unfold UE, Ele in H4. simpl in H4.
apply H4 with x1.
right...
apply Ecmp_apply_sym.
simpl.
apply Ecmp_eq_trans_r with (subscript e)...
apply Ecmp_apply_sym...
simpl.
apply IndexSeq_cons...
apply IHn...
apply (IndexSeq_cons_inv (IndexSeq_perm H0 H3)).
rewrite (proj1_conj (filter_none (fun f: Index => unsum_bool (cmp_cmp (Ecmp T (subscript f) (subscript e)) Lt)) x))...
intros.
case_eq (Ecmp T (subscript x1) (subscript e))...
intros.
elimtype False.
apply H4 with x1.
right...
apply Ecmp_apply_sym.
simpl.
apply Ecmp_trans with (subscript e)...
apply Ecmp_apply_sym...
Qed.

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