A note on syntax
The reason for the name “Pi types” (and the symbol Π
) is the following :
In math, it is common to use the notation to indicate the set of all functions from to .
For simplicity let’s assume that is finite (and has cardinality )
Then we can define:
and each element has the form .
In other words, for each we can find an element at the position .
Given such a tuple we can create a function by the rule
conversely, given a function we can create the tuple
In a dependent function we let depend on like so:
This is the motivation for the syntax:
Π (a: A), B a
When B
does not depend on a: A
this becomes
Π (_: A), B
and we can use the syntactic sugar
A -> B