Skip to content

Commit 82c92a6

Browse files
pimottefgdoraiskim-em
authored
feat: getElem_tail lemmas (#905)
Co-authored-by: François G. Dorais <[email protected]> Co-authored-by: Kim Morrison <[email protected]>
1 parent deb7e08 commit 82c92a6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Batteries/Data/List/Lemmas.lean

+11
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,17 @@ theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :
228228

229229
@[deprecated (since := "2024-05-06")] alias length_removeNth := length_eraseIdx
230230

231+
/-! ### tail -/
232+
233+
theorem length_tail_add_one (l : List α) (h : 0 < length l) : (length (tail l)) + 1 = length l := by
234+
simp [Nat.sub_add_cancel h]
235+
236+
@[simp] theorem getElem?_tail (l : List α) : l.tail[n]? = l[n + 1]? := by cases l <;> simp
237+
238+
@[simp] theorem getElem_tail (l : List α) (h : n < l.tail.length) :
239+
l.tail[n] = l[n + 1]'(by simp at h; omega) := by
240+
cases l; contradiction; simp
241+
231242
/-! ### eraseP -/
232243

233244
@[simp] theorem extractP_eq_find?_eraseP

lake-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{"version": "1.0.0",
1+
{"version": "1.1.0",
22
"packagesDir": ".lake/packages",
33
"packages": [],
44
"name": "batteries",

0 commit comments

Comments
 (0)