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

Comparison operations can be chained, but lead to generator problems later #69

Open
MattWindsor91 opened this issue Jan 25, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@MattWindsor91
Copy link

In one of my models, I have expressions of the form 0 <= x <= 180 where x is a nat. This validates ok, which led me to believe that the semantics would be equivalent to 0 <= x /\ x <= 180. csp-gen, however, generates the direct CSP translation ((0 <= x) <= 180), which is ill-formed CSP as it is comparing a Bool with an Int.

A read of the draft Z specification tells me that <= et al. are strictly mathematical toolkit relations with the type P(A × A), which would lead me to believe that if RoboChart's expression language is generally faithful to Z's then the validator or grammar should not be allowing this sort of expression. It might be that this chaining is intentional, in which case the CSP generator is at fault (and therefore I'd be happy to reopen the bug there).

@MattWindsor91 MattWindsor91 added the bug Something isn't working label Jan 25, 2023
@pefribeiro
Copy link
Contributor

Hi @MattWindsor91, in what context is your expression being used? I just tried this in a condition and I get a type-checker error, as it should be?

@MattWindsor91
Copy link
Author

MattWindsor91 commented Jan 25, 2023

Ah, apologies -- it's preconditions and postconditions in functions. I can see the type checker is, rightly, unable to determine a type in other positions.

@pefribeiro
Copy link
Contributor

Ok, I think that's because there is no type-checking implemented for those.

@MattWindsor91
Copy link
Author

That would make sense! Is type checking the pre/postconditions difficult, or something I could trivially PRQ in at some point? Presumably the former.

@pefribeiro
Copy link
Contributor

I think that would be for @alvarohm to comment. I don't suppose it's difficult, but I think it may just have been that there was not sufficient coverage in the implementation, and so it could have precluded writing of more complex pre/postconditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants