Skip to content

Commit

Permalink
attempt in hash once prog spec
Browse files Browse the repository at this point in the history
  • Loading branch information
hei411 committed Aug 16, 2024
1 parent 3f0793d commit 0848057
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
27 changes: 25 additions & 2 deletions theories/coneris/examples/concurrent_hash.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Section concurrent_hash.
Definition hash_once_prog : val :=
λ: "h" "lock" "_",
acquire "lock";;
"h" (rand #val_size)
"h" (rand #val_size);;
release "lock"
.

Expand All @@ -34,8 +34,31 @@ Section concurrent_hash.
multiple_parallel #insert_num (hash_once_prog "h" "lock");;
"h".

Context `{!conerisGS Σ, !spawnG Σ}.
Context `{!conerisGS Σ, !spawnG Σ, !lockG Σ}.

Lemma hash_once_prog_spec γ l f:
{{{ is_lock γ l (∃ m, coll_free_hashfun_amortized val_size max_hash_size f m) ∗ ↯ err }}}
hash_once_prog f l #()
{{{ (v:val), RET v; True }}}.
Proof.
iIntros (Φ) "[#H Herr] HΦ".
rewrite /hash_once_prog.
wp_pures.
wp_apply (acquire_spec with "H") as "[Hl [% K]]".
wp_pures.
wp_apply wp_rand; first done.
iIntros.
wp_apply (wp_insert_amortized with "[$]").
- admit.
- iIntros (?) "(%&?&%)". wp_pures.
wp_apply (release_spec with "[-HΦ]").
+ iFrame. iSplitR; first iApply "H". iFrame.
+ done.
Admitted.




Lemma concurrent_hash_spec :
{{{ ↯ (INR insert_num * err)%R }}}
concurrent_hash_prog
Expand Down
2 changes: 1 addition & 1 deletion theories/coneris/examples/parallel_add.v
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,6 @@ Proof.
- iNext. iFrame. iPureIntro. simpl. eexists _. repeat split; naive_solver.
- simpl. iApply "HΦ". iPureIntro. lia.
Qed.

End parallel_add.

0 comments on commit 0848057

Please sign in to comment.