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
fdc2775d
Commit
fdc2775d
authored
4 years ago
by
Jonas Kastberg
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring of client/service
parent
98da017c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
_CoqProject
+2
-1
2 additions, 1 deletion
_CoqProject
theories/logrel/examples/compute_client_list.v
+2
-63
2 additions, 63 deletions
theories/logrel/examples/compute_client_list.v
theories/logrel/examples/compute_service.v
+74
-0
74 additions, 0 deletions
theories/logrel/examples/compute_service.v
with
78 additions
and
64 deletions
_CoqProject
+
2
−
1
View file @
fdc2775d
...
...
@@ -45,4 +45,5 @@ theories/logrel/examples/rec_subtyping.v
theories/logrel/examples/choice_subtyping.v
theories/logrel/examples/mapper.v
theories/logrel/examples/mapper_list.v
theories/logrel/examples/compute_list_par.v
\ No newline at end of file
theories/logrel/examples/compute_service.v
theories/logrel/examples/compute_client_list.v
\ No newline at end of file
This diff is collapsed.
Click to expand it.
theories/logrel/examples/compute_list
_par
.v
→
theories/logrel/examples/compute_
client_
list.v
+
2
−
63
View file @
fdc2775d
...
...
@@ -5,16 +5,7 @@ From actris.channel Require Import proofmode proto channel.
From
actris
.
logrel
Require
Import
term_typing_rules
session_typing_rules
subtyping_rules
napp
.
From
actris
.
logrel
.
lib
Require
Import
par_start
.
Definition
cont
:
Z
:=
1
.
Definition
stop
:
Z
:=
2
.
Definition
compute_service
:
val
:=
rec
:
"go"
"c"
:=
branch
[
cont
;
stop
]
"c"
(
λ
:
"c"
,
let
:
"v"
:=
recv
"c"
in
send
"c"
(
"v"
#
());;
"go"
"c"
)
(
λ
:
"c"
,
#
())
.
From
actris
.
logrel
.
examples
Require
Import
compute_service
.
Definition
send_all_par
:
val
:=
rec
:
"go"
"c"
"xs"
"lk"
"counter"
:=
...
...
@@ -62,58 +53,6 @@ Section compute_example.
Context
`{
heapG
Σ
,
chanG
Σ
,
lockG
Σ
,
spawnG
Σ
}
.
Context
`{
!
inG
Σ
fracR
}
.
Definition
compute_type_service_aux
(
rec
:
lsty
Σ
)
:
lsty
Σ
:=
lty_branch
$
<
[
cont
:=
(
<
??
A
>
TY
()
⊸
A
;
<!!>
TY
A
;
rec
)
%
lty
]
>
$
<
[
stop
:=
END
%
lty
]
>
$
∅.
Instance
mapper_type_rec_service_contractive
:
Contractive
(
compute_type_service_aux
)
.
Proof
.
solve_proto_contractive
.
Qed
.
Definition
compute_type_service
:
lsty
Σ
:=
lty_rec
(
compute_type_service_aux
)
.
(** This judgement is checked only with the typing rules of the type system *)
Lemma
ltyped_compute_service
Γ
:
⊢
Γ
⊨
compute_service
:
lty_chan
compute_type_service
⊸
()
⫤
Γ
.
Proof
.
iApply
(
ltyped_subsumption
_
_
_
_
_
_
(
lty_chan
compute_type_service
→
())
%
lty
);
[
iApply
env_le_refl
|
iApply
lty_le_copy_elim
|
iApply
env_le_refl
|
]
.
iApply
ltyped_val_ltyped
.
iApply
ltyped_val_rec
.
iApply
ltyped_post_nil
.
iApply
ltyped_app
.
{
iApply
(
ltyped_lam
[])
.
iApply
ltyped_post_nil
.
iApply
ltyped_unit
.
}
iApply
(
ltyped_app
_
_
_
_
_
(
chan
(
<
??
A
>
TY
()
⊸
A
;
<!!>
TY
A
;
compute_type_service
)
⊸
())
%
lty
)
.
{
simpl
.
iApply
(
ltyped_lam
[
EnvItem
"go"
_])
.
iApply
ltyped_post_nil
.
iApply
ltyped_recv_texist
;
[
done
|
apply
_
|
]
.
iIntros
(
Ys
)
.
pose
proof
(
ltys_S_inv
Ys
)
as
[
A
[
Ys'
HYs
]]
.
pose
proof
(
ltys_O_inv
Ys'
)
as
HYs'
.
rewrite
HYs
HYs'
/=.
iApply
ltyped_seq
.
{
iApply
(
ltyped_send
_
[
EnvItem
"v"
_;
EnvItem
"c"
_;
EnvItem
"go"
_]);
[
done
|
]
.
iApply
ltyped_app
;
[
by
iApply
ltyped_unit
|
]=>
/=.
by
iApply
ltyped_var
.
}
simpl
.
iApply
ltyped_app
;
[
by
iApply
ltyped_var
|
]
.
simpl
.
rewrite
!
(
Permutation_swap
(
EnvItem
"go"
_))
.
iApply
ltyped_subsumption
;
[
|
|
iApply
env_le_refl
|
]
.
{
iApply
env_le_cons
;
[
iApply
lty_le_refl
|
iApply
env_le_nil
]
.
}
{
iApply
lty_le_copy_elim
.
}
by
iApply
ltyped_var
.
}
iApply
ltyped_app
;
[
by
iApply
ltyped_var
|
]
.
iApply
ltyped_subsumption
;
[
iApply
env_le_nil
|
|
iApply
env_le_refl
|
]
.
{
iApply
lty_le_arr
;
[
|
iApply
lty_le_refl
]
.
iApply
lty_le_chan
.
iApply
lty_le_l
;
[
iApply
lty_le_rec_unfold
|
iApply
lty_le_refl
]
.
}
rewrite
/
compute_type_service_aux
.
iApply
ltyped_branch
.
intros
x
.
rewrite
-
elem_of_dom
.
set_solver
.
Qed
.
Definition
compute_type_client_aux
(
A
:
ltty
Σ
)
(
rec
:
lsty
Σ
)
:
lsty
Σ
:=
lty_select
$
<
[
cont
:=
(
<!!>
TY
()
⊸
A
;
<
??
>
TY
A
;
rec
)
%
lty
]
>
$
<
[
stop
:=
END
%
lty
]
>∅.
...
...
@@ -425,7 +364,7 @@ Section compute_example.
iSplit
=>
//.
iApply
lty_le_l
;
[
iApply
lty_le_dual_end
|
iApply
lty_le_refl
]
.
Qed
.
Lemma
ltyped_compute_
prog
A
e
Γ
Γ'
:
Lemma
ltyped_compute_
list_par
A
e
Γ
Γ'
:
(
Γ
⊨
e
:
ref_uniq
(
lty_list
(()
⊸
A
))
⫤
Γ'
)
-∗
Γ
⊨
par_start
(
compute_service
)
(
compute_client
e
)
:
(()
*
(
ref_uniq
(
lty_list
A
)))
⫤
Γ'
.
...
...
This diff is collapsed.
Click to expand it.
theories/logrel/examples/compute_service.v
0 → 100644
+
74
−
0
View file @
fdc2775d
From
iris
.
algebra
Require
Import
frac
.
From
iris
.
heap_lang
Require
Import
metatheory
.
From
actris
.
utils
Require
Import
llist
.
From
actris
.
channel
Require
Import
proofmode
proto
channel
.
From
actris
.
logrel
Require
Import
term_typing_rules
session_typing_rules
subtyping_rules
napp
.
From
actris
.
logrel
.
lib
Require
Import
par_start
.
Definition
cont
:
Z
:=
1
.
Definition
stop
:
Z
:=
2
.
Definition
compute_service
:
val
:=
rec
:
"go"
"c"
:=
branch
[
cont
;
stop
]
"c"
(
λ
:
"c"
,
let
:
"v"
:=
recv
"c"
in
send
"c"
(
"v"
#
());;
"go"
"c"
)
(
λ
:
"c"
,
#
())
.
Section
compute_example
.
Context
`{
heapG
Σ
,
chanG
Σ
,
spawnG
Σ
}
.
Definition
compute_type_service_aux
(
rec
:
lsty
Σ
)
:
lsty
Σ
:=
lty_branch
$
<
[
cont
:=
(
<
??
A
>
TY
()
⊸
A
;
<!!>
TY
A
;
rec
)
%
lty
]
>
$
<
[
stop
:=
END
%
lty
]
>
$
∅.
Instance
mapper_type_rec_service_contractive
:
Contractive
(
compute_type_service_aux
)
.
Proof
.
solve_proto_contractive
.
Qed
.
Definition
compute_type_service
:
lsty
Σ
:=
lty_rec
(
compute_type_service_aux
)
.
(** This judgement is checked only with the typing rules of the type system *)
Lemma
ltyped_compute_service
Γ
:
⊢
Γ
⊨
compute_service
:
lty_chan
compute_type_service
⊸
()
⫤
Γ
.
Proof
.
iApply
(
ltyped_subsumption
_
_
_
_
_
_
(
lty_chan
compute_type_service
→
())
%
lty
);
[
iApply
env_le_refl
|
iApply
lty_le_copy_elim
|
iApply
env_le_refl
|
]
.
iApply
ltyped_val_ltyped
.
iApply
ltyped_val_rec
.
iApply
ltyped_post_nil
.
iApply
ltyped_app
.
{
iApply
(
ltyped_lam
[])
.
iApply
ltyped_post_nil
.
iApply
ltyped_unit
.
}
iApply
(
ltyped_app
_
_
_
_
_
(
chan
(
<
??
A
>
TY
()
⊸
A
;
<!!>
TY
A
;
compute_type_service
)
⊸
())
%
lty
)
.
{
simpl
.
iApply
(
ltyped_lam
[
EnvItem
"go"
_])
.
iApply
ltyped_post_nil
.
iApply
ltyped_recv_texist
;
[
done
|
apply
_
|
]
.
iIntros
(
Ys
)
.
pose
proof
(
ltys_S_inv
Ys
)
as
[
A
[
Ys'
HYs
]]
.
pose
proof
(
ltys_O_inv
Ys'
)
as
HYs'
.
rewrite
HYs
HYs'
/=.
iApply
ltyped_seq
.
{
iApply
(
ltyped_send
_
[
EnvItem
"v"
_;
EnvItem
"c"
_;
EnvItem
"go"
_]);
[
done
|
]
.
iApply
ltyped_app
;
[
by
iApply
ltyped_unit
|
]=>
/=.
by
iApply
ltyped_var
.
}
simpl
.
iApply
ltyped_app
;
[
by
iApply
ltyped_var
|
]
.
simpl
.
rewrite
!
(
Permutation_swap
(
EnvItem
"go"
_))
.
iApply
ltyped_subsumption
;
[
|
|
iApply
env_le_refl
|
]
.
{
iApply
env_le_cons
;
[
iApply
lty_le_refl
|
iApply
env_le_nil
]
.
}
{
iApply
lty_le_copy_elim
.
}
by
iApply
ltyped_var
.
}
iApply
ltyped_app
;
[
by
iApply
ltyped_var
|
]
.
iApply
ltyped_subsumption
;
[
iApply
env_le_nil
|
|
iApply
env_le_refl
|
]
.
{
iApply
lty_le_arr
;
[
|
iApply
lty_le_refl
]
.
iApply
lty_le_chan
.
iApply
lty_le_l
;
[
iApply
lty_le_rec_unfold
|
iApply
lty_le_refl
]
.
}
rewrite
/
compute_type_service_aux
.
iApply
ltyped_branch
.
intros
x
.
rewrite
-
elem_of_dom
.
set_solver
.
Qed
.
End
compute_example
.
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