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

Should pred/fun parameters be type checked in runtime? #275

Open
nmacedo opened this issue May 3, 2024 · 1 comment
Open

Should pred/fun parameters be type checked in runtime? #275

nmacedo opened this issue May 3, 2024 · 1 comment
Labels
food-for-thought Open problems

Comments

@nmacedo
Copy link
Contributor

nmacedo commented May 3, 2024

Alloy allows function/predicate calls like the following, as long as the type of the parameter and the type of the argument are not disjoint (which is the case here, since univ contains A):

sig A,B {}

pred p[a:A] {
  a in univ
}

run { no A and some x: univ | p[x] }

The problem is that the resulting instance is inconsistent: it will have a B$0 for which p holds, even marked $x from skolemization (see screenshot). Even more confusing, if you ask the evaluator whether p[B$0] holds, it will gives a type error, even though it was the $x witness that made the run command consistent. However, if you ask p[x$0] it replies true, even though x$0 = B$0, because its type is univ.
Screenshot 2024-05-03 at 13 57 28

This would be solved if calls to predicates tested the type of the argument during solving (in this case, a in A, which would exclude B atoms from passing it).

@nmacedo nmacedo added the food-for-thought Open problems label May 3, 2024
@grayswandyr
Copy link
Contributor

This message from @dnjackson might be timely.

@nmacedo nmacedo changed the title Show pred/fun parameters be type checked in runtime? Should pred/fun parameters be type checked in runtime? May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
food-for-thought Open problems
Projects
None yet
Development

No branches or pull requests

2 participants