Skip to content

Commit e820917

Browse files
chore: tidy various files (#20184)
1 parent 7d071de commit e820917

File tree

27 files changed

+104
-112
lines changed

27 files changed

+104
-112
lines changed

Mathlib/Algebra/Category/Ring/Constructions.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ variable (A B : CommRingCat.{u})
124124
/-- The tensor product `A ⊗[ℤ] B` forms a cocone for `A` and `B`. -/
125125
@[simps! pt ι]
126126
def coproductCocone : BinaryCofan A B :=
127-
BinaryCofan.mk
128-
(ofHom (Algebra.TensorProduct.includeLeft (S := ℤ)).toRingHom : A ⟶ of (A ⊗[ℤ] B))
129-
(ofHom (Algebra.TensorProduct.includeRight (R := ℤ)).toRingHom : B ⟶ of (A ⊗[ℤ] B))
127+
BinaryCofan.mk
128+
(ofHom (Algebra.TensorProduct.includeLeft (S := ℤ)).toRingHom : A ⟶ of (A ⊗[ℤ] B))
129+
(ofHom (Algebra.TensorProduct.includeRight (R := ℤ)).toRingHom : B ⟶ of (A ⊗[ℤ] B))
130130

131131
@[simp]
132132
theorem coproductCocone_inl : (coproductCocone A B).inl =

Mathlib/Algebra/Module/ZLattice/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ end comap
711711
section NormedLinearOrderedField_comap
712712

713713
variable (K : Type*) [NormedLinearOrderedField K] [HasSolidNorm K] [FloorRing K]
714-
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace K E] [FiniteDimensional K E]
714+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace K E] [FiniteDimensional K E]
715715
[ProperSpace E]
716716
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace K F] [FiniteDimensional K F]
717717
[ProperSpace F]

Mathlib/Algebra/Order/Field/Basic.lean

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -743,13 +743,9 @@ theorem le_of_forall_sub_le (h : ∀ ε > 0, b - ε ≤ a) : b ≤ a := by
743743

744744
private lemma exists_lt_mul_left_of_nonneg {a b c : α} (ha : 0 ≤ a) (hc : 0 ≤ c) (h : c < a * b) :
745745
∃ a' ∈ Set.Ico 0 a, c < a' * b := by
746-
rcases eq_or_lt_of_le ha with rfl | ha
747-
· rw [zero_mul] at h; exact (not_le_of_lt h hc).rec
748-
rcases lt_trichotomy b 0 with hb | rfl | hb
749-
· exact (not_le_of_lt (h.trans (mul_neg_of_pos_of_neg ha hb)) hc).rec
750-
· rw [mul_zero] at h; exact (not_le_of_lt h hc).rec
751-
· obtain ⟨a', ha', a_a'⟩ := exists_between ((div_lt_iff₀ hb).2 h)
752-
exact ⟨a', ⟨(div_nonneg hc hb.le).trans ha'.le, a_a'⟩, (div_lt_iff₀ hb).1 ha'⟩
746+
have hb : 0 < b := pos_of_mul_pos_right (hc.trans_lt h) ha
747+
obtain ⟨a', ha', a_a'⟩ := exists_between ((div_lt_iff₀ hb).2 h)
748+
exact ⟨a', ⟨(div_nonneg hc hb.le).trans ha'.le, a_a'⟩, (div_lt_iff₀ hb).1 ha'⟩
753749

754750
private lemma exists_lt_mul_right_of_nonneg {a b c : α} (ha : 0 ≤ a) (hc : 0 ≤ c) (h : c < a * b) :
755751
∃ b' ∈ Set.Ico 0 b, c < a * b' := by

Mathlib/AlgebraicGeometry/AffineScheme.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ theorem range_fromSpec :
357357
infer_instance
358358

359359
@[simp]
360-
theorem opensRange_fromSpec :hU.fromSpec.opensRange = U := Opens.ext (range_fromSpec hU)
360+
theorem opensRange_fromSpec : hU.fromSpec.opensRange = U := Opens.ext (range_fromSpec hU)
361361

362362
@[reassoc (attr := simp)]
363363
theorem map_fromSpec {V : X.Opens} (hV : IsAffineOpen V) (f : op U ⟶ op V) :

