Skip to content

Commit 8f6933f

Browse files
committed
deprecations
1 parent 406f456 commit 8f6933f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Init/Data/List/TakeDrop.lean

+5-4
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ theorem getElem_take (L : List α) {i j : Nat} (hi : i < L.length) (hj : i < j)
9292
L[i] = (L.take j)[i]'(length_take .. ▸ Nat.lt_min.mpr ⟨hj, hi⟩) :=
9393
getElem_of_eq (take_append_drop j L).symm _ ▸ getElem_append ..
9494

95+
set_option linter.deprecated false in
9596
/-- The `i`-th element of a list coincides with the `i`-th element of any of its prefixes of
9697
length `> i`. Version designed to rewrite from the big list to the small list. -/
9798
theorem get_take (L : List α) {i j : Nat} (hi : i < L.length) (hj : i < j) :
@@ -134,14 +135,14 @@ theorem get?_take_eq_if {l : List α} {n m : Nat} :
134135
theorem nth_take_of_succ {l : List α} {n : Nat} : (l.take (n + 1)).get? n = l.get? n :=
135136
get?_take (Nat.lt_succ_self n)
136137

137-
theorem take_succ {l : List α} {n : Nat} : l.take (n + 1) = l.take n ++ (l.get? n).toList := by
138+
theorem take_succ {l : List α} {n : Nat} : l.take (n + 1) = l.take n ++ l[n]?.toList := by
138139
induction l generalizing n with
139140
| nil =>
140-
simp only [Option.toList, get?, take_nil, append_nil]
141+
simp only [take_nil, Option.toList, getElem?_nil, append_nil]
141142
| cons hd tl hl =>
142143
cases n
143-
· simp only [Option.toList, get?, eq_self_iff_true, take, nil_append]
144-
· simp only [hl, cons_append, get?, eq_self_iff_true, take]
144+
· simp only [take, Option.toList, getElem?_cons_zero, nil_append]
145+
· simp only [take, hl, getElem?_cons_succ, cons_append]
145146

146147
@[simp]
147148
theorem take_eq_nil_iff {l : List α} {k : Nat} : l.take k = [] ↔ l = [] ∨ k = 0 := by

0 commit comments

Comments
 (0)