Definition AnnTyping_unique := first unique_mutual.
Definition AnnDefEq_unique  := fourth unique_mutual.
Definition AnnIso_unique    := third unique_mutual.
(* These two tactics look for terms in the context that are typed with two different types and automatically applies the uniqueness lemma.  The first tactic uses subst to resolve the equalities. The second tries to only eliminate equations between variables.  *)
Ltac resolve_unique_subst  :=
match goal with
|   _ : AnnTyping ?G ?a ?A,  H :AnnTyping ?G ?a ?B  |- _  =>
assert (A = B); try (eapply (first unique_mutual); eauto 1); subst; clear H
|   H1 : AnnDefEq ?G ?D ?g ?A1 ?B1,  H2 :AnnDefEq ?G ?D ?g ?A2 ?B2  |- _  =>
destruct (fourth unique_mutual _ _ _ _ _ H1 _ _ H2); subst; clear H2
end.
Ltac resolve_unique_nosubst  :=
match goal with
|   H1 : AnnTyping ?G ?a ?A,  H2 :AnnTyping ?G ?a ?B  |- _  =>
assert (A = B); [ eapply (first unique_mutual);
[eapply H1 | eapply H2]|]; subst B; clear H2
|   H1 : AnnDefEq ?G ?D ?g ?A1 ?B1,  H2 :AnnDefEq ?G ?D ?g ?A2 ?B2  |- _  =>
destruct (fourth unique_mutual _ _ _ _ _ H1 _ _ H2);
try subst A2; try subst B2; try subst A1; try subst B1;
clear H2
end.

(* Coerced values and values are terminal. *)
Lemma no_reduction_mutual :
(forall a, CoercedValue a -> forall G b, not (head_reduction G a b)) /\
(forall a, Value a -> forall G b, not (head_reduction G a b)).