(* This tactic applies whichever of the above two lemmas is applicable. *)
Create HintDb lift_idx_hints.
(* more hints to be added later on into this database *)
Ltac lift_idx :=
first [ rewrite @lift_idx_recent by solve [ omega | eauto with lift_idx_hints ]
| rewrite @lift_idx_old by omega ].
Hint Extern 1 => lift_idx : lift_idx.
Ltac lift_idx_in h :=
first [ rewrite @lift_idx_recent in h by solve [ omega | eauto with lift_idx_hints ]
| rewrite @lift_idx_old in h by omega ].
Ltac lift_idx_all :=
first [ rewrite @lift_idx_recent in * by solve [ omega | eauto with lift_idx_hints ]
| rewrite @lift_idx_old in * by omega ].
(* This tactic finds an occurrence of [lift _ _ _] at type [nat] and examines both cases. *)
Ltac destruct_lift_idx :=
match goal with |- context[@lift nat _ _ ?y ?x] =>
destruct (le_gt_dec y x); lift_idx
end.
(* Our definition of [lift] at type [nat] satisfies the properties listed above. *)
Instance LiftVar_idx: @LiftVar nat _ _.

(* Specifications: *)
Lemma subst_idx_identity:
forall `{Var V} v k x,
k = x ->
subst_idx v k x = v.
Lemma subst_idx_miss_2:
forall `{Var V} v k x,
k < x ->
subst_idx v k x = var (x - 1).