Ltac subst_idx_in h :=
  first [
    rewrite @subst_idx_identity in h by omega
  | rewrite @subst_idx_miss_1 in h by omega
  | rewrite @subst_idx_miss_2 in h by omega
  ].Ltac subst_idx_all :=
  first [
    rewrite @subst_idx_identity in * by omega
  | rewrite @subst_idx_miss_1 in * by omega
  | rewrite @subst_idx_miss_2 in * by omega
  ].

(* Specifications: *)
Lemma subst_idx_var: forall `{Var V}, forall v k x, subst_idx (var v) k x = var (subst_idx v k x).