case pos
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l : List α
h : n < length l
⊢ (if n < length l then (Array.toList #[] ++ take n l, drop n l) else (l, [])) = (take n l, drop n l)

case neg
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l : List α
h : ¬n < length l
⊢ (if n < length l then (Array.toList #[] ++ take n l, drop n l) else (l, [])) = (take n l, drop n l)
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l : List α
⊢ splitAt n l = (take n l, drop n l)
by_cases h : n < l.length <;> rw [splitAt, go_eq_take_drop]
case pos
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l : List α
h : n < length l
⊢ (Array.toList #[] ++ take n l, drop n l) = (take n l, drop n l)
case pos
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l : List α
h : n < length l
⊢ (if n < length l then (Array.toList #[] ++ take n l, drop n l) else (l, [])) = (take n l, drop n l)
rw [if_pos h]
no goals
case pos
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l : List α
h : n < length l
⊢ (Array.toList #[] ++ take n l, drop n l) = (take n l, drop n l)
rfl
no goals
case neg
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l : List α
h : ¬n < length l
⊢ (if n < length l then (Array.toList #[] ++ take n l, drop n l) else (l, [])) = (take n l, drop n l)
rw [if_neg h, take_all_of_le <| le_of_not_lt h, drop_eq_nil_of_le <| le_of_not_lt h]
case inl
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n✝ : ℕ
l✝ : List α
n : ℕ
l xs : List α
acc : Array α
h : n < length xs
⊢ splitAt.go l xs n acc = (Array.toList acc ++ take n xs, drop n xs)

case inr
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n✝ : ℕ
l✝ : List α
n : ℕ
l xs : List α
acc : Array α
h : ¬n < length xs
⊢ splitAt.go l xs n acc = (l, [])
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n✝ : ℕ
l✝ : List α
n : ℕ
l xs : List α
acc : Array α
⊢ splitAt.go l xs n acc = if n < length xs then (Array.toList acc ++ take n xs, drop n xs) else (l, [])
split_ifs with h
case inl.zero.x_4
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
⊢ xs = [] → False

case inl.zero.x_5
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
⊢ ∀ (x : α) (xs_1 : List α) (n : ℕ), xs = x :: xs_1 → zero = succ n → False
case inl.zero
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
⊢ splitAt.go l xs zero acc = (Array.toList acc ++ take zero xs, drop zero xs)
rw [splitAt.go, take, drop, append_nil]
case inl.zero.x_4
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
h₁ : xs = []
⊢ False
case inl.zero.x_4
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
⊢ xs = [] → False
intros h₁
case inl.zero.x_4
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length []
h₁ : xs = []
⊢ False
case inl.zero.x_4
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
h₁ : xs = []
⊢ False
rw [h₁] at h
no goals
case inl.zero.x_4
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length []
h₁ : xs = []
⊢ False
contradiction
case inl.zero.x_5
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
x✝ : α
xs_1✝ : List α
n✝ : ℕ
x_1✝ : xs = x✝ :: xs_1✝
x_2✝ : zero = succ n✝
⊢ False
case inl.zero.x_5
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
⊢ ∀ (x : α) (xs_1 : List α) (n : ℕ), xs = x :: xs_1 → zero = succ n → False
intros
no goals
case inl.zero.x_5
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : zero < length xs
x✝ : α
xs_1✝ : List α
n✝ : ℕ
x_1✝ : xs = x✝ :: xs_1✝
x_2✝ : zero = succ n✝
⊢ False
contradiction
no goals
case inl.succ
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih :
  ∀ (xs : List α) (acc : Array α),
    n✝ < length xs → splitAt.go l xs n✝ acc = (Array.toList acc ++ take n✝ xs, drop n✝ xs)
xs : List α
acc : Array α
h : succ n✝ < length xs
⊢ splitAt.go l xs (succ n✝) acc = (Array.toList acc ++ take (succ n✝) xs, drop (succ n✝) xs)
cases xs with
| nil => contradiction
| cons hd tl =>
  rw [length, succ_eq_add_one] at h
  rw [splitAt.go, take, drop, append_cons, Array.toList_eq, ←Array.push_data,
    ←Array.toList_eq]
  exact ih _ _ <| lt_of_add_lt_add_right h
no goals
case inl.succ.nil
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih :
  ∀ (xs : List α) (acc : Array α),
    n✝ < length xs → splitAt.go l xs n✝ acc = (Array.toList acc ++ take n✝ xs, drop n✝ xs)
acc : Array α
h : succ n✝ < length []
⊢ splitAt.go l [] (succ n✝) acc = (Array.toList acc ++ take (succ n✝) [], drop (succ n✝) [])
contradiction
case inl.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih :
  ∀ (xs : List α) (acc : Array α),
    n✝ < length xs → splitAt.go l xs n✝ acc = (Array.toList acc ++ take n✝ xs, drop n✝ xs)
acc : Array α
hd : α
tl : List α
h : n✝ + 1 < length tl + 1
⊢ splitAt.go l (hd :: tl) (succ n✝) acc = (Array.toList acc ++ take (succ n✝) (hd :: tl), drop (succ n✝) (hd :: tl))
case inl.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih :
  ∀ (xs : List α) (acc : Array α),
    n✝ < length xs → splitAt.go l xs n✝ acc = (Array.toList acc ++ take n✝ xs, drop n✝ xs)
acc : Array α
hd : α
tl : List α
h : succ n✝ < length (hd :: tl)
⊢ splitAt.go l (hd :: tl) (succ n✝) acc = (Array.toList acc ++ take (succ n✝) (hd :: tl), drop (succ n✝) (hd :: tl))
rw [length, succ_eq_add_one] at h
case inl.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih :
  ∀ (xs : List α) (acc : Array α),
    n✝ < length xs → splitAt.go l xs n✝ acc = (Array.toList acc ++ take n✝ xs, drop n✝ xs)
acc : Array α
hd : α
tl : List α
h : n✝ + 1 < length tl + 1
⊢ splitAt.go l tl n✝ (Array.push acc hd) = (Array.toList (Array.push acc hd) ++ take n✝ tl, drop n✝ tl)
case inl.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih :
  ∀ (xs : List α) (acc : Array α),
    n✝ < length xs → splitAt.go l xs n✝ acc = (Array.toList acc ++ take n✝ xs, drop n✝ xs)
acc : Array α
hd : α
tl : List α
h : n✝ + 1 < length tl + 1
⊢ splitAt.go l (hd :: tl) (succ n✝) acc = (Array.toList acc ++ take (succ n✝) (hd :: tl), drop (succ n✝) (hd :: tl))
rw [splitAt.go, take, drop, append_cons, Array.toList_eq, ←Array.push_data,
  ←Array.toList_eq]
no goals
case inl.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih :
  ∀ (xs : List α) (acc : Array α),
    n✝ < length xs → splitAt.go l xs n✝ acc = (Array.toList acc ++ take n✝ xs, drop n✝ xs)
acc : Array α
hd : α
tl : List α
h : n✝ + 1 < length tl + 1
⊢ splitAt.go l tl n✝ (Array.push acc hd) = (Array.toList (Array.push acc hd) ++ take n✝ tl, drop n✝ tl)
exact ih _ _ <| lt_of_add_lt_add_right h
case inr.zero
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : length xs = 0
⊢ splitAt.go l xs zero acc = (l, [])
case inr.zero
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : ¬zero < length xs
⊢ splitAt.go l xs zero acc = (l, [])
rw [zero_eq, not_lt, nonpos_iff_eq_zero] at h
no goals
case inr.zero
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l xs : List α
acc : Array α
h : length xs = 0
⊢ splitAt.go l xs zero acc = (l, [])
rw [eq_nil_of_length_eq_zero h, splitAt.go]
no goals
case inr.succ.nil
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih : ∀ (xs : List α) (acc : Array α), ¬n✝ < length xs → splitAt.go l xs n✝ acc = (l, [])
acc : Array α
h : ¬succ n✝ < length []
⊢ splitAt.go l [] (succ n✝) acc = (l, [])
rw [splitAt.go]
case inr.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih : ∀ (xs : List α) (acc : Array α), ¬n✝ < length xs → splitAt.go l xs n✝ acc = (l, [])
acc : Array α
hd : α
tl : List α
h : ¬n✝ + 1 < length tl + 1
⊢ splitAt.go l (hd :: tl) (succ n✝) acc = (l, [])
case inr.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih : ∀ (xs : List α) (acc : Array α), ¬n✝ < length xs → splitAt.go l xs n✝ acc = (l, [])
acc : Array α
hd : α
tl : List α
h : ¬succ n✝ < length (hd :: tl)
⊢ splitAt.go l (hd :: tl) (succ n✝) acc = (l, [])
rw [length, succ_eq_add_one] at h
case inr.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih : ∀ (xs : List α) (acc : Array α), ¬n✝ < length xs → splitAt.go l xs n✝ acc = (l, [])
acc : Array α
hd : α
tl : List α
h : ¬n✝ + 1 < length tl + 1
⊢ splitAt.go l tl n✝ (Array.push acc hd) = (l, [])
case inr.succ.cons
ι : Type ?u.283895
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
n : ℕ
l✝ l : List α
n✝ : ℕ
ih : ∀ (xs : List α) (acc : Array α), ¬n✝ < length xs → splitAt.go l xs n✝ acc = (l, [])
acc : Array α
hd : α
tl : List α
h : ¬n✝ + 1 < length tl + 1
⊢ splitAt.go l (hd :: tl) (succ n✝) acc = (l, [])
rw [splitAt.go]