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
tlsomers
Actris
Commits
3448b201
Commit
3448b201
authored
4 years ago
by
Jonas Kastberg
Browse files
Options
Downloads
Patches
Plain Diff
Added an example of the recursive variant of the mapper client
parent
f3ad9e36
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theories/logrel/examples/mapper.v
+80
-8
80 additions, 8 deletions
theories/logrel/examples/mapper.v
with
80 additions
and
8 deletions
theories/logrel/examples/mapper.v
+
80
−
8
View file @
3448b201
...
@@ -5,17 +5,24 @@ From iris.proofmode Require Import tactics.
...
@@ -5,17 +5,24 @@ From iris.proofmode Require Import tactics.
Section
with_Σ
.
Section
with_Σ
.
Context
`{
heapG
Σ
,
chanG
Σ
}
.
Context
`{
heapG
Σ
,
chanG
Σ
}
.
Definition
mapper_client_type_aux
(
rec
:
lsty
Σ
)
:
lsty
Σ
:=
<!!>
TY
(
lty_int
⊸
lty_bool
);
<!!>
TY
lty_int
;
<
??
>
TY
lty_bool
;
rec
.
Definition
mapper_client_type
:
lsty
Σ
:=
Definition
mapper_client_type
:
lsty
Σ
:=
<!!>
TY
(
lty_int
⊸
lty_bool
);
<!!>
TY
lty_int
;
<
??
>
TY
lty_bool
;
END
.
mapper_client_type_aux
END
.
Definition
mapper_client
:
expr
:=
λ
:
"c"
,
Instance
mapper_client_type_contractive
:
Contractive
mapper_client_type_aux
.
let
:
"f"
:=
send
"c"
(
λ
:
"x"
,
#
9000
<
"x"
)
in
Proof
.
solve_proto_contractive
.
Qed
.
let
:
"v"
:=
send
"c"
#
42
in
recv
"c"
.
Definition
mapper_client_rec_type
:
lsty
Σ
:=
lty_rec
mapper_client_type_aux
.
Definition
mapper_service_type
:
lsty
Σ
:=
Definition
mapper_service_type
:
lsty
Σ
:=
<
??
>
TY
(
lty_int
⊸
lty_bool
);
<
??
>
TY
lty_int
;
<!!>
TY
lty_bool
;
END
.
<
??
>
TY
(
lty_int
⊸
lty_bool
);
<
??
>
TY
lty_int
;
<!!>
TY
lty_bool
;
END
.
Definition
mapper_client
:
expr
:=
λ
:
"c"
,
send
"c"
(
λ
:
"x"
,
#
9000
<
"x"
);;
send
"c"
#
42
;;
recv
"c"
.
Definition
mapper_service
:
expr
:=
λ
:
"c"
,
Definition
mapper_service
:
expr
:=
λ
:
"c"
,
let
:
"f"
:=
recv
"c"
in
let
:
"f"
:=
recv
"c"
in
let
:
"v"
:=
recv
"c"
in
let
:
"v"
:=
recv
"c"
in
...
@@ -39,10 +46,8 @@ Section with_Σ.
...
@@ -39,10 +46,8 @@ Section with_Σ.
rewrite
insert_insert
/=.
rewrite
insert_insert
/=.
iApply
ltyped_let
.
iApply
ltyped_let
.
{
iApply
ltyped_send
.
apply
lookup_insert
.
{
iApply
ltyped_send
.
apply
lookup_insert
.
rewrite
insert_commute
=>
//.
iApply
ltyped_int
.
}
iApply
ltyped_int
.
}
rewrite
insert_insert
/=
(
insert_commute
_
"v"
"c"
)
//.
rewrite
insert_insert
/=.
iApply
ltyped_recv
.
apply
lookup_insert
.
iApply
ltyped_recv
.
apply
lookup_insert
.
Qed
.
Qed
.
Lemma
mapper_service_typed
Γ
:
Lemma
mapper_service_typed
Γ
:
...
@@ -75,4 +80,71 @@ Section with_Σ.
...
@@ -75,4 +80,71 @@ Section with_Σ.
{
iApply
env_split_right
=>
//
;
last
by
iApply
env_split_id_r
.
eauto
.
}
{
iApply
env_split_right
=>
//
;
last
by
iApply
env_split_id_r
.
eauto
.
}
Qed
.
Qed
.
Definition
mapper_client_rec
:
expr
:=
λ
:
"c"
,
send
"c"
(
λ
:
"x"
,
#
9000
<
"x"
);;
send
"c"
#
42
;;
let
:
"x"
:=
recv
"c"
in
send
"c"
(
λ
:
"x"
,
#
4500
<
"x"
);;
send
"c"
#
20
;;
let
:
"y"
:=
recv
"c"
in
(
"x"
,
"y"
)
.
Lemma
lty_le_rec_unfold_l
{
k
}
(
C
:
lty
Σ
k
→
lty
Σ
k
)
`{
!
Contractive
C
}
:
⊢
lty_rec
C
<:
C
(
lty_rec
C
)
.
Proof
.
iApply
lty_le_l
.
iApply
lty_le_rec_unfold
.
iApply
lty_le_refl
.
Qed
.
Lemma
mapper_client_rec_typed
Γ
:
⊢
Γ
⊨
mapper_client_rec
:
(
lty_chan
(
mapper_client_rec_type
)
⊸
(
lty_bool
*
lty_bool
))
%
lty
⫤
Γ
.
Proof
.
iApply
(
ltyped_frame
_
_
_
_
Γ
)
.
{
iApply
env_split_id_l
.
}
2
:
{
iApply
env_split_id_l
.
}
iApply
(
ltyped_subsumption
_
_
_((
lty_chan
(
mapper_client_type_aux
(
mapper_client_type_aux
(
mapper_client_rec_type
))))
⊸
_))
.
{
iApply
lty_le_arr
.
-
iNext
.
iApply
lty_le_chan
.
iNext
.
iApply
lty_le_trans
.
iApply
lty_le_rec_unfold_l
.
do
3
iModIntro
.
iApply
lty_le_rec_unfold_l
.
-
iApply
lty_le_refl
.
}
iApply
ltyped_lam
.
iApply
ltyped_let
.
{
iApply
ltyped_send
.
apply
lookup_insert
.
iApply
(
ltyped_frame
_
_
_
_
{[
"c"
:=_]})
.
{
iApply
env_split_id_l
.
}
{
iApply
ltyped_lam
.
iApply
ltyped_bin_op
.
-
iApply
ltyped_var
.
apply
lookup_insert
.
-
iApply
ltyped_int
.
}
{
iApply
env_split_id_l
.
}
}
rewrite
insert_insert
/=.
iApply
ltyped_let
.
{
iApply
ltyped_send
.
apply
lookup_insert
.
iApply
ltyped_int
.
}
rewrite
insert_insert
/=.
iApply
ltyped_let
.
{
iApply
ltyped_recv
.
apply
lookup_insert
.
}
rewrite
insert_insert
/=.
rewrite
(
insert_commute
_
"x"
"c"
)
//.
iApply
ltyped_let
.
{
iApply
ltyped_send
.
apply
lookup_insert
.
iApply
(
ltyped_frame
_
_
_
_
(
<
[
"c"
:=_]
>
(
<
[
"x"
:=_]
>∅
)))
.
{
iApply
env_split_id_l
.
}
{
iApply
ltyped_lam
.
iApply
ltyped_bin_op
.
-
iApply
ltyped_var
.
apply
lookup_insert
.
-
iApply
ltyped_int
.
}
{
iApply
env_split_id_l
.
}
}
rewrite
insert_insert
/=.
iApply
ltyped_let
.
{
iApply
ltyped_send
.
apply
lookup_insert
.
iApply
ltyped_int
.
}
rewrite
insert_insert
/=.
iApply
ltyped_let
.
{
iApply
ltyped_recv
.
apply
lookup_insert
.
}
rewrite
insert_insert
/=.
iApply
ltyped_pair
.
-
iApply
ltyped_var
.
apply
lookup_insert
.
-
rewrite
(
insert_commute
_
"c"
"x"
)
//=
(
insert_commute
_
"y"
"x"
)
//=.
iApply
(
ltyped_frame
_
_
_
_
{[
"x"
:=_]})
.
{
iApply
env_split_right
=>
//=.
iApply
env_split_id_r
.
}
iApply
ltyped_var
.
apply
lookup_insert
.
iApply
env_split_right
=>
//
;
last
by
iApply
env_split_id_r
=>
//=.
eauto
.
Qed
.
End
with_Σ
.
End
with_Σ
.
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