Commit f4c04fc1 authored by Dan Frumin's avatar Dan Frumin

Cosmetic changes to some proofs & a tactic

parent 52e1ebe5
...@@ -461,24 +461,26 @@ Section CG_Counter. ...@@ -461,24 +461,26 @@ Section CG_Counter.
iApply (bin_log_related_alloc_r); auto. iApply (bin_log_related_alloc_r); auto.
iIntros (cnt') "Hcnt' /=". iIntros (cnt') "Hcnt' /=".
(* establishing the invariant *) iApply (bin_log_related_rec_r _ _ _ []); auto. simpl.
iAssert (counter_inv l cnt cnt') rewrite /= !Closed_subst_id /=.
with "[Hl Hcnt Hcnt']" as "Hinv".
{ iExists _. by iFrame. }
iMod (inv_alloc counterN with "[Hinv]") as "#Hinv"; trivial.
unfold FG_counter_body. unlock. unfold FG_counter_body. unlock.
iApply (bin_log_related_rec_l _ _ []); auto. iApply (bin_log_related_rec_l _ _ []); auto.
iNext. rewrite /= !Closed_subst_id /=. iNext. rewrite /= !Closed_subst_id /=.
iApply (bin_log_related_rec_r _ _ _ []); auto. simpl.
rewrite /= !Closed_subst_id /=.
rel_bind_r (CG_counter_body _). rel_bind_r (CG_counter_body _).
unfold CG_counter_body. unlock. unfold CG_counter_body. unlock.
iApply (bin_log_related_rec_r _ _); auto. iApply (bin_log_related_rec_r _ _); auto.
rewrite /= !Closed_subst_id /=. rewrite /= !Closed_subst_id /=.
iApply (bin_log_related_rec_r _ _ _ []); auto. iApply (bin_log_related_rec_r _ _ _ []); auto.
rewrite /= !Closed_subst_id /=. rewrite /= !Closed_subst_id /=.
(* establishing the invariant *)
iAssert (counter_inv l cnt cnt')
with "[Hl Hcnt Hcnt']" as "Hinv".
{ iExists _. by iFrame. }
iMod (inv_alloc counterN with "[Hinv]") as "#Hinv"; trivial.
iApply (bin_log_related_pair _ with "[]"). iApply (bin_log_related_pair _ with "[]").
- iApply (FG_CG_increment_refinement with "Hinv"). - iApply (FG_CG_increment_refinement with "Hinv").
- iApply (counter_read_refinement with "Hinv"). - iApply (counter_read_refinement with "Hinv").
......
...@@ -12,7 +12,7 @@ Class heapPreIG Σ := HeapPreIG { ...@@ -12,7 +12,7 @@ Class heapPreIG Σ := HeapPreIG {
Lemma logrel_adequate Σ `{heapPreIG Σ, inG Σ (authR cfgUR)} Lemma logrel_adequate Σ `{heapPreIG Σ, inG Σ (authR cfgUR)}
e e' τ σ : e e' τ σ :
( `{heapIG Σ, cfgSG Σ}, e log e' : τ) ( `{heapIG Σ, cfgSG Σ}, e log e' : τ)
adequate e σ (λ _, thp' h v, rtc step ([e'], ) (of_val v :: thp', h)). adequate e σ (λ _, thp' h v', rtc step ([e'], ) (of_val v' :: thp', h)).
Proof. Proof.
intros Hlog. intros Hlog.
eapply (wp_adequacy Σ _); iIntros (Hinv). eapply (wp_adequacy Σ _); iIntros (Hinv).
......
...@@ -905,8 +905,8 @@ Tactic Notation "tp_apply" constr(j) open_constr(lem) "with" constr(Hs) "as" con ...@@ -905,8 +905,8 @@ Tactic Notation "tp_apply" constr(j) open_constr(lem) "with" constr(Hs) "as" con
| (j _)%I => Hj | (j _)%I => Hj
| _ => find Γ j | _ => find Γ j
end end
| Enil => fail "tp_apply: cannot find " j " ⤇ _ " | Enil => fail 2 "tp_apply: cannot find " j " ⤇ _ "
| _ => fail "tp_apply: unknown error in find" | _ => fail 2 "tp_apply: unknown error in find"
end in end in
let rec findSpec Γp Γs := let rec findSpec Γp Γs :=
match Γp with match Γp with
...@@ -917,10 +917,10 @@ Tactic Notation "tp_apply" constr(j) open_constr(lem) "with" constr(Hs) "as" con ...@@ -917,10 +917,10 @@ Tactic Notation "tp_apply" constr(j) open_constr(lem) "with" constr(Hs) "as" con
end end
| Enil => | Enil =>
match Γs with match Γs with
| Enil => fail "tp_apply: cannot find spec_ctx _" | Enil => fail 2 "tp_apply: cannot find spec_ctx _"
| _ => findSpec Γs Enil | _ => findSpec Γs Enil
end end
| _ => fail "tp_apply: unknown error in findSpec" | _ => fail 2 "tp_apply: unknown error in findSpec"
end in end in
match goal with match goal with
| |- of_envs (Envs ?Γp ?Γs) ?Q => | |- of_envs (Envs ?Γp ?Γs) ?Q =>
...@@ -929,7 +929,7 @@ Tactic Notation "tp_apply" constr(j) open_constr(lem) "with" constr(Hs) "as" con ...@@ -929,7 +929,7 @@ Tactic Notation "tp_apply" constr(j) open_constr(lem) "with" constr(Hs) "as" con
let pat := eval vm_compute in (appP (sel_pat.parse Hs) Hj Hspec) in let pat := eval vm_compute in (appP (sel_pat.parse Hs) Hj Hspec) in
let pats := print_sel pat in let pats := print_sel pat in
let elim_pats := eval vm_compute in (add_elim_pat Hr Hj) in let elim_pats := eval vm_compute in (add_elim_pat Hr Hj) in
iMod (lem with pats) as elim_pats; first by solve_ndisj iMod (lem with pats) as elim_pats; first try by solve_ndisj
| _ => fail "tp_apply: cannot parse the context" | _ => fail "tp_apply: cannot parse the context"
end. end.
...@@ -1016,7 +1016,7 @@ End test. ...@@ -1016,7 +1016,7 @@ End test.
Section test2. Section test2.
Context `{heapIG Σ, !cfgSG Σ}. Context `{heapIG Σ, !cfgSG Σ}.
(* TODO: Coq complains if I make it a section variable *) (* TODO: Coq complains if I make it a section variable *)
Axiom (steps_release : forall E ρ j K l b, Axiom (steps_release_test : forall E ρ j K l b,
nclose specN E nclose specN E
spec_ctx ρ - l ↦ₛ (#v b) - j fill K (App (Lit Unit) (Loc l)) spec_ctx ρ - l ↦ₛ (#v b) - j fill K (App (Lit Unit) (Loc l))
={E}= j fill K (Lit Unit) l ↦ₛ (#v false)). ={E}= j fill K (Lit Unit) l ↦ₛ (#v false)).
...@@ -1028,7 +1028,7 @@ Theorem test_apply E ρ j b K l: ...@@ -1028,7 +1028,7 @@ Theorem test_apply E ρ j b K l:
- |={E}=> True. - |={E}=> True.
Proof. Proof.
iIntros (?) "#Hs Hst Hj". iIntros (?) "#Hs Hst Hj".
tp_apply j steps_release with "Hst" as "Hl". tp_apply j steps_release_test with "Hst" as "Hl".
done. done.
Qed. Qed.
......
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