Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lambda-rust
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
Simon Spies
lambda-rust
Commits
c7437a1f
Commit
c7437a1f
authored
7 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
add a stub for rayon::join
parent
ec2e721a
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
_CoqProject
+1
-0
1 addition, 0 deletions
_CoqProject
theories/typing/lib/join.v
+40
-0
40 additions, 0 deletions
theories/typing/lib/join.v
with
41 additions
and
0 deletions
_CoqProject
+
1
−
0
View file @
c7437a1f
...
...
@@ -55,6 +55,7 @@ theories/typing/lib/option.v
theories/typing/lib/fake_shared_box.v
theories/typing/lib/cell.v
theories/typing/lib/spawn.v
theories/typing/lib/join.v
theories/typing/lib/take_mut.v
theories/typing/lib/rc/rc.v
theories/typing/lib/rc/weak.v
...
...
This diff is collapsed.
Click to expand it.
theories/typing/lib/join.v
0 → 100644
+
40
−
0
View file @
c7437a1f
From
iris
.
proofmode
Require
Import
tactics
.
From
iris
.
base_logic
Require
Import
big_op
.
From
lrust
.
lang
Require
Import
spawn
.
From
lrust
.
typing
Require
Export
type
.
From
lrust
.
typing
Require
Import
typing
.
Set
Default
Proof
Using
"Type"
.
Definition
joinN
:=
lrustN
.
@
"join"
.
Section
join
.
Context
`{
!
typeG
Σ
}
.
(* This model is very far from rayon::join, which uses a persistent work-stealing thread-pool.
Still, the important bits are right: One of the closures is executed in another thread,
and the closures can refer to on-stack data (no 'static' bound). *)
Definition
join
(
call_once_A
call_once_B
:
val
)
(
R_A
R_B
:
type
)
:
val
:=
funrec
:
<>
[
"fA"
;
"fB"
]
:=
let
:
"call_once_A"
:=
call_once_A
in
let
:
"call_once_B"
:=
call_once_B
in
let
:
"join"
:=
spawn
[
λ
:
[
"c"
],
letcall
:
"r"
:=
"call_once_A"
[
"fA"
:
expr
]
in
finish
[
"c"
;
"r"
]]
in
let
:
"retB"
:=
"call_once_B"
[
"fB"
:
expr
]
in
let
:
"retA"
:=
join
[
"join"
]
in
(* Put the results in a pair. *)
let
:
"ret"
:=
new
[
#
(
R_A
.(
ty_size
)
+
R_B
.(
ty_size
))
]
in
"ret"
+
ₗ
#
0
<-
"retA"
;;
"ret"
+
ₗ
#
R_A
.(
ty_size
)
<-
"retB"
;;
delete
[
#
R_A
.(
ty_size
);
"retA"
]
;;
delete
[
#
R_B
.(
ty_size
);
"retB"
]
;;
return
:
[
"ret"
]
.
Lemma
join_type
A
B
R_A
R_B
call_once_A
call_once_B
`{
!
TyWf
A
,
!
TyWf
B
,
!
TyWf
R_A
,
!
TyWf
R_B
}
`
(
!
Send
A
,
!
Send
B
,
!
Send
R_A
,
!
Send
R_B
)
:
typed_val
call_once_A
(
fn
(
∅
;
A
)
→
R_A
)
→
(* A : FnOnce() -> R_A, as witnessed by the impl call_once_A *)
typed_val
call_once_B
(
fn
(
∅
;
B
)
→
R_B
)
→
(* B : FnOnce() -> R_B, as witnessed by the impl call_once_B *)
typed_val
(
join
call_once_A
call_once_B
R_A
R_B
)
(
fn
(
∅
;
A
,
B
)
→
Π
[
R_A
;
R_B
])
.
Proof
.
Abort
.
End
join
.
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