@@ -61,7 +61,7 @@ protected theorem _root_.Eq.sameCycle (h : x = y) (f : Perm α) : f.SameCycle x
6161
6262@[symm]
6363theorem 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
6666theorem 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
251251theorem 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
257256protected 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 then ⟨0 , 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
382378theorem 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 then ⟨0 , 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
412401theorem 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
431420theorem 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
442427theorem 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
671652end Conjugation
@@ -705,8 +686,8 @@ alias ⟨IsCycleOn.of_inv, IsCycleOn.inv⟩ := isCycleOn_inv
705686
706687theorem 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
711692theorem 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
740721theorem 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`. -/
746725theorem IsCycleOn.isCycle_subtypePerm (hf : f.IsCycleOn s) (hs : s.Nontrivial) :
0 commit comments