Skip to content

Commit

Permalink
feat: add lemmas about lists
Browse files Browse the repository at this point in the history
I need these lemmas to prove `String.splitOn_of_valid`.
  • Loading branch information
chabulhwi committed Oct 14, 2024
1 parent 5f963d5 commit 23c06a9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Batteries/Data/List/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ namespace List

@[deprecated (since := "2024-08-15")] alias isEmpty_iff_eq_nil := isEmpty_iff

/-! ### head and tail -/

theorem head_cons_tail : ∀ l h, @head α l h :: l.tail = l
| _::_, _ => rfl

/-! ### next? -/

@[simp] theorem next?_nil : @next? α [] = none := rfl
Expand Down Expand Up @@ -482,6 +487,12 @@ theorem Sublist.erase_diff_erase_sublist {a : α} :

end Diff

/-! ### prefix, suffix, infix -/

theorem ne_nil_of_not_prefix (h : ¬l₁ <+: l₂) : l₁ ≠ [] := by
intro heq
simp [heq, nil_prefix] at h

/-! ### drop -/

theorem disjoint_take_drop : ∀ {l : List α}, l.Nodup → m ≤ n → Disjoint (l.take m) (l.drop n)
Expand Down

0 comments on commit 23c06a9

Please sign in to comment.