fix: mistake in statement of List.take_takeWhile (#4875)

This theorem is meant to say that `List.take` and `List.takeWhile`
commute.
This commit is contained in:
Kyle Miller 2024-07-30 20:29:34 -07:00 committed by GitHub
parent a4015ca36c
commit a827759f1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -411,11 +411,11 @@ theorem dropWhile_replicate (p : α → Bool) :
split <;> simp_all
theorem take_takeWhile {l : List α} (p : α → Bool) n :
(l.takeWhile p).take n = (l.takeWhile p).take n := by
induction l with
| nil => rfl
(l.takeWhile p).take n = (l.take n).takeWhile p := by
induction l generalizing n with
| nil => simp
| cons x xs ih =>
by_cases h : p x <;> simp [takeWhile_cons, h, ih]
by_cases h : p x <;> cases n <;> simp [takeWhile_cons, h, ih, take_succ_cons]
@[simp] theorem all_takeWhile {l : List α} : (l.takeWhile p).all p = true := by
induction l with