-
Notifications
You must be signed in to change notification settings - Fork 0
/
typedefs.tla
41 lines (31 loc) · 1.14 KB
/
typedefs.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
------------------------------- MODULE typedefs --------------------------------
EXTENDS Variants
(*
* Type definitions:
*
* Type-1 messages.
* @typeAlias: msgOne = { src: REPLICA, r: Int, v: Int };
*
* Type-2 messages.
* @typeAlias: msgTwo = Q({ src: REPLICA, r: Int }) | D({ src: REPLICA, r: Int, v: Int });
*)
typedefs_aliases == TRUE
\* predefined constants for the steps
S1 == "S1_OF_STEP"
S2 == "S2_OF_STEP"
S3 == "S3_OF_STEP"
\* @type: (REPLICA, Int, Int) => $msgOne;
M1(src, round, value) == [ src |-> src, r |-> round, v |-> value ]
\* @type: (REPLICA, Int) => $msgTwo;
Q2(src, round) == Variant("Q", [ src |-> src, r |-> round ])
\* @type: $msgTwo => Bool;
IsQ2(msg) == VariantTag(msg) = "Q"
\* @type: $msgTwo => { src: REPLICA, r: Int };
AsQ2(msg) == VariantGetUnsafe("Q", msg)
\* @type: (REPLICA, Int, Int) => $msgTwo;
D2(src, round, value) == Variant("D", [ src |-> src, r |-> round, v |-> value ])
\* @type: $msgTwo => Bool;
IsD2(msg) == VariantTag(msg) = "D"
\* @type: $msgTwo => { src: REPLICA, r: Int, v: Int };
AsD2(msg) == VariantGetUnsafe("D", msg)
================================================================================