Build the idea in three steps
- Decide one positive size n first. The only numbers the world contains are the n remainders of division by n: 0, 1, …, n − 1.
- Adding two residues means replacing their sum by its remainder on division by n. Subtraction and multiplication are decided the same way.
- The construction is called the integers modulo n. In Lean it is ZMod n: for the case 0 it is ℤ, and for a positive n it is the finite set Fin n.
A small example
On a clock labelled 0, …, 11, five hours after nine is two: 9 + 5 = 14 and 14 leaves remainder 2 on division by 12.