Skip to content

Commit

Permalink
fix: mistake in statement of List.take_takeWhile
Browse files Browse the repository at this point in the history
This theorem is meant to say that `List.take` and `List.takeWhile` commute.
  • Loading branch information
kmill committed Jul 30, 2024
1 parent 69f86d6 commit 8471222
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Init/Data/List/TakeDrop.lean
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8471222

Please sign in to comment.