Skip to content

Commit 6fdbc7e

Browse files
chore: backports for leanprover/lean4#4814 (part 19) (#15434)
see #15245 Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>
1 parent bff8114 commit 6fdbc7e

File tree

8 files changed

+46
-45
lines changed

8 files changed

+46
-45
lines changed

Mathlib/GroupTheory/PGroup.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ theorem card_modEq_card_fixedPoints : Nat.card α ≡ Nat.card (fixedPoints G α
190190

191191
/-- If a p-group acts on `α` and the cardinality of `α` is not a multiple
192192
of `p` then the action has a fixed point. -/
193-
theorem nonempty_fixed_point_of_prime_not_dvd_card (hpα : ¬p ∣ Nat.card α) :
193+
theorem nonempty_fixed_point_of_prime_not_dvd_card (α) [MulAction G α] (hpα : ¬p ∣ Nat.card α) :
194194
(fixedPoints G α).Nonempty :=
195195
have : Finite α := Nat.finite_of_card_ne_zero (fun h ↦ (h ▸ hpα) (dvd_zero p))
196196
@Set.nonempty_of_nonempty_subtype _ _
@@ -315,12 +315,12 @@ theorem disjoint_of_ne (p₁ p₂ : ℕ) [hp₁ : Fact p₁.Prime] [hp₂ : Fact
315315

316316
section P2comm
317317

318-
variable [Fact p.Prime] {n : ℕ} (hGpn : Nat.card G = p ^ n)
318+
variable [Fact p.Prime] {n : ℕ}
319319

320320
open Subgroup
321321

322322
/-- The cardinality of the `center` of a `p`-group is `p ^ k` where `k` is positive. -/
323-
theorem card_center_eq_prime_pow (hn : 0 < n) :
323+
theorem card_center_eq_prime_pow (hGpn : Nat.card G = p ^ n) (hn : 0 < n) :
324324
∃ k > 0, Nat.card (center G) = p ^ k := by
325325
have : Finite G := Nat.finite_of_card_ne_zero (hGpn ▸ pow_ne_zero n (NeZero.ne p))
326326
have hcG := to_subgroup (of_card hGpn) (center G)

Mathlib/RingTheory/Binomial.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ theorem smeval_ascPochhammer_neg_of_lt {n k : ℕ} (h : n < k) :
301301
smeval (ascPochhammer ℕ k) (-n : ℤ) = 0 := by
302302
rw [show k = n + (k - n - 1) + 1 by omega, smeval_ascPochhammer_neg_add]
303303

304-
theorem smeval_ascPochhammer_nat_cast [NatPowAssoc R] (n k : ℕ) :
304+
theorem smeval_ascPochhammer_nat_cast {R} [NonAssocRing R] [Pow R ℕ] [NatPowAssoc R] (n k : ℕ) :
305305
smeval (ascPochhammer ℕ k) (n : R) = smeval (ascPochhammer ℕ k) n := by
306306
rw [smeval_at_natCast (ascPochhammer ℕ k) n]
307307

@@ -337,8 +337,8 @@ theorem multichoose_succ_neg_natCast [NatPowAssoc R] (n : ℕ) :
337337
rw [factorial_nsmul_multichoose_eq_ascPochhammer, smeval_neg_nat,
338338
smeval_ascPochhammer_succ_neg n, Int.cast_zero]
339339

340-
theorem smeval_ascPochhammer_int_ofNat [NatPowAssoc R] (r : R) : ∀ n : ℕ,
341-
smeval (ascPochhammer ℤ n) r = smeval (ascPochhammer ℕ n) r
340+
theorem smeval_ascPochhammer_int_ofNat {R} [NonAssocRing R] [Pow R ℕ] [NatPowAssoc R] (r : R) :
341+
∀ n : ℕ, smeval (ascPochhammer ℤ n) r = smeval (ascPochhammer ℕ n) r
342342
| 0 => by
343343
simp only [ascPochhammer_zero, smeval_one]
344344
| n + 1 => by

Mathlib/RingTheory/DiscreteValuationRing/Basic.lean

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ def HasUnitMulPowIrreducibleFactorization [CommRing R] : Prop :=
148148

149149
namespace HasUnitMulPowIrreducibleFactorization
150150

151-
variable {R} [CommRing R] (hR : HasUnitMulPowIrreducibleFactorization R)
151+
variable {R} [CommRing R]
152152

153-
theorem unique_irreducible ⦃p q : R⦄ (hp : Irreducible p) (hq : Irreducible q) :
153+
theorem unique_irreducible (hR : HasUnitMulPowIrreducibleFactorization R)
154+
⦃p q : R⦄ (hp : Irreducible p) (hq : Irreducible q) :
154155
Associated p q := by
155156
rcases hR with ⟨ϖ, hϖ, hR⟩
156157
suffices ∀ {p : R} (_ : Irreducible p), Associated p ϖ by
@@ -178,7 +179,8 @@ variable [IsDomain R]
178179
/-- An integral domain in which there is an irreducible element `p`
179180
such that every nonzero element is associated to a power of `p` is a unique factorization domain.
180181
See `DiscreteValuationRing.ofHasUnitMulPowIrreducibleFactorization`. -/
181-
theorem toUniqueFactorizationMonoid : UniqueFactorizationMonoid R :=
182+
theorem toUniqueFactorizationMonoid (hR : HasUnitMulPowIrreducibleFactorization R) :
183+
UniqueFactorizationMonoid R :=
182184
let p := Classical.choose hR
183185
let spec := Classical.choose_spec hR
184186
UniqueFactorizationMonoid.of_exists_prime_factors fun x hx => by

Mathlib/RingTheory/Filtration.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ theorem _root_.Ideal.stableFiltration_stable (I : Ideal R) (N : Submodule R M) :
187187
rw [add_comm, pow_add, mul_smul, pow_one]
188188

189189
variable {F F'}
190-
variable (h : F.Stable)
191190

192-
theorem Stable.exists_pow_smul_eq : ∃ n₀, ∀ k, F.N (n₀ + k) = I ^ k • F.N n₀ := by
191+
theorem Stable.exists_pow_smul_eq (h : F.Stable) : ∃ n₀, ∀ k, F.N (n₀ + k) = I ^ k • F.N n₀ := by
193192
obtain ⟨n₀, hn⟩ := h
194193
use n₀
195194
intro k
@@ -198,7 +197,8 @@ theorem Stable.exists_pow_smul_eq : ∃ n₀, ∀ k, F.N (n₀ + k) = I ^ k •
198197
· rw [← add_assoc, ← hn, ih, add_comm, pow_add, mul_smul, pow_one]
199198
omega
200199

201-
theorem Stable.exists_pow_smul_eq_of_ge : ∃ n₀, ∀ n ≥ n₀, F.N n = I ^ (n - n₀) • F.N n₀ := by
200+
theorem Stable.exists_pow_smul_eq_of_ge (h : F.Stable) :
201+
∃ n₀, ∀ n ≥ n₀, F.N n = I ^ (n - n₀) • F.N n₀ := by
202202
obtain ⟨n₀, hn₀⟩ := h.exists_pow_smul_eq
203203
use n₀
204204
intro n hn

Mathlib/RingTheory/MvPolynomial/Homogeneous.lean

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,25 @@ lemma weightedHomogeneousSubmodule_one (n : ℕ) :
8080
variable {σ R}
8181

8282
@[simp]
83-
theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) :
83+
theorem mem_homogeneousSubmodule (n : ℕ) (p : MvPolynomial σ R) :
8484
p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl
8585

8686
variable (σ R)
8787

8888
/-- While equal, the former has a convenient definitional reduction. -/
89-
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) :
89+
theorem homogeneousSubmodule_eq_finsupp_supported (n : ℕ) :
9090
homogeneousSubmodule σ R n = Finsupp.supported _ R { d | d.degree = n } := by
9191
simp_rw [degree_eq_weight_one]
9292
exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n
9393

9494
variable {σ R}
9595

96-
theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) :
96+
theorem homogeneousSubmodule_mul (m n : ℕ) :
9797
homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) :=
9898
weightedHomogeneousSubmodule_mul 1 m n
9999

