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

Revising equality check in Core to emit a guard #2971

Merged
merged 4 commits into from
Jun 26, 2023
Merged

Conversation

nikswamy
Copy link
Collaborator

In case both sides are equational

With @meganfrisella, we observed today that if you try to prove v.f == u.f using Core, this results in an SMT guard for v==u, since it matches on the head symbol for the projector of f and then tries to prove the arguments equal. Of course, this doesn't work when v and u differ, although they agree on their f field.

The patch here tries to mimic the behavior of Rel. If the head symbol of both sides of an equation t1 == t2 are equatable (as decided by Rel, i.e., they are marked equational), and if emitting a guard is ok, then Core will prefer to emit a guard rather than unfolding and trying the prove the equation structurally.

@nikswamy nikswamy requested review from aseemr and mtzguido June 20, 2023 22:53
(no_guard (compare_head_and_args ()))
(fun _ -> emit_guard t0 t1)
)
else compare_head_and_args ()
Copy link
Collaborator Author

@nikswamy nikswamy Jun 26, 2023

Choose a reason for hiding this comment

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

Thanks to discussion with @mtzguido, this check is now revised as per the comment.

If we're solving equality problems and either side is equatable, then first try structurally but without SMT. And if that fails, then fallback to SMT on the original pair of terms.

@nikswamy
Copy link
Collaborator Author

I just got an Everest green with this too.

@nikswamy nikswamy merged commit 1614bb2 into master Jun 26, 2023
@nikswamy nikswamy deleted the _nik_core_equatable branch June 26, 2023 20:30
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.

2 participants