Skip to content

[Metatheory] Fix eqDATA, array equality and remove builtinEq - #7923

Draft
ana-pantilie wants to merge 5 commits into
masterfrom
ana/fix-eqdata-eqbuiltin
Draft

[Metatheory] Fix eqDATA, array equality and remove builtinEq#7923
ana-pantilie wants to merge 5 commits into
masterfrom
ana/fix-eqdata-eqbuiltin

Conversation

@ana-pantilie

@ana-pantilie ana-pantilie commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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: moving primTrustMe from builtinEq to 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. eqBuiltin was defined specifically for this purpose, to bypass this issue, since it would call Haskell's (==) on the Haskell ByteString/etc. first and return the right result based on that. At the typechecking level, the equality check would default to true and use Agda's unification algorithm to decide the result (yes or typechecking would get stuck).


This PR also fixes the problems with eqDATA described in the issue, and it also removes its TERMINATING pragma.

I also uncovered another bug, namely that Array equality would compile to constant true. This should also be fixed now.

@ana-pantilie
ana-pantilie marked this pull request as ready for review August 27, 2026 16:04
@ana-pantilie ana-pantilie changed the title [Metatheory] Fix eqDATA and remove builtinEq [Metatheory] Fix eqDATA, array equality and remove builtinEq Aug 27, 2026
@ana-pantilie
ana-pantilie marked this pull request as draft August 27, 2026 19:32
@ana-pantilie
ana-pantilie removed the request for review from basetunnel August 27, 2026 19:32
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.

1 participant