Skip to content

Commit d2330fe

Browse files
committed
chore: golf proofs involving permutations (#31389)
This reduces the diff of #27433.
1 parent 6a73927 commit d2330fe

File tree

11 files changed

+175
-247
lines changed

11 files changed

+175
-247
lines changed

Mathlib/Algebra/Group/End.lean

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ variable {p : α → Prop} {f : Perm α}
367367
def subtypePerm (f : Perm α) (h : ∀ x, p (f x) ↔ p x) : Perm { x // p x } where
368368
toFun := fun x => ⟨f x, (h _).2 x.2
369369
invFun := fun x => ⟨f⁻¹ x, (h (f⁻¹ x)).1 <| by simpa using x.2
370-
left_inv _ := by simp only [Perm.inv_apply_self, Subtype.coe_eta]
371-
right_inv _ := by simp only [Perm.apply_inv_self, Subtype.coe_eta]
370+
left_inv _ := by simp
371+
right_inv _ := by simp
372372

373373
@[simp]
374374
theorem subtypePerm_apply (f : Perm α) (h : ∀ x, p (f x) ↔ p x) (x : { x // p x }) :
@@ -386,7 +386,7 @@ theorem subtypePerm_mul (f g : Perm α) (hf hg) :
386386
rfl
387387

388388
private theorem inv_aux : (∀ x, p (f x) ↔ p x) ↔ ∀ x, p (f⁻¹ x) ↔ p x :=
389-
f⁻¹.surjective.forall.trans <| by simp_rw [f.apply_inv_self, Iff.comm]
389+
f⁻¹.surjective.forall.trans <| by simp [Iff.comm]
390390

391391
/-- See `Equiv.Perm.inv_subtypePerm`. -/
392392
theorem subtypePerm_inv (f : Perm α) (hf) :
@@ -519,12 +519,10 @@ theorem swap_mul_self (i j : α) : swap i j * swap i j = 1 :=
519519

520520
theorem swap_mul_eq_mul_swap (f : Perm α) (x y : α) : swap x y * f = f * swap (f⁻¹ x) (f⁻¹ y) :=
521521
Equiv.ext fun z => by
522-
simp only [Perm.mul_apply, swap_apply_def]
523-
split_ifs <;>
524-
simp_all only [Perm.apply_inv_self, Perm.eq_inv_iff_eq, not_true]
522+
simp only [Perm.mul_apply, swap_apply_def]; split_ifs <;> simp_all [Perm.eq_inv_iff_eq]
525523

526524
theorem mul_swap_eq_swap_mul (f : Perm α) (x y : α) : f * swap x y = swap (f x) (f y) * f := by
527-
rw [swap_mul_eq_mul_swap, Perm.inv_apply_self, Perm.inv_apply_self]
525+
simp [swap_mul_eq_mul_swap]
528526

529527
theorem swap_apply_apply (f : Perm α) (x y : α) : swap (f x) (f y) = f * swap x y * f⁻¹ := by
530528
rw [mul_swap_eq_swap_mul, mul_inv_cancel_right]

Mathlib/Algebra/Order/Rearrangement.lean

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,26 +170,25 @@ theorem MonovaryOn.sum_smul_comp_perm_eq_sum_smul_iff (hfg : MonovaryOn f g s)
170170
(hσ : {x | σ x ≠ x} ⊆ s) :
171171
∑ i ∈ s, f i • g (σ i) = ∑ i ∈ s, f i • g i ↔ MonovaryOn f (g ∘ σ) s := by
172172
classical
173-
refine ⟨not_imp_not.1 fun h ↦ ?_, fun h ↦ (hfg.sum_smul_comp_perm_le_sum_smul hσ).antisymm ?_⟩
174-
· rw [MonovaryOn] at h
175-
push_neg at h
176-
obtain ⟨x, hx, y, hy, hgxy, hfxy⟩ := h
177-
set τ : Perm ι := (Equiv.swap x y).trans σ
178-
have hτs : {x | τ x ≠ x} ⊆ s := by
179-
refine (set_support_mul_subset σ <| swap x y).trans (Set.union_subset hσ fun z hz ↦ ?_)
180-
obtain ⟨_, rfl | rfl⟩ := swap_apply_ne_self_iff.1 hz <;> assumption
181-
refine ((hfg.sum_smul_comp_perm_le_sum_smul hτs).trans_lt' ?_).ne
182-
obtain rfl | hxy := eq_or_ne x y
183-
· cases lt_irrefl _ hfxy
184-
simp only [τ, ← s.sum_erase_add _ hx,
185-
← (s.erase x).sum_erase_add _ (mem_erase.2 ⟨hxy.symm, hy⟩),
186-
add_assoc, Equiv.coe_trans, Function.comp_apply, swap_apply_right, swap_apply_left]
187-
refine add_lt_add_of_le_of_lt (Finset.sum_congr rfl fun z hz ↦ ?_).le
188-
(smul_add_smul_lt_smul_add_smul hfxy hgxy)
189-
simp_rw [mem_erase] at hz
190-
rw [swap_apply_of_ne_of_ne hz.2.1 hz.1]
191-
· convert h.sum_smul_comp_perm_le_sum_smul ((set_support_inv_eq _).subset.trans hσ) using 1
192-
simp_rw [Function.comp_apply, apply_inv_self]
173+
refine ⟨not_imp_not.1 fun h ↦ ?_, fun h ↦ (hfg.sum_smul_comp_perm_le_sum_smul hσ).antisymm <| by
174+
simpa using h.sum_smul_comp_perm_le_sum_smul ((set_support_inv_eq _).subset.trans hσ)⟩
175+
rw [MonovaryOn] at h
176+
push_neg at h
177+
obtain ⟨x, hx, y, hy, hgxy, hfxy⟩ := h
178+
set τ : Perm ι := (Equiv.swap x y).trans σ
179+
have hτs : {x | τ x ≠ x} ⊆ s := by
180+
refine (set_support_mul_subset σ <| swap x y).trans (Set.union_subset hσ fun z hz ↦ ?_)
181+
obtain ⟨_, rfl | rfl⟩ := swap_apply_ne_self_iff.1 hz <;> assumption
182+
refine ((hfg.sum_smul_comp_perm_le_sum_smul hτs).trans_lt' ?_).ne
183+
obtain rfl | hxy := eq_or_ne x y
184+
· cases lt_irrefl _ hfxy
185+
simp only [τ, ← s.sum_erase_add _ hx,
186+
← (s.erase x).sum_erase_add _ (mem_erase.2 ⟨hxy.symm, hy⟩),
187+
add_assoc, Equiv.coe_trans, Function.comp_apply, swap_apply_right, swap_apply_left]
188+
refine add_lt_add_of_le_of_lt (Finset.sum_congr rfl fun z hz ↦ ?_).le
189+
(smul_add_smul_lt_smul_add_smul hfxy hgxy)
190+
simp_rw [mem_erase] at hz
191+
rw [swap_apply_of_ne_of_ne hz.2.1 hz.1]
193192

194193
/-- **Equality case of the Rearrangement Inequality**: Pointwise scalar multiplication of `f` and
195194
`g`, which antivary together on `s`, is unchanged by a permutation if and only if `f` and `g ∘ σ`

Mathlib/Data/Fintype/Perm.lean

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,9 @@ theorem nodup_permsOfList : ∀ {l : List α}, l.Nodup → (permsOfList l).Nodup
113113
· intro f hf₁ hf₂
114114
let ⟨x, hx, hx'⟩ := List.mem_flatMap.1 hf₂
115115
let ⟨g, hg⟩ := List.mem_map.1 hx'
116-
have hgxa : g⁻¹ x = a := f.injective <| by rw [hmeml hf₁, ← hg.2]; simp
117-
have hxa : x ≠ a := fun h => (List.nodup_cons.1 hl).1 (h ▸ hx)
118-
exact (List.nodup_cons.1 hl).1 <|
119-
hgxa ▸ mem_of_mem_permsOfList hg.1 (by rwa [apply_inv_self, hgxa])
116+
obtain rfl : g⁻¹ x = a := f.injective <| by rw [hmeml hf₁, ← hg.2]; simp
117+
have hxa : x ≠ g⁻¹ x := fun h => (List.nodup_cons.1 hl).1 (h ▸ hx)
118+
exact (List.nodup_cons.1 hl).1 <| mem_of_mem_permsOfList hg.1 (by simpa using hxa)
120119

121120
/-- Given a finset, produce the finset of all permutations of its elements. -/
122121
def permsOfFinset (s : Finset α) : Finset (Perm α) :=

Mathlib/GroupTheory/Perm/Centralizer.lean

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ theorem coe_toPermHom (k : centralizer {g}) (c : g.cycleFactorsFinset) :
167167
The equality is proved by `Equiv.Perm.OnCycleFactors.range_toPermHom_eq_range_toPermHom'`. -/
168168
def range_toPermHom' : Subgroup (Perm g.cycleFactorsFinset) where
169169
carrier := {τ | ∀ c, #(τ c).val.support = #c.val.support}
170-
one_mem' := by
171-
simp only [Set.mem_setOf_eq, coe_one, id_eq, imp_true_iff]
170+
one_mem' := by simp
172171
mul_mem' hσ hτ := by
173172
simp only [Subtype.forall, Set.mem_setOf_eq, coe_mul, Function.comp_apply]
174173
simp only [Subtype.forall, Set.mem_setOf_eq] at hσ hτ
@@ -177,9 +176,8 @@ def range_toPermHom' : Subgroup (Perm g.cycleFactorsFinset) where
177176
inv_mem' hσ := by
178177
simp only [Subtype.forall, Set.mem_setOf_eq] at hσ ⊢
179178
intro c hc
180-
rw [← hσ]
181-
· simp only [Finset.coe_mem, Subtype.coe_eta, apply_inv_self]
182-
· simp only [Finset.coe_mem]
179+
rw [← hσ _ (by simp)]
180+
simp
183181

184182
variable {g} in
185183
theorem mem_range_toPermHom'_iff {τ : Perm g.cycleFactorsFinset} :

Mathlib/GroupTheory/Perm/Cycle/Basic.lean

Lines changed: 44 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm α) : f.SameCycle x
6161

6262
@[symm]
6363
theorem SameCycle.symm : SameCycle f x y → SameCycle f y x := fun ⟨i, hi⟩ =>
64-
⟨-i, by rw [zpow_neg, ← hi, inv_apply_self]⟩
64+
⟨-i, by simp [zpow_neg, ← hi]⟩
6565

6666
theorem sameCycle_comm : SameCycle f x y ↔ SameCycle f y x :=
6767
⟨SameCycle.symm, SameCycle.symm⟩
@@ -250,9 +250,8 @@ theorem isCycle_inv : IsCycle f⁻¹ ↔ IsCycle f :=
250250

251251
theorem IsCycle.conj : IsCycle f → IsCycle (g * f * g⁻¹) := by
252252
rintro ⟨x, hx, h⟩
253-
refine ⟨g x, by simp [coe_mul, inv_apply_self, hx], fun y hy => ?_⟩
254-
rw [← apply_inv_self g y]
255-
exact (h <| eq_inv_iff_eq.not.2 hy).conj
253+
refine ⟨g x, by simp [coe_mul, hx], fun y hy => ?_⟩
254+
simpa using (h <| eq_inv_iff_eq.not.2 hy).conj (g := g)
256255

257256
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
258257
IsCycle g → IsCycle (g.extendDomain f) := by
@@ -366,48 +365,38 @@ theorem isCycle_swap_mul_aux₁ {α : Type*} [DecidableEq α] :
366365
| zero => exact fun _ h => ⟨0, h⟩
367366
| succ n hn =>
368367
intro b x f hb h
369-
exact if hfbx : f x = b then0, hfbx⟩
370-
else
371-
have : f b ≠ b ∧ b ≠ x := ne_and_ne_of_swap_mul_apply_ne_self hb
372-
have hb' : (swap x (f x) * f) (f⁻¹ b) ≠ f⁻¹ b := by
373-
rw [mul_apply, apply_inv_self, swap_apply_of_ne_of_ne this.2 (Ne.symm hfbx), Ne, ←
374-
f.injective.eq_iff, apply_inv_self]
375-
exact this.1
376-
let ⟨i, hi⟩ := hn hb' (f.injective <| by
377-
rw [apply_inv_self]; rwa [pow_succ', mul_apply] at h)
378-
⟨i + 1, by
379-
rw [add_comm, zpow_add, mul_apply, hi, zpow_one, mul_apply, apply_inv_self,
380-
swap_apply_of_ne_of_ne (ne_and_ne_of_swap_mul_apply_ne_self hb).2 (Ne.symm hfbx)]⟩
368+
obtain hfbx | hfbx := eq_or_ne (f x) b
369+
· exact ⟨0, hfbx⟩
370+
have : f b ≠ b ∧ b ≠ x := ne_and_ne_of_swap_mul_apply_ne_self hb
371+
have hb' : (swap x (f x) * f) (f.symm b) ≠ f.symm b := by
372+
simpa [swap_apply_of_ne_of_ne this.2 hfbx.symm, eq_symm_apply] using this.1
373+
obtain ⟨i, hi⟩ := hn hb' <| f.injective <| by simpa [pow_succ'] using h
374+
refine ⟨i + 1, ?_⟩
375+
rw [add_comm, zpow_add, mul_apply, hi, zpow_one, mul_apply, apply_symm_apply,
376+
swap_apply_of_ne_of_ne (ne_and_ne_of_swap_mul_apply_ne_self hb).2 hfbx.symm]
381377

382378
theorem isCycle_swap_mul_aux₂ {α : Type*} [DecidableEq α] :
383-
∀ (n : ℤ) {b x : α} {f : Perm α} (_ : (swap x (f x) * f) b ≠ b) (_ : (f ^ n) (f x) = b),
384-
∃ i : ℤ, ((swap x (f x) * f) ^ i) (f x) = b := by
385-
intro n
386-
cases n with
387-
| ofNat n => exact isCycle_swap_mul_aux₁ n
388-
| negSucc n =>
389-
intro b x f hb h
390-
exact if hfbx' : f x = b then0, hfbx'⟩
391-
else
392-
have : f b ≠ b ∧ b ≠ x := ne_and_ne_of_swap_mul_apply_ne_self hb
393-
have hb : (swap x (f⁻¹ x) * f⁻¹) (f⁻¹ b) ≠ f⁻¹ b := by
394-
rw [mul_apply, swap_apply_def]
395-
split_ifs <;>
396-
simp only [inv_eq_iff_eq, Perm.mul_apply, zpow_negSucc, Ne, Perm.apply_inv_self] at *
397-
<;> tauto
398-
let ⟨i, hi⟩ :=
399-
isCycle_swap_mul_aux₁ n hb
400-
(show (f⁻¹ ^ n) (f⁻¹ x) = f⁻¹ b by
401-
rw [← zpow_natCast, ← h, ← mul_apply, ← mul_apply, ← mul_apply, zpow_negSucc,
402-
← inv_pow, pow_succ, mul_assoc, mul_assoc, inv_mul_cancel, mul_one, zpow_natCast,
403-
← pow_succ', ← pow_succ])
404-
have h : (swap x (f⁻¹ x) * f⁻¹) (f x) = f⁻¹ x := by
405-
rw [mul_apply, inv_apply_self, swap_apply_left]
406-
⟨-i, by
407-
rw [← add_sub_cancel_right i 1, neg_sub, sub_eq_add_neg, zpow_add, zpow_one, zpow_neg,
408-
← inv_zpow, mul_inv_rev, swap_inv, mul_swap_eq_swap_mul, inv_apply_self, swap_comm _ x,
409-
zpow_add, zpow_one, mul_apply, mul_apply (_ ^ i), h, hi, mul_apply, apply_inv_self,
410-
swap_apply_of_ne_of_ne this.2 (Ne.symm hfbx')]⟩
379+
∀ (n : ℤ) {b x : α} {f : Perm α}, (swap x (f x) * f) b ≠ b → (f ^ n) (f x) = b →
380+
∃ i : ℤ, ((swap x (f x) * f) ^ i) (f x) = b
381+
| (n : ℕ), _, _, _, hb, h => isCycle_swap_mul_aux₁ n hb h
382+
| .negSucc n, b, x, f, hb, h => by
383+
obtain hfxb | hfxb := eq_or_ne (f x) b
384+
· exact ⟨0, hfxb⟩
385+
obtain ⟨hfb, hbx⟩ : f b ≠ b ∧ b ≠ x := ne_and_ne_of_swap_mul_apply_ne_self hb
386+
replace hb : (swap x (f.symm x) * f⁻¹) (f.symm b) ≠ f.symm b := by
387+
rw [mul_apply, swap_apply_def]
388+
split_ifs <;> simp [symm_apply_eq, eq_symm_apply] at * <;> tauto
389+
obtain ⟨i, hi⟩ := isCycle_swap_mul_aux₁ n hb <| by
390+
rw [← mul_apply, ← pow_succ]; simpa [pow_succ', eq_symm_apply] using h
391+
refine ⟨-i, (swap x (f⁻¹ x) * f⁻¹).injective ?_⟩
392+
convert hi using 1
393+
· rw [zpow_neg, ← inv_zpow, ← mul_apply, mul_inv_rev, swap_inv, mul_swap_eq_swap_mul]
394+
simp [swap_comm _ x, ← mul_apply, -coe_mul, ← inv_def, ← inv_def, mul_assoc _ f⁻¹,
395+
← mul_zpow_mul, mul_assoc _ _ f]
396+
simp
397+
· refine swap_apply_of_ne_of_ne ?_ ?_
398+
· simpa [eq_comm, Perm.eq_inv_iff_eq, Perm.inv_eq_iff_eq] using hfxb
399+
· simpa [eq_comm, eq_symm_apply, symm_apply_eq]
411400

412401
theorem IsCycle.eq_swap_of_apply_apply_eq_self {α : Type*} [DecidableEq α] {f : Perm α}
413402
(hf : IsCycle f) {x : α} (hfx : f x ≠ x) (hffx : f (f x) = x) : f = swap x (f x) :=
@@ -429,15 +418,11 @@ theorem IsCycle.eq_swap_of_apply_apply_eq_self {α : Type*} [DecidableEq α] {f
429418
tauto
430419

431420
theorem IsCycle.swap_mul {α : Type*} [DecidableEq α] {f : Perm α} (hf : IsCycle f) {x : α}
432-
(hx : f x ≠ x) (hffx : f (f x) ≠ x) : IsCycle (swap x (f x) * f) :=
433-
⟨f x, by simp [swap_apply_def, mul_apply, if_neg hffx, f.injective.eq_iff, hx],
434-
fun y hy =>
435-
let ⟨i, hi⟩ := hf.exists_zpow_eq hx (ne_and_ne_of_swap_mul_apply_ne_self hy).1
436-
have hi : (f ^ (i - 1)) (f x) = y :=
437-
calc
438-
(f ^ (i - 1) : Perm α) (f x) = (f ^ (i - 1) * f ^ (1 : ℤ) : Perm α) x := by simp
439-
_ = y := by rwa [← zpow_add, sub_add_cancel]
440-
isCycle_swap_mul_aux₂ (i - 1) hy hi⟩
421+
(hx : f x ≠ x) (hffx : f (f x) ≠ x) : IsCycle (swap x (f x) * f) := by
422+
refine ⟨f x, ?_, fun y hy ↦ ?_⟩
423+
· simp [swap_apply_def, mul_apply, if_neg hffx, f.injective.eq_iff, hx]
424+
obtain ⟨i, rfl⟩ := hf.exists_zpow_eq hx (ne_and_ne_of_swap_mul_apply_ne_self hy).1
425+
exact isCycle_swap_mul_aux₂ (i - 1) hy (by simp [← mul_apply, -coe_mul, ← zpow_add_one])
441426

442427
theorem IsCycle.sign {f : Perm α} (hf : IsCycle f) : sign f = -(-1) ^ #f.support :=
443428
let ⟨x, hx⟩ := hf
@@ -609,7 +594,7 @@ theorem IsCycle.pow_eq_pow_iff [Finite β] {f : Perm β} (hf : IsCycle f) {a b :
609594
rw [hf.pow_eq_one_iff]
610595
by_cases hfa : (f ^ a) x ∈ f.support
611596
· refine ⟨(f ^ a) x, mem_support.mp hfa, ?_⟩
612-
simp only [pow_sub _ hab, Equiv.Perm.coe_mul, Function.comp_apply, inv_apply_self, ← hx']
597+
simp [pow_sub _ hab, ← hx']
613598
· have h := @Equiv.Perm.zpow_apply_comm _ f 1 a x
614599
simp only [zpow_one, zpow_natCast] at h
615600
rw [notMem_support, h, Function.Injective.eq_iff (f ^ a).injective] at hfa
@@ -660,12 +645,8 @@ theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
660645
IsConj σ τ ↔ #σ.support = #τ.support where
661646
mp h := by
662647
obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
663-
refine Finset.card_bij (fun a _ => π a) (fun _ ha => ?_) (fun _ _ _ _ ab => π.injective ab)
664-
fun b hb ↦ ⟨π⁻¹ b, ?_, π.apply_inv_self b⟩
665-
· simp [mem_support.1 ha]
666-
contrapose! hb
667-
rw [mem_support, Classical.not_not] at hb
668-
rw [mem_support, Classical.not_not, Perm.mul_apply, Perm.mul_apply, hb, Perm.apply_inv_self]
648+
exact Finset.card_bij (fun a _ => π a) (fun _ ha => by simpa using ha)
649+
(fun _ _ _ _ ab => π.injective ab) fun b hb ↦ ⟨π⁻¹ b, by simpa using hb, π.apply_symm_apply b⟩
669650
mpr := hσ.isConj hτ
670651

671652
end Conjugation
@@ -705,8 +686,8 @@ alias ⟨IsCycleOn.of_inv, IsCycleOn.inv⟩ := isCycleOn_inv
705686

706687
theorem IsCycleOn.conj (h : f.IsCycleOn s) : (g * f * g⁻¹).IsCycleOn ((g : Perm α) '' s) :=
707688
⟨(g.bijOn_image.comp h.1).comp g.bijOn_symm_image, fun x hx y hy => by
708-
rw [← preimage_inv] at hx hy
709-
convert Equiv.Perm.SameCycle.conj (h.2 hx hy) (g := g) <;> rw [apply_inv_self]
689+
rw [Equiv.image_eq_preimage_symm] at hx hy
690+
convert Equiv.Perm.SameCycle.conj (h.2 hx hy) (g := g) <;> simp
710691

711692
theorem isCycleOn_swap [DecidableEq α] (hab : a ≠ b) : (swap a b).IsCycleOn {a, b} :=
712693
⟨bijOn_swap (by simp) (by simp), fun x hx y hy => by
@@ -738,9 +719,7 @@ theorem isCycle_iff_exists_isCycleOn :
738719
exact ⟨a, hf.apply_ne hs ha, fun b hb => hf.2 ha <| hsf hb⟩
739720

740721
theorem IsCycleOn.apply_mem_iff (hf : f.IsCycleOn s) : f x ∈ s ↔ x ∈ s :=
741-
fun hx => by
742-
convert hf.1.perm_inv.1 hx
743-
rw [inv_apply_self], fun hx => hf.1.mapsTo hx⟩
722+
fun hx => by simpa using hf.1.perm_inv.1 hx, fun hx => hf.1.mapsTo hx⟩
744723

745724
/-- Note that the identity satisfies `IsCycleOn` for any subsingleton set, but not `IsCycle`. -/
746725
theorem IsCycleOn.isCycle_subtypePerm (hf : f.IsCycleOn s) (hs : s.Nontrivial) :

Mathlib/GroupTheory/Perm/Cycle/Factors.lean

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -397,30 +397,20 @@ where
397397
⟨cycleOf f x :: m, by
398398
obtain ⟨hm₁, hm₂, hm₃⟩ := hm
399399
rw [hfg hx] at hm₁ ⊢
400-
constructor
401-
· rw [List.prod_cons, hm₁]
402-
simp
403-
· exact
404-
fun g' hg' =>
405-
((List.mem_cons).1 hg').elim (fun hg' => hg'.symm ▸ isCycle_cycleOf _ hx) (hm₂ g'),
406-
List.pairwise_cons.2
407-
fun g' hg' y =>
408-
or_iff_not_imp_left.2 fun hgy =>
409-
have hxy : SameCycle g x y :=
410-
Classical.not_not.1 (mt cycleOf_apply_of_not_sameCycle hgy)
411-
have hg'm : (g' :: m.erase g') ~ m :=
412-
List.cons_perm_iff_perm_erase.2 ⟨hg', List.Perm.refl _⟩
413-
have : ∀ h ∈ m.erase g', Disjoint g' h :=
414-
(List.pairwise_cons.1 ((hg'm.pairwise_iff Disjoint.symm).2 hm₃)).1
415-
by_cases id fun hg'y : g' y ≠ y =>
416-
(disjoint_prod_right _ this y).resolve_right <| by
417-
have hsc : SameCycle g⁻¹ x (g y) := by
418-
rwa [sameCycle_inv, sameCycle_apply_right]
419-
rw [disjoint_prod_perm hm₃ hg'm.symm, List.prod_cons,
420-
← eq_inv_mul_iff_mul_eq] at hm₁
421-
rwa [hm₁, mul_apply, mul_apply, cycleOf_inv, hsc.cycleOf_apply,
422-
inv_apply_self, inv_eq_iff_eq, eq_comm],
423-
hm₃⟩⟩⟩
400+
rw [List.pairwise_cons]
401+
refine ⟨?_, fun g' hg' ↦ ?_, fun g' hg' y ↦ ?_, hm₃⟩
402+
· simp [List.prod_cons, hm₁]
403+
· exact ((List.mem_cons).1 hg').elim (fun hg' => hg'.symm ▸ isCycle_cycleOf _ hx) (hm₂ g')
404+
by_contra!
405+
obtain ⟨hgy, hg'y⟩ := this
406+
have hxy : SameCycle g x y := not_imp_comm.1 cycleOf_apply_of_not_sameCycle hgy
407+
have hg'm : g' :: m.erase g' ~ m := List.cons_perm_iff_perm_erase.2 ⟨hg', .refl _⟩
408+
have : ∀ h ∈ m.erase g', Disjoint g' h :=
409+
(List.pairwise_cons.1 ((hg'm.pairwise_iff Disjoint.symm).2 hm₃)).1
410+
refine hg'y <| (disjoint_prod_right _ this y).resolve_right ?_
411+
have hsc : SameCycle g⁻¹ x (g y) := by rwa [sameCycle_inv, sameCycle_apply_right]
412+
rw [disjoint_prod_perm hm₃ hg'm.symm, List.prod_cons, ← eq_inv_mul_iff_mul_eq] at hm₁
413+
simpa [hm₁, cycleOf_inv, hsc.cycleOf_apply, Perm.eq_inv_iff_eq, eq_comm] using hg'y⟩
424414

425415
theorem mem_list_cycles_iff {α : Type*} [Finite α] {l : List (Perm α)}
426416
(h1 : ∀ σ : Perm α, σ ∈ l → σ.IsCycle) (h2 : l.Pairwise Disjoint) {σ : Perm α} :
@@ -691,9 +681,8 @@ theorem disjoint_mul_inv_of_mem_cycleFactorsFinset {f g : Perm α} (h : f ∈ cy
691681
intro x
692682
by_cases hx : f x = x
693683
· exact Or.inr hx
694-
· refine Or.inl ?_
695-
rw [mul_apply, ← h.right, apply_inv_self]
696-
rwa [← support_inv, apply_mem_support, support_inv, mem_support]
684+
rw [mul_apply, ← h.right _ (by simpa [Perm.eq_inv_iff_eq])]
685+
simp
697686

698687
/-- If c is a cycle, a ∈ c.support and c is a cycle of f, then `c = f.cycleOf a` -/
699688
theorem cycle_is_cycleOf {f c : Equiv.Perm α} {a : α} (ha : a ∈ c.support)
@@ -749,11 +738,7 @@ theorem mem_cycleFactorsFinset_conj (g k c : Perm α) :
749738
intro hc a ha
750739
simp only [coe_mul, Function.comp_apply, EmbeddingLike.apply_eq_iff_eq]
751740
apply hc
752-
rw [mem_support] at ha ⊢
753-
contrapose! ha
754-
simp only [mul_smul, ← Perm.smul_def] at ha ⊢
755-
rw [ha]
756-
simp only [Perm.smul_def, apply_inv_self]
741+
simpa [inv_def, eq_symm_apply] using ha
757742

758743
/-- If a permutation commutes with every cycle of `g`, then it commutes with `g`
759744

0 commit comments

Comments
 (0)