Definition index_not_const l n :=
  filter (fun v => ~~ is_const (nth (Cst 0) l v) n) (iota 0 (size l)).

Lemma index_not_const_correct : forall n l (k : nat), not (in_mem k (mem (index_not_const l n))) -> is_const (nth (Cst 0) l k) n = true.