l3lab/ntp-mathlib huggingface dataset:
theorem IsCycle.conj : IsCycle f → IsCycle (g * f * g⁻¹) := by
  rintro ⟨x, hx, h⟩
  refine' ⟨g x, by simp [coe_mul, inv_apply_self, hx], fun y hy => _⟩
  rw [← apply_inv_self g y]
  

Proof state:
case intro.intro
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x✝ y✝ x : α
hx : f x ≠ x
h : ∀ ⦃y : α⦄, f y ≠ y → SameCycle f x y
y : α
hy : (g * f * g⁻¹) y ≠ y
⊢ SameCycle (g * f * g⁻¹) (g x) (g (g⁻¹ y))

Next tactic:
exact (h <| eq_inv_iff_eq.not.2 hy).conj
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
⊢ IsCycle g → IsCycle (extendDomain g f)

Next tactic:
rintro ⟨a, ha, ha'⟩
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  

Proof state:
case intro.intro
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
⊢ IsCycle (extendDomain g f)

Next tactic:
refine' ⟨f a, _, fun b hb => _⟩
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  refine' ⟨f a, _, fun b hb => _⟩
  · 

Proof state:
case intro.intro.refine'_1
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
⊢ (extendDomain g f) ↑(f a) ≠ ↑(f a)

Next tactic:
rw [extendDomain_apply_image]
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  refine' ⟨f a, _, fun b hb => _⟩
  · rw [extendDomain_apply_image]
    

Proof state:
case intro.intro.refine'_1
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
⊢ ↑(f (g a)) ≠ ↑(f a)

Next tactic:
exact Subtype.coe_injective.ne (f.injective.ne ha)
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  refine' ⟨f a, _, fun b hb => _⟩
  · rw [extendDomain_apply_image]
    exact Subtype.coe_injective.ne (f.injective.ne ha)
  

Proof state:
case intro.intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
b : β
hb : (extendDomain g f) b ≠ b
⊢ SameCycle (extendDomain g f) (↑(f a)) b

Next tactic:
have h : b = f (f.symm ⟨b, of_not_not <| hb ∘ extendDomain_apply_not_subtype _ _⟩) := by
    rw [apply_symm_apply, Subtype.coe_mk]
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  refine' ⟨f a, _, fun b hb => _⟩
  · rw [extendDomain_apply_image]
    exact Subtype.coe_injective.ne (f.injective.ne ha)
  have h : b = f (f.symm ⟨b, of_not_not <| hb ∘ extendDomain_apply_not_subtype _ _⟩) := by
    

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
b : β
hb : (extendDomain g f) b ≠ b
⊢ b = ↑(f (f.symm { val := b, property := (_ : p b) }))

Next tactic:
rw [apply_symm_apply, Subtype.coe_mk]
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  refine' ⟨f a, _, fun b hb => _⟩
  · rw [extendDomain_apply_image]
    exact Subtype.coe_injective.ne (f.injective.ne ha)
  have h : b = f (f.symm ⟨b, of_not_not <| hb ∘ extendDomain_apply_not_subtype _ _⟩) := by
    rw [apply_symm_apply, Subtype.coe_mk]
  

Proof state:
case intro.intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
b : β
hb : (extendDomain g f) b ≠ b
h : b = ↑(f (f.symm { val := b, property := (_ : p b) }))
⊢ SameCycle (extendDomain g f) (↑(f a)) b

Next tactic:
rw [h] at hb ⊢
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  refine' ⟨f a, _, fun b hb => _⟩
  · rw [extendDomain_apply_image]
    exact Subtype.coe_injective.ne (f.injective.ne ha)
  have h : b = f (f.symm ⟨b, of_not_not <| hb ∘ extendDomain_apply_not_subtype _ _⟩) := by
    rw [apply_symm_apply, Subtype.coe_mk]
  rw [h] at hb ⊢
  

Proof state:
case intro.intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
b : β
hb✝ : (extendDomain g f) b ≠ b
hb :
  (extendDomain g f) ↑(f (f.symm { val := b, property := (_ : p b) })) ≠
    ↑(f (f.symm { val := b, property := (_ : p b) }))
h : b = ↑(f (f.symm { val := b, property := (_ : p b) }))
⊢ SameCycle (extendDomain g f) ↑(f a) ↑(f (f.symm { val := b, property := (_ : p b) }))

