Documentation

Fad.«Chapter1-Ex»

def Chapter1.inits {a : Type u_1} :
List aList (List a)
Equations
Instances For
    def Chapter1.tails {a : Type u_1} :
    List aList (List a)
    Equations
    Instances For
      def Chapter1.dropWhile {α : Type u_1} (p : αBool) (xs : List α) :
      List α
      Equations
      Instances For
        def Chapter1.uncons {α : Type} (xs : List α) :
        Option (α × List α)
        Equations
        Instances For
          def Chapter1.wrap {α : Type} (a : α) :
          List α
          Equations
          Instances For
            def Chapter1.unwrap {α : Type} (a : List α) :
            Equations
            Instances For
              def Chapter1.unwrap! {α : Type} [Inhabited α] (a : List α) :
              α
              Equations
              Instances For
                def Chapter1.single {α : Type} (a : List α) :
                Equations
                Instances For
                  def Chapter1.reverse₀.helper {α : Type} (a res : List α) :
                  List α
                  Equations
                  Instances For
                    theorem Chapter1.rev_cons {α✝ : Type} {x : α✝} {xs : List α✝} :
                    theorem Chapter1.rev_append {α : Type} (as bs : List α) :
                    def Chapter1.map' {α β : Type} (f : αβ) (xs : List α) :
                    List β
                    Equations
                    Instances For
                      def Chapter1.filter' {α : Type} (p : αBool) (xs : List α) :
                      List α
                      Equations
                      Instances For
                        theorem Chapter1.foldr_filter_aux {α✝ α✝¹ : Type} {f : α✝α✝¹α✝¹} {e : α✝¹} {p : α✝Bool} {ys : List α✝} :
                        (foldr f e filter p) ys = foldr f e (filter p ys)
                        def Chapter1.takeWhile {α : Type} (p : αBool) :
                        List αList α
                        Equations
                        Instances For
                          def Chapter1.dropWhileEnd {α : Type} (p : αBool) (xs : List α) :
                          List α
                          Equations
                          Instances For
                            @[irreducible]
                            def Chapter1.foldr' {a b : Type} [Inhabited a] (f : abb) (e : b) (xs : List a) :
                            b
                            Equations
                            Instances For
                              def Chapter1.last₁ {a : Type} (as : List a) (ok : as []) :
                              a
                              Equations
                              Instances For
                                @[irreducible]
                                def Chapter1.foldl' {a b : Type} (f : bab) (e : b) (xs : List a) :
                                b
                                Equations
                                Instances For
                                  Equations
                                  Instances For
                                    Equations
                                    Instances For
                                      def Chapter1.apply {a : Type} :
                                      (aa)aa
                                      Equations
                                      Instances For
                                        def Chapter1.apply₁ {a : Type} :
                                        (aa)aa
                                        Equations
                                        Instances For
                                          def Chapter1.inserts₁ {a : Type} (x : a) (ys : List a) :
                                          Equations
                                          Instances For
                                            def Chapter1.remove {α : Type} [DecidableEq α] (x : α) :
                                            List αList α
                                            Equations
                                            Instances For
                                              partial def Chapter1.perms₃ {α : Type} [DecidableEq α] :
                                              List αList (List α)
                                              Equations
                                              Instances For
                                                def Chapter1.f (x y : ) :
                                                Equations
                                                Instances For
                                                  theorem Chapter1.foldr_fusion_cxt {a b c : Type} (f : acc) (e : c) (xs : List a) (g : abb) (h : cb) (h₁ : ∀ (x : a) (ys : List a), h (f x (List.foldr f e ys)) = g x (h (List.foldr f e ys))) :
                                                  h (List.foldr f e xs) = List.foldr g (h e) xs
                                                  theorem Chapter1.replace_of_even {x : } (h : Even x) :

                                                  replace é a identidade em todo valor computado por foldr f 0, pois esses valores são sempre pares. -

                                                  theorem Chapter1.foldl_fusion {a b c : Type} (f : cac) (g : bab) (h : cb) (h₁ : ∀ (y : c) (x : a), h (f y x) = g (h y) x) (e : c) (xs : List a) :
                                                  h (List.foldl f e xs) = List.foldl g (h e) xs

                                                  Fusion law for foldl.

                                                  The intuition mirrors the foldr fusion law: we want to push a post-processing function h inside a foldl, replacing an accumulator of type c by an already-transformed accumulator of type b.

                                                  The hypothesis h₁ : ∀ y x, h (f y x) = g (h y) x states that h turns one step of f (taken on the untransformed accumulator) into the corresponding step of g (taken on the transformed accumulator). In other words, h is a step-by-step homomorphism between the two accumulators: the diagram commutes for every element x of the list.

                                                  Consequently, applying h to the final result of xs.foldl f e is the same as running xs.foldl g starting from the transformed accumulator h e.

                                                  Note the contrast with foldr fusion: since in foldl the accumulator sits on the left, the condition relates h (f y x) to g (h y) x, keeping x on the same side. -

                                                  def Chapter1.concat {α : Type} (xss : List (List α)) :
                                                  List α
                                                  Equations
                                                  Instances For
                                                    Equations
                                                    Instances For