Theorem: List.drop_take_succ_eq_cons_nthLe
File: Mathlib/Data/List/Join.lean

tactic: induction' L with head tail generalizing i
state_before: α : Type u_1
β : Type ?u.8051
L : List α
i : ℕ
hi : i < length L
⊢ drop i (take (i + 1) L) = [nthLe L i hi]

tactic: cases' i with i hi
state_before: case cons
α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
i : ℕ
hi : i < length (head :: tail)
⊢ drop i (take (i + 1) (head :: tail)) = [nthLe (head :: tail) i hi]

tactic: have : i < tail.length := by
  simp at hi
  exact Nat.lt_of_succ_lt_succ hi
state_before: case cons.succ
α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
i : ℕ
hi : Nat.succ i < length (head :: tail)
⊢ drop (Nat.succ i) (take (Nat.succ i + 1) (head :: tail)) = [nthLe (head :: tail) (Nat.succ i) hi]

tactic: simp [*]
state_before: case cons.succ
α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
i : ℕ
hi : Nat.succ i < length (head :: tail)
this : i < length tail
⊢ drop (Nat.succ i) (take (Nat.succ i + 1) (head :: tail)) = [nthLe (head :: tail) (Nat.succ i) hi]

tactic: rfl
state_before: case cons.succ
α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
i : ℕ
hi : Nat.succ i < length (head :: tail)
this : i < length tail
⊢ nthLe tail i (_ : i < length tail) = nthLe (head :: tail) (Nat.succ i) hi

tactic: simp only [length] at hi
state_before: case nil
α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
i : ℕ
hi : i < length []
⊢ drop i (take (i + 1) []) = [nthLe [] i hi]

tactic: exact (Nat.not_succ_le_zero i hi).elim
state_before: case nil
α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
i : ℕ
hi : i < 0
⊢ drop i (take (i + 1) []) = [nthLe [] i hi]

tactic: simp
state_before: case cons.zero
α : Type u_1
β : Type ?u.8051
L : List α
i : ℕ
hi✝ : i < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
hi : Nat.zero < length (head :: tail)
⊢ drop Nat.zero (take (Nat.zero + 1) (head :: tail)) = [nthLe (head :: tail) Nat.zero hi]

tactic: rfl
state_before: case cons.zero
α : Type u_1
β : Type ?u.8051
L : List α
i : ℕ
hi✝ : i < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
hi : Nat.zero < length (head :: tail)
⊢ head = nthLe (head :: tail) 0 hi

tactic: simp at hi
state_before: α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
i : ℕ
hi : Nat.succ i < length (head :: tail)
⊢ i < length tail

tactic: exact Nat.lt_of_succ_lt_succ hi
state_before: α : Type u_1
β : Type ?u.8051
L : List α
i✝ : ℕ
hi✝ : i✝ < length L
head : α
tail : List α
tail_ih✝ : ∀ {i : ℕ} (hi : i < length tail), drop i (take (i + 1) tail) = [nthLe tail i hi]
i : ℕ
hi : Nat.succ i < Nat.succ (length tail)
⊢ i < length tail