Theorem: List.extractP_eq_find?_eraseP
File: .lake/packages/batteries/Batteries/Data/List/Lemmas.lean

tactic: exact go #[] _ rfl
state_before: α : Type u_1
p : α → Bool
l : List α
⊢ extractP p l = (find? p l, eraseP p l)
state_after: no goals

tactic: simp [extractP.go, find?, eraseP, h]
state_before: α : Type u_1
p : α → Bool
l : List α
acc : Array α
h : l = acc.data ++ []
⊢ extractP.go p l [] acc = (find? p [], acc.data ++ eraseP p [])
state_after: no goals

tactic: simp [extractP.go, find?, eraseP]
state_before: α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
⊢ l = acc.data ++ x :: xs → extractP.go p l (x :: xs) acc = (find? p (x :: xs), acc.data ++ eraseP p (x :: xs))
state_after: α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
⊢ l = acc.data ++ x :: xs →
    (bif p x then (some x, acc.data ++ xs) else extractP.go p l xs (acc.push x)) =
      (match p x with
        | true => some x
        | false => find? p xs,
        acc.data ++ bif p x then xs else x :: eraseP p xs)

tactic: cases p x <;> simp
state_before: α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
⊢ l = acc.data ++ x :: xs →
    (bif p x then (some x, acc.data ++ xs) else extractP.go p l xs (acc.push x)) =
      (match p x with
        | true => some x
        | false => find? p xs,
        acc.data ++ bif p x then xs else x :: eraseP p xs)
state_after: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
⊢ l = acc.data ++ x :: xs → extractP.go p l xs (acc.push x) = (find? p xs, acc.data ++ x :: eraseP p xs)

tactic: intro h
state_before: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
⊢ l = acc.data ++ x :: xs → extractP.go p l xs (acc.push x) = (find? p xs, acc.data ++ x :: eraseP p xs)
state_after: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ extractP.go p l xs (acc.push x) = (find? p xs, acc.data ++ x :: eraseP p xs)

tactic: rw [go _ xs]
state_before: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ extractP.go p l xs (acc.push x) = (find? p xs, acc.data ++ x :: eraseP p xs)
state_after: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ (find? p xs, (acc.push x).data ++ eraseP p xs) = (find? p xs, acc.data ++ x :: eraseP p xs)

case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ l = (acc.push x).data ++ xs

tactic: {simp}
state_before: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ (find? p xs, (acc.push x).data ++ eraseP p xs) = (find? p xs, acc.data ++ x :: eraseP p xs)

case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ l = (acc.push x).data ++ xs
state_after: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ l = (acc.push x).data ++ xs

tactic: simp [h]
state_before: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ l = (acc.push x).data ++ xs
state_after: no goals

tactic: simp
state_before: case false
α : Type u_1
p : α → Bool
l : List α
acc : Array α
x : α
xs : List α
h : l = acc.data ++ x :: xs
⊢ (find? p xs, (acc.push x).data ++ eraseP p xs) = (find? p xs, acc.data ++ x :: eraseP p xs)
state_after: no goals