Skip to content
Snippets Groups Projects
adequacy.v 1.27 KiB
Newer Older
From iris.algebra Require Import auth.
Ralf Jung's avatar
Ralf Jung committed
From iris.proofmode Require Import tactics.
From iris.program_logic Require Export weakestpre adequacy.
From iris.heap_lang Require Import proofmode notation.
Ralf Jung's avatar
Ralf Jung committed
From iris.prelude Require Import options.
Ralf Jung's avatar
Ralf Jung committed
Class heapPreG Σ := HeapPreG {
  heap_preG_iris :> invPreG Σ;
  heap_preG_heap :> gen_heapPreG loc (option val) Σ;
  heap_preG_inv_heap :> inv_heapPreG loc (option val) Σ;
  heap_preG_proph :> proph_mapPreG proph_id (val * val) Σ;
Definition heapΣ : gFunctors :=
  #[invΣ; gen_heapΣ loc (option val); inv_heapΣ loc (option val); proph_mapΣ proph_id (val * val)].
Global Instance subG_heapPreG {Σ} : subG heapΣ Σ  heapPreG Σ.
Definition heap_adequacy Σ `{!heapPreG Σ} s e σ φ :
Ralf Jung's avatar
Ralf Jung committed
  ( `{!heapG Σ},  inv_heap_inv -∗ WP e @ s;  {{ v, φ v }}) 
  adequate s e σ (λ v _, φ v).
  intros Hwp; eapply (wp_adequacy _ _); iIntros (? κs) "".
  iMod (gen_heap_init σ.(heap)) as (?) "[Hh _]".
  iMod (inv_heap_init loc (option val)) as (?) ">Hi".
  iMod (proph_map_init κs σ.(used_proph_id)) as (?) "Hp".
    (λ σ κs, (gen_heap_interp σ.(heap)  proph_map_interp κs σ.(used_proph_id))%I),
Ralf Jung's avatar
Ralf Jung committed
  iFrame. iApply (Hwp (HeapG _ _ _ _ _)). done.
Ralf Jung's avatar
Ralf Jung committed
Qed.