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

tactic: induction' as with a' as ih
state_before: ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a : α
as : List α
h : a ∈ as
⊢ lookup a (map (fun x => (x, f x)) as) = some (f a)
state_after: case nil
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a : α
h : a ∈ []
⊢ lookup a (map (fun x => (x, f x)) []) = some (f a)

case cons
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
⊢ lookup a (map (fun x => (x, f x)) (a' :: as)) = some (f a)

tactic: exact (List.not_mem_nil _ h).elim
state_before: case nil
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a : α
h : a ∈ []
⊢ lookup a (map (fun x => (x, f x)) []) = some (f a)
state_after: no goals

tactic: by_cases ha : a = a'
state_before: case cons
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
⊢ lookup a (map (fun x => (x, f x)) (a' :: as)) = some (f a)
state_after: case pos
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
ha : a = a'
⊢ lookup a (map (fun x => (x, f x)) (a' :: as)) = some (f a)

case neg
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
ha : ¬a = a'
⊢ lookup a (map (fun x => (x, f x)) (a' :: as)) = some (f a)

tactic: simp [ha, lookup_cons]
state_before: case pos
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
ha : a = a'
⊢ lookup a (map (fun x => (x, f x)) (a' :: as)) = some (f a)
state_after: no goals

tactic: simp [lookup_cons, beq_false_of_ne ha]
state_before: case neg
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
ha : ¬a = a'
⊢ lookup a (map (fun x => (x, f x)) (a' :: as)) = some (f a)
state_after: case neg
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
ha : ¬a = a'
⊢ lookup a (map (fun x => (x, f x)) as) = some (f a)

tactic: exact ih (List.mem_of_ne_of_mem ha h)
state_before: case neg
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
inst✝¹ : BEq α
inst✝ : LawfulBEq α
f : α → β
a a' : α
as : List α
ih : a ∈ as → lookup a (map (fun x => (x, f x)) as) = some (f a)
h : a ∈ a' :: as
ha : ¬a = a'
⊢ lookup a (map (fun x => (x, f x)) as) = some (f a)
state_after: no goals