Built with
doc-gen4, running Lean4.
Bubbles (
) indicate interactive fragments: hover for details, tap to reveal contents.
Use
Ctrl+↑Ctrl+↓to navigate,
Ctrl+🖱️to focus.
On Mac, use
Cmdinstead of
Ctrl.
/-
Copyright (c) 2016 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
import Mathlib.Mathport.Rename
import Mathlib.Init.Data.Nat.Notation
import Std.Data.Nat.Lemmas
import Std.Data.List.Basic
/-!
Definitions for `List` not (yet) in `Std`
-/
open Decidable List
universe u v w
namespace List
open Option Nat
#align list.nth List.get?
/-- nth element of a list `l` given `n < l.length`. -/
@[deprecated get]
def nthLe (l : List α) (n) (h : n < l.length) : α := get l ⟨n, h⟩
#align list.nth_le List.nthLe
set_option linter.deprecated false in
@[deprecated]
theorem nthLe_eq (l : List α) (n) (h : n < l.length) : nthLe l n h = get l ⟨n, h⟩ := rfl: ∀ {α : Sort ?u.153} {a : α}, a = a
rfl
/-- The head of a list, or the default element of the type is the list is `nil`. -/
def headI [Inhabited: Sort ?u.181 → Sort (max1?u.181)
Inhabited α] : List α → α
| [] => default
| (a :: _) => a
#align list.head List.headI
@[simp] theorem headI_nil [Inhabited: Sort ?u.502 → Sort (max1?u.502)
Inhabited α] : ([] : List α).headI = default := rfl: ∀ {α : Sort ?u.696} {a : α}, a = a
rfl
@[simp] theorem headI_cons [Inhabited: Sort ?u.727 → Sort (max1?u.727)
Inhabited α] {h : α} {t : List α} : (h :: t).headI = h := rfl: ∀ {α : Sort ?u.756} {a : α}, a = a
rfl
#align list.map₂ List.zipWith
#noalign list.map_with_index_core
#align list.map_with_index List.mapIdx
/-- Find index of element with given property. -/
@[deprecated findIdx]
def findIndex (p : α → Prop) [DecidablePred: {α : Sort ?u.799} → (α → Prop) → Sort (max1?u.799)
DecidablePred p] : List α → ℕ := List.findIdx p
#align list.find_index List.findIndex
#align list.update_nth List.set
#align list.bor List.or
#align list.band List.and
#align list.last List.getLast: {α : Type u_1} → (as : List α) → as ≠ [] → α
List.getLast
/-- The last element of a list, with the default if list empty -/
def getLastI [Inhabited: Sort ?u.955 → Sort (max1?u.955)
Inhabited α] : List α → α
| [] => default
| [a] => a
| [_, b] => b
| _ :: _ :: l => getLastI l
#align list.ilast List.getLastI
#align list.init List.dropLast
/-- List with a single given element. -/
@[inline] protected def ret {α : Type u} (a : α) : List α := [a]
#align list.ret List.ret
/-- `≤` implies not `>` for lists. -/
theorem le_eq_not_gt: ∀ {α : Type u_1} [inst : LT α] (l₁ l₂ : List α), (l₁ ≤ l₂) = ¬l₂ < l₁
le_eq_not_gt [LT α] : ∀ l₁ l₂ : List α, (l₁ ≤ l₂) = ¬l₂ < l₁ := fun _ _ => rfl: ∀ {α : Sort ?u.1798} {a : α}, a = a
rfl
#align list.le_eq_not_gt List.le_eq_not_gt: ∀ {α : Type u_1} [inst : LT α] (l₁ l₂ : List α), (l₁ ≤ l₂) = ¬l₂ < l₁
List.le_eq_not_gt
end List
#align list.replicate List.replicate: {α : Type u} → ℕ → α → List α
List.replicate
#align list.length_replicate List.length_replicate