theorem
Std.Iterators.Vector.isPlausibleStep_iterFromIdxM_of_lt
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{n : Nat}
{xs : Vector β n}
{pos : Nat}
(h : pos < n)
:
(xs.iterFromIdxM m pos).IsPlausibleStep (IterStep.yield (xs.iterFromIdxM m (pos + 1)) xs[pos])
theorem
Std.Iterators.Vector.isPlausibleStep_iterFromIdxM_of_not_lt
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{n : Nat}
{xs : Vector β n}
{pos : Nat}
(h : ¬pos < n)
:
(xs.iterFromIdxM m pos).IsPlausibleStep IterStep.done
theorem
Std.Iterators.Vector.isPlausibleStep_iterM_of_pos
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{n : Nat}
{xs : Vector β n}
(h : 0 < n)
:
(xs.iterM m).IsPlausibleStep (IterStep.yield (xs.iterFromIdxM m 1) xs[0])
theorem
Std.Iterators.Vector.isPlausibleStep_iterM_of_not_pos
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{n : Nat}
{xs : Vector β n}
(h : ¬0 < n)
:
(xs.iterM m).IsPlausibleStep IterStep.done
theorem
Vector.step_iterFromIdxM
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{n : Nat}
{xs : Vector β n}
{pos : Nat}
:
(xs.iterFromIdxM m pos).step = pure
(Std.Shrink.deflate
(if h : pos < n then Std.PlausibleIterStep.yield (xs.iterFromIdxM m (pos + 1)) xs[pos] ⋯
else Std.PlausibleIterStep.done ⋯))
theorem
Vector.step_iterM
{m : Type w → Type w'}
[Monad m]
{β : Type w}
{n : Nat}
{xs : Vector β n}
:
(xs.iterM m).step = pure
(Std.Shrink.deflate
(if h : 0 < n then Std.PlausibleIterStep.yield (xs.iterFromIdxM m 1) xs[0] ⋯ else Std.PlausibleIterStep.done ⋯))
theorem
Vector.iterFromIdxM_equiv_iterM_drop_toList
{n : Nat}
{α : Type w}
{xs : Vector α n}
{m : Type w → Type w'}
[Monad m]
[LawfulMonad m]
{pos : Nat}
:
(xs.iterFromIdxM m pos).Equiv ((List.drop pos xs.toList).iterM m)