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
[ new ] generic "diag" for decidable equality #266
Conversation
Why not make these generic to module Relation.Nullary.Decidable where
-- ...
isWitness : ∀ {p} {P : Set p} {Q : Dec P} (p : P) → Q ≡ yes (toWitness {Q = Q} (fromWitness p))
isWitness {Q = yes p} _ = refl
isWitness {Q = no ¬p} p = ⊥-elim (¬p p)
isWitnessFalse : ∀ {p} {P : Set p} {Q : Dec P} (¬p : ¬ P) → Q ≡ no (toWitnessFalse {Q = Q} (fromWitnessFalse ¬p))
isWitnessFalse {Q = yes p} ¬p = ⊥-elim (¬p p)
isWitnessFalse {Q = no ¬p} _ = refl
-- ... |
Using |
I'm not sure if |
The stdlib relies in at least 3 places on |
I agree that the reduction behaviour of the current versions is more desirable. @gallais is there any reason why |
Thanks! |
All three of those instances are in proofs of decidable equality, for binary and unary numbers. They don't use K, and more importantly they're proofs (rather than functions that we might need to prove theorems about). If someone does want |
A lot of things can be obtained by combining more basic functions but that doesn't As for |
Opinion: Please avoid |
That's why I'm saying it would make sense to also have the |
I agree. I did not understand that that is what your previous comments meant. Thanks for clarifying. |
Realised we might as well include the fact that if propositional equality
is decidable then the decision procedure always succeeds on values
known to be equal.