Skip to content

Commit bf781f2

Browse files
committed
chore: replace by_contra! and contrapose! with plain versions (#31600)
When the push_neg step in these tactics does nothing, write just `by_contra` resp. `contrapose`. Not exhaustive.
1 parent 3827ba2 commit bf781f2

19 files changed

Lines changed: 26 additions & 26 deletions

File tree

Mathlib/Algebra/Group/Fin/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ lemma lt_sub_iff {n : ℕ} {a b : Fin n} : a < a - b ↔ a < b := by
115115
rcases n with - | n
116116
· exact a.elim0
117117
constructor
118-
· contrapose!
118+
· contrapose
119119
intro h
120120
obtain ⟨l, hl⟩ := Nat.exists_eq_add_of_le (Fin.not_lt.mp h)
121121
simpa only [Fin.not_lt, le_iff_val_le_val, sub_def, hl, ← Nat.add_assoc, Nat.add_mod_left,

Mathlib/Algebra/Homology/Embedding/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ lemma notMem_range_embeddingUpIntLE_iff (n : ℤ) :
255255
(∀ (i : ℕ), (embeddingUpIntLE p).f i ≠ n) ↔ p < n := by
256256
constructor
257257
· intro h
258-
by_contra!
258+
by_contra
259259
exact h (p - n).natAbs (by simp; lia)
260260
· intros
261261
dsimp
@@ -268,7 +268,7 @@ lemma notMem_range_embeddingUpIntGE_iff (n : ℤ) :
268268
(∀ (i : ℕ), (embeddingUpIntGE p).f i ≠ n) ↔ n < p := by
269269
constructor
270270
· intro h
271-
by_contra!
271+
by_contra
272272
exact h (n - p).natAbs (by simp; lia)
273273
· intros
274274
dsimp

Mathlib/Algebra/Order/Archimedean/Class.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ theorem mk_prod {ι : Type*} [LinearOrder ι] {s : Finset ι} (hnonempty : s.Non
395395
have hminmem : s.min' hs ∈ (Finset.cons i s hi) :=
396396
Finset.mem_cons_of_mem (Finset.min'_mem _ _)
397397
have hne : mk (a i) ≠ mk (a (s.min' hs)) := by
398-
by_contra!
399-
obtain eq := hmono.injOn (by simp) hminmem this
398+
by_contra h
399+
obtain eq := hmono.injOn (by simp) hminmem h
400400
rw [eq] at hi
401401
exact hi (Finset.min'_mem _ hs)
402402
rw [← ih] at hne

Mathlib/AlgebraicTopology/SimplicialSet/Degenerate.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ lemma isIso_of_nonDegenerate (x : X.nonDegenerate n)
120120
obtain ⟨x, hx⟩ := x
121121
induction m using SimplexCategory.rec with | _ m
122122
rw [mem_nonDegenerate_iff_notMem_degenerate] at hx
123-
by_contra!
124-
refine hx ⟨_, not_le.1 (fun h ↦ this ?_), f, y, hy⟩
123+
by_contra hf
124+
refine hx ⟨_, not_le.1 (fun h ↦ hf ?_), f, y, hy⟩
125125
rw [SimplexCategory.isIso_iff_of_epi]
126126
exact le_antisymm h (SimplexCategory.len_le_of_epi f)
127127

Mathlib/CategoryTheory/Limits/Shapes/Preorder/WellOrderContinuous.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ instance IsWellOrderContinuous.restriction_setIci
9797
dsimp only [f]
9898
by_cases! h : j' ≤ j
9999
· refine ⟨⟨⟨j, le_refl j⟩, ?_⟩, h⟩
100-
by_contra!
101-
simp only [Set.mem_Iio, not_lt] at this
100+
by_contra h'
101+
simp only [Set.mem_Iio, not_lt] at h'
102102
apply hm.1
103103
rintro ⟨k, hk⟩ hkm
104-
exact this.trans hk
104+
exact h'.trans hk
105105
· exact ⟨⟨⟨j', h.le⟩, hj'⟩, by rfl⟩
106106
exact (Functor.Final.isColimitWhiskerEquiv (F := hf.functor) _).2
107107
(F.isColimitOfIsWellOrderContinuous m.1 (Set.Ici.isSuccLimit_coe m hm))⟩

Mathlib/Combinatorics/Colex.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private lemma trans_aux (hst : toColex s ≤ toColex t) (htu : toColex t ≤ toC
153153
set_option backward.privateInPublic true in
154154
private lemma antisymm_aux (hst : toColex s ≤ toColex t) (hts : toColex t ≤ toColex s) : s ⊆ t := by
155155
intro a has
156-
by_contra! hat
156+
by_contra hat
157157
have ⟨_b, hb₁, hb₂, _⟩ := trans_aux hst hts has hat
158158
exact hb₂ hb₁
159159

Mathlib/Combinatorics/SimpleGraph/Clique.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ theorem cliqueFree_two : G.CliqueFree 2 ↔ G = ⊥ := by
500500

501501
lemma CliqueFree.mem_of_sup_edge_isNClique {x y : α} {t : Finset α} {n : ℕ} (h : G.CliqueFree n)
502502
(hc : (G ⊔ edge x y).IsNClique n t) : x ∈ t := by
503-
by_contra! hf
503+
by_contra hf
504504
have ht : (t : Set α) \ {x} = t := sdiff_eq_left.mpr <| Set.disjoint_singleton_right.mpr hf
505505
exact h t ⟨ht ▸ hc.1.sdiff_of_sup_edge, hc.2
506506

Mathlib/Combinatorics/SimpleGraph/Metric.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ protected theorem Reachable.pos_dist_of_ne (h : G.Reachable u v) (hne : u ≠ v)
204204
protected theorem Reachable.one_lt_dist_of_ne_of_not_adj (h : G.Reachable u v) (hne : u ≠ v)
205205
(hnadj : ¬G.Adj u v) : 1 < G.dist u v :=
206206
Nat.lt_of_le_of_ne (h.pos_dist_of_ne hne) (by
207-
by_contra! hc
207+
by_contra hc
208208
obtain ⟨p, hp⟩ := Reachable.exists_walk_length_eq_dist h
209209
exact hnadj (Walk.exists_length_eq_one_iff.mp ⟨p, hc ▸ hp⟩))
210210

Mathlib/Data/Seq/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ theorem at_least_as_long_as_coind {a : Seq α} {b : Seq β}
923923
by_cases ha : a.Terminates; swap
924924
· simp [length'_of_not_terminates ha]
925925
simp only [length'_of_terminates ha, length'_le_iff]
926-
by_contra! hb
926+
by_contra hb
927927
have hb_cons : b.drop (a.length ha) ≠ .nil := by
928928
intro hb'
929929
simp only [← length'_eq_zero_iff_nil, drop_length', tsub_eq_zero_iff_le, length'_le_iff] at hb'

Mathlib/GroupTheory/Perm/ClosureSwap.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ theorem mem_closure_isSwap {S : Set (Perm α)} (hS : ∀ f ∈ S, f.IsSwap) {f :
118118
· rw [← orbit_eq_iff.mpr (hf b), h1, orbit_eq_iff.mpr (hf a)]; apply mem_orbit_self
119119
· rw [← orbit_eq_iff.mpr (hf b), h2]; apply hf
120120
· exact hf b
121-
· contrapose! hb
121+
· contrapose hb
122122
simp_rw [notMem_compl_iff, mem_fixedBy, Perm.smul_def, Perm.mul_apply, swap_apply_def,
123123
apply_eq_iff_eq]
124124
by_cases hb' : f b = b

0 commit comments

Comments
 (0)