Commit 36f0e548 authored by Ralf Jung's avatar Ralf Jung

Merge branch 'master' into 'master'

Master

See merge request iris/examples!13
parents 73e3afad 14821493
Pipeline #15272 passed with stage
in 6 minutes and 25 seconds
......@@ -23,11 +23,11 @@ theories/spanning_tree/mon.v
theories/spanning_tree/spanning.v
theories/spanning_tree/proof.v
theories/concurrent_stacks/specs.v
theories/concurrent_stacks/concurrent_stack1.v
#theories/concurrent_stacks/concurrent_stack2.v
theories/concurrent_stacks/concurrent_stack2.v
theories/concurrent_stacks/concurrent_stack3.v
#theories/concurrent_stacks/concurrent_stack4.v
theories/concurrent_stacks/spec.v
theories/concurrent_stacks/concurrent_stack4.v
theories/logrel/prelude/base.v
theories/logrel/stlc/lang.v
......
From stdpp Require Import namespaces.
From iris.program_logic Require Export weakestpre.
From iris.heap_lang Require Export proofmode notation.
(** General (HoCAP-style) spec for a concurrent bag ("per-elemt spec") *)
Record concurrent_bag {Σ} `{!heapG Σ} := ConcurrentBag {
mk_bag : val;
mk_bag_spec (N : namespace) (P : val iProp Σ) :
{{{ True }}}
mk_bag #()
{{{ (f f : val), RET (f, f);
( WP f #() {{ v, ( (v' : val), v SOMEV v' P v') v NONEV }})
( (v : val), (P v - WP f v {{ v, True }}))
}}}
}.
Arguments concurrent_bag _ {_}.
(** General (HoCAP-style) spec for a concurrent stack *)
Record concurrent_stack {Σ} `{!heapG Σ} := ConcurrentStack {
mk_stack : val;
mk_stack_spec (N : namespace) (P : list val iProp Σ)
(Q : val iProp Σ) (Q' Q'' : iProp Σ) :
{{{ P [] }}}
mk_stack #()
{{{ (f f : val), RET (f, f);
( ( ( v vs, P (v :: vs) ={ N}= Q v P vs)
(P [] ={ N}= Q' P []) -
WP f #() {{ v, ( (v' : val), v SOMEV v' Q v') (v NONEV Q')}}))
( (v : val),
(( vs, P vs ={ N}= P (v :: vs) Q'') - WP f v {{ v, Q'' }}))
}}}
}.
Arguments concurrent_stack _ {_}.
From stdpp Require Import namespaces.
From iris.program_logic Require Export weakestpre.
From iris.heap_lang Require Export proofmode notation.
(** General (HoCAP-style) spec for a concurrent bag ("per-elemt spec") *)
Record concurrent_bag {Σ} `{!heapG Σ} := ConcurrentBag {
is_bag (P : val iProp Σ) (s : val) : iProp Σ;
bag_pers (P : val iProp Σ) (s : val) : Persistent (is_bag P s);
new_bag : val;
bag_push : val;
bag_pop : val;
mk_bag_spec (P : val iProp Σ) :
{{{ True }}}
new_bag #()
{{{ s, RET s; is_bag P s }}};
bag_push_spec (P : val iProp Σ) s v :
{{{ is_bag P s P v }}} bag_push s v {{{ RET #(); True }}};
bag_pop_spec (P : val iProp Σ) s :
{{{ is_bag P s }}} bag_pop s {{{ ov, RET ov; ov = NONEV v, ov = SOMEV v P v }}}
}.
Arguments concurrent_bag _ {_}.
(** General (CAP-style) spec for a concurrent stack *)
Record concurrent_stack {Σ} `{!heapG Σ} := ConcurrentStack {
is_stack (N : namespace) (P : list val iProp Σ) (s : val) : iProp Σ;
stack_pers (N : namespace) (P : list val iProp Σ) (s : val) : Persistent (is_stack N P s);
new_stack : val;
stack_push : val;
stack_pop : val;
new_stack_spec (N : namespace) (P : list val iProp Σ) :
{{{ P [] }}} new_stack #() {{{ v, RET v; is_stack N P v }}};
stack_push_spec (N : namespace) (P : list val iProp Σ) (Ψ : val iProp Σ) s v :
{{{ is_stack N P s xs, P xs ={ N}= P (v :: xs) Ψ #()}}}
stack_push s v
{{{ RET #(); Ψ #() }}};
stack_pop_spec (N : namespace) (P : list val iProp Σ) Ψ s :
{{{ is_stack N P s
( v xs, P (v :: xs) ={ N}= P xs Ψ (SOMEV v))
(P [] ={ N}= P [] Ψ NONEV) }}}
stack_pop s
{{{ v, RET v; Ψ v }}};
}.
Arguments concurrent_stack _ {_}.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment