l3lab/ntp-mathlib huggingface dataset:
theorem sizeOf_lt_sizeOf_of_mem [SizeOf α] {x : α} {l : List α} (hx : x ∈ l) :
    SizeOf.sizeOf x < SizeOf.sizeOf l := by
  induction' l with h t ih <;> cases hx <;> rw [cons.sizeOf_spec]
  · exact lt_add_of_lt_of_nonneg (lt_one_add _) (Nat.zero_le _)
  · 

Proof state:
case cons.tail
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
inst✝ : SizeOf α
x h : α
t : List α
ih : x ∈ t → sizeOf x < sizeOf t
a✝ : Mem x t
⊢ sizeOf x < 1 + sizeOf h + sizeOf t

Next tactic:
refine lt_add_of_pos_of_le ?_ (le_of_lt (ih ‹_›))
theorem sizeOf_lt_sizeOf_of_mem [SizeOf α] {x : α} {l : List α} (hx : x ∈ l) :
    SizeOf.sizeOf x < SizeOf.sizeOf l := by
  induction' l with h t ih <;> cases hx <;> rw [cons.sizeOf_spec]
  · exact lt_add_of_lt_of_nonneg (lt_one_add _) (Nat.zero_le _)
  · refine lt_add_of_pos_of_le ?_ (le_of_lt (ih ‹_›))
    

Proof state:
case cons.tail
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
inst✝ : SizeOf α
x h : α
t : List α
ih : x ∈ t → sizeOf x < sizeOf t
a✝ : Mem x t
⊢ 0 < 1 + sizeOf h

Next tactic:
rw [add_comm]
theorem sizeOf_lt_sizeOf_of_mem [SizeOf α] {x : α} {l : List α} (hx : x ∈ l) :
    SizeOf.sizeOf x < SizeOf.sizeOf l := by
  induction' l with h t ih <;> cases hx <;> rw [cons.sizeOf_spec]
  · exact lt_add_of_lt_of_nonneg (lt_one_add _) (Nat.zero_le _)
  · refine lt_add_of_pos_of_le ?_ (le_of_lt (ih ‹_›))
    rw [add_comm]; 

Proof state:
case cons.tail
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
inst✝ : SizeOf α
x h : α
t : List α
ih : x ∈ t → sizeOf x < sizeOf t
a✝ : Mem x t
⊢ 0 < sizeOf h + 1

Next tactic:
exact succ_pos _
@[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (l : List α) (H) :
    @pmap _ _ p (fun a _ => f a) l H = map f l := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : α → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ pmap (fun a x => f a) l H = map f l

Next tactic:
induction l <;> [rfl; simp only [*, pmap, map]]
@[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (l : List α) (H) :
    @pmap _ _ p (fun a _ => f a) l H = map f l := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : α → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ pmap (fun a x => f a) l H = map f l

Next tactic:
induction l
@[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (l : List α) (H) :
    @pmap _ _ p (fun a _ => f a) l H = map f l := by
  induction l <;> [

Proof state:
case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : α → β
H : ∀ (a : α), a ∈ [] → p a
⊢ pmap (fun a x => f a) [] H = map f []

Next tactic:
rfl
@[simp]
theorem pmap_eq_map (p : α → Prop) (f : α → β) (l : List α) (H) :
    @pmap _ _ p (fun a _ => f a) l H = map f l := by
  induction l <;> [rfl; 

Proof state:
case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : α → β
head✝ : α
tail✝ : List α
tail_ih✝ : ∀ (H : ∀ (a : α), a ∈ tail✝ → p a), pmap (fun a x => f a) tail✝ H = map f tail✝
H : ∀ (a : α), a ∈ head✝ :: tail✝ → p a
⊢ pmap (fun a x => f a) (head✝ :: tail✝) H = map f (head✝ :: tail✝)

Next tactic:
simp only [*, pmap, map]
theorem pmap_congr {p q : α → Prop} {f : ∀ a, p a → β} {g : ∀ a, q a → β} (l : List α) {H₁ H₂}
    (h : ∀ a ∈ l, ∀ (h₁ h₂), f a h₁ = g a h₂) : pmap f l H₁ = pmap g l H₂ := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p q : α → Prop
f : (a : α) → p a → β
g : (a : α) → q a → β
l : List α
H₁ : ∀ (a : α), a ∈ l → p a
H₂ : ∀ (a : α), a ∈ l → q a
h : ∀ (a : α), a ∈ l → ∀ (h₁ : p a) (h₂ : q a), f a h₁ = g a h₂
⊢ pmap f l H₁ = pmap g l H₂

Next tactic:
induction' l with _ _ ih
theorem pmap_congr {p q : α → Prop} {f : ∀ a, p a → β} {g : ∀ a, q a → β} (l : List α) {H₁ H₂}
    (h : ∀ a ∈ l, ∀ (h₁ h₂), f a h₁ = g a h₂) : pmap f l H₁ = pmap g l H₂ := by
  induction' l with _ _ ih
  · 

Proof state:
case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p q : α → Prop
f : (a : α) → p a → β
g : (a : α) → q a → β
H₁ : ∀ (a : α), a ∈ [] → p a
H₂ : ∀ (a : α), a ∈ [] → q a
h : ∀ (a : α), a ∈ [] → ∀ (h₁ : p a) (h₂ : q a), f a h₁ = g a h₂
⊢ pmap f [] H₁ = pmap g [] H₂

Next tactic:
rfl
theorem pmap_congr {p q : α → Prop} {f : ∀ a, p a → β} {g : ∀ a, q a → β} (l : List α) {H₁ H₂}
    (h : ∀ a ∈ l, ∀ (h₁ h₂), f a h₁ = g a h₂) : pmap f l H₁ = pmap g l H₂ := by
  induction' l with _ _ ih
  · rfl
  · 

Proof state:
case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p q : α → Prop
f : (a : α) → p a → β
g : (a : α) → q a → β
head✝ : α
tail✝ : List α
ih :
  ∀ {H₁ : ∀ (a : α), a ∈ tail✝ → p a} {H₂ : ∀ (a : α), a ∈ tail✝ → q a},
    (∀ (a : α), a ∈ tail✝ → ∀ (h₁ : p a) (h₂ : q a), f a h₁ = g a h₂) → pmap f tail✝ H₁ = pmap g tail✝ H₂
H₁ : ∀ (a : α), a ∈ head✝ :: tail✝ → p a
H₂ : ∀ (a : α), a ∈ head✝ :: tail✝ → q a
h : ∀ (a : α), a ∈ head✝ :: tail✝ → ∀ (h₁ : p a) (h₂ : q a), f a h₁ = g a h₂
⊢ pmap f (head✝ :: tail✝) H₁ = pmap g (head✝ :: tail✝) H₂

Next tactic:
rw [pmap, pmap, h _ (mem_cons_self _ _), ih fun a ha => h a (mem_cons_of_mem _ ha)]
theorem map_pmap {p : α → Prop} (g : β → γ) (f : ∀ a, p a → β) (l H) :
    map g (pmap f l H) = pmap (fun a h => g (f a h)) l H := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
g : β → γ
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ map g (pmap f l H) = pmap (fun a h => g (f a h)) l H

Next tactic:
induction l <;> [rfl; simp only [*, pmap, map]]
theorem map_pmap {p : α → Prop} (g : β → γ) (f : ∀ a, p a → β) (l H) :
    map g (pmap f l H) = pmap (fun a h => g (f a h)) l H := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
g : β → γ
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ map g (pmap f l H) = pmap (fun a h => g (f a h)) l H

Next tactic:
induction l
theorem map_pmap {p : α → Prop} (g : β → γ) (f : ∀ a, p a → β) (l H) :
    map g (pmap f l H) = pmap (fun a h => g (f a h)) l H := by
  induction l <;> [

Proof state:
case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
g : β → γ
f : (a : α) → p a → β
H : ∀ (a : α), a ∈ [] → p a
⊢ map g (pmap f [] H) = pmap (fun a h => g (f a h)) [] H

Next tactic:
rfl
theorem map_pmap {p : α → Prop} (g : β → γ) (f : ∀ a, p a → β) (l H) :
    map g (pmap f l H) = pmap (fun a h => g (f a h)) l H := by
  induction l <;> [rfl; 

Proof state:
case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
g : β → γ
f : (a : α) → p a → β
head✝ : α
tail✝ : List α
tail_ih✝ : ∀ (H : ∀ (a : α), a ∈ tail✝ → p a), map g (pmap f tail✝ H) = pmap (fun a h => g (f a h)) tail✝ H
H : ∀ (a : α), a ∈ head✝ :: tail✝ → p a
⊢ map g (pmap f (head✝ :: tail✝) H) = pmap (fun a h => g (f a h)) (head✝ :: tail✝) H

Next tactic:
simp only [*, pmap, map]
theorem pmap_map {p : β → Prop} (g : ∀ b, p b → γ) (f : α → β) (l H) :
    pmap g (map f l) H = pmap (fun a h => g (f a) h) l fun a h => H _ (mem_map_of_mem _ h) := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : β → Prop
g : (b : β) → p b → γ
f : α → β
l : List α
H : ∀ (a : β), a ∈ map f l → p a
⊢ pmap g (map f l) H = pmap (fun a h => g (f a) h) l (_ : ∀ (a : α), a ∈ l → p (f a))

Next tactic:
induction l <;> [rfl; simp only [*, pmap, map]]
theorem pmap_map {p : β → Prop} (g : ∀ b, p b → γ) (f : α → β) (l H) :
    pmap g (map f l) H = pmap (fun a h => g (f a) h) l fun a h => H _ (mem_map_of_mem _ h) := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : β → Prop
g : (b : β) → p b → γ
f : α → β
l : List α
H : ∀ (a : β), a ∈ map f l → p a
⊢ pmap g (map f l) H = pmap (fun a h => g (f a) h) l (_ : ∀ (a : α), a ∈ l → p (f a))

Next tactic:
induction l
theorem pmap_map {p : β → Prop} (g : ∀ b, p b → γ) (f : α → β) (l H) :
    pmap g (map f l) H = pmap (fun a h => g (f a) h) l fun a h => H _ (mem_map_of_mem _ h) := by
  induction l <;> [

Proof state:
case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : β → Prop
g : (b : β) → p b → γ
f : α → β
H : ∀ (a : β), a ∈ map f [] → p a
⊢ pmap g (map f []) H = pmap (fun a h => g (f a) h) [] (_ : ∀ (a : α), a ∈ [] → p (f a))

Next tactic:
rfl
theorem pmap_map {p : β → Prop} (g : ∀ b, p b → γ) (f : α → β) (l H) :
    pmap g (map f l) H = pmap (fun a h => g (f a) h) l fun a h => H _ (mem_map_of_mem _ h) := by
  induction l <;> [rfl; 

Proof state:
case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : β → Prop
g : (b : β) → p b → γ
f : α → β
head✝ : α
tail✝ : List α
tail_ih✝ :
  ∀ (H : ∀ (a : β), a ∈ map f tail✝ → p a),
    pmap g (map f tail✝) H = pmap (fun a h => g (f a) h) tail✝ (_ : ∀ (a : α), a ∈ tail✝ → p (f a))
H : ∀ (a : β), a ∈ map f (head✝ :: tail✝) → p a
⊢ pmap g (map f (head✝ :: tail✝)) H =
    pmap (fun a h => g (f a) h) (head✝ :: tail✝) (_ : ∀ (a : α), a ∈ head✝ :: tail✝ → p (f a))

Next tactic:
simp only [*, pmap, map]
theorem pmap_eq_map_attach {p : α → Prop} (f : ∀ a, p a → β) (l H) :
    pmap f l H = l.attach.map fun x => f x.1 (H _ x.2) := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ pmap f l H = map (fun x => f ↑x (_ : p ↑x)) (attach l)

Next tactic:
rw [attach, map_pmap]
theorem pmap_eq_map_attach {p : α → Prop} (f : ∀ a, p a → β) (l H) :
    pmap f l H = l.attach.map fun x => f x.1 (H _ x.2) := by
  rw [attach, map_pmap]; 

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ pmap f l H =
    pmap (fun a h => f ↑{ val := a, property := h } (_ : p ↑{ val := a, property := h })) l
      (_ : ∀ (x : α), x ∈ l → x ∈ l)

Next tactic:
exact pmap_congr l fun _ _ _ _ => rfl
theorem attach_map_coe' (l : List α) (f : α → β) :
    (l.attach.map fun (i : {i // i ∈ l}) => f i) = l.map f := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ l : List α
f : α → β
⊢ map (fun i => f ↑i) (attach l) = map f l

Next tactic:
rw [attach, map_pmap]
theorem attach_map_coe' (l : List α) (f : α → β) :
    (l.attach.map fun (i : {i // i ∈ l}) => f i) = l.map f := by
  rw [attach, map_pmap]; 

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ l : List α
f : α → β
⊢ pmap (fun a h => f ↑{ val := a, property := h }) l (_ : ∀ (x : α), x ∈ l → x ∈ l) = map f l

Next tactic:
exact pmap_eq_map _ _ _ _
@[simp]
theorem mem_attach (l : List α) : ∀ x, x ∈ l.attach
  | ⟨a, h⟩ => by
    

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ l : List α
a : α
h : a ∈ l
⊢ { val := a, property := h } ∈ attach l

Next tactic:
have := mem_map.1 (by rw [attach_map_val] <;> exact h)
@[simp]
theorem mem_attach (l : List α) : ∀ x, x ∈ l.attach
  | ⟨a, h⟩ => by
    have := mem_map.1 (by 

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ l : List α
a : α
h : a ∈ l
⊢ ?m.294833 ∈ map ?m.294834 ?m.294835

Next tactic:
rw [attach_map_val]
@[simp]
theorem mem_attach (l : List α) : ∀ x, x ∈ l.attach
  | ⟨a, h⟩ => by
    have := mem_map.1 (by rw [attach_map_val] <;> 

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ l : List α
a : α
h : a ∈ l
⊢ ?m.294833 ∈ ?m.294848

Next tactic:
exact h
@[simp]
theorem mem_attach (l : List α) : ∀ x, x ∈ l.attach
  | ⟨a, h⟩ => by
    have := mem_map.1 (by rw [attach_map_val] <;> exact h)
    

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ l : List α
a : α
h : a ∈ l
this : ∃ a_1, a_1 ∈ attach l ∧ ↑a_1 = a
⊢ { val := a, property := h } ∈ attach l

Next tactic:
rcases this with ⟨⟨_, _⟩, m, rfl⟩
@[simp]
theorem mem_attach (l : List α) : ∀ x, x ∈ l.attach
  | ⟨a, h⟩ => by
    have := mem_map.1 (by rw [attach_map_val] <;> exact h)
    rcases this with ⟨⟨_, _⟩, m, rfl⟩
    

Proof state:
case intro.mk.intro
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ l : List α
val✝ : α
property✝ : val✝ ∈ l
m : { val := val✝, property := property✝ } ∈ attach l
h : ↑{ val := val✝, property := property✝ } ∈ l
⊢ { val := ↑{ val := val✝, property := property✝ }, property := h } ∈ attach l

Next tactic:
exact m
@[simp]
theorem mem_pmap {p : α → Prop} {f : ∀ a, p a → β} {l H b} :
    b ∈ pmap f l H ↔ ∃ (a : _) (h : a ∈ l), f a (H a h) = b := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
b : β
⊢ b ∈ pmap f l H ↔ ∃ a h, f a (_ : p a) = b

Next tactic:
simp only [pmap_eq_map_attach, mem_map, mem_attach, true_and_iff, Subtype.exists, eq_comm]
@[simp]
theorem length_pmap {p : α → Prop} {f : ∀ a, p a → β} {l H} : length (pmap f l H) = length l := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ length (pmap f l H) = length l

Next tactic:
induction l <;> [rfl; simp only [*, pmap, length]]
@[simp]
theorem length_pmap {p : α → Prop} {f : ∀ a, p a → β} {l H} : length (pmap f l H) = length l := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ length (pmap f l H) = length l

Next tactic:
induction l
@[simp]
theorem length_pmap {p : α → Prop} {f : ∀ a, p a → β} {l H} : length (pmap f l H) = length l := by
  induction l <;> [

Proof state:
case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
H : ∀ (a : α), a ∈ [] → p a
⊢ length (pmap f [] H) = length []

Next tactic:
rfl
@[simp]
theorem length_pmap {p : α → Prop} {f : ∀ a, p a → β} {l H} : length (pmap f l H) = length l := by
  induction l <;> [rfl; 

Proof state:
case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
head✝ : α
tail✝ : List α
tail_ih✝ : ∀ {H : ∀ (a : α), a ∈ tail✝ → p a}, length (pmap f tail✝ H) = length tail✝
H : ∀ (a : α), a ∈ head✝ :: tail✝ → p a
⊢ length (pmap f (head✝ :: tail✝) H) = length (head✝ :: tail✝)

Next tactic:
simp only [*, pmap, length]
@[simp]
theorem pmap_eq_nil {p : α → Prop} {f : ∀ a, p a → β} {l H} : pmap f l H = [] ↔ l = [] := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
H : ∀ (a : α), a ∈ l → p a
⊢ pmap f l H = [] ↔ l = []

Next tactic:
rw [← length_eq_zero, length_pmap, length_eq_zero]
theorem getLast_pmap {α β : Type*} (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) := by
  

Proof state:
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
p : α → Prop
f : (a : α) → p a → β
l : List α
hl₁ : ∀ (a : α), a ∈ l → p a
hl₂ : l ≠ []
⊢ getLast (pmap f l hl₁) (_ : ¬pmap f l hl₁ = []) = f (getLast l hl₂) (_ : p (getLast l hl₂))

Next tactic:
induction' l with l_hd l_tl l_ih
theorem getLast_pmap {α β : Type*} (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) := by
  induction' l with l_hd l_tl l_ih
  · 

Proof state:
case nil
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
p : α → Prop
f : (a : α) → p a → β
hl₁ : ∀ (a : α), a ∈ [] → p a
hl₂ : [] ≠ []
⊢ getLast (pmap f [] hl₁) (_ : ¬pmap f [] hl₁ = []) = f (getLast [] hl₂) (_ : p (getLast [] hl₂))

Next tactic:
apply (hl₂ rfl).elim
theorem getLast_pmap {α β : Type*} (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) := by
  induction' l with l_hd l_tl l_ih
  · apply (hl₂ rfl).elim
  · 

Proof state:
case cons
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
p : α → Prop
f : (a : α) → p a → β
l_hd : α
l_tl : List α
l_ih :
  ∀ (hl₁ : ∀ (a : α), a ∈ l_tl → p a) (hl₂ : l_tl ≠ []),
    getLast (pmap f l_tl hl₁) (_ : ¬pmap f l_tl hl₁ = []) = f (getLast l_tl hl₂) (_ : p (getLast l_tl hl₂))
hl₁ : ∀ (a : α), a ∈ l_hd :: l_tl → p a
hl₂ : l_hd :: l_tl ≠ []
⊢ getLast (pmap f (l_hd :: l_tl) hl₁) (_ : ¬pmap f (l_hd :: l_tl) hl₁ = []) =
    f (getLast (l_hd :: l_tl) hl₂) (_ : p (getLast (l_hd :: l_tl) hl₂))

Next tactic:
by_cases hl_tl : l_tl = []
theorem getLast_pmap {α β : Type*} (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) := by
  induction' l with l_hd l_tl l_ih
  · apply (hl₂ rfl).elim
  · by_cases hl_tl : l_tl = []
    · 

Proof state:
case pos
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
p : α → Prop
f : (a : α) → p a → β
l_hd : α
l_tl : List α
l_ih :
  ∀ (hl₁ : ∀ (a : α), a ∈ l_tl → p a) (hl₂ : l_tl ≠ []),
    getLast (pmap f l_tl hl₁) (_ : ¬pmap f l_tl hl₁ = []) = f (getLast l_tl hl₂) (_ : p (getLast l_tl hl₂))
hl₁ : ∀ (a : α), a ∈ l_hd :: l_tl → p a
hl₂ : l_hd :: l_tl ≠ []
hl_tl : l_tl = []
⊢ getLast (pmap f (l_hd :: l_tl) hl₁) (_ : ¬pmap f (l_hd :: l_tl) hl₁ = []) =
    f (getLast (l_hd :: l_tl) hl₂) (_ : p (getLast (l_hd :: l_tl) hl₂))

Next tactic:
simp [hl_tl]
theorem getLast_pmap {α β : Type*} (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) := by
  induction' l with l_hd l_tl l_ih
  · apply (hl₂ rfl).elim
  · by_cases hl_tl : l_tl = []
    · simp [hl_tl]
    · 

Proof state:
case neg
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
p : α → Prop
f : (a : α) → p a → β
l_hd : α
l_tl : List α
l_ih :
  ∀ (hl₁ : ∀ (a : α), a ∈ l_tl → p a) (hl₂ : l_tl ≠ []),
    getLast (pmap f l_tl hl₁) (_ : ¬pmap f l_tl hl₁ = []) = f (getLast l_tl hl₂) (_ : p (getLast l_tl hl₂))
hl₁ : ∀ (a : α), a ∈ l_hd :: l_tl → p a
hl₂ : l_hd :: l_tl ≠ []
hl_tl : ¬l_tl = []
⊢ getLast (pmap f (l_hd :: l_tl) hl₁) (_ : ¬pmap f (l_hd :: l_tl) hl₁ = []) =
    f (getLast (l_hd :: l_tl) hl₂) (_ : p (getLast (l_hd :: l_tl) hl₂))

Next tactic:
simp only [pmap]
theorem getLast_pmap {α β : Type*} (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) := by
  induction' l with l_hd l_tl l_ih
  · apply (hl₂ rfl).elim
  · by_cases hl_tl : l_tl = []
    · simp [hl_tl]
    · simp only [pmap]
      

Proof state:
case neg
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
p : α → Prop
f : (a : α) → p a → β
l_hd : α
l_tl : List α
l_ih :
  ∀ (hl₁ : ∀ (a : α), a ∈ l_tl → p a) (hl₂ : l_tl ≠ []),
    getLast (pmap f l_tl hl₁) (_ : ¬pmap f l_tl hl₁ = []) = f (getLast l_tl hl₂) (_ : p (getLast l_tl hl₂))
hl₁ : ∀ (a : α), a ∈ l_hd :: l_tl → p a
hl₂ : l_hd :: l_tl ≠ []
hl_tl : ¬l_tl = []
⊢ getLast (f l_hd (_ : p l_hd) :: pmap f l_tl (_ : ∀ (x : α), x ∈ l_tl → p x))
      (_ : f l_hd (_ : p l_hd) :: pmap f l_tl (_ : ∀ (x : α), x ∈ l_tl → p x) ≠ []) =
    f (getLast (l_hd :: l_tl) hl₂) (_ : p (getLast (l_hd :: l_tl) hl₂))

Next tactic:
rw [getLast_cons, l_ih _ hl_tl]
theorem getLast_pmap {α β : Type*} (p : α → Prop) (f : ∀ a, p a → β) (l : List α)
    (hl₁ : ∀ a ∈ l, p a) (hl₂ : l ≠ []) :
    (l.pmap f hl₁).getLast (mt List.pmap_eq_nil.1 hl₂) =
      f (l.getLast hl₂) (hl₁ _ (List.getLast_mem hl₂)) := by
  induction' l with l_hd l_tl l_ih
  · apply (hl₂ rfl).elim
  · by_cases hl_tl : l_tl = []
    · simp [hl_tl]
    · simp only [pmap]
      rw [getLast_cons, l_ih _ hl_tl]
      

Proof state:
case neg
ι : Type u_1
α✝ : Type u
β✝ : Type v
γ : Type w
l₁ l₂ : List α✝
α : Type u_2
β : Type u_3
p : α → Prop
f : (a : α) → p a → β
l_hd : α
l_tl : List α
l_ih :
  ∀ (hl₁ : ∀ (a : α), a ∈ l_tl → p a) (hl₂ : l_tl ≠ []),
    getLast (pmap f l_tl hl₁) (_ : ¬pmap f l_tl hl₁ = []) = f (getLast l_tl hl₂) (_ : p (getLast l_tl hl₂))
hl₁ : ∀ (a : α), a ∈ l_hd :: l_tl → p a
hl₂ : l_hd :: l_tl ≠ []
hl_tl : ¬l_tl = []
⊢ f (getLast l_tl hl_tl) (_ : p (getLast l_tl hl_tl)) =
    f (getLast (l_hd :: l_tl) hl₂) (_ : p (getLast (l_hd :: l_tl) hl₂))

Next tactic:
simp only [getLast_cons hl_tl]
theorem get?_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) (n : ℕ) :
    get? (pmap f l h) n = Option.pmap f (get? l n) fun x H => h x (get?_mem H) := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
h : ∀ (a : α), a ∈ l → p a
n : ℕ
⊢ get? (pmap f l h) n = Option.pmap f (get? l n) (_ : ∀ (x : α), x ∈ get? l n → p x)

Next tactic:
induction' l with hd tl hl generalizing n
theorem get?_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) (n : ℕ) :
    get? (pmap f l h) n = Option.pmap f (get? l n) fun x H => h x (get?_mem H) := by
  induction' l with hd tl hl generalizing n
  · 

Proof state:
case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
h : ∀ (a : α), a ∈ [] → p a
n : ℕ
⊢ get? (pmap f [] h) n = Option.pmap f (get? [] n) (_ : ∀ (x : α), x ∈ get? [] n → p x)

Next tactic:
simp
theorem get?_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) (n : ℕ) :
    get? (pmap f l h) n = Option.pmap f (get? l n) fun x H => h x (get?_mem H) := by
  induction' l with hd tl hl generalizing n
  · simp
  · 

Proof state:
case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
hd : α
tl : List α
hl :
  ∀ (h : ∀ (a : α), a ∈ tl → p a) (n : ℕ),
    get? (pmap f tl h) n = Option.pmap f (get? tl n) (_ : ∀ (x : α), x ∈ get? tl n → p x)
h : ∀ (a : α), a ∈ hd :: tl → p a
n : ℕ
⊢ get? (pmap f (hd :: tl) h) n = Option.pmap f (get? (hd :: tl) n) (_ : ∀ (x : α), x ∈ get? (hd :: tl) n → p x)

Next tactic:
cases' n with n
theorem get?_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) (n : ℕ) :
    get? (pmap f l h) n = Option.pmap f (get? l n) fun x H => h x (get?_mem H) := by
  induction' l with hd tl hl generalizing n
  · simp
  · cases' n with n
    · 

Proof state:
case cons.zero
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
hd : α
tl : List α
hl :
  ∀ (h : ∀ (a : α), a ∈ tl → p a) (n : ℕ),
    get? (pmap f tl h) n = Option.pmap f (get? tl n) (_ : ∀ (x : α), x ∈ get? tl n → p x)
h : ∀ (a : α), a ∈ hd :: tl → p a
⊢ get? (pmap f (hd :: tl) h) zero = Option.pmap f (get? (hd :: tl) zero) (_ : ∀ (x : α), x ∈ get? (hd :: tl) zero → p x)

Next tactic:
simp
theorem get?_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) (n : ℕ) :
    get? (pmap f l h) n = Option.pmap f (get? l n) fun x H => h x (get?_mem H) := by
  induction' l with hd tl hl generalizing n
  · simp
  · cases' n with n
    · simp
    · 

Proof state:
case cons.succ
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
hd : α
tl : List α
hl :
  ∀ (h : ∀ (a : α), a ∈ tl → p a) (n : ℕ),
    get? (pmap f tl h) n = Option.pmap f (get? tl n) (_ : ∀ (x : α), x ∈ get? tl n → p x)
h : ∀ (a : α), a ∈ hd :: tl → p a
n : ℕ
⊢ get? (pmap f (hd :: tl) h) (succ n) =
    Option.pmap f (get? (hd :: tl) (succ n)) (_ : ∀ (x : α), x ∈ get? (hd :: tl) (succ n) → p x)

Next tactic:
simp [hl]
theorem get_pmap {p : α → Prop} (f : ∀ a, p a → β) {l : List α} (h : ∀ a ∈ l, p a) {n : ℕ}
    (hn : n < (pmap f l h).length) :
    get (pmap f l h) ⟨n, hn⟩ =
      f (get l ⟨n, @length_pmap _ _ p f l h ▸ hn⟩)
        (h _ (get_mem l n (@length_pmap _ _ p f l h ▸ hn))) := by
  

Proof state:
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Prop
f : (a : α) → p a → β
l : List α
h : ∀ (a : α), a ∈ l → p a
n : ℕ
hn : n < length (pmap f l h)
⊢ get (pmap f l h) { val := n, isLt := hn } =
    f (get l { val := n, isLt := (_ : n < length l) }) (_ : p (get l { val := n, isLt := (_ : n < length l) }))

Next tactic:
induction' l with hd tl hl generalizing n