@[unbox]
structure Std.Iterators.Types.Attach (α : Type w) (m : Type w → Type w') {β : Type w} [Iterator α m β] (P : β → Prop) :
Type w
Internal state of the attachWith combinator. Do not depend on its internals.
- inner : IterM m β
- invariant (out : β) : self.inner.IsPlausibleIndirectOutput out → P out
Instances For
@[inline]
def Std.Iterators.Types.Attach.Monadic.modifyStep {α : Type w} {m : Type w → Type w'} {β : Type w} [Iterator α m β] {P : β → Prop} (it : IterM m { out : β // P out }) (step : it.internalState.inner.Step) :
Equations
- Std.Iterators.Types.Attach.Monadic.modifyStep it ⟨Std.IterStep.yield it' out, h⟩ = Std.IterStep.yield { internalState := { inner := it', invariant := ⋯ } } ⟨out, ⋯⟩
- Std.Iterators.Types.Attach.Monadic.modifyStep it ⟨Std.IterStep.skip it', h⟩ = Std.IterStep.skip { internalState := { inner := it', invariant := ⋯ } }
- Std.Iterators.Types.Attach.Monadic.modifyStep it ⟨Std.IterStep.done, property⟩ = Std.IterStep.done
Instances For
def Std.Iterators.Types.Attach.instProductivenessRelation {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β] [Productive α m] {P : β → Prop} :
ProductivenessRelation (Attach α m P) m
Equations
- One or more equations did not get rendered due to their size.
Instances For
instance Std.Iterators.Types.Attach.instProductive {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β] [Productive α m] {P : β → Prop} :
Productive (Attach α m P) m
@[inline]
def Std.IterM.attachWith {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β] (it : IterM m β) (P : β → Prop) (h : ∀ (out : β), it.IsPlausibleIndirectOutput out → P out) :
“Attaches” individual proofs to an iterator of values that satisfy a predicate P, returning an
iterator with values in the corresponding subtype { x // P x }.
Termination properties:
Finiteinstance: only if the base iterator is finiteProductiveinstance: only if the base iterator is productive