<commit_before>You should look at least at the page on the natural numbers for background, and possibly also at the set theory notes.

## Definition of the Integers
An **integer** is an expression $a --- b$ for $a, b \in \mathbb{N}$. Two integers $a --- b$ and $c --- d$ are equal iff $a + d = c + b$. $\mathbb{Z}$ denotes the set of all integers.

## Integer equality is an equivalence relation
For all $a --- b, c --- d, e --- f \in \mathbb{Z}$, we have

 - $a --- b = a --- b$
 - If $a -- b = c --- d$, then $c --- d = a --- b$
 - If $a --- b = c --- d $ and $c --- d = e --- f$, then $a --- b = e --- f$

 1. $a --- b = a --- b$

    *Proof:* $a + b = b + a$ by commutativity of $+$.

 2. If $a -- b = c --- d$, then $c --- d = a --- b$

    *Proof:* By hypothesis $a + d = c + b$. But $c + b = a + d$ by symmetricity of equality on $\mathbb{N}$.

 3. If $a --- b = c --- d $ and $c --- d = e --- f$, then $a --- b = e --- f$

    *Proof:* We have $a + d = c + b$ and $c + f = e + d$, so $a + f + c + d = e + b + c + d$ by addition. By cancellation we have $a + f = e + b$, which proves the statement.


## Definition of integer addition and multiplication
Integer addition is defined by $a --- b + c --- d = (a + c) --- (b + d)$

Integer multiplication is defined by $ a --- b \cdot c --- d = (ac + bd) --- (ad + bc)$

### Addition and multiplication are well-defined
If $A --- B = a --- b$ and $C --- D = c --- d$ then

 - $A --- B + C --- D = a --- b + c --- d$
 - $A --- B \cdot C --- D = a --- b \cdot c --- d$

 1. $A --- B + C --- D = a --- b + c --- d$

    *Proof:* We must show $(A + C) --- (B + D) = (a + c) --- (b + d)$ That is, that $(A + C) + (b + d) = (a + c) + (B + D)$. But $A + b = a + B$ and $C + d = c + D$, which establishes the statement.

 2. $A --- B \cdot C --- D = a --- b + c --- d$

    *Proof:* We must show $Z := (AC + BD) --- (AD + BC) = (ac + bd) -- (ad + bc) =: z$, or:

    $$Z_0 + z_1 = z_0 + Z_1$$

    Where $Z_0 = AC + BD$, $Z_1 = AD + BC$, $z_0 = ad + bc$ and $z_1 = ac + bd$.

    However, it can be easily shown that

    $$z_0 + (Ac + Bd) = z_1 + (Ad + Bc)$$

    and

    $$Z_0 + (Ad + Bc) = Z_1 + (Ac + Bd)$$

    So $Z_0 + z_1 + (Ac + Bd) + (Ad + Bc) = z_0 + Z_1 + (Ac + Bd) + (Ad + Bc)$, so by cancellation the statement is established.


## $\mathbb{N}$ is a subset of $\mathbb{Z}$
For all $n, m \in \mathbb{N}$, 
 - $n --- 0 + m --- 0 = (n + m) --- 0$, 
 - $n --- 0 \times m --- 0 = (n \cdot m) --- 0$
 - $n --- 0 = m --- 0$ iff $n = m$.

 1. $n --- 0 + m --- 0 = (n + m) --- 0$

    *Proof:* Immediate from the definition of integer addition.

 2. $n --- 0 \times m --- 0 = (n \cdot m) --- 0$

    *Proof:* $n -- 0 \times m --- 0 = (nm  + 00) --- (n0 + m0) = nm --- 0$.

 3. $n --- 0 = m --- 0$ iff $n = m$.

    *Proof:*  Immediate from the definition of integer equality.

### Corollary
We can identify for all $n \in \mathbb{N}$ the integer $n --- 0$, since these integers behave exactly like the naturals. We will say that an integer $z = n$ for some $n \in \mathbb{N}$ as shorthand for $z = n --- 0$.


## Definition of integer negation
If $a --- b \in \mathbb{Z}$, then $-(a --- b)$ defined to be $b --- a$.

### Integer negation is well-defined
If $A --- B = a --- b$, then $-(A --- B) = -(a --- b)$

*Proof:* $-(A --- B) = B --- A$. But $A = a$ and $B = b$ by hypothesis, so $B --- A = b --- a = -(a --- b)$.


<commit_msg>Prove one more proposition about integer negation<commit_after>You should look at least at the page on the natural numbers for background, and possibly also at the set theory notes.

## Definition of the Integers
An **integer** is an expression $a --- b$ for $a, b \in \mathbb{N}$. Two integers $a --- b$ and $c --- d$ are equal iff $a + d = c + b$. $\mathbb{Z}$ denotes the set of all integers.

