Fine-grained post-conditions for forked-off threads.
This commit extends the state interpretation with an additional parameter to talk about the number of forked-off threads, and a fixed postcondition for each forked-off thread: state_interp : Λstate → list Λobservation → nat → iProp Σ; fork_post : iProp Σ; This way, instead of having `True` as the post-condition of `Fork`, one can have any post-condition, which is then recorded in the state interpretation. The point of keeping track of the postconditions of forked-off threads, is that we get an (additional) stronger adequacy theorem: Theorem wp_strong_all_adequacy Σ Λ `{invPreG Σ} s e σ1 v vs σ2 φ : (∀ `{Hinv : invG Σ} κs, (|={⊤}=> ∃ (stateI : state Λ → list (observation Λ) → nat → iProp Σ) (fork_post : iProp Σ), let _ : irisG Λ Σ := IrisG _ _ _ Hinv stateI fork_post in stateI σ1 κs 0 ∗ WP e @ s; ⊤ {{ v, let m := length vs in stateI σ2 [] m -∗ [∗] replicate m fork_post ={⊤,∅}=∗ ⌜ φ v ⌝ }})%I) → rtc erased_step ([e], σ1) (of_val <$> v :: vs, σ2) → φ v. The difference with the ordinary adequacy theorem is that this one only applies once all threads terminated. In this case, one gets back the post-conditions `[∗] replicate m fork_post` of all forked-off threads. In Iron we showed that we can use this mechanism to make sure that all resources are disposed of properly in the presence of fork-based concurrency.
Showing
- theories/heap_lang/lifting.v 20 additions, 20 deletionstheories/heap_lang/lifting.v
- theories/heap_lang/total_adequacy.v 3 additions, 1 deletiontheories/heap_lang/total_adequacy.v
- theories/program_logic/adequacy.v 147 additions, 81 deletionstheories/program_logic/adequacy.v
- theories/program_logic/ectx_lifting.v 41 additions, 33 deletionstheories/program_logic/ectx_lifting.v
- theories/program_logic/lifting.v 69 additions, 30 deletionstheories/program_logic/lifting.v
- theories/program_logic/ownp.v 14 additions, 16 deletionstheories/program_logic/ownp.v
- theories/program_logic/total_adequacy.v 36 additions, 29 deletionstheories/program_logic/total_adequacy.v
- theories/program_logic/total_ectx_lifting.v 37 additions, 19 deletionstheories/program_logic/total_ectx_lifting.v
- theories/program_logic/total_lifting.v 54 additions, 17 deletionstheories/program_logic/total_lifting.v
- theories/program_logic/total_weakestpre.v 35 additions, 30 deletionstheories/program_logic/total_weakestpre.v
- theories/program_logic/weakestpre.v 35 additions, 23 deletionstheories/program_logic/weakestpre.v
Loading
Please register or sign in to comment