Theorem: Finsupp.antidiagonal_single
File: Mathlib/Data/Finsupp/Antidiagonal.lean

tactic: ext ⟨x, y⟩
state_before: α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
⊢ antidiagonal (single a n) =
    map ({ toFun := single a, inj' := ⋯ }.prodMap { toFun := single a, inj' := ⋯ }) (antidiagonal n)
state_after: case a.mk
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ (x, y) ∈ antidiagonal (single a n) ↔
    (x, y) ∈ map ({ toFun := single a, inj' := ⋯ }.prodMap { toFun := single a, inj' := ⋯ }) (antidiagonal n)

tactic: simp only [mem_antidiagonal, mem_map, mem_antidiagonal, Function.Embedding.coe_prodMap,
  Function.Embedding.coeFn_mk, Prod.map_apply, Prod.mk.injEq, Prod.exists]
state_before: case a.mk
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ (x, y) ∈ antidiagonal (single a n) ↔
    (x, y) ∈ map ({ toFun := single a, inj' := ⋯ }.prodMap { toFun := single a, inj' := ⋯ }) (antidiagonal n)
state_after: case a.mk
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ x + y = single a n ↔ ∃ a_1 b, a_1 + b = n ∧ single a a_1 = x ∧ single a b = y

tactic: constructor
state_before: case a.mk
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ x + y = single a n ↔ ∃ a_1 b, a_1 + b = n ∧ single a a_1 = x ∧ single a b = y
state_after: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ x + y = single a n → ∃ a_2 b, a_2 + b = n ∧ single a a_2 = x ∧ single a b = y

case a.mk.mpr
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ (∃ a_1 b, a_1 + b = n ∧ single a a_1 = x ∧ single a b = y) → x + y = single a n

tactic: intro h
state_before: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ x + y = single a n → ∃ a_2 b, a_2 + b = n ∧ single a a_2 = x ∧ single a b = y
state_after: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
⊢ ∃ a_1 b, a_1 + b = n ∧ single a a_1 = x ∧ single a b = y

tactic: refine ⟨x a, y a, DFunLike.congr_fun h a |>.trans single_eq_same, ?_⟩
state_before: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
⊢ ∃ a_1 b, a_1 + b = n ∧ single a a_1 = x ∧ single a b = y
state_after: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
⊢ single a (x a) = x ∧ single a (y a) = y

tactic: simp_rw [DFunLike.ext_iff, ← forall_and]
state_before: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
⊢ single a (x a) = x ∧ single a (y a) = y
state_after: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
⊢ ∀ (x_1 : α), (single a (x a)) x_1 = x x_1 ∧ (single a (y a)) x_1 = y x_1

tactic: intro i
state_before: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
⊢ ∀ (x_1 : α), (single a (x a)) x_1 = x x_1 ∧ (single a (y a)) x_1 = y x_1
state_after: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
i : α
⊢ (single a (x a)) i = x i ∧ (single a (y a)) i = y i

tactic: replace h := DFunLike.congr_fun h i
state_before: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x + y = single a n
i : α
⊢ (single a (x a)) i = x i ∧ (single a (y a)) i = y i
state_after: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
h : (x + y) i = (single a n) i
⊢ (single a (x a)) i = x i ∧ (single a (y a)) i = y i

tactic: simp_rw [single_apply, Finsupp.add_apply] at h ⊢
state_before: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
h : (x + y) i = (single a n) i
⊢ (single a (x a)) i = x i ∧ (single a (y a)) i = y i
state_after: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
h : x i + y i = if a = i then n else 0
⊢ (if a = i then x a else 0) = x i ∧ (if a = i then y a else 0) = y i

tactic: obtain rfl | hai := Decidable.eq_or_ne a i
state_before: case a.mk.mp
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
h : x i + y i = if a = i then n else 0
⊢ (if a = i then x a else 0) = x i ∧ (if a = i then y a else 0) = y i
state_after: case a.mk.mp.inl
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x a + y a = if a = a then n else 0
⊢ (if a = a then x a else 0) = x a ∧ (if a = a then y a else 0) = y a

case a.mk.mp.inr
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
h : x i + y i = if a = i then n else 0
hai : a ≠ i
⊢ (if a = i then x a else 0) = x i ∧ (if a = i then y a else 0) = y i

tactic: exact ⟨if_pos rfl, if_pos rfl⟩
state_before: case a.mk.mp.inl
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
h : x a + y a = if a = a then n else 0
⊢ (if a = a then x a else 0) = x a ∧ (if a = a then y a else 0) = y a
state_after: no goals

tactic: simp_rw [if_neg hai, _root_.add_eq_zero_iff] at h ⊢
state_before: case a.mk.mp.inr
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
h : x i + y i = if a = i then n else 0
hai : a ≠ i
⊢ (if a = i then x a else 0) = x i ∧ (if a = i then y a else 0) = y i
state_after: case a.mk.mp.inr
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
hai : a ≠ i
h : x i = 0 ∧ y i = 0
⊢ 0 = x i ∧ 0 = y i

tactic: exact h.imp Eq.symm Eq.symm
state_before: case a.mk.mp.inr
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
i : α
hai : a ≠ i
h : x i = 0 ∧ y i = 0
⊢ 0 = x i ∧ 0 = y i
state_after: no goals

tactic: rintro ⟨a, b, rfl, rfl, rfl⟩
state_before: case a.mk.mpr
α : Type u
inst✝ : DecidableEq α
a : α
n : ℕ
x y : α →₀ ℕ
⊢ (∃ a_1 b, a_1 + b = n ∧ single a a_1 = x ∧ single a b = y) → x + y = single a n
state_after: case a.mk.mpr.intro.intro.intro.intro
α : Type u
inst✝ : DecidableEq α
a✝ : α
a b : ℕ
⊢ single a✝ a + single a✝ b = single a✝ (a + b)

tactic: exact (single_add _ _ _).symm
state_before: case a.mk.mpr.intro.intro.intro.intro
α : Type u
inst✝ : DecidableEq α
a✝ : α
a b : ℕ
⊢ single a✝ a + single a✝ b = single a✝ (a + b)
state_after: no goals