Skip to content

Commit

Permalink
chore(*): remove extra parentheses in universe annotations (#14595)
Browse files Browse the repository at this point in the history
We change `f.{(max u v)}` to `f.{max u v}` throughout, and similarly for `imax`. This is for consistency with the rest of the code.

Note that `max` and `imax` take an arbitrary number of parameters, so if anyone wants to add a second universe parameter, they'll have to add the parentheses again.
  • Loading branch information
vihdzp committed Jun 8, 2022
1 parent 3e4d6aa commit 201a3f4
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/algebra/category/Module/projective.lean
Expand Up @@ -37,7 +37,7 @@ begin
end

namespace Module
variables {R : Type u} [ring R] {M : Module.{(max u v)} R}
variables {R : Type u} [ring R] {M : Module.{max u v} R}

/-- Modules that have a basis are projective. -/
-- We transport the corresponding result from `module.projective`.
Expand Down
2 changes: 1 addition & 1 deletion src/category_theory/category/ulift.lean
Expand Up @@ -132,7 +132,7 @@ end ulift_hom
def {w v u} as_small (C : Type u) [category.{v} C] := ulift.{max w v} C

instance : small_category (as_small.{w₁} C) :=
{ hom := λ X Y, ulift.{(max w₁ u₁)} $ X.down ⟶ Y.down,
{ hom := λ X Y, ulift.{max w₁ u₁} $ X.down ⟶ Y.down,
id := λ X, ⟨𝟙 _⟩,
comp := λ X Y Z f g, ⟨f.down ≫ g.down⟩ }

Expand Down
6 changes: 3 additions & 3 deletions src/category_theory/graded_object.lean
Expand Up @@ -53,7 +53,7 @@ namespace graded_object

variables {C : Type u} [category.{v} C]

instance category_of_graded_objects (β : Type w) : category.{(max w v)} (graded_object β C) :=
instance category_of_graded_objects (β : Type w) : category.{max w v} (graded_object β C) :=
category_theory.pi (λ _, C)

/-- The projection of a graded object to its `i`-th component. -/
Expand Down Expand Up @@ -124,7 +124,7 @@ rfl
rfl

instance has_zero_morphisms [has_zero_morphisms C] (β : Type w) :
has_zero_morphisms.{(max w v)} (graded_object β C) :=
has_zero_morphisms.{max w v} (graded_object β C) :=
{ has_zero := λ X Y,
{ zero := λ b, 0 } }

Expand All @@ -136,7 +136,7 @@ section
open_locale zero_object

instance has_zero_object [has_zero_object C] [has_zero_morphisms C] (β : Type w) :
has_zero_object.{(max w v)} (graded_object β C) :=
has_zero_object.{max w v} (graded_object β C) :=
by { refine ⟨⟨λ b, 0, λ X, ⟨⟨⟨λ b, 0⟩, λ f, _⟩⟩, λ X, ⟨⟨⟨λ b, 0⟩, λ f, _⟩⟩⟩⟩; ext, }
end

Expand Down
4 changes: 2 additions & 2 deletions src/linear_algebra/dimension.lean
Expand Up @@ -235,7 +235,7 @@ variables [nontrivial R]

lemma {m} cardinal_lift_le_dim_of_linear_independent
{ι : Type w} {v : ι → M} (hv : linear_independent R v) :
cardinal.lift.{(max v m)} (#ι) ≤ cardinal.lift.{(max w m)} (module.rank R M) :=
cardinal.lift.{max v m} (#ι) ≤ cardinal.lift.{max w m} (module.rank R M) :=
begin
apply le_trans,
{ exact cardinal.lift_mk_le.mpr
Expand Down Expand Up @@ -839,7 +839,7 @@ begin
end

theorem {m} basis.mk_eq_dim' (v : basis ι R M) :
cardinal.lift.{(max v m)} (#ι) = cardinal.lift.{(max w m)} (module.rank R M) :=
cardinal.lift.{max v m} (#ι) = cardinal.lift.{max w m} (module.rank R M) :=
by simpa using v.mk_eq_dim

/-- If a module has a finite dimension, all bases are indexed by a finite type. -/
Expand Down
16 changes: 8 additions & 8 deletions src/set_theory/cardinal/basic.lean
Expand Up @@ -157,7 +157,7 @@ induction_on a $ λ α, mk_congr equiv.ulift
@[simp] theorem lift_uzero (a : cardinal.{u}) : lift.{0} a = a := lift_id'.{0 u} a

@[simp] theorem lift_lift (a : cardinal) :
lift.{w} (lift.{v} a) = lift.{(max v w)} a :=
lift.{w} (lift.{v} a) = lift.{max v w} a :=
induction_on a $ λ α,
(equiv.ulift.trans $ equiv.ulift.trans equiv.ulift.symm).cardinal_eq

Expand Down Expand Up @@ -200,7 +200,7 @@ theorem out_embedding {c c' : cardinal} : c ≤ c' ↔ nonempty (c.out ↪ c'.ou
by { transitivity _, rw [←quotient.out_eq c, ←quotient.out_eq c'], refl }

theorem lift_mk_le {α : Type u} {β : Type v} :
lift.{(max v w)} (#α) ≤ lift.{(max u w)} (#β) ↔ nonempty (α ↪ β) :=
lift.{(max v w)} (#α) ≤ lift.{max u w} (#β) ↔ nonempty (α ↪ β) :=
⟨λ ⟨f⟩, ⟨embedding.congr equiv.ulift equiv.ulift f⟩,
λ ⟨f⟩, ⟨embedding.congr equiv.ulift.symm equiv.ulift.symm f⟩⟩

Expand All @@ -213,7 +213,7 @@ theorem lift_mk_le' {α : Type u} {β : Type v} :
lift_mk_le.{u v 0}

theorem lift_mk_eq {α : Type u} {β : Type v} :
lift.{(max v w)} (#α) = lift.{(max u w)} (#β) ↔ nonempty (α ≃ β) :=
lift.{max v w} (#α) = lift.{max u w} (#β) ↔ nonempty (α ≃ β) :=
quotient.eq.trans
⟨λ ⟨f⟩, ⟨equiv.ulift.symm.trans $ f.trans equiv.ulift⟩,
λ ⟨f⟩, ⟨equiv.ulift.trans $ f.trans equiv.ulift.symm⟩⟩
Expand Down Expand Up @@ -724,7 +724,7 @@ le_antisymm
(succ_le_of_lt $ lift_lt.2 $ lt_succ a)

@[simp] theorem lift_umax_eq {a : cardinal.{u}} {b : cardinal.{v}} :
lift.{(max v w)} a = lift.{(max u w)} b ↔ lift.{v} a = lift.{u} b :=
lift.{max v w} a = lift.{max u w} b ↔ lift.{v} a = lift.{u} b :=
by rw [←lift_lift, ←lift_lift, lift_inj]

@[simp] theorem lift_min {a b : cardinal} : lift (min a b) = min (lift a) (lift b) :=
Expand Down Expand Up @@ -770,9 +770,9 @@ if bounded by the lift of some cardinal from the larger supremum.
-/
lemma lift_sup_le_lift_sup
{ι : Type v} {ι' : Type v'} (f : ι → cardinal.{max v w}) (f' : ι' → cardinal.{max v' w'})
(g : ι → ι') (h : ∀ i, lift.{(max v' w')} (f i) ≤ lift.{(max v w)} (f' (g i))) :
lift.{(max v' w')} (sup f) ≤ lift.{(max v w)} (sup f') :=
lift_sup_le.{(max v' w')} f _ (λ i, (h i).trans $ by { rw lift_le, apply le_sup })
(g : ι → ι') (h : ∀ i, lift.{max v' w'} (f i) ≤ lift.{max v w} (f' (g i))) :
lift.{max v' w'} (sup f) ≤ lift.{max v w} (sup f') :=
lift_sup_le.{max v' w'} f _ (λ i, (h i).trans $ by { rw lift_le, apply le_sup })

/-- A variant of `lift_sup_le_lift_sup` with universes specialized via `w = v` and `w' = v'`.
This is sometimes necessary to avoid universe unification issues. -/
Expand Down Expand Up @@ -1257,7 +1257,7 @@ lemma mk_range_eq_of_injective {α : Type u} {β : Type v} {f : α → β} (hf :
lift_mk_eq'.mpr ⟨(equiv.of_injective f hf).symm⟩

lemma mk_range_eq_lift {α : Type u} {β : Type v} {f : α → β} (hf : injective f) :
lift.{(max u w)} (# (range f)) = lift.{(max v w)} (# α) :=
lift.{max u w} (# (range f)) = lift.{max v w} (# α) :=
lift_mk_eq.mpr ⟨(equiv.of_injective f hf).symm⟩

theorem mk_image_eq {α β : Type u} {f : α → β} {s : set α} (hf : injective f) :
Expand Down
4 changes: 2 additions & 2 deletions src/set_theory/cardinal/cofinality.lean
Expand Up @@ -82,7 +82,7 @@ end order

theorem rel_iso.cof_le_lift {α : Type u} {β : Type v} {r : α → α → Prop} {s}
[is_refl β s] (f : r ≃r s) :
cardinal.lift.{(max u v)} (order.cof r) ≤ cardinal.lift.{(max u v)} (order.cof s) :=
cardinal.lift.{max u v} (order.cof r) ≤ cardinal.lift.{max u v} (order.cof s) :=
begin
rw [order.cof, order.cof, lift_Inf, lift_Inf,
le_cInf_iff'' (nonempty_image_iff.2 (order.cof_nonempty s))],
Expand All @@ -97,7 +97,7 @@ end

theorem rel_iso.cof_eq_lift {α : Type u} {β : Type v} {r s}
[is_refl α r] [is_refl β s] (f : r ≃r s) :
cardinal.lift.{(max u v)} (order.cof r) = cardinal.lift.{(max u v)} (order.cof s) :=
cardinal.lift.{max u v} (order.cof r) = cardinal.lift.{max u v} (order.cof s) :=
(rel_iso.cof_le_lift f).antisymm (rel_iso.cof_le_lift f.symm)

theorem rel_iso.cof_le {α β : Type u} {r : α → α → Prop} {s} [is_refl β s] (f : r ≃r s) :
Expand Down
6 changes: 3 additions & 3 deletions src/set_theory/cardinal/ordinal.lean
Expand Up @@ -748,9 +748,9 @@ lemma mk_compl_eq_mk_compl_infinite {α : Type*} [infinite α] {s t : set α} (h
by { rw [mk_compl_of_infinite s hs, mk_compl_of_infinite t ht] }

lemma mk_compl_eq_mk_compl_finite_lift {α : Type u} {β : Type v} [fintype α]
{s : set α} {t : set β} (h1 : lift.{(max v w)} (#α) = lift.{(max u w)} (#β))
(h2 : lift.{(max v w)} (#s) = lift.{(max u w)} (#t)) :
lift.{(max v w)} (#(sᶜ : set α)) = lift.{(max u w)} (#(tᶜ : set β)) :=
{s : set α} {t : set β} (h1 : lift.{max v w} (#α) = lift.{max u w} (#β))
(h2 : lift.{max v w} (#s) = lift.{max u w} (#t)) :
lift.{max v w} (#(sᶜ : set α)) = lift.{max u w} (#(tᶜ : set β)) :=
begin
rcases lift_mk_eq.1 h1 with ⟨e⟩, letI : fintype β := fintype.of_equiv α e,
replace h1 : fintype.card α = fintype.card β := (fintype.of_equiv_card _).symm,
Expand Down
18 changes: 9 additions & 9 deletions src/set_theory/ordinal/basic.lean
Expand Up @@ -819,32 +819,32 @@ quotient.sound ⟨rel_iso.preimage equiv.ulift r⟩
@[simp] theorem lift_id : ∀ a, lift.{u u} a = a := lift_id'.{u u}

@[simp]
theorem lift_lift (a : ordinal) : lift.{w} (lift.{v} a) = lift.{(max v w)} a :=
theorem lift_lift (a : ordinal) : lift.{w} (lift.{v} a) = lift.{max v w} a :=
induction_on a $ λ α r _,
quotient.sound ⟨(rel_iso.preimage equiv.ulift _).trans $
(rel_iso.preimage equiv.ulift _).trans (rel_iso.preimage equiv.ulift _).symm⟩

theorem lift_type_le {α : Type u} {β : Type v} {r s} [is_well_order α r] [is_well_order β s] :
lift.{(max v w)} (type r) ≤ lift.{(max u w)} (type s) ↔ nonempty (r ≼i s) :=
lift.{max v w} (type r) ≤ lift.{max u w} (type s) ↔ nonempty (r ≼i s) :=
⟨λ ⟨f⟩, ⟨(initial_seg.of_iso (rel_iso.preimage equiv.ulift r).symm).trans $
f.trans (initial_seg.of_iso (rel_iso.preimage equiv.ulift s))⟩,
λ ⟨f⟩, ⟨(initial_seg.of_iso (rel_iso.preimage equiv.ulift r)).trans $
f.trans (initial_seg.of_iso (rel_iso.preimage equiv.ulift s).symm)⟩⟩

theorem lift_type_eq {α : Type u} {β : Type v} {r s} [is_well_order α r] [is_well_order β s] :
lift.{(max v w)} (type r) = lift.{(max u w)} (type s) ↔ nonempty (r ≃r s) :=
lift.{max v w} (type r) = lift.{max u w} (type s) ↔ nonempty (r ≃r s) :=
quotient.eq.trans
⟨λ ⟨f⟩, ⟨(rel_iso.preimage equiv.ulift r).symm.trans $
f.trans (rel_iso.preimage equiv.ulift s)⟩,
λ ⟨f⟩, ⟨(rel_iso.preimage equiv.ulift r).trans $
f.trans (rel_iso.preimage equiv.ulift s).symm⟩⟩

theorem lift_type_lt {α : Type u} {β : Type v} {r s} [is_well_order α r] [is_well_order β s] :
lift.{(max v w)} (type r) < lift.{(max u w)} (type s) ↔ nonempty (r ≺i s) :=
by haveI := @rel_embedding.is_well_order _ _ (@equiv.ulift.{(max v w)} α ⁻¹'o r)
r (rel_iso.preimage equiv.ulift.{(max v w)} r) _;
haveI := @rel_embedding.is_well_order _ _ (@equiv.ulift.{(max u w)} β ⁻¹'o s)
s (rel_iso.preimage equiv.ulift.{(max u w)} s) _; exact
lift.{max v w} (type r) < lift.{max u w} (type s) ↔ nonempty (r ≺i s) :=
by haveI := @rel_embedding.is_well_order _ _ (@equiv.ulift.{max v w} α ⁻¹'o r)
r (rel_iso.preimage equiv.ulift.{max v w} r) _;
haveI := @rel_embedding.is_well_order _ _ (@equiv.ulift.{max u w} β ⁻¹'o s)
s (rel_iso.preimage equiv.ulift.{max u w} s) _; exact
⟨λ ⟨f⟩, ⟨(f.equiv_lt (rel_iso.preimage equiv.ulift r).symm).lt_le
(initial_seg.of_iso (rel_iso.preimage equiv.ulift s))⟩,
λ ⟨f⟩, ⟨(f.equiv_lt (rel_iso.preimage equiv.ulift r)).lt_le
Expand Down Expand Up @@ -1153,7 +1153,7 @@ def lift.principal_seg : @principal_seg ordinal.{u} ordinal.{max (u+1) v} (<) (<
end

@[simp] theorem lift.principal_seg_coe :
(lift.principal_seg.{u v} : ordinal → ordinal) = lift.{(max (u+1) v)} := rfl
(lift.principal_seg.{u v} : ordinal → ordinal) = lift.{max (u+1) v} := rfl

@[simp] theorem lift.principal_seg_top : lift.principal_seg.top = univ := rfl

Expand Down
2 changes: 1 addition & 1 deletion src/testing/slim_check/functions.lean
Expand Up @@ -207,7 +207,7 @@ instance pi_pred.sampleable_ext [sampleable_ext (α → bool)] :

@[priority 2000]
instance pi_uncurry.sampleable_ext
[sampleable_ext (α × β → γ)] : sampleable_ext.{(imax (u+1) (v+1) w)} (α → β → γ) :=
[sampleable_ext (α × β → γ)] : sampleable_ext.{imax (u+1) (v+1) w} (α → β → γ) :=
{ proxy_repr := proxy_repr (α × β → γ),
interp := λ m x y, interp (α × β → γ) m (x, y),
sample := sample (α × β → γ),
Expand Down

0 comments on commit 201a3f4

Please sign in to comment.