Theorem: Equiv.Perm.IsCycle.existsUnique_cycle
File: Mathlib/GroupTheory/Perm/Cycle/Concrete.lean

tactic: cases nonempty_fintype α
state_before: α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : IsCycle f
⊢ ∃! s, ∃ h, Cycle.formPerm s h = f

tactic: obtain ⟨x, hx, hy⟩ := id hf
state_before: case intro
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : IsCycle f
val✝ : Fintype α
⊢ ∃! s, ∃ h, Cycle.formPerm s h = f

tactic: refine' ⟨f.toList x, ⟨nodup_toList f x, _⟩, _⟩
state_before: case intro.intro.intro
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : IsCycle f
val✝ : Fintype α
x : α
hx : ↑f x ≠ x
hy : ∀ ⦃y : α⦄, ↑f y ≠ y → SameCycle f x y
⊢ ∃! s, ∃ h, Cycle.formPerm s h = f

tactic: simp [formPerm_toList, hf.cycleOf_eq hx]
state_before: case intro.intro.intro.refine'_1
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : IsCycle f
val✝ : Fintype α
x : α
hx : ↑f x ≠ x
hy : ∀ ⦃y : α⦄, ↑f y ≠ y → SameCycle f x y
⊢ Cycle.formPerm ↑(toList f x) (_ : Nodup (toList f x)) = f

tactic: rintro ⟨l⟩ ⟨hn, rfl⟩
state_before: case intro.intro.intro.refine'_2
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : IsCycle f
val✝ : Fintype α
x : α
hx : ↑f x ≠ x
hy : ∀ ⦃y : α⦄, ↑f y ≠ y → SameCycle f x y
⊢ ∀ (y : Cycle α), (fun s => ∃ h, Cycle.formPerm s h = f) y → y = ↑(toList f x)

tactic: simp only [Cycle.mk_eq_coe, Cycle.coe_eq_coe, Subtype.coe_mk, Cycle.formPerm_coe]
state_before: case intro.intro.intro.refine'_2.mk.intro
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hx : ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
⊢ Quot.mk Setoid.r l = ↑(toList (Cycle.formPerm (Quot.mk Setoid.r l) hn) x)

tactic: refine' (toList_formPerm_isRotated_self _ _ hn _ _).symm
state_before: case intro.intro.intro.refine'_2.mk.intro
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hx : ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
⊢ l ~r toList (formPerm l) x

tactic: contrapose! hx
state_before: case intro.intro.intro.refine'_2.mk.intro.refine'_1
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hx : ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
⊢ 2 ≤ length l

tactic: suffices formPerm l = 1 by simp [this]
state_before: case intro.intro.intro.refine'_2.mk.intro.refine'_1
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
hx : length l < 2
⊢ ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x = x

tactic: rw [formPerm_eq_one_iff _ hn]
state_before: case intro.intro.intro.refine'_2.mk.intro.refine'_1
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
hx : length l < 2
⊢ formPerm l = 1

tactic: exact Nat.le_of_lt_succ hx
state_before: case intro.intro.intro.refine'_2.mk.intro.refine'_1
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
hx : length l < 2
⊢ length l ≤ 1

tactic: simp [this]
state_before: α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
hx : length l < 2
this : formPerm l = 1
⊢ ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x = x

tactic: rw [← mem_toFinset]
state_before: case intro.intro.intro.refine'_2.mk.intro.refine'_2
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hx : ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
⊢ x ∈ l

tactic: refine' support_formPerm_le l _
state_before: case intro.intro.intro.refine'_2.mk.intro.refine'_2
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hx : ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
⊢ x ∈ toFinset l

tactic: simpa using hx
state_before: case intro.intro.intro.refine'_2.mk.intro.refine'_2
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
val✝ : Fintype α
x : α
y✝ : Cycle α
l : List α
hn : Cycle.Nodup (Quot.mk Setoid.r l)
hf : IsCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn)
hx : ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, ↑(Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → SameCycle (Cycle.formPerm (Quot.mk Setoid.r l) hn) x y
⊢ x ∈ support (formPerm l)