Commit ab6066fe authored by Dan Frumin's avatar Dan Frumin
Browse files

Clean up denv.v

parent b81ea4fb
......@@ -44,12 +44,12 @@ Section denv.
| [], _ => false
end.
Lemma denv_wf_len_spec E m :
Lemma denv_wf_len_spec E m :
denv_wf_len E m <-> length E >= length m.
Proof.
revert m. induction E; destruct m; intros; try (simpl; lia).
simpl. specialize (IHE m). rewrite IHE. lia.
Qed.
Proof.
revert m. induction E; destruct m; intros; try (simpl; lia).
simpl. specialize (IHE m). rewrite IHE. lia.
Qed.
Definition denv_wf (E: known_locs) (m: denv) : bool :=
denv_wf_val E m && denv_wf_len E m.
......@@ -685,7 +685,7 @@ Section denv_spec.
Qed.
(** ** Well-foundness of denv *)
(** ** Well-foundness of denv *)
Lemma denv_wf_len_mono E E' m :
denv_wf_len E m
E `prefix_of`E'
......@@ -712,7 +712,7 @@ Section denv_spec.
destruct m2; first done.
* simpl in *. eapply IHE with (m1 ++ [o0]).
rewrite -app_assoc. naive_solver.
Qed.
Qed.
Lemma denv_wf_val_mono_r E m1 m2 :
denv_wf_val E (m1 ++ m2)
......@@ -770,35 +770,35 @@ Qed.
destruct m2 as [|[denv2|] ms2]; try (destruct denv2); naive_solver.
Qed.
Lemma denv_wf_merge_len (E : known_locs) (m1 m2 : denv) :
denv_wf_len E m1
denv_wf_len E m2
denv_wf_len E (denv_merge m1 m2).
Proof.
revert m1 m2. induction E; destruct m1, m2; naive_solver.
Qed.
Lemma denv_wf_merge E m1 m2 :
denv_wf E m1 denv_wf E m2 denv_wf E (denv_merge m1 m2).
Proof.
intros Hwf1 Hwf2.
unfold denv_wf in Hwf1; apply andb_True in Hwf1 as [Haux1 Hlen1].
unfold denv_wf in Hwf2; apply andb_True in Hwf2 as [Haux2 Hlen2].
specialize (denv_wf_merge_val E m1 m2 Haux1 Haux2) as Hwf.
specialize (denv_wf_merge_len E m1 m2 Hlen1 Hlen2) as Hlen.
unfold denv_wf. naive_solver.
Qed.
Lemma denv_wf_stack_merge ms E :
Forall (denv_wf E) ms
denv_wf E (denv_stack_merge ms).
Proof.
induction ms as [|m ms]; simpl; eauto.
- intros; unfold denv_wf; by destruct E.
- rewrite Forall_cons =>Hm. destruct Hm as [Hm Hms].
apply denv_wf_merge; eauto.
Qed.
Lemma denv_wf_merge_len (E : known_locs) (m1 m2 : denv) :
denv_wf_len E m1
denv_wf_len E m2
denv_wf_len E (denv_merge m1 m2).
Proof.
revert m1 m2. induction E; destruct m1, m2; naive_solver.
Qed.
Lemma denv_wf_merge E m1 m2 :
denv_wf E m1 denv_wf E m2 denv_wf E (denv_merge m1 m2).
Proof.
intros Hwf1 Hwf2.
unfold denv_wf in Hwf1; apply andb_True in Hwf1 as [Haux1 Hlen1].
unfold denv_wf in Hwf2; apply andb_True in Hwf2 as [Haux2 Hlen2].
specialize (denv_wf_merge_val E m1 m2 Haux1 Haux2) as Hwf.
specialize (denv_wf_merge_len E m1 m2 Hlen1 Hlen2) as Hlen.
unfold denv_wf. naive_solver.
Qed.
Lemma denv_wf_stack_merge ms E :
Forall (denv_wf E) ms
denv_wf E (denv_stack_merge ms).
Proof.
induction ms as [|m ms]; simpl; eauto.
- intros; unfold denv_wf; by destruct E.
- rewrite Forall_cons =>Hm. destruct Hm as [Hm Hms].
apply denv_wf_merge; eauto.
Qed.
Lemma denv_wf_val_unlock E m :
denv_wf_val E m denv_wf_val E (denv_unlock m).
......@@ -808,7 +808,7 @@ Qed.
split_and. eapply dval_wf_mono; eauto. apply IHms; eauto.
Qed.
Lemma denv_wf_len_unlock E m :
Lemma denv_wf_len_unlock E m :
denv_wf_len E m denv_wf_len E (denv_unlock m).
Proof.
revert m; induction E; destruct m; try naive_solver.
......@@ -946,11 +946,11 @@ Qed.
assert ((i + S n)%nat = (S (i + n))%nat) as -> by omega. done.
Admitted. *)
Lemma denv_interp_aux_mono E E' m (i:nat) :
Lemma denv_interp_aux_mono E E' m (i:nat) :
denv_wf E m E `prefix_of` E'
denv_interp_aux E m i - denv_interp_aux E' m i.
Proof.
iIntros (Hwf Hpre) "H".
iIntros (Hwf Hpre) "H".
unfold denv_wf in Hwf; apply andb_True in Hwf as [Haux Hlen].
iInduction m as [|dio m i] "IHm" forall (i).
- by unfold denv_interp_aux.
......@@ -992,8 +992,6 @@ Qed.
Proof.
intros. destruct m; first by naive_solver.
rewrite -!denv_interp_aux_0 denv_interp_aux_mono //.
(* destruct E; last done.
unfold denv_wf in H0. naive_solver. *)
Qed.
......@@ -1015,14 +1013,14 @@ Qed.
dval_wf E dv.
Proof. Admitted.
Lemma denv_wf_extend E m dv l x q :
Lemma denv_wf_extend E m dv l x q :
denv_wf E m dval_wf E dv
denv_wf (E ++ [l]) (denv_insert (length E) x q dv m).
Proof.
intros.
assert (E `prefix_of` E ++ [l]). by eapply prefix_app_l; done.
assert (dval_wf (E ++ [l]) dv). eapply dval_wf_mono; done.
apply denv_wf_insert; eauto. eapply denv_wf_mono; done.
Qed.
Proof.
intros.
assert (E `prefix_of` E ++ [l]). by eapply prefix_app_l; done.
assert (dval_wf (E ++ [l]) dv). eapply dval_wf_mono; done.
apply denv_wf_insert; eauto. eapply denv_wf_mono; done.
Qed.
End denv_spec.
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