Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Actris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Thomas Somers
Actris
Commits
de0c3041
Commit
de0c3041
authored
6 years ago
by
Jonas Kastberg Hinrichsen
Browse files
Options
Downloads
Patches
Plain Diff
Minor updates and added small examples
parent
79409543
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
theories/channel.v
+1
-0
1 addition, 0 deletions
theories/channel.v
theories/examples.v
+106
-0
106 additions, 0 deletions
theories/examples.v
theories/logrel.v
+1
-1
1 addition, 1 deletion
theories/logrel.v
with
108 additions
and
1 deletion
theories/channel.v
+
1
−
0
View file @
de0c3041
...
@@ -20,6 +20,7 @@ Definition new_chan : val :=
...
@@ -20,6 +20,7 @@ Definition new_chan : val :=
Coercion
side_to_bool
(
s
:
side
)
:
bool
:=
Coercion
side_to_bool
(
s
:
side
)
:
bool
:=
match
s
with
Left
=>
true
|
Right
=>
false
end
.
match
s
with
Left
=>
true
|
Right
=>
false
end
.
Arguments
side_to_bool
:
simpl
never
.
Definition
side_elim
{
A
}
(
s
:
side
)
(
l
r
:
A
)
:
A
:=
Definition
side_elim
{
A
}
(
s
:
side
)
(
l
r
:
A
)
:
A
:=
match
s
with
Left
=>
l
|
Right
=>
r
end
.
match
s
with
Left
=>
l
|
Right
=>
r
end
.
...
...
This diff is collapsed.
Click to expand it.
theories/examples.v
0 → 100644
+
106
−
0
View file @
de0c3041
From
iris
.
proofmode
Require
Import
tactics
.
From
iris
.
program_logic
Require
Export
weakestpre
.
From
iris
.
heap_lang
Require
Import
proofmode
notation
.
From
osiris
Require
Import
typing
channel
logrel
.
From
iris
.
algebra
Require
Import
list
auth
excl
.
From
iris
.
base_logic
Require
Import
invariants
.
Section
Examples
.
Context
`{
!
heapG
Σ
}
(
N
:
namespace
)
.
Context
`{
!
logrelG
Σ
}
.
Definition
seq_example
:
expr
:=
(
let
:
"c"
:=
new_chan
#
()
in
send
"c"
#
Left
#
5
;;
recv
"c"
#
Right
)
%
E
.
Notation
"⟦ c @ s : sτ ⟧{ γ }"
:=
(
interp_st
N
γ
sτ
c
s
)
(
at
level
10
,
s
at
next
level
,
sτ
at
next
level
,
γ
at
next
level
,
format
"⟦ c @ s : sτ ⟧{ γ }"
)
.
Lemma
seq_proof
:
{{{
True
}}}
seq_example
{{{
v
,
RET
v
;
⌜
v
=
#
5
⌝
}}}
.
Proof
.
iIntros
(
Φ
H
)
"HΦ"
.
rewrite
/
seq_example
.
wp_bind
(
new_chan
_)
.
wp_apply
(
new_chan_st_spec
N
(
TSR
Send
(
λ
v
,
⌜
v
=
#
5
⌝%
I
)
(
λ
v
,
TEnd
)))=>
//.
iIntros
(
c
γ
)
"[Hstl Hstr]"
=>
/=.
wp_pures
.
wp_bind
(
send
_
_
_)
.
wp_apply
(
send_st_spec
N
with
"[Hstl]"
)
.
by
iFrame
.
iIntros
"Hstl"
.
wp_pures
.
wp_apply
(
recv_st_spec
_
with
"[Hstr]"
)
.
by
iFrame
.
iIntros
(
v
)
"[Hstr HP]"
.
by
iApply
"HΦ"
.
Qed
.
Definition
par_example
:
expr
:=
(
let
:
"c"
:=
new_chan
#
()
in
Fork
(
send
"c"
#
Left
#
5
);;
recv
"c"
#
Right
)
%
E
.
Lemma
par_proof
:
{{{
True
}}}
par_example
{{{
v
,
RET
v
;
⌜
v
=
#
5
⌝
}}}
.
Proof
.
iIntros
(
Φ
H
)
"HΦ"
.
rewrite
/
par_example
.
wp_bind
(
new_chan
_)
.
wp_apply
(
new_chan_st_spec
N
(
TSR
Send
(
λ
v
,
⌜
v
=
#
5
⌝%
I
)
(
λ
v
,
TEnd
)))=>
//.
iIntros
(
c
γ
)
"[Hstl Hstr]"
=>
/=.
wp_pures
.
wp_bind
(
Fork
_)
.
wp_apply
(
wp_fork
with
"[Hstl]"
)
.
-
iNext
.
wp_apply
(
send_st_spec
N
with
"[Hstl]"
)
.
by
iFrame
.
eauto
.
-
wp_apply
(
recv_st_spec
_
with
"[Hstr]"
)
.
by
iFrame
.
iIntros
(
v
)
"[Hstr HP]"
.
by
iApply
"HΦ"
.
Qed
.
Definition
par_2_example
:
expr
:=
(
let
:
"c"
:=
new_chan
#
()
in
Fork
(
let
:
"v"
:=
recv
"c"
#
Right
in
send
"c"
#
Right
(
"v"
+#
2
));;
send
"c"
#
Left
#
5
;;
recv
"c"
#
Left
)
%
E
.
Lemma
par_2_proof
:
{{{
True
}}}
par_2_example
{{{
v
,
RET
v
;
∃
w
,
⌜
v
=
LitV
$
LitInt
$
w
∧
w
>=
7
⌝
}}}
.
Proof
.
iIntros
(
Φ
H
)
"HΦ"
.
rewrite
/
par_2_example
.
wp_bind
(
new_chan
_)
.
wp_apply
(
new_chan_st_spec
N
(
TSR
Send
(
λ
v
,
⌜
v
=
#
5
⌝%
I
)
(
λ
v
,
TSR
Receive
(
λ
v'
,
(
∃
w
,
⌜
v
=
LitV
$
LitInt
$
w
⌝
∧
∃
w'
,
⌜
v'
=
LitV
$
LitInt
$
w'
∧
w'
>=
w
+
2
⌝
)
%
I
)
(
λ
v'
,
TEnd
))))=>
//.
iIntros
(
c
γ
)
"[Hstl Hstr]"
=>
/=.
wp_pures
.
wp_bind
(
Fork
_)
.
wp_apply
(
wp_fork
with
"[Hstr]"
)
.
-
iNext
.
wp_apply
(
recv_st_spec
_
with
"[Hstr]"
)
.
by
iFrame
.
iIntros
(
v
)
"[Hstr HP]"
.
wp_pures
.
iDestruct
"HP"
as
%->
.
wp_apply
(
send_st_spec
N
with
"[Hstr]"
)
.
iFrame
.
iExists
_
.
iSplit
=>
//.
iExists
_
.
iSplit
=>
//.
eauto
.
-
wp_apply
(
send_st_spec
_
with
"[Hstl]"
)
.
by
iFrame
.
iIntros
"Hstl"
.
wp_apply
(
recv_st_spec
_
with
"[Hstl]"
)
.
by
iFrame
.
iIntros
(
v
)
"[Hstl HP]"
.
iApply
"HΦ"
.
iDestruct
"HP"
as
%
[
w
[
HP
[
w'
[
HQ
HQ'
]]]]
.
iExists
_
.
iSplit
=>
//.
iPureIntro
.
inversion
HP
.
rewrite
-
H1
in
HQ'
.
eauto
.
Qed
.
End
Examples
.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
theories/logrel.v
+
1
−
1
View file @
de0c3041
...
@@ -18,7 +18,7 @@ Instance subG_chanΣ {Σ} : subG logrelΣ Σ → logrelG Σ.
...
@@ -18,7 +18,7 @@ Instance subG_chanΣ {Σ} : subG logrelΣ Σ → logrelG Σ.
Proof
.
intros
[??
%
subG_auth_exclG
]
%
subG_inv
.
constructor
;
apply
_
.
Qed
.
Proof
.
intros
[??
%
subG_auth_exclG
]
%
subG_inv
.
constructor
;
apply
_
.
Qed
.
Section
logrel
.
Section
logrel
.
Context
`{
!
heapG
Σ
,
!
lockG
Σ
}
(
N
:
namespace
)
.
Context
`{
!
heapG
Σ
}
(
N
:
namespace
)
.
Context
`{
!
logrelG
Σ
}
.
Context
`{
!
logrelG
Σ
}
.
Notation
stype_iprop
:=
(
@
stypeC
(
laterC
(
iProp
Σ
)))
.
Notation
stype_iprop
:=
(
@
stypeC
(
laterC
(
iProp
Σ
)))
.
...
...
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