agda-stdlib
agda-stdlib copied to clipboard
Problem with `DISPLAY` pragma for `⊥` in `Data.Empty`
Agda issue#7533 and its 'resolution'/explanation via Agda issue#2004 suggests that perhaps we should rethink our approach to how to deal lexically with the ⊥ token (for output as well as input)? Or else (at least!) document that Data.Irrelevant should be approached with caution...
Sadly, syntax declarations are subject to the same, or similar, effects, so attempting to write
syntax Irrelevant Empty = ⊥
is both ill-formed (the 'hole' Empty is never used), and useless (Empty is not correctly interpreted as a already-defined term).
Perhaps a solution is simply to remove the DISPLAY pragma altogether?
UPDATED: NB. this is the only use of the pragma in stdlib!
Hmm, this is very irritating. It's a big usability loss to remove the DISPLAY pragma... I really don't want Irrelevant Empty popping up in people's buffers...
Introduced by @gallais in https://github.com/agda/agda-stdlib/commit/367e3d620a8512a36e2916dc081cdf300593f749. Can't exactly revert this either, as it'll break a lot of code.
@gallais any ideas?
Could we use the new abstract feature somehow to prevent reduction?
Could we use the new abstract feature somehow to prevent reduction?
This is what I was going to suggest we should experiment with.
However the following does not typecheck and so it does seem that Agda's emptyness check
refuses to go under abstract types which would make it a dramatically breaking change.
data Empty : Set where
abstract
⊥ : Set
⊥ = Empty
⊥-elim : ⊥ → ∀ {a} {A : Set a} → A
⊥-elim ()
I've commented on an upstream issue bringing up a similar issue for positivity annotations: https://github.com/agda/agda/issues/6970#issuecomment-2396159611
Andreas has reopened my originating issue, so there may be upstream progress at some point https://github.com/agda/agda/pull/7536 ... in the meanwhile, display pragma is a new label on the main Agda issue tracker...
Separately, he hinted that perhaps REWRITE could be used here, but I'm not clear whether or not any such attempt would be subject to the same interpretation of Empty as a (pattern) variable...
As for pragmatics of the problem, I only encountered it when trying to have Data.Empty and Data.Irrelevant in scope at the same time... a (perhaps) rare scenario? (And leaning in to my customary observation about explicit use of ⊥ and ⊥-elim when these are largely avoidable via other mechanisms...)
Prompted by this issue, Agda 2.8 might have more usable DISPLAY pragmas:
- https://github.com/agda/agda/pull/7543
This should fix your problem (albeit not right now).
That's great, thank you! So I guess we mark this issue as blocked upstream and wait for the fix.
@jamesmckinna can you confirm that this problem is resolved in v2.8.0-rc3 and if so close this issue?
Ugh... @MatthewDaggitt it turns out in my setup that I can't seem to install RC3 (both cabal- and stack- based install fall over, the first with dependencies, the second with invalid HTTP requests), so I can't seem to achieve this right now... sigh.
@Taneb are you able to check that the issue goes away under v2.8.0-rc3?
I'll take a look this afternoon
Sorry I won't have time now to look at this, any update @Taneb ?
Okay removing this from v2.3 milestone regardless as I think the consensus is that this is an upstream problem rather than something to be fixed by us now.
Isn't this fixed by switching to Agda 2.8.0?
After some install woes, I can now confirm that this is fixed by v2.8.0! :tada: