Ltac destruct_as_tree :=
repeat
match goal with
| [ H : context [ match as_tree ?x with _ => _ end] |- _] => destruct (as_tree x) eqn:?
| [ H : as_tree _ = Some (inl (_ , _ , _, _)) |- _ ] => apply as_tree_l in H
| [ H : as_tree _ = Some (inr _) |- _ ] => apply as_tree_r in H
| [ H : as_tree _ = Some (inl (?p, _, _)) |- _ ] => destruct p
| [ H : as_tree _ = Some (inl (?p, _)) |- _ ] => destruct p
| [ H : as_tree _ = Some (inl ?p) |- _ ] => destruct p
| [ H : as_tree _ = Some ?p |- _ ] => destruct p
end;
subst.Ltac solve_exprD := solve_exprD.solve_exprD tbl.

(* Specifications: *)
Lemma get_reif_val_exists : forall i tr typ tus tvs vtr, exprD' tus tvs (typtree typ) tr = Some vtr -> exists v, exprD' tus tvs (tyoption typ) (get_reif i tr typ) = Some v.
Lemma get_reif_eq2 : forall typ i tr tus tvs val, exprD' tus tvs (typtree typ) tr = Some val -> exprD' tus tvs (tyoption typ) (App (Inj (inr (Data (fget typ i)))) tr) = exprD' tus tvs (tyoption typ) (get_reif i tr typ) .
Lemma set_reif_istree : forall i tus tvs t0 vr e t x, exprD' tus tvs t0 (set_reif i vr e t) = Some x -> t0 = typtree t.
Lemma set_reif_exprD : forall tus tvs typ i vr e v ev, exprD' tus tvs (typtree typ) e = Some ev -> exprD' tus tvs typ vr = Some v -> exists r, exprD' tus tvs (typtree typ) (set_reif i vr e typ) = Some r.
Lemma set_reif_vr : forall tus tvs typ i e vr e4, exprD' tus tvs (typtree typ) (set_reif i vr e typ) = Some e4 -> exists v, exprD' tus tvs typ vr = Some v.