(* A useful tactic *)
Ltac resolve_open a :=
let s := fresh in
match goal with
[ x1 : ?b = open_tm_wrt_tm a (a_Var_f ?x) |- _ ] =>
destruct a; inversion x1;
[unfold open_tm_wrt_tm in x1;
simpl in x1;
match goal with [ n:nat |- _ ] =>
destruct (lt_eq_lt_dec n 0) as [s | [| s]];
try destruct s; inversion x1
end | subst; unfold open_tm_wrt_tm in x1;
unfold open_tm_wrt_tm; simpl in *; inversion x1; clear x1]
end.

Lemma An_AbsTerm_exists : ∀ G x A (a a' : tm),
x `notin` (fv_tm a \u fv_tm a' \u dom G) ->
AnnTyping G A a_Star ->
head_reduction ([(x, Tm A)] ++ G) (open_tm_wrt_tm a (a_Var_f x))
(open_tm_wrt_tm a' (a_Var_f x))
→ head_reduction G (a_Abs Irrel A a) (a_Abs Irrel A a').