l3lab/ntp-mathlib huggingface dataset:
set_option linter.deprecated false in
theorem isCycle_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) : IsCycle (formPerm l) := by
  cases' l with x l
  · norm_num at hn
  induction' l with y l generalizing x
  · norm_num at hn
  · use x
    constructor
    · rwa [formPerm_apply_mem_ne_self_iff _ hl _ (mem_cons_self _ _)]
    · intro w hw
      have : w ∈ x::y::l := mem_of_formPerm_ne_self _ _ hw
      

Proof state:
case h.right
α : Type u_1
inst✝ : DecidableEq α
l' : List α
y : α
l : List α
tail_ih✝ : ∀ (x : α), Nodup (x :: l) → 2 ≤ length (x :: l) → IsCycle (formPerm (x :: l))
x : α
hl : Nodup (x :: y :: l)
hn : 2 ≤ length (x :: y :: l)
w : α
hw : (formPerm (x :: y :: l)) w ≠ w
this : w ∈ x :: y :: l
⊢ SameCycle (formPerm (x :: y :: l)) x w

Next tactic:
obtain ⟨k, hk, rfl⟩ := nthLe_of_mem this
set_option linter.deprecated false in
theorem isCycle_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) : IsCycle (formPerm l) := by
  cases' l with x l
  · norm_num at hn
  induction' l with y l generalizing x
  · norm_num at hn
  · use x
    constructor
    · rwa [formPerm_apply_mem_ne_self_iff _ hl _ (mem_cons_self _ _)]
    · intro w hw
      have : w ∈ x::y::l := mem_of_formPerm_ne_self _ _ hw
      obtain ⟨k, hk, rfl⟩ := nthLe_of_mem this
      

Proof state:
case h.right.intro.intro
α : Type u_1
inst✝ : DecidableEq α
l' : List α
y : α
l : List α
tail_ih✝ : ∀ (x : α), Nodup (x :: l) → 2 ≤ length (x :: l) → IsCycle (formPerm (x :: l))
x : α
hl : Nodup (x :: y :: l)
hn : 2 ≤ length (x :: y :: l)
k : ℕ
hk : k < length (x :: y :: l)
hw : (formPerm (x :: y :: l)) (nthLe (x :: y :: l) k hk) ≠ nthLe (x :: y :: l) k hk
this : nthLe (x :: y :: l) k hk ∈ x :: y :: l
⊢ SameCycle (formPerm (x :: y :: l)) x (nthLe (x :: y :: l) k hk)

Next tactic:
use k
set_option linter.deprecated false in
theorem isCycle_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) : IsCycle (formPerm l) := by
  cases' l with x l
  · norm_num at hn
  induction' l with y l generalizing x
  · norm_num at hn
  · use x
    constructor
    · rwa [formPerm_apply_mem_ne_self_iff _ hl _ (mem_cons_self _ _)]
    · intro w hw
      have : w ∈ x::y::l := mem_of_formPerm_ne_self _ _ hw
      obtain ⟨k, hk, rfl⟩ := nthLe_of_mem this
      use k
      

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
l' : List α
y : α
l : List α
tail_ih✝ : ∀ (x : α), Nodup (x :: l) → 2 ≤ length (x :: l) → IsCycle (formPerm (x :: l))
x : α
hl : Nodup (x :: y :: l)
hn : 2 ≤ length (x :: y :: l)
k : ℕ
hk : k < length (x :: y :: l)
hw : (formPerm (x :: y :: l)) (nthLe (x :: y :: l) k hk) ≠ nthLe (x :: y :: l) k hk
this : nthLe (x :: y :: l) k hk ∈ x :: y :: l
⊢ (formPerm (x :: y :: l) ^ ↑k) x = nthLe (x :: y :: l) k hk

