Skip to content

Commit

Permalink
feat: more lemmas
Browse files Browse the repository at this point in the history
  • Loading branch information
fgdorais committed May 30, 2024
1 parent c80ca8b commit fd44699
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Batteries/Data/DArray/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,14 @@ theorem umodify_eq_modify (a : DArray n α) (i : USize) (h : i.toNat < n)

@[simp]
theorem copy_eq (a : DArray n α) : a.copy = a := rfl

theorem get_map {β : Fin n → Type _} (f : {i : Fin n} → α i → β i) (a : DArray n α) (i : Fin n) :
(a.map f).get i = f (a.get i) := rfl

@[simp]
theorem size_amap (f : {i : Fin n} → α i → β) (a : DArray n α) :
(a.amap f).size = n := Array.size_ofFn ..

theorem getElem_amap (f : {i : Fin n} → α i → β) (a : DArray n α) (i : Fin n)
(h : i.val < (a.amap f).size := (a.size_amap f).symm ▸ i.is_lt) :
(a.amap f)[i] = f (a.get i) := by simp [amap]

0 comments on commit fd44699

Please sign in to comment.