-
Notifications
You must be signed in to change notification settings - Fork 0
/
9.txt
86 lines (49 loc) · 2.15 KB
/
9.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# 9.2.1
Because no base types are defined in the style, which means any value will be any type.
# 9.2.2
(Q. where did T-TRUE come from?)
1.
-------------------------- T-FALSE
f:Bool->Bool ∈ f:Bool->Bool f:Bool->Bool ⊢ false:Bool
--------------------------- T-VAR --------------------------------------------------- T-IF
f:Bool->Bool ⊢ f:Bool->Bool f:Bool->Bool ⊢ if false then true else false:Bool
------------------------------------------------------------------------------------------------- T-APP
f:Bool->Bool ⊢ f (if false then true else false):Bool
2.
f:Bool->Bool,x:Bool ∈ f:Bool->Bool
----------------------------------- T-VAR ------------------------------------------------------
f:Bool->Bool,x:Bool ⊢ f:Bool->Bool f:Bool->Bool,x:Bool ⊢ if x then false else x:Bool
----------------------------------------------------------------------------------------------------- T-APP
f:Bool->Bool,x:Bool ⊢ \x : f (if x then false else x) : Bool->Bool
----------------------------------------------------------------------------- T-ABS
f:Bool->Bool ⊢ \x : Bool. f (if x then false else x) : Bool->Bool
# 9.2.3
e.g.)
f: Bool->Bool->Bool, x:Bool, y:Bool
f: (Bool->Bool)->Bool->Bool, x:Bool->Bool, y:Bool
...
in general
f: T->U->Bool, x:T, y:U
# 9.3.2
(1) `x` has to be `S->T` type since one argument is applied to `x` and will be evaluated as `T`
(2) `S` in (1) has to be `S->T` since both `x` has to be the same type
(3) `S` in (2) has to be ...
As described above, derivation cannot determine `S` and this is infinite number of types; therefore, there is no context Γ.
# 9.3.3
Lemma 9.3.1 covers all the situation
TODO:
# 9.3.9
TODO:
# 9.3.10
No.
counterexample:
Suppose that a nested abstraction with an unused argument, then pass a different typed value as the argument. Although this abstraction is considered to be ill-typed, the induced one is well-typed.
(\x:S. \y:T. y) v:U :??
[E-APPABS] -> [x->v] (\y:T. y) : T
# 9.4.1
8-1
introduction: T-TRUE, T-FALSE
elimination: T-IF
8-2
introduction: T-ZERO, **T-SUCC**
elimination: T-PRED, T-ISZERO