Documentation

Init.Data.List.Nat.InsertIdx

insertIdx #

Proves various lemmas about List.insertIdx.

@[simp]
theorem List.insertIdx_zero {α : Type u} (s : List α) (x : α) :
insertIdx 0 x s = x :: s
@[simp]
theorem List.insertIdx_succ_nil {α : Type u} (n : Nat) (a : α) :
insertIdx (n + 1) a [] = []
@[simp]
theorem List.insertIdx_succ_cons {α : Type u} (s : List α) (hd x : α) (i : Nat) :
insertIdx (i + 1) x (hd :: s) = hd :: insertIdx i x s
theorem List.length_insertIdx {α : Type u} {a : α} (i : Nat) (as : List α) :
(insertIdx i a as).length = if i as.length then as.length + 1 else as.length
theorem List.length_insertIdx_of_le_length {α : Type u} {a : α} {i : Nat} {as : List α} (h : i as.length) :
(insertIdx i a as).length = as.length + 1
theorem List.length_insertIdx_of_length_lt {α : Type u} {a : α} {as : List α} {i : Nat} (h : as.length < i) :
(insertIdx i a as).length = as.length
@[simp]
theorem List.eraseIdx_insertIdx {α : Type u} {a : α} (i : Nat) (l : List α) :
(insertIdx i a l).eraseIdx i = l
theorem List.insertIdx_eraseIdx_of_ge {α : Type u} {a : α} (i m : Nat) (as : List α) :
i < as.lengthi minsertIdx m a (as.eraseIdx i) = (insertIdx (m + 1) a as).eraseIdx i
theorem List.insertIdx_eraseIdx_of_le {α : Type u} {a : α} (i j : Nat) (as : List α) :
i < as.lengthj iinsertIdx j a (as.eraseIdx i) = (insertIdx j a as).eraseIdx (i + 1)
theorem List.insertIdx_comm {α : Type u} (a b : α) (i j : Nat) (l : List α) :
i jj l.lengthinsertIdx (j + 1) b (insertIdx i a l) = insertIdx i a (insertIdx j b l)
theorem List.mem_insertIdx {α : Type u} {a b : α} {i : Nat} {l : List α} :
i l.length → (a insertIdx i b l a = b a l)
theorem List.insertIdx_of_length_lt {α : Type u} (l : List α) (x : α) (i : Nat) (h : l.length < i) :
insertIdx i x l = l
@[simp]
theorem List.insertIdx_length_self {α : Type u} (l : List α) (x : α) :
theorem List.length_le_length_insertIdx {α : Type u} (l : List α) (x : α) (i : Nat) :
theorem List.length_insertIdx_le_succ {α : Type u} (l : List α) (x : α) (i : Nat) :
theorem List.getElem_insertIdx_of_lt {α : Type u} {l : List α} {x : α} {i j : Nat} (hn : j < i) (hk : j < (insertIdx i x l).length) :
(insertIdx i x l)[j] = l[j]
@[simp]
theorem List.getElem_insertIdx_self {α : Type u} {l : List α} {x : α} {i : Nat} (hi : i < (insertIdx i x l).length) :
(insertIdx i x l)[i] = x
theorem List.getElem_insertIdx_of_gt {α : Type u} {l : List α} {x : α} {i j : Nat} (hn : i < j) (hk : j < (insertIdx i x l).length) :
(insertIdx i x l)[j] = l[j - 1]
@[reducible, inline, deprecated List.getElem_insertIdx_of_gt (since := "2025-02-04")]
abbrev List.getElem_insertIdx_of_ge {α : Type u_1} {l : List α} {x : α} {i j : Nat} (hn : i < j) (hk : j < (insertIdx i x l).length) :
(insertIdx i x l)[j] = l[j - 1]
Equations
Instances For
    theorem List.getElem_insertIdx {α : Type u} {l : List α} {x : α} {i j : Nat} (h : j < (insertIdx i x l).length) :
    (insertIdx i x l)[j] = if h₁ : j < i then l[j] else if h₂ : j = i then x else l[j - 1]
    theorem List.getElem?_insertIdx {α : Type u} {l : List α} {x : α} {i j : Nat} :
    (insertIdx i x l)[j]? = if j < i then l[j]? else if j = i then if j l.length then some x else none else l[j - 1]?
    theorem List.getElem?_insertIdx_of_lt {α : Type u} {l : List α} {x : α} {i j : Nat} (h : j < i) :
    (insertIdx i x l)[j]? = l[j]?
    theorem List.getElem?_insertIdx_self {α : Type u} {l : List α} {x : α} {i : Nat} :
    theorem List.getElem?_insertIdx_of_gt {α : Type u} {l : List α} {x : α} {i j : Nat} (h : i < j) :
    (insertIdx i x l)[j]? = l[j - 1]?
    @[reducible, inline, deprecated List.getElem?_insertIdx_of_gt (since := "2025-02-04")]
    abbrev List.getElem?_insertIdx_of_ge {α : Type u_1} {l : List α} {x : α} {i j : Nat} (h : i < j) :
    (insertIdx i x l)[j]? = l[j - 1]?
    Equations
    Instances For