adequacy.v 996 Bytes
Newer Older
1
From iris.program_logic Require Export weakestpre adequacy gen_heap.
Ralf Jung's avatar
Ralf Jung committed
2
From iris.heap_lang Require Export op_rules.
3
From iris.algebra Require Import auth.
4
From iris.heap_lang Require Import proofmode notation.
5
From iris.proofmode Require Import tactics.
6

7
Class heapPreG Σ := HeapPreG {
8
  heap_preG_iris :> invPreG Σ;
9
  heap_preG_heap :> gen_heapPreG loc val Σ
10
}.
11

12
Definition heapΣ : gFunctors := #[invΣ; gen_heapΣ loc val].
13
Instance subG_heapPreG {Σ} : subG heapΣ Σ  heapPreG Σ.
14
Proof. intros [? ?]%subG_inv; split; apply _. Qed.
15 16

Definition heap_adequacy Σ `{heapPreG Σ} e σ φ :
17
  ( `{heapG Σ}, True  WP e {{ v, ⌜φ v }}) 
18 19
  adequate e σ φ.
Proof.
20
  intros Hwp; eapply (wp_adequacy _ _); iIntros (?) "".
21 22 23
  iMod (own_alloc ( to_gen_heap σ)) as (γ) "Hh".
  { apply: auth_auth_valid. exact: to_gen_heap_valid. }
  iModIntro. iExists (λ σ, own γ ( to_gen_heap σ)); iFrame.
Ralf Jung's avatar
Ralf Jung committed
24
  set (Hheap := GenHeapG loc val Σ _ _ _ γ).
25
  iApply (Hwp (HeapG _ _ _)).
Ralf Jung's avatar
Ralf Jung committed
26
Qed.