HepLean Documentation

Init.Data.Array.MapIdx

mapFinIdx #

theorem Array.mapFinIdx_induction {α : Type u_1} {β : Type u_2} (as : Array α) (f : Fin as.sizeαβ) (motive : NatProp) (h0 : motive 0) (p : Fin as.sizeβProp) (hs : ∀ (i : Fin as.size), motive ip i (f i as[i]) motive (i + 1)) :
motive as.size ∃ (eq : (as.mapFinIdx f).size = as.size), ∀ (i : Nat) (h : i < as.size), p i, h (as.mapFinIdx f)[i]
theorem Array.mapFinIdx_induction.go {α : Type u_1} {β : Type u_2} (as : Array α) (f : Fin as.sizeαβ) (motive : NatProp) (p : Fin as.sizeβProp) (hs : ∀ (i : Fin as.size), motive ip 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 := Array.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]
theorem Array.mapFinIdx_spec {α : Type u_1} {β : Type u_2} (as : Array α) (f : Fin as.sizeαβ) (p : Fin as.sizeβProp) (hs : ∀ (i : Fin as.size), p i (f i as[i])) :
∃ (eq : (as.mapFinIdx f).size = as.size), ∀ (i : Nat) (h : i < as.size), p i, h (as.mapFinIdx f)[i]
@[simp]
theorem Array.size_mapFinIdx {α : Type u_1} {β : Type u_2} (a : Array α) (f : Fin a.sizeαβ) :
(a.mapFinIdx f).size = a.size
@[simp]
theorem Array.size_zipWithIndex {α : Type u_1} (as : Array α) :
as.zipWithIndex.size = as.size
@[simp]
theorem Array.getElem_mapFinIdx {α : Type u_1} {β : Type u_2} (a : Array α) (f : Fin a.sizeαβ) (i : Nat) (h : i < (a.mapFinIdx f).size) :
(a.mapFinIdx f)[i] = f i, a[i]
@[simp]
theorem Array.getElem?_mapFinIdx {α : Type u_1} {β : Type u_2} (a : Array α) (f : Fin a.sizeαβ) (i : Nat) :
(a.mapFinIdx f)[i]? = a[i]?.pbind fun (b : α) (h : b a[i]?) => some (f i, b)

mapIdx #

theorem Array.mapIdx_induction {α : Type u_1} {β : Type u_2} (as : Array α) (f : Natαβ) (motive : NatProp) (h0 : motive 0) (p : Fin as.sizeβProp) (hs : ∀ (i : Fin as.size), motive ip i (f (↑i) as[i]) motive (i + 1)) :
motive as.size ∃ (eq : (as.mapIdx f).size = as.size), ∀ (i : Nat) (h : i < as.size), p i, h (as.mapIdx f)[i]
theorem Array.mapIdx_spec {α : Type u_1} {β : Type u_2} (as : Array α) (f : Natαβ) (p : Fin as.sizeβProp) (hs : ∀ (i : Fin as.size), p i (f (↑i) as[i])) :
∃ (eq : (as.mapIdx f).size = as.size), ∀ (i : Nat) (h : i < as.size), p i, h (as.mapIdx f)[i]
@[simp]
theorem Array.size_mapIdx {α : Type u_1} {β : Type u_2} (a : Array α) (f : Natαβ) :
(a.mapIdx f).size = a.size
@[simp]
theorem Array.getElem_mapIdx {α : Type u_1} {β : Type u_2} (a : Array α) (f : Natαβ) (i : Nat) (h : i < (a.mapIdx f).size) :
(a.mapIdx f)[i] = f i a[i]
@[simp]
theorem Array.getElem?_mapIdx {α : Type u_1} {β : Type u_2} (a : Array α) (f : Natαβ) (i : Nat) :
(a.mapIdx f)[i]? = Option.map (f i) a[i]?