Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ReLoC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Iris
ReLoC
Commits
a7ce476f
Commit
a7ce476f
authored
6 years ago
by
Dan Frumin
Browse files
Options
Downloads
Patches
Plain Diff
Semantic interpretation of types
parent
4c62c9f1
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
_CoqProject
+1
-0
1 addition, 0 deletions
_CoqProject
theories/logic/model.v
+3
-3
3 additions, 3 deletions
theories/logic/model.v
theories/typing/interp.v
+94
-0
94 additions, 0 deletions
theories/typing/interp.v
theories/typing/types.v
+1
-1
1 addition, 1 deletion
theories/typing/types.v
with
99 additions
and
4 deletions
_CoqProject
+
1
−
0
View file @
a7ce476f
...
...
@@ -11,6 +11,7 @@ theories/logic/derived.v
theories/logic/proofmode/tactics.v
theories/typing/types.v
theories/typing/interp.v
theories/tests/tp_tests.v
theories/tests/proofmode_tests.v
This diff is collapsed.
Click to expand it.
theories/logic/model.v
+
3
−
3
View file @
a7ce476f
...
...
@@ -25,8 +25,8 @@ Existing Instance lty2_persistent.
Section
lty2_ofe
.
Context
`{
relocG
Σ
}
.
Instance
lty2_equiv
:
Equiv
lty2
:=
λ
A
B
,
∀
w1
w2
,
A
w1
w2
≡
B
w1
w2
.
Instance
lty2_dist
:
Dist
lty2
:=
λ
n
A
B
,
∀
w1
w2
,
A
w1
w2
≡
{
n
}
≡
B
w1
w2
.
Global
Instance
lty2_equiv
:
Equiv
lty2
:=
λ
A
B
,
∀
w1
w2
,
A
w1
w2
≡
B
w1
w2
.
Global
Instance
lty2_dist
:
Dist
lty2
:=
λ
n
A
B
,
∀
w1
w2
,
A
w1
w2
≡
{
n
}
≡
B
w1
w2
.
Lemma
lty2_ofe_mixin
:
OfeMixin
lty2
.
Proof
.
by
apply
(
iso_ofe_mixin
(
lty2_car
:
lty2
→
(
val
-
c
>
val
-
c
>
iProp
Σ
)))
.
Qed
.
Canonical
Structure
lty2C
:=
OfeT
lty2
lty2_ofe_mixin
.
...
...
@@ -60,7 +60,7 @@ Section semtypes.
=
{
E
,
⊤
}
=∗
WP
e
{{
v
,
∃
v'
,
j
⤇
fill
K
(
of_val
v'
)
∗
A
v
v'
}})
%
I
.
Global
Instance
interp_expr_ne
E
n
:
Proper
((
=
)
==>
(
=
)
==>
(
=
)
==>
dist
n
)
(
interp_expr
E
)
.
Proper
((
=
)
==>
(
=
)
==>
(
dist
n
)
==>
dist
n
)
(
interp_expr
E
)
.
Proof
.
solve_proper
.
Qed
.
Definition
lty2_unit
:
lty2
:=
Lty2
(
λ
w1
w2
,
⌜
w1
=
#
()
∧
w2
=
#
()
⌝%
I
)
.
...
...
This diff is collapsed.
Click to expand it.
theories/typing/interp.v
0 → 100644
+
94
−
0
View file @
a7ce476f
(* ReLoC -- Relational logic for fine-grained concurrency *)
(** Interpretations for System F_mu_ref types *)
From
iris
.
algebra
Require
Import
list
.
From
reloc
.
typing
Require
Export
types
.
From
reloc
.
logic
Require
Import
model
.
From
Autosubst
Require
Import
Autosubst
.
Section
semtypes
.
Context
`{
relocG
Σ
}
.
(** Type-level lambdas are interpreted as closures *)
Definition
lty2_forall
(
C
:
lty2
→
lty2
)
:
lty2
:=
Lty2
(
λ
w1
w2
,
□
∀
A
:
lty2
,
interp_expr
⊤
(
TApp
w1
)
(
TApp
w2
)
(
C
A
))
%
I
.
Definition
lty2_exists
(
C
:
lty2
→
lty2
)
:
lty2
:=
Lty2
(
λ
w1
w2
,
∃
A
:
lty2
,
C
A
w1
w2
)
%
I
.
Definition
lty2_true
:
lty2
:=
Lty2
(
λ
w1
w2
,
True
)
%
I
.
Program
Definition
ctx_lookup
(
x
:
var
)
:
listC
lty2C
-
n
>
lty2C
:=
λ
ne
Δ
,
(
from_option
id
lty2_true
(
Δ
!!
x
))
%
I
.
Next
Obligation
.
intros
x
n
Δ
Δ'
HΔ
.
destruct
(
Δ
!!
x
)
as
[
P
|]
eqn
:
HP
;
cbn
in
*.
-
eapply
(
Forall2_lookup_l
_
_
_
x
P
)
in
HΔ
;
last
done
.
destruct
HΔ
as
(
Q
&
HQ
&
HΔ
)
.
rewrite
HQ
/=
//.
-
destruct
(
Δ'
!!
x
)
as
[
Q
|]
eqn
:
HQ
;
last
reflexivity
.
eapply
(
Forall2_lookup_r
_
_
_
x
Q
)
in
HΔ
;
last
done
.
destruct
HΔ
as
(
P
&
HP'
&
HΔ
)
.
exfalso
.
rewrite
HP
in
HP'
.
inversion
HP'
.
Qed
.
Instance
lty2_prod_ne
n
:
Proper
(
dist
n
==>
(
dist
n
==>
dist
n
))
lty2_prod
.
Proof
.
intros
A
A'
HA
B
B'
HB
.
intros
w1
w2
.
cbn
.
unfold
lty2_prod
,
lty2_car
.
cbn
.
(* TODO: why do we have to unfold lty2_car here? *)
repeat
f_equiv
;
eauto
.
Qed
.
Instance
lty2_sum_ne
n
:
Proper
(
dist
n
==>
(
dist
n
==>
dist
n
))
lty2_sum
.
Proof
.
intros
A
A'
HA
B
B'
HB
.
intros
w1
w2
.
cbn
.
unfold
lty2_sum
,
lty2_car
.
cbn
.
(* TODO: why do we have to unfold lty2_car here? *)
repeat
f_equiv
;
eauto
.
Qed
.
Instance
lty2_arr_ne
n
:
Proper
(
dist
n
==>
(
dist
n
==>
dist
n
))
lty2_arr
.
Proof
.
intros
A
A'
HA
B
B'
HB
.
intros
w1
w2
.
cbn
.
unfold
lty2_sum
,
lty2_car
.
cbn
.
(* TODO: why do we have to unfold lty2_car here? *)
repeat
f_equiv
;
eauto
.
Qed
.
Instance
lty2_rec_ne
n
:
Proper
(
dist
n
==>
dist
n
)
(
lty2_rec
:
(
lty2C
-
n
>
lty2C
)
->
lty2C
)
.
Proof
.
intros
F
F'
HF
.
unfold
lty2_rec
,
lty2_car
.
apply
fixpoint_ne
=>
X
w1
w2
.
unfold
lty2_rec1
,
lty2_car
.
cbn
.
f_equiv
.
apply
lty2_car_ne
;
eauto
.
Qed
.
Program
Fixpoint
interp
(
τ
:
type
)
:
listC
lty2C
-
n
>
lty2C
:=
match
τ
as
_
return
_
with
|
TUnit
=>
λ
ne
_,
lty2_unit
|
TNat
=>
λ
ne
_,
lty2_int
|
TBool
=>
λ
ne
_,
lty2_bool
|
TProd
τ1
τ2
=>
λ
ne
Δ
,
lty2_prod
(
interp
τ1
Δ
)
(
interp
τ2
Δ
)
|
TSum
τ1
τ2
=>
λ
ne
Δ
,
lty2_sum
(
interp
τ1
Δ
)
(
interp
τ2
Δ
)
|
TArrow
τ1
τ2
=>
λ
ne
Δ
,
lty2_arr
(
interp
τ1
Δ
)
(
interp
τ2
Δ
)
|
TRec
τ'
=>
λ
ne
Δ
,
lty2_rec
(
λ
ne
τ
,
interp
τ'
(
τ
::
Δ
))
|
TVar
x
=>
ctx_lookup
x
|
TForall
τ'
=>
λ
ne
Δ
,
lty2_forall
(
λ
τ
,
interp
τ'
(
τ
::
Δ
))
|
TExists
τ'
=>
λ
ne
Δ
,
lty2_exists
(
λ
τ
,
interp
τ'
(
τ
::
Δ
))
|
Tref
τ
=>
λ
ne
Δ
,
lty2_ref
(
interp
τ
Δ
)
end
.
Solve
Obligations
with
(
intros
I
τ
τ'
n
Δ
Δ'
HΔ'
??;
solve_proper
)
.
Next
Obligation
.
intros
I
τ
τ'
n
Δ
Δ'
HΔ'
??
.
apply
lty2_rec_ne
=>
X
/=.
apply
I
.
by
f_equiv
.
Defined
.
End
semtypes
.
This diff is collapsed.
Click to expand it.
theories/typing/types.v
+
1
−
1
View file @
a7ce476f
(* ReLoC -- Relational logic for fine-grained concurrency *)
(** Typing for System F_mu_ref with existential types and concurrency *)
From
stdpp
Require
Export
stringmap
.
From
iris
.
heap_lang
Require
Im
port
lang
notation
.
From
iris
.
heap_lang
Require
Ex
port
lang
notation
.
From
Autosubst
Require
Import
Autosubst
.
(** * Types *)
...
...
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