-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmpb.tla
45 lines (31 loc) · 1.11 KB
/
mpb.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
-------------------------------- MODULE mpb --------------------------------
EXTENDS Sequences, Naturals
Min(x,y) == IF x < y THEN x ELSE y
CONSTANT MESSAGE, WINDOW_SIZE
VARIABLES index, output, buffer, n
vars == <<index, output, buffer, n>>
\* MULTIPLACE BUFFER
SendN == /\ buffer = <<>>
/\ n = 0
/\ n' \in index+1..Min(index+WINDOW_SIZE,Len(MESSAGE))
/\ buffer' = SubSeq(MESSAGE,index,n'-index)
ReceiveN == /\ buffer # <<>>
/\ output' = output \o buffer
/\ buffer' = <<>>
MovePlace == /\ buffer = <<>>
/\ n # 0
/\ index' = n
/\ n' = 0
Init == /\ index = 1
/\ output = <<>>
/\ buffer = <<>>
/\ n = 0
Next == \/ SendN /\ UNCHANGED <<output, index>>
\/ ReceiveN /\ UNCHANGED <<n, index>>
\/ MovePlace /\ UNCHANGED <<output, buffer>>
Spec == /\ Init
/\ [][Next]_vars
=============================================================================
\* Modification History
\* Last modified Tue Jun 18 22:09:31 NZST 2019 by jb567
\* Created Mon Jun 03 12:09:13 NZST 2019 by jb567