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 : f.IsCycle
⊢ ∃! s, ∃ (h : s.Nodup), s.formPerm h = f
state_after: case intro
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : f.IsCycle
val✝ : Fintype α
⊢ ∃! s, ∃ (h : s.Nodup), s.formPerm h = f

tactic: obtain ⟨x, hx, hy⟩ := id hf
state_before: case intro
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : f.IsCycle
val✝ : Fintype α
⊢ ∃! s, ∃ (h : s.Nodup), s.formPerm h = f
state_after: case intro.intro.intro
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : f.IsCycle
val✝ : Fintype α
x : α
hx : f x ≠ x
hy : ∀ ⦃y : α⦄, f y ≠ y → f.SameCycle x y
⊢ ∃! s, ∃ (h : s.Nodup), s.formPerm 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 : f.IsCycle
val✝ : Fintype α
x : α
hx : f x ≠ x
hy : ∀ ⦃y : α⦄, f y ≠ y → f.SameCycle x y
⊢ ∃! s, ∃ (h : s.Nodup), s.formPerm h = f
state_after: case intro.intro.intro.refine_1
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : f.IsCycle
val✝ : Fintype α
x : α
hx : f x ≠ x
hy : ∀ ⦃y : α⦄, f y ≠ y → f.SameCycle x y
⊢ (↑(f.toList x)).formPerm ⋯ = f

case intro.intro.intro.refine_2
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : f.IsCycle
val✝ : Fintype α
x : α
hx : f x ≠ x
hy : ∀ ⦃y : α⦄, f y ≠ y → f.SameCycle x y
⊢ ∀ (y : Cycle α), (fun s => ∃ (h : s.Nodup), s.formPerm h = f) y → y = ↑(f.toList x)

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 : f.IsCycle
val✝ : Fintype α
x : α
hx : f x ≠ x
hy : ∀ ⦃y : α⦄, f y ≠ y → f.SameCycle x y
⊢ (↑(f.toList x)).formPerm ⋯ = f
state_after: no goals

tactic: rintro ⟨l⟩ ⟨hn, rfl⟩
state_before: case intro.intro.intro.refine_2
α : Type u_1
inst✝¹ : Finite α
inst✝ : DecidableEq α
f : Perm α
hf : f.IsCycle
val✝ : Fintype α
x : α
hx : f x ≠ x
hy : ∀ ⦃y : α⦄, f y ≠ y → f.SameCycle x y
⊢ ∀ (y : Cycle α), (fun s => ∃ (h : s.Nodup), s.formPerm h = f) y → y = ↑(f.toList x)
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ Quot.mk Setoid.r l = ↑((Cycle.formPerm (Quot.mk Setoid.r l) hn).toList 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ Quot.mk Setoid.r l = ↑((Cycle.formPerm (Quot.mk Setoid.r l) hn).toList x)
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ l ~r l.formPerm.toList 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ l ~r l.formPerm.toList x
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ 2 ≤ l.length

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ x ∈ l

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ 2 ≤ l.length
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
hx : l.length < 2
⊢ (Cycle.formPerm (Quot.mk Setoid.r l) hn) x = x

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
hx : l.length < 2
⊢ (Cycle.formPerm (Quot.mk Setoid.r l) hn) x = x
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
hx : l.length < 2
⊢ l.formPerm = 1

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
hx : l.length < 2
⊢ l.formPerm = 1
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
hx : l.length < 2
⊢ l.length ≤ 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
hx : l.length < 2
⊢ l.length ≤ 1
state_after: no goals

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
hx : l.length < 2
this : l.formPerm = 1
⊢ (Cycle.formPerm (Quot.mk Setoid.r l) hn) x = x
state_after: no goals

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ x ∈ l
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ x ∈ l.toFinset

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ x ∈ l.toFinset
state_after: 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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ x ∈ l.formPerm.support

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 : (Cycle.formPerm (Quot.mk Setoid.r l) hn).IsCycle
hx : (Cycle.formPerm (Quot.mk Setoid.r l) hn) x ≠ x
hy : ∀ ⦃y : α⦄, (Cycle.formPerm (Quot.mk Setoid.r l) hn) y ≠ y → (Cycle.formPerm (Quot.mk Setoid.r l) hn).SameCycle x y
⊢ x ∈ l.formPerm.support
state_after: no goals