[Metatheory] Fix eqDATA, array equality and remove builtinEq - #7923
Draft
ana-pantilie wants to merge 5 commits into
Draft
[Metatheory] Fix eqDATA, array equality and remove builtinEq#7923ana-pantilie wants to merge 5 commits into
ana-pantilie wants to merge 5 commits into
Conversation
ana-pantilie
marked this pull request as ready for review
August 27, 2026 16:04
ana-pantilie
marked this pull request as draft
August 27, 2026 19:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes https://github.com/IntersectMBO/plutus-private/issues/2418
As part of fixing the issue above, I tried out what @basetunnel and I discussed last week: movingprimTrustMefrombuiltinEqto a dedicated function for each postulated type.I think this new design is much safer. It's also cleaner because we now have one decision procedure for each builtin type, and one boolean checker derived from the decision procedure.EDIT
Turns out the approach above doesn't work, and I've remembered why: the compiled decision procedures will not behave correctly, they'll just return
yes.eqBuiltinwas defined specifically for this purpose, to bypass this issue, since it would call Haskell's(==)on the HaskellByteString/etc. first and return the right result based on that. At the typechecking level, the equality check would default totrueand use Agda's unification algorithm to decide the result (yesor typechecking would get stuck).This PR also fixes the problems with
eqDATAdescribed in the issue, and it also removes its TERMINATING pragma.I also uncovered another bug, namely that
Arrayequality would compile to constanttrue. This should also be fixed now.