-
Notifications
You must be signed in to change notification settings - Fork 4
/
LinQueuePlusCal.tla
67 lines (53 loc) · 1.76 KB
/
LinQueuePlusCal.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
-------------------------- MODULE LinQueuePlusCal --------------------------
EXTENDS LinQueue, Utilities
CONSTANT H
(*
--algorithm FindLinearization
variables
linearizable = FALSE,
completeHp, f, S;
begin
with Hp \in L!ExtendedHistories(H) do
completeHp := L!Complete(Hp);
end with;
with x \in L!Orderings(Len(completeHp)) do
f := x;
end with;
S := completeHp ** f;
linearizable := /\ L!IsSequential(S)
/\ IsLegal(S)
/\ L!AreEquivalent(S, completeHp)
/\ L!RespectsPrecedenceOrdering(H, S)
end algorithm
*)
\* BEGIN TRANSLATION
CONSTANT defaultInitValue
VARIABLES linearizable, completeHp, f, S, pc
vars == << linearizable, completeHp, f, S, pc >>
Init == (* Global variables *)
/\ linearizable = FALSE
/\ completeHp = defaultInitValue
/\ f = defaultInitValue
/\ S = defaultInitValue
/\ pc = "Lbl_1"
Lbl_1 == /\ pc = "Lbl_1"
/\ \E Hp \in L!ExtendedHistories(H):
completeHp' = L!Complete(Hp)
/\ \E x \in L!Orderings(Len(completeHp')):
f' = x
/\ S' = completeHp' ** f'
/\ linearizable' = (/\ L!IsSequential(S')
/\ IsLegal(S')
/\ L!AreEquivalent(S', completeHp')
/\ L!RespectsPrecedenceOrdering(H, S'))
/\ pc' = "Done"
Next == Lbl_1
\/ (* Disjunct to prevent deadlock on termination *)
(pc = "Done" /\ UNCHANGED vars)
Spec == Init /\ [][Next]_vars
Termination == <>(pc = "Done")
\* END TRANSLATION
=============================================================================
\* Modification History
\* Last modified Mon Oct 22 19:40:16 PDT 2018 by lhochstein
\* Created Sun Oct 21 19:33:05 PDT 2018 by lhochstein