agda-stdlib icon indicating copy to clipboard operation
agda-stdlib copied to clipboard

Adds `Relation.Nullary.Recomputable` plus consequences

Open jamesmckinna opened this issue 2 years ago • 9 comments

Fixes #2199 , and the Recomputable and Irrelevant instances of #2091 . Cherry-picks some of the lower-hanging fruit from #2149 .

Outstanding issues:

  • [x] names of things: recompute vs. recomputable vs. ...⇒recomputable in all the various places; also the various additions to Relation.Nullary.Negation.Core; UPDATED sticking with recompute for now
  • [x] deprecations: module Data.Empty.Irrelevant could now be deprecated entirely, but I have not (yet) done so; similarly, there may be knock-on deprecations arising from name choices above; UPDATED no deprecations!
  • [x] where things should live/be (re-)exported from. UPDATED see @JacquesCarette 's comments and my revised commits

(Definite~~Probab~~ly) Won't do in relation to issues raised as a result of #2199 :

  • "induction on the negative fragment": a separate (relativised!) Data.Universe construction for the 'Harrop' universe, as Relation.Nullary.Recomputable.Universe, with a view to generalising Harrop's results to ones of the form "if everything in 𝕌 = (U, El) is Recomputable/Irrelevant/Decidable... then so too is everything in Harrop 𝕌 etc. (UPDATED: downstream PR, but only once I've figured it out)
  • relationship with the 'Irrelevance Axiom' or @nad 's developments mentioned there. (Ditto.)

jamesmckinna avatar Jan 02 '24 13:01 jamesmckinna

Converting to DRAFT for the time being as I haven't had the brain space to revisit the questions above. UPDATED: punting those downstream!

jamesmckinna avatar Mar 19 '24 08:03 jamesmckinna

Incoming commits tidy this up, and then ready for review. Leaving the 'hard' questions for downstream development.

jamesmckinna avatar Mar 25 '24 19:03 jamesmckinna

I further conjecture on #2329 that all uses of ⊥-elim can be replaced by their irrelevant version ⊥-elim-irr... so question for the maintainers, are we prepared to embrace such a (breaking?) change to the type of ⊥-elim?

jamesmckinna avatar Mar 26 '24 17:03 jamesmckinna

so question for the maintainers, are we prepared to embrace such a (breaking?) change to the type of ⊥-elim?

Yes, but in v3.0! I suggest we make an issue with the 3.0 milestone?

MatthewDaggitt avatar Mar 27 '24 01:03 MatthewDaggitt

@MatthewDaggitt fair point, but my belief (Modulo the merge conflict) is that everything here is v2.1 compatible so I won't pursue further changes this time around... ;-) And indeed I've now reverted the last round of changes (I think otherwise harmless, but glaring, which invoked weak-contradiction throughout... it's a terrible name, so I welcome a review which offers a better one!)

jamesmckinna avatar Mar 27 '24 06:03 jamesmckinna

@JacquesCarette after the merge of #2329 could you review this one please?

jamesmckinna avatar Mar 29 '24 10:03 jamesmckinna

Now : proofs computed using recompute are irrelevant, so UIP follows immediately from DecidableEquality. I've added these in as further low-hanging-fruit cherry-picked from #2149 UPDATED: but this construction (recomputable implies constant) should be pulled back as far as Recomputable itself... Now DONE. That's it!

jamesmckinna avatar Apr 08 '24 11:04 jamesmckinna

@MatthewDaggitt are you happy with this not being a breaking change now?

jamesmckinna avatar Apr 08 '24 12:04 jamesmckinna

As I understand things, there are (now!) two outstanding issues:

  • is this PR breaking or not? I claim it is not, because specifically: in the top-level stdlib API, the public export of recompute (and now, additionally, recompute-constant}) from Relation.Nullary is still that from Relation.Nullary.Decidable (and hence from Relation.Nullary.Decidable.Core), and not that of the newly introduced Relation.Nullary.Reflects.recompute{-constant}.
  • does https://github.com/agda/agda/issues/7193 affect the 'safety' of this PR? From my (limited) understanding of @dolio 's reply to my question there, the answer is also that it does not.

Hope this helps! (And removes any further obstruction to merging...)

jamesmckinna avatar May 04 '24 08:05 jamesmckinna

Just need @gallais to re-review.

JacquesCarette avatar Jun 01 '24 13:06 JacquesCarette

Just need ... to re-review.

And @MatthewDaggitt ?

jamesmckinna avatar Jun 05 '24 12:06 jamesmckinna