-
Notifications
You must be signed in to change notification settings - Fork 143
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
Remove the makeX
functions but keep the makeIsX
#598
Comments
I disagree, since I think ℤ : Group₀
fst ℤ = ℤType
1g (snd ℤ) = 0
_·_ (snd ℤ) = _+ℤ_
inv (snd ℤ) = _-ℤ_ 0
isGroup (snd ℤ) = isGroupℤ
where
abstract
isGroupℤ : IsGroup (pos 0) _+ℤ_ (_-ℤ_ (pos 0))
isGroupℤ = makeIsGroup isSetℤ +Assoc (λ _ → refl) (+Comm 0)
(λ x → +Comm x (pos 0 -ℤ x) ∙ minusPlus x 0)
(λ x → minusPlus x 0) vs using ℤ = makeGroup
0
_+ℤ_
(_-ℤ_ 0)
isSetℤ
+Assoc
(λ _ → refl)
(+Comm 0)
(λ x → +Comm x (pos 0 -ℤ x) ∙ minusPlus x 0)
(λ x → minusPlus x 0) You could even annotate it: ℤ = makeGroup
0 -- identity
_+ℤ_ -- group operation
(_-ℤ_ 0) -- inverses
... |
On the other hand, I just tried doing this with the ℤ : Group₀
ℤ = ℤType , groupstr
0
_+ℤ_
(_-ℤ_ 0)
(makeIsGroup
isSetℤ
+Assoc
(λ _ → refl)
(+Comm 0)
(λ x → +Comm x (pos 0 -ℤ x) ∙ minusPlus x 0)
(λ x → minusPlus x 0)
) which looks very similar. Probably not all of these are necessary to keep. I think some of the |
It's mainly a matter of efficiency. Copatterns have the benefit that Agda won't unfold the definitions unless one applies a projection. This seems completely essential to ensure reasonable typechecking times for complex constructions (e.g. Z cohomology groups). By now I also find the copattern definitions more readable as well. If you have
you don't need any comments about what is the 1, operation and inverse are So I think all algebra structure operations should be given by copatterns, but the proofs that these operations form an instance of the structure can be given using the |
If |
We could remove for example
makeGroup
as groups should be constructed using copatterns anyway. It might still be nice to keep themakeIsGroup
and it should hopefully not be a problem as the copatterns in the group def will block the laws from getting unfolded unless necessaryThe text was updated successfully, but these errors were encountered: