Theorem: AList.insertRec_insert
File: Mathlib/Data/List/AList.lean

tactic: cases' l with l hl
state_before: α : Type u
β : α → Type v
inst✝ : DecidableEq α
C : AList β → Sort u_1
H0 : C ∅
IH : (a : α) → (b : β a) → (l : AList β) → ¬a ∈ l → C l → C (insert a b l)
c : Sigma β
l : AList β
h : ¬c.fst ∈ l
⊢ insertRec H0 IH (insert c.fst c.snd l) = IH c.fst c.snd l h (insertRec H0 IH l)

tactic: suffices HEq (@insertRec α β _ C H0 IH ⟨c :: l, nodupKeys_cons.2 ⟨h, hl⟩⟩)
    (IH c.1 c.2 ⟨l, hl⟩ h (@insertRec α β _ C H0 IH ⟨l, hl⟩)) by
  cases c
  apply eq_of_heq
  convert this <;> rw [insert_of_neg h]
state_before: case mk
α : Type u
β : α → Type v
inst✝ : DecidableEq α
C : AList β → Sort u_1
H0 : C ∅
IH : (a : α) → (b : β a) → (l : AList β) → ¬a ∈ l → C l → C (insert a b l)
c : Sigma β
l : List (Sigma β)
hl : NodupKeys l
h : ¬c.fst ∈ { entries := l, nodupKeys := hl }
⊢ insertRec H0 IH (insert c.fst c.snd { entries := l, nodupKeys := hl }) =
    IH c.fst c.snd { entries := l, nodupKeys := hl } h (insertRec H0 IH { entries := l, nodupKeys := hl })

tactic: rw [insertRec]
state_before: case mk
α : Type u
β : α → Type v
inst✝ : DecidableEq α
C : AList β → Sort u_1
H0 : C ∅
IH : (a : α) → (b : β a) → (l : AList β) → ¬a ∈ l → C l → C (insert a b l)
c : Sigma β
l : List (Sigma β)
hl : NodupKeys l
h : ¬c.fst ∈ { entries := l, nodupKeys := hl }
⊢ HEq (insertRec H0 IH { entries := c :: l, nodupKeys := (_ : NodupKeys (c :: l)) })
    (IH c.fst c.snd { entries := l, nodupKeys := hl } h (insertRec H0 IH { entries := l, nodupKeys := hl }))

tactic: apply cast_heq
state_before: case mk
α : Type u
β : α → Type v
inst✝ : DecidableEq α
C : AList β → Sort u_1
H0 : C ∅
IH : (a : α) → (b : β a) → (l : AList β) → ¬a ∈ l → C l → C (insert a b l)
c : Sigma β
l : List (Sigma β)
hl : NodupKeys l
h : ¬c.fst ∈ { entries := l, nodupKeys := hl }
⊢ HEq
    (Eq.mpr
      (_ :
        C { entries := c :: l, nodupKeys := (_ : NodupKeys (c :: l)) } =
          C (insert c.fst c.snd { entries := l, nodupKeys := (_ : NodupKeys l) }))
      (IH c.fst c.snd { entries := l, nodupKeys := (_ : NodupKeys l) }
        (_ : ¬c.fst ∈ List.keys { entries := l, nodupKeys := (_ : NodupKeys l) }.entries)
        (insertRec H0 IH { entries := l, nodupKeys := (_ : NodupKeys l) })))
    (IH c.fst c.snd { entries := l, nodupKeys := hl } h (insertRec H0 IH { entries := l, nodupKeys := hl }))

tactic: cases c
state_before: α : Type u
β : α → Type v
inst✝ : DecidableEq α
C : AList β → Sort u_1
H0 : C ∅
IH : (a : α) → (b : β a) → (l : AList β) → ¬a ∈ l → C l → C (insert a b l)
c : Sigma β
l : List (Sigma β)
hl : NodupKeys l
h : ¬c.fst ∈ { entries := l, nodupKeys := hl }
this :
  HEq (insertRec H0 IH { entries := c :: l, nodupKeys := (_ : NodupKeys (c :: l)) })
    (IH c.fst c.snd { entries := l, nodupKeys := hl } h (insertRec H0 IH { entries := l, nodupKeys := hl }))
⊢ insertRec H0 IH (insert c.fst c.snd { entries := l, nodupKeys := hl }) =
    IH c.fst c.snd { entries := l, nodupKeys := hl } h (insertRec H0 IH { entries := l, nodupKeys := hl })

tactic: apply eq_of_heq
state_before: case mk
α : Type u
β : α → Type v
inst✝ : DecidableEq α
C : AList β → Sort u_1
H0 : C ∅
IH : (a : α) → (b : β a) → (l : AList β) → ¬a ∈ l → C l → C (insert a b l)
l : List (Sigma β)
hl : NodupKeys l
fst✝ : α
snd✝ : β fst✝
h : ¬{ fst := fst✝, snd := snd✝ }.fst ∈ { entries := l, nodupKeys := hl }
this :
  HEq
    (insertRec H0 IH
      { entries := { fst := fst✝, snd := snd✝ } :: l,
        nodupKeys := (_ : NodupKeys ({ fst := fst✝, snd := snd✝ } :: l)) })
    (IH { fst := fst✝, snd := snd✝ }.fst { fst := fst✝, snd := snd✝ }.snd { entries := l, nodupKeys := hl } h
      (insertRec H0 IH { entries := l, nodupKeys := hl }))
⊢ insertRec H0 IH
      (insert { fst := fst✝, snd := snd✝ }.fst { fst := fst✝, snd := snd✝ }.snd { entries := l, nodupKeys := hl }) =
    IH { fst := fst✝, snd := snd✝ }.fst { fst := fst✝, snd := snd✝ }.snd { entries := l, nodupKeys := hl } h
      (insertRec H0 IH { entries := l, nodupKeys := hl })

tactic: convert this <;> rw [insert_of_neg h]
state_before: case mk.h
α : Type u
β : α → Type v
inst✝ : DecidableEq α
C : AList β → Sort u_1
H0 : C ∅
IH : (a : α) → (b : β a) → (l : AList β) → ¬a ∈ l → C l → C (insert a b l)
l : List (Sigma β)
hl : NodupKeys l
fst✝ : α
snd✝ : β fst✝
h : ¬{ fst := fst✝, snd := snd✝ }.fst ∈ { entries := l, nodupKeys := hl }
this :
  HEq
    (insertRec H0 IH
      { entries := { fst := fst✝, snd := snd✝ } :: l,
        nodupKeys := (_ : NodupKeys ({ fst := fst✝, snd := snd✝ } :: l)) })
    (IH { fst := fst✝, snd := snd✝ }.fst { fst := fst✝, snd := snd✝ }.snd { entries := l, nodupKeys := hl } h
      (insertRec H0 IH { entries := l, nodupKeys := hl }))
⊢ HEq
    (insertRec H0 IH
      (insert { fst := fst✝, snd := snd✝ }.fst { fst := fst✝, snd := snd✝ }.snd { entries := l, nodupKeys := hl }))
    (IH { fst := fst✝, snd := snd✝ }.fst { fst := fst✝, snd := snd✝ }.snd { entries := l, nodupKeys := hl } h
      (insertRec H0 IH { entries := l, nodupKeys := hl }))