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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Dan Frumin
Actris
Commits
dc4049c4
Commit
dc4049c4
authored
4 years ago
by
Jonas Kastberg
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned up examples and added lob recursion example
parent
0b053008
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
theories/examples/basics.v
+3
-3
3 additions, 3 deletions
theories/examples/basics.v
theories/examples/subprotocols.v
+32
-49
32 additions, 49 deletions
theories/examples/subprotocols.v
with
35 additions
and
52 deletions
theories/examples/basics.v
+
3
−
3
View file @
dc4049c4
...
...
@@ -88,8 +88,8 @@ Definition prog_swap : val := λ: <>,
let
:
"c"
:=
start_chan
(
λ
:
"c'"
,
send
"c'"
#
20
;;
let
:
"y"
:=
recv
"c'"
in
send
"c'"
"y"
)
in
send
"c"
#
2
2
;;
send
"c'"
(
"y"
+
#
2
)
)
in
send
"c"
#
2
0
;;
recv
"c"
+
recv
"c"
.
Definition
prog_swap_twice
:
val
:=
λ
:
<>
,
...
...
@@ -189,7 +189,7 @@ Fixpoint prot_lock (n : nat) : iProto Σ :=
Definition
prot_swap
:
iProto
Σ
:=
(
<!
(
x
:
Z
)
>
MSG
#
x
;
<
?
>
MSG
#
20
;
<
?
>
MSG
#
x
;
END
)
%
proto
.
<
?
>
MSG
#
(
x
+
2
)
;
END
)
%
proto
.
Definition
prot_swap_twice
:
iProto
Σ
:=
(
<!
(
x
:
Z
)
>
MSG
#
x
;
...
...
This diff is collapsed.
Click to expand it.
theories/examples/subprotocols.v
+
32
−
49
View file @
dc4049c4
From
actris
.
channel
Require
Import
proofmode
proto
channel
.
From
iris
.
proofmode
Require
Import
tactics
.
From
actris
.
utils
Require
Import
llist
.
From
actris
.
examples
Require
Import
swap_mapper
.
Section
basics
.
Section
subprotocol_
basics
.
Context
`{
heapG
Σ
,
chanG
Σ
}
.
Lemma
reference_example
(
l
2
'
:
loc
)
:
l
2
'
↦
#
2
2
-∗
Lemma
reference_example
(
l
1
'
:
loc
)
:
l
1
'
↦
#
2
0
-∗
(
<!
(
l1
l2
:
loc
)
>
MSG
(
#
l1
,
#
l2
)
{{
l1
↦
#
20
∗
l2
↦
#
22
}};
END
)
⊑
(
<!
(
l
1
:
loc
)
>
MSG
(
#
l1
,
#
l2
'
)
{{
l
1
↦
#
2
0
}};
END
)
.
Proof
.
iIntros
"Hl
2
'"
(
l
1
)
"Hl
1
"
.
iExists
l1
,
l2
'
.
by
iFrame
"Hl1 Hl2
'
"
.
Qed
.
(
<!
(
l
2
:
loc
)
>
MSG
(
#
l1
'
,
#
l2
)
{{
l
2
↦
#
2
2
}};
END
)
.
Proof
.
iIntros
"Hl
1
'"
(
l
2
)
"Hl
2
"
.
iExists
l1
'
,
l2
.
by
iFrame
"Hl1
'
Hl2"
.
Qed
.
Lemma
framing_example
(
P
Q
R
:
iProp
Σ
)
(
v
w
:
val
)
:
⊢
((
<!>
MSG
v
{{
P
}}
;
<
?
>
MSG
w
{{
Q
}};
END
)
%
proto
⊑
...
...
@@ -20,49 +18,34 @@ Section basics.
iIntros
"HQ"
.
iFrame
"HQ HR"
.
eauto
.
Qed
.
Section
program_reuse
.
Context
{
T
U
R
:
Type
}
.
Context
(
IT
:
T
->
val
->
iProp
Σ
)
.
Context
(
ITR
:
(
T
*
R
)
->
val
->
iProp
Σ
)
.
Context
(
IU
:
U
->
val
->
iProp
Σ
)
.
Context
(
IUR
:
(
U
*
R
)
->
val
->
iProp
Σ
)
.
Context
(
IR
:
R
->
iProp
Σ
)
.
Context
(
f
:
T
->
U
)
.
Definition
prot1_aux
(
prot
:
iProto
Σ
)
:
iProto
Σ
:=
(
<!
(
x
:
Z
)
>
MSG
#
x
;
<
?
>
MSG
#
(
x
+
2
)
;
prot
)
%
proto
.
Definition
prot2_aux
(
prot
:
iProto
Σ
)
:
iProto
Σ
:=
(
<!
(
x
:
Z
)
>
MSG
#
x
;
<!
(
y
:
Z
)
>
MSG
#
y
;
<
?
>
MSG
#
(
x
+
2
)
;
<
?
>
MSG
#
(
y
+
2
)
;
prot
)
%
proto
.
Axiom
HIT
:
∀
v
t
r
,
ITR
(
t
,
r
)
v
-∗
IT
t
v
∗
IR
r
.
Axiom
HIU
:
∀
v
u
r
,
(
IU
u
v
∗
IR
r
)
-∗
IUR
(
u
,
r
)
v
.
Instance
prot1_aux_contractive
:
Contractive
prot1_aux
.
Proof
.
solve_proto_contractive
.
Qed
.
Instance
prot2_aux_contractive
:
Contractive
prot2_aux
.
Proof
.
solve_proto_contractive
.
Qed
.
Lemma
example
prot
prot'
:
▷
(
prot
⊑
prot'
)
-∗
(
<!
(
x
:
T
)
(
v
:
val
)
>
MSG
v
{{
IT
x
v
}};
<
?
(
w
:
val
)
>
MSG
w
{{
IU
(
f
x
)
w
}};
prot
)
⊑
(
<!
(
x
:
T
*
R
)
(
v
:
val
)
>
MSG
v
{{
ITR
x
v
}};
<
?
(
w
:
val
)
>
MSG
w
{{
IUR
(
f
x
.
1
,
x
.
2
)
w
}};
prot'
)
.
Proof
.
iIntros
"Hprot"
.
iIntros
([
t
r
]
v
)
"HTR"
.
iDestruct
(
HIT
with
"HTR"
)
as
"[HT HR]"
.
iExists
t
,
v
.
iFrame
"HT"
.
iModIntro
.
iIntros
(
w
)
"HU"
.
iDestruct
(
HIU
with
"[$HR $HU]"
)
as
"HUR"
.
iExists
w
.
iFrame
"HUR"
.
iModIntro
.
iApply
"Hprot"
.
Qed
.
Definition
prot1
:
iProto
Σ
:=
fixpoint
prot1_aux
.
Definition
prot2
:
iProto
Σ
:=
fixpoint
prot2_aux
.
Lemma
mapper_prot_reuse
_example
:
⊢
mapper_prot
IT
IU
f
⊑
mapper_prot
ITR
IUR
(
λ
tr
,
(
f
tr
.
1
,
tr
.
2
))
.
Proof
.
iLöb
as
"IH"
.
iEval
(
rewrite
/
mapper_
prot
)
.
rewrite
(
fixpoint_unfold
(
mapper_
prot_aux
IT
_
_)
)
.
rewrite
(
fixpoint_unfold
(
mapper_
prot_aux
ITR
_
_)
)
.
rewrite
{
1
3
}
/
mapper_prot_aux
.
rewrite
/
iProto_choice
.
iIntros
(
b
)
.
iExists
(
b
)
.
destruct
b
=>
//.
iModIntro
.
iApply
example
.
iApply
"IH"
.
Qed
.
End
program_reuse
.
Lemma
nonstructural_recursion
_example
:
⊢
prot1
⊑
prot2
.
Proof
.
iLöb
as
"IH"
.
iEval
(
rewrite
/
prot1
/
prot
2
)
.
do
2
rewrite
(
fixpoint_unfold
prot
1
_aux
)
.
rewrite
(
fixpoint_unfold
prot
2
_aux
)
.
iIntros
(
x
)
.
iExists
x
.
iModIntro
.
iIntros
(
y
)
.
iApply
(
iProto_le_trans
)
.
{
iModIntro
.
iExists
y
.
iApply
iProto_le_refl
.
}
iApply
iProto_le_trans
;
[
iApply
iProto_le_base_swap
|
]
.
iModIntro
.
iModIntro
.
iModIntro
.
iApply
"IH"
.
Qed
.
End
basics
.
End
subprotocol_
basics
.
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