100100
section
101101

102-
variable [CommSemiring R]
103-
104102
theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : d.degree = n) :
105103
IsHomogeneous (monomial d r) n := by
106104
rw [degree_eq_weight_one] at hn
@@ -143,7 +141,7 @@ end
143141

144142
namespace IsHomogeneous
145143

146-
variable [CommSemiring R] [CommSemiring S] {φ ψ : MvPolynomial σ R} {m n : ℕ}
144+
variable [CommSemiring S] {φ ψ : MvPolynomial σ R} {m n : ℕ}
147145

148146
theorem coeff_eq_zero (hφ : IsHomogeneous φ n) {d : σ →₀ ℕ} (hd : d.degree ≠ n) :
149147
coeff d φ = 0 := by
@@ -448,7 +446,7 @@ section HomogeneousComponent
448446

449447
open Finset Finsupp
450448

451-
variable [CommSemiring R] (n : ℕ) (φ ψ : MvPolynomial σ R)
449+
variable (n : ℕ) (φ ψ : MvPolynomial σ R)
452450

453451
theorem homogeneousComponent_mem :
454452
homogeneousComponent n φ ∈ homogeneousSubmodule σ R n :=

Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ namespace IsWeaklyEisensteinAt
5656

5757
section CommSemiring
5858

59-
variable [CommSemiring R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟)
59+
variable [CommSemiring R] {𝓟 : Ideal R} {f : R[X]}
6060

