Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - chore: avoid some unused variables #11594

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions Mathlib/Analysis/NormedSpace/Real.lean
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ theorem interior_closedBall (x : E) {r : ℝ} (hr : r ≠ 0) :
have hf1 : (1 : ℝ) ∈ f ⁻¹' interior (closedBall x <| dist y x) := by simpa [f]
have h1 : (1 : ℝ) ∈ interior (Icc (-1 : ℝ) 1) :=
interior_mono this (preimage_interior_subset_interior_preimage hfc hf1)
contrapose h1
simp
simp at h1
intro c hc
rw [mem_Icc, ← abs_le, ← Real.norm_eq_abs, ← mul_le_mul_right hr]
simpa [f, dist_eq_norm, norm_smul] using hc
Expand Down
11 changes: 4 additions & 7 deletions Mathlib/FieldTheory/Finite/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,10 @@ theorem sum_subgroup_pow_eq_zero [CommRing K] [NoZeroDivisors K]
* (Multiset.map (fun i : G => (i.val : K) ^ k) Finset.univ.val).sum = 0 := by
rw [sub_mul, mul_comm, ← h_multiset_map_sum, one_mul, sub_self]
rw [mul_eq_zero] at hzero
rcases hzero with h | h
· contrapose! ha
ext
rw [← sub_eq_zero]
simp_rw [SubmonoidClass.coe_pow, Units.val_pow_eq_pow_val, OneMemClass.coe_one,
Units.val_one, h]
· exact h
refine hzero.resolve_left fun h => ha ?_
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use "\maps" instead of "=>" while you're at it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Not official or anything, but my preference is against "while you're at it" suggestions. They really do, in my opinion, add friction to getting stuff done.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this point!
My point was this is a new proof written - so reviewing doesn't become any harder this way. Authoring it does; thanks for pointing this out.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me add: I can make sure to, in the future,

  • make such comments directly as suggestions (minimizing the overhead for authors and reviewers)
  • limit these comments to new proofs, or PRs cleaning up miscellaneous things, where such a change is in scope.

ext
rw [← sub_eq_zero]
simp_rw [SubmonoidClass.coe_pow, Units.val_pow_eq_pow_val, OneMemClass.coe_one, Units.val_one, h]

section

