Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narrowing integer bounds #20

Open
ramononis opened this issue Jun 25, 2019 · 0 comments
Open

Narrowing integer bounds #20

ramononis opened this issue Jun 25, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@ramononis
Copy link
Collaborator

ramononis commented Jun 25, 2019

Bachelor project?

Problem
The most trivial data type in Uppaal is the integer. Unlike in most programming languages, the int data type is a 16-bit signed number with a range of [-32768, 32767], unless specified otherwise.
In general, it is considered bad practice not to explicitly specify the bounds of data variables (e.g. by using data types):

  • It indicates that the modeler may not have thought about the possible values a integer may hold.
  • Specifying the bounds of an integer decreases the size of a state.
  • Unnecessarily unbounded integers can drastically increase the state space of a model.
  • Integer variables going outside of their intended (but not specified) range remain undetected.
  • Detecting overflows require the integers to go outside the default range, which may require a very large state space to be explored

Proposed solutions
The most basic solution would be a warning when using unbounded integers, which can be achieved with simple static analysis using the Ecore utils.
The more elegant solution would be to deduct what the bounds of integer variables should be based on some type of data flow analysis. E.g. based on an edge guard x < 10 with a update x = 0, one could conclude that x should have an range of [0, 10]. An variable x whose only assignment is y = x * x should have bounds [0, 100].

@ramononis ramononis added the enhancement New feature or request label Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant