A proof of Moessner’s theorem by coinduction
 679 Downloads
 3 Citations
Abstract
We present a coinductive proof of Moessner’s theorem. This theorem describes the construction of the stream (1^{ n },2^{ n },3^{ n },…) (for n≥1) out of the stream of positive natural numbers by repeatedly dropping and summing elements. Our formalisation consists of a direct translation of the operational description of Moessner’s procedure into the equivalence of—in essence—two functional programs. Our proof fully exploits the circularity that is implicitly present in Moessner’s procedure, and it is more elementary than existing proofs. As such, it serves as a nontrivial illustration of the relevance and power of coinduction.
Keywords
Stream Stream bisimulation Coalgebra Coinduction Stream differential equation Stream calculus Moessner’s theorem1 Introduction
Here, we present another proof of Moessner’s theorem, based on coinduction. Coinduction is both a definition principle and a proof principle, and it is one of the cornerstones of the theory of coalgebra [9]. It is dual to the wellknown principle of mathematical induction, which is wellsuited for finite and wellfounded structures, such as the natural numbers and finite lists. In contrast, coinduction can be used for reasoning about infinite structures such as the streams of natural numbers above.
 1.
Our formalisation of Moessner’s procedure consists of a direct translation of the operational description of Moessner’s procedure with which we started this paper.
 2.
The construction of a suitable stream bisimulation, which as usual constitutes the heart of a proof by coinduction, fully exploits the circularity that is present in our definition of both the stream of natural numbers and the drop and sum operators.
 3.
Our proof is elementary to a degree that we expect that it can be easily automated, as is often the case with coinductive proofs.
None of these characteristics are shared by the aforementioned classic proofs by Perron, Paasche and Salié. And although Hinze’s proof does exploit some of the circularity involved, using corecursive definitions of the operators it uses, his formalisation is at a considerable distance from the original operational description of Moessner’s procedure. Moreover, the proof by Hinze is, to be sure, very interesting and clever but also somewhat ad hoc and relatively complex.
At the same time, the proofs by Paasche, Salié and Hinze deal with both Moessner’s original theorem and with the generalisations mentioned above. In contrast, our present proof deals with Moessner’s original procedure only. And although we conclude our paper with a formalisation of a representative example of these generalisations, finding a proof by coinduction for this representative example is left as future work.
2 Preliminaries
 The stream \(\overline{n} = (n,n,n, \ldots)\), for every n∈ℕ, is given by the following stream differential equation:with initial value \(\overline{n}(0) = n\).$$\overline{n}'= \overline{n} $$
 The elementwise sumof two streams σ,τ∈ℕ^{ ω } can be specified by the following stream differential equation:$$\sigma+ \tau= \bigl(\sigma(0) + \tau(0) , \sigma(1) + \tau(1) , \sigma(2) + \tau(2), \ldots\bigr) $$with initial value$$(\sigma+ \tau)' = \sigma' + \tau' $$(We use overloading: the same symbol is used for the sum of natural numbers and the sum of streams.)$$(\sigma+ \tau) (0) = \sigma(0) + \tau(0) $$
 Using the operation of sum, we can specify the stream of the positive natural numbers nat=(1,2,3,…) bywith initial value nat(0)=1.$$\mbox {\textsf {nat}}'= \mbox {\textsf {nat}}+ \overline {1}$$
 The (elementwise) Hadamard productof two streams σ,τ∈ℕ^{ ω } satisfies$$\sigma\odot\tau= \bigl(\sigma(0) \cdot\tau(0) , \sigma(1) \cdot \tau(1) , \sigma(2) \cdot\tau(2), \ldots\bigr) $$with initial value$$(\sigma\odot\tau)' = \sigma' \odot \tau' $$$$(\sigma\odot\tau) (0) = \sigma(0) \cdot\tau(0) $$
 The following notation will be convenient. For a stream σ and for n≥0, we defineThus σ ^{〈1〉}=σ, σ ^{〈2〉}=σ⊙σ, σ ^{〈3〉}=σ⊙σ⊙σ, and so on. Also,$$\sigma^{\langle0 \rangle} = \overline {1}\qquad \sigma^{\langle n+1 \rangle} = \sigma\odot \sigma^{ \langle n \rangle} $$$$\mbox {\textsf {nat}}^{ \langle n \rangle} = \bigl(1^n, 2^n, 3^n, \ldots\bigr) $$
 Scalar multiplicationof a stream σ∈ℕ^{ ω } with a natural number k∈ℕ satisfies:$$k\sigma= \bigl(k \cdot\sigma(0) , k \cdot\sigma(1) , k \cdot\sigma (2) , \ldots \bigr) $$with initial value$$(k\sigma)' = k\sigma' $$$$(k\sigma) (0) = k \cdot\sigma(0) $$
 For every σ∈ℕ^{ ω }, the streamof partial sums of σ is defined by the following stream differential equation:$$\varSigma \sigma = \bigl(\sigma(0) , \sigma(0) + \sigma(1) , \sigma(0) + \sigma(1) + \sigma(2) , \ldots\bigr) $$with initial value$$( \varSigma \sigma )' = \bigl( \varSigma \sigma' \bigr) + \overline{\sigma(0)} $$$$( \varSigma \sigma ) (0) = \sigma(0) $$
 We define drop operators \(D_{k}^{i}\), for all k≥2 and 0≤i<k, and for all σ∈ℕ^{ ω }, by the following system of stream differential equations: for all k≥2 and 0≤i<k−1, with initial values The operator \(D_{k}^{i}\) repeatedly drops the ith element of every block of k elements of the incoming stream (please note that we start counting the elements of streams with 0). For instance,$$D_3^1(\sigma) = \bigl(\sigma(0), \sigma(2), \sigma(3), \sigma(5), \sigma(6), \sigma(8) ,\ldots\bigr) $$
 It will be convenient to have one function symbol for the composition of a drop operator with the operator for partial sums. Therefore we define, for all k≥2 and 0≤i<k,These operators satisfy the following differential equations: for all k≥2 and 0≤i<k−1, with initial values$$\varSigma_k^i = \varSigma\circ D_k^i $$
