l3lab/ntp-mathlib huggingface dataset:
theorem cycleOf_mul_of_apply_right_eq_self (h : Commute f g) (x : α) (hx : g x = x) :
    (f * g).cycleOf x = f.cycleOf x := by
  ext y
  by_cases hxy : (f * g).SameCycle x y
  · obtain ⟨z, rfl⟩ := hxy
    rw [cycleOf_apply_apply_zpow_self]
    simp [h.mul_zpow, zpow_apply_eq_self_of_apply_eq_self hx]
  · rw [cycleOf_apply_of_not_sameCycle hxy, cycleOf_apply_of_not_sameCycle]
    

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x✝ y✝ : α
h : Commute f g
x : α
hx : g x = x
y : α
hxy : ¬SameCycle (f * g) x y
⊢ ¬SameCycle f x y

Next tactic:
contrapose! hxy
theorem cycleOf_mul_of_apply_right_eq_self (h : Commute f g) (x : α) (hx : g x = x) :
    (f * g).cycleOf x = f.cycleOf x := by
  ext y
  by_cases hxy : (f * g).SameCycle x y
  · obtain ⟨z, rfl⟩ := hxy
    rw [cycleOf_apply_apply_zpow_self]
    simp [h.mul_zpow, zpow_apply_eq_self_of_apply_eq_self hx]
  · rw [cycleOf_apply_of_not_sameCycle hxy, cycleOf_apply_of_not_sameCycle]
    contrapose! hxy
    

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x✝ y✝ : α
h : Commute f g
x : α
hx : g x = x
y : α
hxy : SameCycle f x y
⊢ SameCycle (f * g) x y

Next tactic:
obtain ⟨z, rfl⟩ := hxy
theorem cycleOf_mul_of_apply_right_eq_self (h : Commute f g) (x : α) (hx : g x = x) :
    (f * g).cycleOf x = f.cycleOf x := by
  ext y
  by_cases hxy : (f * g).SameCycle x y
  · obtain ⟨z, rfl⟩ := hxy
    rw [cycleOf_apply_apply_zpow_self]
    simp [h.mul_zpow, zpow_apply_eq_self_of_apply_eq_self hx]
  · rw [cycleOf_apply_of_not_sameCycle hxy, cycleOf_apply_of_not_sameCycle]
    contrapose! hxy
    obtain ⟨z, rfl⟩ := hxy
    

Proof state:
case neg.intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x✝ y : α
h : Commute f g
x : α
hx : g x = x
z : ℤ
⊢ SameCycle (f * g) x ((f ^ z) x)

Next tactic:
refine' ⟨z, _⟩
theorem cycleOf_mul_of_apply_right_eq_self (h : Commute f g) (x : α) (hx : g x = x) :
    (f * g).cycleOf x = f.cycleOf x := by
  ext y
  by_cases hxy : (f * g).SameCycle x y
  · obtain ⟨z, rfl⟩ := hxy
    rw [cycleOf_apply_apply_zpow_self]
    simp [h.mul_zpow, zpow_apply_eq_self_of_apply_eq_self hx]
  · rw [cycleOf_apply_of_not_sameCycle hxy, cycleOf_apply_of_not_sameCycle]
    contrapose! hxy
    obtain ⟨z, rfl⟩ := hxy
    refine' ⟨z, _⟩
    

Proof state:
case neg.intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x✝ y : α
h : Commute f g
x : α
hx : g x = x
z : ℤ
⊢ ((f * g) ^ z) x = (f ^ z) x

Next tactic:
simp [h.mul_zpow, zpow_apply_eq_self_of_apply_eq_self hx]
theorem Disjoint.cycleOf_mul_distrib (h : f.Disjoint g) (x : α) :
    (f * g).cycleOf x = f.cycleOf x * g.cycleOf x := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x✝ y : α
h : Disjoint f g
x : α
⊢ cycleOf (f * g) x = cycleOf f x * cycleOf g x

Next tactic:
cases' (disjoint_iff_eq_or_eq.mp h) x with hfx hgx
theorem Disjoint.cycleOf_mul_distrib (h : f.Disjoint g) (x : α) :
    (f * g).cycleOf x = f.cycleOf x * g.cycleOf x := by
  cases' (disjoint_iff_eq_or_eq.mp h) x with hfx hgx
  · 

