Theorem: Finset.product_self_eq_disjUnion_perm
File: Mathlib/GroupTheory/Perm/Cycle/Basic.lean

tactic: ext ⟨a, b⟩
state_before: ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
⊢ s ×ˢ s =
    disjiUnion (range (card s))
      (fun k =>
        map
          { toFun := fun i => (i, ↑(f ^ k) i),
            inj' :=
              (_ :
                ∀ (i j : α),
                  (fun i => (i, ↑(f ^ k) i)) i = (fun i => (i, ↑(f ^ k) i)) j →
                    ((fun i => (i, ↑(f ^ k) i)) i).fst = ((fun i => (i, ↑(f ^ k) i)) j).fst) }
          s)
      (_ :
        Set.PairwiseDisjoint ↑(range (card s)) fun k =>
          map
            { toFun := fun i => (i, ↑(f ^ k) i),
              inj' :=
                (_ :
                  ∀ (i j : α),
                    (fun i => (i, ↑(f ^ k) i)) i = (fun i => (i, ↑(f ^ k) i)) j →
                      ((fun i => (i, ↑(f ^ k) i)) i).fst = ((fun i => (i, ↑(f ^ k) i)) j).fst) }
            s)

tactic: simp only [mem_product, Equiv.Perm.coe_pow, mem_disjiUnion, mem_range, mem_map,
  Function.Embedding.coeFn_mk, Prod.mk.inj_iff, exists_prop]
state_before: case a.mk
ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
a b : α
⊢ (a, b) ∈ s ×ˢ s ↔
    (a, b) ∈
      disjiUnion (range (card s))
        (fun k =>
          map
            { toFun := fun i => (i, ↑(f ^ k) i),
              inj' :=
                (_ :
                  ∀ (i j : α),
                    (fun i => (i, ↑(f ^ k) i)) i = (fun i => (i, ↑(f ^ k) i)) j →
                      ((fun i => (i, ↑(f ^ k) i)) i).fst = ((fun i => (i, ↑(f ^ k) i)) j).fst) }
            s)
        (_ :
          Set.PairwiseDisjoint ↑(range (card s)) fun k =>
            map
              { toFun := fun i => (i, ↑(f ^ k) i),
                inj' :=
                  (_ :
                    ∀ (i j : α),
                      (fun i => (i, ↑(f ^ k) i)) i = (fun i => (i, ↑(f ^ k) i)) j →
                        ((fun i => (i, ↑(f ^ k) i)) i).fst = ((fun i => (i, ↑(f ^ k) i)) j).fst) }
              s)

tactic: refine' ⟨fun hx => _, _⟩
state_before: case a.mk
ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
a b : α
⊢ a ∈ s ∧ b ∈ s ↔ ∃ a_1, a_1 < card s ∧ ∃ a_2, a_2 ∈ s ∧ a_2 = a ∧ (↑f^[a_1]) a_2 = b

tactic: obtain ⟨n, hn, rfl⟩ := hf.exists_pow_eq hx.1 hx.2
state_before: case a.mk.refine'_1
ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
a b : α
hx : a ∈ s ∧ b ∈ s
⊢ ∃ a_1, a_1 < card s ∧ ∃ a_2, a_2 ∈ s ∧ a_2 = a ∧ (↑f^[a_1]) a_2 = b

tactic: exact ⟨n, hn, a, hx.1, rfl, by rw [f.iterate_eq_pow]⟩
state_before: case a.mk.refine'_1.intro.intro
ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
a : α
n : ℕ
hn : n < card s
hx : a ∈ s ∧ ↑(f ^ n) a ∈ s
⊢ ∃ a_1, a_1 < card s ∧ ∃ a_2, a_2 ∈ s ∧ a_2 = a ∧ (↑f^[a_1]) a_2 = ↑(f ^ n) a

tactic: rw [f.iterate_eq_pow]
state_before: ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
a : α
n : ℕ
hn : n < card s
hx : a ∈ s ∧ ↑(f ^ n) a ∈ s
⊢ (↑f^[n]) a = ↑(f ^ n) a

tactic: rintro ⟨n, -, a, ha, rfl, rfl⟩
state_before: case a.mk.refine'_2
ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
a b : α
⊢ (∃ a_1, a_1 < card s ∧ ∃ a_2, a_2 ∈ s ∧ a_2 = a ∧ (↑f^[a_1]) a_2 = b) → a ∈ s ∧ b ∈ s

tactic: exact ⟨ha, (hf.1.iterate _).mapsTo ha⟩
state_before: case a.mk.refine'_2.intro.intro.intro.intro.intro
ι : Type ?u.3150272
α : Type u_1
β : Type ?u.3150278
inst✝ : DecidableEq α
f : Perm α
s : Finset α
hf : IsCycleOn f ↑s
n : ℕ
a : α
ha : a ∈ s
⊢ a ∈ s ∧ (↑f^[n]) a ∈ s