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

Lemma D_correct : forall (e : expr) l n, let '(a,b) := D e n in interp_domain l b -> is_derive (fun x => interp (set_nth R0 l n x) e) (nth R0 l n) (interp l a).