Proof state:
case inl
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x✝ y : α
h : Disjoint f g
x : α
hfx : f x = x
⊢ cycleOf (f * g) x = cycleOf f x * cycleOf g x

Next tactic:
simp [h.commute.eq, cycleOf_mul_of_apply_right_eq_self h.symm.commute, hfx]
theorem Disjoint.cycleOf_mul_distrib (h : f.Disjoint g) (x : α) :
    (f * g).cycleOf x = f.cycleOf x * g.cycleOf x := by
  cases' (disjoint_iff_eq_or_eq.mp h) x with hfx hgx
  · simp [h.commute.eq, cycleOf_mul_of_apply_right_eq_self h.symm.commute, hfx]
  · 

Proof state:
case inr
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x✝ y : α
h : Disjoint f g
x : α
hgx : g x = x
⊢ cycleOf (f * g) x = cycleOf f x * cycleOf g x

Next tactic:
simp [cycleOf_mul_of_apply_right_eq_self h.commute, hgx]
theorem support_cycleOf_eq_nil_iff : (f.cycleOf x).support = ∅ ↔ x ∉ f.support := by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
⊢ support (cycleOf f x) = ∅ ↔ x ∉ support f

Next tactic:
simp
theorem support_cycleOf_le (f : Perm α) (x : α) : support (f.cycleOf x) ≤ support f := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y : α
f : Perm α
x : α
⊢ support (cycleOf f x) ≤ support f

Next tactic:
intro y hy
theorem support_cycleOf_le (f : Perm α) (x : α) : support (f.cycleOf x) ≤ support f := by
  intro y hy
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y✝ : α
f : Perm α
x y : α
hy : y ∈ support (cycleOf f x)
⊢ y ∈ support f

Next tactic:
rw [mem_support, cycleOf_apply] at hy
theorem support_cycleOf_le (f : Perm α) (x : α) : support (f.cycleOf x) ≤ support f := by
  intro y hy
  rw [mem_support, cycleOf_apply] at hy
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y✝ : α
f : Perm α
x y : α
hy : (if SameCycle f x y then f y else y) ≠ y
⊢ y ∈ support f

Next tactic:
split_ifs at hy
theorem support_cycleOf_le (f : Perm α) (x : α) : support (f.cycleOf x) ≤ support f := by
  intro y hy
  rw [mem_support, cycleOf_apply] at hy
  split_ifs at hy
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y✝ : α
f : Perm α
x y : α
h✝ : SameCycle f x y
hy : f y ≠ y
⊢ y ∈ support f

Next tactic:
exact mem_support.mpr hy
theorem support_cycleOf_le (f : Perm α) (x : α) : support (f.cycleOf x) ≤ support f := by
  intro y hy
  rw [mem_support, cycleOf_apply] at hy
  split_ifs at hy
  · exact mem_support.mpr hy
  · 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y✝ : α
f : Perm α
x y : α
h✝ : ¬SameCycle f x y
hy : y ≠ y
⊢ y ∈ support f

Next tactic:
exact absurd rfl hy
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
⊢ y ∈ support (cycleOf f x) ↔ SameCycle f x y ∧ x ∈ support f

Next tactic:
by_cases hx : f x = x
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : f x = x
⊢ y ∈ support (cycleOf f x) ↔ SameCycle f x y ∧ x ∈ support f

Next tactic:
rw [(cycleOf_eq_one_iff _).mpr hx]
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : f x = x
⊢ y ∈ support 1 ↔ SameCycle f x y ∧ x ∈ support f

Next tactic:
simp [hx]
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    simp [hx]
  · 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : ¬f x = x
⊢ y ∈ support (cycleOf f x) ↔ SameCycle f x y ∧ x ∈ support f

Next tactic:
rw [mem_support, cycleOf_apply]
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    simp [hx]
  · rw [mem_support, cycleOf_apply]
    

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : ¬f x = x
⊢ (if SameCycle f x y then f y else y) ≠ y ↔ SameCycle f x y ∧ x ∈ support f

Next tactic:
split_ifs with hy
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    simp [hx]
  · rw [mem_support, cycleOf_apply]
    split_ifs with hy
    · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : ¬f x = x
