-
Notifications
You must be signed in to change notification settings - Fork 643
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
add proof of decEq x x = Yes Refl
#3905
Conversation
|
||
||| Everything is decidably equal to itself | ||
total decEqSelfIsYes : DecEq a => {x : a} -> decEq x x = Yes Refl | ||
decEqSelfIsYes {x} with (decEq x x) |
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.
Why should we have this in the prelude? Has it come up in practice for you? I imagine it's not so useful, because if I already know that something is the same as another, then I can just use Refl
directly rather than calling decEq
on it.
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.
I'm doing an Idris translation of "Software foundations" and this has already come up twice when trying to prove things about functions defined via decEq
. Typically you get to the point where the arguments are the same and then there's an error that smth like Decidable.Equality.Nat implementation of Decidable.Equality.DecEq, method decEq n n
could not be reduced to get to the goal. Doing rewrite decEqSelfIsYes {x=n}
solves this.
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.
Thanks, that makes sense. It would be useful for this kind of context to be part of the PR message in the future.
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.
Sure, I'll try to be more informative in the future!
There's too much stuff in the prelude that don't belong there already. There should be a high bar to get in.
Why does this need to be usable in every idris file without importing?
… 9 juli 2017 kl. 22:15 skrev Alex Gryzlov ***@***.***>:
@clayrat commented on this pull request.
In libs/prelude/Decidable/Equality.idr:
> @@ -30,6 +22,20 @@ interface DecEq t where
total decEq : (x1 : t) -> (x2 : t) -> Dec (x1 = x2)
--------------------------------------------------------------------------------
+-- Utility lemmas
+--------------------------------------------------------------------------------
+
+||| The negation of equality is symmetric (follows from symmetry of equality)
+total negEqSym : {a : t} -> {b : t} -> (a = b -> Void) -> (b = a -> Void)
+negEqSym p h = p (sym h)
+
+||| Everything is decidably equal to itself
+total decEqSelfIsYes : DecEq a => {x : a} -> decEq x x = Yes Refl
+decEqSelfIsYes {x} with (decEq x x)
I'm doing an Idris translation of "Software foundations" and this has already come up twice when trying to prove things about functions defined via decEq. Typically you get to the point where the arguments are the same and then there's an error that smth like Decidable.Equality.Nat implementation of Decidable.Equality.DecEq, method decEq n n could not be reduced to get to the goal. Doing rewrite decEqSelfIsYes {x=n} solves this.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think @melted is hinting that |
My reasoning is that since |
Given that this is something that has come up in practice, I think it's OK in the Prelude along with But for a Prelude change, we also need a CHANGELOG entry. Then I'm happy. |
Done. |
I'm happy with a merge, but I don't want to do it unilaterally - it sounds like @melted has concerns about library bloat and like @ahmadsalim may as well. What do the two of you think, given that it has been useful? |
It's ok to merge for me, but if discoverability is a problem for putting things outside the prelude, that needs to be fixed.
… 12 juli 2017 kl. 15:26 skrev David Christiansen ***@***.***>:
I'm happy with a merge, but I don't want to do it unilaterally - it sounds like @melted has concerns about library bloat and like @ahmadsalim may as well. What do the two of you think, given that it has been useful?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yeah, LGTM. |
@melted This would indeed be good to fix, and it's an interesting thing to do research on. Referring to "proofy" things by their propositional content rather than their name might be one approach. But we're not there yet. |
Thanks, @clayrat! |
@david-christiansen I am not sure I understand, how do |
They only search what's imported. |
@david-christiansen don't they search what's loaded? Base is losded but not imported. |
There's an optional parameter to get them to do that, but it makes them a lot slower and doesn't get used a lot in practice. |
What is the optional parameter, David? I would love to set this as a
standard in my projects. Wasting a bit of time with ":s" searches seems to
be a much better solution for me than greping through the code base.
Markus
2017-07-13 15:22 GMT+02:00 David Christiansen <[email protected]>:
… There's an optional parameter to get them to do that, but it makes them a
lot slower and doesn't get used a lot in practice.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3905 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAX75MomJ_4uAUxYPqGj17Blnnv2JPfmks5sNhorgaJpZM4OSI5l>
.
|
@justjoheinz the syntax is:
For example:
|
No description provided.