-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tuples.tla
132 lines (120 loc) · 2.6 KB
/
Tuples.tla
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---- MODULE Tuples ----
(*
* Typed operations over tuples. This module contains typed tuple constructors,
* which resolve ambiguity between various versions of <<...>>.
*
* Igor Konnov, 2024.
*
* Subject to Apache 2.0. See LICENSE.
*)
(**
* Construct a pair.
*
* (a, b) => <<a, b>>;
*)
Pair(x, y) ==
LET \* @type: <<a, b>>;
_res == <<x, y>>
IN
_res
(**
* Construct a singleton tuple.
*
* (a) => <<a>>;
*)
T1(x) ==
LET \* @type: <<a>>;
_res == <<x>>
IN
_res
(**
* Construct a pair, same as `Pair(x, y)`.
*
* (a, b) => <<a, b>>;
*)
T2(x, y) ==
LET \* @type: <<a, b>>;
_res == <<x, y>>
IN
_res
(**
* Construct a triple.
*
* (a, b, c) => <<a, b, c>>;
*)
T3(x, y, z) ==
LET \* @type: <<a, b, c>>;
_res == <<x, y, z>>
IN
_res
(**
* Construct a 4-element tuple.
*
* (a1, a2, a3, a4) => <<a1, a2, a3, a4>>;
*)
T4(e1, e2, e3, e4) ==
LET \* @type: <<a1, a2, a3, a4>>;
_res == <<e1, e2, e3, e4>>
IN
_res
(**
* Construct a 5-element tuple.
*
* (a1, a2, a3, a4, a5) => <<a1, a2, a3, a4, a5>>;
*)
T5(e1, e2, e3, e4, e5) ==
LET \* @type: <<a1, a2, a3, a4, a5>>;
_res == <<e1, e2, e3, e4, e5>>
IN
_res
(**
* Construct a 6-element tuple.
*
* (a1, a2, a3, a4, a5, a6) => <<a1, a2, a3, a4, a5, a6>>;
*)
T6(e1, e2, e3, e4, e5, e6) ==
LET \* @type: <<a1, a2, a3, a4, a5, a6>>;
_res == <<e1, e2, e3, e4, e5, e6>>
IN
_res
(**
* Construct a 7-element tuple.
*
* (a1, a2, a3, a4, a5, a6, a7) => <<a1, a2, a3, a4, a5, a6, a7>>;
*)
T7(e1, e2, e3, e4, e5, e6, e7) ==
LET \* @type: <<a1, a2, a3, a4, a5, a6, a7>>;
_res == <<e1, e2, e3, e4, e5, e6, e7>>
IN
_res
(**
* Construct an 8-element tuple.
*
* (a1, a2, a3, a4, a5, a6, a7, a8) => <<a1, a2, a3, a4, a5, a6, a7, a8>>;
*)
T8(e1, e2, e3, e4, e5, e6, e7, e8) ==
LET \* @type: <<a1, a2, a3, a4, a5, a6, a7, a8>>;
_res == <<e1, e2, e3, e4, e5, e6, e7, e8>>
IN
_res
(**
* Construct a 9-element tuple.
*
* (a1, a2, a3, a4, a5, a6, a7, a8, a9) => <<a1, a2, a3, a4, a5, a6, a7, a8, a9>>;
*)
T9(e1, e2, e3, e4, e5, e6, e7, e8, e9) ==
LET \* @type: <<a1, a2, a3, a4, a5, a6, a7, a8, a9>>;
_res == <<e1, e2, e3, e4, e5, e6, e7, e8, e9>>
IN
_res
(**
* Construct a 10-element tuple.
*
* (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) => <<a1, a2, a3, a4, a5, a6, a7, a8, a9, a10>>;
*)
T10(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) ==
LET \* @type: <<a1, a2, a3, a4, a5, a6, a7, a8, a9, a10>>;
_res == <<e1, e2, e3, e4, e5, e6, e7, e8, e9, e10>>
IN
_res
=======================