@@ -92,6 +92,7 @@ theorem getElem_take (L : List α) {i j : Nat} (hi : i < L.length) (hj : i < j)
92
92
L[i] = (L.take j)[i]'(length_take .. ▸ Nat.lt_min.mpr ⟨hj, hi⟩) :=
93
93
getElem_of_eq (take_append_drop j L).symm _ ▸ getElem_append ..
94
94
95
+ set_option linter.deprecated false in
95
96
/-- The `i`-th element of a list coincides with the `i`-th element of any of its prefixes of
96
97
length `> i`. Version designed to rewrite from the big list to the small list. -/
97
98
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} :
134
135
theorem nth_take_of_succ {l : List α} {n : Nat} : (l.take (n + 1 )).get? n = l.get? n :=
135
136
get?_take (Nat.lt_succ_self n)
136
137
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
138
139
induction l generalizing n with
139
140
| nil =>
140
- simp only [Option.toList, get?, take_nil , append_nil]
141
+ simp only [take_nil, Option.toList, getElem?_nil , append_nil]
141
142
| cons hd tl hl =>
142
143
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 ]
145
146
146
147
@[simp]
147
148
theorem take_eq_nil_iff {l : List α} {k : Nat} : l.take k = [] ↔ l = [] ∨ k = 0 := by
0 commit comments