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 BAB^A to indicate the set of all functions from AA to BB.

For simplicity let’s assume that AA is finite (and has cardinality A=n|A| = n)

Then we can define:

BA:=Πa:A B=B×B××BA timesB^A := \Pi_{a: A}\ B = \underbrace{B \times B \times \cdots \times B}_{|A|\ \mathrm{ times}}

and each element fΠa:A Bf \in \Pi_{a: A}\ B has the form (fa1,fa2,,fan)(f_{a_1}, f_{a_2}, \dots, f_{a_n}).

In other words, for each aiAa_i \in A we can find an element faiBf_{a_i}\in B at the position ii.

Given such a tuple we can create a function f:ABf: A \to B by the rule

f(ai):=faif(a_i) := f_{a_i}

conversely, given a function f:ABf: A \to B we can create the tuple (f(a1),f(a2),)Πa:A B(f(a_1), f(a_2), \dots) \in \Pi_{a: A}\ B

In a dependent function we let BB depend on aAa \in A like so:

Πa:A Ba=Ba1×Ba2××Ban\Pi_{a: A}\ B_a = B_{a_1} \times B_{a_2} \times \cdots \times B_{a_n}

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

Profile picture

Personal blog of Juan Pablo Romero Méndez.