Repository navigation
Description
The current definition of Data.Empty, and its derivative sub-module Data.Empty.Irrelevant are the basis of the current (re-)definition of Relation.Nullary.Negation and ... everything else involving ⊥ and negation ¬ A etc.
What's at present missing, and responsible for the artificial distinction between
Data.Empty.Irrelevant.⊥-elim : ∀ {w} {Whatever : Set w} → .⊥ → WhateverData.Empty.⊥-elim : ∀ {w} {Whatever : Set w} → ⊥ → Whatever
is the equivalence of .⊥ and ⊥... ie that ⊥ is Recomputable.
NB Recomputable seems to be the modern-dress version of the very old idea that certain types (negated formulae, among others) have no computational content, that is, we can't make essential use (eg by pattern-matching) of their inhabitants in order to define/prove... other things.
Well, the use of pattern-matching against the empty pattern () ensures that ⊥ itself is Recomputable:
Recomputable : ∀ {a} (A : Set a) → Set a
Recomputable A = .A → A
-- ⊥ is Recomputable
⊥-recompute : Recomputable ⊥
⊥-recompute ()... and this is already provable in the current formulation of the library... and hence that the above two elimination principles are interderivable (so: do we need both, or does one suffice? UPDATED: does the asymmetry in the use of irrelevant marks in types between assumptions and conclusions mean that this cannot precisely be the case?). See branch, with no (seemingly!?) wider knock-on consequences for the rest of the library.
So: we should reconcile these things, and their many consequences; esp. wrt proving Recomputable for all kinds of types, notably product types (below), negated types, decidable types, ... in general at least (conjecture!?) the (hereditarily) Harrop formulas, and more generally, any 'Glivenko class' of formulas (ditto.).
Question/Issue: Why haven't we done this before/already? cf. #645 / #652 / #762
Activity
prototype for fixing agda#2199
jamesmckinna commentedon Nov 15, 2023
Further evidence towards the identification of
Recomputableand Harrop:Suggest that this become a focus of effort on reconciling (the) 'classical' fragment(s) of type theory with the ambient intuitionistic.
Or has this already been done somewhere (else) before?
Have now asked on the main Agda Zulip
Nisse's answer there has me needing to think a bit harder. Specifically, I don't think we can make a simple-minded identification of
Recomputableand Harrop; rather they have the same/similar closure properties. But for any collection of 'base' types, the Harrop/negative fragment defined over them will satisfy all sorts of things (Recomputable,Decidable,Stable, ...) depending on the corresponding conditions on those base types. So this seems really to be more about 'induction over the negative fragment'.JacquesCarette commentedon Nov 15, 2023
This is definitely about Agda's handling of 'irrelevant' (which I've run into quite a bit too). A discussion about it should happen on the Agda side (either Zulip or git issues) as that's where the experts are for that.
jamesmckinna commentedon Nov 25, 2023
But the main content of the issue: namely reconciling 'irrelevant'
⊥-elimand⊥-elim, still stands. So at some point I'll turn the branch into a small(er)-scale PR, leaving the 'other' issue: what/where/how should we defineRecomputable, and refactor the library to make use of this definition? So... further comments on the issue welcome towards such an eventual 'design'.jamesmckinna commentedon Mar 26, 2024
Proposal: replace the type of
⊥-elimwith that of⊥-elim-irr:Would this constitute a breaking change?
gallais commentedon Mar 26, 2024
Given that we don't have subtyping for functions whose domain is irrelevant (the following is rejected:
) then I'd say yes. It could break strange code that uses
⊥-elimpartially applied.JacquesCarette commentedon Mar 26, 2024
Good point: I think that the proposal goes one step too far. Indeed it would only break rather strange code, but the debugging pain would be quite something!
jamesmckinna commentedon Mar 27, 2024
Thanks to both. Indeed, errors arising from (some) partial applications of
contradictionwas one reason I introduced its friendcontradictionᵒin #2243 , and I won't pursue the more radical proposal on that PR ... or any other, until v3.0! But definitely keen to push on with what's already there. Please review!Adds `Relation.Nullary.Recomputable` plus consequences (#2243)
Adds `Relation.Nullary.Recomputable` plus consequences (#2243)
Merge v2.1.1 into `master` (#2473)