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
1eb8dac5
Commit
1eb8dac5
authored
Jan 19, 2020
by
Robbert Krebbers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More demo.
parent
b22d3f6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
theories/demo.v
theories/demo.v
+64
-0
No files found.
theories/demo.v
View file @
1eb8dac5
From
tutorial_popl20
Require
Import
language
.
Inductive
ty
:
=
|
TVar
:
nat
→
ty
|
TUnit
:
ty
|
TBool
:
ty
|
TInt
:
ty
|
TProd
:
ty
→
ty
→
ty
|
TArr
:
ty
→
ty
→
ty
|
TRef
:
ty
→
ty
.
Reserved
Notation
"Γ ⊢ₜ e : τ"
(
at
level
74
,
e
,
τ
at
next
level
).
Inductive
typed
:
gmap
string
ty
→
expr
→
ty
→
Prop
:
=
(** Variables *)
|
Var_typed
Γ
x
τ
:
Γ
!!
x
=
Some
τ
→
Γ
⊢
ₜ
Var
x
:
τ
(** Base values *)
|
UnitV_typed
Γ
:
Γ
⊢
ₜ
#()
:
TUnit
|
BoolV_typed
Γ
(
b
:
bool
)
:
Γ
⊢
ₜ
#
b
:
TBool
|
IntV_val_typed
Γ
(
i
:
Z
)
:
Γ
⊢
ₜ
#
i
:
TInt
(** Products and sums *)
|
Pair_typed
Γ
e1
e2
τ
1
τ
2
:
Γ
⊢
ₜ
e1
:
τ
1
→
Γ
⊢
ₜ
e2
:
τ
2
→
Γ
⊢
ₜ
Pair
e1
e2
:
TProd
τ
1
τ
2
|
Fst_typed
Γ
e
τ
1
τ
2
:
Γ
⊢
ₜ
e
:
TProd
τ
1
τ
2
→
Γ
⊢
ₜ
Fst
e
:
τ
1
|
Snd_typed
Γ
e
τ
1
τ
2
:
Γ
⊢
ₜ
e
:
TProd
τ
1
τ
2
→
Γ
⊢
ₜ
Snd
e
:
τ
2
(** Functions *)
|
Rec_typed
Γ
f
x
e
τ
1
τ
2
:
binder_insert
f
(
TArr
τ
1
τ
2
)
(
binder_insert
x
τ
1
Γ
)
⊢
ₜ
e
:
τ
2
→
Γ
⊢
ₜ
Rec
f
x
e
:
TArr
τ
1
τ
2
|
App_typed
Γ
e1
e2
τ
1
τ
2
:
Γ
⊢
ₜ
e1
:
TArr
τ
1
τ
2
→
Γ
⊢
ₜ
e2
:
τ
1
→
Γ
⊢
ₜ
App
e1
e2
:
τ
2
(** Heap operations *)
|
Alloc_typed
Γ
e
τ
:
Γ
⊢
ₜ
e
:
τ
→
Γ
⊢
ₜ
Alloc
e
:
TRef
τ
|
Load_typed
Γ
e
τ
:
Γ
⊢
ₜ
e
:
TRef
τ
→
Γ
⊢
ₜ
Load
e
:
τ
|
Store_typed
Γ
e1
e2
τ
:
Γ
⊢
ₜ
e1
:
TRef
τ
→
Γ
⊢
ₜ
e2
:
τ
→
Γ
⊢
ₜ
Store
e1
e2
:
TUnit
(** If *)
|
If_typed
Γ
e0
e1
e2
τ
:
Γ
⊢
ₜ
e0
:
TBool
→
Γ
⊢
ₜ
e1
:
τ
→
Γ
⊢
ₜ
e2
:
τ
→
Γ
⊢
ₜ
If
e0
e1
e2
:
τ
where
"Γ ⊢ₜ e : τ"
:
=
(
typed
Γ
e
τ
).
(**
We have already seen syntactic typing (introduced by Robbert):
...
...
@@ -29,6 +85,7 @@ step 2: Lift value interpretation to expressions (semantic typing judgment):
*)
Module
version1
.
Section
semtyp
.
Context
`
{!
heapG
Σ
}.
...
...
@@ -86,6 +143,13 @@ Section semtyp.
wp_pures
;
eauto
.
Qed
.
Theorem
fundamental
Γ
e
τ
:
Γ
⊢
ₜ
e
:
τ
→
Γ
⊨
e
:
τ
.
Proof
.
intros
Htyped
.
iInduction
Htyped
as
[]
"IH"
.
5
:
{
iApply
Pair_sem_typed
;
auto
.
}
Admitted
.
End
semtyp
.
End
version1
.
(* 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