Skip to content

Commit 2b9cd2f

Browse files
committed
style: fix many leading by's in mathlib (#35343)
Per the style guide, these should go on the preceding line. Inspired by #22727, and then searching for `:=\n\s*by ` in mathlib.
1 parent 1d77eae commit 2b9cd2f

File tree

37 files changed

+74
-90
lines changed

37 files changed

+74
-90
lines changed

Mathlib/Algebra/FreeMonoid/Count.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ theorem count_apply [DecidableEq α] (x : α) (l : FreeAddMonoid α) :
5858
count x l = Multiplicative.ofAdd (l.toList.count x) := rfl
5959

6060
theorem count_of [DecidableEq α] (x y : α) :
61-
count x (of y) = Pi.mulSingle (M := fun _ => Multiplicative ℕ) x (Multiplicative.ofAdd 1) y :=
62-
by simp only [count, eq_comm, countP_of, ofAdd_zero, Pi.mulSingle_apply]
61+
count x (of y) = Pi.mulSingle (M := fun _ Multiplicative ℕ) x (Multiplicative.ofAdd 1) y := by
62+
simp [count, countP_of, Pi.mulSingle_apply]
6363

6464
end FreeMonoid
6565

Mathlib/Algebra/Group/Int/Defs.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ instance instAddCommGroup : AddCommGroup ℤ where
4343
nsmul := (· * ·)
4444
nsmul_zero := Int.zero_mul
4545
nsmul_succ n x :=
46-
show (n + 1 : ℤ) * x = n * x + x
47-
by rw [Int.add_mul, Int.one_mul]
46+
show (n + 1 : ℤ) * x = n * x + x by rw [Int.add_mul, Int.one_mul]
4847
zsmul := (· * ·)
4948
zsmul_zero' := Int.zero_mul
5049
zsmul_succ' m n := by

Mathlib/Algebra/Group/Invertible/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ before applying this lemma. -/
141141
theorem map_invOf {R : Type*} {S : Type*} {F : Type*} [MulOneClass R] [Monoid S]
142142
[FunLike F R S] [MonoidHomClass F R S] (f : F) (r : R)
143143
[Invertible r] [ifr : Invertible (f r)] :
144-
f (⅟r) = ⅟(f r) :=
144+
f (⅟r) = ⅟(f r) := by
145145
have h : ifr = Invertible.map f r := Subsingleton.elim _ _
146-
by subst h; rfl
146+
subst h; rfl
147147

148148
/-- If a function `f : R → S` has a left-inverse that is a monoid hom,
149149
then `r : R` is invertible if `f r` is.

Mathlib/Algebra/Group/Submonoid/Operations.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,7 @@ lemma closure_prod_one (s : Set M) : closure (s ×ˢ ({1} : Set N)) = (closure s
600600
le_antisymm
601601
(closure_le.2 <| Set.prod_subset_prod_iff.2 <| .inl ⟨subset_closure, .rfl⟩)
602602
(prod_le_iff.2
603-
map_le_of_le_comap _ <| closure_le.2 fun _x hx => subset_closure ⟨hx, rfl⟩,
604-
by simp⟩)
603+
map_le_of_le_comap _ <| closure_le.2 fun _x hx => subset_closure ⟨hx, rfl⟩, by simp⟩)
605604

606605
@[to_additive (attr := simp) closure_zero_prod]
607606
lemma closure_one_prod (t : Set N) : closure (({1} : Set M) ×ˢ t) = .prod ⊥ (closure t) :=

Mathlib/Algebra/Homology/Embedding/TruncGEHomology.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ lemma acyclic_truncGE_iff_isSupportedOutside :
208208
(K.truncGE e).Acyclic ↔ K.IsSupportedOutside e := by
209209
constructor
210210
· intro hK
211-
exact ⟨fun i =>
212-
by simpa only [exactAt_iff_of_quasiIsoAt (K.πTruncGE e)] using hK (e.f i)⟩
211+
exact ⟨fun i ↦ by simpa only [exactAt_iff_of_quasiIsoAt (K.πTruncGE e)] using hK (e.f i)⟩
213212
· intro hK i'
214213
by_cases hi' : ∃ i, e.f i = i'
215214
· obtain ⟨i, rfl⟩ := hi'

