-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: avoid termination_by', introduce WellFounded.wrap #420
feat: avoid termination_by', introduce WellFounded.wrap #420
Conversation
I’d like to remove support for the `termination_by'` annotation. Until leanprover-community#371 it wasn't used anywhere in lean, std, mathlib, so this PR removes the single use of it. It does so using the pattern that can be used to replace uses of `termination_by'`, should there be more: Using the helper type `WellFounded.Wrap` one can indicate an explicit `WellFounded` relation to use. So this PR uses that pattern to avoid the use of `termination_by'` here, and at the same time provides the necessary definitions for others, so when Lean drops support for `termination_by'` (leanprover/lean4#3033), we can tell users how migrate.
Maybe there is a more idiomatic name rather than |
We also need a way to get a well founded relation out of a value of type |
Would that be |
Yes that works. Next challenge: how to get the type inference working correctly when there are multiple arguments involved? |
By the way, the |
What example do you have in mind? I'd expect once the Note that users will have to manually select and tuple the arguments they care about. But the target audience (users of |
Not exactly, as in this example where the original text was
Lean needs quite a lot of handholding to infer dependent sigma types. |
Interesting, thanks for the pointer. So an alternative would be to make that not private and add
which is nice, because there are no additional definitions with unused arguments to write and explain, and the instance looks kinda useful anyways. I have updated the PR accordingly, WDYT? |
I’d expect that the user has to define the |
This reverts commit 36044fe.
I’d like to remove support for the
termination_by'
annotation. Until#371 it wasn't used anywhere else in
lean, std, mathlib, so this PR removes the single use of it.
It does so using the pattern that can be used to replace uses of
termination_by'
: UsingWellFounded.wrap
one can indicate an explicitWellFounded
relation to use.This also un-privates the
wfRel
instance forWellFoundedRelation { val // Acc r val }
which looks useful enough.
So this PR uses that pattern to avoid the use of
termination_by'
here,and at the same time provides the necessary definitions for others, so
when Lean drops support for
termination_by'
(leanprover/lean4#3033), we can tell users how
migrate.