61-
62-
theorem map {A : Type v} [CommRing A] (φ : R →+* A) : (f.map φ).IsWeaklyEisensteinAt (𝓟.map φ) := by
61+
theorem map (hf : f.IsWeaklyEisensteinAt 𝓟) {A : Type v} [CommRing A] (φ : R →+* A) :
62+
(f.map φ).IsWeaklyEisensteinAt (𝓟.map φ) := by
6363
refine (isWeaklyEisensteinAt_iff _ _).2 fun hn => ?_
6464
rw [coeff_map]
6565
exact mem_map_of_mem _ (hf.mem (lt_of_lt_of_le hn (natDegree_map_le _ _)))
@@ -68,7 +68,7 @@ end CommSemiring
6868

6969
section CommRing
7070

71-
variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟)
71+
variable [CommRing R] {𝓟 : Ideal R} {f : R[X]}
7272
variable {S : Type v} [CommRing S] [Algebra R S]
7373

7474
section Principal
@@ -118,7 +118,8 @@ end Principal
118118

119119
-- Porting note: `Ideal.neg_mem_iff` was `neg_mem_iff` on line 142 but Lean was not able to find
120120
-- NegMemClass
121-
theorem pow_natDegree_le_of_root_of_monic_mem {x : R} (hroot : IsRoot f x) (hmo : f.Monic) :
121+
theorem pow_natDegree_le_of_root_of_monic_mem (hf : f.IsWeaklyEisensteinAt 𝓟)
122+
{x : R} (hroot : IsRoot f x) (hmo : f.Monic) :
122123
∀ i, f.natDegree ≤ i → x ^ i ∈ 𝓟 := by
123124
intro i hi
124125
obtain ⟨k, hk⟩ := exists_add_of_le hi
@@ -130,8 +131,8 @@ theorem pow_natDegree_le_of_root_of_monic_mem {x : R} (hroot : IsRoot f x) (hmo
130131
rw [eq_neg_of_add_eq_zero_left hroot, Ideal.neg_mem_iff]
131132
exact Submodule.sum_mem _ fun i _ => mul_mem_right _ _ (hf.mem (Fin.is_lt i))
132133

133-
theorem pow_natDegree_le_of_aeval_zero_of_monic_mem_map {x : S} (hx : aeval x f = 0)
134-
(hmo : f.Monic) :
134+
theorem pow_natDegree_le_of_aeval_zero_of_monic_mem_map (hf : f.IsWeaklyEisensteinAt 𝓟)
135+
{x : S} (hx : aeval x f = 0) (hmo : f.Monic) :
135136
∀ i, (f.map (algebraMap R S)).natDegree ≤ i → x ^ i ∈ 𝓟.map (algebraMap R S) := by
136137
suffices x ^ (f.map (algebraMap R S)).natDegree ∈ 𝓟.map (algebraMap R S) by
137138
intro i hi
@@ -180,7 +181,7 @@ namespace IsEisensteinAt
180181

181182
section CommSemiring
182183

183-
variable [CommSemiring R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsEisensteinAt 𝓟)
184+
variable [CommSemiring R] {𝓟 : Ideal R} {f : R[X]}
184185

185186
theorem _root_.Polynomial.Monic.leadingCoeff_not_mem (hf : f.Monic) (h : 𝓟 ≠ ⊤) :
186187
¬f.leadingCoeff ∈ 𝓟 := hf.leadingCoeff.symm ▸ (Ideal.ne_top_iff_one _).1 h
@@ -192,10 +193,10 @@ theorem _root_.Polynomial.Monic.isEisensteinAt_of_mem_of_not_mem (hf : f.Monic)
192193
mem := fun hn => hmem hn
193194
not_mem := hnot_mem }
194195

195-
theorem isWeaklyEisensteinAt : IsWeaklyEisensteinAt f 𝓟 :=
196+
theorem isWeaklyEisensteinAt (hf : f.IsEisensteinAt 𝓟) : IsWeaklyEisensteinAt f 𝓟 :=
196197
fun h => hf.mem h⟩
197198

