Skip to content

Commit

Permalink
feat: gaps/cleanup in List lemmas (leanprover#4835)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em authored Jul 26, 2024
1 parent 8c87a90 commit e280de0
Show file tree
Hide file tree
Showing 6 changed files with 836 additions and 277 deletions.
10 changes: 9 additions & 1 deletion src/Init/Data/List/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ def take : Nat → List α → List α

@[simp] theorem take_nil : ([] : List α).take i = [] := by cases i <;> rfl
@[simp] theorem take_zero (l : List α) : l.take 0 = [] := rfl
@[simp] theorem take_cons_succ : (a::as).take (i+1) = a :: as.take i := rfl
@[simp] theorem take_succ_cons : (a::as).take (i+1) = a :: as.take i := rfl

/-! ### drop -/

Expand Down Expand Up @@ -1258,6 +1258,14 @@ def unzip : List (α × β) → List α × List β

/-! ## Ranges and enumeration -/

/-- Sum of a list of natural numbers. -/
-- This is not in the `List` namespace as later `List.sum` will be defined polymorphically.
protected def _root_.Nat.sum (l : List Nat) : Nat := l.foldr (·+·) 0

@[simp] theorem _root_.Nat.sum_nil : Nat.sum ([] : List Nat) = 0 := rfl
@[simp] theorem _root_.Nat.sum_cons (a : Nat) (l : List Nat) :
Nat.sum (a::l) = a + Nat.sum l := rfl

/-! ### range -/

/--
Expand Down
Loading

0 comments on commit e280de0

Please sign in to comment.