Skip to content

Commit 2b93138

Browse files
committed
chore: avoid superfluous use of push_neg with contrapose, by_contra o… (#37937)
…r by_cases Found by the linter in #37907.
1 parent 2233275 commit 2b93138

File tree

252 files changed

+354
-354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+354
-354
lines changed

Archive/Imo/Imo1988Q6.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ →
179179
suffices hc : c ≠ mx from lt_of_le_of_ne (mod_cast c_lt) hc
180180
-- However, recall that B(m_x) ≠ m_x + m_y.
181181
-- If c = m_x, we can prove B(m_x) = m_x + m_y.
182-
contrapose! hm_B₂
182+
contrapose hm_B₂
183183
subst c
184184
simp [hV₁]
185185
-- Hence p' = (c, m_x) lies on the upper branch, and we are done.

Archive/Imo/Imo2008Q2.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ theorem imo2008_q2a (x y z : ℝ) (h : x * y * z = 1) (hx : x ≠ 1) (hy : y ≠
4646
x ^ 2 / (x - 1) ^ 2 + y ^ 2 / (y - 1) ^ 2 + z ^ 2 / (z - 1) ^ 21 := by
4747
obtain ⟨a, b, c, ha, hb, hc, rfl, rfl, rfl⟩ := subst_abc h
4848
obtain ⟨m, n, rfl, rfl⟩ : ∃ m n, b = c - m ∧ a = c - m - n := by use c - b, b - a; simp
49-
have hm_ne_zero : m ≠ 0 := by contrapose! hy; simpa [field]
50-
have hn_ne_zero : n ≠ 0 := by contrapose! hx; simpa [field]
51-
have hmn_ne_zero : m + n ≠ 0 := by contrapose! hz; field_simp; linarith
49+
have hm_ne_zero : m ≠ 0 := by contrapose hy; simpa [field]
50+
have hn_ne_zero : n ≠ 0 := by contrapose hx; simpa [field]
51+
have hmn_ne_zero : m + n ≠ 0 := by contrapose hz; field_simp; linarith
5252
have hc_sub_sub : c - (c - m - n) = m + n := by abel
5353
rw [ge_iff_le, ← sub_nonneg]
5454
convert sq_nonneg ((c * (m ^ 2 + n ^ 2 + m * n) - m * (m + n) ^ 2) / (m * n * (m + n)))

Archive/MiuLanguage/DecisionNec.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ theorem goodm_of_rule2 (xs : Miustr) (_ : Derivable (M :: xs)) (h₂ : Goodm (M
133133
constructor
134134
· rfl
135135
· obtain ⟨mhead, mtail⟩ := h₂
136-
contrapose! mtail
136+
contrapose mtail
137137
rw [cons_append] at mtail
138138
exact or_self_iff.mp (mem_append.mp mtail)
139139

@@ -145,7 +145,7 @@ theorem goodm_of_rule3 (as bs : Miustr) (h₁ : Derivable (as ++ [I, I, I] ++ bs
145145
· cases as
146146
· contradiction
147147
exact mhead
148-
· contrapose! nmtail
148+
· contrapose nmtail
149149
rcases exists_cons_of_ne_nil k with ⟨x, xs, rfl⟩
150150
simp_rw [cons_append] at nmtail ⊢
151151
simpa using nmtail
@@ -163,7 +163,7 @@ theorem goodm_of_rule4 (as bs : Miustr) (h₁ : Derivable (as ++ [U, U] ++ bs))
163163
· cases as
164164
· contradiction
165165
exact mhead
166-
· contrapose! nmtail
166+
· contrapose nmtail
167167
rcases exists_cons_of_ne_nil k with ⟨x, xs, rfl⟩
168168
simp_rw [cons_append] at nmtail ⊢
169169
simpa using nmtail

Archive/Sensitivity.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ theorem adj_iff_proj_adj {p q : Q n.succ} (h₀ : p 0 = q 0) :
131131
rw [← Fin.pred_inj (ha := (?ha : y ≠ 0)) (hb := (?hb : i.succ ≠ 0)),
132132
Fin.pred_succ]
133133
case ha =>
134-
contrapose! hy
134+
contrapose hy
135135
rw [hy, h₀]
136136
case hb =>
137137
apply Fin.succ_ne_zero

Archive/Wiedijk100Theorems/PerfectNumbers.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ theorem eq_two_pow_mul_odd {n : ℕ} (hpos : 0 < n) : ∃ k m : ℕ, n = 2 ^ k *
6262
refine ⟨hm, ?_⟩
6363
rw [even_iff_two_dvd]
6464
have hg := h.not_pow_dvd_of_multiplicity_lt (Nat.lt_succ_self _)
65-
contrapose! hg
65+
contrapose hg
6666
rcases hg with ⟨k, rfl⟩
6767
apply Dvd.intro k
6868
rw [pow_succ, mul_assoc, ← hm]
@@ -105,7 +105,7 @@ theorem eq_two_pow_mul_prime_mersenne_of_even_perfect {n : ℕ} (ev : Even n) (p
105105
apply ne_of_lt _ jcon2
106106
rw [mersenne, ← Nat.pred_eq_sub_one, Nat.lt_pred_iff, ← pow_one (Nat.succ 1)]
107107
apply pow_lt_pow_right₀ (Nat.lt_succ_self 1) (Nat.succ_lt_succ k.succ_pos)
108-
contrapose! hm
108+
contrapose hm
109109
simp [hm]
110110

111111
/-- The Euclid-Euler theorem characterizing even perfect numbers -/

Archive/Wiedijk100Theorems/SolutionOfCubicQuartic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ theorem cubic_depressed_eq_zero_iff (hω : IsPrimitiveRoot ω 3) (hp_nonzero : p
9191
rw [h₁]
9292
apply Eq.congr_left
9393
have hs_nonzero : s ≠ 0 := by
94-
contrapose! hp_nonzero with hs_nonzero
94+
contrapose hp_nonzero with hs_nonzero
9595
linear_combination -1 * ht + t * hs_nonzero
9696
rw [← mul_left_inj' (pow_ne_zero 3 hs_nonzero)]
9797
have H := cube_root_of_unity_sum hω
@@ -172,7 +172,7 @@ theorem quartic_depressed_eq_zero_iff
172172
have hi2 : (2 : K) ≠ 0 := Invertible.ne_zero _
173173
have h4 : (4 : K) = 2 ^ 2 := by norm_num
174174
have hs_nonzero : s ≠ 0 := by
175-
contrapose! hq_nonzero with hs0
175+
contrapose hq_nonzero with hs0
176176
linear_combination (exp := 2) -hu + (4 * r - u ^ 2) * hs + (u ^ 2 * s - 4 * r * s) * hs0
177177
calc
178178
_ ↔ 4 * (x ^ 4 + p * x ^ 2 + q * x + r) = 0 := by simp [h4, hi2]

Mathlib/Algebra/Algebra/Spectrum/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ lemma spectrum.units_conjugate {a : A} {u : Aˣ} :
440440
simp [mul_assoc]
441441
intro a u μ hμ
442442
rw [spectrum.mem_iff] at hμ ⊢
443-
contrapose!
443+
contrapose hμ
444444
simpa [mul_sub, sub_mul, Algebra.right_comm] using u.isUnit.mul hμ |>.mul u⁻¹.isUnit
445445

446446
/-- Conjugation by a unit preserves the spectrum, inverse on left. -/

Mathlib/Algebra/GCDMonoid/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ noncomputable def gcdMonoidOfGCD [DecidableEq α] (gcd : α → α → α)
10131013
· rfl
10141014
have h := (Classical.choose_spec ((gcd_dvd_left a 0).trans (Dvd.intro 0 rfl))).symm
10151015
have a0' : gcd a 00 := by
1016-
contrapose! a0
1016+
contrapose a0
10171017
rw [← associated_zero_iff_eq_zero, ← a0]
10181018
exact associated_of_dvd_dvd (dvd_gcd (dvd_refl a) (dvd_zero a)) (gcd_dvd_left _ _)
10191019
apply Or.resolve_left (mul_eq_zero.1 _) a0'
@@ -1051,7 +1051,7 @@ noncomputable def normalizedGCDMonoidOfGCD [NormalizationMonoid α] [DecidableEq
10511051
· rw [hl, zero_mul]
10521052
have h1 : gcd a b ≠ 0 := by
10531053
have hab : a * b ≠ 0 := mul_ne_zero a0 hb
1054-
contrapose! hab
1054+
contrapose hab
10551055
rw [← normalize_eq_zero, ← this, hab, zero_mul]
10561056
have h2 : normalize (gcd a b * l) = gcd a b * l := by rw [this, normalize_idem]
10571057
rw [← normalize_gcd] at this

Mathlib/Algebra/Group/Irreducible/Indecomposable.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ lemma Submonoid.closure_image_isMulIndecomposable_baseOf [Finite ι]
102102
have ⟨(hi₀ : 1 < f (v i)), (hi₁ : v i ∉ _)⟩ : i ∈ s := hi.prop
103103
have hi₂ (k : ι) (hk₀ : 1 < f (v k)) (hk₁ : f (v k) < f (v i)) : v k ∈ closure (v '' t) := by
104104
by_contra hk₂; exact not_le.mpr hk₁ <| hi.le_of_le ⟨hk₀, hk₂⟩ hk₁.le
105-
have hi₃ : i ∉ t := by contrapose! hi₁; exact subset_closure <| mem_image_of_mem v hi₁
105+
have hi₃ : i ∉ t := by contrapose hi₁; exact subset_closure <| mem_image_of_mem v hi₁
106106
obtain ⟨j, k, hj, hk, hjk⟩ : ∃ (j k : ι) (hj : 1 < f (v j)) (hk : 1 < f (v k)),
107107
v i = v j * v k := by
108108
grind [IsMulIndecomposable]

Mathlib/Algebra/Group/UniqueProds/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ theorem of_mulOpposite (h : TwoUniqueProds Gᵐᵒᵖ) : TwoUniqueProds G where
560560
simp_rw [mem_product] at h1 h2 ⊢
561561
refine ⟨(_, _), ⟨?_, ?_⟩, (_, _), ⟨?_, ?_⟩, ?_, hu1.of_mulOpposite, hu2.of_mulOpposite⟩
562562
pick_goal 5
563-
· contrapose! hne; rw [Prod.ext_iff] at hne ⊢
563+
· contrapose hne; rw [Prod.ext_iff] at hne ⊢
564564
exact ⟨unop_injective hne.2, unop_injective hne.1
565565
all_goals apply (mem_map' f).mp
566566
exacts [h1.2, h1.1, h2.2, h2.1]

0 commit comments

Comments
 (0)