Mathlib/Algebra/Homology/Embedding/TruncLEHomology.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ lemma shortComplexTruncLE_X₃_isSupportedOutside :
155155
dsimp [shortComplexTruncLE]
156156
rw [← homologyMap_comp, cokernel.condition, homologyMap_zero]
157157
· simp
158-
· have : IsIso (homologyMap (K.shortComplexTruncLE e).f (e.f i)) :=
159-
by dsimp; infer_instance
158+
· have : IsIso (homologyMap (K.shortComplexTruncLE e).f (e.f i)) := by dsimp; infer_instance
160159
rw [IsZero.iff_id_eq_zero, ← cancel_epi (homologyMap (K.shortComplexTruncLE e).g (e.f i)),
161160
comp_id, comp_zero, ← cancel_epi (homologyMap (K.shortComplexTruncLE e).f (e.f i)),
162161
comp_zero, ← homologyMap_comp, ShortComplex.zero, homologyMap_zero]

Mathlib/Algebra/Module/LocalizedModule/Submodule.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ instance IsLocalizedModule.toLocalizedQuotient' (M' : Submodule R M) :
286286
IsLocalizedModule p (M'.toLocalizedQuotient' S p f) where
287287
map_units x := by
288288
refine (Module.End.isUnit_iff _).mpr ⟨fun m n e ↦ ?_, fun m ↦ ⟨(IsLocalization.mk' S 1 x) • m,
289-
by rw [Module.algebraMap_end_apply, ← smul_assoc, smul_mk'_one, mk'_self', one_smul]⟩⟩
289+
by rw [Module.algebraMap_end_apply, ← smul_assoc, smul_mk'_one, mk'_self', one_smul]⟩⟩
290290
obtain ⟨⟨m, rfl⟩, n, rfl⟩ := PProd.mk (mk_surjective _ m) (mk_surjective _ n)
291291
simp only [Module.algebraMap_end_apply, ← mk_smul, Submodule.Quotient.eq, ← smul_sub] at e
292292
replace e := Submodule.smul_mem _ (IsLocalization.mk' S 1 x) e

Mathlib/Algebra/Module/Presentation/Free.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ lemma free_iff_exists_presentation :
8181
constructor
8282
· rw [free_def.{_, _, v}]
8383
rintro ⟨G, ⟨⟨e⟩⟩⟩
84-
exact ⟨(presentationFinsupp A G).ofLinearEquiv e.symm,
85-
by dsimp; infer_instance⟩
84+
exact ⟨(presentationFinsupp A G).ofLinearEquiv e.symm, by dsimp; infer_instance⟩
8685
· rintro ⟨p, h⟩
8786
exact p.toIsPresentation.free
8887

Mathlib/Algebra/MvPolynomial/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ def coeff (m : σ →₀ ℕ) (p : MvPolynomial σ R) : R :=
550550
theorem mem_support_iff {p : MvPolynomial σ R} {m : σ →₀ ℕ} : m ∈ p.support ↔ p.coeff m ≠ 0 := by
551551
simp [support, coeff]
552552

553-
theorem notMem_support_iff {p : MvPolynomial σ R} {m : σ →₀ ℕ} : m ∉ p.support ↔ p.coeff m = 0 :=
554-
by simp
553+
theorem notMem_support_iff {p : MvPolynomial σ R} {m : σ →₀ ℕ} : m ∉ p.support ↔ p.coeff m = 0 := by
554+
simp
555555

556556
theorem sum_def {A} [AddCommMonoid A] {p : MvPolynomial σ R} {b : (σ →₀ ℕ) → R → A} :
557557
p.sum b = ∑ m ∈ p.support, b m (p.coeff m) := by simp [support, Finsupp.sum, coeff]

Mathlib/Algebra/Order/CauSeq/Completion.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ theorem inv_zero : (0 : (Cauchy abv))⁻¹ = 0 :=
210210
theorem inv_mk {f} (hf) : (mk (abv := abv) f)⁻¹ = mk (inv f hf) :=
211211
congr_arg mk <| by rw [dif_neg]
212212

213-
theorem cau_seq_zero_ne_one : ¬(0 : CauSeq _ abv) ≈ 1 := fun h =>
213+
theorem cau_seq_zero_ne_one : ¬(0 : CauSeq _ abv) ≈ 1 := fun h
214214
have : LimZero (1 - 0 : CauSeq _ abv) := Setoid.symm h
215215
have : LimZero (1 : CauSeq _ abv) := by simpa
216-
by apply one_ne_zero <| const_limZero.1 this
216+
one_ne_zero <| const_limZero.1 this
217217

218218
theorem zero_ne_one : (0 : (Cauchy abv)) ≠ 1 := fun h => cau_seq_zero_ne_one <| mk_eq.1 h
219219

0 commit comments

Comments
 (0)