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

Lemma interp_AppExt_set_nth_not_const : forall k f le l n x, interp (set_nth 0 l n x) (AppExt k f le) = apply k f (foldr (fun v acc i => if ssrnat.eqn i v then interp (set_nth 0 l n x) (nth (Cst 0) le v) else acc i) (nth 0 (map (interp l) le)) (index_not_const le n)).