Build the idea in three steps
- Choose a set of allowed inputs and a set of outputs.
- A function assigns exactly one output to each input. Different inputs may share an output.
- Lean writes α → β for a function from inputs of type α to outputs of type β. Applying f to x is written f x.
A small example
A rule that sends x to x × x sends both 2 and −2 to 4. It is still a function.