Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Tutorial POPL20
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arthur Azevedo de Amorim
Tutorial POPL20
Commits
8e1cfad9
Commit
8e1cfad9
authored
Jan 19, 2020
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More demo.
parent
1eb8dac5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
theories/demo.v
theories/demo.v
+36
-4
No files found.
theories/demo.v
View file @
8e1cfad9
From
tutorial_popl20
Require
Import
language
.
From
iris
.
base_logic
.
lib
Require
Import
invariants
.
From
iris
.
heap_lang
Require
Import
adequacy
.
Inductive
ty
:
=
|
TVar
:
nat
→
ty
|
TUnit
:
ty
|
TBool
:
ty
|
TInt
:
ty
...
...
@@ -85,7 +86,6 @@ step 2: Lift value interpretation to expressions (semantic typing judgment):
*)
Module
version1
.
Section
semtyp
.
Context
`
{!
heapG
Σ
}.
...
...
@@ -104,7 +104,8 @@ Section semtyp.
|
TProd
τ
1
τ
2
=>
SemTy
(
λ
w
,
∃
v1
v2
,
⌜
w
=
(
v1
,
v2
)%
V
⌝
∗
interp
τ
1
v1
∗
interp
τ
2
v2
)
|
TArr
τ
1
τ
2
=>
SemTy
(
λ
w
,
□
∀
v
,
interp
τ
1
v
-
∗
WP
w
v
{{
u
,
interp
τ
2
u
}})
|
_
=>
SemTy
(
λ
_
,
False
)
(* dummy interpretation *)
|
TRef
τ
=>
SemTy
(
λ
w
,
∃
l
:
loc
,
⌜
w
=
#
l
⌝
∗
inv
(
nroot
.@
"ref"
.@
l
)
(
∃
v
,
l
↦
v
∗
interp
τ
v
))
end
%
I
.
Definition
interp_env
(
Γ
:
gmap
string
ty
)
(
vs
:
gmap
string
val
)
:
iProp
Σ
:
=
...
...
@@ -148,8 +149,39 @@ Section semtyp.
intros
Htyped
.
iInduction
Htyped
as
[]
"IH"
.
5
:
{
iApply
Pair_sem_typed
;
auto
.
}
Admitted
.
Definition
unsafe_pure
:
val
:
=
λ
:
<>,
if
:
#
true
then
#
13
else
#
13
#
37
.
Lemma
sem_typed_unsafe_pure
:
∅
⊨
unsafe_pure
:
TArr
TUnit
TInt
.
Proof
.
Admitted
.
End
semtyp
.
End
version1
.
Notation
"Γ ⊨ e : A"
:
=
(
sem_typed
Γ
e
A
)
(
at
level
74
,
e
,
A
at
next
level
).
Lemma
sem_type_safety
`
{!
heapPreG
Σ
}
e
σ
es
σ
'
e'
τ
:
(
∀
`
{!
heapG
Σ
},
∅
⊨
e
:
τ
)
→
rtc
erased_step
([
e
],
σ
)
(
es
,
σ
'
)
→
e'
∈
es
→
is_Some
(
to_val
e'
)
∨
reducible
e'
σ
'
.
Proof
.
intros
Hty
.
apply
(
heap_adequacy
Σ
NotStuck
e
σ
(
λ
_
,
True
))=>
//
?.
iDestruct
(
Hty
$!
∅
)
as
"#He"
.
rewrite
subst_map_empty
.
iApply
(
wp_wand
with
"(He [])"
).
{
rewrite
/
interp_env
.
auto
.
}
auto
.
Qed
.
Lemma
type_safety
e
σ
es
σ
'
e'
τ
:
(
∅
⊢
ₜ
e
:
τ
)
→
rtc
erased_step
([
e
],
σ
)
(
es
,
σ
'
)
→
e'
∈
es
→
is_Some
(
to_val
e'
)
∨
reducible
e'
σ
'
.
Proof
.
intros
Hty
.
eapply
(
sem_type_safety
(
Σ
:
=
heap
Σ
))=>
?.
by
apply
fundamental
.
Qed
.
(* LocalWords: Robbert
*)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment