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.

(* Specifications: *)
Lemma AFTER_STORE_sound : rtac_sound AFTER_STORE.