## Integer equality is an equivalence relation
For all $a --- b, c --- d, e --- f \in \mathbb{Z}$, we have

 - $a --- b = a --- b$
 - If $a -- b = c --- d$, then $c --- d = a --- b$
 - If $a --- b = c --- d $ and $c --- d = e --- f$, then $a --- b = e --- f$

 1. $a --- b = a --- b$

    *Proof:* $a + b = b + a$ by commutativity of $+$.

 2. If $a -- b = c --- d$, then $c --- d = a --- b$

    *Proof:* By hypothesis $a + d = c + b$. But $c + b = a + d$ by symmetricity of equality on $\mathbb{N}$.

 3. If $a --- b = c --- d $ and $c --- d = e --- f$, then $a --- b = e --- f$

    *Proof:* We have $a + d = c + b$ and $c + f = e + d$, so $a + f + c + d = e + b + c + d$ by addition. By cancellation we have $a + f = e + b$, which proves the statement.


## Definition of integer addition and multiplication
Integer addition is defined by $a --- b + c --- d = (a + c) --- (b + d)$

Integer multiplication is defined by $ a --- b \cdot c --- d = (ac + bd) --- (ad + bc)$

### Addition and multiplication are well-defined
If $A --- B = a --- b$ and $C --- D = c --- d$ then

 - $A --- B + C --- D = a --- b + c --- d$
 - $A --- B \cdot C --- D = a --- b \cdot c --- d$

 1. $A --- B + C --- D = a --- b + c --- d$

    *Proof:* We must show $(A + C) --- (B + D) = (a + c) --- (b + d)$ That is, that $(A + C) + (b + d) = (a + c) + (B + D)$. But $A + b = a + B$ and $C + d = c + D$, which establishes the statement.

 2. $A --- B \cdot C --- D = a --- b + c --- d$

    *Proof:* We must show $Z := (AC + BD) --- (AD + BC) = (ac + bd) -- (ad + bc) =: z$, or:

    $$Z_0 + z_1 = z_0 + Z_1$$

    Where $Z_0 = AC + BD$, $Z_1 = AD + BC$, $z_0 = ad + bc$ and $z_1 = ac + bd$.

    However, it can be easily shown that

    $$z_0 + (Ac + Bd) = z_1 + (Ad + Bc)$$

    and

    $$Z_0 + (Ad + Bc) = Z_1 + (Ac + Bd)$$

    So $Z_0 + z_1 + (Ac + Bd) + (Ad + Bc) = z_0 + Z_1 + (Ac + Bd) + (Ad + Bc)$, so by cancellation the statement is established.


## $\mathbb{N}$ is a subset of $\mathbb{Z}$
For all $n, m \in \mathbb{N}$, 
 - $n --- 0 + m --- 0 = (n + m) --- 0$, 
 - $n --- 0 \times m --- 0 = (n \cdot m) --- 0$
 - $n --- 0 = m --- 0$ iff $n = m$.

 1. $n --- 0 + m --- 0 = (n + m) --- 0$

    *Proof:* Immediate from the definition of integer addition.

 2. $n --- 0 \times m --- 0 = (n \cdot m) --- 0$

    *Proof:* $n -- 0 \times m --- 0 = (nm  + 00) --- (n0 + m0) = nm --- 0$.

 3. $n --- 0 = m --- 0$ iff $n = m$.

    *Proof:*  Immediate from the definition of integer equality.

### Corollary
We can identify for all $n \in \mathbb{N}$ the integer $n --- 0$, since these integers behave exactly like the naturals. We will say that an integer $z = n$ for some $n \in \mathbb{N}$ as shorthand for $z = n --- 0$.


## Definition of integer negation
If $a --- b \in \mathbb{Z}$, then $-(a --- b)$ defined to be $b --- a$.

### Integer negation is well-defined
If $A --- B = a --- b$, then $-(A --- B) = -(a --- b)$

*Proof:* $-(A --- B) = B --- A$. But $A = a$ and $B = b$ by hypothesis, so $B --- A = b --- a = -(a --- b)$.

### Pull the negative sign out in front.
For any $x \in \mathbb{Z}$, $-1 \cdot x = -x$.

*Proof:* $x = a --- b$ for some $a, b \in \mathbb{N}$. So $-1 \cdot x = 0 --- 1 \cdot a --- b = (0a + 1b) --- (0b + 1a = b --- a = -x$.



{'fraction_non_alphanumeric': 0.24139402560455192, 'fraction_numerical': 0.015078236130867709, 'mean_word_length': 1.6127833519137866, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6967971', 'n_tokens_mistral': 2810, 'n_tokens_neox': 2624, 'n_words': 1198}