[Merged by Bors] - chore: remove many Type _ before the colon#7718
[Merged by Bors] - chore: remove many Type _ before the colon#7718
Type _ before the colon#7718Conversation
| #align simply_connected_space.paths_homotopic SimplyConnectedSpace.paths_homotopic | ||
|
|
||
| instance (priority := 100) ofContractible (Y : Type _) [TopologicalSpace Y] [ContractibleSpace Y] : | ||
| instance (priority := 100) ofContractible (Y : Type u) [TopologicalSpace Y] [ContractibleSpace Y] : |
There was a problem hiding this comment.
With the old proof, Type _ expanded to just Type !!
| theorem norm_sub (h : SameRay ℝ x y) : ‖x - y‖ = |‖x‖ - ‖y‖| := by | ||
| rcases h.exists_eq_smul with ⟨u, a, b, ha, hb, -, rfl, rfl⟩ | ||
| wlog hab : b ≤ a with H | ||
| wlog hab : b ≤ a generalizing a b with H |
There was a problem hiding this comment.
The old proof used the universe in {F : Type _} (where F is a variable not appearing in the theorem statement) in the wlog generalization, to match it with that of ℝ! (so replacing {F : Type _} with {F : Type*} broke the proof for dark magic reasons)
| set_option maxHeartbeats 400000 in | ||
| instance {A : Type _} [Semiring A] [Algebra R A] {S : Submonoid R} : | ||
| set_option maxHeartbeats 500000 in | ||
| instance {A : Type*} [Semiring A] [Algebra R A] {S : Submonoid R} : |
There was a problem hiding this comment.
The type of the instance is the same with Type _ or Type* (so no added generality here), but it is just slightly slower with Type*...
There was a problem hiding this comment.
I think @semorrison advocated that we should stick to powers of two bump factors rather than small bumps like this
There was a problem hiding this comment.
In the end I think it was powers of 1.2 or 1.3, I think, so coherent with what I've done here.
|
|
||
| variable [CompactSpace X] | ||
|
|
||
| set_option synthInstance.maxHeartbeats 30000 in |
There was a problem hiding this comment.
The proof is slightly slower with Type* than with Type _, although the statements are the same in the end...
| #align option.join_eq_join Option.joinM_eq_join | ||
|
|
||
| theorem bind_eq_bind {α β : Type _} {f : α → Option β} {x : Option α} : x >>= f = x.bind f := | ||
| theorem bind_eq_bind {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f := |
There was a problem hiding this comment.
Another reasonable option for these rare declarations is
| theorem bind_eq_bind {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f := | |
| theorem bind_eq_bind.{u} {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f := |
or
| theorem bind_eq_bind {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f := | |
| universe u in | |
| theorem bind_eq_bind {α β : Type u} {f : α → Option β} {x : Option α} : x >>= f = x.bind f := |
to keep the universe local
There was a problem hiding this comment.
Thanks for the suggestions!
eric-wieser
left a comment
There was a problem hiding this comment.
bors d+
Thanks! I thought about doing this the other day, but struggled to justify the effort to do so!
| theorem RespectsIso.is_localization_away_iff (hP : RingHom.RespectsIso @P) {R S : Type _} | ||
| (R' S' : Type _) [CommRing R] [CommRing S] [CommRing R'] [CommRing S'] [Algebra R R'] | ||
| theorem RespectsIso.is_localization_away_iff (hP : RingHom.RespectsIso @P) {R S : Type u} | ||
| (R' S' : Type u) [CommRing R] [CommRing S] [CommRing R'] [CommRing S'] [Algebra R R'] |
There was a problem hiding this comment.
This looks slightly suspicious to me; is there really no polymorphism here?
There was a problem hiding this comment.
Yes. P only makes sense for rings in the given universe u, and the conclusion mentions P applied both to R, S and to R', S'.
|
✌️ sgouezel can now approve this pull request. To approve and merge a pull request, simply reply with |
|
bors r+ |
We have turned to `Type*` instead of `Type _`, but many of them remained in mathlib because the straight replacement did not work. In general, having `Type _` before the colon is a code smell, though, as it hides which types should be in the same universe and which shouldn't, and is not very robust. This PR replaces most of the remaining `Type _` before the colon (except those in category theory) by `Type*` or `Type u`. This has uncovered a few bugs (where declarations were not as polymorphic as they should be). I had to increase heartbeats at two places when replacing `Type _` by `Type*`, but I think it's worth it as it's really more robust.
|
Pull request successfully merged into master. Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Type _ before the colonType _ before the colon
We have turned to
Type*instead ofType _, but many of them remained in mathlib because the straight replacement did not work. In general, havingType _before the colon is a code smell, though, as it hides which types should be in the same universe and which shouldn't, and is not very robust.This PR replaces most of the remaining
Type _before the colon (except those in category theory) byType*orType u. This has uncovered a few bugs (where declarations were not as polymorphic as they should be).I had to increase heartbeats at two places when replacing
Type _byType*, but I think it's worth it as it's really more robust.