Mathlib/AlgebraicGeometry/SpreadingOut.lean

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ lemma injective_germ_basicOpen (U : X.Opens) (hU : IsAffineOpen U)
6060
(x : X) (hx : x ∈ U) (f : Γ(X, U))
6161
(hf : x ∈ X.basicOpen f)
6262
(H : Function.Injective (X.presheaf.germ U x hx)) :
63-
Function.Injective (X.presheaf.germ (X.basicOpen f) x hf) := by
63+
Function.Injective (X.presheaf.germ (X.basicOpen f) x hf) := by
6464
rw [RingHom.injective_iff_ker_eq_bot, RingHom.ker_eq_bot_iff_eq_zero] at H ⊢
6565
intros t ht
6666
have := hU.isLocalization_basicOpen f
@@ -72,13 +72,13 @@ lemma injective_germ_basicOpen (U : X.Opens) (hU : IsAffineOpen U)
7272

7373
lemma Scheme.exists_germ_injective (X : Scheme.{u}) (x : X) [X.IsGermInjectiveAt x] :
7474
∃ (U : X.Opens) (hx : x ∈ U),
75-
IsAffineOpen U ∧ Function.Injective (X.presheaf.germ U x hx) :=
75+
IsAffineOpen U ∧ Function.Injective (X.presheaf.germ U x hx) :=
7676
Scheme.IsGermInjectiveAt.cond
7777

7878
lemma Scheme.exists_le_and_germ_injective (X : Scheme.{u}) (x : X) [X.IsGermInjectiveAt x]
7979
(V : X.Opens) (hxV : x ∈ V) :
8080
∃ (U : X.Opens) (hx : x ∈ U),
81-
IsAffineOpen U ∧ U ≤ V ∧ Function.Injective (X.presheaf.germ U x hx) := by
81+
IsAffineOpen U ∧ U ≤ V ∧ Function.Injective (X.presheaf.germ U x hx) := by
8282
obtain ⟨U, hx, hU, H⟩ := Scheme.IsGermInjectiveAt.cond (x := x)
8383
obtain ⟨f, hf, hxf⟩ := hU.exists_basicOpen_le ⟨x, hxV⟩ hx
8484
exact ⟨X.basicOpen f, hxf, hU.basicOpen f, hf, injective_germ_basicOpen U hU x hx f hxf H⟩
@@ -94,7 +94,7 @@ instance (x : X) [X.IsGermInjectiveAt x] [IsOpenImmersion f] :
9494
simpa
9595

9696
variable {f} in
97-
lemma isGermInjectiveAt_iff_of_isOpenImmersion {x : X} [IsOpenImmersion f]:
97+
lemma isGermInjectiveAt_iff_of_isOpenImmersion {x : X} [IsOpenImmersion f] :
9898
Y.IsGermInjectiveAt (f.base x) ↔ X.IsGermInjectiveAt x := by
9999
refine ⟨fun H ↦ ?_, fun _ ↦ inferInstance⟩
100100
obtain ⟨U, hxU, hU, hU', H⟩ :=
@@ -126,8 +126,9 @@ lemma Scheme.IsGermInjective.of_openCover
126126

127127
protected
128128
lemma Scheme.IsGermInjective.Spec
129-
(H : ∀ I : Ideal R, I.IsPrime → ∃ f : R, f ∉ I ∧ ∀ (x y : R)
130-
(_ : y * x = 0) (_ : y ∉ I), ∃ n, f ^ n * x = 0) : (Spec R).IsGermInjective := by
129+
(H : ∀ I : Ideal R, I.IsPrime →
130+
∃ f : R, f ∉ I ∧ ∀ (x y : R), y * x = 0 → y ∉ I → ∃ n, f ^ n * x = 0) :
131+
(Spec R).IsGermInjective := by
131132
refine fun p ↦ ⟨?_⟩
132133
obtain ⟨f, hf, H⟩ := H p.asIdeal p.2
133134
refine ⟨PrimeSpectrum.basicOpen f, hf, ?_, ?_⟩

Mathlib/Analysis/Analytic/Basic.lean

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,16 @@ theorem radius_shift (p : FormalMultilinearSeries 𝕜 E F) : p.shift.radius = p
352352
intro h
353353
simp only [le_refl, le_sup_iff, exists_prop, and_true]
354354
intro n
355-
by_cases hr : r = 0
356-
· rw [hr]
355+
cases eq_zero_or_pos r with
356+
| inl hr =>
357+
rw [hr]
357358
cases n <;> simp
358-
right
359-
replace hr : 0 < (r : ℝ) := pos_iff_ne_zero.mpr hr
360-
specialize h (n + 1)
361-
rw [le_div_iff₀ hr]
362-
rwa [pow_succ, ← mul_assoc] at h
359+
| inr hr =>
360+
right
361+
rw [← NNReal.coe_pos] at hr
362+
specialize h (n + 1)
363+
rw [le_div_iff₀ hr]
364+
rwa [pow_succ, ← mul_assoc] at h
363365

