I've been studying dependent types and I understand the following:
- Why universal quantification is represented as a dependent function type.
∀(x:A).B(x)means “for allxof typeAthere is a value of typeB(x)”. Hence it's represented as a function which when given any valuexof typeAreturns a value of typeB(x). - Why existential quantification is represented as a dependent pair type.
∃(x:A).B(x)means “there exists anxof typeAfor which there is a value of typeB(x)”. Hence it's represented as a pair whose first element is a particular valuexof typeAand whose second element is a value of typeB(x).
Aside: It's also interesting to note that universal quantification is always used with material implication while existential quantification is always used with logical conjunction.
Anyway, the Wikipedia article on dependent types states that:
The opposite of the dependent type is the dependent pair type, dependent sum type or sigma-type. It is analogous to the coproduct or disjoint union.
How is it that a pair type (which is normally a product type) is analogous to a disjoint union (which is a sum type)? This has always confused me.
In addition, how is the dependent function type analogous to the product type?