Theorem: List.findIdx_eq_length
File: Mathlib/Data/List/Indexes.lean

tactic: simp_all
state_before: case nil
α : Type u
β : Type v
p : α → Bool
⊢ findIdx p [] = [].length ↔ ∀ x ∈ [], ¬p x = true
state_after: no goals

tactic: rw [findIdx_cons, length_cons]
state_before: case cons
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
⊢ findIdx p (x :: xs) = (x :: xs).length ↔ ∀ x_1 ∈ x :: xs, ¬p x_1 = true
state_after: case cons
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
⊢ (bif p x then 0 else findIdx p xs + 1) = xs.length + 1 ↔ ∀ x_1 ∈ x :: xs, ¬p x_1 = true

tactic: constructor <;> intro h
state_before: case cons
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
⊢ (bif p x then 0 else findIdx p xs + 1) = xs.length + 1 ↔ ∀ x_1 ∈ x :: xs, ¬p x_1 = true
state_after: case cons.mp
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : (bif p x then 0 else findIdx p xs + 1) = xs.length + 1
⊢ ∀ x_1 ∈ x :: xs, ¬p x_1 = true

case cons.mpr
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : ∀ x_1 ∈ x :: xs, ¬p x_1 = true
⊢ (bif p x then 0 else findIdx p xs + 1) = xs.length + 1

tactic: have : ¬p x := by contrapose h; simp_all
state_before: case cons.mp
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : (bif p x then 0 else findIdx p xs + 1) = xs.length + 1
⊢ ∀ x_1 ∈ x :: xs, ¬p x_1 = true
state_after: case cons.mp
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : (bif p x then 0 else findIdx p xs + 1) = xs.length + 1
this : ¬p x = true
⊢ ∀ x_1 ∈ x :: xs, ¬p x_1 = true

tactic: simp_all
state_before: case cons.mp
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : (bif p x then 0 else findIdx p xs + 1) = xs.length + 1
this : ¬p x = true
⊢ ∀ x_1 ∈ x :: xs, ¬p x_1 = true
state_after: no goals

tactic: contrapose h
state_before: α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : (bif p x then 0 else findIdx p xs + 1) = xs.length + 1
⊢ ¬p x = true
state_after: α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : ¬¬p x = true
⊢ ¬(bif p x then 0 else findIdx p xs + 1) = xs.length + 1

tactic: simp_all
state_before: α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : ¬¬p x = true
⊢ ¬(bif p x then 0 else findIdx p xs + 1) = xs.length + 1
state_after: no goals

tactic: simp_rw [h x (mem_cons_self x xs), cond_false, Nat.succ.injEq, ih]
state_before: case cons.mpr
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : ∀ x_1 ∈ x :: xs, ¬p x_1 = true
⊢ (bif p x then 0 else findIdx p xs + 1) = xs.length + 1
state_after: case cons.mpr
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : ∀ x_1 ∈ x :: xs, ¬p x_1 = true
⊢ ∀ x ∈ xs, ¬p x = true

tactic: exact fun y hy ↦ h y <| mem_cons.mpr (Or.inr hy)
state_before: case cons.mpr
α : Type u
β : Type v
p : α → Bool
x : α
xs : List α
ih : findIdx p xs = xs.length ↔ ∀ x ∈ xs, ¬p x = true
h : ∀ x_1 ∈ x :: xs, ¬p x_1 = true
⊢ ∀ x ∈ xs, ¬p x = true
state_after: no goals