Documentation

Fad.Chapter1

def Chapter1.map₁ {a : Type u_1} {b : Type u_2} (f : ab) (xs : List a) :
Equations
Instances For
    def Chapter1.map {a : Type u_1} {b : Type u_2} (f : ab) :
    List aList b
    Equations
    Instances For
      theorem Chapter1.map_equal {α : Type u_1} {β : Type u_2} (a : List α) (f : αβ) :
      map f a = List.map f a
      def Chapter1.makeInc (n : ) :
      Equations
      Instances For
        def Chapter1.filter {a : Type} (p : aBool) :
        List aList a
        Equations
        Instances For
          def Chapter1.foldr {a b : Type} (f : abb) (e : b) :
          List ab
          Equations
          Instances For
            def Chapter1.label {α : Type} (xs : List α) :
            List ( × α)
            Equations
            Instances For
              def Chapter1.length₁ {a : Type} (xs : List a) :
              Equations
              Instances For
                def Chapter1.length₂ {α : Type} :
                List α
                Equations
                Instances For
                  def Chapter1.sum (as : List ) :
                  Equations
                  Instances For
                    def Chapter1.foldl {a b : Type} (f : bab) (e : b) :
                    List ab
                    Equations
                    Instances For
                      def Chapter1.foldl₀ {a b : Type} (f : bab) (e : b) :
                      List ab
                      Equations
                      Instances For
                        def Chapter1.foldl₁ {a b : Type} (f : bab) (e : b) (xs : List a) :
                        b
                        Equations
                        Instances For
                          structure Chapter1.Point :
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[implicit_reducible]
                              Equations
                              def Chapter1.head {α : Type} [Inhabited α] :
                              List αα
                              Equations
                              Instances For
                                def Chapter1.head₁ {α : Type} :
                                List αOption α
                                Equations
                                Instances For
                                  def Chapter1.scanl {b : Type u_1} {a : Type u_2} (f : bab) :
                                  bList aList b
                                  Equations
                                  Instances For
                                    def Chapter1.scanr₀ {a b : Type} (f : abb) (q₀ : b) (as : List a) :
                                    Equations
                                    Instances For
                                      def Chapter1.scanr₀.aux {a b : Type} (f : abb) (q₀ : b) :
                                      List a{ l : List b // l [] }
                                      Equations
                                      Instances For
                                        def Chapter1.scanr {a : Type u_1} {b : Type u_2} (f : abb) :
                                        bList aList b
                                        Equations
                                        Instances For
                                          def Chapter1.inserts {a : Type u_1} (x : a) :
                                          List aList (List a)
                                          Equations
                                          Instances For
                                            def Chapter1.concatMap {a : Type u_1} {b : Type} (f : aList b) :
                                            List aList b
                                            Equations
                                            Instances For
                                              def Chapter1.perms1₂ {a : Type u_1} :
                                              List aList (List a)
                                              Equations
                                              Instances For
                                                def Chapter1.perms1₃.step {a : Type} (x : a) (as : List (List a)) :
                                                Equations
                                                Instances For
                                                  def Chapter1.picks {a : Type u_1} :
                                                  List aList (a × List a)
                                                  Equations
                                                  Instances For
                                                    partial def Chapter1.perms2₁ {a : Type} :
                                                    List aList (List a)

                                                    partial because Lean cannot verify termination: p comes from concatMap with no proof that p ∈ picks xs, so p.2.length < xs.length is unknown.

                                                    theorem Chapter1.picks_decreases {a : Type} (xs : List a) (p : a × List a) :
                                                    p picks xsp.2.length < xs.length
                                                    @[irreducible]
                                                    def Chapter1.perms2₂ {a : Type} :
                                                    List aList (List a)

                                                    Uses List.attach to pair each element with its membership proof, then pattern-matches on ⟨p, hp⟩ to obtain hp : p ∈ picks xs inline.

                                                    Equations
                                                    Instances For
                                                      def Chapter1.picks₁ {a : Type u_1} (xs : List a) :
                                                      List { r : a × List a // r.2.length < xs.length }
                                                      Equations
                                                      Instances For
                                                        @[irreducible]
                                                        def Chapter1.perms2₄ {a : Type} :
                                                        List aList (List a)
                                                        Equations
                                                        Instances For
                                                          @[irreducible]
                                                          def Chapter1.perms2₅ {a : Type} :
                                                          List aList (List a)

                                                          Avoids attach by using an explicit helper go that threads the membership proof ∀ p, p ∈ ps → p.2.length < xs.length through the recursion. Requires a lexicographic termination measure (xs.length, ps.length).

                                                          Equations
                                                          Instances For
                                                            @[irreducible]
                                                            def Chapter1.perms2₅.go {a : Type} (xs : List a) (ps : List (a × List a)) :
                                                            (∀ pps, p.2.length < xs.length)List (List a)
                                                            Equations
                                                            Instances For
                                                              partial def Chapter1.until' {a : Sort u_1} (p : aBool) (f : aa) (x : a) :
                                                              a
                                                              def Chapter1.while' {a : Sort u_1} (p : aBool) (f : aa) (x : a) :
                                                              a
                                                              Equations
                                                              Instances For
                                                                theorem Chapter1.map_map {α β γ : Type} (f : βγ) (g : αβ) :
                                                                theorem Chapter1.concatMap_map {α β : Type} (f : αList β) (g : βα) :
                                                                theorem Chapter1.foldr_map {α β : Type} (f : αββ) (e : β) (g : βα) :
                                                                theorem Chapter1.foldr_fusion {a b c : Type} (f : acc) (e : c) (xs : List a) (g : abb) (h : cb) (h₁ : ∀ (x : a) (y : c), h (f x y) = g x (h y)) :
                                                                h (List.foldr f e xs) = List.foldr g (h e) xs
                                                                theorem Chapter1.foldl_comp {α β : Type} (y : α) (e : β) (f : βαβ) :
                                                                (List.foldl f e fun (x : List α) => y :: x) = List.foldl f (f e y)
                                                                @[irreducible]
                                                                Equations
                                                                Instances For
                                                                  Equations
                                                                  Instances For
                                                                    Equations
                                                                    Instances For
                                                                      Equations
                                                                      Instances For
                                                                        def Chapter1.collapse₃.help :
                                                                        × (List List )List ( × List )have tf := List List ; tf
                                                                        Equations
                                                                        Instances For