Next tactic:
simp only [extendDomain_apply_image, Subtype.coe_injective.ne_iff, f.injective.ne_iff] at hb
protected theorem IsCycle.extendDomain {p : β → Prop} [DecidablePred p] (f : α ≃ Subtype p) :
    IsCycle g → IsCycle (g.extendDomain f) := by
  rintro ⟨a, ha, ha'⟩
  refine' ⟨f a, _, fun b hb => _⟩
  · rw [extendDomain_apply_image]
    exact Subtype.coe_injective.ne (f.injective.ne ha)
  have h : b = f (f.symm ⟨b, of_not_not <| hb ∘ extendDomain_apply_not_subtype _ _⟩) := by
    rw [apply_symm_apply, Subtype.coe_mk]
  rw [h] at hb ⊢
  simp only [extendDomain_apply_image, Subtype.coe_injective.ne_iff, f.injective.ne_iff] at hb
  

Proof state:
case intro.intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
f✝ g : Perm α
x y : α
p : β → Prop
inst✝ : DecidablePred p
f : α ≃ Subtype p
a : α
ha : g a ≠ a
ha' : ∀ ⦃y : α⦄, g y ≠ y → SameCycle g a y
b : β
hb✝ : (extendDomain g f) b ≠ b
h : b = ↑(f (f.symm { val := b, property := (_ : p b) }))
hb : g (f.symm { val := b, property := (_ : p b) }) ≠ f.symm { val := b, property := (_ : p b) }
⊢ SameCycle (extendDomain g f) ↑(f a) ↑(f (f.symm { val := b, property := (_ : p b) }))

