Theorem: List.findIdx_lt_length_of_exists
File: .lake/packages/batteries/Batteries/Data/List/Lemmas.lean

tactic: simp_all
state_before: case nil
α : Type u_1
p : α → Bool
h : ∃ x, x ∈ [] ∧ p x = true
⊢ findIdx p [] < [].length
state_after: no goals

tactic: by_cases p x
state_before: case cons
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : (∃ x, x ∈ xs ∧ p x = true) → findIdx p xs < xs.length
h : ∃ x_1, x_1 ∈ x :: xs ∧ p x_1 = true
⊢ findIdx p (x :: xs) < (x :: xs).length
state_after: case pos
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : (∃ x, x ∈ xs ∧ p x = true) → findIdx p xs < xs.length
h : ∃ x_1, x_1 ∈ x :: xs ∧ p x_1 = true
h✝ : p x = true
⊢ findIdx p (x :: xs) < (x :: xs).length

case neg
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : (∃ x, x ∈ xs ∧ p x = true) → findIdx p xs < xs.length
h : ∃ x_1, x_1 ∈ x :: xs ∧ p x_1 = true
h✝ : ¬p x = true
⊢ findIdx p (x :: xs) < (x :: xs).length

tactic: simp_all only [forall_exists_index, and_imp, mem_cons, exists_eq_or_imp, true_or,
  findIdx_cons, cond_true, length_cons]
state_before: case pos
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : (∃ x, x ∈ xs ∧ p x = true) → findIdx p xs < xs.length
h : ∃ x_1, x_1 ∈ x :: xs ∧ p x_1 = true
h✝ : p x = true
⊢ findIdx p (x :: xs) < (x :: xs).length
state_after: case pos
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h✝ : p x = true
⊢ 0 < xs.length + 1

tactic: apply Nat.succ_pos
state_before: case pos
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h✝ : p x = true
⊢ 0 < xs.length + 1
state_after: no goals

tactic: simp_all [findIdx_cons]
state_before: case neg
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : (∃ x, x ∈ xs ∧ p x = true) → findIdx p xs < xs.length
h : ∃ x_1, x_1 ∈ x :: xs ∧ p x_1 = true
h✝ : ¬p x = true
⊢ findIdx p (x :: xs) < (x :: xs).length
state_after: case neg
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h : ∃ a, a ∈ xs ∧ p a = true
h✝ : p x = false
⊢ findIdx p xs + 1 < xs.length + 1

tactic: refine Nat.succ_lt_succ ?_
state_before: case neg
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h : ∃ a, a ∈ xs ∧ p a = true
h✝ : p x = false
⊢ findIdx p xs + 1 < xs.length + 1
state_after: case neg
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h : ∃ a, a ∈ xs ∧ p a = true
h✝ : p x = false
⊢ findIdx p xs < xs.length

tactic: obtain ⟨x', m', h'⟩ := h
state_before: case neg
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h : ∃ a, a ∈ xs ∧ p a = true
h✝ : p x = false
⊢ findIdx p xs < xs.length
state_after: case neg.intro.intro
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h✝ : p x = false
x' : α
m' : x' ∈ xs
h' : p x' = true
⊢ findIdx p xs < xs.length

tactic: exact ih x' m' h'
state_before: case neg.intro.intro
α : Type u_1
p : α → Bool
x : α
xs : List α
ih : ∀ (x : α), x ∈ xs → p x = true → findIdx p xs < xs.length
h✝ : p x = false
x' : α
m' : x' ∈ xs
h' : p x' = true
⊢ findIdx p xs < xs.length
state_after: no goals