Fakultas Ilmu Komputer UI
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ariangganugraha-funpro2020-lambda
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ari Angga Nugraha
ariangganugraha-funpro2020-lambda
Commits
92afbc2b
Commit
92afbc2b
authored
8 years ago
by
Sean Gillespie
Browse files
Options
Downloads
Patches
Plain Diff
Update System F doc
Add typechecking rules for System F
parent
212582f8
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
doc/system-f.md
+53
-0
53 additions, 0 deletions
doc/system-f.md
with
53 additions
and
0 deletions
doc/system-f.md
+
53
−
0
View file @
92afbc2b
...
...
@@ -294,6 +294,59 @@ application, we can instantiate these to the concrete type `CN`. Here
Using a combination of type abstraction and application, we define functions
that can operate on all types.
## Type Checking
Just like
λ
<sub>
→
</sub>
, an expression is
*well-typed*
if we can
determine its type.
In addition to the typing rules in
λ
<sub>
→
</sub>
, we introduce two
more. We repeat them here.
### Variables
Variables have the typing rule
x:T ∈ Γ
⇒ Γ ⊢ x:T
If the context
`Γ`
contains
`x`
of type
`T`
, then
`x`
has type
`T`
in the
context
`Γ`
.
### Abstractions
Abstractions use the typing rule
Γ, x:T ⊢ y:U
⇒ Γ ⊢ λ x:T. y : T → U
We first add
`x:T`
to the context
`Γ`
. If
`y`
has type
`U`
in this context,
then
`λ x:T. y`
has type
`T → U`
### Applications
Function applications have the rule
Γ ⊢ x:T → U, Γ ⊢ y:T
⇒ Γ ⊢ x y : U
If
`x`
has type
`T → U`
and
`y`
has type
`T`
in the context
`Γ`
, then
`x y`
has the type
`U`
.
### Type Abstractions
Type abstraction is the first of two new rules.
Γ, X ⊢ t:T
⇒ Γ ⊢ Λ X. t : ∀ X. T
We add the type
`X`
to the context. If
`t`
has type
`T`
, then
`Λ X. t`
has the
type ∀ X. T.
### Type Applications
Finally, type applications have the rule
Γ ⊢ t : ∀ X. T
⇒ Γ ⊢ t [U] : [X ↦ U] T
Assume
`t`
has type
`∀ X. T`
. Given the type application
`t [U]`
, we substitute
all occurrences of
`X`
with
`U`
in
`T`
.
# References
1.
[
System F
](
https://en.wikipedia.org/wiki/System_F
)
. Wikipedia: The Free Encyclopedia
2.
Types and Programming Languages. Benjamin C. Pierce
...
...
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