-
Notifications
You must be signed in to change notification settings - Fork 194
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
Reduce universe variables in a number of places #1721
Conversation
The first commit, introducing (Idempotents.v and several of the Classes files do locally turn on minimization to |
Just to be clear what I am talking about: From HoTT Require Import Basics.
Definition myid (A : Type) : A -> A := fun a => a.
Set Printing Universes.
Print myid.
Definition id_unit : Unit -> Unit := myid Unit.
Print id_unit.
Check id_unit@{u}. (* An unused universe variable. *)
Definition const_unit (A : Type) : A -> Unit := @const A Unit tt.
Print const_unit.
Check const_unit@{u v}. (* u is unused, while v is the universe containing A. *)
Local Set Universe Minimization ToSet.
Definition id_unit' : Unit -> Unit := myid Unit.
Print id_unit'. (* myid@{Set} Unit *)
Check id_unit'@{}.
Definition const_unit' (A : Type) : A -> Unit := @const A Unit tt.
Print const_unit'. (* const@{Set u} tt *)
Check const_unit'@{u}. |
This is because we do Using |
We intentionally chose that meaning of |
Thanks for explaining! Yes, it seems like we're fighting Coq here by using names that conflict with built-in names. Changing the name for I also tried changing the definition of So, I think for now this PR could go in. I added a comment mentioning that that |
What are those problems?
It may be related to -impredicative-set which allows to declare inductives that have induction schemes for Set but not for Type. |
In PropResizing/Nat.v, Coq can't prove In Categories/Functor/Sum.v, we get The term "C" has type
"PreCategory@{HoTT.Categories.Functor.Sum.1 HoTT.Categories.Functor.Sum.2}"
while it is expected to have type
"PreCategory@{HoTT.Categories.Functor.Sum.10 Set}". and I couldn't figure out how to fix this. In Extensions.v, we get The term "equiv_extendable_pathsplit n.+2 C f" has type
"ExtendableAlong n.+2 f C <~>
PathSplit n.+2 (fun g : forall b : B, C b => g oD f)"
while it is expected to have type
"?T@{g0:=isequiv_pathsplit n} -> PathSplit n.+2 ?f". and I didn't investigate this. There will likely be other issues, but they aren't revealed because of dependency issues. (Also, in Categories/IndiscreteCategory.v, we get |
BTW, Related to Mike's comment, is there any mechanism to instead get |
Ah, I found coq/coq#10766, from 2019, which is requesting this feature. No comments at all on that issue, so I can't tell if there's any chance it might be implemented. |
The issues involving turning on minimization to Set are too big to tackle as part of this PR, so if anyone is able to review it as is, that would be great. |
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.
The changes seem good to me! Just a few minor comments.
I just saw #1531 and addressed it. In master, |
…d adapt other files
I'll merge this when the CI is done. If there is further feedback, I'm of course happy to make requested fixes. The things in this PR are pretty innocuous, and make lots of things better. If we can figure out how to get more things living in Set, that would get rid of lots more free universe variables that multiply in many situations, but that's blocked on things I don't know how to solve. |
This PR improves things that were getting in the way in practice with certain formalizations. Lots more could be done, but these were things I was noticing. Each commit can be read independently.
Some highlights:
conn_point_incl
goes from 17 universe variables to 2 andSusp
goes from 6 to 1.OO_inverts_ap'
goes from 6 to 1, with no changes, just inheriting improvements from elsewhere. This allows us to avoid defining it in two steps.Another nice thing sometimes happens: when you reduce
foo
from 8 to 4 variables, you often go from having to specify 8 variables to having to specify none, since the ones that remain are often determined by the context. So this PR is able to remove a number of annotations in high-level code (in exchange to adding some to more fundamental results).