Skip to content

Require a positive floor count - #245

Merged
lemmy merged 1 commit into
tlaplus:masterfrom
Qian-Cheng-nju:elevator-floor-domain
Oct 23, 2026
Merged

lemmy merged 1 commit into
tlaplus:masterfrom
Qian-Cheng-nju:elevator-floor-domain

Conversation

@Qian-Cheng-nju

@Qian-Cheng-nju Qian-Cheng-nju commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

FloorCount is used in Floor == 1..FloorCount, but its domain is not stated. A Boolean value fails during interval evaluation; zero or negative values leave Floor empty, so Init has no states when there are people or elevators.

Add ASSUME FloorCountIsPositive == FloorCount \in (Nat \ {0}) to require at least one floor. This adds no upper bound and leaves the actions and invariants unchanged.

The shipped ElevatorSafetySmall and ElevatorLivenessMedium models pass with the same 4,122 distinct states. Parameter checks reject zero, negative and Boolean values before initialization, and accept 1, 2 and 1,000,000. Two focused TLAPS lemmas check that moving one floor toward a destination stays in Floor (six obligations, --strict --nofp). SANY passes for both modules.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that makes sense. I'll change it to Nat \ {0} and update the assumption name.

Signed-off-by: Qian-Cheng-nju <Qian-Cheng-nju@users.noreply.github.com>
@Qian-Cheng-nju Qian-Cheng-nju changed the title State the integer domain of FloorCount Require a positive floor count Oct 23, 2026
@lemmy
lemmy merged commit 0cab2b3 into tlaplus:master Oct 23, 2026
3 of 13 checks passed
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