Skip to content

Commit cff6012

Browse files
chore: tidy various files (#1693)
1 parent 9981514 commit cff6012

File tree

11 files changed

+109
-126
lines changed

11 files changed

+109
-126
lines changed

Mathlib/Algebra/BigOperators/Ring.lean

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ variable [CommMonoid β]
3838
open Classical
3939

4040
theorem prod_pow_eq_pow_sum {x : β} {f : α → ℕ} :
41-
∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x :=
42-
by
41+
∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x := by
4342
apply Finset.induction
4443
· simp
4544
· intro a s has H
@@ -61,8 +60,8 @@ theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
6160
#align finset.mul_sum Finset.mul_sum
6261

6362
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
64-
(f₂ : ι₂ → β) : ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ᶠ s₂, f₁ p.1 * f₂ p.2 :=
65-
by
63+
(f₂ : ι₂ → β) :
64+
((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ᶠ s₂, f₁ p.1 * f₂ p.2 := by
6665
rw [sum_product, sum_mul, sum_congr rfl]
6766
intros
6867
rw [mul_sum]
@@ -96,13 +95,12 @@ variable [CommSemiring β]
9695
`Finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
9796
theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
9897
{t : ∀ a, Finset (δ a)} {f : ∀ a, δ a → β} :
99-
(∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) :=
100-
by
98+
(∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) := by
10199
induction' s using Finset.induction with a s ha ih
102100
· rw [pi_empty, sum_singleton]
103101
rfl
104-
· have h₁ : ∀ x ∈ t a,∀ y ∈ t a,
105-
x ≠ y → Disjoint (image (pi.cons s a x) (pi s t)) (image (pi.cons s a y) (pi s t)) := by
102+
· have h₁ : ∀ x ∈ t a, ∀ y ∈ t a, x ≠ y →
103+
Disjoint (image (pi.cons s a x) (pi s t)) (image (pi.cons s a y) (pi s t)) := by
106104
intro x _ y _ h
107105
simp only [disjoint_iff_ne, mem_image]
108106
rintro _ ⟨p₂, _, eq₂⟩ _ ⟨p₃, _, eq₃⟩ eq
@@ -166,8 +164,7 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
166164
∏ i in s, (f i + g i) =
167165
(∏ i in s, f i) +
168166
∑ i in s,
169-
g i * (∏ j in s.filter (· < i), (f j + g j)) * ∏ j in s.filter fun j => i < j, f j :=
170-
by
167+
g i * (∏ j in s.filter (· < i), (f j + g j)) * ∏ j in s.filter fun j => i < j, f j := by
171168
refine' Finset.induction_on_max s (by simp) _
172169
clear s
173170
intro a s ha ihs
@@ -191,8 +188,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
191188
∏ i in s, (f i - g i) =
192189
(∏ i in s, f i) -
193190
∑ i in s,
194-
g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j :=
195-
by
191+
g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j := by
196192
simp only [sub_eq_add_neg]
197193
convert prod_add_ordered s f fun i => -g i
198194
simp
@@ -201,17 +197,15 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
201197
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
202198
a partition of unity from a collection of “bump” functions. -/
203199
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
204-
(f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) :=
205-
by
200+
(f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) := by
206201
rw [prod_sub_ordered]
207202
simp
208203
#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
209204

210205
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `Finset`
211206
gives `(a + b)^s.card`.-/
212207
theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
213-
(∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card :=
214-
by
208+
(∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card := by
215209
rw [← prod_const, prod_add]
216210
refine' Finset.sum_congr rfl fun t ht => _
217211
rw [prod_const, prod_const, ← card_sdiff (mem_powerset.1 ht)]
@@ -222,9 +216,9 @@ theorem dvd_sum {b : β} {s : Finset α} {f : α → β} (h : ∀ x ∈ s, b ∣
222216
#align finset.dvd_sum Finset.dvd_sum
223217

224218
@[norm_cast]
225-
theorem prod_nat_cast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
219+
theorem prod_natCast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
226220
(Nat.castRingHom β).map_prod f s
227-
#align finset.prod_nat_cast Finset.prod_nat_cast
221+
#align finset.prod_nat_cast Finset.prod_natCast
228222

229223
end CommSemiring
230224

@@ -235,7 +229,7 @@ variable {R : Type _} [CommRing R]
235229
theorem prod_range_cast_nat_sub (n k : ℕ) :
236230
∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) :=
237231
by
238-
rw [prod_nat_cast]
232+
rw [prod_natCast]
239233
cases' le_or_lt k n with hkn hnk
240234
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
241235
· rw [← mem_range] at hnk
@@ -252,8 +246,7 @@ of `s`, and over all subsets of `s` to which one adds `x`. -/
252246
theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x : α} (h : x ∉ s)
253247
(f : Finset α → β) :
254248
(∏ a in (insert x s).powerset, f a) =
255-
(∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) :=
256-
by
249+
(∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) := by
257250
rw [powerset_insert, Finset.prod_union, Finset.prod_image]
258251
· intro t₁ h₁ t₂ h₂ heq
259252
rw [← Finset.erase_insert (not_mem_of_mem_powerset_of_not_mem h₁ h), ←
@@ -279,8 +272,8 @@ theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k :
279272
((∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i) =
280273
(((∑ i in range n, f i) * ∑ i in range k, g i) + f n * ∑ i in range k, g i) +
281274
(∑ i in range n, f i) * g k +
282-
f n * g k :=
283-
by simp only [add_mul, mul_add, add_assoc, sum_range_succ]
275+
f n * g k := by
276+
simp only [add_mul, mul_add, add_assoc, sum_range_succ]
284277
#align finset.sum_range_succ_mul_sum_range_succ Finset.sum_range_succ_mul_sum_range_succ
285278

286279
end Finset

Mathlib/Algebra/Order/Monoid/Lemmas.lean

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,47 +1277,47 @@ theorem StrictAntiOn.mul' [CovariantClass α α (· * ·) (· < ·)]
12771277
#align strict_anti_on.add StrictAntiOn.add
12781278

12791279
/-- The product of a monotone function and a strictly monotone function is strictly monotone. -/
1280-
@[to_additive add_strict_mono "The sum of a monotone function and a strictly monotone function is
1280+
@[to_additive add_strictMono "The sum of a monotone function and a strictly monotone function is
12811281
strictly monotone."]
1282-
theorem Monotone.mul_strict_mono' [CovariantClass α α (· * ·) (· < ·)]
1282+
theorem Monotone.mul_strictMono' [CovariantClass α α (· * ·) (· < ·)]
12831283
[CovariantClass α α (swap (· * ·)) (· ≤ ·)] {f g : β → α} (hf : Monotone f)
12841284
(hg : StrictMono g) :
12851285
StrictMono fun x => f x * g x :=
12861286
fun _ _ h => mul_lt_mul_of_le_of_lt (hf h.le) (hg h)
1287-
#align monotone.mul_strict_mono' Monotone.mul_strict_mono'
1288-
#align monotone.add_strict_mono Monotone.add_strict_mono
1287+
#align monotone.mul_strict_mono' Monotone.mul_strictMono'
1288+
#align monotone.add_strict_mono Monotone.add_strictMono
12891289

12901290
/-- The product of a monotone function and a strictly monotone function is strictly monotone. -/
1291-
@[to_additive add_strict_mono "The sum of a monotone function and a strictly monotone function is
1291+
@[to_additive add_strictMono "The sum of a monotone function and a strictly monotone function is
12921292
strictly monotone."]
1293-
theorem MonotoneOn.mul_strict_mono' [CovariantClass α α (· * ·) (· < ·)]
1293+
theorem MonotoneOn.mul_strictMono' [CovariantClass α α (· * ·) (· < ·)]
12941294
[CovariantClass α α (swap (· * ·)) (· ≤ ·)] {f g : β → α} (hf : MonotoneOn f s)
12951295
(hg : StrictMonoOn g s) : StrictMonoOn (fun x => f x * g x) s :=
12961296
fun _ hx _ hy h => mul_lt_mul_of_le_of_lt (hf hx hy h.le) (hg hx hy h)
1297-
#align monotone_on.mul_strict_mono' MonotoneOn.mul_strict_mono'
1298-
#align monotone_on.add_strict_mono MonotoneOn.add_strict_mono
1297+
#align monotone_on.mul_strict_mono' MonotoneOn.mul_strictMono'
1298+
#align monotone_on.add_strict_mono MonotoneOn.add_strictMono
12991299

13001300
/-- The product of a antitone function and a strictly antitone function is strictly antitone. -/
1301-
@[to_additive add_strict_anti "The sum of a antitone function and a strictly antitone function is
1301+
@[to_additive add_strictAnti "The sum of a antitone function and a strictly antitone function is
13021302
strictly antitone."]
1303-
theorem Antitone.mul_strict_anti' [CovariantClass α α (· * ·) (· < ·)]
1303+
theorem Antitone.mul_strictAnti' [CovariantClass α α (· * ·) (· < ·)]
13041304
[CovariantClass α α (swap (· * ·)) (· ≤ ·)] {f g : β → α} (hf : Antitone f)
13051305
(hg : StrictAnti g) :
13061306
StrictAnti fun x => f x * g x :=
13071307
fun _ _ h => mul_lt_mul_of_le_of_lt (hf h.le) (hg h)
1308-
#align antitone.mul_strict_anti' Antitone.mul_strict_anti'
1309-
#align antitone.add_strict_anti Antitone.add_strict_anti
1308+
#align antitone.mul_strict_anti' Antitone.mul_strictAnti'
1309+
#align antitone.add_strict_anti Antitone.add_strictAnti
13101310

13111311
/-- The product of a antitone function and a strictly antitone function is strictly antitone. -/
1312-
@[to_additive add_strict_anti "The sum of a antitone function and a strictly antitone function is
1312+
@[to_additive add_strictAnti "The sum of a antitone function and a strictly antitone function is
13131313
strictly antitone."]
1314-
theorem AntitoneOn.mul_strict_anti' [CovariantClass α α (· * ·) (· < ·)]
1314+
theorem AntitoneOn.mul_strictAnti' [CovariantClass α α (· * ·) (· < ·)]
13151315
[CovariantClass α α (swap (· * ·)) (· ≤ ·)] {f g : β → α} (hf : AntitoneOn f s)
13161316
(hg : StrictAntiOn g s) :
13171317
StrictAntiOn (fun x => f x * g x) s :=
13181318
fun _ hx _ hy h => mul_lt_mul_of_le_of_lt (hf hx hy h.le) (hg hx hy h)
1319-
#align antitone_on.mul_strict_anti' AntitoneOn.mul_strict_anti'
1320-
#align antitone_on.add_strict_anti AntitoneOn.add_strict_anti
1319+
#align antitone_on.mul_strict_anti' AntitoneOn.mul_strictAnti'
1320+
#align antitone_on.add_strict_anti AntitoneOn.add_strictAnti
13211321

13221322
variable [CovariantClass α α (· * ·) (· ≤ ·)] [CovariantClass α α (swap (· * ·)) (· < ·)]
13231323

@@ -1490,9 +1490,9 @@ theorem bit0_mono [CovariantClass α α (· + ·) (· ≤ ·)] [CovariantClass
14901490
#align bit0_mono bit0_mono
14911491

14921492
@[deprecated]
1493-
theorem bit0_strict_mono [CovariantClass α α (· + ·) (· < ·)]
1493+
theorem bit0_strictMono [CovariantClass α α (· + ·) (· < ·)]
14941494
[CovariantClass α α (swap (· + ·)) (· < ·)] :
14951495
StrictMono (bit0 : α → α) := fun _ _ h => add_lt_add h h
1496-
#align bit0_strict_mono bit0_strict_mono
1496+
#align bit0_strict_mono bit0_strictMono
14971497

14981498
end Bit

Mathlib/Data/Fin/Tuple/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ def consCases {P : (∀ i : Fin n.succ, α i) → Sort v} (h : ∀ x₀ x, P (Fi
154154
#align fin.cons_cases Fin.consCases
155155

156156
@[simp]
157-
theorem cons_cases_cons {P : (∀ i : Fin n.succ, α i) → Sort v} (h : ∀ x₀ x, P (Fin.cons x₀ x))
157+
theorem consCases_cons {P : (∀ i : Fin n.succ, α i) → Sort v} (h : ∀ x₀ x, P (Fin.cons x₀ x))
158158
(x₀ : α 0) (x : ∀ i : Fin n, α i.succ) : @consCases _ _ _ h (cons x₀ x) = h x₀ x := by
159159
rw [consCases, cast_eq]
160160
congr
161-
#align fin.cons_cases_cons Fin.cons_cases_cons
161+
#align fin.cons_cases_cons Fin.consCases_cons
162162

163163
/-- Recurse on an tuple by splitting into `Fin.elim0` and `Fin.cons`. -/
164164
@[elab_as_elim]
@@ -289,7 +289,7 @@ theorem range_cons {α : Type _} {n : ℕ} (x : α) (b : Fin n → α) :
289289
section Append
290290

291291
/-- Append a tuple of length `m` to a tuple of length `n` to get a tuple of length `m + n`.
292-
This is a non-dependent version of `fin.add_cases`. -/
292+
This is a non-dependent version of `Fin.add_cases`. -/
293293
def append {α : Type _} (a : Fin m → α) (b : Fin n → α) : Fin (m + n) → α :=
294294
@Fin.addCases _ _ (fun _ => α) a b
295295
#align fin.append Fin.append
@@ -935,7 +935,7 @@ theorem sigma_eq_of_eq_comp_cast {α : Type _} :
935935
simpa using h
936936
#align fin.sigma_eq_of_eq_comp_cast Fin.sigma_eq_of_eq_comp_cast
937937

938-
/-- `fin.sigma_eq_of_eq_comp_cast` as an `iff`. -/
938+
/-- `Fin.sigma_eq_of_eq_comp_cast` as an `iff`. -/
939939
theorem sigma_eq_iff_eq_comp_cast {α : Type _} {a b : Σii, Fin ii → α} :
940940
a = b ↔ ∃ h : a.fst = b.fst, a.snd = b.snd ∘ Fin.cast h :=
941941
fun h ↦ h ▸ ⟨rfl, funext <| Fin.rec fun _ _ ↦ rfl⟩, fun ⟨_, h'⟩ ↦

0 commit comments

Comments
 (0)