Theorem: Set.Countable.exists_cycleOn
File: Mathlib/GroupTheory/Perm/Cycle/Basic.lean

tactic: obtain hs' | hs' := s.finite_or_infinite
state_before: ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
⊢ ∃ f, IsCycleOn f s ∧ {x | ↑f x ≠ x} ⊆ s

tactic: haveI := hs.to_subtype
state_before: case inr
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
⊢ ∃ f, IsCycleOn f s ∧ {x | ↑f x ≠ x} ⊆ s

tactic: haveI := hs'.to_subtype
state_before: case inr
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
this : Countable ↑s
⊢ ∃ f, IsCycleOn f s ∧ {x | ↑f x ≠ x} ⊆ s

tactic: obtain ⟨f⟩ : Nonempty (ℤ ≃ s) := inferInstance
state_before: case inr
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
this✝ : Countable ↑s
this : Infinite ↑s
⊢ ∃ f, IsCycleOn f s ∧ {x | ↑f x ≠ x} ⊆ s

tactic: refine'
  ⟨(Equiv.addRight 1).extendDomain f, _, fun x hx =>
    of_not_not fun h => hx <| Perm.extendDomain_apply_not_subtype _ _ h⟩
state_before: case inr.intro
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f✝ : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
this✝ : Countable ↑s
this : Infinite ↑s
f : ℤ ≃ ↑s
⊢ ∃ f, IsCycleOn f s ∧ {x | ↑f x ≠ x} ⊆ s

tactic: convert Int.addRight_one_isCycle.isCycleOn.extendDomain f
state_before: case inr.intro
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f✝ : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
this✝ : Countable ↑s
this : Infinite ↑s
f : ℤ ≃ ↑s
⊢ IsCycleOn (extendDomain (Equiv.addRight 1) f) s

tactic: rw [Set.image_comp, Equiv.image_eq_preimage]
state_before: case h.e'_3
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f✝ : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
this✝ : Countable ↑s
this : Infinite ↑s
f : ℤ ≃ ↑s
⊢ s = Subtype.val ∘ ↑f '' {x | ↑(Equiv.addRight 1) x ≠ x}

tactic: ext
state_before: case h.e'_3
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f✝ : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
this✝ : Countable ↑s
this : Infinite ↑s
f : ℤ ≃ ↑s
⊢ s = Subtype.val '' (↑f.symm ⁻¹' {x | ↑(Equiv.addRight 1) x ≠ x})

tactic: simp
state_before: case h.e'_3.h
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f✝ : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Infinite s
this✝ : Countable ↑s
this : Infinite ↑s
f : ℤ ≃ ↑s
x✝ : α
⊢ x✝ ∈ s ↔ x✝ ∈ Subtype.val '' (↑f.symm ⁻¹' {x | ↑(Equiv.addRight 1) x ≠ x})

tactic: refine'
  ⟨hs'.toFinset.toList.formPerm, _, fun x hx => by
    simpa using List.mem_of_formPerm_apply_ne _ _ hx⟩
state_before: case inl
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Finite s
⊢ ∃ f, IsCycleOn f s ∧ {x | ↑f x ≠ x} ⊆ s

tactic: convert hs'.toFinset.nodup_toList.isCycleOn_formPerm
state_before: case inl
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Finite s
⊢ IsCycleOn (List.formPerm (toList (Set.Finite.toFinset hs'))) s

tactic: simp
state_before: case h.e'_3
ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Finite s
⊢ s = {a | a ∈ toList (Set.Finite.toFinset hs')}

tactic: simpa using List.mem_of_formPerm_apply_ne _ _ hx
state_before: ι : Type ?u.3075067
α : Type u_1
β : Type ?u.3075073
inst✝ : DecidableEq α
f : Perm α
s : Set α
hs : Set.Countable s
hs' : Set.Finite s
x : α
hx : x ∈ {x | ↑(List.formPerm (toList (Set.Finite.toFinset hs'))) x ≠ x}
⊢ x ∈ s