(It is straightforward to prove that all of the stream differential equations [10] mentioned above are welldefined, that is, have a unique solution.)
In our proof of Moessner’s theorem, we will use a few basic properties of the operators above, all of which are easily verified.
Proposition 2.1
We use stream differential equations not only because they offer a very succinct and convenient way of specifying streams. Equally importantly, they also allow us to build stream bisimulation relations, which are defined in terms of stream derivatives and initial values. Stream bisimulations are the key ingredient of proofs by coinduction, as we will see shortly.
Definition 2.2
(stream bisimulation)
 (1)
σ(0)=τ(0)
 (2)
(σ′,τ′)∈R
Theorem 2.3
(coinduction proof principle)
Proof
If R is a bisimulation relation, then one proves σ(n)=τ(n), for all σ,τ∈ℕ^{ ω } with (σ,τ)∈R, by induction on n∈ℕ. □
Example 2.4
 (i)for all σ, τ and ρ in ℕ^{ ω },$$\bigl( (\sigma\otimes\tau)\otimes\rho, \sigma \otimes( \tau \otimes\rho) \bigr) \in R $$
 (ii)for all (σ _{1},σ _{2})∈R and (τ _{1},τ _{2})∈R,$$( \sigma_1 + \tau_1 , \sigma_2 + \tau_2 ) \in R $$
