insertIdx #
Proves various lemmas about List.insertIdx
.
@[simp]
theorem
List.insertIdx_eraseIdx_self
{α : Type u}
{l : List α}
{n : ℕ}
(hn : n ≠ l.length)
(a : α)
:
Erasing n
th element of a list, then inserting a
at the same place
is the same as setting n
th element to a
.
We assume that n ≠ length l
, because otherwise LHS equals l ++ [a]
while RHS equals l
.
theorem
List.insertIdx_injective
{α : Type u}
(n : ℕ)
(x : α)
:
Function.Injective fun (l : List α) => l.insertIdx n x