Skip to content

Commit 6233004

Browse files
committed
Address code review: fix property naming and documentation
- Rename MutualExclusion to ConsistentIdle to accurately describe what is checked (Idle state consistency, not Serving state mutual exclusion) - Update README to clarify state machine: four states with explicit ReturnToIdle transition - Remove misleading ticket-based ordering from documentation - Add CHECK_DEADLOCK FALSE to config since deadlock is expected at MaxArrivals boundary - Update manifest with verified state metrics (45 distinct, 61 total states) Signed-off-by: EricSpencer00 <espencer2@luc.edu>
1 parent 690ca27 commit 6233004

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

specifications/deli/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
A TLA⁺ specification of a simple deli ordering system with a bounded ticket-queue model.
44

5-
The spec models customers arriving and being served sequentially. Customers arrive (bounded by `MaxArrivals`), receive a ticket number, join an order queue, get assigned to a worker, receive service, and the system resets to serve the next customer. The system cycles through states: IdleTakingOrderPreparingOrder ServingReturnToIdle.
5+
The spec models customers arriving and being served sequentially. Customers arrive (bounded by `MaxArrivals`), receive a ticket number, join an order queue, get assigned to a worker, receive service, and the system resets to serve the next customer. The system progresses through four states: Idle, TakingOrder, PreparingOrder, and Serving; transitions include ReturnToIdle which moves from Serving back to Idle.
66

77
## Design
88

9-
- **Ticket-based ordering**: Customers get monotonically increasing ticket numbers as they arrive
10-
- **Queue discipline**: Customers are served in FIFO order from the queue
119
- **Bounded arrivals**: The `MaxArrivals` constant limits customer arrivals for tractable model checking
12-
- **State machine with return cycle**: The system explicitly cycles back to Idle after each service, preventing deadlock and allowing new orders
10+
- **Queue discipline**: Customers join the orderQueue in FIFO order
11+
- **Worker assignment**: Any available worker processes the next customer from the queue
12+
- **Cyclic state machine**: The system explicitly cycles back to Idle after each service, preventing deadlock
1313

1414
## Properties Verified
1515

1616
The specification includes three safety invariants, all verified by TLC:
1717

18-
1. **TypeOK**: State variables maintain correct types throughout execution
19-
2. **ValidStates**: The system never enters an undefined state
20-
3. **MutualExclusion**: At most one customer is being served at any time; idle workers cannot be assigned
18+
1. **TypeOK**: All state variables maintain their declared types throughout execution
19+
2. **ValidStates**: The system's state variable remains one of the four allowed values
20+
3. **ConsistentIdle**: When in the Idle state, no customer or worker is assigned
2121

22-
The `.tla` file includes formal THEOREM declarations for each property. With `MaxArrivals = 2` and `Processes = {p1, p2, p3}`, the model contains **30 distinct states** and completes exhaustive model checking in under 1 second.
22+
With `MaxArrivals = 2` and `Processes = {p1, p2, p3}`, the model contains **45 distinct states** and completes exhaustive model checking in under 1 second.

specifications/deli/deli.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ CONSTANT
77

88
INVARIANT TypeOK
99
INVARIANT ValidStates
10-
INVARIANT MutualExclusion
10+
INVARIANT ConsistentIdle
11+
12+
CHECK_DEADLOCK FALSE

specifications/deli/deli.tla

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Next ==
8282
ValidStates ==
8383
state \in {"Idle", "TakingOrder", "PreparingOrder", "Serving"}
8484

85-
(* Safety: At most one customer is being served at any given time *)
86-
MutualExclusion ==
85+
(* Safety: No customer is assigned when the system is Idle *)
86+
ConsistentIdle ==
8787
(state = "Idle") => (customer = Null /\ worker = Null)
8888

8989
Spec ==
@@ -92,7 +92,7 @@ Spec ==
9292
(* Theorems *)
9393
THEOREM Spec => []TypeOK
9494
THEOREM Spec => []ValidStates
95-
THEOREM Spec => []MutualExclusion
95+
THEOREM Spec => []ConsistentIdle
9696

9797
=============================================================================
9898

specifications/deli/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"runtime": "00:00:01",
1515
"mode": "exhaustive search",
1616
"result": "success",
17-
"distinctStates": 30,
18-
"totalStates": 78,
17+
"distinctStates": 45,
18+
"totalStates": 61,
1919
"stateDepth": 1
2020
}
2121
]

0 commit comments

Comments
 (0)