The example above will not play a role in the rest of this paper, apart from the last part of Sect. 7, where we discuss future research.
3 Moessner’s theorem
Using the definitions from Sect. 2, we shall now formalise Moessner’s construction, which we shall start not with the stream of natural numbers but with the constant stream \(\overline {1}= (1,1,1, \ldots)\). This formulation is equivalent to the description given in the introduction because, as we shall see, \(\varSigma \overline {1}= \mbox {\textsf {nat}}\) whence \(\varSigma^{n}_{n+1} \overline {1}= \mbox {\textsf {nat}}\), for all n≥1.
Theorem 3.1
(Moessner’s theorem)
We note that the above formula is a direct translation of the operational description of Moessner’s procedure, given in the introduction.
4 The proof: warming up
We shall first prove Moessner’s theorem for n=1 and n=2. The proofs will be by coinduction and consist of the construction of a stream bisimulation relation. After that, it will be easy to define one (big) bisimulation relation for Moessner’s theorem in its full generality, for all n≥1 at the same time.
4.1 Moessner theorem for n=1
 (i)
\(( \varSigma^{1}_{2} \overline {1}, \mbox {\textsf {nat}}) \in R \)
 (ii)
\(( \varSigma^{0}_{2} \overline {1}, \mbox {\textsf {nat}}) \in R \)
 (iii)
for all σ∈ℕ^{ ω }, (σ,σ)∈R
 (iv)for all (σ _{1},τ _{1})∈R and (σ _{2},τ _{2})∈R,$$(\sigma_1 + \sigma_2 , \tau_1 + \tau_2 ) \in R $$
4.2 Moessner theorem for n=2
 (i)
\(( \varSigma^{1}_{2} \overline {1}, \mbox {\textsf {nat}}) \in R\) and \(( \varSigma^{1}_{2} \varSigma^{2}_{3} \overline {1}, \mbox {\textsf {nat}}^{ \langle2 \rangle } ) \in R \)
 (ii)
\(( \varSigma^{0}_{2} \overline {1}, \mbox {\textsf {nat}}) \in R \) and \(( \varSigma^{0}_{2} \varSigma^{1}_{3} \overline {1}, \mbox {\textsf {nat}}\odot(\mbox {\textsf {nat}}+ \overline {1}) ) \in R\)
 (iii)
for all σ∈ℕ^{ ω }, (σ,σ)∈R
 (iv)
for all (σ _{1},τ _{1})∈R and (σ _{2},τ _{2})∈R, (σ _{1}+σ _{2},τ _{1}+τ _{2})∈R
5 The proof: general case
 (i)for all n≥1,$$\bigl( \varSigma^1_2 \varSigma^2_3 \cdots \varSigma^n_{n+1} \overline {1}, \mbox {\textsf {nat}}^{ \langle n \rangle} \bigr) \in R $$
 (ii)for all n≥1,$$\bigl( \varSigma^0_2 \varSigma^1_3 \cdots \varSigma^{n1}_{n+1} \overline {1}, \mbox {\textsf {nat}}\odot(\mbox {\textsf {nat}}+ \overline {1})^{ \langle n1 \rangle} \bigr) \in R $$
 (iii)for all σ∈ℕ^{ ω },$$(\sigma, \sigma) \in R $$
 (iv)for all (σ _{1},τ _{1})∈R and (σ _{2},τ _{2})∈R,$$(\sigma_1 + \sigma_2 , \tau_1 + \tau_2 ) \in R $$
In order to prove that the relation R is a bisimulation, we shall use the following facts.
Proposition 5.1
Proposition 5.2
Proposition 5.3
Proposition 5.4
Using these four propositions, one can easily show that the relation R, defined at the beginning of this section, is a stream bisimulation relation. Moessner’s theorem, now for all n≥1, follows as before by coinduction.
6 Stream calculus
The coinductive proof of the previous section is what we see as the main contribution of this paper. In the present section, we want to give yet another proof of Moessner’s theorem, which can be viewed as an equational version of the proof by coinduction: by using a bit of elementary stream calculus [10], of which we shall briefly recall the basics below, we can find closed expressions for each of the streams in Moessner’s theorem. The theorem is then proved by showing that these expressions are equal.
In the remainder of this section, we shall apply the stream calculus above for yet another proof of Moessner’s theorem. More specifically, we shall prove that both streams on the lefthand side and the righthand side of Moessner’s identity are rational, using the fundamental theorem together with the propositions from Sect. 5. Then Moessner’s follows simply from the observation that these rational streams are equal.
6.1 A rational expression for \(\varSigma^{1}_{2} \varSigma^{2}_{3} \cdots \varSigma^{n}_{n+1} \overline {1}\)
6.2 A rational expression for nat ^{〈n〉}
6.3 Yet another proof of Moessner’s theorem
7 Discussion

