l3lab/ntp-mathlib huggingface dataset:
theorem closure_prime_cycle_swap {σ τ : Perm α} (h0 : (Fintype.card α).Prime) (h1 : IsCycle σ)
    (h2 : σ.support = Finset.univ) (h3 : IsSwap τ) : closure ({σ, τ} : Set (Perm α)) = ⊤ := by
  obtain ⟨x, y, h4, h5⟩ := h3
  obtain ⟨i, hi⟩ :=
    h1.exists_pow_eq (mem_support.mp ((Finset.ext_iff.mp h2 x).mpr (Finset.mem_univ x)))
      (mem_support.mp ((Finset.ext_iff.mp h2 y).mpr (Finset.mem_univ y)))
  rw [h5, ← hi]
  refine'
    closure_cycle_coprime_swap (Nat.Coprime.symm (h0.coprime_iff_not_dvd.mpr fun h => h4 _)) h1 h2 x
  cases' h with m hm
  

Proof state:
case intro.intro.intro.intro.intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : DecidableEq α
inst✝¹ : Finite β
inst✝ : Fintype α
σ τ : Perm α
h0 : Nat.Prime (Fintype.card α)
h1 : IsCycle σ
h2 : support σ = univ
x y : α
h4 : x ≠ y
h5 : τ = swap x y
i : ℕ
hi : (σ ^ i) x = y
m : ℕ
hm : i = Fintype.card α * m
⊢ x = y

Next tactic:
rwa [hm, pow_mul, ← Finset.card_univ, ← h2, ← h1.orderOf, pow_orderOf_eq_one, one_pow,
    one_apply] at hi
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
⊢ IsConj σ τ

Next tactic:
refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
⊢ extendSubtype f * σ * (extendSubtype f)⁻¹ = τ

Next tactic:
rw [mul_inv_eq_iff_eq_mul]
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
  rw [mul_inv_eq_iff_eq_mul]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
⊢ extendSubtype f * σ = τ * extendSubtype f

Next tactic:
ext x
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
  rw [mul_inv_eq_iff_eq_mul]
  ext x
  

Proof state:
case H
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
x : α
⊢ (extendSubtype f * σ) x = (τ * extendSubtype f) x

Next tactic:
simp only [Perm.mul_apply]
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
  rw [mul_inv_eq_iff_eq_mul]
  ext x
  simp only [Perm.mul_apply]
  

Proof state:
case H
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
x : α
⊢ (extendSubtype f) (σ x) = τ ((extendSubtype f) x)

Next tactic:
by_cases hx : x ∈ σ.support
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
  rw [mul_inv_eq_iff_eq_mul]
  ext x
  simp only [Perm.mul_apply]
  by_cases hx : x ∈ σ.support
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
x : α
hx : x ∈ support σ
⊢ (extendSubtype f) (σ x) = τ ((extendSubtype f) x)

Next tactic:
rw [Equiv.extendSubtype_apply_of_mem, Equiv.extendSubtype_apply_of_mem]
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
  rw [mul_inv_eq_iff_eq_mul]
  ext x
  simp only [Perm.mul_apply]
  by_cases hx : x ∈ σ.support
  · rw [Equiv.extendSubtype_apply_of_mem, Equiv.extendSubtype_apply_of_mem]
    · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
x : α
hx : x ∈ support σ
⊢ ↑(f { val := σ x, property := ?pos.hx✝ }) = τ ↑(f { val := x, property := ?pos.hx✝ })

Next tactic:
exact hf x (Finset.mem_coe.2 hx)
theorem isConj_of_support_equiv
    (f : { x // x ∈ (σ.support : Set α) } ≃ { x // x ∈ (τ.support : Set α) })
    (hf :
      ∀ (x : α) (hx : x ∈ (σ.support : Set α)),
        (f ⟨σ x, apply_mem_support.2 hx⟩ : α) = τ ↑(f ⟨x, hx⟩)) :
    IsConj σ τ := by
  refine' isConj_iff.2 ⟨Equiv.extendSubtype f, _⟩
  rw [mul_inv_eq_iff_eq_mul]
  ext x
  simp only [Perm.mul_apply]
  by_cases hx : x ∈ σ.support
  · rw [Equiv.extendSubtype_apply_of_mem, Equiv.extendSubtype_apply_of_mem]
    · exact hf x (Finset.mem_coe.2 hx)
  · 

Proof state:
case neg
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
f : { x // x ∈ ↑(support σ) } ≃ { x // x ∈ ↑(support τ) }
hf :
  ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(f { val := σ x, property := (_ : σ x ∈ support σ) }) = τ ↑(f { val := x, property := hx })
x : α
hx : x ∉ support σ
⊢ (extendSubtype f) (σ x) = τ ((extendSubtype f) x)

Next tactic:
rwa [Classical.not_not.1 ((not_congr mem_support).1 (Equiv.extendSubtype_not_mem f _ _)),
      Classical.not_not.1 ((not_congr mem_support).mp hx)]
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
⊢ IsConj σ τ

Next tactic:
refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
⊢ orderOf σ = orderOf τ

Next tactic:
rw [hσ.orderOf, h, hτ.orderOf]
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
⊢ ∀ (x : α) (hx : x ∈ ↑(support σ)),
    ↑(((zpowersEquivSupport hσ).symm.trans
            ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ)).trans (zpowersEquivSupport hτ)))
          { val := σ x, property := (_ : σ x ∈ support σ) }) =
      τ
        ↑(((zpowersEquivSupport hσ).symm.trans
              ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ)).trans (zpowersEquivSupport hτ)))
            { val := x, property := hx })

