getD and getI #
This file provides theorems for working with the getD
and getI
functions. These are used to
access an element of a list by numerical index, with a default value as a fallback when the index
is out of range.
An empty list can always be decidably checked for the presence of an element.
Not an instance because it would clash with DecidableEq α
.
Equations
- List.decidableGetDNilNe a x✝ = isFalse ⋯
Instances For
@[simp]
@[deprecated List.getElem?_getD_singleton_default_eq]
Alias of List.getElem?_getD_singleton_default_eq
.
@[simp]
theorem
List.getElem?_getD_replicate_default_eq
{α : Type u}
(d : α)
(r n : ℕ)
:
(List.replicate r d)[n]?.getD d = d
@[deprecated List.getElem?_getD_replicate_default_eq]
theorem
List.getD_replicate_default_eq
{α : Type u}
(d : α)
(r n : ℕ)
:
(List.replicate r d)[n]?.getD d = d
Alias of List.getElem?_getD_replicate_default_eq
.
theorem
List.getD_replicate
{α : Type u}
(x : α)
{y : α}
{i n : ℕ}
(h : i < n)
:
(List.replicate n x).getD i y = x