intros.
edestruct (set_reif_exprD); eauto.
instantiate (1 := i) in H2.
solve_exprD. unfold RSym_sym in *.
fold func in *. congruence.
Qed.
Ltac set_typeof_None :=
match goal with
| [H: typeof_expr ?tus ?tvs (set_reif ?i ?vr ?e ?t) = None |- _ ] =>
try solve [eapply typeof_set_reif_None_F in H; first [progress eauto | solve_exprD]; try contradiction]
end.
Ltac get_vr_type :=
repeat
match goal with
|  [ H :  exprD' ?tus ?tvs (typtree ?typ) (set_reif ?i ?vr ?e ?typ) = Some ?v |- _ ] =>
match goal with
| [ H': exprD' tus tvs typ vr = Some _ |- _] => fail 1
| _ => destruct (set_reif_vr _ _ typ _ _ _ _ H)
end
end.
Ltac set_reif_tac :=
repeat (unfold RSym_sym in *;
solve_exprD;
try set_reif_ex;
extract_set_reif_type;
try set_typeof_None;
try (progress get_vr_type; pose_types tbl)
).

Lemma set_reif_eq2 :
forall i tus tvs typ vr tr val,
exprD' tus tvs (typtree typ) tr = Some val ->
exprD' tus tvs (typtree typ) (App (App (Inj (inr (Data (fset typ i)))) vr) tr)  =
exprD' tus tvs (typtree typ) (set_reif i vr tr typ).