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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Service Desk
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
Iris
lambda-rust
Commits
cde0d062
Commit
cde0d062
authored
8 years ago
by
Robbert Krebbers
Browse files
Options
Downloads
Patches
Plain Diff
Params instances for Copy, Sync, Send.
parent
60eeca59
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/typing/type.v
+50
-47
50 additions, 47 deletions
theories/typing/type.v
with
50 additions
and
47 deletions
theories/typing/type.v
+
50
−
47
View file @
cde0d062
...
@@ -333,16 +333,56 @@ Ltac solve_type_proper :=
...
@@ -333,16 +333,56 @@ Ltac solve_type_proper :=
constructor
;
constructor
;
solve_proper_core
ltac
:(
fun
_
=>
f_type_equiv
||
f_contractive
||
f_equiv
)
.
solve_proper_core
ltac
:(
fun
_
=>
f_type_equiv
||
f_contractive
||
f_equiv
)
.
Fixpoint
shr_locsE
(
l
:
loc
)
(
n
:
nat
)
:
coPset
:=
match
n
with
|
0
%
nat
=>
∅
|
S
n
=>
↑
shrN
.
@
l
∪
shr_locsE
(
shift_loc
l
1
%
nat
)
n
end
.
Class
Copy
`{
typeG
Σ
}
(
t
:
type
)
:=
{
copy_persistent
tid
vl
:
PersistentP
(
t
.(
ty_own
)
tid
vl
);
copy_shr_acc
κ
tid
E
F
l
q
:
lftE
∪
↑
shrN
⊆
E
→
shr_locsE
l
(
t
.(
ty_size
)
+
1
)
⊆
F
→
lft_ctx
-∗
t
.(
ty_shr
)
κ
tid
l
-∗
na_own
tid
F
-∗
q
.[
κ
]
=
{
E
}
=∗
∃
q'
,
na_own
tid
(
F
∖
shr_locsE
l
t
.(
ty_size
))
∗
▷
(
l
↦∗
{
q'
}:
t
.(
ty_own
)
tid
)
∗
(
na_own
tid
(
F
∖
shr_locsE
l
t
.(
ty_size
))
-∗
▷
l
↦∗
{
q'
}:
t
.(
ty_own
)
tid
=
{
E
}
=∗
na_own
tid
F
∗
q
.[
κ
])
}
.
Existing
Instances
copy_persistent
.
Instance
:
Params
(
@
Copy
)
2
.
Class
LstCopy
`{
typeG
Σ
}
(
tys
:
list
type
)
:=
lst_copy
:
Forall
Copy
tys
.
Instance
:
Params
(
@
LstCopy
)
2
.
Global
Instance
lst_copy_nil
`{
typeG
Σ
}
:
LstCopy
[]
:=
List
.
Forall_nil
_
.
Global
Instance
lst_copy_cons
`{
typeG
Σ
}
ty
tys
:
Copy
ty
→
LstCopy
tys
→
LstCopy
(
ty
::
tys
)
:=
List
.
Forall_cons
_
_
_
.
Class
Send
`{
typeG
Σ
}
(
t
:
type
)
:=
send_change_tid
tid1
tid2
vl
:
t
.(
ty_own
)
tid1
vl
-∗
t
.(
ty_own
)
tid2
vl
.
Instance
:
Params
(
@
Send
)
2
.
Class
LstSend
`{
typeG
Σ
}
(
tys
:
list
type
)
:=
lst_send
:
Forall
Send
tys
.
Instance
:
Params
(
@
LstSend
)
2
.
Global
Instance
lst_send_nil
`{
typeG
Σ
}
:
LstSend
[]
:=
List
.
Forall_nil
_
.
Global
Instance
lst_send_cons
`{
typeG
Σ
}
ty
tys
:
Send
ty
→
LstSend
tys
→
LstSend
(
ty
::
tys
)
:=
List
.
Forall_cons
_
_
_
.
Class
Sync
`{
typeG
Σ
}
(
t
:
type
)
:=
sync_change_tid
κ
tid1
tid2
l
:
t
.(
ty_shr
)
κ
tid1
l
-∗
t
.(
ty_shr
)
κ
tid2
l
.
Instance
:
Params
(
@
Sync
)
2
.
Class
LstSync
`{
typeG
Σ
}
(
tys
:
list
type
)
:=
lst_sync
:
Forall
Sync
tys
.
Instance
:
Params
(
@
LstSync
)
2
.
Global
Instance
lst_sync_nil
`{
typeG
Σ
}
:
LstSync
[]
:=
List
.
Forall_nil
_
.
Global
Instance
lst_sync_cons
`{
typeG
Σ
}
ty
tys
:
Sync
ty
→
LstSync
tys
→
LstSync
(
ty
::
tys
)
:=
List
.
Forall_cons
_
_
_
.
Section
type
.
Section
type
.
Context
`{
typeG
Σ
}
.
Context
`{
typeG
Σ
}
.
(** Copy types *)
(** Copy types *)
Fixpoint
shr_locsE
(
l
:
loc
)
(
n
:
nat
)
:
coPset
:=
match
n
with
|
0
%
nat
=>
∅
|
S
n
=>
↑
shrN
.
@
l
∪
shr_locsE
(
shift_loc
l
1
%
nat
)
n
end
.
Lemma
shr_locsE_shift
l
n
m
:
Lemma
shr_locsE_shift
l
n
m
:
shr_locsE
l
(
n
+
m
)
=
shr_locsE
l
n
∪
shr_locsE
(
shift_loc
l
n
)
m
.
shr_locsE
l
(
n
+
m
)
=
shr_locsE
l
n
∪
shr_locsE
(
shift_loc
l
n
)
m
.
Proof
.
Proof
.
...
@@ -386,20 +426,7 @@ Section type.
...
@@ -386,20 +426,7 @@ Section type.
rewrite
shr_locsE_shift
na_own_union
//.
apply
shr_locsE_disj
.
rewrite
shr_locsE_shift
na_own_union
//.
apply
shr_locsE_disj
.
Qed
.
Qed
.
Class
Copy
(
t
:
type
)
:=
{
Global
Instance
copy_equiv
:
Proper
(
equiv
==>
impl
)
Copy
.
copy_persistent
tid
vl
:
PersistentP
(
t
.(
ty_own
)
tid
vl
);
copy_shr_acc
κ
tid
E
F
l
q
:
lftE
∪
↑
shrN
⊆
E
→
shr_locsE
l
(
t
.(
ty_size
)
+
1
)
⊆
F
→
lft_ctx
-∗
t
.(
ty_shr
)
κ
tid
l
-∗
na_own
tid
F
-∗
q
.[
κ
]
=
{
E
}
=∗
∃
q'
,
na_own
tid
(
F
∖
shr_locsE
l
t
.(
ty_size
))
∗
▷
(
l
↦∗
{
q'
}:
t
.(
ty_own
)
tid
)
∗
(
na_own
tid
(
F
∖
shr_locsE
l
t
.(
ty_size
))
-∗
▷
l
↦∗
{
q'
}:
t
.(
ty_own
)
tid
=
{
E
}
=∗
na_own
tid
F
∗
q
.[
κ
])
}
.
Global
Existing
Instances
copy_persistent
.
Global
Instance
copy_equiv
:
Proper
(
equiv
==>
impl
)
Copy
.
Proof
.
Proof
.
intros
ty1
ty2
[
EQsz
%
leibniz_equiv
EQown
EQshr
]
Hty1
.
split
.
intros
ty1
ty2
[
EQsz
%
leibniz_equiv
EQown
EQshr
]
Hty1
.
split
.
-
intros
.
rewrite
-
EQown
.
apply
_
.
-
intros
.
rewrite
-
EQown
.
apply
_
.
...
@@ -407,11 +434,6 @@ Section type.
...
@@ -407,11 +434,6 @@ Section type.
apply
copy_shr_acc
.
apply
copy_shr_acc
.
Qed
.
Qed
.
Class
LstCopy
(
tys
:
list
type
)
:=
lst_copy
:
Forall
Copy
tys
.
Global
Instance
lst_copy_nil
:
LstCopy
[]
:=
List
.
Forall_nil
_
.
Global
Instance
lst_copy_cons
ty
tys
:
Copy
ty
→
LstCopy
tys
→
LstCopy
(
ty
::
tys
)
:=
List
.
Forall_cons
_
_
_
.
Global
Program
Instance
ty_of_st_copy
st
:
Copy
(
ty_of_st
st
)
.
Global
Program
Instance
ty_of_st_copy
st
:
Copy
(
ty_of_st
st
)
.
Next
Obligation
.
Next
Obligation
.
iIntros
(
st
κ
tid
E
?
l
q
?
HF
)
"#LFT #Hshr Htok Hlft"
.
iIntros
(
st
κ
tid
E
?
l
q
?
HF
)
"#LFT #Hshr Htok Hlft"
.
...
@@ -430,38 +452,19 @@ Section type.
...
@@ -430,38 +452,19 @@ Section type.
Qed
.
Qed
.
(** Send and Sync types *)
(** Send and Sync types *)
Class
Send
(
t
:
type
)
:=
Global
Instance
send_equiv
:
Proper
(
equiv
==>
impl
)
Send
.
send_change_tid
tid1
tid2
vl
:
t
.(
ty_own
)
tid1
vl
-∗
t
.(
ty_own
)
tid2
vl
.
Global
Instance
send_equiv
:
Proper
(
equiv
==>
impl
)
Send
.
Proof
.
Proof
.
intros
ty1
ty2
[
EQsz
%
leibniz_equiv
EQown
EQshr
]
Hty1
.
intros
ty1
ty2
[
EQsz
%
leibniz_equiv
EQown
EQshr
]
Hty1
.
rewrite
/
Send
=>???
.
rewrite
-!
EQown
.
auto
.
rewrite
/
Send
=>???
.
rewrite
-!
EQown
.
auto
.
Qed
.
Qed
.
Class
LstSend
(
tys
:
list
type
)
:=
lst_send
:
Forall
Send
tys
.
Global
Instance
sync_equiv
:
Proper
(
equiv
==>
impl
)
Sync
.
Global
Instance
lst_send_nil
:
LstSend
[]
:=
List
.
Forall_nil
_
.
Global
Instance
lst_send_cons
ty
tys
:
Send
ty
→
LstSend
tys
→
LstSend
(
ty
::
tys
)
:=
List
.
Forall_cons
_
_
_
.
Class
Sync
(
t
:
type
)
:=
sync_change_tid
κ
tid1
tid2
l
:
t
.(
ty_shr
)
κ
tid1
l
-∗
t
.(
ty_shr
)
κ
tid2
l
.
Global
Instance
sync_equiv
:
Proper
(
equiv
==>
impl
)
Sync
.
Proof
.
Proof
.
intros
ty1
ty2
[
EQsz
%
leibniz_equiv
EQown
EQshr
]
Hty1
.
intros
ty1
ty2
[
EQsz
%
leibniz_equiv
EQown
EQshr
]
Hty1
.
rewrite
/
Send
=>????
.
rewrite
-!
EQshr
.
auto
.
rewrite
/
Send
=>????
.
rewrite
-!
EQshr
.
auto
.
Qed
.
Qed
.
Class
LstSync
(
tys
:
list
type
)
:=
lst_sync
:
Forall
Sync
tys
.
Global
Instance
ty_of_st_sync
st
:
Send
(
ty_of_st
st
)
→
Sync
(
ty_of_st
st
)
.
Global
Instance
lst_sync_nil
:
LstSync
[]
:=
List
.
Forall_nil
_
.
Global
Instance
lst_sync_cons
ty
tys
:
Sync
ty
→
LstSync
tys
→
LstSync
(
ty
::
tys
)
:=
List
.
Forall_cons
_
_
_
.
Global
Instance
ty_of_st_sync
st
:
Send
(
ty_of_st
st
)
→
Sync
(
ty_of_st
st
)
.
Proof
.
Proof
.
iIntros
(
Hsend
κ
tid1
tid2
l
)
.
iDestruct
1
as
(
vl
)
"[Hm Hown]"
.
iIntros
(
Hsend
κ
tid1
tid2
l
)
.
iDestruct
1
as
(
vl
)
"[Hm Hown]"
.
iExists
vl
.
iFrame
"Hm"
.
iNext
.
by
iApply
Hsend
.
iExists
vl
.
iFrame
"Hm"
.
iNext
.
by
iApply
Hsend
.
...
...
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