-
Notifications
You must be signed in to change notification settings - Fork 0
/
linearity.txt
109 lines (67 loc) · 2.47 KB
/
linearity.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Γ ⊢ e : A ⊣ Γ'
Γ' ⇓ Γ ↝ Γ''
Γ'' ⊢ e' : A ⊣ Δ
————————————————————
Γ ⊢ e || e' : A ⊣ Δ
Δ ⊢ e : A+B ⊣ Γ₀
Γ₀, x:A ⊢ e₁ : C ⊣ Γ₁, x:A, Γ'
Γ₀ ⇓ Γ₁ ↝ Γ₂
Γ₂, y:B ⊢ e₂ : C ⊣ Δ', y:B, Γ''
Δ' ∼ Γ₁
————————————————————————————————
Δ ⊢ case(e, x.e₁, y.e₂) : C ⊢ Δ'
Γ ::= · | Γ, α̂ | Γ, α̂=A | Γ, x:A | Γ, x∼A[+] | Γ, x∼A[-]
The judgment's invariant is that the set of term variables is the
same, but (1) more type variables may be introduced, and (2) evars may
get values, and (3) linear variables may go from + to -
Γ, β̂, γ̂, α̂ =̱ β̂ → γ̂, Γ', x:α̂ ⊢ e ⇐ β̂ ⊣ Γ'', x:α̂, Γ'''
————————————————————————————————————————————————————
Γ, α̂, Γ' ⊢ λx.e ⇐ α̂ ⊣ Γ''
To merge contexts:
Γ ⇓ Γ' ↝ Γ''
———————————————————————————————————
Γ, x∼A[±] ⇓ Γ', x∼A[_] ↝ Γ'', x∼A[±]
Γ ⇓ Γ' ↝ Γ''
———————————————————————————
Γ, x:A ⇓ Γ', x:A ↝ Γ'', x:A
Γ ⇓ Γ' ↝ Γ''
———————————————
Γ, α̂ ⇓ Γ' ↝ Γ''
Γ ⇓ Γ' ↝ Γ''
———————————————————
Γ ⇓ Γ', α̂ ↝ Γ'', α̂
Γ ⇓ Γ' ↝ Γ''
———————————————
Γ, α̂ ⇓ Γ' ↝ Γ''
Γ ⇓ Γ' ↝ Γ''
—————————————————
Γ, α̂=A ⇓ Γ' ↝ Γ''
Γ ⇓ Γ' ↝ Γ''
——————————————————————
Γ ⇓ Γ', α̂=A ↝ Γ'', α̂=A
When two contexts are resource-compatible?
Γ ∼ Δ
Γ ∼ Δ
—————————————————————
Γ, x∼A[+] ∼ Δ, x∼A[+]
Γ ∼ Δ
—————————————————————
Γ, x∼A[-] ∼ Δ, x∼A[-]
Γ ∼ Δ
———————————————
Γ, x:A ∼ Δ, x:A
Γ ∼ Δ
—————————
Γ, α̂ ∼ Δ
Γ ∼ Δ
————————
Γ ∼ Δ, α̂
Γ ∼ Δ
————————
Γ, α̂ ∼ Δ
Γ ∼ Δ
——————————
Γ, α̂=A ∼ Δ
Γ ∼ Δ
——————————
Γ ∼ Δ, α̂=A