Theorem: List.findIdx?_of_eq_none
File: .lake/packages/batteries/Batteries/Data/List/Lemmas.lean

tactic: intro i
state_before: α : Type u_1
xs : List α
p : α → Bool
w : findIdx? p xs = none
⊢ ∀ (i : Nat),
    match xs.get? i with
    | some a => ¬p a = true
    | none => true = true
state_after: α : Type u_1
xs : List α
p : α → Bool
w : findIdx? p xs = none
i : Nat
⊢ match xs.get? i with
  | some a => ¬p a = true
  | none => true = true

tactic: induction xs generalizing i with
| nil => simp_all
| cons x xs ih =>
  simp_all only [Bool.not_eq_true, findIdx?_cons, Nat.zero_add, findIdx?_succ]
  cases i with
  | zero =>
    split at w <;> simp_all
  | succ i =>
    simp only [get?_cons_succ]
    apply ih
    split at w <;> simp_all
state_before: α : Type u_1
xs : List α
p : α → Bool
w : findIdx? p xs = none
i : Nat
⊢ match xs.get? i with
  | some a => ¬p a = true
  | none => true = true
state_after: no goals

tactic: simp_all
state_before: case nil
α : Type u_1
p : α → Bool
w : findIdx? p [] = none
i : Nat
⊢ match [].get? i with
  | some a => ¬p a = true
  | none => true = true
state_after: no goals

tactic: simp_all only [Bool.not_eq_true, findIdx?_cons, Nat.zero_add, findIdx?_succ]
state_before: case cons
α : Type u_1
p : α → Bool
x : α
xs : List α
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => ¬p a = true
      | none => true = true
w : findIdx? p (x :: xs) = none
i : Nat
⊢ match (x :: xs).get? i with
  | some a => ¬p a = true
  | none => true = true
state_after: case cons
α : Type u_1
p : α → Bool
x : α
xs : List α
i : Nat
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
⊢ match (x :: xs).get? i with
  | some a => p a = false
  | none => True

tactic: cases i with
| zero =>
  split at w <;> simp_all
| succ i =>
  simp only [get?_cons_succ]
  apply ih
  split at w <;> simp_all
state_before: case cons
α : Type u_1
p : α → Bool
x : α
xs : List α
i : Nat
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
⊢ match (x :: xs).get? i with
  | some a => p a = false
  | none => True
state_after: no goals

tactic: split at w <;> simp_all
state_before: case cons.zero
α : Type u_1
p : α → Bool
x : α
xs : List α
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
⊢ match (x :: xs).get? 0 with
  | some a => p a = false
  | none => True
state_after: no goals

tactic: simp only [get?_cons_succ]
state_before: case cons.succ
α : Type u_1
p : α → Bool
x : α
xs : List α
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
i : Nat
⊢ match (x :: xs).get? (i + 1) with
  | some a => p a = false
  | none => True
state_after: case cons.succ
α : Type u_1
p : α → Bool
x : α
xs : List α
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
i : Nat
⊢ match xs.get? i with
  | some a => p a = false
  | none => True

tactic: apply ih
state_before: case cons.succ
α : Type u_1
p : α → Bool
x : α
xs : List α
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
i : Nat
⊢ match xs.get? i with
  | some a => p a = false
  | none => True
state_after: case cons.succ.w
α : Type u_1
p : α → Bool
x : α
xs : List α
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
i : Nat
⊢ findIdx? p xs = none

tactic: split at w <;> simp_all
state_before: case cons.succ.w
α : Type u_1
p : α → Bool
x : α
xs : List α
ih :
  findIdx? p xs = none →
    ∀ (i : Nat),
      match xs.get? i with
      | some a => p a = false
      | none => True
w : (if p x = true then some 0 else Option.map (fun i => i + 1) (findIdx? p xs)) = none
i : Nat
⊢ findIdx? p xs = none
state_after: no goals