Commit 245cfb14 authored by charguer's avatar charguer

heap contains

parent a2fdd18a
This diff is collapsed.
......@@ -162,37 +162,9 @@ Proof.
intros i' j ? ?.
forwards~ [M|[M|M]]: inv_true_edges0 i' j.
rew_listx in M. branches; try tauto. subst i'.
right. right. Search out_edges. rewrite~ out_edges_has_edge.
right. right. rewrite~ out_edges_has_edge.
Qed.
Lemma remove_empty : forall A (E: set A),
E \- \{} = E.
Proof. intros. rew_set. intros. rew_set. tauto. Qed.
Lemma remove_all : forall A (E: set A),
E \- E = \{}.
Proof. intros. rew_set. intros. rew_set. tauto. Qed.
Lemma iter_edges_remaining_spec : forall (I:set int->hprop) (G:graph) g f i,
i \in nodes G ->
(forall L, (g ~> RGraph G) \c (I L)) ->
(forall j E, j \notin E -> has_edge G i j ->
(app f [j] (I (E \u \{j})) (# I E))) ->
app Graph_ml.iter_edges [g i f]
PRE (I (out_edges G i))
POST (# I \{}).
Proof.
intros. xapp_spec~ iter_edges_spec (>> (fun E => I (out_edges G i \- E)) G).
{ introv Hj Hij. xapp~.
{ intro HH. rew_set in HH. tauto. }
{ hsimpl. match goal with |- I ?x ==> I ?y \* _ => asserts_rewrite (x = y) end.
{ rew_set. intro x. rew_set. rew_logic. iff; unpack.
{ tests~: (x = j). }
{ tests~: (x = j). branches; [| now false]. tauto. } }
hsimpl. } }
{ rewrite remove_empty. hsimpl. }
{ rewrite remove_all. hsimpl. }
Qed.
Lemma reachable_imperative_spec : forall g G a b,
a \in nodes G ->
......@@ -230,8 +202,9 @@ Proof.
xapp_spec iter_edges_remaining_spec
(>> (fun E => Hexists C2 L2, hinv E C2 L2 \* \[ C2[i] = true ]) G).
{ auto. }
{ unfold hinv. intros. skip.
(* eapply heap_contains_intro. (* evar context issues? *) skip. skip. *) }
{ intros L. unfold hinv. applys heap_contains_intro (Hexists C2 L2,
c ~> Array C2 \* s ~> Stack L2 \*
\[ inv G n a C2 L2 L] \* \[ C2[i] = true]); hsimpl*. }
{ introv N Hij. xpull. intros C2 L2 ?. xapp_spec Sf.
unfold hinv at 1. xpull. intros I'.
xapps. skip.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment