Lemmas about array iterators #
This module provides lemmas about the interactions of Array.iterM
with IterM.step
and various
collectors.
theorem
Array.step_iterFromIdxM
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{array : Array β}
{pos : Nat}
:
(array.iterFromIdxM m pos).step = pure
(if h : pos < array.size then Std.Iterators.PlausibleIterStep.yield (array.iterFromIdxM m (pos + 1)) array[pos] ⋯
else Std.Iterators.PlausibleIterStep.done ⋯)
theorem
Array.step_iterM
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{array : Array β}
:
(array.iterM m).step = pure
(if h : 0 < array.size then Std.Iterators.PlausibleIterStep.yield (array.iterFromIdxM m 1) array[0] ⋯
else Std.Iterators.PlausibleIterStep.done ⋯)
@[simp]
theorem
Array.toList_iterFromIdxM
{m : Type w → Type w'}
[Monad m]
{β : Type w}
[LawfulMonad m]
{array : Array β}
{pos : Nat}
:
@[simp]
theorem
Array.toArray_iterFromIdxM
{m : Type w → Type w'}
[Monad m]
{β : Type w}
[LawfulMonad m]
{array : Array β}
{pos : Nat}
: