Documentation

PentagonalNumber.Old

Pentagonal number theorem with Franklin's bijective proof #

This file proves the pentagonal number theorem at pentagonalNumberTheorem in terms of formal power series:

$$\prod_{n=1}^{\infty} (1 - x^n) = \sum_{k=-\infty}^{\infty} (-1)^k x^{k(3k-1)/2}$$

following Franklin's bijective proof presented on the wikipedia page. This long proof is obsolete by the shorter ones in PowerSeries.lean and Complex.lean, but I keep it here to show case how a combinatorial proof can be done.

Basic properties of pentagonal numbers #

def pentagonal'' (k : ) :

Pentagonal numbers, including negative inputs

Equations
Instances For
    theorem two_pentagonal'' (k : ) :
    2 * pentagonal'' k = k * (3 * k - 1)

    Because integer division is hard to work with, we often multiply it by two

    Nonnegativity

    theorem two_pentagonal_inj'' {x y : } (h : x * (3 * x - 1) = y * (3 * y - 1)) :
    x = y

    There are no repeated pentagonal number

    The inverse of pentagonal number $n = k(3k - 1) / 2$ is $$ k = \frac{1 \pm \sqrt{1 + 24n}}{6} $$ We can use $1 + 24n$ to determine whether such inverse exists.

    Equations
    Instances For
      def phiCoeff (n : ) :

      The first definition of $\phi(x)$, where each coefficient is assigned according to the pentagonal number inverse. $0$ if there is no inverse; $(-1)^k$ if there is an inverse $k$.

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

        The coefficients are exactly $(-1)^k$ at pentagonal numbers.

        A coefficient is zero iff and only if it is not a pentagonal number.

        $\phi(x)$ is constructed using the coefficients defined above.

        Equations
        Instances For

          The second definition of $\phi(x)$, summing over terms with pentagonal exponents directly.

          Some utility of lists #

          theorem List.zipIdx_set {α : Type u_1} {l : List α} {n k : } {a : α} :
          (l.set n a).zipIdx k = (l.zipIdx k).set n (a, n + k)
          theorem List.zipIdx_take {α : Type u_1} {l : List α} {n k : } :
          (take n l).zipIdx k = take n (l.zipIdx k)
          theorem List.zipIdx_drop {α : Type u_1} {l : List α} {n k : } :
          (drop n l).zipIdx (k + n) = drop n (l.zipIdx k)
          def List.lengthWhile {α : Type u_1} (p : αProp) [DecidablePred p] :
          List α

          Returns the number of leading elements satisfying a condition.

          Equations
          Instances For
            @[simp]
            theorem List.lengthWhile_nil {α : Type u_1} (p : αProp) [DecidablePred p] :
            theorem List.lengthWhile_le_length {α : Type u_1} (p : αProp) [DecidablePred p] (l : List α) :
            theorem List.lengthWhile_eq_length_iff {α : Type u_1} {p : αProp} [DecidablePred p] {l : List α} :
            theorem List.pred_of_lt_lengthWhile {α : Type u_1} (p : αProp) [DecidablePred p] {l : List α} {i : } (h : i < lengthWhile p l) :
            p l[i]
            theorem List.lengthWhile_eq_iff_of_lt_length {α : Type u_1} {p : αProp} [DecidablePred p] {l : List α} {a : } (ha : a < l.length) :
            lengthWhile p l = a (∀ (i : ) (h : i < a), p l[i]) ¬p l[a]
            theorem List.lengthWhile_mono {α : Type u_1} (p : αProp) [DecidablePred p] (l r : List α) :
            theorem List.lengthWhile_set {α : Type u_1} (p : αProp) [DecidablePred p] (l : List α) {i : } (hi : i < l.length) (hp : ¬p l[i]) (x : α) :
            def List.updateLast {α : Type u_1} (l : List α) (f : αα) :
            List α

            Replace the last element a with f a.

            Equations
            Instances For
              @[simp]
              theorem List.updateLast_id {α : Type u_1} (l : List α) :
              theorem List.updateLast_eq_self {α : Type u_1} (l : List α) (f : αα) (hl : l []) (h : f (l.getLast hl) = l.getLast hl) :
              @[simp]
              theorem List.updateLast_nil {α : Type u_1} (f : αα) :
              @[simp]
              theorem List.updateLast_eq {α : Type u_1} (l : List α) (f : αα) (h : l []) :
              l.updateLast f = l.set (l.length - 1) (f (l.getLast h))
              @[simp]
              theorem List.updateLast_eq_nil_iff {α : Type u_1} (l : List α) (f : αα) :
              @[simp]
              theorem List.getLast_updateLast {α : Type u_1} (l : List α) (f : αα) (h : l []) :
              (l.updateLast f).getLast = f (l.getLast h)
              @[simp]
              theorem List.length_updateLast {α : Type u_1} (l : List α) (f : αα) :
              @[simp]
              theorem List.updateLast_updateLast {α : Type u_1} (l : List α) (f g : αα) :
              theorem List.getElem_updateLast {α : Type u_1} (l : List α) (f : αα) {i : } (h : i + 1 < l.length) :
              (l.updateLast f)[i] = l[i]

              Ferrers diagram #

              A FerrersDiagram n is a representation of distinct partition of number n.

              To represent a partition, we first sort all parts in descending order, such as

              26 = 14 + 8 + 3 + 1  →  [14, 8, 3, 1]
              

              We then calculate the difference between each element, and keep the last element:

              [14, 8, 3, 1]  →  [6, 5, 2, 1]
              

              We get a valid x : FerrersDiagram 26 where x.delta = [6, 5, 2, 1].

              structure FerrersDiagram (n : ) :
              • delta : List

                The difference between parts.

              • delta_pos : List.Forall (fun (x : ) => 0 < x) self.delta

                since we require distinct partition, all delta should be positive.

              • delta_sum : (List.map (fun (p : × ) => p.1 * p.2) (self.delta.zipIdx 1)).sum = n

                All parts should sum back to n. Since we took the difference, this becomes a rolling sum.

              Instances For
                theorem FerrersDiagram.ext {n : } {x y : FerrersDiagram n} (delta : x.delta = y.delta) :
                x = y
                theorem FerrersDiagram.ext_iff {n : } {x y : FerrersDiagram n} :
                x = y x.delta = y.delta
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  There can't be more parts than n

                  theorem FerrersDiagram.delta_ne_nil {n : } (hn : 0 < n) (x : FerrersDiagram n) :

                  The parts are not empty for non-zero n. We will discuss mostly with this condition, leaving the n = 0 case a special one for later.

                  theorem FerrersDiagram.getLast_delta_le_n {n : } (hn : 0 < n) (x : FerrersDiagram n) :
                  x.delta.getLast n

                  All parts are not greater than n. Since the last element of delta equals to the smallest part, it is not greater either.

                  Pentagonal configuration #

                  There is a type of distinct partition we will call "pentagonal". Later, we will see they are in correspondence with pentagonal numbers.

                  The special configuration corresponding to pentagonal number n with a positive k.

                  For example when n = 12, this looks like

                  ∘ ∘ ∘ ∘ ∘
                  ∘ ∘ ∘ ∘
                  ∘ ∘ ∘
                  
                  Equations
                  Instances For

                    The special configuration corresponding to pentagonal number n with a negative k.

                    For example when n = 15, this looks like

                    ∘ ∘ ∘ ∘ ∘ ∘
                    ∘ ∘ ∘ ∘ ∘
                    ∘ ∘ ∘ ∘
                    
                    Equations
                    Instances For

                      "Up" and "Down" movement #

                      We will define two operations on distinct partitions / Ferrers diagram:

                      It is obvious that they are inverse to each other. We will only allow the operation when it is legal to do so. We will then show that for non-pentagonal configurations, either up or down will be legal, and performing the action will make the other one legal.

                      The number of consecutive leading 1 in delta.

                      This is mimicking the "number of elements in the rightmost 45 degree line of the diagram" s, where we have diagSize = s - 1. However, if the configuration is a complete triangle (i.e. delta are all 1), then we actually have diagSize = s. This inconsistency turns out insignificant, because we only care whether this size is smaller than the smallest part, and that's never the case for triangle configuration regardless which definition we take (except for pentagonal configuration, which we will discuss separately anyway)

                      Equations
                      Instances For
                        @[reducible, inline]
                        abbrev FerrersDiagram.takeDiagFun (delta : List ) (i : ) (hi : i < delta.length) :
                        Equations
                        Instances For
                          def FerrersDiagram.takeDiag {n : } (x : FerrersDiagram n) (i : ) (hi : i < x.delta.length) (h : 1 < x.delta[i]) :
                          FerrersDiagram (n - (i + 1))

                          The action to subtract one from the first i + 1 parts.

                          Equations
                          Instances For
                            theorem FerrersDiagram.takeDiag_ne_nil {n : } (x : FerrersDiagram n) (i : ) (hi : i < x.delta.length) (h : 1 < x.delta[i]) :
                            (x.takeDiag i hi h).delta []
                            theorem FerrersDiagram.getLast_takeDiag {n : } (x : FerrersDiagram n) (i : ) (hi : i < x.delta.length - 1) (h : 1 < x.delta[i]) :
                            (x.takeDiag i h).delta.getLast = x.delta.getLast

                            takeDiag preserves the last part as long as we didn't touch it.

                            theorem FerrersDiagram.getLast_takeDiag' {n : } (hn : 0 < n) (x : FerrersDiagram n) (i : ) (hi : i = x.delta.length - 1) (h : 1 < x.delta[i]) :
                            (x.takeDiag i h).delta.getLast = x.delta.getLast - 1

                            takeDiag make the last part smaller by one if we took one from every part

                            @[reducible, inline]
                            abbrev FerrersDiagram.putLastFun (delta : List ) (i : ) :
                            Equations
                            Instances For
                              def FerrersDiagram.putLast {n : } (hn : 0 < n) (x : FerrersDiagram n) (i : ) (hi : i + 1 < x.delta.getLast ) :
                              FerrersDiagram (n + (i + 1))

                              The action to add a new part smaller than every other part.

                              Equations
                              Instances For
                                theorem FerrersDiagram.getLast_putLast {n : } (hn : 0 < n) (x : FerrersDiagram n) (i : ) (hi : i + 1 < x.delta.getLast ) :
                                (putLast hn x i hi).delta.getLast = i + 1

                                putLast updates the last part.

                                theorem FerrersDiagram.diagSize_putLast {n : } (hn : 0 < n) (x : FerrersDiagram n) (i : ) (hi : i + 1 < x.delta.getLast ) (hlast : 1 < x.delta.getLast ) :

                                putLast increases or preserves diagSize.

                                def FerrersDiagram.IsToDown {n : } (hn : 0 < n) (x : FerrersDiagram n) :

                                The criteria to legally move the diagonal down

                                Equations
                                Instances For
                                  theorem FerrersDiagram.diagSize_of_isToDown {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) :
                                  x.diagSize + 1 < n
                                  theorem FerrersDiagram.diagSize_of_isToDown' {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) :
                                  n = n - (x.diagSize + 1) + (x.diagSize + 1)
                                  theorem FerrersDiagram.diagSize_lt_length {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) :
                                  theorem FerrersDiagram.delta_diagSize {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) :
                                  def FerrersDiagram.takeDiag' {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) :

                                  Specialize takeDiag to take precisely the 45 degree diagonal.

                                  Equations
                                  Instances For
                                    theorem FerrersDiagram.diagSize_add_one_lt {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                    x.diagSize + 1 < (takeDiag' hn x hdown).delta.getLast
                                    def FerrersDiagram.down {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :

                                    The down action is defined as takeDiag then putLast.

                                    Equations
                                    Instances For
                                      theorem FerrersDiagram.delta_down {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                      (down hn x hdown hnegpen).delta = putLastFun (takeDiagFun x.delta x.diagSize ) x.diagSize
                                      theorem FerrersDiagram.getLast_down {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                      (down hn x hdown hnegpen).delta.getLast = x.diagSize + 1
                                      theorem FerrersDiagram.length_down {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                      (down hn x hdown hnegpen).delta.length = x.delta.length + 1
                                      theorem FerrersDiagram.down_notToDown {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                      ¬IsToDown hn (down hn x hdown hnegpen)

                                      Barring pentagonal configuration, doing down will make it illegal to down.

                                      theorem FerrersDiagram.down_notPosPentagonal {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                      ¬IsPosPentagonal hn (down hn x hdown hnegpen)

                                      Non-pentagonal configuration will not be positive-pentagonal after down.

                                      theorem FerrersDiagram.down_notNegPentagonal {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                      ¬IsNegPentagonal hn (down hn x hdown hnegpen)

                                      Non-pentagonal configuration will not be negative-pentagonal after down.

                                      @[reducible, inline]
                                      abbrev FerrersDiagram.takeLastFun (delta : List ) (h : delta []) :
                                      Equations
                                      Instances For
                                        def FerrersDiagram.takeLast {n : } (hn : 0 < n) (x : FerrersDiagram n) :

                                        The inverse of putLast

                                        Equations
                                        Instances For
                                          @[reducible, inline]
                                          abbrev FerrersDiagram.putDiagFun (delta : List ) (i : ) (hi : i < delta.length) :
                                          Equations
                                          Instances For
                                            def FerrersDiagram.putDiag {n : } (x : FerrersDiagram n) (i : ) (hi : i < x.delta.length) :
                                            FerrersDiagram (n + (i + 1))

                                            The inverse of takeDiag.

                                            Equations
                                            Instances For
                                              theorem FerrersDiagram.aux_up_size {n : } (hn : 0 < n) (x : FerrersDiagram n) :
                                              n - x.delta.getLast + (x.delta.getLast - 1 + 1) = n
                                              theorem FerrersDiagram.getLast_lt_of_notToDown {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                              theorem FerrersDiagram.getLast_lt_of_notToDown' {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                              def FerrersDiagram.up {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :

                                              The inverse of down.

                                              Equations
                                              Instances For
                                                theorem FerrersDiagram.delta_up {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                (up hn x hdown hpospen).delta = putDiagFun (takeLastFun x.delta ) (x.delta.getLast - 1)
                                                theorem FerrersDiagram.one_lt_length {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                theorem FerrersDiagram.diagSize_up {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                (up hn x hdown hpospen).diagSize = x.delta.getLast - 1
                                                theorem FerrersDiagram.getLast_up {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                x.delta.getLast < (up hn x hdown hpospen).delta.getLast
                                                theorem FerrersDiagram.up_isToDown {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                IsToDown hn (up hn x hdown hpospen)

                                                Barring pentagonal configuration, doing up will make it legal to do down.

                                                theorem FerrersDiagram.length_up {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                (up hn x hdown hpospen).delta.length = x.delta.length - 1
                                                theorem FerrersDiagram.up_notPentagonal {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) (h : ∀ (i : ) (h : i < (up hn x hdown hpospen).delta.length - 1), (up hn x hdown hpospen).delta[i] = 1) :
                                                (up hn x hdown hpospen).delta.length + 1 < (up hn x hdown hpospen).delta.getLast

                                                Non-pentagonal configuration will not be pentagonal after doing up.

                                                Here we disprove the common condition of both pos- and neg- pentagonal.

                                                theorem FerrersDiagram.up_notPosPentagonal {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                ¬IsPosPentagonal hn (up hn x hdown hpospen)
                                                theorem FerrersDiagram.up_notNegPentagonal {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                ¬IsNegPentagonal hn (up hn x hdown hpospen)
                                                theorem FerrersDiagram.takeLastFun_putLastFun (delta : List ) (i : ) (hdelta : delta []) (h : i + 1 delta.getLast hdelta) :
                                                takeLastFun (putLastFun delta i) = delta
                                                theorem FerrersDiagram.putLastFun_takeLastFun (delta : List ) (hdelta : delta []) (hpos : List.Forall (fun (x : ) => 0 < x) delta) :
                                                putLastFun (takeLastFun delta hdelta) (delta.getLast hdelta - 1) = delta
                                                theorem FerrersDiagram.takeDiagFun_putDiagFun (delta : List ) (i : ) (hi : i < delta.length) :
                                                takeDiagFun (putDiagFun delta i hi) i = delta
                                                theorem FerrersDiagram.up_down {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                                up hn (down hn x hdown hnegpen) = x

                                                up is the left inverse of down.

                                                theorem FerrersDiagram.down_up {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                down hn (up hn x hdown hpospen) = x

                                                up is the right inverse of down.

                                                Up/down involution #

                                                We now combine both up and down into one function bij, selecting the operation based on which way is legal. We notice that in either way the parity of delta.length is changed, so this provides a bijection between even and odd non-pentagonal configurations.

                                                theorem FerrersDiagram.parity_up {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : ¬IsToDown hn x) (hpospen : ¬IsPosPentagonal hn x) :
                                                Even (up hn x hdown hpospen).delta.length ¬Even x.delta.length
                                                theorem FerrersDiagram.parity_down {n : } (hn : 0 < n) (x : FerrersDiagram n) (hdown : IsToDown hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                                Even (down hn x hdown hnegpen).delta.length ¬Even x.delta.length
                                                def FerrersDiagram.bij {n : } (hn : 0 < n) (x : FerrersDiagram n) (hpospen : ¬IsPosPentagonal hn x) (hnegpen : ¬IsNegPentagonal hn x) :

                                                bij is either up or down, depending on which way is legal.

                                                Equations
                                                Instances For
                                                  theorem FerrersDiagram.bij_notPosPentagonal {n : } (hn : 0 < n) (x : FerrersDiagram n) (hpospen : ¬IsPosPentagonal hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                                  ¬IsPosPentagonal hn (bij hn x hpospen hnegpen)
                                                  theorem FerrersDiagram.bij_notNegPentagonal {n : } (hn : 0 < n) (x : FerrersDiagram n) (hpospen : ¬IsPosPentagonal hn x) (hnegpen : ¬IsNegPentagonal hn x) :
                                                  ¬IsNegPentagonal hn (bij hn x hpospen hnegpen)
                                                  @[reducible, inline]
                                                  abbrev FerrersDiagram.NpFerrers {n : } (hn : 0 < n) :

                                                  Type of all non-pentagonal Ferrers diagrams.

                                                  Equations
                                                  Instances For
                                                    @[reducible, inline]
                                                    abbrev FerrersDiagram.bijNp {n : } {hn : 0 < n} (x : NpFerrers hn) :

                                                    bij as a function on NpFerrers.

                                                    Equations
                                                    Instances For
                                                      @[simp]
                                                      theorem FerrersDiagram.bijNp_bijNp {n : } {hn : 0 < n} (x : NpFerrers hn) :
                                                      bijNp (bijNp x) = x
                                                      theorem FerrersDiagram.parity_bijNp {n : } {hn : 0 < n} (x : NpFerrers hn) :
                                                      @[reducible, inline]
                                                      abbrev FerrersDiagram.NpEven {n : } (hn : 0 < n) :

                                                      Even non-pentagonal configurations.

                                                      Equations
                                                      Instances For
                                                        @[reducible, inline]
                                                        abbrev FerrersDiagram.NpOdd {n : } (hn : 0 < n) :

                                                        Odd non-pentagonal configurations.

                                                        Equations
                                                        Instances For
                                                          theorem FerrersDiagram.NpFerrers_card_eq {n : } (hn : 0 < n) :

                                                          The numer of even and odd configurations, barring pentagonal ones, are equal.

                                                          Translate Ferrers diagram to distinct partition #

                                                          Unbundled function that calculates parts from delta.

                                                          Equations
                                                          Instances For
                                                            theorem FerrersDiagram.foldDelta_pos_of_pos {l : List } (hpos : al, 0 < a) (a : ) :
                                                            a foldDelta l0 < a
                                                            theorem FerrersDiagram.sum_foldDelta (l : List ) :
                                                            (foldDelta l).sum = (List.map (fun (p : × ) => p.1 * p.2) (l.zipIdx 1)).sum
                                                            theorem FerrersDiagram.foldDelta_sorted (l : List ) :
                                                            List.Pairwise (fun (x1 x2 : ) => x1 x2) (foldDelta l)
                                                            theorem FerrersDiagram.foldDelta_sorted_of_pos {l : List } (hpos : List.Forall (fun (x : ) => 0 < x) l) :
                                                            List.Pairwise (fun (x1 x2 : ) => x1 > x2) (foldDelta l)
                                                            @[simp]
                                                            theorem FerrersDiagram.mergeSort_foldDelta (l : List ) :
                                                            ((foldDelta l).mergeSort fun (x1 x2 : ) => decide (x1 x2)) = foldDelta l

                                                            Unbundled function that calculates delta from parts.

                                                            Equations
                                                            Instances For
                                                              theorem FerrersDiagram.unfoldDelta_pos_of_sorted {l : List } (hsort : List.Pairwise (fun (x1 x2 : ) => x1 > x2) l) (hpos : List.Forall (fun (x : ) => 0 < x) l) :
                                                              List.Forall (fun (x : ) => 0 < x) (unfoldDelta l)
                                                              theorem FerrersDiagram.sum_unfoldDelta' {l : List } (hsort : List.Pairwise (fun (x1 x2 : ) => x1 x2) l) :
                                                              theorem FerrersDiagram.sum_unfoldDelta {l : List } (hsort : List.Pairwise (fun (x1 x2 : ) => x1 x2) l) :
                                                              (List.map (fun (p : × ) => p.1 * p.2) ((unfoldDelta l).zipIdx 1)).sum = l.sum
                                                              @[simp]
                                                              theorem FerrersDiagram.foldDelta_unfoldDelta {l : List } (h : List.Pairwise (fun (x1 x2 : ) => x1 x2) l) :
                                                              theorem FerrersDiagram.Multiset.qind {α : Type u_1} {motive : Multiset αProp} (mk : ∀ (a : List α), motive a) (a : Multiset α) :
                                                              motive a

                                                              Correspondence between FerrersDiagram n and Nat.Partition.distincts n, which also preserves parity.

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

                                                                The difference between even and odd partitions is reduced to pentagonal cases.

                                                                theorem FerrersDiagram.Finset.sum_range_id_mul_two' (n : ) :
                                                                2 * iFinset.range n, i = n * (n - 1)
                                                                theorem FerrersDiagram.negpenSum {k : } (hk : 0 < k) :
                                                                2 * (List.map (fun (p : × ) => p.1 * p.2) ((List.replicate (k - 1) 1 ++ [k + 1]).zipIdx 1)).sum = -k * (3 * -k - 1)

                                                                Calculation of n for negative pentagonal case.

                                                                theorem FerrersDiagram.pospenSum {k : } (hk : 0 < k) :
                                                                2 * (List.map (fun (p : × ) => p.1 * p.2) ((List.replicate (k - 1) 1 ++ [k]).zipIdx 1)).sum = k * (3 * k - 1)

                                                                Calculation of n for positive pentagonal case.

                                                                theorem FerrersDiagram.IsPosPentagonal.two_n_eq {n : } (hn : 0 < n) (x : FerrersDiagram n) (hpospen : IsPosPentagonal hn x) :
                                                                2 * n = x.delta.length * (3 * x.delta.length - 1)

                                                                For positive pentagonal case, delta.length = k.

                                                                theorem FerrersDiagram.IsNegPentagonal.two_n_eq {n : } (hn : 0 < n) (x : FerrersDiagram n) (hpospen : IsNegPentagonal hn x) :
                                                                2 * n = -x.delta.length * (3 * -x.delta.length - 1)

                                                                For negative pentagonal case, delta.length = -k.

                                                                theorem FerrersDiagram.pentagonal_exists_k {n : } (hn : 0 < n) (x : FerrersDiagram n) (hpen : IsPosPentagonal hn x IsNegPentagonal hn x) :
                                                                ∃ (k : ), 2 * n = k * (3 * k - 1) (Even x.delta.length Even k)

                                                                In summary, pentagonal case always gives a pentagonal number n.

                                                                theorem FerrersDiagram.pentagonal_of_exists_k {n : } (hn : 0 < n) {k : } (h : 2 * n = k * (3 * k - 1)) :

                                                                The converse: pentagonal number n gives a pentagonal case.

                                                                There is at most one pentagonal case for a given n.

                                                                Third definition of $\phi$: coefficients represents the existence of even and odd pentagonal partition.

                                                                Final connection #

                                                                def phiCoeff' (n : ) :

                                                                Forth definition: of $\phi$: coefficients represents the difference of even and odd partitions.

                                                                Equations
                                                                Instances For
                                                                  theorem phiCoeff_eq (n : ) :
                                                                  theorem eularPhi :
                                                                  HasProd (fun (n : ℕ+) => 1 - (PowerSeries.monomial n) 1) (PowerSeries.mk fun (x : ) => phiCoeff' x)

                                                                  The multiplication formula of $\phi(x)$ expands precisely to the partition formula.

                                                                  theorem pentagonalNumberTheorem :
                                                                  ∏' (n : ℕ+), (1 - (PowerSeries.monomial n) 1) = ∑' (k : ), (PowerSeries.monomial (k * (3 * k - 1) / 2).toNat) ↑((-1) ^ k)

                                                                  Pentagonal number theorem

                                                                  $$\prod_{n=1}^{\infty} (1 - x^n) = \sum_{k=-\infty}^{\infty} (-1)^k x^{k(3k-1)/2}$$