364366
@[simp]
365367
theorem radius_unshift (p : FormalMultilinearSeries 𝕜 E (E →L[𝕜] F)) (z : F) :

Mathlib/Analysis/Analytic/Constructions.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,9 @@ def formalMultilinearSeries_geometric : FormalMultilinearSeries 𝕜 A A :=
716716

717717
/-- The geometric series as an `ofScalars` series. -/
718718
theorem formalMultilinearSeries_geometric_eq_ofScalars :
719-
formalMultilinearSeries_geometric 𝕜 A = FormalMultilinearSeries.ofScalars A fun _ ↦ (1 : 𝕜) :=
720-
by simp_rw [FormalMultilinearSeries.ext_iff, FormalMultilinearSeries.ofScalars,
719+
formalMultilinearSeries_geometric 𝕜 A =
720+
FormalMultilinearSeries.ofScalars A fun _ ↦ (1 : 𝕜) := by
721+
simp_rw [FormalMultilinearSeries.ext_iff, FormalMultilinearSeries.ofScalars,
721722
formalMultilinearSeries_geometric, one_smul, implies_true]
722723

723724
lemma formalMultilinearSeries_geometric_apply_norm_le (n : ℕ) :
@@ -739,9 +740,9 @@ lemma one_le_formalMultilinearSeries_geometric_radius (𝕜 : Type*) [Nontrivial
739740

740741
lemma formalMultilinearSeries_geometric_radius (𝕜 : Type*) [NontriviallyNormedField 𝕜]
741742
(A : Type*) [NormedRing A] [NormOneClass A] [NormedAlgebra 𝕜 A] :
742-
(formalMultilinearSeries_geometric 𝕜 A).radius = 1 := by
743-
exact (formalMultilinearSeries_geometric_eq_ofScalars 𝕜 A ▸
744-
FormalMultilinearSeries.ofScalars_radius_eq_of_tendsto A _ one_ne_zero (by simp))
743+
(formalMultilinearSeries_geometric 𝕜 A).radius = 1 :=
744+
formalMultilinearSeries_geometric_eq_ofScalars 𝕜 A ▸
745+
FormalMultilinearSeries.ofScalars_radius_eq_of_tendsto A _ one_ne_zero (by simp)
745746

746747
lemma hasFPowerSeriesOnBall_inverse_one_sub
747748
(𝕜 : Type*) [NontriviallyNormedField 𝕜]

Mathlib/Analysis/Analytic/OfScalars.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,8 @@ private theorem tendsto_succ_norm_div_norm {r r' : ℝ≥0} (hr' : r' ≠ 0)
164164
(hc : Tendsto (fun n ↦ ‖c n.succ‖ / ‖c n‖) atTop (𝓝 r)) :
165165
Tendsto (fun n ↦ ‖‖c (n + 1)‖ * r' ^ (n + 1)‖ /
166166
‖‖c n‖ * r' ^ n‖) atTop (𝓝 ↑(r' * r)) := by
167-
simp_rw [norm_mul, norm_norm, mul_div_mul_comm, ← norm_div, pow_succ,
168-
mul_div_right_comm, div_self (pow_ne_zero _ (NNReal.coe_ne_zero.mpr hr')
169-
), one_mul, norm_div, NNReal.norm_eq]
167+
simp_rw [norm_mul, norm_norm, mul_div_mul_comm, ← norm_div, pow_succ, mul_div_right_comm,
168+
div_self (pow_ne_zero _ (NNReal.coe_ne_zero.mpr hr')), one_mul, norm_div, NNReal.norm_eq]
170169
exact mul_comm r' r ▸ hc.mul tendsto_const_nhds
171170

172171
theorem ofScalars_radius_ge_inv_of_tendsto {r : ℝ≥0} (hr : r ≠ 0)

Mathlib/Analysis/CStarAlgebra/ContinuousFunctionalCalculus/Instances.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ instance IsStarNormal.instContinuousFunctionalCalculus {A : Type*} [CStarAlgebra
159159
spectrum_nonempty a _ := spectrum.nonempty a
160160
exists_cfc_of_predicate a ha := by
161161
refine ⟨(StarAlgebra.elemental ℂ a).subtype.comp <| continuousFunctionalCalculus a,
162-
?hom_closedEmbedding, ?hom_id, ?hom_map_spectrum, ?predicate_hom⟩
163-
case hom_closedEmbedding =>
162+
?hom_isClosedEmbedding, ?hom_id, ?hom_map_spectrum, ?predicate_hom⟩
163+
case hom_isClosedEmbedding =>
164164
exact Isometry.isClosedEmbedding <|
165165
isometry_subtype_coe.comp <| StarAlgEquiv.isometry (continuousFunctionalCalculus a)
166166
case hom_id => exact congr_arg Subtype.val <| continuousFunctionalCalculus_map_id a

Mathlib/Analysis/Calculus/FirstDerivativeTest.lean

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ lemma isLocalMax_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ} (g₀ : a < b) (g
4646
(h : ContinuousAt f b)
4747
(hd₀ : DifferentiableOn ℝ f (Ioo a b))
4848
(hd₁ : DifferentiableOn ℝ f (Ioo b c))
49-
(h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
50-
(h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0) : IsLocalMax f b :=
49+
(h₀ : ∀ x ∈ Ioo a b, 0 ≤ deriv f x)
50+
(h₁ : ∀ x ∈ Ioo b c, deriv f x ≤ 0) : IsLocalMax f b :=
5151
have hIoc : ContinuousOn f (Ioc a b) :=
5252
Ioo_union_right g₀ ▸ hd₀.continuousOn.union_continuousAt (isOpen_Ioo (a := a) (b := b))
5353
(by simp_all)
@@ -65,20 +65,20 @@ lemma isLocalMin_of_deriv_Ioo {f : ℝ → ℝ} {a b c : ℝ}
6565
(hd₀ : DifferentiableOn ℝ f (Ioo a b)) (hd₁ : DifferentiableOn ℝ f (Ioo b c))
6666
(h₀ : ∀ x ∈ Ioo a b, deriv f x ≤ 0)
6767
(h₁ : ∀ x ∈ Ioo b c, 0 ≤ deriv f x) : IsLocalMin f b := by
68-
have := isLocalMax_of_deriv_Ioo (f := -f) g₀ g₁
69-
(by simp_all) hd₀.neg hd₁.neg
70-
(fun x hx => deriv.neg (f := f) ▸ Left.nonneg_neg_iff.mpr <|h₀ x hx)
71-
(fun x hx => deriv.neg (f := f) ▸ Left.neg_nonpos_iff.mpr <|h₁ x hx)
72-
exact (neg_neg f) ▸ IsLocalMax.neg this
68+
have := isLocalMax_of_deriv_Ioo (f := -f) g₀ g₁
69+
(by simp_all) hd₀.neg hd₁.neg
70+
(fun x hx => deriv.neg (f := f) ▸ Left.nonneg_neg_iff.mpr <|h₀ x hx)
71+
(fun x hx => deriv.neg (f := f) ▸ Left.neg_nonpos_iff.mpr <|h₁ x hx)
72+
exact (neg_neg f) ▸ IsLocalMax.neg this
7373

7474
/-- The First-Derivative Test from calculus, maxima version,
7575
expressed in terms of left and right filters. -/
7676
lemma isLocalMax_of_deriv' {f : ℝ → ℝ} {b : ℝ} (h : ContinuousAt f b)
7777
(hd₀ : ∀ᶠ x in 𝓝[<] b, DifferentiableAt ℝ f x) (hd₁ : ∀ᶠ x in 𝓝[>] b, DifferentiableAt ℝ f x)
78-
(h₀ : ∀ᶠ x in 𝓝[<] b, 0 ≤ deriv f x) (h₁ : ∀ᶠ x in 𝓝[>] b, deriv f x ≤ 0) :
78+
(h₀ : ∀ᶠ x in 𝓝[<] b, 0 ≤ deriv f x) (h₁ : ∀ᶠ x in 𝓝[>] b, deriv f x ≤ 0) :
7979
IsLocalMax f b := by
80-
obtain ⟨a,ha⟩ := (nhdsWithin_Iio_basis' ⟨b - 1, sub_one_lt b⟩).eventually_iff.mp <| hd₀.and h₀
81-
obtain ⟨c,hc⟩ := (nhdsWithin_Ioi_basis' ⟨b + 1, lt_add_one b⟩).eventually_iff.mp <| hd₁.and h₁
80+
obtain ⟨a, ha⟩ := (nhdsWithin_Iio_basis' ⟨b - 1, sub_one_lt b⟩).eventually_iff.mp <| hd₀.and h₀
81+
obtain ⟨c, hc⟩ := (nhdsWithin_Ioi_basis' ⟨b + 1, lt_add_one b⟩).eventually_iff.mp <| hd₁.and h₁
8282
exact isLocalMax_of_deriv_Ioo ha.1 hc.1 h
8383
(fun _ hx => (ha.2 hx).1.differentiableWithinAt)
8484
(fun _ hx => (hc.2 hx).1.differentiableWithinAt)
@@ -88,10 +88,10 @@ lemma isLocalMax_of_deriv' {f : ℝ → ℝ} {b : ℝ} (h : ContinuousAt f b)
8888
expressed in terms of left and right filters. -/
8989
lemma isLocalMin_of_deriv' {f : ℝ → ℝ} {b : ℝ} (h : ContinuousAt f b)
9090
(hd₀ : ∀ᶠ x in 𝓝[<] b, DifferentiableAt ℝ f x) (hd₁ : ∀ᶠ x in 𝓝[>] b, DifferentiableAt ℝ f x)
91-
(h₀ : ∀ᶠ x in 𝓝[<] b, deriv f x ≤ 0) (h₁ : ∀ᶠ x in 𝓝[>] b, deriv f x ≥ 0) :
91+
(h₀ : ∀ᶠ x in 𝓝[<] b, deriv f x ≤ 0) (h₁ : ∀ᶠ x in 𝓝[>] b, deriv f x ≥ 0) :
9292
IsLocalMin f b := by
93-
obtain ⟨a,ha⟩ := (nhdsWithin_Iio_basis' ⟨b - 1, sub_one_lt b⟩).eventually_iff.mp <| hd₀.and h₀
94-
obtain ⟨c,hc⟩ := (nhdsWithin_Ioi_basis' ⟨b + 1, lt_add_one b⟩).eventually_iff.mp <| hd₁.and h₁
93+
obtain ⟨a, ha⟩ := (nhdsWithin_Iio_basis' ⟨b - 1, sub_one_lt b⟩).eventually_iff.mp <| hd₀.and h₀
94+
obtain ⟨c, hc⟩ := (nhdsWithin_Ioi_basis' ⟨b + 1, lt_add_one b⟩).eventually_iff.mp <| hd₁.and h₁
9595
exact isLocalMin_of_deriv_Ioo ha.1 hc.1 h
9696
(fun _ hx => (ha.2 hx).1.differentiableWithinAt)
9797
(fun _ hx => (hc.2 hx).1.differentiableWithinAt)
@@ -100,15 +100,15 @@ lemma isLocalMin_of_deriv' {f : ℝ → ℝ} {b : ℝ} (h : ContinuousAt f b)
100100
/-- The First Derivative test, maximum version. -/
101101
theorem isLocalMax_of_deriv {f : ℝ → ℝ} {b : ℝ} (h : ContinuousAt f b)
102102
(hd : ∀ᶠ x in 𝓝[≠] b, DifferentiableAt ℝ f x)
103-
(h₀ : ∀ᶠ x in 𝓝[<] b, 0 ≤ deriv f x) (h₁ : ∀ᶠ x in 𝓝[>] b, deriv f x ≤ 0) :
103+
(h₀ : ∀ᶠ x in 𝓝[<] b, 0 ≤ deriv f x) (h₁ : ∀ᶠ x in 𝓝[>] b, deriv f x ≤ 0) :
104104
IsLocalMax f b :=
105105
isLocalMax_of_deriv' h
106106
(nhds_left'_le_nhds_ne _ (by tauto)) (nhds_right'_le_nhds_ne _ (by tauto)) h₀ h₁
107107

108108
/-- The First Derivative test, minimum version. -/
109109
theorem isLocalMin_of_deriv {f : ℝ → ℝ} {b : ℝ} (h : ContinuousAt f b)
110110
(hd : ∀ᶠ x in 𝓝[≠] b, DifferentiableAt ℝ f x)
111-
(h₀ : ∀ᶠ x in 𝓝[<] b, deriv f x ≤ 0) (h₁ : ∀ᶠ x in 𝓝[>] b, 0 ≤ deriv f x) :
111+
(h₀ : ∀ᶠ x in 𝓝[<] b, deriv f x ≤ 0) (h₁ : ∀ᶠ x in 𝓝[>] b, 0 ≤ deriv f x) :
112112
IsLocalMin f b :=
113113
isLocalMin_of_deriv' h
114114
(nhds_left'_le_nhds_ne _ (by tauto)) (nhds_right'_le_nhds_ne _ (by tauto)) h₀ h₁

0 commit comments

Comments
 (0)