For the Egyptian god, see Seth.
Georg Cantor, in 1894. Cantor was the first mathematician to talk about sets
Cantor's original definition of a set
A **set** is an idea from mathematics. A set has *members* (also called *elements*). A set is defined by its members, so any two sets with the same members are the same (e.g. if set {\displaystyle {\mathit {X}}} and set {\displaystyle {\mathit {Y}}} have the same members, then *{\displaystyle {\mathit {X}}={\mathit {Y}}}*).

Example of a set of polygons
A set cannot have the same member more than once. Membership is the only thing that matters. For example, there is no order or other difference among the members. *Anything* can be a member of a set, including sets themselves (though if a set is a member of itself, paradoxes such as Russell's paradox can happen).

What to do with sets
--------------------

Imagine the set is a bag.

### Element of

Various things can be put into a bag. Later on, a good question would be if a certain thing is in the bag. Mathematicians call this *element of*. Something is an element of a set, if that thing can be found in the respective bag. The symbol used for this is {\displaystyle \in }:

{\displaystyle a\in {\mathit {A}}},

which means that a is in the bag {\displaystyle {\mathit {A}}} or a is an element of {\displaystyle {\mathit {A}}}.

Unlike a bag, a set can contain at most one item of a given type. So for a set of fruits, it would make no difference if there is one orange, or if there are 10 oranges.

### Empty set

Like a bag, a set can also be *empty*. The empty set is like an empty bag: it has nothing in it. The "empty set" is also called the *null set* and is represented by the symbol {\displaystyle \varnothing }.

### Universe

If we consider, say, some sets of American cars, e.g. a set of all Fords and a set of all Dodges, we may also wish to consider the whole set of American cars. In this case, the set of all American cars would be called a universe.

In other words, a universe is a collection of all the elements one wishes to consider in a given problem. The universe is usually named {\displaystyle U}.

### Comparing sets

Two sets can be compared. This is like looking into two different bags. If they contain the same things, they are equal. No matter, in which order these things are.

*For example*, if {\displaystyle {\mathit {A}}=\{Stanford,Stanley\}} and {\displaystyle {\mathit {B}}=\{Stanley,Stanford\}}, the sets are the same.

### Cardinality of a set

When mathematicians talk about a set, they sometimes want to know how big a set is (or what is the cardinality of the set). They do this by counting how many elements are in the set (how many items are in the bag). For finite sets the cardinality is a simple number. The empty set has a cardinality of 0. The set {\displaystyle \{apple,orange\}} has a cardinality of 2.

Two sets have the same cardinality if we can pair up their elements—if we can join two elements, one from each set. The set {\displaystyle \{apple,orange\}} and the set {\displaystyle \{sun,moon\}} have the same cardinality. E.g. we could pair *apple* with *sun*, and *orange* with *moon*. The order does not matter. It is possible to pair all the elements, and none is left out. But the set {\displaystyle \{dog,cat,bird\}} and the set {\displaystyle \{5,6\}} have different cardinality.
If we try to pair them up, we always leave out one animal.

#### Infinite cardinality

At times cardinality is not a number. Sometimes a set has infinite cardinality. The set of all integers is a set with infinite cardinality. Some sets with infinite cardinality are bigger (have a bigger cardinality) than others. There are more real numbers than there are natural numbers, for example, which means we cannot pair up the set of integers and the set of real numbers, even if we worked forever.

#### Countability

If you can count the elements of a set, it is called a countable set. Countable sets include all sets with a finite number of members. Countable sets also include some infinite sets, such as the natural numbers. You can count the natural numbers with {\displaystyle {1,2,3...}}. The natural numbers are nicknamed "the counting numbers", since they are what we usually use to count things with.

An uncountable set is an infinite set that is impossible to count. If we try to count the elements, we will always skip some. It does not matter what step we take. The set of real numbers is an uncountable set. There are many other uncountable sets, even such a small interval like {\displaystyle [0,1]}.[3]

### Subsets

A subset of regular polygons
If you look at the set {\displaystyle A=\{a,b\}} and the set {\displaystyle B=\{a,b,c,d\}}, you can see that all elements in the first set are also in the second set.  
 We say: {\displaystyle \{a,b\}} is a subset of {\displaystyle \{a,b,c,d\}}  

As a formula it looks like this:  

{\displaystyle \{a,b\}\subseteq \{a,b,c,d\}}

In general, when all elements of set {\displaystyle A} are also elements of set {\displaystyle B}, we call {\displaystyle A} a subset of {\displaystyle B}:  

{\displaystyle A\subseteq B}.  

It is usually read "{\displaystyle A} is contained in {\displaystyle B}."

*Example:* Every Chevrolet is an American car. So the set of all Chevrolets is contained in the set of all American cars.

### Set operations

Intersection of two sets of polygons
There are different ways to combine sets.

#### Intersections

The intersection {\displaystyle A\cap B} of two sets {\displaystyle A} and {\displaystyle B} is a set that contains all the elements that are both in set {\displaystyle A} **and** in set {\displaystyle B} at the same time.

*Example:* When {\displaystyle A} is the set of all cheap cars, and {\displaystyle B} is the set of all American cars, then {\displaystyle A\cap B} is the set of all cheap American cars.

#### Unions

Union of two sets of polygons
The union {\displaystyle A\cup B} of two sets {\displaystyle A} and {\displaystyle B} is a set that contains all the elements that are in set {\displaystyle A} **or** in set {\displaystyle B}.
This "or" is the *inclusive* disjunction, so the union also contains the elements, that are in set {\displaystyle A} *and* in set {\displaystyle B}.
By the way, this means, that the intersection is a subset of the union:
{\displaystyle (A\cap B)\subseteq (A\cup B)}.

*Example:* When {\displaystyle A} is the set of all cheap cars, and {\displaystyle B} is the set of all American cars, then {\displaystyle A\cup B} is the set of all cars, without all expensive cars that are not from America.

#### Complements

Complement can mean two different things:

* The **complement of {\displaystyle A}** is the universe {\displaystyle U} without all the elements of {\displaystyle A}:

{\displaystyle A^{\rm {C}}=U\setminus A}   

The universe {\displaystyle U} is the set of all things you speak about.  

*Example:* When {\displaystyle U} is the set of all cars, and {\displaystyle A} is the set of all cheap cars,  
 then {\displaystyle A}C is the set of all expensive cars.

Differences of two sets of polygons
* The *set difference* of {\displaystyle A} and {\displaystyle B} is the set {\displaystyle B} without all the elements of {\displaystyle A}:

{\displaystyle B\setminus A}  

It is also called the **relative complement of {\displaystyle A} in {\displaystyle B}**.  

*Example:* When {\displaystyle A} is the set of all cheap cars, and {\displaystyle B} is the set of all American cars, then {\displaystyle B\setminus A} is the set of all expensive American cars.

If you exchange the sets in the set difference, the result is different:  
In the *example* with the cars, the difference {\displaystyle A\setminus B} is the set of all cheap cars, that are not made in America.

Notation
--------

Most mathematicians use uppercase *ITALIC* (usually Roman) letters to write about sets (such as {\displaystyle A}, {\displaystyle B}, {\displaystyle C}). The things that are seen as elements of sets are usually written with lowercase Roman letters.

One way of showing a set is by a list of its members, separated by commas, included in braces.
*For example*,

* {\displaystyle X=\{1,2,3\}} is set which has members 1, 2, and 3.

Another way, called the set-builder notation, is by a statement of what is true of the members of the set, like this:

* {*x* | *x* is a natural number & *x* < 4}.

In spoken English, this reads: "the set of all *x* such that *x* is a natural number and *x* is less than four". The symbol [ipe "|" means "such that" or "so that".

The empty set is written in a special way: {\displaystyle \emptyset }, {\displaystyle \varnothing } or {\displaystyle \{\}}.

When object *a* is the member of set {\displaystyle A} it is written as:

* *a* ∈ *A*.

In spoken English, this reads: "*a* is a member of {\displaystyle A}".

Venn diagrams
-------------

Intersection {\displaystyle A\cap B}
To illustrate operations on sets mathematicians use Venn diagrams. Venn diagrams use circles to show individual sets. The universe is depicted with a rectangle. Results of operations are shown as colored areas. In the illustration of the intersection operation the left circle shows set {\displaystyle A} and the right circle shows set {\displaystyle B}.

Special sets
------------

Some sets are very important to mathematics. They are used very often. One of these is the *empty set*.
Many of these special sets are written using blackboard bold typeface, and these include:

* {\displaystyle \mathbb {P} }, denoting the set of all primes.
* {\displaystyle \mathbb {N} }, denoting the set of all natural numbers. That is to say, {\displaystyle \mathbb {N} } = {1, 2, 3, ...}, or sometimes {\displaystyle \mathbb {N} } = {0, 1, 2, 3, ...}.
* {\displaystyle \mathbb {Z} }, denoting the set of all integers (whether positive, negative or zero). So {\displaystyle \mathbb {Z} } = {... -2, -1, 0, 1, 2, ...}.
* {\displaystyle \mathbb {Q} }, denoting the set of all rational numbers (that is, the set of all proper and improper fractions). So, {\displaystyle \mathbb {Q} =\left\{{\begin{matrix}{\frac {a}{b}}\end{matrix}}|a,b\in \mathbb {Z} ,b\neq 0\right\}}, meaning all fractions {\displaystyle {\begin{matrix}{\frac {a}{b}}\end{matrix}}} where *a* and *b* are in the set of all integers and *b* is not equal to 0. For example, {\displaystyle {\begin{matrix}{\frac {1}{4}}\end{matrix}}\in \mathbb {Q} } and {\displaystyle {\begin{matrix}{\frac {11}{6}}\end{matrix}}\in \mathbb {Q} }. All integers are in this set since every integer *a* can be expressed as the fraction {\displaystyle {\begin{matrix}{\frac {a}{1}}\end{matrix}}}.
* {\displaystyle \mathbb {R} }, denoting the set of all real numbers. This set includes all rational numbers, together with all irrational numbers (that is, numbers which cannot be rewritten as fractions, such as {\displaystyle \pi ,} {\displaystyle e,} and √2).
* {\displaystyle \mathbb {C} }, denoting the set of all complex numbers.

Each of these sets of numbers has an infinite number of elements, and {\displaystyle \mathbb {P} \subset \mathbb {N} \subset \mathbb {Z} \subset \mathbb {Q} \subset \mathbb {R} \subset \mathbb {C} }.

Paradoxes about sets
--------------------

The mathematician Bertrand Russell found that there are problems with the informal definition of sets. He stated this in a paradox called *Russell's paradox*. An easier to understand version, closer to real life, is called the *Barber paradox*.

### The barber paradox

There is a small town somewhere. In that town, there is a barber. All the men in the town do not like beards, so they either shave themselves, or they go to the barber shop to be shaved by the barber.

We can therefore make a statement about the barber himself: *The barber shaves all men that do not shave themselves. He only shaves those men (since the others shave themselves and do not need a barber to give them a shave).*

This of course raises the question: What does the barber do each morning to look clean-shaven? This is the paradox.

If the barber shaves himself, he cannot be a barber, since a barber does not shave himself.
If he does not shave himself, he falls in the category of those who do not shave themselves, and so, cannot be a barber.

Related pages
-------------

* Cantor set
* Group theory
* Open set
* Relation
* Set theory

Further reading
---------------

The following books explore sets in more detail:

* Halmos, Paul R. *Naive Set Theory*, Princeton, N.J.: Van Nostrand (1960) ISBN 0-387-90092-6
* Stoll, Robert R. *Set Theory and Logic*, Mineola, N.Y.: Dover Publications (1979) ISBN 0-486-63829-4
* Allenby, R.B.J.T, *Rings, Fields and Groups*, Leeds, England: Butterworth Heinemann (1991) ISBN 0-340-54440-6

| * v
* t
* e
Mathematical logic |
| --- |
| General | 
* Axiom
	+ list
* Cardinality
* First-order logic
* Formal proof
* Formal semantics
* Foundations of mathematics
* Information theory
* Lemma
* Logical consequence
* Model
* Theorem
* Theory
* Type theory

 |
| Theorems (list) & Paradoxes | 
* Gödel's completeness and incompleteness theorems
* Tarski's undefinability
* Banach–Tarski paradox
* Cantor's theorem, paradox and diagonal argument
* Compactness
* Halting problem
* Lindström's
* Löwenheim–Skolem
* Russell's paradox

 |
| Logics | 

|  |  |
| --- | --- |
| Traditional | 
* Classical logic
* Logical truth
* Tautology
* Proposition
* Inference
* Logical equivalence
* Consistency
	+ Equiconsistency
* Argument
* Soundness
* Validity
* Syllogism
* Square of opposition
* Venn diagram

 |
| Propositional | 
* Boolean algebra
* Boolean functions
* Logical connectives
* Propositional calculus
* Propositional formula
* Truth tables
* Many-valued logic
	+ 3
	+ Finite
	+ ∞

 |
| Predicate | 
* First-order
	+ list
* Second-order
	+ Monadic
* Higher-order
* Free
* Quantifiers
* Predicate
* Monadic predicate calculus

 |

 |
| Set theory | 

|  |
| --- |
| 
* Set
	+ Hereditary
* Class
* (Ur-)Element
* Ordinal number
* Extensionality
* Forcing
* Relation
	+ Equivalence
	+ Partition
* Set operations:
	+ Intersection
	+ Union
	+ Complement
	+ Cartesian product
	+ Power set
	+ Identities

 |
| Types of Sets | 
* Countable
* Uncountable
* Empty
* Inhabited
* Singleton
* Finite
* Infinite
* Transitive
* Ultrafilter
* Recursive
* Fuzzy
* Universal
* Universe
	+ Constructible
	+ Grothendieck
	+ Von Neumann

 |
| Maps & Cardinality | 
* Function/Map
	+ Domain
	+ Codomain
	+ Image
* In/Sur/Bi-jection
* Schröder–Bernstein theorem
* Isomorphism
* Gödel numbering
* Enumeration
* Large cardinal
	+ Inaccessible
* Aleph number
* Operation
	+ Binary

 |
| Set theories | 
* Zermelo–Fraenkel
	+ Axiom of choice
	+ Continuum hypothesis
* General
* Kripke–Platek
* Morse–Kelley
* Naive
* New Foundations
* Tarski–Grothendieck
* Von Neumann–Bernays–Gödel
* Ackermann
* Constructive

 |

 |
| Formal systems (list),Language & Syntax | 

|  |
| --- |
| 
* Alphabet
* Arity
* Automata
* Axiom schema
* Expression
	+ Ground
* Extension
	+ by definition
	+ Conservative
* Relation
* Formation rule
* Grammar
* Formula
	+ Atomic
	+ Closed
	+ Ground
	+ Open
* Free/bound variable
* Language
* Metalanguage
* Logical connective
	+ ¬
	+ ∨
	+ ∧
	+ →
	+ ↔
	+ =
* Predicate
	+ Functional
	+ Variable
	+ Propositional variable
* Proof
* Quantifier
	+ ∃
	+ !
	+ ∀
	+ rank
* Sentence
	+ Atomic
	+ Spectrum
* Signature
* String
* Substitution
* Symbol
	+ Function
	+ Logical/Constant
	+ Non-logical
	+ Variable
* Term
* Theory
	+ list

 |
| Example axiomaticsystems (list) | 
* of arithmetic:
	+ Peano
	+ second-order
	+ elementary function
	+ primitive recursive
	+ Robinson
	+ Skolem
* of the real numbers
	+ Tarski's axiomatization
* of Boolean algebras
	+ canonical
	+ minimal axioms
* of geometry:
	+ Euclidean:
		- *Elements*
		- Hilbert's
		- Tarski's
	+ non-Euclidean

* *Principia Mathematica*

 |

 |
| Proof theory | 
* Formal proof
* Natural deduction
* Logical consequence
* Rule of inference
* Sequent calculus
* Theorem
* Systems
	+ Axiomatic
	+ Deductive
	+ Hilbert
		- list
* Complete theory
* Independence (from ZFC)
* Proof of impossibility
* Ordinal analysis
* Reverse mathematics
* Self-verifying theories

 |
| Model theory | 
* Interpretation
	+ Function
	+ of models
* Model
	+ Equivalence
	+ Finite
	+ Saturated
	+ Spectrum
	+ Submodel
* Non-standard model
	+ of arithmetic
* Diagram
	+ Elementary
* Categorical theory
* Model complete theory
* Satisfiability
* Semantics of logic
* Strength
* Theories of truth
	+ Semantic
	+ Tarski's
	+ Kripke's
* T-schema
* Transfer principle
* Truth predicate
* Truth value
* Type
* Ultraproduct
* Validity

 |
| Computability theory | 
* Church encoding
* Church–Turing thesis
* Computably enumerable
* Computable function
* Computable set
* Decision problem
	+ Decidable
	+ Undecidable
	+ P
	+ NP
	+ P versus NP problem
* Kolmogorov complexity
* Lambda calculus
* Primitive recursive function
* Recursion
* Recursive set
* Turing machine
* Type theory

 |
| Related | 
* Abstract logic
* Category theory
* Concrete/Abstract Category
* Category of sets
* History of logic
* History of mathematical logic
	+ timeline
* Logicism
* Mathematical object
* Philosophy of mathematics
* Supertask

 |