Skip to content

Commit 7170a1f

Browse files
committed
reasoning about saving the tag
1 parent 0350dbe commit 7170a1f

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

theories/iris/logrel/compat_lemmas/compat_case.v

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,42 @@ Section Fundamental.
244244
cbn [of_val].
245245
rewrite v_to_e_list1.
246246

247+
(* Store tag *)
248+
lwp_chomp 2.
249+
iApply (lenient_wp_seq with "[Hfr Hrun]").
250+
{
251+
set (Φ := {| lp_fr_inv := λ _, True;
252+
lp_val := λ f vs',
253+
⌜∀ j, j ≠ (fe_wlocal_offset fe + length (wl ++ wl_save))%nat -> f_locs f !! j = f_locs fr_saved !! j⌝ ∗
254+
⌜f_locs f !! (fe_wlocal_offset fe + length (wl ++ wl_save))%nat = Some (VAL_int32 (Wasm_int.Int32.repr i))⌝ ∗
255+
⌜vs' = []⌝;
256+
lp_trap := False;
257+
lp_br := λ _ _, False;
258+
lp_ret := λ _, False;
259+
lp_host := λ _ _ _ _, False |}%I : @logpred Σ).
260+
iApply (lenient_wp_set_local _ _ _ Φ); last iFrame.
261+
1: admit. (* fe_wlocal_offset fe + length (wl ++ wl_save) < length (f_locs fr_saved) *)
262+
unfold lp_val, Φ.
263+
iSplit.
264+
- iIntros "!> %j".
265+
iPureIntro.
266+
intros Hneq.
267+
simpl.
268+
apply util.set_nth_neq; try done.
269+
admit. (* fe_wlocal_offset fe + length (wl ++ wl_save) < length (f_locs fr_saved) *)
270+
- iSimpl.
271+
iSplit; last done.
272+
iPureIntro.
273+
apply set_nth_read.
274+
}
275+
{ by iIntros. }
276+
iIntros (w fr_saved_and_tag) "Hnotrap Hfr _".
277+
destruct w; iEval (cbn) in "Hnotrap"; try done;
278+
try (iDestruct "Hnotrap" as "[? ?]"; done).
279+
iDestruct "Hnotrap" as "(Hrun & %Hsame' & %Hsaved_and_tag' & ->)".
280+
clear_nils.
281+
282+
247283
Admitted.
248284

249285
Lemma compat_case M F L L' n_skip wt wt' wtf wl wl' wlf es' ess τs τs' κ :

theories/util.v

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,18 @@ Proof.
115115
destruct (@ssrnat.ltP x y); auto.
116116
Qed.
117117

118+
Lemma set_nth_neq:
119+
∀ {A : Type} (l : seq.seq A) (i j : nat) (x : A),
120+
i < length l ->
121+
i <> j ->
122+
seq.set_nth x l i x !! j = l !! j.
123+
Proof.
124+
intros.
125+
rewrite properties.update_list_at_is_set_nth.
126+
rewrite stdpp_aux.update_ne; auto.
127+
auto using lt_ssrleq.
128+
Qed.
129+
118130
Lemma set_nth_read_neq:
119131
∀ {A : Type} (l : seq.seq A) (i j : nat) (x y : A),
120132
i <> j ->

0 commit comments

Comments
 (0)