Revising equality check in Core to emit a guard #2971
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 forv==u
, since it matches on the head symbol for the projector off
and then tries to prove the arguments equal. Of course, this doesn't work whenv
andu
differ, although they agree on theirf
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.