Next tactic:
exact (ha' hb).extendDomain
theorem isCycle_iff_sameCycle (hx : f x ≠ x) : IsCycle f ↔ ∀ {y}, SameCycle f x y ↔ f y ≠ y :=
  ⟨fun hf y =>
    ⟨fun ⟨i, hi⟩ hy =>
      hx <| by
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y✝ : α
hx : f x ≠ x
hf : IsCycle f
y : α
x✝ : SameCycle f x y
hy : f y = y
i : ℤ
hi : (f ^ i) x = y
⊢ f x = x

Next tactic:
rw [← zpow_apply_eq_self_of_apply_eq_self hy i, (f ^ i).injective.eq_iff] at hi
theorem isCycle_iff_sameCycle (hx : f x ≠ x) : IsCycle f ↔ ∀ {y}, SameCycle f x y ↔ f y ≠ y :=
  ⟨fun hf y =>
    ⟨fun ⟨i, hi⟩ hy =>
      hx <| by
        rw [← zpow_apply_eq_self_of_apply_eq_self hy i, (f ^ i).injective.eq_iff] at hi
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y✝ : α
hx : f x ≠ x
hf : IsCycle f
y : α
x✝ : SameCycle f x y
hy : f y = y
i : ℤ
hi : x = y
⊢ f x = x

Next tactic:
rw [hi, hy]
theorem IsCycle.exists_pow_eq (hf : IsCycle f) (hx : f x ≠ x) (hy : f y ≠ y) :
    ∃ i : ℕ, (f ^ i) x = y := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : Finite α
hf : IsCycle f
hx : f x ≠ x
hy : f y ≠ y
⊢ ∃ i, (f ^ i) x = y

Next tactic:
let ⟨n, hn⟩ := hf.exists_zpow_eq hx hy
theorem IsCycle.exists_pow_eq (hf : IsCycle f) (hx : f x ≠ x) (hy : f y ≠ y) :
    ∃ i : ℕ, (f ^ i) x = y := by
  let ⟨n, hn⟩ := hf.exists_zpow_eq hx hy
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : Finite α
hf : IsCycle f
hx : f x ≠ x
hy : f y ≠ y
n : ℤ
hn : (f ^ n) x = y
⊢ ∃ i, (f ^ i) x = y

Next tactic:
classical exact
      ⟨(n % orderOf f).toNat, by
        {have := n.emod_nonneg (Int.coe_nat_ne_zero.mpr (ne_of_gt (orderOf_pos f)))
         rwa [← zpow_ofNat, Int.toNat_of_nonneg this, zpow_mod_orderOf]}⟩
theorem IsCycle.exists_pow_eq (hf : IsCycle f) (hx : f x ≠ x) (hy : f y ≠ y) :
    ∃ i : ℕ, (f ^ i) x = y := by
  let ⟨n, hn⟩ := hf.exists_zpow_eq hx hy
  classical 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : Finite α
hf : IsCycle f
hx : f x ≠ x
hy : f y ≠ y
n : ℤ
hn : (f ^ n) x = y
⊢ ∃ i, (f ^ i) x = y

Next tactic:
exact
      ⟨(n % orderOf f).toNat, by
        {have := n.emod_nonneg (Int.coe_nat_ne_zero.mpr (ne_of_gt (orderOf_pos f)))
         rwa [← zpow_ofNat, Int.toNat_of_nonneg this, zpow_mod_orderOf]}⟩
theorem IsCycle.exists_pow_eq (hf : IsCycle f) (hx : f x ≠ x) (hy : f y ≠ y) :
    ∃ i : ℕ, (f ^ i) x = y := by
  let ⟨n, hn⟩ := hf.exists_zpow_eq hx hy
  classical exact
      ⟨(n % orderOf f).toNat, by
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : Finite α
hf : IsCycle f
hx : f x ≠ x
hy : f y ≠ y
n : ℤ
hn : (f ^ n) x = y
⊢ (f ^ Int.toNat (n % ↑(orderOf f))) x = y

Next tactic:
{have := n.emod_nonneg (Int.coe_nat_ne_zero.mpr (ne_of_gt (orderOf_pos f)))
         rwa [← zpow_ofNat, Int.toNat_of_nonneg this, zpow_mod_orderOf]}
theorem IsCycle.exists_pow_eq (hf : IsCycle f) (hx : f x ≠ x) (hy : f y ≠ y) :
    ∃ i : ℕ, (f ^ i) x = y := by
  let ⟨n, hn⟩ := hf.exists_zpow_eq hx hy
  classical exact
      ⟨(n % orderOf f).toNat, by
        {

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : Finite α
hf : IsCycle f
hx : f x ≠ x
hy : f y ≠ y
n : ℤ
hn : (f ^ n) x = y
⊢ (f ^ Int.toNat (n % ↑(orderOf f))) x = y

Next tactic:
have := n.emod_nonneg (Int.coe_nat_ne_zero.mpr (ne_of_gt (orderOf_pos f)))
theorem IsCycle.exists_pow_eq (hf : IsCycle f) (hx : f x ≠ x) (hy : f y ≠ y) :
    ∃ i : ℕ, (f ^ i) x = y := by
  let ⟨n, hn⟩ := hf.exists_zpow_eq hx hy
  classical exact
      ⟨(n % orderOf f).toNat, by
        {have := n.emod_nonneg (Int.coe_nat_ne_zero.mpr (ne_of_gt (orderOf_pos f)))
         

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : Finite α
hf : IsCycle f
hx : f x ≠ x
hy : f y ≠ y
n : ℤ
hn : (f ^ n) x = y
this : 0 ≤ n % ↑(orderOf f)
⊢ (f ^ Int.toNat (n % ↑(orderOf f))) x = y

Next tactic:
rwa [← zpow_ofNat, Int.toNat_of_nonneg this, zpow_mod_orderOf]
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
⊢ (swap x y) y ≠ y

Next tactic:
rwa [swap_apply_right]
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
ha : (if a = x then y else if a = y then x else a) ≠ a
hya : ¬y = a
⊢ (swap x y ^ 1) y = a

Next tactic:
rw [zpow_one, swap_apply_def]
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
ha : (if a = x then y else if a = y then x else a) ≠ a
hya : ¬y = a
⊢ (if y = x then y else if y = y then x else y) = a

Next tactic:
split_ifs at *
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝¹ : y = x
h✝ : a = x
ha : y ≠ a
⊢ y = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝² : y = x
h✝¹ : ¬a = x
h✝ : a = y
ha : x ≠ a
⊢ y = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝² : y = x
h✝¹ : ¬a = x
h✝ : ¬a = y
ha : a ≠ a
⊢ y = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝² : ¬y = x
h✝¹ : y = y
h✝ : a = x
ha : y ≠ a
⊢ x = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝³ : ¬y = x
h✝² : y = y
h✝¹ : ¬a = x
h✝ : a = y
ha : x ≠ a
⊢ x = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝³ : ¬y = x
h✝² : y = y
h✝¹ : ¬a = x
h✝ : ¬a = y
ha : a ≠ a
⊢ x = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝² : ¬y = x
h✝¹ : ¬y = y
h✝ : a = x
ha : y ≠ a
⊢ y = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝³ : ¬y = x
h✝² : ¬y = y
h✝¹ : ¬a = x
h✝ : a = y
ha : x ≠ a
⊢ y = a

Next tactic:
tauto
theorem isCycle_swap (hxy : x ≠ y) : IsCycle (swap x y) :=
  ⟨y, by rwa [swap_apply_right], fun a (ha : ite (a = x) y (ite (a = y) x a) ≠ a) =>
    if hya : y = a then ⟨0, hya⟩
    else
      ⟨1, by
        rw [zpow_one, swap_apply_def]
        split_ifs at * <;> 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
hxy : x ≠ y
a : α
hya : ¬y = a
h✝³ : ¬y = x
h✝² : ¬y = y
h✝¹ : ¬a = x
h✝ : ¬a = y
ha : a ≠ a
⊢ y = a

Next tactic:
tauto
protected theorem IsSwap.isCycle : IsSwap f → IsCycle f := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝ : DecidableEq α
⊢ IsSwap f → IsCycle f

Next tactic:
rintro ⟨x, y, hxy, rfl⟩
protected theorem IsSwap.isCycle : IsSwap f → IsCycle f := by
  rintro ⟨x, y, hxy, rfl⟩
  

Proof state:
case intro.intro.intro
ι : Type u_1
α : Type u_2
β : Type u_3
g : Perm α
x✝ y✝ : α
inst✝ : DecidableEq α
x y : α
hxy : x ≠ y
⊢ IsCycle (swap x y)

Next tactic:
exact isCycle_swap hxy
/-- The subgroup generated by a cycle is in bijection with its support -/
noncomputable def IsCycle.zpowersEquivSupport {σ : Perm α} (hσ : IsCycle σ) :
    (Subgroup.zpowers σ) ≃ σ.support :=
  Equiv.ofBijective
    (fun (τ : ↥ ((Subgroup.zpowers σ) : Set (Perm α))) =>
      ⟨(τ : Perm α) (Classical.choose hσ), by
        

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
τ : ↑↑(Subgroup.zpowers σ)
⊢ ↑τ (Classical.choose hσ) ∈ support σ

Next tactic:
obtain ⟨τ, n, rfl⟩ := τ
/-- The subgroup generated by a cycle is in bijection with its support -/
noncomputable def IsCycle.zpowersEquivSupport {σ : Perm α} (hσ : IsCycle σ) :
    (Subgroup.zpowers σ) ≃ σ.support :=
  Equiv.ofBijective
    (fun (τ : ↥ ((Subgroup.zpowers σ) : Set (Perm α))) =>
      ⟨(τ : Perm α) (Classical.choose hσ), by
        obtain ⟨τ, n, rfl⟩ := τ
        

Proof state:
case mk.intro
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
n : ℤ
⊢ ↑{ val := (fun x => σ ^ x) n, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) n) } (Classical.choose hσ) ∈
    support σ

Next tactic:
erw [Finset.mem_coe, Subtype.coe_mk, zpow_apply_mem_support, mem_support]
/-- The subgroup generated by a cycle is in bijection with its support -/
noncomputable def IsCycle.zpowersEquivSupport {σ : Perm α} (hσ : IsCycle σ) :
    (Subgroup.zpowers σ) ≃ σ.support :=
  Equiv.ofBijective
    (fun (τ : ↥ ((Subgroup.zpowers σ) : Set (Perm α))) =>
      ⟨(τ : Perm α) (Classical.choose hσ), by
        obtain ⟨τ, n, rfl⟩ := τ
        erw [Finset.mem_coe, Subtype.coe_mk, zpow_apply_mem_support, mem_support]
        

Proof state:
case mk.intro
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
n : ℤ
⊢ σ (Classical.choose hσ) ≠ Classical.choose hσ

Next tactic:
exact (Classical.choose_spec hσ).1
/-- The subgroup generated by a cycle is in bijection with its support -/
noncomputable def IsCycle.zpowersEquivSupport {σ : Perm α} (hσ : IsCycle σ) :
    (Subgroup.zpowers σ) ≃ σ.support :=
  Equiv.ofBijective
    (fun (τ : ↥ ((Subgroup.zpowers σ) : Set (Perm α))) =>
      ⟨(τ : Perm α) (Classical.choose hσ), by
        obtain ⟨τ, n, rfl⟩ := τ
        erw [Finset.mem_coe, Subtype.coe_mk, zpow_apply_mem_support, mem_support]
        exact (Classical.choose_spec hσ).1⟩)
    (by
      

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
⊢ Bijective fun τ => { val := ↑τ (Classical.choose hσ), property := (_ : ↑τ (Classical.choose hσ) ∈ support σ) }

Next tactic:
constructor
/-- The subgroup generated by a cycle is in bijection with its support -/
noncomputable def IsCycle.zpowersEquivSupport {σ : Perm α} (hσ : IsCycle σ) :
    (Subgroup.zpowers σ) ≃ σ.support :=
  Equiv.ofBijective
    (fun (τ : ↥ ((Subgroup.zpowers σ) : Set (Perm α))) =>
      ⟨(τ : Perm α) (Classical.choose hσ), by
        obtain ⟨τ, n, rfl⟩ := τ
        erw [Finset.mem_coe, Subtype.coe_mk, zpow_apply_mem_support, mem_support]
        exact (Classical.choose_spec hσ).1⟩)
    (by
      constructor
      · 

Proof state:
case left
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
⊢ Injective fun τ => { val := ↑τ (Classical.choose hσ), property := (_ : ↑τ (Classical.choose hσ) ∈ support σ) }

Next tactic:
rintro ⟨a, m, rfl⟩ ⟨b, n, rfl⟩ h
/-- The subgroup generated by a cycle is in bijection with its support -/
noncomputable def IsCycle.zpowersEquivSupport {σ : Perm α} (hσ : IsCycle σ) :
    (Subgroup.zpowers σ) ≃ σ.support :=
  Equiv.ofBijective
    (fun (τ : ↥ ((Subgroup.zpowers σ) : Set (Perm α))) =>
      ⟨(τ : Perm α) (Classical.choose hσ), by
        obtain ⟨τ, n, rfl⟩ := τ
        erw [Finset.mem_coe, Subtype.coe_mk, zpow_apply_mem_support, mem_support]
        exact (Classical.choose_spec hσ).1⟩)
    (by
      constructor
      · rintro ⟨a, m, rfl⟩ ⟨b, n, rfl⟩ h
        

Proof state:
case left.mk.intro.mk.intro
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y : α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
m n : ℤ
h :
  (fun τ => { val := ↑τ (Classical.choose hσ), property := (_ : ↑τ (Classical.choose hσ) ∈ support σ) })
      { val := (fun x => σ ^ x) m, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) m) } =
    (fun τ => { val := ↑τ (Classical.choose hσ), property := (_ : ↑τ (Classical.choose hσ) ∈ support σ) })
      { val := (fun x => σ ^ x) n, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) n) }
⊢ { val := (fun x => σ ^ x) m, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) m) } =
    { val := (fun x => σ ^ x) n, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) n) }

