lean4-htt/doc/builtintypes.md
2020-12-08 10:09:58 -08:00

578 B
Raw Blame History

Builtin Types

Numeric Operations

Lean supports the basic mathematical operations youd expect for all of the number types: addition, subtraction, multiplication, division, and remainder. The following code shows how youd 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.