hy : SameCycle f x y
⊢ f y ≠ y ↔ SameCycle f x y ∧ x ∈ support f

Next tactic:
simp only [hx, hy, iff_true_iff, Ne.def, not_false_iff, and_self_iff, mem_support]
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    simp [hx]
  · rw [mem_support, cycleOf_apply]
    split_ifs with hy
    · simp only [hx, hy, iff_true_iff, Ne.def, not_false_iff, and_self_iff, mem_support]
      

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : ¬f x = x
hy : SameCycle f x y
⊢ ¬f y = y

Next tactic:
rcases hy with ⟨k, rfl⟩
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    simp [hx]
  · rw [mem_support, cycleOf_apply]
    split_ifs with hy
    · simp only [hx, hy, iff_true_iff, Ne.def, not_false_iff, and_self_iff, mem_support]
      rcases hy with ⟨k, rfl⟩
      

Proof state:
case pos.intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x : α
hx : ¬f x = x
k : ℤ
⊢ ¬f ((f ^ k) x) = (f ^ k) x

Next tactic:
rw [← not_mem_support]
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    simp [hx]
  · rw [mem_support, cycleOf_apply]
    split_ifs with hy
    · simp only [hx, hy, iff_true_iff, Ne.def, not_false_iff, and_self_iff, mem_support]
      rcases hy with ⟨k, rfl⟩
      rw [← not_mem_support]
      

Proof state:
case pos.intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x : α
hx : ¬f x = x
k : ℤ
⊢ ¬(f ^ k) x ∉ support f

Next tactic:
simpa using hx
theorem mem_support_cycleOf_iff : y ∈ support (f.cycleOf x) ↔ SameCycle f x y ∧ x ∈ support f := by
  by_cases hx : f x = x
  · rw [(cycleOf_eq_one_iff _).mpr hx]
    simp [hx]
  · rw [mem_support, cycleOf_apply]
    split_ifs with hy
    · simp only [hx, hy, iff_true_iff, Ne.def, not_false_iff, and_self_iff, mem_support]
      rcases hy with ⟨k, rfl⟩
      rw [← not_mem_support]
      simpa using hx
    · 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : ¬f x = x
hy : ¬SameCycle f x y
⊢ y ≠ y ↔ SameCycle f x y ∧ x ∈ support f

Next tactic:
simpa [hx] using hy
theorem mem_support_cycleOf_iff' (hx : f x ≠ x) : y ∈ support (f.cycleOf x) ↔ SameCycle f x y := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hx : f x ≠ x
⊢ y ∈ support (cycleOf f x) ↔ SameCycle f x y

Next tactic:
rw [mem_support_cycleOf_iff, and_iff_left (mem_support.2 hx)]
theorem pow_mod_card_support_cycleOf_self_apply (f : Perm α) (n : ℕ) (x : α) :
    (f ^ (n % (f.cycleOf x).support.card)) x = (f ^ n) x := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y : α
f : Perm α
n : ℕ
x : α
⊢ (f ^ (n % card (support (cycleOf f x)))) x = (f ^ n) x

Next tactic:
by_cases hx : f x = x
theorem pow_mod_card_support_cycleOf_self_apply (f : Perm α) (n : ℕ) (x : α) :
    (f ^ (n % (f.cycleOf x).support.card)) x = (f ^ n) x := by
  by_cases hx : f x = x
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y : α
f : Perm α
n : ℕ
x : α
hx : f x = x
⊢ (f ^ (n % card (support (cycleOf f x)))) x = (f ^ n) x

Next tactic:
rw [pow_apply_eq_self_of_apply_eq_self hx, pow_apply_eq_self_of_apply_eq_self hx]
theorem pow_mod_card_support_cycleOf_self_apply (f : Perm α) (n : ℕ) (x : α) :
    (f ^ (n % (f.cycleOf x).support.card)) x = (f ^ n) x := by
  by_cases hx : f x = x
  · rw [pow_apply_eq_self_of_apply_eq_self hx, pow_apply_eq_self_of_apply_eq_self hx]
  · 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y : α
f : Perm α
n : ℕ
x : α
hx : ¬f x = x
⊢ (f ^ (n % card (support (cycleOf f x)))) x = (f ^ n) x

Next tactic:
rw [← cycleOf_pow_apply_self, ← cycleOf_pow_apply_self f, ← (isCycle_cycleOf f hx).orderOf,
      pow_mod_orderOf]
/-- `x` is in the support of `f` iff `Equiv.Perm.cycle_of f x` is a cycle. -/
theorem isCycle_cycleOf_iff (f : Perm α) : IsCycle (cycleOf f x) ↔ f x ≠ x := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
⊢ IsCycle (cycleOf f x) ↔ f x ≠ x

Next tactic:
refine' ⟨fun hx => _, f.isCycle_cycleOf⟩
/-- `x` is in the support of `f` iff `Equiv.Perm.cycle_of f x` is a cycle. -/
theorem isCycle_cycleOf_iff (f : Perm α) : IsCycle (cycleOf f x) ↔ f x ≠ x := by
  refine' ⟨fun hx => _, f.isCycle_cycleOf⟩
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
hx : IsCycle (cycleOf f x)
⊢ f x ≠ x

Next tactic:
rw [Ne.def, ← cycleOf_eq_one_iff f]
/-- `x` is in the support of `f` iff `Equiv.Perm.cycle_of f x` is a cycle. -/
theorem isCycle_cycleOf_iff (f : Perm α) : IsCycle (cycleOf f x) ↔ f x ≠ x := by
  refine' ⟨fun hx => _, f.isCycle_cycleOf⟩
  rw [Ne.def, ← cycleOf_eq_one_iff f]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
hx : IsCycle (cycleOf f x)
⊢ ¬cycleOf f x = 1

Next tactic:
exact hx.ne_one
theorem isCycleOn_support_cycleOf (f : Perm α) (x : α) : f.IsCycleOn (f.cycleOf x).support :=
  ⟨f.bijOn <| by
    

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y : α
f : Perm α
x : α
⊢ ∀ (a : α), f a ∈ ↑(support (cycleOf f x)) ↔ a ∈ ↑(support (cycleOf f x))

Next tactic:
refine fun _ ↦ ⟨fun h ↦ mem_support_cycleOf_iff.2 ?_, fun h ↦ mem_support_cycleOf_iff.2 ?_⟩
theorem isCycleOn_support_cycleOf (f : Perm α) (x : α) : f.IsCycleOn (f.cycleOf x).support :=
  ⟨f.bijOn <| by
    refine fun _ ↦ ⟨fun h ↦ mem_support_cycleOf_iff.2 ?_, fun h ↦ mem_support_cycleOf_iff.2 ?_⟩
    · 

Proof state:
case refine_1
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝¹ y : α
f : Perm α
x x✝ : α
h : f x✝ ∈ ↑(support (cycleOf f x))
⊢ SameCycle f x x✝ ∧ x ∈ support f

Next tactic:
exact ⟨sameCycle_apply_right.1 (mem_support_cycleOf_iff.1 h).1,
      (mem_support_cycleOf_iff.1 h).2⟩
theorem isCycleOn_support_cycleOf (f : Perm α) (x : α) : f.IsCycleOn (f.cycleOf x).support :=
  ⟨f.bijOn <| by
    refine fun _ ↦ ⟨fun h ↦ mem_support_cycleOf_iff.2 ?_, fun h ↦ mem_support_cycleOf_iff.2 ?_⟩
    · exact ⟨sameCycle_apply_right.1 (mem_support_cycleOf_iff.1 h).1,
      (mem_support_cycleOf_iff.1 h).2⟩
    · 

Proof state:
case refine_2
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝¹ y : α
f : Perm α
x x✝ : α
h : x✝ ∈ ↑(support (cycleOf f x))
⊢ SameCycle f x (f x✝) ∧ x ∈ support f

Next tactic:
exact ⟨sameCycle_apply_right.2 (mem_support_cycleOf_iff.1 h).1,
      (mem_support_cycleOf_iff.1 h).2⟩
