Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Abel Nieto
Iris
Commits
abd4de45
Commit
abd4de45
authored
7 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
define logically atomic heap and instantiate it with physical heap
parent
75c98fae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
_CoqProject
+1
-0
1 addition, 0 deletions
_CoqProject
theories/heap_lang/lib/atomic_heap.v
+81
-0
81 additions, 0 deletions
theories/heap_lang/lib/atomic_heap.v
theories/program_logic/atomic.v
+2
-2
2 additions, 2 deletions
theories/program_logic/atomic.v
with
84 additions
and
2 deletions
_CoqProject
+
1
−
0
View file @
abd4de45
...
...
@@ -85,6 +85,7 @@ theories/heap_lang/lib/lock.v
theories/heap_lang/lib/spin_lock.v
theories/heap_lang/lib/ticket_lock.v
theories/heap_lang/lib/counter.v
theories/heap_lang/lib/atomic_heap.v
theories/heap_lang/proofmode.v
theories/heap_lang/adequacy.v
theories/heap_lang/total_adequacy.v
...
...
This diff is collapsed.
Click to expand it.
theories/heap_lang/lib/atomic_heap.v
0 → 100644
+
81
−
0
View file @
abd4de45
From
iris
.
heap_lang
Require
Export
lifting
notation
.
From
iris
.
base_logic
.
lib
Require
Export
invariants
.
From
iris
.
program_logic
Require
Export
atomic
.
From
iris
.
proofmode
Require
Import
tactics
.
From
iris
.
heap_lang
Require
Import
proofmode
notation
.
Set
Default
Proof
Using
"Type"
.
(** A general logically atomic interface for a heap. *)
Structure
atomic_heap
Σ
`{
!
heapG
Σ
}
:=
AtomicHeap
{
(* -- operations -- *)
alloc
:
val
;
load
:
val
;
store
:
val
;
(* -- predicates -- *)
(* name is used to associate locked with is_lock *)
mapsto
(
l
:
loc
)
(
q
:
Qp
)
(
v
:
val
)
:
iProp
Σ
;
(* -- general properties -- *)
mapsto_timeless
l
q
v
:
Timeless
(
mapsto
l
q
v
);
(* -- operation specs -- *)
alloc_spec
v
:
{{{
True
}}}
alloc
v
{{{
l
,
RET
#
l
;
mapsto
l
1
v
}}};
load_spec
(
l
:
loc
)
:
atomic_wp
(
load
#
l
)
%
E
(
λ
'
(
v
,
q
),
mapsto
l
q
v
)
(
λ
'
(
v
,
q
)
(_:()),
mapsto
l
q
v
)
⊤
∅
(
λ
'
(
v
,
q
)
_,
v
);
store_spec
(
l
:
loc
)
(
w
:
val
)
:
atomic_wp
(
store
(
#
l
,
w
))
%
E
(
λ
v
,
mapsto
l
1
v
)
(
λ
v
(_:()),
mapsto
l
1
w
)
⊤
∅
(
λ
_
_,
#
()
%
V
);
}
.
(** Proof that the primitive physical operations of heap_lang satisfy said interface. *)
Definition
primitive_alloc
:
val
:=
λ
:
"v"
,
ref
"v"
.
Definition
primitive_load
:
val
:=
λ
:
"l"
,
!
"l"
.
Definition
primitive_store
:
val
:=
λ
:
"p"
,
(
Fst
"p"
)
<-
(
Snd
"p"
)
.
Section
proof
.
Context
`{
!
heapG
Σ
}
.
Lemma
primitive_alloc_spec
v
:
{{{
True
}}}
primitive_alloc
v
{{{
l
,
RET
#
l
;
l
↦
v
}}}
.
Proof
.
iIntros
(
Φ
)
"_ HΦ"
.
wp_let
.
wp_alloc
l
.
iApply
"HΦ"
.
done
.
Qed
.
Lemma
primitive_load_spec
(
l
:
loc
)
:
atomic_wp
(
primitive_load
#
l
)
%
E
(
λ
'
(
v
,
q
),
l
↦
{
q
}
v
)
%
I
(
λ
'
(
v
,
q
)
(_:()),
l
↦
{
q
}
v
)
%
I
⊤
∅
(
λ
'
(
v
,
q
)
_,
v
)
.
Proof
.
iIntros
(
Φ
)
"Aupd"
.
wp_let
.
iMod
(
aupd_acc
with
"Aupd"
)
as
((
v
,
q
))
"[H↦ [_ Hclose]]"
;
first
solve_ndisj
.
wp_load
.
iMod
(
"Hclose"
$!
()
with
"H↦"
)
.
done
.
Qed
.
Lemma
primitive_store_spec
(
l
:
loc
)
(
w
:
val
)
:
atomic_wp
(
primitive_store
(
#
l
,
w
))
%
E
(
λ
v
,
l
↦
v
)
%
I
(
λ
v
(_:()),
l
↦
w
)
%
I
⊤
∅
(
λ
_
_,
#
()
%
V
)
.
Proof
.
iIntros
(
Φ
)
"Aupd"
.
wp_let
.
wp_proj
.
wp_proj
.
iMod
(
aupd_acc
with
"Aupd"
)
as
(
v
)
"[H↦ [_ Hclose]]"
;
first
solve_ndisj
.
wp_store
.
iMod
(
"Hclose"
$!
()
with
"H↦"
)
.
done
.
Qed
.
Definition
primitive_atomic_heap
:
atomic_heap
Σ
:=
{|
alloc_spec
:=
primitive_alloc_spec
;
load_spec
:=
primitive_load_spec
;
store_spec
:=
primitive_store_spec
|}
.
End
proof
.
This diff is collapsed.
Click to expand it.
theories/program_logic/atomic.v
+
2
−
2
View file @
abd4de45
From
iris
.
program_logic
Require
Export
weakestpre
.
From
iris
.
proofmode
Require
Import
tactics
classes
.
From
iris
.
bi
.
lib
Require
Im
port
atomic
.
From
iris
.
bi
.
lib
Require
Ex
port
atomic
.
Set
Default
Proof
Using
"Type"
.
Definition
atomic_wp
`{
irisG
Λ
Σ
}
{
A
B
:
Type
}
...
...
@@ -13,4 +13,4 @@ Definition atomic_wp `{irisG Λ Σ} {A B : Type}
(
∀
Φ
,
atomic_update
α
β
Eo
Em
(
λ
x
y
,
Φ
(
f
x
y
))
-∗
WP
e
{{
Φ
}})
%
I
.
(* Note: To add a private postcondition, use
atomic_
shift
α β Eo Em (λ x y, POST x y -∗ Φ (f x y)) *)
atomic_
update
α β Eo Em (λ x y, POST x y -∗ Φ (f x y)) *)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment