Peano axioms are the foundation of modern mathematics. The five rules that bring its name define the concept of ordered set of numbers. The axioms are:
- 0 is a number
- the successor of a number is a number
- two different numbers can't have the same successor
- 0 is not the successor of any other number
- every property of 0 or of any successor of a number which has that property, if a property of every number
Peano axioms was intended to describe natural numbers: 0, 1, 2, 3, 4, 5,... But the idea of successoris open to a wide range of interpretations. Bertrand Russel writes in its Introduction to Mathematical Philosophy that if we take the notion of pair number and we use it to define what is the successor of a number, Peano axioms still hold: 0, 2, 4, 6, 8,...
This idea can be elegantly formalized in Scala by defining a successor function for a specific number series: