Theorem: Equiv.Perm.card_support_eq_two
File: Mathlib/GroupTheory/Perm/Support.lean

tactic: constructor <;> intro h
state_before: α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
⊢ card (support f) = 2 ↔ IsSwap f

tactic: obtain ⟨x, t, hmem, hins, ht⟩ := card_eq_succ.1 h
state_before: case mp
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
⊢ IsSwap f

tactic: obtain ⟨y, rfl⟩ := card_eq_one.1 ht
state_before: case mp.intro.intro.intro.intro
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x : α
t : Finset α
hmem : ¬x ∈ t
hins : insert x t = support f
ht : card t = 1
⊢ IsSwap f

tactic: rw [mem_singleton] at hmem
state_before: case mp.intro.intro.intro.intro.intro
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x ∈ {y}
hins : {x, y} = support f
ht : card {y} = 1
⊢ IsSwap f

tactic: refine' ⟨x, y, hmem, _⟩
state_before: case mp.intro.intro.intro.intro.intro
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
⊢ IsSwap f

tactic: ext a
state_before: case mp.intro.intro.intro.intro.intro
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
⊢ f = swap x y

tactic: have key : ∀ b, f b ≠ b ↔ _ := fun b => by rw [← mem_support, ← hins, mem_insert, mem_singleton]
state_before: case mp.intro.intro.intro.intro.intro.H
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
a : α
⊢ ↑f a = ↑(swap x y) a

tactic: by_cases ha : f a = a
state_before: case mp.intro.intro.intro.intro.intro.H
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
a : α
key : ∀ (b : α), ↑f b ≠ b ↔ b = x ∨ b = y
⊢ ↑f a = ↑(swap x y) a

tactic: rw [← mem_support, ← hins, mem_insert, mem_singleton]
state_before: α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
a b : α
⊢ ↑f b ≠ b ↔ ?m.185118 b

tactic: have ha' := not_or.mp (mt (key a).mpr (not_not.mpr ha))
state_before: case pos
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
a : α
key : ∀ (b : α), ↑f b ≠ b ↔ b = x ∨ b = y
ha : ↑f a = a
⊢ ↑f a = ↑(swap x y) a

tactic: rw [ha, swap_apply_of_ne_of_ne ha'.1 ha'.2]
state_before: case pos
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
a : α
key : ∀ (b : α), ↑f b ≠ b ↔ b = x ∨ b = y
ha : ↑f a = a
ha' : ¬a = x ∧ ¬a = y
⊢ ↑f a = ↑(swap x y) a

tactic: have ha' := (key (f a)).mp (mt f.apply_eq_iff_eq.mp ha)
state_before: case neg
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
a : α
key : ∀ (b : α), ↑f b ≠ b ↔ b = x ∨ b = y
ha : ¬↑f a = a
⊢ ↑f a = ↑(swap x y) a

tactic: obtain rfl | rfl := (key a).mp ha
state_before: case neg
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x y : α
hmem : ¬x = y
hins : {x, y} = support f
ht : card {y} = 1
a : α
key : ∀ (b : α), ↑f b ≠ b ↔ b = x ∨ b = y
ha : ¬↑f a = a
ha' : ↑f a = x ∨ ↑f a = y
⊢ ↑f a = ↑(swap x y) a

tactic: rw [Or.resolve_left ha' ha, swap_apply_left]
state_before: case neg.inl
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
y : α
ht : card {y} = 1
a : α
ha : ¬↑f a = a
hmem : ¬a = y
hins : {a, y} = support f
key : ∀ (b : α), ↑f b ≠ b ↔ b = a ∨ b = y
ha' : ↑f a = a ∨ ↑f a = y
⊢ ↑f a = ↑(swap a y) a

tactic: rw [Or.resolve_right ha' ha, swap_apply_right]
state_before: case neg.inr
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : card (support f) = 2
x a : α
ha : ¬↑f a = a
hmem : ¬x = a
hins : {x, a} = support f
ht : card {a} = 1
key : ∀ (b : α), ↑f b ≠ b ↔ b = x ∨ b = a
ha' : ↑f a = x ∨ ↑f a = a
⊢ ↑f a = ↑(swap x a) a

tactic: obtain ⟨x, y, hxy, rfl⟩ := h
state_before: case mpr
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f✝ g f : Perm α
h : IsSwap f
⊢ card (support f) = 2

tactic: exact card_support_swap hxy
state_before: case mpr.intro.intro.intro
α : Type u_1
inst✝¹ : DecidableEq α
inst✝ : Fintype α
f g : Perm α
x y : α
hxy : x ≠ y
⊢ card (support (swap x y)) = 2