Documentation

Init.Data.Iterators.Combinators.Monadic.Attach

@[unbox]
structure Std.Iterators.Types.Attach (α : Type w) (m : Type w → Type w') {β : Type w} [Iterator α m β] (P : βProp) :

Internal state of the attachWith combinator. Do not depend on its internals.

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) :
    IterStep (IterM m { out : β // P out }) { out : β // P out }
    Equations
      Instances For
        instance Std.Iterators.Types.Attach.instIterator {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β] {P : βProp} :
        Iterator (Attach α m P) m { out : β // P out }
        Equations
          def Std.Iterators.Types.Attach.instFinitenessRelation {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β] [Finite α m] {P : βProp} :
          Equations
            Instances For
              instance Std.Iterators.Types.Attach.instFinite {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β] [Finite α m] {P : βProp} :
              Finite (Attach α m P) m
              def Std.Iterators.Types.Attach.instProductivenessRelation {α β : Type w} {m : Type w → Type w'} [Monad m] [Iterator α m β] [Productive α m] {P : βProp} :
              Equations
                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
                  instance Std.Iterators.Types.Attach.instIteratorLoop {α β : Type w} {m : Type w → Type w'} [Monad m] {n : Type x → Type x'} [Monad n] {P : βProp} [Iterator α m β] :
                  IteratorLoop (Attach α m P) m n
                  Equations
                    @[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 outP out) :
                    IterM m { 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:

                    • Finite instance: only if the base iterator is finite
                    • Productive instance: only if the base iterator is productive
                    Equations
                      Instances For