-
Notifications
You must be signed in to change notification settings - Fork 1
/
LetPairExtension.xstw
31 lines (27 loc) · 1.02 KB
/
LetPairExtension.xstw
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
module LetPairExtension;
import PairExtension;
import LetSeqExtension;
extension {
context-free syntax
"(" ID "," ID ")" "=" Term -> Binding
inductive definitions
T-LetPair1:
(C |- t1 : Pair T1) (C,x1:T1,x2:T1 |- let bs in t2 : T2)
--------------------------------------------------------
C |- let (x1,x2) = t1; bs in t2 : T2
T-LetPair2:
(C |- t1 : Pair T1) (C,x1:T1,x2:T1 |- t2 : T2)
----------------------------------------------
C |- let (x1,x2) = t1 in t2 : T2
desugarings
{ (C |- t1 : Pair T1) (C,x1:T1,x2:T1 |- let bs in t2 : T2)
--------------------------------------------------------
C |- [ let (x1,x2) = t1; bs in t2 ] : T2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>
(\x1:T1.\x2:T1. let bs in t2) (t1.1) (t1.2) }
{ (C |- t1 : Pair T1) (C,x1:T1,x2:T1 |- t2 : T2)
----------------------------------------------
C |- [ let (x1,x2) = t1 in t2 ] : T2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>
(\x1:T1.\x2:T1. t2) (t1.1) (t1.2) }
}