agda / agda

Agda is a dependently typed programming language / interactive theorem prover.
https://wiki.portal.chalmers.se/agda/pmwiki.php
Other
2.41k stars 339 forks source link

Use compareAs for assignE even in compareAtom #7180

Closed plt-amy closed 3 months ago

plt-amy commented 3 months ago

I'm struggling to actually describe the bug that this fixes — I ran into it in the wild and divined a reproducer based on the logs (with 14 different verbosity flags...!). I guess literally the problem is this: if we compareAtom a neutral value in a singleton record against a projected metavariable, the field should be compareAs'd, to account for eta again.

The reproducer uses reflection to set up the elaborate ritual. We need:

The comparison against a projected meta lands us in applyE, which eta-expands the meta and compares the corresponding field in the expansion against the original thing. If you set things up just right you get fireworks:

Checking Test138 (/home/amelia/default/Projects/agda/Test138.agda).
/home/amelia/default/Projects/agda/Test138.agda:23,5-27,41
tt != Hom.hom fun tt of type ⊤

Anyway, the fix is just to compareAs the field, so that whatever applicable eta rules can fire again.