Next tactic:
intro x hx
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  intro x hx
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
x : α
hx : x ∈ ↑(support σ)
⊢ ↑(((zpowersEquivSupport hσ).symm.trans
          ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ)).trans (zpowersEquivSupport hτ)))
        { val := σ x, property := (_ : σ x ∈ support σ) }) =
    τ
      ↑(((zpowersEquivSupport hσ).symm.trans
            ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ)).trans (zpowersEquivSupport hτ)))
          { val := x, property := hx })

Next tactic:
simp only [Perm.mul_apply, Equiv.trans_apply, Equiv.sumCongr_apply]
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  intro x hx
  simp only [Perm.mul_apply, Equiv.trans_apply, Equiv.sumCongr_apply]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
x : α
hx : x ∈ ↑(support σ)
⊢ ↑((zpowersEquivSupport hτ)
        ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
          ((zpowersEquivSupport hσ).symm { val := σ x, property := (_ : σ x ∈ support σ) }))) =
    τ
      ↑((zpowersEquivSupport hτ)
          ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
            ((zpowersEquivSupport hσ).symm { val := x, property := hx })))

Next tactic:
obtain ⟨n, rfl⟩ := hσ.exists_pow_eq (Classical.choose_spec hσ).1 (mem_support.1 hx)
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  intro x hx
  simp only [Perm.mul_apply, Equiv.trans_apply, Equiv.sumCongr_apply]
  obtain ⟨n, rfl⟩ := hσ.exists_pow_eq (Classical.choose_spec hσ).1 (mem_support.1 hx)
  

Proof state:
case intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
n : ℕ
hx : (σ ^ n) (Classical.choose hσ) ∈ ↑(support σ)
⊢ ↑((zpowersEquivSupport hτ)
        ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
          ((zpowersEquivSupport hσ).symm
            { val := σ ((σ ^ n) (Classical.choose hσ)),
              property := (_ : σ ((σ ^ n) (Classical.choose hσ)) ∈ support σ) }))) =
    τ
      ↑((zpowersEquivSupport hτ)
          ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
            ((zpowersEquivSupport hσ).symm { val := (σ ^ n) (Classical.choose hσ), property := hx })))

Next tactic:
apply
    Eq.trans _
      (congr rfl (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply n).symm))))
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  intro x hx
  simp only [Perm.mul_apply, Equiv.trans_apply, Equiv.sumCongr_apply]
  obtain ⟨n, rfl⟩ := hσ.exists_pow_eq (Classical.choose_spec hσ).1 (mem_support.1 hx)
  apply
    Eq.trans _
      (congr rfl (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply n).symm))))
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
n : ℕ
hx : (σ ^ n) (Classical.choose hσ) ∈ ↑(support σ)
⊢ ↑((zpowersEquivSupport hτ)
        ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
          ((zpowersEquivSupport hσ).symm
            { val := σ ((σ ^ n) (Classical.choose hσ)),
              property := (_ : σ ((σ ^ n) (Classical.choose hσ)) ∈ support σ) }))) =
    τ
      ↑((zpowersEquivSupport hτ)
          ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
            { val := σ ^ n, property := (_ : ∃ y, (fun x => σ ^ x) y = σ ^ n) }))

