Documentation

Init.Data.Range.Polymorphic.RangeIterator

@[unbox]
structure Std.Rxc.Iterator (α : Type u) :

Internal state of the range iterators. Do not depend on its internals.

  • next : Option α
  • upperBound : α
Instances For
    @[inline]

    The pure function mapping a range iterator of type IterM to the next step of the iterator.

    This function is prefixed with Monadic in order to disambiguate it from the version for iterators of type Iter.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[inline]

      The pure function mapping a range iterator of type Iter to the next step of the iterator.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[inline]
        Equations
        • One or more equations did not get rendered due to their size.
        Equations
        • One or more equations did not get rendered due to their size.
        @[inline]

        An efficient IteratorLoop instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

        Equations
        • One or more equations did not get rendered due to their size.
        @[irreducible, specialize #[]]
        def Std.Rxc.Iterator.instIteratorLoop.loop {α : Type u} [PRange.UpwardEnumerable α] [LE α] [DecidableLE α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (Pl : αγForInStep γProp) (wf : Iterators.IteratorLoop.WellFounded (Rxc.Iterator α) Id Pl) (upperBound least : α) (acc : γ) (f : (out : α) → PRange.UpwardEnumerable.LE least outout upperBound(c : γ) → n { s : ForInStep γ // Pl out c s }) (next : α) (hl : PRange.UpwardEnumerable.LE least next) (hu : next upperBound) :
        n γ
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          An efficient IteratorLoop instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

          Equations
          • One or more equations did not get rendered due to their size.
          @[specialize #[]]
          partial def Std.Rxc.Iterator.instIteratorLoopPartial.loop {α : Type u} [PRange.UpwardEnumerable α] [LE α] [DecidableLE α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (upperBound least : α) (acc : γ) (f : (out : α) → PRange.UpwardEnumerable.LE least outout upperBoundγn (ForInStep γ)) (next : α) (hl : PRange.UpwardEnumerable.LE least next) (hu : next upperBound) :
          n γ
          @[irreducible]
          theorem Std.Rxc.Iterator.instIteratorLoop.loop_eq {α : Type u} {least : α} [PRange.UpwardEnumerable α] [LE α] [DecidableLE α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLE α] {n : Type u → Type w} [Monad n] [LawfulMonad n] {γ : Type u} {lift : (γ δ : Type u) → (γn δ)Id γn δ} [Internal.LawfulMonadLiftBindFunction lift] {PlausibleForInStep : αγForInStep γProp} {upperBound next : α} {hl : PRange.UpwardEnumerable.LE least next} {hu : next upperBound} {f : (out : α) → PRange.UpwardEnumerable.LE least outout upperBound(c : γ) → n { s : ForInStep γ // PlausibleForInStep out c s }} {acc : γ} {wf : Iterators.IteratorLoop.WellFounded (Rxc.Iterator α) Id PlausibleForInStep} :
          loop γ PlausibleForInStep wf upperBound least acc f next hl hu = do let __do_liftf next hl hu acc match __do_lift with | ForInStep.yield c, property => Iterators.IterM.DefaultConsumers.forIn' lift γ PlausibleForInStep wf { internalState := { next := PRange.succ? next, upperBound := upperBound } } c { internalState := { next := PRange.succ? next, upperBound := upperBound } }.IsPlausibleIndirectOutput fun (b : α) (h : { internalState := { next := PRange.succ? next, upperBound := upperBound } }.IsPlausibleIndirectOutput b) (c : γ) => f b c | ForInStep.done c, property => pure c
          @[unbox]
          structure Std.Rxo.Iterator (α : Type u) :

          Internal state of the range iterators. Do not depend on its internals.

          • next : Option α
          • upperBound : α
          Instances For
            @[inline]

            The pure function mapping a range iterator of type IterM to the next step of the iterator.

            This function is prefixed with Monadic in order to disambiguate it from the version for iterators of type Iter.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              @[inline]

              The pure function mapping a range iterator of type Iter to the next step of the iterator.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[inline]
                Equations
                • One or more equations did not get rendered due to their size.
                Equations
                • One or more equations did not get rendered due to their size.
                @[inline]

                An efficient IteratorLoop instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

                Equations
                • One or more equations did not get rendered due to their size.
                @[irreducible, specialize #[]]
                def Std.Rxo.Iterator.instIteratorLoop.loop {α : Type u} [PRange.UpwardEnumerable α] [LT α] [DecidableLT α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (Pl : αγForInStep γProp) (wf : Iterators.IteratorLoop.WellFounded (Rxo.Iterator α) Id Pl) (upperBound least : α) (acc : γ) (f : (out : α) → PRange.UpwardEnumerable.LE least outout < upperBound(c : γ) → n { s : ForInStep γ // Pl out c s }) (next : α) (hl : PRange.UpwardEnumerable.LE least next) (hu : next < upperBound) :
                n γ
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  An efficient IteratorLoopPartial instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  @[specialize #[]]
                  partial def Std.Rxo.Iterator.instIteratorLoopPartial.loop {α : Type u} [PRange.UpwardEnumerable α] [LT α] [DecidableLT α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (upperBound least : α) (acc : γ) (f : (out : α) → PRange.UpwardEnumerable.LE least outout < upperBoundγn (ForInStep γ)) (next : α) (hl : PRange.UpwardEnumerable.LE least next) (hu : next < upperBound) :
                  n γ
                  @[irreducible]
                  theorem Std.Rxo.Iterator.instIteratorLoop.loop_eq {α : Type u} {least : α} [PRange.UpwardEnumerable α] [LT α] [DecidableLT α] [PRange.LawfulUpwardEnumerable α] [PRange.LawfulUpwardEnumerableLT α] {n : Type u → Type w} [Monad n] [LawfulMonad n] {γ : Type u} {lift : (γ δ : Type u) → (γn δ)Id γn δ} [Internal.LawfulMonadLiftBindFunction lift] {PlausibleForInStep : αγForInStep γProp} {upperBound next : α} {hl : PRange.UpwardEnumerable.LE least next} {hu : next < upperBound} {f : (out : α) → PRange.UpwardEnumerable.LE least outout < upperBound(c : γ) → n { s : ForInStep γ // PlausibleForInStep out c s }} {acc : γ} {wf : Iterators.IteratorLoop.WellFounded (Rxo.Iterator α) Id PlausibleForInStep} :
                  loop γ PlausibleForInStep wf upperBound least acc f next hl hu = do let __do_liftf next hl hu acc match __do_lift with | ForInStep.yield c, property => Iterators.IterM.DefaultConsumers.forIn' lift γ PlausibleForInStep wf { internalState := { next := PRange.succ? next, upperBound := upperBound } } c { internalState := { next := PRange.succ? next, upperBound := upperBound } }.IsPlausibleIndirectOutput fun (b : α) (h : { internalState := { next := PRange.succ? next, upperBound := upperBound } }.IsPlausibleIndirectOutput b) (c : γ) => f b c | ForInStep.done c, property => pure c
                  @[unbox]
                  structure Std.Rxi.Iterator (α : Type u) :

                  Internal state of the range iterators. Do not depend on its internals.

                  Instances For
                    @[inline]

                    The pure function mapping a range iterator of type IterM to the next step of the iterator.

                    This function is prefixed with Monadic in order to disambiguate it from the version for iterators of type Iter.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[inline]

                      The pure function mapping a range iterator of type Iter to the next step of the iterator.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        @[inline]
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[inline]

                        An efficient IteratorLoop instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        @[irreducible, specialize #[]]
                        def Std.Rxi.Iterator.instIteratorLoop.loop {α : Type u} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (Pl : αγForInStep γProp) (wf : Iterators.IteratorLoop.WellFounded (Rxi.Iterator α) Id Pl) (least : α) (acc : γ) (f : (out : α) → PRange.UpwardEnumerable.LE least out(c : γ) → n { s : ForInStep γ // Pl out c s }) (next : α) (hl : PRange.UpwardEnumerable.LE least next) :
                        n γ
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          An efficient IteratorLoopPartial instance: As long as the compiler cannot optimize away the Option in the internal state, we use a special loop implementation.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          @[specialize #[]]
                          partial def Std.Rxi.Iterator.instIteratorLoopPartial.loop {α : Type u} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] (γ : Type u) (least : α) (acc : γ) (f : (out : α) → PRange.UpwardEnumerable.LE least outγn (ForInStep γ)) (next : α) (hl : PRange.UpwardEnumerable.LE least next) :
                          n γ
                          @[irreducible]
                          theorem Std.Rxi.Iterator.instIteratorLoop.loop_eq {α : Type u} {least : α} [PRange.UpwardEnumerable α] [PRange.LawfulUpwardEnumerable α] {n : Type u → Type w} [Monad n] [LawfulMonad n] {γ : Type u} {lift : (γ δ : Type u) → (γn δ)Id γn δ} [Internal.LawfulMonadLiftBindFunction lift] {PlausibleForInStep : αγForInStep γProp} {next : α} {hl : PRange.UpwardEnumerable.LE least next} {f : (out : α) → PRange.UpwardEnumerable.LE least out(c : γ) → n { s : ForInStep γ // PlausibleForInStep out c s }} {acc : γ} {wf : Iterators.IteratorLoop.WellFounded (Rxi.Iterator α) Id PlausibleForInStep} :
                          loop γ PlausibleForInStep wf least acc f next hl = do let __do_liftf next hl acc match __do_lift with | ForInStep.yield c, property => Iterators.IterM.DefaultConsumers.forIn' lift γ PlausibleForInStep wf { internalState := { next := PRange.succ? next } } c { internalState := { next := PRange.succ? next } }.IsPlausibleIndirectOutput fun (b : α) (h : { internalState := { next := PRange.succ? next } }.IsPlausibleIndirectOutput b) (c : γ) => f b c | ForInStep.done c, property => pure c