Skip to content

Commit 056cc6b

Browse files
committed
chore: update std4 11-13 (#587)
The main work is cleaning up all the new linter warnings. Also turns on `warningAsError` globally, which in particular means that `sorry`s will break the build; you have to use `set_option warningAsError false` to locally disable this behavior when needed.
1 parent 3fe6184 commit 056cc6b

File tree

19 files changed

+42
-38
lines changed

19 files changed

+42
-38
lines changed

Mathlib/Algebra/Group/Basic.lean

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ theorem mul_div_cancel'' (a b : G) : a * b / b = a :=
497497

498498
@[simp, to_additive]
499499
theorem mul_div_mul_right_eq_div (a b c : G) : a * c / (b * c) = a / b := by
500-
rw [div_mul_eq_div_div_swap] <;> simp only [mul_left_inj, eq_self_iff_true, mul_div_cancel'']
500+
rw [div_mul_eq_div_div_swap]; simp only [mul_left_inj, eq_self_iff_true, mul_div_cancel'']
501501

502502
@[to_additive eq_sub_of_add_eq]
503503
theorem eq_div_of_mul_eq' (h : a * c = b) : a = b / c := by simp [← h]
@@ -633,8 +633,8 @@ theorem div_eq_iff_eq_mul' : a / b = c ↔ a = b * c := by rw [div_eq_iff_eq_mul
633633
theorem mul_div_cancel''' (a b : G) : a * b / a = b := by rw [div_eq_inv_mul, inv_mul_cancel_left]
634634

635635
@[simp, to_additive]
636-
theorem mul_div_cancel'_right (a b : G) : a * (b / a) = b :=
637-
by rw [← mul_div_assoc, mul_div_cancel''']
636+
theorem mul_div_cancel'_right (a b : G) : a * (b / a) = b := by
637+
rw [← mul_div_assoc, mul_div_cancel''']
638638

639639
@[simp, to_additive sub_add_cancel']
640640
theorem div_mul_cancel'' (a b : G) : a / (a * b) = b⁻¹ := by rw [← inv_div, mul_div_cancel''']
@@ -643,24 +643,24 @@ theorem div_mul_cancel'' (a b : G) : a / (a * b) = b⁻¹ := by rw [← inv_div,
643643
-- along with the additive version `add_neg_cancel_comm_assoc`,
644644
-- defined in `algebra/group/commute`
645645
@[to_additive]
646-
theorem mul_mul_inv_cancel'_right (a b : G) : a * (b * a⁻¹) = b :=
647-
by rw [← div_eq_mul_inv, mul_div_cancel'_right a b]
646+
theorem mul_mul_inv_cancel'_right (a b : G) : a * (b * a⁻¹) = b := by
647+
rw [← div_eq_mul_inv, mul_div_cancel'_right a b]
648648

649649
@[simp, to_additive]
650-
theorem mul_mul_div_cancel (a b c : G) : a * c * (b / c) = a * b :=
651-
by rw [mul_assoc, mul_div_cancel'_right]
650+
theorem mul_mul_div_cancel (a b c : G) : a * c * (b / c) = a * b := by
651+
rw [mul_assoc, mul_div_cancel'_right]
652652

653653
@[simp, to_additive]
654-
theorem div_mul_mul_cancel (a b c : G) : a / c * (b * c) = a * b :=
655-
by rw [mul_left_comm, div_mul_cancel', mul_comm]
654+
theorem div_mul_mul_cancel (a b c : G) : a / c * (b * c) = a * b := by
655+
rw [mul_left_comm, div_mul_cancel', mul_comm]
656656

657657
@[simp, to_additive sub_add_sub_cancel']
658-
theorem div_mul_div_cancel'' (a b c : G) : a / b * (c / a) = c / b :=
659-
by rw [mul_comm] <;> apply div_mul_div_cancel'
658+
theorem div_mul_div_cancel'' (a b c : G) : a / b * (c / a) = c / b := by
659+
rw [mul_comm]; apply div_mul_div_cancel'
660660

661661
@[simp, to_additive]
662-
theorem mul_div_div_cancel (a b c : G) : a * b / (a / c) = b * c :=
663-
by rw [← div_mul, mul_div_cancel''']
662+
theorem mul_div_div_cancel (a b c : G) : a * b / (a / c) = b * c := by
663+
rw [← div_mul, mul_div_cancel''']
664664

665665
@[simp, to_additive]
666666
theorem div_div_div_cancel_left (a b c : G) : c / a / (c / b) = b / a := by

Mathlib/Algebra/Ring/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ lemma Nat.cast_pow [Semiring R] {m n : ℕ} : (m ^ n).cast = (m.cast ^ n : R) :=
6060
theorem Nat.cast_commute [Semiring α] (n : ℕ) (x : α) : Commute (↑n) x := by
6161
induction n with
6262
| zero => rw [Nat.cast_zero]; exact Commute.zero_left x
63-
| succ n ihn => rw [Nat.cast_succ] <;> exact ihn.add_left (Commute.one_left x)
63+
| succ n ihn => rw [Nat.cast_succ]; exact ihn.add_left (Commute.one_left x)
6464

6565
end Semiring
6666

Mathlib/Data/Fin/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ lemma Fin.size_positive' [Nonempty (Fin n)] : 0 < n :=
2828

2929
@[simp]
3030
protected theorem Fin.eta (a : Fin n) (h : (a : ℕ) < n) : (⟨(a : ℕ), h⟩ : Fin n) = a := by
31-
cases a <;> rfl
31+
cases a; rfl
3232

3333
lemma zero_lt_of_lt {a : Nat} : ∀ {x : Nat}, x < a -> 0 < a
3434
| 0, h => h

Mathlib/Data/FunLike/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ theorem coe_injective : Function.Injective (fun f : F => (f : ∀ a : α, β a))
157157

158158
@[simp]
159159
theorem coe_fn_eq {f g : F} : (f : ∀ a : α, β a) = (g : ∀ a : α, β a) ↔ f = g :=
160-
fun h => FunLike.coe_injective' h, fun h => by cases h <;> rfl⟩
160+
fun h => FunLike.coe_injective' h, fun h => by cases h; rfl⟩
161161

162162
theorem ext' {f g : F} (h : (f : ∀ a : α, β a) = (g : ∀ a : α, β a)) : f = g :=
163163
FunLike.coe_injective' h

Mathlib/Data/List/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ theorem pmap_map {p : β → Prop} (g : ∀ b, p b → γ) (f : α → β) (l H)
250250

251251
theorem pmap_eq_map_attach {p : α → Prop} (f : ∀ a, p a → β) (l H) :
252252
pmap f l H = l.attach.map fun x => f x.1 (H _ x.2) := by
253-
rw [attach, map_pmap] <;> exact pmap_congr l fun _ _ _ _ => rfl
253+
rw [attach, map_pmap]; exact pmap_congr l fun _ _ _ _ => rfl
254254

255255
theorem attach_map_val (l : List α) : l.attach.map Subtype.val = l := by
256-
rw [attach, map_pmap] <;> exact (pmap_eq_map _ _ _ _).trans (map_id l)
256+
rw [attach, map_pmap]; exact (pmap_eq_map ..).trans (map_id l)
257257

258258
@[simp]
259259
theorem mem_attach (l : List α) : ∀ x, x ∈ l.attach

Mathlib/Data/List/Pairwise.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ theorem pairwise_append_comm (s : Symmetric R) {l₁ l₂ : List α} :
1717
Pairwise R (l₁ ++ l₂) ↔ Pairwise R (l₂ ++ l₁) := by
1818
have : ∀ l₁ l₂ : List α, (∀ x : α, x ∈ l₁ → ∀ y : α, y ∈ l₂ → R x y) →
1919
∀ x : α, x ∈ l₂ → ∀ y : α, y ∈ l₁ → R x y := fun l₁ l₂ a x xm y ym => s (a y ym x xm)
20-
simp only [pairwise_append, and_left_comm] <;> rw [Iff.intro (this l₁ l₂) (this l₂ l₁)]
20+
simp only [pairwise_append, and_left_comm]; rw [Iff.intro (this l₁ l₂) (this l₂ l₁)]
2121

2222
theorem pairwise_middle (s : Symmetric R) {a : α} {l₁ l₂ : List α} :
2323
Pairwise R (l₁ ++ a :: l₂) ↔ Pairwise R (a :: (l₁ ++ l₂)) :=

Mathlib/Data/List/Range.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ theorem mem_range' {m : ℕ} : ∀ {s n : ℕ}, m ∈ range' s n ↔ s ≤ m ∧
3232
have l : m = s ∨ s + 1 ≤ m ↔ s ≤ m := by
3333
simpa only [eq_comm] using (@Decidable.le_iff_eq_or_lt _ _ _ s m).symm
3434
mem_cons.trans <| by
35-
simp only [mem_range', or_and_left, or_iff_right_of_imp this, l, Nat.add_right_comm]
36-
<;> rfl
35+
simp only [mem_range', or_and_left, or_iff_right_of_imp this, l, Nat.add_right_comm]; rfl
3736

3837
theorem rangeAux_range' : ∀ s n : ℕ, rangeAux s (range' s n) = range' 0 (n + s)
3938
| 0, n => rfl

Mathlib/Data/Option/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ theorem getD_default_eq_iget [Inhabited α] (o : Option α) :
273273
@[simp]
274274
theorem guard_eq_some' {p : Prop} [Decidable p] (u) : _root_.guard p = some u ↔ p := by
275275
cases u
276-
by_cases p <;> simp [_root_.guard, h] <;> first |rfl|contradiction
276+
by_cases p <;> simp [_root_.guard, h]
277277

278278
theorem liftOrGet_choice {f : α → α → α} (h : ∀ a b, f a b = a ∨ f a b = b) :
279279
∀ o₁ o₂, liftOrGet f o₁ o₂ = o₁ ∨ liftOrGet f o₁ o₂ = o₂

Mathlib/Data/Prod/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ theorem Lex_def (r : α → α → Prop) (s : β → β → Prop) {p q : α ×
180180
fun h => by cases h <;> simp [*], fun h =>
181181
match p, q, h with
182182
| (a, b), (c, d), Or.inl h => Lex.left _ _ h
183-
| (a, b), (c, d), Or.inr ⟨e, h⟩ => by subst e <;> exact Lex.right _ h⟩
183+
| (a, b), (c, d), Or.inr ⟨e, h⟩ => by subst e; exact Lex.right _ h⟩
184184

185185
instance Lex.decidable [DecidableEq α]
186186
(r : α → α → Prop) (s : β → β → Prop) [DecidableRel r] [DecidableRel s] :

Mathlib/Init/CcLemmas.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ theorem or_eq_of_eq {a b : Prop} (h : a = b) : (a ∨ b) = a :=
4949
h ▸ propext or_self_iff
5050

5151
theorem imp_eq_of_eq_true_left {a b : Prop} (h : a = True) : (a → b) = b :=
52-
h.symm ▸ propext (Iff.intro (fun h => h trivial) fun h₁ _ => h₁)
52+
h.symm ▸ propext fun h => h trivial, fun h₁ _ => h₁
5353

5454
theorem imp_eq_of_eq_true_right {a b : Prop} (h : b = True) : (a → b) = True :=
55-
h.symm ▸ propext (Iff.intro (fun h => trivial) fun h₁ _ => h₁)
55+
h.symm ▸ propext fun _ => trivial, fun h₁ _ => h₁
5656

5757
theorem imp_eq_of_eq_false_left {a b : Prop} (h : a = False) : (a → b) = True :=
58-
h.symm ▸ propext (Iff.intro (fun h => trivial) fun _ h₂ => False.elim h₂)
58+
h.symm ▸ propext fun _ => trivial, fun _ h₂ => False.elim h₂
5959

6060
theorem imp_eq_of_eq_false_right {a b : Prop} (h : b = False) : (a → b) = Not a :=
61-
h.symm ▸ propext (Iff.intro (fun h => h) fun hna ha => hna ha)
61+
h.symm ▸ propext fun h => h, fun hna ha => hna ha
6262

6363
/- Remark: the congruence closure module will only use the following lemma is
6464
cc_config.em is tt. -/
@@ -67,7 +67,7 @@ theorem not_imp_eq_of_eq_false_right {a b : Prop} (h : b = False) : (Not a → b
6767
fun h' => Classical.byContradiction fun hna => h' hna) fun ha hna => hna ha)
6868

6969
theorem imp_eq_true_of_eq {a b : Prop} (h : a = b) : (a → b) = True :=
70-
h ▸ propext (Iff.intro (fun _ => trivial) fun _ ha => ha)
70+
h ▸ propext fun _ => trivial, fun _ ha => ha
7171

7272
theorem not_eq_of_eq_true {a : Prop} (h : a = True) : Not a = False :=
7373
h.symm ▸ propext not_true

0 commit comments

Comments
 (0)