Builtin Types

Numeric Operations

Lean supports the basic mathematical operations you’d expect for all of the number types: addition, subtraction, multiplication, division, and remainder. The following code shows how you’d use each one in a def commands:

-- addition def sum := 5 + 10 -- subtraction def difference := 95.5 - 4.3 -- multiplication def product := 4 * 30 -- division def quotient := 53.7 / 32.2 -- remainder/modulo def modulo := 43 % 5

Each expression in these statements uses a mathematical operator and evaluates to a single value.