subst. auto.
    (* Left/Right
  - ann_invert_clear.
    apply_ind g1. invert_syntactic_equality. auto.apply_ind g1. done.- ann_invert_clear.apply_ind g1. invert_syntactic_equality. auto.
  - repeat ann_invert_clear;
    apply_ind g1;
    apply_ind g2.
    done.
    invert_syntactic_equality. auto.
    *)
Qed.


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
  |

all: try solve [inversion p].