Next tactic:
simp only [zpow_ofNat, formPerm_pow_apply_head _ _ hl k, Nat.mod_eq_of_lt hk]
theorem cycleOf_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) (x) :
    cycleOf l.attach.formPerm x = l.attach.formPerm :=
  have hn : 2 ≤ l.attach.length := by 

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup l
hn : 2 ≤ length l
x : { x // x ∈ l }
⊢ 2 ≤ length (attach l)

Next tactic:
rwa [← length_attach] at hn
theorem cycleOf_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) (x) :
    cycleOf l.attach.formPerm x = l.attach.formPerm :=
  have hn : 2 ≤ l.attach.length := by rwa [← length_attach] at hn
  have hl : l.attach.Nodup := by 

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup l
hn✝ : 2 ≤ length l
x : { x // x ∈ l }
hn : 2 ≤ length (attach l)
⊢ Nodup (attach l)

Next tactic:
rwa [← nodup_attach] at hl
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup l
hn : 2 ≤ length l
⊢ cycleType (formPerm (attach l)) = {length l}

Next tactic:
rw [← length_attach] at hn
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup l
hn : 2 ≤ length (attach l)
⊢ cycleType (formPerm (attach l)) = {length l}

Next tactic:
rw [← nodup_attach] at hl
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ cycleType (formPerm (attach l)) = {length l}

Next tactic:
rw [cycleType_eq [l.attach.formPerm]]
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · 

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ ↑(map (Finset.card ∘ support) [formPerm (attach l)]) = {length l}

Next tactic:
simp only [map, Function.comp_apply]
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · simp only [map, Function.comp_apply]
    

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ ↑[Finset.card (support (formPerm (attach l)))] = {length l}

Next tactic:
rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · simp only [map, Function.comp_apply]
    rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
    · 

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ ↑[length (attach l)] = {length l}

Next tactic:
simp
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · simp only [map, Function.comp_apply]
    rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
    · simp
    · 

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ ∀ (x : { x // x ∈ l }), attach l ≠ [x]

Next tactic:
intro x h
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · simp only [map, Function.comp_apply]
    rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
    · simp
    · intro x h
      

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
x : { x // x ∈ l }
h : attach l = [x]
⊢ False

Next tactic:
simp [h, Nat.succ_le_succ_iff] at hn
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · simp only [map, Function.comp_apply]
    rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
    · simp
    · intro x h
      simp [h, Nat.succ_le_succ_iff] at hn
  · 

Proof state:
case h0
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ prod [formPerm (attach l)] = formPerm (attach l)

Next tactic:
simp
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · simp only [map, Function.comp_apply]
    rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
    · simp
    · intro x h
      simp [h, Nat.succ_le_succ_iff] at hn
  · simp
  · 

Proof state:
case h1
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ ∀ σ ∈ [formPerm (attach l)], IsCycle σ

Next tactic:
simpa using isCycle_formPerm hl hn
theorem cycleType_formPerm (hl : Nodup l) (hn : 2 ≤ l.length) :
    cycleType l.attach.formPerm = {l.length} := by
  rw [← length_attach] at hn
  rw [← nodup_attach] at hl
  rw [cycleType_eq [l.attach.formPerm]]
  · simp only [map, Function.comp_apply]
    rw [support_formPerm_of_nodup _ hl, card_toFinset, dedup_eq_self.mpr hl]
    · simp
    · intro x h
      simp [h, Nat.succ_le_succ_iff] at hn
  · simp
  · simpa using isCycle_formPerm hl hn
  · 

Proof state:
case h2
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup (attach l)
hn : 2 ≤ length (attach l)
⊢ Pairwise Perm.Disjoint [formPerm (attach l)]

Next tactic:
simp
set_option linter.deprecated false in
theorem formPerm_apply_mem_eq_next (hl : Nodup l) (x : α) (hx : x ∈ l) :
    formPerm l x = next l x hx := by
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup l
x : α
hx : x ∈ l
⊢ (formPerm l) x = next l x hx

Next tactic:
obtain ⟨k, hk, rfl⟩ := nthLe_of_mem hx
set_option linter.deprecated false in
theorem formPerm_apply_mem_eq_next (hl : Nodup l) (x : α) (hx : x ∈ l) :
    formPerm l x = next l x hx := by
  obtain ⟨k, hk, rfl⟩ := nthLe_of_mem hx
  

Proof state:
case intro.intro
α : Type u_1
inst✝ : DecidableEq α
l l' : List α
hl : Nodup l
k : ℕ
hk : k < length l
hx : nthLe l k hk ∈ l
⊢ (formPerm l) (nthLe l k hk) = next l (nthLe l k hk) hx

Next tactic:
rw [next_nthLe _ hl, formPerm_apply_nthLe _ hl]
/-- A cycle `s : Cycle α`, given `Nodup s` can be interpreted as an `Equiv.Perm α`
where each element in the list is permuted to the next one, defined as `formPerm`.
-/
def formPerm : ∀ s : Cycle α, Nodup s → Equiv.Perm α :=
  fun s => Quotient.hrecOn s (fun l _ => List.formPerm l) fun l₁ l₂ (h : l₁ ~r l₂) => by
    

Proof state:
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
l₁ l₂ : List α
h : l₁ ~r l₂
⊢ HEq (fun x => List.formPerm l₁) fun x => List.formPerm l₂

Next tactic:
apply Function.hfunext
/-- A cycle `s : Cycle α`, given `Nodup s` can be interpreted as an `Equiv.Perm α`
where each element in the list is permuted to the next one, defined as `formPerm`.
-/
def formPerm : ∀ s : Cycle α, Nodup s → Equiv.Perm α :=
  fun s => Quotient.hrecOn s (fun l _ => List.formPerm l) fun l₁ l₂ (h : l₁ ~r l₂) => by
    apply Function.hfunext
    

Proof state:
case hα
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
l₁ l₂ : List α
h : l₁ ~r l₂
⊢ Nodup ⟦l₁⟧ = Nodup ⟦l₂⟧
case h
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
l₁ l₂ : List α
h : l₁ ~r l₂
⊢ ∀ (a : Nodup ⟦l₁⟧) (a' : Nodup ⟦l₂⟧), HEq a a' → HEq (List.formPerm l₁) (List.formPerm l₂)

Next tactic:
ext
/-- A cycle `s : Cycle α`, given `Nodup s` can be interpreted as an `Equiv.Perm α`
where each element in the list is permuted to the next one, defined as `formPerm`.
-/
def formPerm : ∀ s : Cycle α, Nodup s → Equiv.Perm α :=
  fun s => Quotient.hrecOn s (fun l _ => List.formPerm l) fun l₁ l₂ (h : l₁ ~r l₂) => by
    apply Function.hfunext
    ext
    · 

Proof state:
case hα.a
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
l₁ l₂ : List α
h : l₁ ~r l₂
⊢ Nodup ⟦l₁⟧ ↔ Nodup ⟦l₂⟧

Next tactic:
exact h.nodup_iff
/-- A cycle `s : Cycle α`, given `Nodup s` can be interpreted as an `Equiv.Perm α`
where each element in the list is permuted to the next one, defined as `formPerm`.
-/
def formPerm : ∀ s : Cycle α, Nodup s → Equiv.Perm α :=
  fun s => Quotient.hrecOn s (fun l _ => List.formPerm l) fun l₁ l₂ (h : l₁ ~r l₂) => by
    apply Function.hfunext
    ext
    · exact h.nodup_iff
    · 

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
l₁ l₂ : List α
h : l₁ ~r l₂
⊢ ∀ (a : Nodup ⟦l₁⟧) (a' : Nodup ⟦l₂⟧), HEq a a' → HEq (List.formPerm l₁) (List.formPerm l₂)

Next tactic:
intro h₁ h₂ _
/-- A cycle `s : Cycle α`, given `Nodup s` can be interpreted as an `Equiv.Perm α`
where each element in the list is permuted to the next one, defined as `formPerm`.
-/
def formPerm : ∀ s : Cycle α, Nodup s → Equiv.Perm α :=
  fun s => Quotient.hrecOn s (fun l _ => List.formPerm l) fun l₁ l₂ (h : l₁ ~r l₂) => by
    apply Function.hfunext
    ext
    · exact h.nodup_iff
    · intro h₁ h₂ _
      

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
l₁ l₂ : List α
h : l₁ ~r l₂
h₁ : Nodup ⟦l₁⟧
h₂ : Nodup ⟦l₂⟧
a✝ : HEq h₁ h₂
⊢ HEq (List.formPerm l₁) (List.formPerm l₂)

Next tactic:
exact heq_of_eq (formPerm_eq_of_isRotated h₁ h)
theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
h : Subsingleton s
⊢ formPerm s (_ : Nodup s) = 1

Next tactic:
induction' s using Quot.inductionOn with s
theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by
  induction' s using Quot.inductionOn with s
  

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s✝ s' : Cycle α
s : List α
h : Subsingleton (Quot.mk Setoid.r s)
⊢ formPerm (Quot.mk Setoid.r s) (_ : Nodup (Quot.mk Setoid.r s)) = 1

Next tactic:
simp only [formPerm_coe, mk_eq_coe]
theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by
  induction' s using Quot.inductionOn with s
  simp only [formPerm_coe, mk_eq_coe]
  

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s✝ s' : Cycle α
s : List α
h : Subsingleton (Quot.mk Setoid.r s)
⊢ List.formPerm s = 1

Next tactic:
simp only [length_subsingleton_iff, length_coe, mk_eq_coe] at h
theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by
  induction' s using Quot.inductionOn with s
  simp only [formPerm_coe, mk_eq_coe]
  simp only [length_subsingleton_iff, length_coe, mk_eq_coe] at h
  

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s✝ s' : Cycle α
s : List α
h : List.length s ≤ 1
⊢ List.formPerm s = 1

Next tactic:
cases' s with hd tl
theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by
  induction' s using Quot.inductionOn with s
  simp only [formPerm_coe, mk_eq_coe]
  simp only [length_subsingleton_iff, length_coe, mk_eq_coe] at h
  cases' s with hd tl
  · 

Proof state:
case h.nil
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
h : List.length [] ≤ 1
⊢ List.formPerm [] = 1

Next tactic:
simp
theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by
  induction' s using Quot.inductionOn with s
  simp only [formPerm_coe, mk_eq_coe]
  simp only [length_subsingleton_iff, length_coe, mk_eq_coe] at h
  cases' s with hd tl
  · simp
  · 

Proof state:
case h.cons
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
hd : α
tl : List α
h : List.length (hd :: tl) ≤ 1
⊢ List.formPerm (hd :: tl) = 1

Next tactic:
simp only [length_eq_zero, add_le_iff_nonpos_left, List.length, nonpos_iff_eq_zero] at h
theorem formPerm_subsingleton (s : Cycle α) (h : Subsingleton s) : formPerm s h.nodup = 1 := by
  induction' s using Quot.inductionOn with s
  simp only [formPerm_coe, mk_eq_coe]
  simp only [length_subsingleton_iff, length_coe, mk_eq_coe] at h
  cases' s with hd tl
  · simp
  · simp only [length_eq_zero, add_le_iff_nonpos_left, List.length, nonpos_iff_eq_zero] at h
    

Proof state:
case h.cons
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
hd : α
tl : List α
h : tl = []
⊢ List.formPerm (hd :: tl) = 1

Next tactic:
simp [h]
theorem isCycle_formPerm (s : Cycle α) (h : Nodup s) (hn : Nontrivial s) :
    IsCycle (formPerm s h) := by
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
h : Nodup s
hn : Nontrivial s
⊢ IsCycle (formPerm s h)

Next tactic:
induction s using Quot.inductionOn
theorem isCycle_formPerm (s : Cycle α) (h : Nodup s) (hn : Nontrivial s) :
    IsCycle (formPerm s h) := by
  induction s using Quot.inductionOn
  

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
a✝ : List α
h : Nodup (Quot.mk Setoid.r a✝)
hn : Nontrivial (Quot.mk Setoid.r a✝)
⊢ IsCycle (formPerm (Quot.mk Setoid.r a✝) h)

Next tactic:
exact List.isCycle_formPerm h (length_nontrivial hn)
theorem support_formPerm [Fintype α] (s : Cycle α) (h : Nodup s) (hn : Nontrivial s) :
    support (formPerm s h) = s.toFinset := by
  

Proof state:
α : Type u_1
inst✝¹ : DecidableEq α
s✝ s' : Cycle α
inst✝ : Fintype α
s : Cycle α
h : Nodup s
hn : Nontrivial s
⊢ support (formPerm s h) = toFinset s

Next tactic:
induction' s using Quot.inductionOn with s
theorem support_formPerm [Fintype α] (s : Cycle α) (h : Nodup s) (hn : Nontrivial s) :
    support (formPerm s h) = s.toFinset := by
  induction' s using Quot.inductionOn with s
  

Proof state:
case h
α : Type u_1
inst✝¹ : DecidableEq α
s✝ s' : Cycle α
inst✝ : Fintype α
s : List α
h : Nodup (Quot.mk Setoid.r s)
hn : Nontrivial (Quot.mk Setoid.r s)
⊢ support (formPerm (Quot.mk Setoid.r s) h) = toFinset (Quot.mk Setoid.r s)

Next tactic:
refine' support_formPerm_of_nodup s h _
theorem support_formPerm [Fintype α] (s : Cycle α) (h : Nodup s) (hn : Nontrivial s) :
    support (formPerm s h) = s.toFinset := by
  induction' s using Quot.inductionOn with s
  refine' support_formPerm_of_nodup s h _
  

Proof state:
case h
α : Type u_1
inst✝¹ : DecidableEq α
s✝ s' : Cycle α
inst✝ : Fintype α
s : List α
h : Nodup (Quot.mk Setoid.r s)
hn : Nontrivial (Quot.mk Setoid.r s)
⊢ ∀ (x : α), s ≠ [x]

Next tactic:
rintro _ rfl
theorem support_formPerm [Fintype α] (s : Cycle α) (h : Nodup s) (hn : Nontrivial s) :
    support (formPerm s h) = s.toFinset := by
  induction' s using Quot.inductionOn with s
  refine' support_formPerm_of_nodup s h _
  rintro _ rfl
  

Proof state:
case h
α : Type u_1
inst✝¹ : DecidableEq α
s s' : Cycle α
inst✝ : Fintype α
x✝ : α
h : Nodup (Quot.mk Setoid.r [x✝])
hn : Nontrivial (Quot.mk Setoid.r [x✝])
⊢ False

Next tactic:
simpa [Nat.succ_le_succ_iff] using length_nontrivial hn
theorem formPerm_eq_self_of_not_mem (s : Cycle α) (h : Nodup s) (x : α) (hx : x ∉ s) :
    formPerm s h x = x := by
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
h : Nodup s
x : α
hx : x ∉ s
⊢ (formPerm s h) x = x

Next tactic:
induction s using Quot.inductionOn
theorem formPerm_eq_self_of_not_mem (s : Cycle α) (h : Nodup s) (x : α) (hx : x ∉ s) :
    formPerm s h x = x := by
  induction s using Quot.inductionOn
  

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
x : α
a✝ : List α
h : Nodup (Quot.mk Setoid.r a✝)
hx : x ∉ Quot.mk Setoid.r a✝
⊢ (formPerm (Quot.mk Setoid.r a✝) h) x = x

Next tactic:
simpa using List.formPerm_eq_self_of_not_mem _ _ hx
theorem formPerm_apply_mem_eq_next (s : Cycle α) (h : Nodup s) (x : α) (hx : x ∈ s) :
    formPerm s h x = next s h x hx := by
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
h : Nodup s
x : α
hx : x ∈ s
⊢ (formPerm s h) x = next s h x hx

Next tactic:
induction s using Quot.inductionOn
theorem formPerm_apply_mem_eq_next (s : Cycle α) (h : Nodup s) (x : α) (hx : x ∈ s) :
    formPerm s h x = next s h x hx := by
  induction s using Quot.inductionOn
  

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
x : α
a✝ : List α
h : Nodup (Quot.mk Setoid.r a✝)
hx : x ∈ Quot.mk Setoid.r a✝
⊢ (formPerm (Quot.mk Setoid.r a✝) h) x = next (Quot.mk Setoid.r a✝) h x hx

Next tactic:
simpa using List.formPerm_apply_mem_eq_next h _ (by simp_all)
theorem formPerm_apply_mem_eq_next (s : Cycle α) (h : Nodup s) (x : α) (hx : x ∈ s) :
    formPerm s h x = next s h x hx := by
  induction s using Quot.inductionOn
  simpa using List.formPerm_apply_mem_eq_next h _ (by 

Proof state:
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
x : α
a✝ : List α
h : Nodup (Quot.mk Setoid.r a✝)
hx : x ∈ Quot.mk Setoid.r a✝
⊢ x ∈ a✝

Next tactic:
simp_all
nonrec theorem formPerm_reverse (s : Cycle α) (h : Nodup s) :
    formPerm s.reverse (nodup_reverse_iff.mpr h) = (formPerm s h)⁻¹ := by
  

Proof state:
α : Type u_1
inst✝ : DecidableEq α
s✝ s' s : Cycle α
h : Nodup s
⊢ formPerm (reverse s) (_ : Nodup (reverse s)) = (formPerm s h)⁻¹

Next tactic:
induction s using Quot.inductionOn
nonrec theorem formPerm_reverse (s : Cycle α) (h : Nodup s) :
    formPerm s.reverse (nodup_reverse_iff.mpr h) = (formPerm s h)⁻¹ := by
  induction s using Quot.inductionOn
  

Proof state:
case h
α : Type u_1
inst✝ : DecidableEq α
s s' : Cycle α
a✝ : List α
h : Nodup (Quot.mk Setoid.r a✝)
⊢ formPerm (reverse (Quot.mk Setoid.r a✝)) (_ : Nodup (reverse (Quot.mk Setoid.r a✝))) =
    (formPerm (Quot.mk Setoid.r a✝) h)⁻¹

Next tactic:
simpa using formPerm_reverse _ h
nonrec theorem formPerm_eq_formPerm_iff {α : Type*} [DecidableEq α] {s s' : Cycle α} {hs : s.Nodup}
    {hs' : s'.Nodup} :
    s.formPerm hs = s'.formPerm hs' ↔ s = s' ∨ s.Subsingleton ∧ s'.Subsingleton := by
  

Proof state:
α✝ : Type u_1
inst✝¹ : DecidableEq α✝
s✝ s'✝ : Cycle α✝
α : Type u_2
inst✝ : DecidableEq α
s s' : Cycle α
hs : Nodup s
hs' : Nodup s'
⊢ formPerm s hs = formPerm s' hs' ↔ s = s' ∨ Subsingleton s ∧ Subsingleton s'

Next tactic:
rw [Cycle.length_subsingleton_iff, Cycle.length_subsingleton_iff]
nonrec theorem formPerm_eq_formPerm_iff {α : Type*} [DecidableEq α] {s s' : Cycle α} {hs : s.Nodup}
    {hs' : s'.Nodup} :
    s.formPerm hs = s'.formPerm hs' ↔ s = s' ∨ s.Subsingleton ∧ s'.Subsingleton := by
  rw [Cycle.length_subsingleton_iff, Cycle.length_subsingleton_iff]
  

Proof state:
α✝ : Type u_1
inst✝¹ : DecidableEq α✝
s✝ s'✝ : Cycle α✝
α : Type u_2
inst✝ : DecidableEq α
s s' : Cycle α
hs : Nodup s
hs' : Nodup s'
⊢ formPerm s hs = formPerm s' hs' ↔ s = s' ∨ length s ≤ 1 ∧ length s' ≤ 1

Next tactic:
revert s s'
nonrec theorem formPerm_eq_formPerm_iff {α : Type*} [DecidableEq α] {s s' : Cycle α} {hs : s.Nodup}
    {hs' : s'.Nodup} :
    s.formPerm hs = s'.formPerm hs' ↔ s = s' ∨ s.Subsingleton ∧ s'.Subsingleton := by
  rw [Cycle.length_subsingleton_iff, Cycle.length_subsingleton_iff]
  revert s s'
  

Proof state:
α✝ : Type u_1
inst✝¹ : DecidableEq α✝
s s' : Cycle α✝
α : Type u_2
inst✝ : DecidableEq α
⊢ ∀ {s s' : Cycle α} {hs : Nodup s} {hs' : Nodup s'},
    formPerm s hs = formPerm s' hs' ↔ s = s' ∨ length s ≤ 1 ∧ length s' ≤ 1

Next tactic:
intro s s'
nonrec theorem formPerm_eq_formPerm_iff {α : Type*} [DecidableEq α] {s s' : Cycle α} {hs : s.Nodup}
    {hs' : s'.Nodup} :
    s.formPerm hs = s'.formPerm hs' ↔ s = s' ∨ s.Subsingleton ∧ s'.Subsingleton := by
  rw [Cycle.length_subsingleton_iff, Cycle.length_subsingleton_iff]
  revert s s'
  intro s s'
  

Proof state:
α✝ : Type u_1
inst✝¹ : DecidableEq α✝
s✝ s'✝ : Cycle α✝
α : Type u_2
inst✝ : DecidableEq α
s s' : Cycle α
⊢ ∀ {hs : Nodup s} {hs' : Nodup s'}, formPerm s hs = formPerm s' hs' ↔ s = s' ∨ length s ≤ 1 ∧ length s' ≤ 1

Next tactic:
apply @Quotient.inductionOn₂' _ _ _ _ _ s s'
nonrec theorem formPerm_eq_formPerm_iff {α : Type*} [DecidableEq α] {s s' : Cycle α} {hs : s.Nodup}
    {hs' : s'.Nodup} :
    s.formPerm hs = s'.formPerm hs' ↔ s = s' ∨ s.Subsingleton ∧ s'.Subsingleton := by
  rw [Cycle.length_subsingleton_iff, Cycle.length_subsingleton_iff]
  revert s s'
  intro s s'
  apply @Quotient.inductionOn₂' _ _ _ _ _ s s'
  

Proof state:
α✝ : Type u_1
inst✝¹ : DecidableEq α✝
s✝ s'✝ : Cycle α✝
α : Type u_2
inst✝ : DecidableEq α
s s' : Cycle α
⊢ ∀ (a₁ a₂ : List α) {hs : Nodup (Quotient.mk'' a₁)} {hs' : Nodup (Quotient.mk'' a₂)},
    formPerm (Quotient.mk'' a₁) hs = formPerm (Quotient.mk'' a₂) hs' ↔
      Quotient.mk'' a₁ = Quotient.mk'' a₂ ∨ length (Quotient.mk'' a₁) ≤ 1 ∧ length (Quotient.mk'' a₂) ≤ 1

Next tactic:
intro l l'