Documentation

Mathlib.Data.WSeq.Defs

Miscellaneous definitions concerning weak sequences #

These definitions, as well as those in Mathlib/Data/WSeq/Productive.lean, are not needed for the development of Mathlib/Data/Seq/Parallel.lean.

Get the length of s (if it is finite and completes in finite time).

Equations
    Instances For
      class Stream'.WSeq.IsFinite {α : Type u} (s : WSeq α) :

      A weak sequence is finite if toList s terminates. Equivalently, it is a finite number of think and cons applied to nil.

      Instances
        def Stream'.WSeq.get {α : Type u} (s : WSeq α) [s.IsFinite] :
        List α

        Get the list corresponding to a finite weak sequence.

        Equations
          Instances For
            def Stream'.WSeq.updateNth {α : Type u} (s : WSeq α) (n : ) (a : α) :
            WSeq α

            Replace the nth element of s with a.

            Equations
              Instances For
                def Stream'.WSeq.removeNth {α : Type u} (s : WSeq α) (n : ) :
                WSeq α

                Remove the nth element of s.

                Equations
                  Instances For
                    def Stream'.WSeq.filterMap {α : Type u} {β : Type v} (f : αOption β) :
                    WSeq αWSeq β

                    Map the elements of s over f, removing any values that yield none.

                    Equations
                      Instances For
                        def Stream'.WSeq.filter {α : Type u} (p : αProp) [DecidablePred p] :
                        WSeq αWSeq α

                        Select the elements of s that satisfy p.

                        Equations
                          Instances For
                            def Stream'.WSeq.find {α : Type u} (p : αProp) [DecidablePred p] (s : WSeq α) :

                            Get the first element of s satisfying p.

                            Equations
                              Instances For
                                def Stream'.WSeq.zipWith {α : Type u} {β : Type v} {γ : Type w} (f : αβγ) (s1 : WSeq α) (s2 : WSeq β) :
                                WSeq γ

                                Zip a function over two weak sequences

                                Equations
                                  Instances For
                                    def Stream'.WSeq.zip {α : Type u} {β : Type v} :
                                    WSeq αWSeq βWSeq (α × β)

                                    Zip two weak sequences into a single sequence of pairs

                                    Equations
                                      Instances For
                                        def Stream'.WSeq.findIndexes {α : Type u} (p : αProp) [DecidablePred p] (s : WSeq α) :

                                        Get the list of indexes of elements of s satisfying p

                                        Equations
                                          Instances For
                                            def Stream'.WSeq.findIndex {α : Type u} (p : αProp) [DecidablePred p] (s : WSeq α) :

                                            Get the index of the first element of s satisfying p

                                            Equations
                                              Instances For
                                                def Stream'.WSeq.indexOf {α : Type u} [DecidableEq α] (a : α) :

                                                Get the index of the first occurrence of a in s

                                                Equations
                                                  Instances For
                                                    def Stream'.WSeq.indexesOf {α : Type u} [DecidableEq α] (a : α) :
                                                    WSeq αWSeq

                                                    Get the indexes of occurrences of a in s

                                                    Equations
                                                      Instances For
                                                        def Stream'.WSeq.union {α : Type u} (s1 s2 : WSeq α) :
                                                        WSeq α

                                                        union s1 s2 is a weak sequence which interleaves s1 and s2 in some order (nondeterministically).

                                                        Equations
                                                          Instances For

                                                            Returns true if s is nil and false if s has an element

                                                            Equations
                                                              Instances For
                                                                def Stream'.WSeq.compute {α : Type u} (s : WSeq α) :
                                                                WSeq α

                                                                Calculate one step of computation

                                                                Equations
                                                                  Instances For
                                                                    def Stream'.WSeq.take {α : Type u} (s : WSeq α) (n : ) :
                                                                    WSeq α

                                                                    Get the first n elements of a weak sequence

                                                                    Equations
                                                                      Instances For
                                                                        def Stream'.WSeq.splitAt {α : Type u} (s : WSeq α) (n : ) :

                                                                        Split the sequence at position n into a finite initial segment and the weak sequence tail

                                                                        Equations
                                                                          Instances For
                                                                            def Stream'.WSeq.any {α : Type u} (s : WSeq α) (p : αBool) :

                                                                            Returns true if any element of s satisfies p

                                                                            Equations
                                                                              Instances For
                                                                                def Stream'.WSeq.all {α : Type u} (s : WSeq α) (p : αBool) :

                                                                                Returns true if every element of s satisfies p

                                                                                Equations
                                                                                  Instances For
                                                                                    def Stream'.WSeq.scanl {α : Type u} {β : Type v} (f : αβα) (a : α) (s : WSeq β) :
                                                                                    WSeq α

                                                                                    Apply a function to the elements of the sequence to produce a sequence of partial results. (There is no scanr because this would require working from the end of the sequence, which may not exist.)

                                                                                    Equations
                                                                                      Instances For
                                                                                        def Stream'.WSeq.inits {α : Type u} (s : WSeq α) :
                                                                                        WSeq (List α)

                                                                                        Get the weak sequence of initial segments of the input sequence

                                                                                        Equations
                                                                                          Instances For
                                                                                            def Stream'.WSeq.collect {α : Type u} (s : WSeq α) (n : ) :
                                                                                            List α

                                                                                            Like take, but does not wait for a result. Calculates n steps of computation and returns the sequence computed so far

                                                                                            Equations
                                                                                              Instances For