Theorem: card_support_eq_three_iff
File: Mathlib/GroupTheory/Perm/Cycle/Type.lean

tactic: refine' ⟨fun h => _, IsThreeCycle.card_support⟩
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
⊢ Finset.card (support σ) = 3 ↔ IsThreeCycle σ

tactic: by_cases h0 : σ.cycleType = 0
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : Finset.card (support σ) = 3
⊢ IsThreeCycle σ

tactic: obtain ⟨n, hn⟩ := exists_mem_of_ne_zero h0
state_before: case neg
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : Finset.card (support σ) = 3
h0 : ¬Perm.cycleType σ = 0
⊢ IsThreeCycle σ

tactic: by_cases h1 : σ.cycleType.erase n = 0
state_before: case neg.intro
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : Finset.card (support σ) = 3
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
⊢ IsThreeCycle σ

tactic: obtain ⟨m, hm⟩ := exists_mem_of_ne_zero h1
state_before: case neg
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : Finset.card (support σ) = 3
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
h1 : ¬erase (Perm.cycleType σ) n = 0
⊢ IsThreeCycle σ

tactic: rw [← sum_cycleType, ← cons_erase hn, ← cons_erase hm, Multiset.sum_cons, Multiset.sum_cons] at h
state_before: case neg.intro
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : Finset.card (support σ) = 3
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
h1 : ¬erase (Perm.cycleType σ) n = 0
m : ℕ
hm : m ∈ erase (Perm.cycleType σ) n
⊢ IsThreeCycle σ

tactic: have : ∀ {k}, 2 ≤ m → 2 ≤ n → n + (m + k) = 3 → False := by
  intros
  linarith
state_before: case neg.intro
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
h1 : ¬erase (Perm.cycleType σ) n = 0
m : ℕ
h : n + (m + sum (erase (erase (Perm.cycleType σ) n) m)) = 3
hm : m ∈ erase (Perm.cycleType σ) n
⊢ IsThreeCycle σ

tactic: cases this (two_le_of_mem_cycleType (mem_of_mem_erase hm)) (two_le_of_mem_cycleType hn) h
state_before: case neg.intro
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
h1 : ¬erase (Perm.cycleType σ) n = 0
m : ℕ
h : n + (m + sum (erase (erase (Perm.cycleType σ) n) m)) = 3
hm : m ∈ erase (Perm.cycleType σ) n
this : ∀ {k : ℕ}, 2 ≤ m → 2 ≤ n → n + (m + k) = 3 → False
⊢ IsThreeCycle σ

tactic: rw [← sum_cycleType, h0, sum_zero] at h
state_before: case pos
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : Finset.card (support σ) = 3
h0 : Perm.cycleType σ = 0
⊢ IsThreeCycle σ

tactic: exact (ne_of_lt zero_lt_three h).elim
state_before: case pos
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : 0 = 3
h0 : Perm.cycleType σ = 0
⊢ IsThreeCycle σ

tactic: rw [← sum_cycleType, ← cons_erase hn, h1, cons_zero, Multiset.sum_singleton] at h
state_before: case pos
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h : Finset.card (support σ) = 3
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
h1 : erase (Perm.cycleType σ) n = 0
⊢ IsThreeCycle σ

tactic: rw [IsThreeCycle, ← cons_erase hn, h1, h, ← cons_zero]
state_before: case pos
α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h0 : ¬Perm.cycleType σ = 0
n : ℕ
h : n = 3
hn : n ∈ Perm.cycleType σ
h1 : erase (Perm.cycleType σ) n = 0
⊢ IsThreeCycle σ

tactic: intros
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
h1 : ¬erase (Perm.cycleType σ) n = 0
m : ℕ
h : n + (m + sum (erase (erase (Perm.cycleType σ) n) m)) = 3
hm : m ∈ erase (Perm.cycleType σ) n
⊢ ∀ {k : ℕ}, 2 ≤ m → 2 ≤ n → n + (m + k) = 3 → False

tactic: linarith
state_before: α : Type u_1
inst✝¹ : Fintype α
inst✝ : DecidableEq α
σ : Perm α
h0 : ¬Perm.cycleType σ = 0
n : ℕ
hn : n ∈ Perm.cycleType σ
h1 : ¬erase (Perm.cycleType σ) n = 0
m : ℕ
h : n + (m + sum (erase (erase (Perm.cycleType σ) n) m)) = 3
hm : m ∈ erase (Perm.cycleType σ) n
k✝ : ℕ
a✝² : 2 ≤ m
a✝¹ : 2 ≤ n
a✝ : n + (m + k✝) = 3
⊢ False