198-
theorem coeff_mem {n : ℕ} (hn : n ≠ f.natDegree) : f.coeff n ∈ 𝓟 := by
199+
theorem coeff_mem (hf : f.IsEisensteinAt 𝓟) {n : ℕ} (hn : n ≠ f.natDegree) : f.coeff n ∈ 𝓟 := by
199200
cases' ne_iff_lt_or_gt.1 hn with h₁ h₂
200201
· exact hf.mem h₁
201202
· rw [coeff_eq_zero_of_natDegree_lt h₂]
@@ -205,12 +206,12 @@ end CommSemiring
205206

206207
section IsDomain
207208

208-
variable [CommRing R] [IsDomain R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsEisensteinAt 𝓟)
209+
variable [CommRing R] [IsDomain R] {𝓟 : Ideal R} {f : R[X]}
209210

210211
/-- If a primitive `f` satisfies `f.IsEisensteinAt 𝓟`, where `𝓟.IsPrime`,
211212
then `f` is irreducible. -/
212-
theorem irreducible (hprime : 𝓟.IsPrime) (hu : f.IsPrimitive) (hfd0 : 0 < f.natDegree) :
213-
Irreducible f :=
213+
theorem irreducible (hf : f.IsEisensteinAt 𝓟) (hprime : 𝓟.IsPrime) (hu : f.IsPrimitive)
214+
(hfd0 : 0 < f.natDegree) : Irreducible f :=
214215
irreducible_of_eisenstein_criterion hprime hf.leading (fun _ hn => hf.mem (coe_lt_degree.1 hn))
215216
(natDegree_pos_iff_degree_pos.1 hfd0) hf.not_mem hu
216217