Streams are viewed as single entities.
 The coinduction proof principle, Theorem 2.3, says that in order to prove that two streams are the same, it suffices to show that they behave the same (since two streams have the same behaviour if they are related by a bisimulation). For streams, in other words,
being is doing

Showing that two streams behave the same (and hence are equal) is particularly easy when their behaviour is circular. Circularity makes it possible to construct finite or (using induction) finitary bisimulation relations.
 For the proof of Moessner’s theorem, the circularity involved is expressed by the stream differential equations for the operations of partial summation and dropping, on the one hand, and the stream of natural numbers, on the other hand. To illustrate this circularity for the natural numbers, we recall thatHere we have circular behaviour in that after one transition step of nat, we obtain a new state nat′ that contains nat again as a summand.$$\mbox {\textsf {nat}}'= \mbox {\textsf {nat}}+ \overline {1}$$

We arrived at the definition of the bisimulation relation R used in the proof of Moessner’s theorem in a fairly standard way. First we constructed R for the cases of n equal to 1 (Sect. 4.1) and 2 (Sect. 4.2). For each of these cases, we included first the pair of streams that we wanted to prove equal (clause (i) of the definition of R). Then we computed their derivatives and observed that they consist of sums of the streams we started out with together with some new streams. The latter were added as new pairs, in clause (ii). Closing R under sums, in clause (iii) and including the identity relation, in clause (iv), then was sufficient to prove that R is a bisimulation. Having gone through this process for the first few values of n, the general definition of R emerged (Sect. 5).
 (1)
