<jupyter_start><jupyter_text>$\newcommand{\nc}{\newcommand}$$\nc{\Nn}{\mathbb{N}}$$\nc{\Qq}{\mathbb{Q}}$$\nc{\Zz}{\mathbb{Z}}$$\nc{\Rr}{\mathbb{R}}$  Basic Set Theory  Sets: the language We talk about mathematics in the language of sets. A **set** is just a *collection of objects* of interest. Sets are usually denoted by captial letters. The objects in the set are called its **elements** (or members). For example, $S = \{0,1,2\}$ is a set with three elements.   Membership and Cardinality Write $a \in X$ to indicate that $a$ is an element of $X$ and write $a \notin X$ to indicate otherwise. So if $S = \{0,1,2\}$ then $1 \in S$ and $4 \notin S$. A set is **finite** if it has finitely many elements, otherwise it is **infinite**. Use $|X|$ to denote the **cardinality** of $X$. E.g. $|S| = 3$.  Set bulider notation Clearly, one cannot list all elements of an infinite set... So we simply assume we know some of them...E.g. $$\Nn = \{0,1,2,3,\ldots\}$$is the set of natural numbers. $\Zz$ the set of integers, $\Qq$ the set of rational numbers and $\Rr$ the set of real numbers. With them, we can bulid various other sets.  For example$$E = \{ n \in \Nn \colon n = 2k \text{ for some } k \in \Nn\}$$is the set of all even (natural) numbers. So $E = \{0,2,4,\ldots\}$<jupyter_code>NN = NonNegativeIntegers(); E = iter(n for n in NN if n%2==0)
# [next(E) for n in [1..10]]<jupyter_output><empty_output><jupyter_text>In general, a set expressed in the **set builder notation** looks like: $$\{ \text{symbol for the objects} \colon \text{ properties that the objects possess.}\}$$  Subsets A set $Y$ is a **subset** of a set $X$, denoted by $Y \subseteq X$, if every element of $Y$ is also an element of $X$. Two sets $X$ and $Y$ are **equal** if $X \subseteq Y$ and $Y \subseteq X$. $Y$ is a **proper** subset of $X$, denoted by $Y \subsetneq X$ (or just $Y \subset X$) if $Y \subseteq X$ but $X \nsubseteq Y$. Consequently, the order of listing of the elements of a set does not matter.  For example. $$\{2,3,5,7\} = \{5,3,7,2\} = \{n \in \Nn \colon\ \text{$n$ is a prime that $<$ 10} \}. $$<jupyter_code>Set([2,3,5,7])==Set([5,3,7,2])==Set([n for n in [0..10] if is_prime(n)])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17684305744007237, 'fraction_numerical': 0.019448213478064226, 'mean_word_length': 3.8508771929824563, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '303924', 'license': 'CC0-1.0', 'n_tokens_mistral': 770, 'n_tokens_neox': 748, 'n_words': 333, 'path': 'Sets.ipynb', 'repo_name': 'wypong/Discrete_Math', 'size': '2211'}