Next tactic:
apply (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply (n + 1))))).trans _
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  intro x hx
  simp only [Perm.mul_apply, Equiv.trans_apply, Equiv.sumCongr_apply]
  obtain ⟨n, rfl⟩ := hσ.exists_pow_eq (Classical.choose_spec hσ).1 (mem_support.1 hx)
  apply
    Eq.trans _
      (congr rfl (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply n).symm))))
  apply (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply (n + 1))))).trans _
  -- This used to be a `simp only` before leanprover/lean4#2644
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
n : ℕ
hx : (σ ^ n) (Classical.choose hσ) ∈ ↑(support σ)
⊢ ↑((zpowersEquivSupport hτ)
        ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
          { val := σ ^ (n + 1), property := (_ : ∃ y, (fun x => σ ^ x) y = σ ^ (n + 1)) })) =
    τ
      ↑((zpowersEquivSupport hτ)
          ((zpowersEquivZPowers (_ : orderOf σ = orderOf τ))
            { val := σ ^ n, property := (_ : ∃ y, (fun x => σ ^ x) y = σ ^ n) }))

Next tactic:
erw [zpowersEquivZPowers_apply, zpowersEquivZPowers_apply]
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  intro x hx
  simp only [Perm.mul_apply, Equiv.trans_apply, Equiv.sumCongr_apply]
  obtain ⟨n, rfl⟩ := hσ.exists_pow_eq (Classical.choose_spec hσ).1 (mem_support.1 hx)
  apply
    Eq.trans _
      (congr rfl (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply n).symm))))
  apply (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply (n + 1))))).trans _
  -- This used to be a `simp only` before leanprover/lean4#2644
  erw [zpowersEquivZPowers_apply, zpowersEquivZPowers_apply]
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
n : ℕ
hx : (σ ^ n) (Classical.choose hσ) ∈ ↑(support σ)
⊢ ↑((zpowersEquivSupport hτ) { val := τ ^ (n + 1), property := (_ : ∃ y, (fun x => τ ^ x) y = τ ^ (n + 1)) }) =
    τ ↑((zpowersEquivSupport hτ) { val := τ ^ n, property := (_ : ∃ y, (fun x => τ ^ x) y = τ ^ n) })

Next tactic:
dsimp
theorem IsCycle.isConj (hσ : IsCycle σ) (hτ : IsCycle τ) (h : σ.support.card = τ.support.card) :
    IsConj σ τ := by
  refine'
    isConj_of_support_equiv
      (hσ.zpowersEquivSupport.symm.trans <|
        (zpowersEquivZPowers <| by rw [hσ.orderOf, h, hτ.orderOf]).trans hτ.zpowersEquivSupport)
      _
  intro x hx
  simp only [Perm.mul_apply, Equiv.trans_apply, Equiv.sumCongr_apply]
  obtain ⟨n, rfl⟩ := hσ.exists_pow_eq (Classical.choose_spec hσ).1 (mem_support.1 hx)
  apply
    Eq.trans _
      (congr rfl (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply n).symm))))
  apply (congr rfl (congr rfl (congr rfl (hσ.zpowersEquivSupport_symm_apply (n + 1))))).trans _
  -- This used to be a `simp only` before leanprover/lean4#2644
  erw [zpowersEquivZPowers_apply, zpowersEquivZPowers_apply]
  dsimp
    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : card (support σ) = card (support τ)
n : ℕ
hx : (σ ^ n) (Classical.choose hσ) ∈ ↑(support σ)
⊢ (τ ^ (n + 1)) (Classical.choose hτ) = τ ((τ ^ n) (Classical.choose hτ))

Next tactic:
erw [pow_succ, Perm.mul_apply]
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
⊢ IsConj σ τ → card (support σ) = card (support τ)

Next tactic:
intro h
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    intro h
    

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
hσ : IsCycle σ
hτ : IsCycle τ
h : IsConj σ τ
⊢ card (support σ) = card (support τ)

Next tactic:
obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    intro h
    obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
    

Proof state:
case intro
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
π : Perm α
hτ : IsCycle (π * σ * π⁻¹)
h : IsConj σ (π * σ * π⁻¹)
⊢ card (support σ) = card (support (π * σ * π⁻¹))

Next tactic:
refine' Finset.card_congr (fun a _ => π a) (fun _ ha => _) (fun _ _ _ _ ab => π.injective ab)
        fun b hb => _
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    intro h
    obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
    refine' Finset.card_congr (fun a _ => π a) (fun _ ha => _) (fun _ _ _ _ ab => π.injective ab)
        fun b hb => _
    · 

Proof state:
case intro.refine'_1
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
π : Perm α
hτ : IsCycle (π * σ * π⁻¹)
h : IsConj σ (π * σ * π⁻¹)
x✝ : α
ha : x✝ ∈ support σ
⊢ (fun a x => π a) x✝ ha ∈ support (π * σ * π⁻¹)

Next tactic:
simp [mem_support.1 ha]
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    intro h
    obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
    refine' Finset.card_congr (fun a _ => π a) (fun _ ha => _) (fun _ _ _ _ ab => π.injective ab)
        fun b hb => _
    · simp [mem_support.1 ha]
    · 

