Skip to content

Commit 483c5ea

Browse files
committed
Add MaxArrivals constant to bound state space for tractable model checking
1 parent 36269e9 commit 483c5ea

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

specifications/deli/deli.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ SPECIFICATION Spec
33
CONSTANT
44
Processes = {p1, p2, p3}
55
Null = null
6+
MaxArrivals = 2
67

78
INVARIANT TypeOK
89
INVARIANT ValidStates

specifications/deli/deli.tla

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
EXTENDS Naturals, Sequences
1010

11-
CONSTANTS Processes, Null
11+
CONSTANTS Processes, Null, MaxArrivals
1212

13-
VARIABLES ticket, worker, customer, state, orderQueue
13+
VARIABLES ticket, worker, customer, state, orderQueue, arrivals
1414

1515
(***************************************************************************)
1616
(* State variables: *)
@@ -28,19 +28,23 @@ TypeOK ==
2828
/\ customer \in Processes \cup {Null}
2929
/\ state \in {"Idle", "TakingOrder", "PreparingOrder", "Serving"}
3030
/\ orderQueue \in Seq(Processes)
31+
/\ arrivals \in Nat
3132

3233
Init ==
3334
/\ ticket = 0
3435
/\ worker = Null
3536
/\ customer = Null
3637
/\ state = "Idle"
3738
/\ orderQueue = <<>>
39+
/\ arrivals = 0
3840

3941
(* Customer arrives, gets a ticket number, and joins the queue *)
4042
TakeOrder ==
4143
/\ state = "Idle"
44+
/\ arrivals < MaxArrivals
4245
/\ \E c \in Processes :
4346
/\ ticket' = ticket + 1
47+
/\ arrivals' = arrivals + 1
4448
/\ orderQueue' = Append(orderQueue, c)
4549
/\ state' = "TakingOrder"
4650
/\ UNCHANGED <<worker, customer>>
@@ -55,21 +59,21 @@ PrepareOrder ==
5559
/\ worker' = w
5660
/\ orderQueue' = Tail(orderQueue)
5761
/\ state' = "PreparingOrder"
58-
/\ UNCHANGED ticket
62+
/\ UNCHANGED <<ticket, arrivals>>
5963

6064
(* The assigned worker serves the current customer *)
6165
Serve ==
6266
/\ state = "PreparingOrder"
6367
/\ state' = "Serving"
64-
/\ UNCHANGED <<ticket, worker, customer, orderQueue>>
68+
/\ UNCHANGED <<ticket, worker, customer, orderQueue, arrivals>>
6569

6670
(* Customer is served, worker and customer reset, ready for the next order *)
6771
ReturnToIdle ==
6872
/\ state = "Serving"
6973
/\ state' = "Idle"
7074
/\ worker' = Null
7175
/\ customer' = Null
72-
/\ UNCHANGED <<ticket, orderQueue>>
76+
/\ UNCHANGED <<ticket, orderQueue, arrivals>>
7377

7478
Next ==
7579
TakeOrder \/ PrepareOrder \/ Serve \/ ReturnToIdle
@@ -83,7 +87,7 @@ MutualExclusion ==
8387
(state = "Idle") => (customer = Null /\ worker = Null)
8488

8589
Spec ==
86-
Init /\ [][Next]_<<ticket, worker, customer, state, orderQueue>>
90+
Init /\ [][Next]_<<ticket, worker, customer, state, orderQueue, arrivals>>
8791

8892
(* Theorems *)
8993
THEOREM Spec => []TypeOK

0 commit comments

Comments
 (0)