Section tbled.
Existing Instance SubstUpdate_ctx_subst.
Variable tbl : SymEnv.functions RType_typ.
Instance SS : SubstI.Subst subst (expr typ func) :=
@FMapSubst.SUBST.Subst_subst _.
Let RSym_sym := RSym_sym tbl.
Existing Instance RSym_sym.
Existing Instance SubstOk_ctx_subst.
Existing Instance SubstUpdate_ctx_subst.
Existing Instance SubstUpdateOk_ctx_subst.
Existing Instance RType_typ.
Existing Instance Typ2_tyArr.
Existing Instance Expr_expr.
Existing Instance MA.
Existing Instance Expr_ok_fs.
Instance MentionsAnyOk : MentionsAnyOk MA _ _.
Admitted.
Ltac solve_exprD := solve_exprD.solve_exprD tbl.
Opaque type_cast.
Definition AFTER_SET_LOAD : rtac typ (expr typ func) :=
fun tus tvs n m c s e =>
match e with
| (App (App (Inj (inr (Other (feq ty)))) l) r) =>
match l with
| App
(App (App (Inj (inr (Smx fassertD))) P)
(App
(App (Inj (inr (Smx flocalD)))
(App
(App (Inj (inr (Data (fset tyval id))))
v) T1)) T2)) R =>
let l' :=
App
(App (App (Inj (inr (Smx fassertD))) P)
(App
(App (Inj (inr (Smx flocalD)))
(set_reif id v T1 tyval)) T2)) R
in
match @exprUnify (ctx_subst c) typ func _ _ _ _ _ 3
tus tvs 0 l' r ty s with
| Some s => RTac.Core.Solved s
| None =>  RTac.Core.Fail
end
| _ => RTac.Core.Fail
end
| _ => RTac.Core.Fail
end.
Definition AFTER_STORE : rtac typ (expr typ func) :=
fun tus tvs n m c s e =>
match e with
| (App (App (Inj (inr (Other (feq ty)))) l) r) =>
match l with
| App
(App (App (Inj (inr (Smx fassertD))) P) Q)
(App
(App (Inj (inr (Data (freplace_nth tympred n)))) R) Rn) =>
let l' :=
App
(App (App (Inj (inr (Smx fassertD))) P) Q)
(rreplace_nth tympred n R Rn)
in
match @exprUnify (ctx_subst c) typ func _ _ _ _ _ 3
tus tvs 0 l' r ty s with
| Some s => RTac.Core.Solved s
| None =>  RTac.Core.Fail
end
| _ => RTac.Core.Fail
end
| _ => RTac.Core.Fail
end.

Lemma AFTER_STORE_sound : rtac_sound AFTER_STORE.