Theorem: List.filterMap_congr
File: Mathlib/Data/List/Basic.lean

tactic: induction' l with a l ih <;> simp [filterMap_cons]
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
l : List α
h : ∀ (x : α), x ∈ l → f x = g x
⊢ filterMap f l = filterMap g l
state_after: case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
⊢ (match f a with
    | none => filterMap f l
    | some b => b :: filterMap f l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l

tactic: simp [ih (fun x hx ↦ h x (List.mem_cons_of_mem a hx))]
state_before: case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
⊢ (match f a with
    | none => filterMap f l
    | some b => b :: filterMap f l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l
state_after: case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
⊢ (match f a with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l

tactic: cases' hfa : f a with b
state_before: case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
⊢ (match f a with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l
state_after: case cons.none
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
hfa : f a = none
⊢ (match none with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l

case cons.some
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
b : β
hfa : f a = some b
⊢ (match some b with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l

tactic: have : g a = none := Eq.symm (by simpa [hfa] using h a (by simp))
state_before: case cons.none
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
hfa : f a = none
⊢ (match none with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l
state_after: case cons.none
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
hfa : f a = none
this : g a = none
⊢ (match none with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l

tactic: simp [this]
state_before: case cons.none
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
hfa : f a = none
this : g a = none
⊢ (match none with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l
state_after: no goals

tactic: simpa [hfa] using h a (by simp)
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
hfa : f a = none
⊢ none = g a
state_after: no goals

tactic: simp
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
hfa : f a = none
⊢ a ∈ a :: l
state_after: no goals

tactic: have : g a = some b := Eq.symm (by simpa [hfa] using h a (by simp))
state_before: case cons.some
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
b : β
hfa : f a = some b
⊢ (match some b with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l
state_after: case cons.some
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
b : β
hfa : f a = some b
this : g a = some b
⊢ (match some b with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l

tactic: simp [this]
state_before: case cons.some
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
b : β
hfa : f a = some b
this : g a = some b
⊢ (match some b with
    | none => filterMap g l
    | some b => b :: filterMap g l) =
    match g a with
    | none => filterMap g l
    | some b => b :: filterMap g l
state_after: no goals

tactic: simpa [hfa] using h a (by simp)
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
b : β
hfa : f a = some b
⊢ some b = g a
state_after: no goals

tactic: simp
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
f g : α → Option β
a : α
l : List α
ih : (∀ (x : α), x ∈ l → f x = g x) → filterMap f l = filterMap g l
h : ∀ (x : α), x ∈ a :: l → f x = g x
b : β
hfa : f a = some b
⊢ a ∈ a :: l
state_after: no goals