-
Notifications
You must be signed in to change notification settings - Fork 447
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: find Decidable instances via unification #2816
Conversation
Agreed.
Happy to merge the workaround. We have used it in other places. |
f83f28b
to
904a602
Compare
|
904a602
to
9f4f2a8
Compare
@@ -806,6 +806,12 @@ decidability instance instead of the proposition, which has no code). | |||
|
|||
If a proposition `p` is `Decidable`, then `(by decide : p)` will prove it by | |||
evaluating the decidability instance to `isTrue h` and returning `h`. | |||
|
|||
Because `Decidable` carries data, | |||
when writing `@[simp]` lemmas which include a `Decidable` instance on the LHS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the corollary here that you can no longer use the lemma with ←
if no Decidable
instance is on the RHS? And so in those cases, you need to write two versions of the same lemma?
(Re-posted as this got lost as a non-PR comment)
Because `Decidable` carries data, when writing `@[simp]` lemmas which include a `Decidable` instance on the LHS, it is best to use `{_ : Decidable p}` rather than `[Decidable p]` so that non-canonical instances can be found via unification rather than typeclass search. (Previously this behaviour was often being hidden by the default `decide := true` in `simp`.)
I've been finding situations where these
simp
lemmas don't fire, because the decidable instance is not the one found by typeclass inference.This perhaps deserves a deeper fix, but I want to see if just changing the binder types here suffices for my purposes.
(Previously this behaviour was being hidden by the default
decide := true
insimp
.)