Skip to content

Commit

Permalink
feat: getElem_tail lemmas (#905)
Browse files Browse the repository at this point in the history
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
Co-authored-by: Kim Morrison <kim@tqft.net>
  • Loading branch information
3 people authored Sep 28, 2024
1 parent deb7e08 commit 82c92a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Batteries/Data/List/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ theorem get?_set_of_lt' (a : α) {m n} (l : List α) (h : m < length l) :

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

/-! ### tail -/

theorem length_tail_add_one (l : List α) (h : 0 < length l) : (length (tail l)) + 1 = length l := by
simp [Nat.sub_add_cancel h]

@[simp] theorem getElem?_tail (l : List α) : l.tail[n]? = l[n + 1]? := by cases l <;> simp

@[simp] theorem getElem_tail (l : List α) (h : n < l.tail.length) :
l.tail[n] = l[n + 1]'(by simp at h; omega) := by
cases l; contradiction; simp

/-! ### eraseP -/

@[simp] theorem extractP_eq_find?_eraseP
Expand Down
2 changes: 1 addition & 1 deletion lake-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"version": "1.0.0",
{"version": "1.1.0",
"packagesDir": ".lake/packages",
"packages": [],
"name": "batteries",
Expand Down

0 comments on commit 82c92a6

Please sign in to comment.