Download presentation

Presentation is loading. Please wait.

Published byHadley Endicott Modified about 1 year ago

1
20110248 CSE 김형준 5 월 30 일 무은재 기념관 308 호

2
Remind Γ▷e : U Given untyped expression e can have type U ㆍ ▷ λx.x : int → int ㆍ ▷ λx.x : bool → bool ㆍ ▷ λx.x : ∀α. α→α All these typings make sense.

3

4
e Untyped expressions set Types set

5
λx.x Untyped expressions set Types set int → int bool → bool …

6
Bottom up Top down

7
Why we need to check whether a is fresh or not? If we reuse type variable which is not fresh under gamma, there may occur unintended link between unrelated variable actually.

8
Why we need Spec rule? To instantiate polytype variable x to monotype so that we can use x polymorphically.

9
W(Γ,e) = (S,A) type Substitution S ::= id | {A/α} | S о S mapping from type variables to monotypes why not polytypes? In my opinion, we may introduce type variable when typing lambda abstraction, and the lambda binder must be monotype in let polymorphism which is base of implicit polymorphism.

10

11
When we talk about Most General type, by its definition, λx.x can have another most general type which is ∀β.∀α. α→α. This type also can be instantiated to all types that ∀α. α→α can be. So we need more constraint to define most general type strictly. In my opinion, this constraint may work. This kind of unrealistic situation happens because we can create a type variables which is not used actually, so every introduced type variables must be used at least once in body. Otherwise it is not most general type because it has meaningless part(not optimization).

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google