Conversation
|
I'm not sure where are you using |
|
Oh, |
fredrikNordvallForsberg
left a comment
There was a problem hiding this comment.
One thing that could be nice would be to do the right %access incantations in UnsafeQuotient so that the commuting triangle in exists would commute pointwise.
It might also be worth it to split up the dependent pair in exists into two fields in the record, since this is the way to define functions out of the quotient.
| module Quotients | ||
|
|
||
| import Quotient.Quotient | ||
|
|
There was a problem hiding this comment.
Should this module use %access public export?
There was a problem hiding this comment.
Good point, forgot that.
src/Quotient/UnsafeQuotient.idr
Outdated
| (QuotientType x eq) | ||
| (Wrap ** (\a, b, h => QuotientEquality x eq h)) | ||
| (\y, f => ((\a => fst f $ unwrap a) ** (\a => Refl))) | ||
| (\y, f, g, h, a => trans (cong $ wrapUnwrapId a) (sym $ h $ unwrap a)) |
There was a problem hiding this comment.
| (\y, f, g, h, a => trans (cong $ wrapUnwrapId a) (sym $ h $ unwrap a)) | |
| (\y, f, g, h, (InternalWrap a) => sym $ h a) |
There was a problem hiding this comment.
I find these things very weird. In the previous line where I use unwrap, I cannot pattern match in the lambda, while in this line I can. The only reason why unwrap exists is because it didn't work there for me. Do you or @clayrat have any insight as to what might be the issue there?
There was a problem hiding this comment.
As for the dependent pair, do you mean that it would be nicer if we didn't have to write
fst $ exists ...? In that case, I'd just define another function.
Concretely, I suggest to replace the exists field with the following two fields (possibly with better chosen names):
extension : (y : Type) -> (f : RespectingMap x y eq)
-> carrier -> y
commutes : (y : Type) -> (f : RespectingMap x y eq)
-> extEq (fst f) (extension y f . (fst proj))Why?
- Most of the time, the function
extension y fis probably what you want easy access to (what I tried to say above). - Should make it easier to build things stepwise using holes, because Idris doesn't need to juggle sigma types and first projections etc.
- Might make it easier to talk about the code, e.g. 'the commuting triangle in
exists' above is thecommutesfield.
I'm not sure what you mean by 'the commuting triangle in
existswould commute pointwise'.
What I meant was that in the Quotients.Unsafe module, the proof of commutes y f a is Refl for every a, which is nice, but outside this module, nothing reduces anymore.
| Wrap : x -> QuotientType x eq | ||
| Wrap = InternalWrap | ||
|
|
||
| unwrap : QuotientType x eq -> x |
There was a problem hiding this comment.
Probably best not to export unwrap, as it corresponds to a form of global axiom of choice?
There was a problem hiding this comment.
Oh, completely missed that.
|
I'm not sure what you mean by 'the commuting triangle in As for the dependent pair, do you mean that it would be nicer if we didn't have to write |
This adds some generic code for dealing with (extensional) quotients