We want to analyse the precise relationships between our present two proofs, on the one hand, and the proofs by Perron [8], Paasche [7] and Salié [11], and by Hinze [3], on the other hand. Such an analysis will be more difficult than one might expect, since our coinductive proof exploits another type of circularity (of the natural numbers, of the various stream operators) than any of the other proofs. This difference makes a direct comparison rather difficult. Also, our formalisation, that is, our mathematical formulation of Moessner’s theorem is different from any of the other proofs: ours is an almost literal translation of the operational description of Moessner’s procedure.
 (2)We want to try and apply our coinductive proof method to the following generalisation of Moessner’s theorem [3, 7, 11]. A first contribution to a coinductive proof of this generalisation is already contained in our formulation of it here: we present its ingredients in terms of again a stream differential equation, using the following slightly adapted version of the drop operator: for all σ∈ℕ^{ ω } and all k≥2 and 0≤i<k, we define The difference between this definition and the one in Sect. 2 lies in the value of \(( D_{k}^{0} \sigma )'\), which changes the cycle of the drop operator from k to k+1. Using this new definition, we define an operation M on streams σ∈ℕ^{ ω } of natural numbers by the following stream differential equation:The question with which we want to conclude the present paper is: to give a coinductive proof of the fact that$$M(\sigma) (0) = \sigma(0)\qquad \bigl(M(\sigma)\bigr)' = M\bigl( \varSigma\circ D^1_2 \bigl(\sigma' \bigr) \bigr) $$The fact that we are able to formalise also this generalised version of Moessner’s theorem can be considered in itself already as a contribution. In order to be able to come up with a coinductive proof, we will have to understand better which type of circularity is underlying the stream of factorial numbers. The following characterisation [10] might turn out to be useful:$$M(\overline {1}) = (0!,1!,2!, \ldots) $$where the operator of (underlined) inverse is with respect to the shuffle product, introduced in Example 2.4. Shuffle inverse is formally defined by the following stream differential equation:$$(0!,1!,2!, \ldots) = \bigl([1]X\bigr)^{\underline{1}} $$with initial value$$\bigl(\sigma^{\underline{1}}\bigr)' = \sigma' \otimes\bigl( \sigma^{\underline{1}} \otimes\sigma^{\underline {1}} \bigr) $$$$\sigma^{\underline{1}}(0) = \sigma(0)^{1} $$
Notes
Acknowledgements
We are very much indebted to Ralf Hinze, who gave a proof of Moessner’s theorem in a calculational style [3, 4]. On hearing the presentation of our paper on stream splitting and sampling [6], he invited us to investigate a possible link with coinduction. The outcome of our investigation is the present paper. We are grateful to Olivier Danvy for various constructive comments on earlier versions of this paper. Finally we would like to thank the anonymous referees for their corrections and suggestions for improvements.
Open Access
This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.
References
 1.Berstel, J., Reutenauer, C.: Rational Series and Their Languages. EATCS Monographs on Theoretical Computer Science, vol. 12. Springer, Berlin (1988) zbMATHCrossRefGoogle Scholar
 2.Graham, R.L., Knuth, D.E., Patashnik, O.: Concrete Mathematics, 2nd edn. AddisonWesley, Reading (1994) zbMATHGoogle Scholar
 3.Hinze, R.: Scans and convolutions—a calculational proof of Moessner’s theorem. In: Scholz, S.B., Chitil, O. (eds.) Postproceedings of the 20th International Symposium on the Implementation and Application of Functional Languages (IFL’08). Lecture Notes in Computer Science, vol. 5836, pp. 1–24. Springer, Berlin (2008) CrossRefGoogle Scholar
 4.Hinze, R.: Concrete stream calculus: an extended study. J. Funct. Program. 20(5–6), 463–535 (2011) MathSciNetGoogle Scholar
 5.Moessner, A.: Eine Bemerkung über die Potenzen der natürlichen Zahlen. Aus den Sitzungsberichten der Bayerische Akademie der Wissenschaften, Mathematischnaturwissenschaftliche Klasse 1951 Nr. 3 (1951) Google Scholar
 6.Niqui, M., Rutten, J.J.M.M.: Sampling, splitting and merging in coinductive stream calculus. In: Bolduc, C., Desharnais, J., Ktari, B. (eds.) MPC. Lecture Notes in Computer Science, vol. 6120, pp. 310–330. Springer, Berlin (2010) Google Scholar
 7.Paasche, I.: Ein neuer Beweis des Moessnerschen Satz. Aus den Sitzungsberichten der Bayerische Akademie der Wissenschaften, Mathematischnaturwissenschaftliche Klasse 1952 Nr. 1 (1952) Google Scholar
 8.Perron, O.: Beweis des Moessnerschen Satz. Aus den Sitzungsberichten der Bayerische Akademie der Wissenschaften, Mathematischnaturwissenschaftliche Klasse 1951 Nr. 4 (1951) Google Scholar
 9.Rutten, J.J.M.M.: Universal coalgebra: a theory of systems. Theor. Comput. Sci. 249(1), 3–80 (2000). Fundamental Study MathSciNetzbMATHCrossRefGoogle Scholar
 10.Rutten, J.J.M.M.: A coinductive calculus of streams. Math. Struct. Comput. Sci. 15, 93–147 (2005) MathSciNetzbMATHCrossRefGoogle Scholar
 11.Salié, H.: Bemerkung zum einen Satz von Moessner. Aus den Sitzungsberichten der Bayerische Akademie der Wissenschaften, Mathematischnaturwissenschaftliche Klasse 1952 Nr. 2 (1952) Google Scholar
 12.Samadi, S., Omair Ahmad, M., Swamy, M.N.S.: Multiplierfree structures for exact generation of natural powers of integers. In: ISCAS (2), pp. 1146–1149. IEEE, New York (2005) Google Scholar