theorem isCycleOn_support_cycleOf (f : Perm α) (x : α) : f.IsCycleOn (f.cycleOf x).support :=
  ⟨f.bijOn <| by
    refine fun _ ↦ ⟨fun h ↦ mem_support_cycleOf_iff.2 ?_, fun h ↦ mem_support_cycleOf_iff.2 ?_⟩
    · exact ⟨sameCycle_apply_right.1 (mem_support_cycleOf_iff.1 h).1,
      (mem_support_cycleOf_iff.1 h).2⟩
    · exact ⟨sameCycle_apply_right.2 (mem_support_cycleOf_iff.1 h).1,
      (mem_support_cycleOf_iff.1 h).2⟩
    , fun a ha b hb =>
      by
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y : α
f : Perm α
x a : α
ha : a ∈ ↑(support (cycleOf f x))
b : α
hb : b ∈ ↑(support (cycleOf f x))
⊢ SameCycle f a b

Next tactic:
rw [mem_coe, mem_support_cycleOf_iff] at ha hb
theorem isCycleOn_support_cycleOf (f : Perm α) (x : α) : f.IsCycleOn (f.cycleOf x).support :=
  ⟨f.bijOn <| by
    refine fun _ ↦ ⟨fun h ↦ mem_support_cycleOf_iff.2 ?_, fun h ↦ mem_support_cycleOf_iff.2 ?_⟩
    · exact ⟨sameCycle_apply_right.1 (mem_support_cycleOf_iff.1 h).1,
      (mem_support_cycleOf_iff.1 h).2⟩
    · exact ⟨sameCycle_apply_right.2 (mem_support_cycleOf_iff.1 h).1,
      (mem_support_cycleOf_iff.1 h).2⟩
    , fun a ha b hb =>
      by
        rw [mem_coe, mem_support_cycleOf_iff] at ha hb
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x✝ y : α
f : Perm α
x a : α
ha : SameCycle f x a ∧ x ∈ support f
b : α
hb : SameCycle f x b ∧ x ∈ support f
⊢ SameCycle f a b

Next tactic:
exact ha.1.symm.trans hb.1
theorem SameCycle.exists_pow_eq_of_mem_support (h : SameCycle f x y) (hx : x ∈ f.support) :
    ∃ i < (f.cycleOf x).support.card, (f ^ i) x = y := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
h : SameCycle f x y
hx : x ∈ support f
⊢ ∃ i < card (support (cycleOf f x)), (f ^ i) x = y

Next tactic:
rw [mem_support] at hx
theorem SameCycle.exists_pow_eq_of_mem_support (h : SameCycle f x y) (hx : x ∈ f.support) :
    ∃ i < (f.cycleOf x).support.card, (f ^ i) x = y := by
  rw [mem_support] at hx
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
h : SameCycle f x y
hx : f x ≠ x
⊢ ∃ i < card (support (cycleOf f x)), (f ^ i) x = y

Next tactic:
exact Equiv.Perm.IsCycleOn.exists_pow_eq (b := y) (f.isCycleOn_support_cycleOf x)
    (by rw [mem_support_cycleOf_iff' hx]) (by rwa [mem_support_cycleOf_iff' hx])
