Documentation

Cslib.Foundations.Data.OmegaSequence.Defs

Definition of ωSequence and functions on infinite sequences #

An ωSequence α is an infinite sequence of elements of α. It is basically a wrapper around the type ℕ → α which supports the dot-notation and the analogues of many familiar API functions of List α. In particular, the element at postion n : ℕ of s : ωSequence α is obtained using the function application notation s n.

In this file we define ωSequence and its API functions. Most code below is adapted from Mathlib.Data.Stream.Defs.

structure Cslib.ωSequence (α : Type u) :

An ωSequence α is an infinite sequence of elements of α.

  • get : α

    The function that defines this infinite sequence.

Instances For
    instance Cslib.instCoeForallNatωSequence {α : Type u} :
    Coe (α) (ωSequence α)
    Equations
    @[reducible, inline]
    abbrev Cslib.ωSequence.head {α : Type u} (s : ωSequence α) :
    α

    Head of an ω-sequence: ωSequence.head s = ωSequence s 0.

    Equations
    Instances For

      Tail of an ω-sequence: ωSequence.tail (h :: t) = t.

      Equations
      Instances For
        def Cslib.ωSequence.drop {α : Type u} (n : ) (s : ωSequence α) :

        Drop first n elements of an ω-sequence.

        Equations
        Instances For
          def Cslib.ωSequence.take {α : Type u} :
          ωSequence αList α

          take n s returns a list of the n first elements of ω-sequence s

          Equations
          Instances For
            def Cslib.ωSequence.extract {α : Type u} (xs : ωSequence α) (m n : ) :
            List α

            Get the list containing the elements of xs from position m to n - 1.

            Equations
            Instances For
              def Cslib.ωSequence.cons {α : Type u} (a : α) (s : ωSequence α) :

              Prepend an element to an ω-sequence.

              Equations
              Instances For

                Prepend an element to an ω-sequence.

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

                  Append an ω-sequence to a list.

                  Equations
                  Instances For

                    Append an ω-sequence to a list.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Cslib.ωSequence.const {α : Type u} (a : α) :

                      The constant ω-sequence: ωSequence n (ωSequence.const a) = a.

                      Equations
                      Instances For
                        def Cslib.ωSequence.map {α : Type u} {β : Type v} (f : αβ) (s : ωSequence α) :

                        Apply a function f to all elements of an ω-sequence s.

                        Equations
                        Instances For
                          def Cslib.ωSequence.zip {α : Type u} {β : Type v} {δ : Type w} (f : αβδ) (s₁ : ωSequence α) (s₂ : ωSequence β) :

                          Zip two ω-sequences using a binary operation: ωSequence n (ωSequence.zip f s₁ s₂) = f (ωSequence s₁) (ωSequence s₂).

                          Equations
                          Instances For
                            def Cslib.ωSequence.iterate {α : Type u} (f : αα) (a : α) :

                            Iterates of a function as an ω-sequence.

                            Equations
                            Instances For