Module Type ISO_SOUND.
Declare Module VeriStarSound : VERISTAR_SOUND.
Definition existsv (nextv: var) (P: spred) : spred :=
fun s => exists y,  P (State (env_set nextv y (stk s)) (hp s)).
Definition fresh {A} (f: A -> var) (a: A) (x: var) : Prop :=  Ident.lt (f a) x.
Ltac do_fresh1 :=
repeat match goal with H: Ile _ _ |- _ => revert H
| H: Ident.lt _ _ |- _ => revert H
| H: fresh _ _ _ |- _ => revert H end;
clear;
unfold fresh; simpl;
repeat ((rewrite freshmax_list_app || rewrite freshmax_list_rev
|| rewrite varmax_minid || rewrite varmax_minid'); simpl).
Ltac do_fresh :=
do_fresh1; intros;
repeat match goal with
|  H: Ident.lt (var_max _ _) _ |- _ => apply var_max_split in H; destruct H
end;
repeat apply var_max_intro; auto;
try solve [etransitivity; eauto].
Definition set_in_state nextv z s := State (env_set nextv z (stk s)) (hp s).
(* Lemma agree_except_sym: forall x s s', agree_except x s s' -> agree_except x s' s. *)

Axiom isolate_sound:
forall e P nextv nextv2 results
(LT: Ident.lt nextv nextv2),
isolate e P nextv = Some results ->
fresh freshmax_expr e nextv ->
fresh freshmax_assertion P nextv ->
assertion_denote P |--
fold_right (fun P => orp (existsv nextv (assertion_denote P))) FF results /\
forall Q, In Q results ->
match Q with
|Assertion _ (Next e0 _ :: _) => e=e0
| _ => False
end /\
fresh freshmax_assertion Q nextv2.