Theorem: List.take_one_drop_eq_of_lt_length
File: Mathlib/Data/List/Basic.lean

tactic: induction' l with x l ih generalizing n
state_before: ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l : List α
n : ℕ
h : n < length l
⊢ take 1 (drop n l) = [get l { val := n, isLt := h }]

tactic: cases h
state_before: case nil
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l : List α
n✝ : ℕ
h✝ : n✝ < length l
n : ℕ
h : n < length []
⊢ take 1 (drop n []) = [get [] { val := n, isLt := h }]

tactic: by_cases h₁ : l = []
state_before: case cons
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n✝ : ℕ
h✝ : n✝ < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
n : ℕ
h : n < length (x :: l)
⊢ take 1 (drop n (x :: l)) = [get (x :: l) { val := n, isLt := h }]

tactic: have h₂ := h
state_before: case neg
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n✝ : ℕ
h✝ : n✝ < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
n : ℕ
h : n < length (x :: l)
h₁ : ¬l = []
⊢ take 1 (drop n (x :: l)) = [get (x :: l) { val := n, isLt := h }]

tactic: rw [length_cons, Nat.lt_succ_iff, le_iff_eq_or_lt] at h₂
state_before: case neg
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n✝ : ℕ
h✝ : n✝ < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
n : ℕ
h : n < length (x :: l)
h₁ : ¬l = []
h₂ : n < length (x :: l)
⊢ take 1 (drop n (x :: l)) = [get (x :: l) { val := n, isLt := h }]

tactic: cases n
state_before: case neg
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n✝ : ℕ
h✝ : n✝ < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
n : ℕ
h : n < length (x :: l)
h₁ : ¬l = []
h₂ : n = length l ∨ n < length l
⊢ take 1 (drop n (x :: l)) = [get (x :: l) { val := n, isLt := h }]

tactic: rw [drop, get]
state_before: case neg.succ
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n : ℕ
h✝ : n < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
h₁ : ¬l = []
n✝ : ℕ
h : succ n✝ < length (x :: l)
h₂ : succ n✝ = length l ∨ succ n✝ < length l
⊢ take 1 (drop (succ n✝) (x :: l)) = [get (x :: l) { val := succ n✝, isLt := h }]

tactic: apply ih
state_before: case neg.succ
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n : ℕ
h✝ : n < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
h₁ : ¬l = []
n✝ : ℕ
h : succ n✝ < length (x :: l)
h₂ : succ n✝ = length l ∨ succ n✝ < length l
⊢ take 1 (drop n✝ l) = [get l { val := n✝, isLt := (_ : succ n✝ ≤ length l) }]

tactic: subst h₁
state_before: case pos
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n✝ : ℕ
h✝ : n✝ < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
n : ℕ
h : n < length (x :: l)
h₁ : l = []
⊢ take 1 (drop n (x :: l)) = [get (x :: l) { val := n, isLt := h }]

tactic: rw [get_singleton]
state_before: case pos
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l : List α
n✝ : ℕ
h✝ : n✝ < length l
x : α
n : ℕ
ih : ∀ {n : ℕ} (h : n < length []), take 1 (drop n []) = [get [] { val := n, isLt := h }]
h : n < length [x]
⊢ take 1 (drop n [x]) = [get [x] { val := n, isLt := h }]

tactic: simp [lt_succ_iff] at h
state_before: case pos
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l : List α
n✝ : ℕ
h✝ : n✝ < length l
x : α
n : ℕ
ih : ∀ {n : ℕ} (h : n < length []), take 1 (drop n []) = [get [] { val := n, isLt := h }]
h : n < length [x]
⊢ take 1 (drop n [x]) = [x]

tactic: subst h
state_before: case pos
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l : List α
n✝ : ℕ
h✝ : n✝ < length l
x : α
n : ℕ
ih : ∀ {n : ℕ} (h : n < length []), take 1 (drop n []) = [get [] { val := n, isLt := h }]
h : n = 0
⊢ take 1 (drop n [x]) = [x]

tactic: simp
state_before: case pos
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l : List α
n : ℕ
h : n < length l
x : α
ih : ∀ {n : ℕ} (h : n < length []), take 1 (drop n []) = [get [] { val := n, isLt := h }]
⊢ take 1 (drop 0 [x]) = [x]

tactic: simp [get]
state_before: case neg.zero
ι : Type ?u.89571
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ l✝ : List α
n : ℕ
h✝ : n < length l✝
x : α
l : List α
ih : ∀ {n : ℕ} (h : n < length l), take 1 (drop n l) = [get l { val := n, isLt := h }]
h₁ : ¬l = []
h : zero < length (x :: l)
h₂ : zero = length l ∨ zero < length l
⊢ take 1 (drop zero (x :: l)) = [get (x :: l) { val := zero, isLt := h }]