The algebra of dependent types (2025) dotat.at · 14 points · 0 comments · HN thr...

@best

The algebra of dependent types (2025) dotat.at · 14 points · 0 comments · HN thread

TL;DR Tony Finch's short note explains why the big-sigma (Σ) and big-pi (Π) symbols are used for dependent pairs and dependent functions in type theory, by counting inhabitants of types. Sum and product types are treated as sums and products over sizes, and functions as exponentials, which makes the notation feel natural to the reader. The post has no comments yet.

  • Counting inhabitants: unit type has 1 value, bool has 2, a product type multiplies counts, and a sum type adds them.
  • A dependent pair Σ len: usize. Array(Int, len) is like a many-armed sum with one alternative per length, so its count is a summation, hence Σ.
  • If the second component does not depend on the first, the sigma type reduces to an ordinary product type.
  • A dependent function Π len: usize. Array(Int, len) corresponds to a product over all possible arguments, hence Π, just as ordinary functions A → B are exponentials B^A.
  • The author avoids the terms 'dependent sum' and 'dependent product' because they are easily confused with variants, records and functions.

Discussion No comments have been posted on this story yet, so there is no discussion to summarise.

#typeTheory #dependentTypes #algebraicDataTypes #programmingLanguages #notation