Expand Down
8 changes: 3 additions & 5 deletions Mathlib/FieldTheory/Minpoly/Field.lean
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0)
have hx : IsIntegral A x := ⟨p, pmonic, hp⟩
symm; apply eq_of_sub_eq_zero
by_contra hnz
have hd := degree_le_of_ne_zero A x hnz (by simp [hp])
contrapose! hd
apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt
apply degree_sub_lt _ (minpoly.ne_zero hx)
· rw [(monic hx).leadingCoeff, pmonic.leadingCoeff]
· exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x))
Expand All @@ -72,9 +71,8 @@ theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by
have hx : IsIntegral A x := IsAlgebraic.isIntegral ⟨p, hp0, hp⟩
rw [← dvd_iff_modByMonic_eq_zero (monic hx)]
by_contra hnz
have hd := degree_le_of_ne_zero A x hnz
((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp)
contrapose! hd
apply degree_le_of_ne_zero A x hnz
((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt
exact degree_modByMonic_lt _ (monic hx)
#align minpoly.dvd minpoly.dvd

Expand Down
5 changes: 2 additions & 3 deletions Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ theorem _root_.IsIntegrallyClosed.minpoly.unique {s : S} {P : R[X]} (hmo : P.Mon
have hs : IsIntegral R s := ⟨P, hmo, hP⟩
symm; apply eq_of_sub_eq_zero
by_contra hnz
have := IsIntegrallyClosed.degree_le_of_ne_zero hs hnz (by simp [hP])
contrapose! this
refine' degree_sub_lt _ (ne_zero hs) _
refine IsIntegrallyClosed.degree_le_of_ne_zero hs hnz (by simp [hP]) |>.not_lt ?_
refine degree_sub_lt ?_ (ne_zero hs) ?_
· exact le_antisymm (min R s hmo hP) (Pmin (minpoly R s) (monic hs) (aeval R s))
· rw [(monic hs).leadingCoeff, hmo.leadingCoeff]
#align minpoly.is_integrally_closed.minpoly.unique IsIntegrallyClosed.minpoly.unique
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/GroupTheory/Perm/Cycle/Type.lean
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ theorem le_card_support_of_mem_cycleType {n : ℕ} {σ : Perm α} (h : n ∈ cyc
theorem cycleType_of_card_le_mem_cycleType_add_two {n : ℕ} {g : Perm α}
(hn2 : Fintype.card α < n + 2) (hng : n ∈ g.cycleType) : g.cycleType = {n} := by
obtain ⟨c, g', rfl, hd, hc, rfl⟩ := mem_cycleType_iff.1 hng
by_cases g'1 : g' = 1
· rw [hd.cycleType, hc.cycleType, coe_singleton, g'1, cycleType_one, add_zero]
contrapose! hn2
suffices g'1 : g' = 1 by
rw [hd.cycleType, hc.cycleType, coe_singleton, g'1, cycleType_one, add_zero]
contrapose! hn2 with g'1
apply le_trans _ (c * g').support.card_le_univ
rw [hd.card_support_mul]
exact add_le_add_left (two_le_card_support_of_ne_one g'1) _
Expand Down
12 changes: 5 additions & 7 deletions Mathlib/GroupTheory/SpecificGroups/Alternating.lean
Original file line number Diff line number Diff line change
Expand Up @@ -291,17 +291,15 @@ theorem isConj_swap_mul_swap_of_cycleType_two {g : Perm (Fin 5)} (ha : g ∈ alt
rw [isConj_iff_cycleType_eq, h2]
interval_cases h_1 : Multiset.card g.cycleType
· exact (h1 (card_cycleType_eq_zero.1 h_1)).elim
· contrapose! ha
simp [h_1]
· simp at ha
· have h04 : (0 : Fin 5) ≠ 4 := by decide
have h13 : (1 : Fin 5) ≠ 3 := by decide
rw [Disjoint.cycleType, (isCycle_swap h04).cycleType, (isCycle_swap h13).cycleType,
card_support_swap h04, card_support_swap h13]
· rfl
· rw [disjoint_iff_disjoint_support, support_swap h04, support_swap h13]
decide
· contrapose! ha
decide
· contradiction
#align alternating_group.is_conj_swap_mul_swap_of_cycle_type_two alternatingGroup.isConj_swap_mul_swap_of_cycleType_two

/-- Shows that $A_5$ is simple by taking an arbitrary non-identity element and showing by casework
Expand Down Expand Up @@ -347,9 +345,9 @@ instance isSimpleGroup_five : IsSimpleGroup (alternatingGroup (Fin 5)) :=
exact mul_mem h h
· -- The case `n = 4` leads to contradiction, as no element of $A_5$ includes a 4-cycle.
have con := mem_alternatingGroup.1 gA
contrapose! con
rw [sign_of_cycleType, cycleType_of_card_le_mem_cycleType_add_two (by decide) ng]
decide
rw [sign_of_cycleType, cycleType_of_card_le_mem_cycleType_add_two (by decide) ng] at con
have : Odd 5 := by decide
simp [this] at con
· -- If `n = 5`, then `g` is itself a 5-cycle, conjugate to `finRotate 5`.
refine' (isConj_iff_cycleType_eq.2 _).normalClosure_eq_top_of normalClosure_finRotate_five
rw [cycleType_of_card_le_mem_cycleType_add_two (by decide) ng, cycleType_finRotate]⟩
Expand Down
3 changes: 1 addition & 2 deletions Mathlib/NumberTheory/ArithmeticFunction.lean
Original file line number Diff line number Diff line change
Expand Up @@ -967,8 +967,7 @@ lemma cardFactors_zero : Ω 0 = 0 := rfl
theorem cardFactors_eq_one_iff_prime {n : ℕ} : Ω n = 1 ↔ n.Prime := by
refine' ⟨fun h => _, fun h => List.length_eq_one.2 ⟨n, factors_prime h⟩⟩
cases' n with n
· contrapose! h
simp
· simp at h
rcases List.length_eq_one.1 h with ⟨x, hx⟩
rw [← prod_factors n.succ_ne_zero, hx, List.prod_singleton]
apply prime_of_mem_factors
Expand Down
14 changes: 7 additions & 7 deletions Mathlib/NumberTheory/NumberField/Embeddings.lean
Original file line number Diff line number Diff line change
Expand Up @@ -547,17 +547,17 @@ theorem _root_.NumberField.is_primitive_element_of_infinitePlace_lt {x : 𝓞 K}
contrapose! h
exact h₂ h.symm
rw [(mk_embedding w).symm, mk_eq_iff] at main
by_cases hw : IsReal w
· rw [conjugate_embedding_eq_of_isReal hw, or_self] at main
cases h₃ with
| inl hw =>
rw [conjugate_embedding_eq_of_isReal hw, or_self] at main
exact congr_arg RingHom.toRatAlgHom main
· refine congr_arg RingHom.toRatAlgHom (main.resolve_right fun h' ↦ ?_)
| inr hw =>
refine congr_arg RingHom.toRatAlgHom (main.resolve_right fun h' ↦ hw.not_le ?_)
have : (embedding w x).im = 0 := by
erw [← Complex.conj_eq_iff_im, RingHom.congr_fun h' x]
exact hψ.symm
contrapose! h
rw [← norm_embedding_eq, ← Complex.re_add_im (embedding w x), this, Complex.ofReal_zero,
zero_mul, add_zero, Complex.norm_eq_abs, Complex.abs_ofReal]
exact h₃.resolve_left hw
rwa [← norm_embedding_eq, ← Complex.re_add_im (embedding w x), this, Complex.ofReal_zero,
zero_mul, add_zero, Complex.norm_eq_abs, Complex.abs_ofReal] at h
· exact fun x ↦ IsAlgClosed.splits_codomain (minpoly ℚ x)

theorem _root_.NumberField.adjoin_eq_top_of_infinitePlace_lt {x : 𝓞 K} {w : InfinitePlace K}
Expand Down
3 changes: 1 addition & 2 deletions Mathlib/RingTheory/HahnSeries/Summable.lean
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ def embDomain (s : SummableFamily Γ R α) (f : α ↪ β) : SummableFamily Γ R
by_cases hb : b ∈ Set.range f
· simp only [Ne.def, Set.mem_setOf_eq, dif_pos hb] at h
exact ⟨Classical.choose hb, h, Classical.choose_spec hb⟩
· contrapose! h
simp only [Ne.def, Set.mem_setOf_eq, dif_neg hb, Classical.not_not, zero_coeff])
· simp only [Ne.def, Set.mem_setOf_eq, dif_neg hb, zero_coeff, not_true_eq_false] at h)
#align hahn_series.summable_family.emb_domain HahnSeries.SummableFamily.embDomain

variable (s : SummableFamily Γ R α) (f : α ↪ β) {a : α} {b : β}
Expand Down
5 changes: 2 additions & 3 deletions Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ private theorem isRoot_cyclotomic_iff' {n : ℕ} {K : Type*} [Field K] {μ : K}
rw [← Finset.prod_sdiff hni, Finset.prod_pair key.ne, hk, hj] at this
have hn := (X_pow_sub_one_separable_iff.mpr <| NeZero.natCast_ne n K).squarefree
rw [← this, Squarefree] at hn
contrapose! hn
refine' ⟨X - C μ, ⟨(∏ x in n.divisors \ {i, n}, cyclotomic x K) * k * j, by ring⟩, _⟩
simp [Polynomial.isUnit_iff_degree_eq_zero]
specialize hn (X - C μ) ⟨(∏ x in n.divisors \ {i, n}, cyclotomic x K) * k * j, by ring⟩
simp [Polynomial.isUnit_iff_degree_eq_zero] at hn

theorem isRoot_cyclotomic_iff [NeZero (n : R)] {μ : R} :
IsRoot (cyclotomic n R) μ ↔ IsPrimitiveRoot μ n := by
Expand Down
8 changes: 3 additions & 5 deletions Mathlib/Topology/Connected/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1095,11 +1095,9 @@ theorem isPreconnected_iff_subset_of_disjoint_closed :
exact h ⟨y, hys, hyu⟩ ⟨x, hxs, hxv⟩
· rw [isPreconnected_closed_iff]
intro u v hu hv hs hsu hsv
rw [nonempty_iff_ne_empty]
intro H
specialize h u v hu hv hs H
contrapose H
apply Nonempty.ne_empty
by_contra H
specialize h u v hu hv hs (Set.not_nonempty_iff_eq_empty.mp H)
apply H
cases' h with h h
· rcases hsv with ⟨x, hxs, hxv⟩
exact ⟨x, hxs, ⟨h hxs, hxv⟩⟩
Expand Down