Proof state:
case intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
π : Perm α
hτ : IsCycle (π * σ * π⁻¹)
h : IsConj σ (π * σ * π⁻¹)
b : α
hb : b ∈ support (π * σ * π⁻¹)
⊢ ∃ a, ∃ (ha : a ∈ support σ), (fun a x => π a) a ha = b

Next tactic:
refine' ⟨π⁻¹ b, ⟨_, π.apply_inv_self b⟩⟩
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    intro h
    obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
    refine' Finset.card_congr (fun a _ => π a) (fun _ ha => _) (fun _ _ _ _ ab => π.injective ab)
        fun b hb => _
    · simp [mem_support.1 ha]
    · refine' ⟨π⁻¹ b, ⟨_, π.apply_inv_self b⟩⟩
      

Proof state:
case intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
π : Perm α
hτ : IsCycle (π * σ * π⁻¹)
h : IsConj σ (π * σ * π⁻¹)
b : α
hb : b ∈ support (π * σ * π⁻¹)
⊢ π⁻¹ b ∈ support σ

Next tactic:
contrapose! hb
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    intro h
    obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
    refine' Finset.card_congr (fun a _ => π a) (fun _ ha => _) (fun _ _ _ _ ab => π.injective ab)
        fun b hb => _
    · simp [mem_support.1 ha]
    · refine' ⟨π⁻¹ b, ⟨_, π.apply_inv_self b⟩⟩
      contrapose! hb
      

Proof state:
case intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
π : Perm α
hτ : IsCycle (π * σ * π⁻¹)
h : IsConj σ (π * σ * π⁻¹)
b : α
hb : π⁻¹ b ∉ support σ
⊢ b ∉ support (π * σ * π⁻¹)

Next tactic:
rw [mem_support, Classical.not_not] at hb
theorem IsCycle.isConj_iff (hσ : IsCycle σ) (hτ : IsCycle τ) :
    IsConj σ τ ↔ σ.support.card = τ.support.card :=
  ⟨by
    intro h
    obtain ⟨π, rfl⟩ := (_root_.isConj_iff).1 h
    refine' Finset.card_congr (fun a _ => π a) (fun _ ha => _) (fun _ _ _ _ ab => π.injective ab)
        fun b hb => _
    · simp [mem_support.1 ha]
    · refine' ⟨π⁻¹ b, ⟨_, π.apply_inv_self b⟩⟩
      contrapose! hb
      rw [mem_support, Classical.not_not] at hb
      

Proof state:
case intro.refine'_2
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ : Perm α
hσ : IsCycle σ
π : Perm α
hτ : IsCycle (π * σ * π⁻¹)
h : IsConj σ (π * σ * π⁻¹)
b : α
hb : σ (π⁻¹ b) = π⁻¹ b
⊢ b ∉ support (π * σ * π⁻¹)

Next tactic:
rw [mem_support, Classical.not_not, Perm.mul_apply, Perm.mul_apply, hb, Perm.apply_inv_self]
@[simp]
theorem support_conj : (σ * τ * σ⁻¹).support = τ.support.map σ.toEmbedding := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
⊢ support (σ * τ * σ⁻¹) = map (Equiv.toEmbedding σ) (support τ)

Next tactic:
ext
@[simp]
theorem support_conj : (σ * τ * σ⁻¹).support = τ.support.map σ.toEmbedding := by
  ext
  

Proof state:
case a
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
a✝ : α
⊢ a✝ ∈ support (σ * τ * σ⁻¹) ↔ a✝ ∈ map (Equiv.toEmbedding σ) (support τ)

Next tactic:
simp only [mem_map_equiv, Perm.coe_mul, Function.comp_apply, Ne.def, Perm.mem_support,
    Equiv.eq_symm_apply]
@[simp]
theorem support_conj : (σ * τ * σ⁻¹).support = τ.support.map σ.toEmbedding := by
  ext
  simp only [mem_map_equiv, Perm.coe_mul, Function.comp_apply, Ne.def, Perm.mem_support,
    Equiv.eq_symm_apply]
  

Proof state:
case a
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
a✝ : α
⊢ ¬σ (τ (σ⁻¹ a✝)) = a✝ ↔ ¬σ (τ (σ.symm a✝)) = a✝

Next tactic:
rfl
theorem card_support_conj : (σ * τ * σ⁻¹).support.card = τ.support.card := by 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝¹ : DecidableEq α
inst✝ : Fintype α
σ τ : Perm α
⊢ card (support (σ * τ * σ⁻¹)) = card (support τ)

Next tactic:
simp