Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
c
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iris
c
Commits
84f6294f
Commit
84f6294f
authored
Feb 01, 2019
by
Dan Frumin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ccall'
parents
404b952d
7b4eb36f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
translation.v
theories/c_translation/translation.v
+32
-20
No files found.
theories/c_translation/translation.v
View file @
84f6294f
...
...
@@ -146,8 +146,10 @@ Notation "'λᶜ' x , e" := (c_fun (λ: x, e)%V)
Definition
c_call
:
val
:=
λ
:
"f"
"arg"
,
(* sequence point before a function call *)
"fa"
←ᶜ
(
"f"
|||
ᶜ
"arg"
);
ᶜ
c_atomic
(
λ
:
<>,
(
Fst
"fa"
)
(
Snd
"fa"
)).
"fa"
←ᶜ
(
"f"
|||
ᶜ
"arg"
)
;;
ᶜ
c_atomic
(
λ
:
<>,
c_atomic_env
mset_clear
;;
ᶜ
(
Fst
"fa"
)
(
Snd
"fa"
)).
Notation
"'callᶜ' f a"
:=
(
c_call
f
a
)%
E
(
at
level
10
,
f
,
a
at
level
9
,
...
...
@@ -382,23 +384,20 @@ Section proofs.
iIntros
(
v
).
iDestruct
1
as
(
cl
w
->)
"[H1 H2]"
;
eauto
with
iFrame
.
Qed
.
(*
Internal spec: breaks the abstraction/notation
*)
Lemma
cwp_
seq_bind'
R
Φ
e
(
f
:
val
)
:
CWP
e
@
R
{{
v
,
U
(
CWP
f
v
@
R
{{
Φ
}})
}}
-
∗
CWP
c_
seq_bind
e
f
@
R
{{
Φ
}}.
(*
* Helper lemma
*)
Lemma
cwp_
mset_clear
R
Φ
:
▷
U
(
Φ
#())
-
∗
CWP
c_
atomic_env
mset_clear
@
R
{{
Φ
}}.
Proof
.
iIntros
"H"
.
cwp_apply
(
cwp_wp
with
"H"
);
iIntros
(
v
)
"H"
.
cwp_lam
.
cwp_pures
.
iApply
cwp_bind
.
iApply
(
cwp_wand
with
"H"
).
iIntros
(
w
)
"H"
.
cwp_pures
.
iApply
cwp_bind
.
iApply
cwp_atomic_env
.
iIntros
(
env
)
"Henv $"
.
iApply
wp_fupd
.
iDestruct
"Henv"
as
(
X
σ
_)
"[Hlocks Hσ]"
.
iIntros
"HΦ"
.
iApply
cwp_atomic_env
.
iIntros
(
env
).
iDestruct
(
1
)
as
(
X
σ
_)
"[Hlocks Hσ]"
.
iIntros
"$"
.
iApply
wp_fupd
.
wp_apply
(
mset_clear_spec
with
"Hlocks"
);
iIntros
"Hlocks"
.
rewrite
U_eq
.
iDestruct
"H"
as
(
us
)
"[Hus H]"
.
rewrite
U_eq
.
iDestruct
"H
Φ
"
as
(
us
)
"[Hus H]"
.
iInduction
us
as
[|[
ul
[
uq
uv
]]
us
]
"IH"
using
gmultiset_ind
forall
(
σ
);
simpl
.
-
iModIntro
.
iSplitR
"H"
.
-
iModIntro
.
iSplitR
"H
Hus
"
.
+
iExists
∅
,
σ
.
by
iFrame
.
+
iNext
.
cwp_lam
.
by
iApply
"H"
.
+
iNext
.
by
iApply
"H"
.
-
iDestruct
"Hus"
as
"[Hu Hus]"
.
rewrite
!
big_sepMS_singleton
/=.
iDestruct
(
full_locking_heap_locked_present
with
"Hu Hσ"
)
as
%[
z
Hz
].
iMod
(
full_locking_heap_unlock
with
"Hσ Hu"
)
as
"[Hσ Hu]"
.
...
...
@@ -406,6 +405,18 @@ Section proofs.
iIntros
"Hus"
.
iApply
"H"
.
iFrame
.
by
rewrite
!
big_sepMS_singleton
/=.
Qed
.
(* Internal spec: breaks the abstraction/notation *)
Lemma
cwp_seq_bind'
R
Φ
e
(
f
:
val
)
:
CWP
e
@
R
{{
v
,
U
(
CWP
f
v
@
R
{{
Φ
}})
}}
-
∗
CWP
c_seq_bind
e
f
@
R
{{
Φ
}}.
Proof
.
iIntros
"H"
.
cwp_apply
(
cwp_wp
with
"H"
);
iIntros
(
v
)
"H"
.
cwp_lam
.
cwp_pures
.
iApply
cwp_bind
.
iApply
(
cwp_wand
with
"H"
).
iIntros
(
w
)
"H"
.
cwp_pures
.
iApply
cwp_bind
.
iApply
cwp_mset_clear
.
iNext
.
iModIntro
.
by
cwp_lam
.
Qed
.
Lemma
cwp_seq_bind
R
Φ
x
e1
e2
:
CWP
e1
@
R
{{
v
,
U
(
CWP
subst'
x
v
e2
@
R
{{
Φ
}})
}}
-
∗
CWP
x
←ᶜ
e1
;
ᶜ
e2
@
R
{{
Φ
}}.
...
...
@@ -535,11 +546,12 @@ Section proofs.
cwp_apply
(
cwp_wp
with
"H2"
);
iIntros
(
vf
)
"H2"
.
cwp_apply
(
cwp_wp
with
"H1"
);
iIntros
(
va
)
"H1"
.
cwp_lam
.
cwp_pures
.
iApply
cwp_seq_bind'
.
iApply
(
cwp_par
with
"H1 H2"
).
iIntros
"!>"
(
f
a
)
"H1 H2 !>"
.
iSpecialize
(
"H"
with
"H1 H2"
);
iModIntro
.
cwp_pures
.
iApply
cwp_atomic
.
iIntros
"HR"
.
iSpecialize
(
"H"
with
"HR"
).
iExists
True
%
I
.
iModIntro
;
iSplit
;
first
done
.
cwp_pures
.
iApply
cwp_bind
.
iApply
(
cwp_par
with
"H1 H2"
).
iIntros
"!>"
(
f
a
)
"H1 H2 !>"
.
iSpecialize
(
"H"
with
"H1 H2"
).
cwp_pures
.
iApply
cwp_atomic
.
iIntros
"HR"
.
iNext
.
iExists
True
%
I
.
iSplitR
;
first
done
.
cwp_pures
.
iApply
cwp_bind
.
iApply
cwp_mset_clear
.
iNext
.
iModIntro
.
iSpecialize
(
"H"
with
"HR"
).
cwp_pures
.
iApply
(
cwp_wand
with
"H"
);
eauto
.
Qed
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment