Theorem: suffixLevenshtein_cons_cons_fst_get_zero
File: Mathlib/Data/List/EditDistance/Defs.lean

tactic: conv =>
  lhs
  dsimp only [suffixLevenshtein_cons₂]
state_before: α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ (suffixLevenshtein C (x :: xs) (y :: ys)).val[0] =
    match suffixLevenshtein C xs (y :: ys) with
    | ⟨dx, property⟩ =>
      match suffixLevenshtein C (x :: xs) ys with
      | ⟨dy, property_1⟩ =>
        match suffixLevenshtein C xs ys with
        | ⟨dxy, property_2⟩ => min (C.delete x + dx[0]) (min (C.insert y + dy[0]) (C.substitute x y + dxy[0]))
state_after: α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ (impl C (x :: xs) y (suffixLevenshtein C (x :: xs) ys)).val[0] =
    match suffixLevenshtein C xs (y :: ys) with
    | ⟨dx, property⟩ =>
      match suffixLevenshtein C (x :: xs) ys with
      | ⟨dy, property_1⟩ =>
        match suffixLevenshtein C xs ys with
        | ⟨dxy, property_2⟩ => min (C.delete x + dx[0]) (min (C.insert y + dy[0]) (C.substitute x y + dxy[0]))

tactic: simp only [suffixLevenshtein_cons₁]
state_before: α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ (impl C (x :: xs) y (suffixLevenshtein C (x :: xs) ys)).val[0] =
    match suffixLevenshtein C xs (y :: ys) with
    | ⟨dx, property⟩ =>
      match suffixLevenshtein C (x :: xs) ys with
      | ⟨dy, property_1⟩ =>
        match suffixLevenshtein C xs ys with
        | ⟨dxy, property_2⟩ => min (C.delete x + dx[0]) (min (C.insert y + dy[0]) (C.substitute x y + dxy[0]))
state_after: α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ (impl C (x :: xs) y ⟨levenshtein C (x :: xs) ys :: (suffixLevenshtein C xs ys).val, ⋯⟩).val[0] =
    min (C.delete x + (suffixLevenshtein C xs (y :: ys)).val[0])
      (min (C.insert y + (levenshtein C (x :: xs) ys :: (suffixLevenshtein C xs ys).val)[0])
        (C.substitute x y + (suffixLevenshtein C xs ys).val[0]))

tactic: rw [impl_cons_fst_zero]
state_before: α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ (impl C (x :: xs) y ⟨levenshtein C (x :: xs) ys :: (suffixLevenshtein C xs ys).val, ⋯⟩).val[0] =
    min (C.delete x + (suffixLevenshtein C xs (y :: ys)).val[0])
      (min (C.insert y + (levenshtein C (x :: xs) ys :: (suffixLevenshtein C xs ys).val)[0])
        (C.substitute x y + (suffixLevenshtein C xs ys).val[0]))
state_after: α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ (match impl C xs y ⟨(suffixLevenshtein C xs ys).val, ?w'⟩ with
    | ⟨r, w⟩ =>
      min (C.delete x + r[0])
        (min (C.insert y + levenshtein C (x :: xs) ys) (C.substitute x y + (suffixLevenshtein C xs ys).val[0]))) =
    min (C.delete x + (suffixLevenshtein C xs (y :: ys)).val[0])
      (min (C.insert y + (levenshtein C (x :: xs) ys :: (suffixLevenshtein C xs ys).val)[0])
        (C.substitute x y + (suffixLevenshtein C xs ys).val[0]))

case w'
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ 0 < (suffixLevenshtein C xs ys).val.length

tactic: rfl
state_before: α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ (match impl C xs y ⟨(suffixLevenshtein C xs ys).val, ?w'⟩ with
    | ⟨r, w⟩ =>
      min (C.delete x + r[0])
        (min (C.insert y + levenshtein C (x :: xs) ys) (C.substitute x y + (suffixLevenshtein C xs ys).val[0]))) =
    min (C.delete x + (suffixLevenshtein C xs (y :: ys)).val[0])
      (min (C.insert y + (levenshtein C (x :: xs) ys :: (suffixLevenshtein C xs ys).val)[0])
        (C.substitute x y + (suffixLevenshtein C xs ys).val[0]))

case w'
α : Type u_1
β : Type u_2
δ : Type u_3
inst✝¹ : AddZeroClass δ
inst✝ : Min δ
C : Cost α β δ
x : α
xs : List α
y : β
ys : List β
w : 0 < (suffixLevenshtein C (x :: xs) (y :: ys)).val.length
⊢ 0 < (suffixLevenshtein C xs ys).val.length
state_after: no goals