(************************************************  Reified Lemmas  ************************************************)
Definition reify_hlip_base (temp : PTree.t (type * bool)) (var : PTree.t type)
(ret : type) (gt : PTree.t type) (s : statement) : my_lemma.
reify_lemma reify_vst (hoist_later_in_pre_aux temp var ret gt s).
Defined.
(* Print reify_hlip_base. *)
Definition reify_hlip_ind : my_lemma.
reify_lemma reify_vst (fold_right_sepcon_later_derives).
Defined.
(* Print reify_hlip_ind. *)
Section tbled.
Variable tbl : SymEnv.functions RType_typ.
Let RSym_sym := RSym_sym tbl.
Existing Instance RSym_sym.
Definition solve_hd_in_hlip (hd: expr typ func) : rtac typ (expr typ func) :=
match hd with
| App (Inj (inr (Smx flater))) _ => EAPPLY typ func reify_derives_refl
| _ => EAPPLY typ func reify_now_later
end.
Fixpoint solve_strip_1_later (R: expr typ func) : rtac typ (expr typ func) :=
match R with
| Inj (inr (Data (fnil tympred))) => EAPPLY typ func reify_now_later
| App (App (Inj (inr (Data (fcons tympred)))) hd) tl =>
THEN (EAPPLY typ func reify_hlip_ind)
(THEN (TRY (REFLEXIVITY tbl))
(FIRST [solve_hd_in_hlip hd; solve_strip_1_later tl]))
| _ => FAIL
end.
Definition HLIP temp var ret gt R s :=
THEN (EAPPLY typ func (reify_hlip_base temp var ret gt s))
(TRY (solve_strip_1_later R)).
Let Expr_expr_fs := Expr_expr_fs tbl.
Existing Instance Expr_expr_fs.
Let Expr_ok_fs := Expr_ok_fs tbl.
Existing Instance Expr_ok_fs.
Let ExprVar_expr := @ExprVariables.ExprVar_expr typ func.
Existing Instance ExprVar_expr.
Existing Instance MA.
Existing Instance rtac_base.MentionsAnyOk.

Lemma HLIP_sound_aux0: forall temp var ret gt s, rtac_sound (EAPPLY typ func (reify_hlip_base temp var ret gt s)).