diff --git a/content/set_theory.md b/content/set_theory.md index 0f6f317..b5f9feb 100644 --- a/content/set_theory.md +++ b/content/set_theory.md @@ -21,38 +21,49 @@ Set theory was born as a necessity to formulate a general theory in order to org ## What is a set? -A set is a **collection** of unique elements, the order of these unique elements does not matter. +A set is a **collection** of distinct elements, the order of these unique elements does not matter. These elements are also called **members** of the set. -> The set concept is __primitive__: it is not possible to define it with more simpler concepts. +> The notation of a set is __primitive__: it can't be defined in terms of simpler concepts. -We can find sets in our every day life, for example the set of books a library has, the set of libraries in a city, the set of cities in a country ecc. +We can find sets in our every day life, for example the set of books a library has, the set of libraries in a city, the set of cities in a country etc. A set can have a finite number of elements, like the books inside a library, or an infinite number of elements. -A set with an infinite number of elements is called an __infinite set__. +A set with a finite number of elements is called a *finite set*, while a set with an infinite number of elements is called an *infinite set*. -Two special sets are defined: the [[empty set|#empty-set]] and the [[universe set|#universe-set]]. +Two special sets are defined: the **empty set** and the **universe set**. ### Empty set -The empty set, denoted with $\\{\\}$ or with the $\varnothing$ symbol, is a special set that has no element. +The empty set, denoted with $\{\}$ or with the $\varnothing$ symbol, is a special set that has no element. ### Universe set The universal set, denoted by $U$, is a set that has as elements all unique elements of all related sets. +The universal set depends on the context — it contains all elements under consideration in a given discussion. + +--- + ## Notations Before going further inside the set theory, it is worth introducing the notations for them. Sets are typically denoted by an italic capital letter, like $A$, $B$, $C$ etc. -To list the elements of a given set the enumeration notation is used. This list the elements of a set between curly braces. For example, to reppresent the set $A$ of all natural numbers less than 8 we write the following: +To list the elements of a given set the enumeration notation is used. This lists the elements of a set between curly braces. For example, to represent the set $A$ of all natural numbers less than 8 we write the following: -$$ A = \\{ 1, 2, 3, 4, 5, 6, 7 \\} $$ +$$ A = \{ 1, 2, 3, 4, 5, 6, 7 \} $$ +We can also use a different notation called set-builder notation, specifying that a set is a set of elements that satisfies some logical formula. More specifically, if $P(x)$ is a logical formula depending on the variable $x$, then $\{x\,|\,P(x)\}$ denotes the set of all $x$ for which $P(x)$ is true, with the example above we have: +$$ +A = \{ x\,|\,x < 8 \} +$$ +In this notation, the vertical bar $|$ is read as "such that", and the whole formula can be read as $A$ is the set of all $x$ such that $x$ are less than 8. + +--- ## Element membership We denote that an element is a member of a given set with the $\in$ symbol: given the previous set $A$, we write that @@ -69,24 +80,24 @@ $$ 8 \notin A $$ This can be read as 8 is not a member of set $A$, or 8 is not inside the set $A$. -If two sets $A$ and $B$ contain the same elements we define them as **equal**, denoted by $$ A = B $$ +If two sets $A$ and $B$ contain the same elements we define them as **equal**, denoted by $A = B$: $$ \begin{aligned} -A &= \\{ 1, 2 \\} \\\\ -B &= \\{ 2, 1 \\} \\\\ +A &= \{ 1, 2 \} \\\\ +B &= \{ 2, 1 \} \\\\ A &= B \end{aligned} $$ - +--- ## Cardinality -In set theory, the cardinality of a given set $A$ is the number of elements inside the set itself, denoted with $\mid A \mid$. +The cardinality of a given set $A$ is the number of elements inside the set itself, denoted with $\mid A \mid$. $$ \begin{aligned} -A &= \\{ \text{blue}, \text{red}, \text{green}, \text{yellow} \\} \\\\ +A &= \{ \text{blue}, \text{red}, \text{green}, \text{yellow} \} \\\\ \mid A \mid &= 4 \end{aligned} $$ @@ -101,29 +112,31 @@ $$ > The cardinality of a set may also be denoted by $card(A)$ or $n(A)$ -## Subsets and supersets + +--- +## Subsets and super sets Between two sets there may exist a relation called **set inclusion**: if all elements inside set $A$ are also elements of $B$, then $A$ is a subset of $B$, denoted with $A \subseteq B$. $$ \begin{aligned} -A &= \\{ 2, 3, 4 \\} \\\\ -B &= \\{ 1, 2, 3, 4, 5 \\} \\\\ +A &= \{ 2, 3, 4 \} \\\\ +B &= \{ 1, 2, 3, 4, 5 \} \\\\ A &\subseteq B \end{aligned} $$ -When $A$ is a subset of $B$, we can define $B$ as a superset of $A$, denoted with $B \supseteq A$. +When $A$ is a subset of $B$, we can define $B$ as a super set of $A$, denoted with $B \supseteq A$. $$ \begin{aligned} -A &= \\{ 2, 3, 4 \\} \\\\ -B &= \\{ 1, 2, 3, 4, 5 \\} \\\\ +A &= \{ 2, 3, 4 \} \\\\ +B &= \{ 1, 2, 3, 4, 5 \} \\\\ B &\supseteq A \end{aligned} $$ -If the set inclusion relation does not exist between two sets, then we can define $A$ as not being a subset of $B$, formally $A \not\subseteq B$, same for $B$ not being a superset of $A$: $B \not\supseteq A$. +If the set inclusion relation does not exist between two sets, then we can define $A$ as not being a subset of $B$, formally $A \not\subseteq B$, same for $B$ not being a super set of $A$: $B \not\supseteq A$. Given the above definition, a set is always a subset of itself, but there may be cases where we would like to reject this definition. @@ -133,24 +146,45 @@ We denote the fact that a set $A$ is a proper subset of $B$ with the symbol $\su $$ \begin{aligned} -A &= \\{ 2, 3, 4 \\} \\\\ -B &= \\{ 1, 2, 3, 4, 5 \\} \\\\ +A &= \{ 2, 3, 4 \} \\\\ +B &= \{ 1, 2, 3, 4, 5 \} \\\\ A &\subset B \end{aligned} $$ -Likewise we denote a set $B$ being a proper superset of $A$ with the symbol $\supset$. +Likewise we denote a set $B$ being a proper super set of $A$ with the symbol $\supset$. $$ \begin{aligned} -A &= \\{ 2, 3, 4 \\} \\\\ -B &= \\{ 1, 2, 3, 4, 5 \\} \\\\ +A &= \{ 2, 3, 4 \} \\\\ +B &= \{ 1, 2, 3, 4, 5 \} \\\\ B &\supset A \end{aligned} $$ Note that the empty set $\varnothing$ is a proper subset of any set except itself. +--- +## Power set + +Given a set $A$, there exists a set called *power set* that contains as elements all subsets of $A$, including the empty set $\emptyset$ and the set $A$ itself. The power set of a set $A$ is denoted as $\mathcal{P}(A)$: + +$$ +\begin{aligned} +A = \{1, 2, 3\} \\ +\mathcal{P}(A) = \{\emptyset, \{1\}, \{2\}, \{3\}, \{1,2\}, \{1,3\}, \{2,3\}, A\} +\end{aligned} +$$ + +The cardinality of the power set, denoted as $|\mathcal{P}(A)|$ is always $2^{|A|}$. + +--- + +## Partitions + +A *partition* of a set $A$ is a set of non-empty subsets of $A$ such that every element $a$ of $A$ belongs to exactly one of these subset (the subsets are non-empty mutually disjoint sets). + +--- # Operations Just like algebra has his operations on numbers, sets have their own operations. @@ -159,13 +193,13 @@ Just like algebra has his operations on numbers, sets have their own operations. The union of two or more sets is a set that contains all elements in the given sets, with no duplicated element. -It's denoted with the $\cup$ symbol. +It's denotated with the $\cup$ symbol. $$ \begin{aligned} -A &= \\{ 2, 4, 6 \\} \\\\ -B &= \\{ 2, 3, 5 \\} \\\\ -A \cup B &= \\{ 2, 3, 4, 5, 6 \\} +A &= \{ 2, 4, 6 \} \\\\ +B &= \{ 2, 3, 5 \} \\\\ +A \cup B &= \{ 2, 3, 4, 5, 6 \} \end{aligned} $$ @@ -191,13 +225,13 @@ $$ The intersection of two or more sets is a set that contains all elements that belongs in all given sets. -It's denoted with the $\cap$ symbol. +It's denotated with the $\cap$ symbol. $$ \begin{aligned} -A &= \\{ 2, 4, 6 \\} \\\\ -B &= \\{ 2, 3, 5 \\} \\\\ -A \cap B &= \\{ 2 \\} +A &= \{ 2, 4, 6 \} \\\\ +B &= \{ 2, 3, 5 \} \\\\ +A \cap B &= \{ 2 \} \end{aligned} $$ @@ -226,13 +260,13 @@ $$ The set difference of two sets $A$ and $B$ is a set that contains all elements of $A$ that are not inside $B$. -It's denoted with the $−$ symbol and is formally defined as $A − B = \\{ x ∣ x \in A : x \notin B \\}$ +It's denotated with the $−$ symbol and is formally defined as $A − B = \{ x ∣ x \in A \text{\,and\,} x \notin B \}$ $$ \begin{aligned} -A &= \\{ 2, 4, 6 \\} \\\\ -B &= \\{ 2, 3, 5 \\} \\\\ -A - B &= \\{ 4, 6 \\} +A &= \{ 2, 4, 6 \} \\\\ +B &= \{ 2, 3, 5 \} \\\\ +A - B &= \{ 4, 6 \} \end{aligned} $$ @@ -240,12 +274,12 @@ The set difference is not commutative, indeed $$ \begin{aligned} -A - B &= \\{ 4, 6 \\} \\\\ -B - A &= \\{ 3, 5 \\} +A - B &= \{ 4, 6 \} \\\\ +B - A &= \{ 3, 5 \} \end{aligned} $$ -The set difference has three absorbing elements: +The set difference has two absorbing elements: $$ \begin{aligned} @@ -263,15 +297,15 @@ $$ ## Symmetric Difference -The symmetric difference of two sets or more sets, also called __disjunctive union__, is a set that contains all unique elements of a set that are not inside the other sets. +The symmetric difference of two or more sets, also called __disjunctive union__, is a set that contains all unique elements of a set that are not inside the other sets. It's defined as the union of the set difference $A − B$ with the set difference $B − A$ $$ \begin{aligned} -A &= \\{ 1, 2, 5, 6 \\} \\\\ -B &= \\{ 2, 3, 4, 7 \\} \\\\ -(A − B) \cup (B − A) &= \\{ 1, 3, 4, 5, 6, 7 \\} +A &= \{ 1, 2, 5, 6 \} \\\\ +B &= \{ 2, 3, 4, 7 \} \\\\ +(A − B) \cup (B − A) &= \{ 1, 3, 4, 5, 6, 7 \} \end{aligned} $$ @@ -281,8 +315,8 @@ The symmetric difference is both commutative and associative $$ \begin{aligned} -A &= \\{ 1, 2, 5, 6 \\} \\\\ -B &= \\{ 2, 3, 4, 7 \\} \\\\ +A &= \{ 1, 2, 5, 6 \} \\\\ +B &= \{ 2, 3, 4, 7 \} \\\\ A \vartriangle B &= B \vartriangle A \\\\ (A \vartriangle B) \vartriangle C &= A \vartriangle (B \vartriangle C) \end{aligned} @@ -304,13 +338,13 @@ $$ The cartesian product of two sets $A$ and $B$, denoted by $A \times B$, is a set of ordered pairs $(a,b)$ where $a$ is an element of $A$, and $b$ is an element of $B$. -Formally it is defined as $A \times B = \\{ (a,b) ∣ a \in A, b \in B \\}$. +Formally it is defined as $A \times B = \{ (a,b) ∣ a \in A, b \in B \}$. $$ \begin{aligned} -A &= \\{ 1, 2 \\} \\\\ -B &= \\{ 3, 4 \\} \\\\ -A \times B &= \\{ (1,3), (1,4), (2,3), (2,4) \\} +A &= \{ 1, 2 \} \\\\ +B &= \{ 3, 4 \} \\\\ +A \times B &= \{ (1,3), (1,4), (2,3), (2,4) \} \end{aligned} $$ @@ -318,18 +352,18 @@ The cartesian product is not commutative, because $A \times B$ is not the same a $$ \begin{aligned} -A &= \\{ 1, 2 \\} \\\\ -B &= \\{ 3, 4 \\} \\\\ -A \times B &= \\{ (1,3), (1,4), (2,3), (2,4) \\} \\\\ -B \times A &= \\{ (3,1), (3,2), (4,1), (4,2) \\} +A &= \{ 1, 2 \} \\\\ +B &= \{ 3, 4 \} \\\\ +A \times B &= \{ (1,3), (1,4), (2,3), (2,4) \} \\\\ +B \times A &= \{ (3,1), (3,2), (4,1), (4,2) \} \end{aligned} $$ -> Remember that the order inside a pair matter +> Remember that the order inside a pair matters -The cartesian produt of a set by the set itself is denoted by $A \times A$ or $A^2$. +The cartesian product of a set by the set itself is denoted by $A \times A$ or $A^2$. -The absobing element of the cartesian product is the $\varnothing$ set +The absorbing element of the cartesian product is the $\varnothing$ set $$ A \times \varnothing = \varnothing @@ -339,13 +373,13 @@ $$ The complement of a set $A$, denoted by $A^\complement$ is the set difference of the universal set $U$ with $A$. -It is formally defined as $A^\complement = \\{ x ∣ x \in U \land x \not\in A \\}$ +It is formally defined as $A^\complement = \{ x ∣ x \in U \land x \not\in A \}$ $$ \begin{aligned} -U &= \\{ 1, 2, 3, 4, 5, 6, 7, 8, 9 \\} \\\\ -A &= \\{ 1, 3, 5, 7, 9 \\} \\\\ -A^\complement = U − A &= \\{ 2, 4, 6, 8 \\} +U &= \{ 1, 2, 3, 4, 5, 6, 7, 8, 9 \} \\\\ +A &= \{ 1, 3, 5, 7, 9 \} \\\\ +A^\complement = U − A &= \{ 2, 4, 6, 8 \} \end{aligned} $$ @@ -353,4 +387,30 @@ The complement of the complement a set $A$, denoted by $(A^\complement)^\complem The union of set $A$ with the complement of itself results in the universal set $U$: $A \cup A^\complement=U$. -The intersection of set $A$ with the complement of itself results in the $\varnothing$ set: $A \cap A^\complement = \varnothing$. \ No newline at end of file +The intersection of set $A$ with the complement of itself results in the $\varnothing$ set: $A \cap A^\complement = \varnothing$. + +--- + +## De Morgan's laws + +In propositional logic, **De Morgan's laws** (also known as *De Morgan's theorem*), are a pair of transformation rules that are both valid rules of inference. The rules allow the expression of conjunctions and disjunctions purely in term of each other via negation. + +1. $\neg (A \land B) = (\neg A) \lor (\neg B)$ +2. $\neg(A \lor B) = (\neg A) \land (\neg B)$ + +In set theory, this gets translated in two ways: + +$$ +\begin{aligned} +A - (B \cup C) = (A - B) \cap (A - C) \\ +A - (B \cap C) = (A - B) \cup (A - C) +\end{aligned} +$$ +And + +$$ +\begin{aligned} +(A \cup B)^\complement = (A^\complement) \cap (B^\complement) \\ +(A \cap B)^\complement = (A^\complement) \cup (B^\complement) +\end{aligned} +$$