Mathlib/RingTheory/RootsOfUnity/Basic.lean

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,24 +306,24 @@ theorem mk_of_lt (ζ : M) (hk : 0 < k) (h1 : ζ ^ k = 1) (h : ∀ l : ℕ, 0 < l
306306

307307
section CommMonoid
308308

309-
variable {ζ : M} {f : F} (h : IsPrimitiveRoot ζ k)
309+
variable {ζ : M} {f : F}
310310

311311
@[nontriviality]
312312
theorem of_subsingleton [Subsingleton M] (x : M) : IsPrimitiveRoot x 1 :=
313313
⟨Subsingleton.elim _ _, fun _ _ => one_dvd _⟩
314314

315-
theorem pow_eq_one_iff_dvd (l : ℕ) : ζ ^ l = 1 ↔ k ∣ l :=
315+
theorem pow_eq_one_iff_dvd (h : IsPrimitiveRoot ζ k) (l : ℕ) : ζ ^ l = 1 ↔ k ∣ l :=
316316
⟨h.dvd_of_pow_eq_one l, by
317317
rintro ⟨i, rfl⟩; simp only [pow_mul, h.pow_eq_one, one_pow, PNat.mul_coe]⟩
318318

319319
theorem isUnit (h : IsPrimitiveRoot ζ k) (h0 : 0 < k) : IsUnit ζ := by
320320
apply isUnit_of_mul_eq_one ζ (ζ ^ (k - 1))
321321
rw [← pow_succ', tsub_add_cancel_of_le h0.nat_succ_le, h.pow_eq_one]
322322

323-
theorem pow_ne_one_of_pos_of_lt (h0 : 0 < l) (hl : l < k) : ζ ^ l ≠ 1 :=
323+
theorem pow_ne_one_of_pos_of_lt (h : IsPrimitiveRoot ζ k) (h0 : 0 < l) (hl : l < k) : ζ ^ l ≠ 1 :=
324324
mt (Nat.le_of_dvd h0 ∘ h.dvd_of_pow_eq_one _) <| not_le_of_lt hl
325325

326-
theorem ne_one (hk : 1 < k) : ζ ≠ 1 :=
326+
theorem ne_one (h : IsPrimitiveRoot ζ k) (hk : 1 < k) : ζ ≠ 1 :=
327327
h.pow_ne_one_of_pos_of_lt zero_lt_one hk ∘ (pow_one ζ).trans
328328

329329
theorem pow_inj (h : IsPrimitiveRoot ζ k) ⦃i j : ℕ⦄ (hi : i < k) (hj : j < k) (H : ζ ^ i = ζ ^ j) :
@@ -343,7 +343,6 @@ theorem one : IsPrimitiveRoot (1 : M) 1 :=
343343

344344
@[simp]
345345
theorem one_right_iff : IsPrimitiveRoot ζ 1 ↔ ζ = 1 := by
346-
clear h
347346
constructor
348347
· intro h; rw [← pow_one ζ, h.pow_eq_one]
349348
· rintro rfl; exact one
@@ -364,8 +363,8 @@ lemma isUnit_unit {ζ : M} {n} (hn) (hζ : IsPrimitiveRoot ζ n) :
364363
lemma isUnit_unit' {ζ : G} {n} (hn) (hζ : IsPrimitiveRoot ζ n) :
365364
IsPrimitiveRoot (hζ.isUnit hn).unit' n := coe_units_iff.mp hζ
366365

367-
-- Porting note `variable` above already contains `(h : IsPrimitiveRoot ζ k)`
368-
theorem pow_of_coprime (i : ℕ) (hi : i.Coprime k) : IsPrimitiveRoot (ζ ^ i) k := by
366+
theorem pow_of_coprime (h : IsPrimitiveRoot ζ k) (i : ℕ) (hi : i.Coprime k) :
367+
IsPrimitiveRoot (ζ ^ i) k := by
369368
by_cases h0 : k = 0
370369
· subst k; simp_all only [pow_one, Nat.coprime_zero_right]
371370
rcases h.isUnit (Nat.pos_of_ne_zero h0) with ⟨ζ, rfl⟩
@@ -405,7 +404,7 @@ protected theorem orderOf (ζ : M) : IsPrimitiveRoot ζ (orderOf ζ) :=
405404
theorem unique {ζ : M} (hk : IsPrimitiveRoot ζ k) (hl : IsPrimitiveRoot ζ l) : k = l :=
406405
Nat.dvd_antisymm (hk.2 _ hl.1) (hl.2 _ hk.1)
407406

408-
theorem eq_orderOf : k = orderOf ζ :=
407+
theorem eq_orderOf (h : IsPrimitiveRoot ζ k) : k = orderOf ζ :=
409408
h.unique (IsPrimitiveRoot.orderOf ζ)
410409

411410
protected theorem iff (hk : 0 < k) :
@@ -561,9 +560,10 @@ end DivisionCommMonoid
561560

562561
section CommRing
563562

564-
variable [CommRing R] {n : ℕ} (hn : 1 < n) {ζ : R} (hζ : IsPrimitiveRoot ζ n)
563+
variable [CommRing R] {n : ℕ} {ζ : R}
565564

566-
theorem sub_one_ne_zero : ζ - 10 := sub_ne_zero.mpr <| hζ.ne_one hn
565+
theorem sub_one_ne_zero (hn : 1 < n) (hζ : IsPrimitiveRoot ζ n) : ζ - 10 :=
566+
sub_ne_zero.mpr <| hζ.ne_one hn
567567

568568
end CommRing
569569

Mathlib/Topology/Sequences.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,19 @@ theorem continuous_iff_seqContinuous [SequentialSpace X] {f : X → Y} :
189189
Continuous f ↔ SeqContinuous f :=
190190
⟨Continuous.seqContinuous, SeqContinuous.continuous⟩
191191

192-
theorem SequentialSpace.coinduced [SequentialSpace X] (f : X → Y) :
192+
theorem SequentialSpace.coinduced [SequentialSpace X] {Y} (f : X → Y) :
193193
@SequentialSpace Y (.coinduced f ‹_›) :=
194194
letI : TopologicalSpace Y := .coinduced f ‹_›
195195
fun s hs ↦ isClosed_coinduced.2 (hs.preimage continuous_coinduced_rng.seqContinuous).isClosed⟩
196196

197-
protected theorem SequentialSpace.iSup {ι : Sort*} {t : ι → TopologicalSpace X}
197+
protected theorem SequentialSpace.iSup {X} {ι : Sort*} {t : ι → TopologicalSpace X}
198198
(h : ∀ i, @SequentialSpace X (t i)) : @SequentialSpace X (⨆ i, t i) := by
199199
letI : TopologicalSpace X := ⨆ i, t i
200200
refine ⟨fun s hs ↦ isClosed_iSup_iff.2 fun i ↦ ?_⟩
201201
letI := t i
202202
exact IsSeqClosed.isClosed fun u x hus hux ↦ hs hus <| hux.mono_right <| nhds_mono <| le_iSup _ _
203203

204-
protected theorem SequentialSpace.sup {t₁ t₂ : TopologicalSpace X}
204+
protected theorem SequentialSpace.sup {X} {t₁ t₂ : TopologicalSpace X}
205205
(h₁ : @SequentialSpace X t₁) (h₂ : @SequentialSpace X t₂) :
206206
@SequentialSpace X (t₁ ⊔ t₂) := by
207207
rw [sup_eq_iSup]

0 commit comments

Comments
 (0)