Skip to content

State the integer domain of FloorCount - #245

Open
Qian-Cheng-nju wants to merge 1 commit into
tlaplus:masterfrom
Qian-Cheng-nju:elevator-floor-domain
Open

Qian-Cheng-nju wants to merge 1 commit into
tlaplus:masterfrom
Qian-Cheng-nju:elevator-floor-domain

Conversation

@Qian-Cheng-nju

Copy link
Copy Markdown
Contributor

FloorCount is used in Floor == 1..FloorCount, but its domain is not stated. For example, FloorCount = TRUE is not excluded by an assumption; TLC then fails while evaluating the interval during initialization.

Add ASSUME FloorCountIsInteger == FloorCount \in Int. This states the domain needed by the interval and movement arithmetic. It adds neither a positivity requirement nor an upper bound, and leaves the actions and invariants unchanged.

The shipped ElevatorSafetySmall and ElevatorLivenessMedium models pass before and after the change with the same 4,122 distinct states. Parameter checks accept zero, negative and large integers, and reject the Boolean value at assumption evaluation. Two focused TLAPS lemmas also check that moving one floor toward an integer destination stays in Floor (six obligations, --strict --nofp).

Elevator, \* The set of all elevators
FloorCount \* The number of floors serviced by the elevator system

ASSUME FloorCountIsInteger == FloorCount \in Int

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Qian-Cheng-nju Shouldn't Int be replaced with Nat \ {0}, given that the set of valid floors is defined as Floor == 1 .. FloorCount?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants