Skip to content
Snippets Groups Projects
Commit 333c3dba authored by Ralf Jung's avatar Ralf Jung
Browse files

heap_lang interpreter: fix build with Coq 8.11, and some style fixes

parent 000ec35e
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,7 @@ issues before stabilization. *) ...@@ -50,6 +50,7 @@ issues before stabilization. *)
*) *)
From stdpp Require Import gmap.
From iris.heap_lang Require Export lang. From iris.heap_lang Require Export lang.
From iris.heap_lang Require Import tactics pretty. From iris.heap_lang Require Import tactics pretty.
From iris.prelude Require Import options. From iris.prelude Require Import options.
...@@ -706,35 +707,36 @@ Section interpret_ok. ...@@ -706,35 +707,36 @@ Section interpret_ok.
Qed. Qed.
Lemma state_wf_same_dom s f : Lemma state_wf_same_dom s f :
(dom (gmap.gset _) (f s.(lang_state)).(heap) = dom _ s.(lang_state).(heap)) (dom (gset loc) (f s.(lang_state)).(heap) = dom _ s.(lang_state).(heap))
state_wf s state_wf s
state_wf (modify_lang_state f s). state_wf (modify_lang_state f s).
Proof. Proof.
intros Hdom_eq Hwf. intros Hdom_eq Hwf.
constructor; rewrite /modify_lang_state /= => l ?. constructor; rewrite /modify_lang_state /= => l ?.
apply fin_map_dom.not_elem_of_dom. apply (fin_map_dom.not_elem_of_dom (D:=gset loc)).
rewrite Hdom_eq. rewrite Hdom_eq.
apply fin_map_dom.not_elem_of_dom. apply fin_map_dom.not_elem_of_dom.
apply state_wf_holds; auto. apply state_wf_holds; auto.
Qed. Qed.
Lemma state_wf_upd s l mv0 v' : Lemma state_wf_upd s l mv0 v' :
state_wf s state_wf s
heap (lang_state s) !! l = Some mv0 heap (lang_state s) !! l = Some mv0
state_wf (modify_lang_state (λ σ : state, state_upd_heap <[l:=v']> σ) s). state_wf (modify_lang_state (λ σ : state, state_upd_heap <[l:=v']> σ) s).
Proof. Proof.
intros Hwf Heq. intros Hwf Heq.
apply state_wf_same_dom; auto. apply state_wf_same_dom; auto.
rewrite fin_map_dom.dom_insert_L. rewrite fin_map_dom.dom_insert_L.
apply fin_map_dom.elem_of_dom_2 in Heq. apply (fin_map_dom.elem_of_dom_2 (D:=gset loc)) in Heq.
set_solver. set_solver.
Qed. Qed.
Lemma interpret_wf fuel : (e: expr) s v s', Lemma interpret_wf fuel (e: expr) s v s' :
state_wf s state_wf s
interpret fuel e s = (inl v, s') interpret fuel e s = (inl v, s')
state_wf s'. state_wf s'.
Proof. Proof.
revert e s v s'.
induction fuel as [|fuel]; simpl; intros e s v s' **; [ errored | ]. induction fuel as [|fuel]; simpl; intros e s v s' **; [ errored | ].
destruct e; try errored; success; eauto; destruct e; try errored; success; eauto;
(repeat case_match; subst; try errored; (repeat case_match; subst; try errored;
...@@ -753,11 +755,12 @@ Section interpret_ok. ...@@ -753,11 +755,12 @@ Section interpret_ok.
Local Hint Resolve interpret_wf : core. Local Hint Resolve interpret_wf : core.
Lemma interpret_sound fuel : e s v s', Lemma interpret_sound fuel e s v s' :
state_wf s state_wf s
interpret fuel e s = (inl v, s') interpret fuel e s = (inl v, s')
rtc erased_step (e :: s.(forked_threads), s.(lang_state)) (Val v :: s'.(forked_threads), s'.(lang_state)). rtc erased_step (e :: s.(forked_threads), s.(lang_state)) (Val v :: s'.(forked_threads), s'.(lang_state)).
Proof. Proof.
revert e s v s'.
induction fuel as [|fuel]; simpl; intros e s v s' **; [ errored | ]. induction fuel as [|fuel]; simpl; intros e s v s' **; [ errored | ].
destruct e; try errored; success; cbn [forked_threads lang_state]; destruct e; try errored; success; cbn [forked_threads lang_state];
repeat match goal with repeat match goal with
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment