# Topic: Set Theory¶

A branch of maths. The study of sets and functions between sets. A set is a collection of mathematical objects.

## Sources¶

Category theory for programmers^{1} touches on set theory in order to expand into category theory

## Backlinks¶

- Topic: Maths
- Video Series: Category Theory
- Empty set
- In set theory, the empty set is a set with no elements.

- Codomain
- The singleton set and the unit type
- The singleton set from set theory corresponds to the Unit type from type theory. Also to
`true`

in logic, and to a 1-category in category theory.

- The singleton set from set theory corresponds to the Unit type from type theory. Also to
- Domain
- Inclusion in a set
- In set theory, a set is defined by its elements. We can state that an element is in a set using the \\in notation - using
`\in`

in \\LaTeX.

- In set theory, a set is defined by its elements. We can state that an element is in a set using the \\in notation - using
- The empty set and the void type
- The empty set in set theory corresponds to the
`Void`

type in type theory or to`false`

in logic. There's also the 0-category in category theory.

- The empty set in set theory corresponds to the
- Blackboard Bold
- In maths, a natural number is any positive integer. The set of all natural numbers is denoted \\mathbb{N}.

- Injectivity
- In set theory, injectivity is a property of a function. Given a function f : A \\rightarrow B, if when supplied with every input in A f produces every possible output in B then f is injective.

- De-duplicate an Array by value
- This runs it through a
`Set`

, which ensures that there's only one element of each type, and then converts it back into an array. One footgun with this approach is that`Set`

appears to test equality by reference. While this works for primitive values, if you're trying to de-duplicate an array of complex data this isn't going to work so well.

- This runs it through a
- A pair of types with the same cardinality will always be isomorphic
- There will always be a way of exhaustively mapping each value of type a to type b, injectively and surjectively when viewing the domain and the codomain as a set.

- Language: Function over a set
- Tuples
- \\mathbb{R}^3 denotes a set of 3-tuples of real numbers, as an example. I.e (4, 1023, -3) \\in \\mathbb{R}^3 (inclusion in a set)

- A monoid has an associative binary operation
- Any monoid has an associative binary operation that takes any two elements in the associated set and produces an element in that set.

- Integer
- In maths, an integer is a whole number. The set of all integers is denoted \\mathbb{Z}

- Natural Number
- In maths, a natural number is any positive integer. The set of all natural numbers is denoted \\mathbb{N}.

- The identity morphism in a monoidal category corresponds to the unit element
- The unit element defined for a set-theory monoid corresponds to the identity morphism within a monoidal category.

- A set-theory monoid and a category-theory monoid are the same thing
- The set theory definition and the category theory definition of monoids are different views over the same concept. Category theory defines a monoid as any category with a single object. Set theory defines a monoid as a set with an associative binary operation and a unit element.