mapFinIdx #
theorem
Array.mapFinIdx_induction.go
{α : Type u_1}
{β : Type u_2}
(as : Array α)
(f : Fin as.size → α → β)
(motive : Nat → Prop)
(p : Fin as.size → β → Prop)
(hs : ∀ (i : Fin as.size), motive ↑i → p i (f i as[i]) ∧ motive (↑i + 1))
{bs : Array β}
{i j : Nat}
{h : i + j = as.size}
(h₁ : j = bs.size)
(h₂ : ∀ (i : Nat) (h : i < as.size) (h' : i < bs.size), p ⟨i, h⟩ bs[i])
(hm : motive j)
:
let arr := mapFinIdxM.map as f i j h bs;
motive as.size ∧ ∃ (eq : arr.size = as.size), ∀ (i_1 : Nat) (h : i_1 < as.size), p ⟨i_1, h⟩ arr[i_1]
@[simp]
mapIdx #
@[simp]
theorem
Array.getElem?_mapIdx
{α : Type u_1}
{β : Type u_2}
(f : Nat → α → β)
(as : Array α)
(i : Nat)
:
(mapIdx f as)[i]? = Option.map (f i) as[i]?
@[simp]
theorem
Array.toList_mapIdx
{α : Type u_1}
{β : Type u_2}
(f : Nat → α → β)
(as : Array α)
:
(mapIdx f as).toList = List.mapIdx (fun (i : Nat) (a : α) => f i a) as.toList
@[simp]
theorem
List.mapIdx_toArray
{α : Type u_1}
{β : Type u_2}
(f : Nat → α → β)
(l : List α)
:
Array.mapIdx f l.toArray = (mapIdx f l).toArray