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

Fixing translation of polymorphic constants to Z3 #455

Closed
wants to merge 3 commits into from

Conversation

ibnyusuf
Copy link
Member

#300 fixed the translation of polymorphic terms with arity > 0. However, we treat constants differently and they were not being translated correctly. This PR should ensure that they are now translated correctly to Z3.

Revert "fixing translation of polymorphic constants to Z3"

This reverts commit 94e7f3b.
@ibnyusuf ibnyusuf linked an issue Jun 23, 2023 that may be closed by this pull request
@MichaelRawson
Copy link
Contributor

The code seems fine, but I don't understand the fix.

fixed the translation of polymorphic terms with arity > 0

Shouldn't polymorphic terms be of arity > 0 by definition? They need a sort variable to be polymorphic.

From #453

If I understand correctly, #300 was a fix for theory instantiation where we know that we are only passing ground things to Z3. Hence, we can safely treat function symbols as indexed families.

When it comes to AVATAR, we pass non-ground things as well and this is where the issue arises.

AVATAR should only pass ground things to Z3. If not (and apparently it doesn't), we need some logic to do the grounding to something reasonable. To start with I'd suggest a new uninterpreted sort and a new uninterpreted constant of that sort, although it's possible that we could do better. Then, the logic in #300 should produce a family of functions for each polymorphic function on-demand.

What am I missing?

@ibnyusuf
Copy link
Member Author

ibnyusuf commented Jun 26, 2023

Please ignore the comment about non-ground and AVATAR. That was just a silly misunderstanding. I believe we only pass ground things to Z3 in AVATAR.

Indeed, polymorphic terms do have arity > 0. In an old version of this code, we treated something as a constant if numTermArgs > 0. However, that was fixed in master. I carried out my "fix" for the same issue on a branch that didn't contain this fix and then ported it onto master without noticing the different condition.

I have now investigated the root cause of #300 more deeply and it is being cause by unification with abstraction code creating constraints between sorts incorrectly. As the whole UWA mechanism is set to change, I don't propose a fix now, but will leave the bug report open so that it can be revited once the new UWA implementation goes in. I'm closing this PR now.

@ibnyusuf ibnyusuf closed this Jun 26, 2023
@MichaelRawson
Copy link
Contributor

OK, thanks anyway @ibnyusuf - sounds like we got somewhere. :-)

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.

Polymorphism and Z3 not playing nicely
2 participants