case h
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
⊢ ↑(toFinsupp (l₁ ++ l₂)) n = ↑(toFinsupp l₁ + Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) n
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
⊢ toFinsupp (l₁ ++ l₂) = toFinsupp l₁ + Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)
ext n
case h
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
⊢ getD (l₁ ++ l₂) n 0 = getD l₁ n 0 + ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) n
case h
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
⊢ ↑(toFinsupp (l₁ ++ l₂)) n = ↑(toFinsupp l₁ + Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) n
simp only [toFinsupp_apply, Finsupp.add_apply]
no goals
case h
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
⊢ getD (l₁ ++ l₂) n 0 = getD l₁ n 0 + ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) n
cases lt_or_le n l₁.length with
| inl h =>
  rw [getD_append _ _ _ _ h, Finsupp.embDomain_notin_range, add_zero]
  rintro ⟨k, rfl : length l₁ + k = n⟩
  exact h.not_le (self_le_add_right _ _)
| inr h =>
  rcases exists_add_of_le h with ⟨k, rfl⟩
  rw [getD_append_right _ _ _ _ h, add_tsub_cancel_left, getD_eq_default _ _ h, zero_add]
  exact Eq.symm (Finsupp.embDomain_apply _ _ _)
case h.inl.h
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
h : n < length l₁
⊢ ¬n ∈ Set.range ↑(addLeftEmbedding (length l₁))
case h.inl
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
h : n < length l₁
⊢ getD (l₁ ++ l₂) n 0 = getD l₁ n 0 + ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) n
rw [getD_append _ _ _ _ h, Finsupp.embDomain_notin_range, add_zero]
case h.inl.h.intro
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
k : ℕ
h : length l₁ + k < length l₁
⊢ False
case h.inl.h
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
h : n < length l₁
⊢ ¬n ∈ Set.range ↑(addLeftEmbedding (length l₁))
rintro ⟨k, rfl : length l₁ + k = n⟩
no goals
case h.inl.h.intro
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
k : ℕ
h : length l₁ + k < length l₁
⊢ False
exact h.not_le (self_le_add_right _ _)
case h.inr.intro
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
k : ℕ
h : length l₁ ≤ length l₁ + k
⊢ getD (l₁ ++ l₂) (length l₁ + k) 0 =
    getD l₁ (length l₁ + k) 0 + ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) (length l₁ + k)
case h.inr
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n✝ : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
n : ℕ
h : length l₁ ≤ n
⊢ getD (l₁ ++ l₂) n 0 = getD l₁ n 0 + ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) n
rcases exists_add_of_le h with ⟨k, rfl⟩
case h.inr.intro
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
k : ℕ
h : length l₁ ≤ length l₁ + k
⊢ getD l₂ k 0 = ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) (length l₁ + k)
case h.inr.intro
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
k : ℕ
h : length l₁ ≤ length l₁ + k
⊢ getD (l₁ ++ l₂) (length l₁ + k) 0 =
    getD l₁ (length l₁ + k) 0 + ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) (length l₁ + k)
rw [getD_append_right _ _ _ _ h, add_tsub_cancel_left, getD_eq_default _ _ h, zero_add]
no goals
case h.inr.intro
M : Type ?u.10005
inst✝⁵ : Zero M
l : List M
inst✝⁴ : DecidablePred fun x => getD l x 0 ≠ 0
n : ℕ
R : Type u_1
inst✝³ : AddZeroClass R
l₁ l₂ : List R
inst✝² : DecidablePred fun x => getD (l₁ ++ l₂) x 0 ≠ 0
inst✝¹ : DecidablePred fun x => getD l₁ x 0 ≠ 0
inst✝ : DecidablePred fun x => getD l₂ x 0 ≠ 0
k : ℕ
h : length l₁ ≤ length l₁ + k
⊢ getD l₂ k 0 = ↑(Finsupp.embDomain (addLeftEmbedding (length l₁)) (toFinsupp l₂)) (length l₁ + k)
exact Eq.symm (Finsupp.embDomain_apply _ _ _)