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

Extend variability rules and fix invalid example #2526

Merged
merged 5 commits into from
Mar 16, 2020

Conversation

henrikt-ma
Copy link
Collaborator

Fixes #2525

Copy link
Collaborator

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

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

Looks good, but will wait a bit for other feedback before merging.

@gkurzbach
Copy link
Collaborator

Maybe I missed some discussion but
b2 = noEvent(x > 1);
for me is clearly a variability error, because the right side may change outside of events but b2 not.

and a further question is whether the assignment from i2 = x; makes x to a discrete variable, because it cannot change between events.

@henrikt-ma
Copy link
Collaborator Author

@gkurzbach, I think we all agree that there is a problem with the equation, the question is how to capture this intuition in the specification. the reason we can't fail the normal equation b2 = noEvent(x > 1) due to variability error is that a normal equation has no prescribed direction of causality. This is different in algorithms, inside when-clauses, and for declaration equations. The point of this PR is to improve the variability rules so that this equation can be reported as an error with reference to variability rules in the specification, instead of needing to come up with a tool-specific explanation.

@henrikt-ma
Copy link
Collaborator Author

henrikt-ma commented Mar 16, 2020

Regarding i2 = x, and as seen in the ongoing discussion in #2521, I think there is disagreement regarding whether x should be considered discrete-time or not for purposes of variability analysis.

This is my personal opinion on the matter: We shouldn't rely on this type of inferred variability when defining the variability of a variable. Instead, I'd like to be able to declare x as discrete Real, and that i2 = x; would be a valid equation for x (that is, not requiring x to be assigned in a when-clause).

For now, I suggest that x is just considered a non-discrete-time variable for purposes of variability analysis, that is, that we are not allowed to make use of the obvious fact that x has a discrete-time solution.

@gkurzbach gkurzbach self-requested a review March 16, 2020 15:13
@gkurzbach
Copy link
Collaborator

To the first point: I got it now. To the second: I agree with you.

Copy link
Collaborator

@gkurzbach gkurzbach left a comment

Choose a reason for hiding this comment

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

So it seems to be ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid example of variability error
3 participants