Next tactic:
ext y
/-- The subgroup generated by a cycle is in bijection with its support -/
noncomputable def IsCycle.zpowersEquivSupport {σ : Perm α} (hσ : IsCycle σ) :
    (Subgroup.zpowers σ) ≃ σ.support :=
  Equiv.ofBijective
    (fun (τ : ↥ ((Subgroup.zpowers σ) : Set (Perm α))) =>
      ⟨(τ : Perm α) (Classical.choose hσ), by
        obtain ⟨τ, n, rfl⟩ := τ
        erw [Finset.mem_coe, Subtype.coe_mk, zpow_apply_mem_support, mem_support]
        exact (Classical.choose_spec hσ).1⟩)
    (by
      constructor
      · rintro ⟨a, m, rfl⟩ ⟨b, n, rfl⟩ h
        ext y
        

Proof state:
case left.mk.intro.mk.intro.a.H
ι : Type u_1
α : Type u_2
β : Type u_3
f g : Perm α
x y✝ : α
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
m n : ℤ
h :
  (fun τ => { val := ↑τ (Classical.choose hσ), property := (_ : ↑τ (Classical.choose hσ) ∈ support σ) })
      { val := (fun x => σ ^ x) m, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) m) } =
    (fun τ => { val := ↑τ (Classical.choose hσ), property := (_ : ↑τ (Classical.choose hσ) ∈ support σ) })
      { val := (fun x => σ ^ x) n, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) n) }
y : α
⊢ ↑{ val := (fun x => σ ^ x) m, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) m) } y =
    ↑{ val := (fun x => σ ^ x) n, property := (_ : ∃ y, (fun x => σ ^ x) y = (fun x => σ ^ x) n) } y

Next tactic:
by_cases hy : σ y = y