specification.v 1.18 KB
Newer Older
1
From iris.program_logic Require Export hoare.
Ralf Jung's avatar
Ralf Jung committed
2 3
From iris.heap_lang.lib.barrier Require Export barrier.
From iris.heap_lang.lib.barrier Require Import proof.
Robbert Krebbers's avatar
Robbert Krebbers committed
4
From iris.heap_lang Require Import proofmode.
5
Set Default Proof Using "Type".
6 7 8
Import uPred.

Section spec.
9 10
Set Default Proof Using "Type*".
Context `{!heapG Σ, !barrierG Σ}.
11

12
Lemma barrier_spec (N : namespace) :
13
   recv send : loc  iProp Σ -n> iProp Σ,
14
    ( P, {{ True }} newbarrier #()
Ralf Jung's avatar
Ralf Jung committed
15
                     {{ v,  l : loc, v = #l  recv l P  send l P }}) 
16
    ( l P, {{ send l P  P }} signal #l {{ _, True }}) 
17
    ( l P, {{ recv l P }} wait #l {{ _, P }}) 
18
    ( l P Q, recv l (P  Q) ={N}=> recv l P  recv l Q) 
19
    ( l P Q, (P - Q) - recv l P - recv l Q).
20
Proof.
21
  exists (λ l, CofeMor (recv N l)), (λ l, CofeMor (send N l)).
22
  split_and?; simpl.
23
  - iIntros (P) "!# _". iApply (newbarrier_spec _ P with "[]"); [done..|].
Ralf Jung's avatar
Ralf Jung committed
24 25 26
    iNext. eauto.
  - iIntros (l P) "!# [Hl HP]". iApply (signal_spec with "[$Hl $HP]"). by eauto.
  - iIntros (l P) "!# Hl". iApply (wait_spec with "Hl"). eauto.
27
  - iIntros (l P Q) "!#". by iApply recv_split.
Robbert Krebbers's avatar
Robbert Krebbers committed
28
  - apply recv_weaken.
29 30
Qed.
End spec.