theorem SameCycle.exists_pow_eq_of_mem_support (h : SameCycle f x y) (hx : x ∈ f.support) :
    ∃ i < (f.cycleOf x).support.card, (f ^ i) x = y := by
  rw [mem_support] at hx
  exact Equiv.Perm.IsCycleOn.exists_pow_eq (b := y) (f.isCycleOn_support_cycleOf x)
    (by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
h : SameCycle f x y
hx : f x ≠ x
⊢ x ∈ support (cycleOf f x)

Next tactic:
rw [mem_support_cycleOf_iff' hx]
theorem SameCycle.exists_pow_eq_of_mem_support (h : SameCycle f x y) (hx : x ∈ f.support) :
    ∃ i < (f.cycleOf x).support.card, (f ^ i) x = y := by
  rw [mem_support] at hx
  exact Equiv.Perm.IsCycleOn.exists_pow_eq (b := y) (f.isCycleOn_support_cycleOf x)
    (by rw [mem_support_cycleOf_iff' hx]) (by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
h : SameCycle f x y
hx : f x ≠ x
⊢ y ∈ support (cycleOf f x)

Next tactic:
rwa [mem_support_cycleOf_iff' hx]
theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
    ∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
h : SameCycle f x y
⊢ ∃ i, 0 < i ∧ i ≤ card (support (cycleOf f x)) + 1 ∧ (f ^ i) x = y

Next tactic:
by_cases hx : x ∈ f.support
theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
    ∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
  by_cases hx : x ∈ f.support
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
h : SameCycle f x y
hx : x ∈ support f
⊢ ∃ i, 0 < i ∧ i ≤ card (support (cycleOf f x)) + 1 ∧ (f ^ i) x = y

Next tactic:
obtain ⟨k, hk, hk'⟩ := h.exists_pow_eq_of_mem_support hx
theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
    ∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
  by_cases hx : x ∈ f.support
  · obtain ⟨k, hk, hk'⟩ := h.exists_pow_eq_of_mem_support hx
    

Proof state:
case pos.intro.intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
h : SameCycle f x y
hx : x ∈ support f
k : ℕ
hk : k < card (support (cycleOf f x))
hk' : (f ^ k) x = y
⊢ ∃ i, 0 < i ∧ i ≤ card (support (cycleOf f x)) + 1 ∧ (f ^ i) x = y

Next tactic:
cases' k with k
theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
    ∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
  by_cases hx : x ∈ f.support
  · obtain ⟨k, hk, hk'⟩ := h.exists_pow_eq_of_mem_support hx
    cases' k with k
    · 

Proof state:
case pos.intro.intro.zero
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
h : SameCycle f x y
hx : x ∈ support f
hk : Nat.zero < card (support (cycleOf f x))
hk' : (f ^ Nat.zero) x = y
⊢ ∃ i, 0 < i ∧ i ≤ card (support (cycleOf f x)) + 1 ∧ (f ^ i) x = y

Next tactic:
refine' ⟨(f.cycleOf x).support.card, _, self_le_add_right _ _, _⟩
theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
    ∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
  by_cases hx : x ∈ f.support
  · obtain ⟨k, hk, hk'⟩ := h.exists_pow_eq_of_mem_support hx
    cases' k with k
    · refine' ⟨(f.cycleOf x).support.card, _, self_le_add_right _ _, _⟩
      · 

Proof state:
case pos.intro.intro.zero.refine'_1
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
h : SameCycle f x y
hx : x ∈ support f
hk : Nat.zero < card (support (cycleOf f x))
hk' : (f ^ Nat.zero) x = y
⊢ 0 < card (support (cycleOf f x))

Next tactic:
refine' zero_lt_one.trans (one_lt_card_support_of_ne_one _)
theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
    ∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
  by_cases hx : x ∈ f.support
  · obtain ⟨k, hk, hk'⟩ := h.exists_pow_eq_of_mem_support hx
    cases' k with k
    · refine' ⟨(f.cycleOf x).support.card, _, self_le_add_right _ _, _⟩
      · refine' zero_lt_one.trans (one_lt_card_support_of_ne_one _)
        

Proof state:
case pos.intro.intro.zero.refine'_1
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
h : SameCycle f x y
hx : x ∈ support f
hk : Nat.zero < card (support (cycleOf f x))
hk' : (f ^ Nat.zero) x = y
⊢ cycleOf f x ≠ 1

Next tactic:
simpa using hx
theorem SameCycle.exists_pow_eq (f : Perm α) (h : SameCycle f x y) :
    ∃ i : ℕ, 0 < i ∧ i ≤ (f.cycleOf x).support.card + 1 ∧ (f ^ i) x = y := by
  by_cases hx : x ∈ f.support
  · obtain ⟨k, hk, hk'⟩ := h.exists_pow_eq_of_mem_support hx
    cases' k with k
    · refine' ⟨(f.cycleOf x).support.card, _, self_le_add_right _ _, _⟩
      · refine' zero_lt_one.trans (one_lt_card_support_of_ne_one _)
        simpa using hx
      · 

Proof state:
case pos.intro.intro.zero.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g : Perm α
x y : α
f : Perm α
h : SameCycle f x y
hx : x ∈ support f
hk : Nat.zero < card (support (cycleOf f x))
hk' : (f ^ Nat.zero) x = y
⊢ (f ^ card (support (cycleOf f x))) x = y

Next tactic:
simp only [Nat.zero_eq, pow_zero, coe_one, id_eq] at hk'