Skip to content
Snippets Groups Projects
Commit c2711f4a authored by Michael Leuschel's avatar Michael Leuschel
Browse files

add slides about proof and laws

parent 5b8e374f
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id: tags:
# Vorlesung 0 - Teil 2 Mengentheorie
Grundlagen der Logik und Mengentheorie sind nicht im Skript.
Hier definieren wir einige Grundlagen und Notationen die im Skript verwendet werden.
Ein gutes Verständnis dieser Grundlagen und Notationen ist für das Verständnis des Skripts, aber auch anderer Teile der Informatik unumgänglich.
%% Cell type:markdown id: tags:
# Mengen
Fundamentale Idee der Mengentheorie:
* _"The ability to regard any collection of objects as a single entity (i.e., as a set)."_ (Keith Devlin. Joy of Sets.)
In der Regel gibt es eine Domäne an "Objekten" aus denen man Mengen bauen kann.
Was genau diese Objekte sind interessiert uns in der Mengentheorie nicht.
Fundamental sind diese beiden Symbole:
* wenn $a$ ein Objekt ist und $x$ eine Menge, dann
* ist $a \in x$ wahr, wenn $a$ ein Element von $x$ ist
* ist $a \not\in x$ wahr, wenn $a$ **kein** Element von $x$ ist.
$\in$ und $\not\in$ sind Prädikate, verbunden durch die Eigenschaft:
* $\forall(a,x).(a\not\in x \Leftrightarrow \neg(a \in x))$
Eine besondere Menge ist die leere Menge $\emptyset$.
Sie hat keine Elemente:
* $z = \emptyset \Leftrightarrow \forall(a).(a\not\in z)$
Zwei Mengen $x$ und $y$ sind gleich gdw wenn sie die gleichen Elemente haben:
* $\forall(x,y).(x=y \Leftrightarrow \forall(a).(a\in x \Leftrightarrow a \in y))$
%% Cell type:code id: tags:
``` prob
∅ = {1}
```
%% Output
$\mathit{FALSE}$
FALSE
%% Cell type:code id: tags:
``` prob
{1} = {1,2}
```
%% Output
$\mathit{FALSE}$
FALSE
%% Cell type:code id: tags:
``` prob
{1,2} = {1,2}
```
%% Output
$\mathit{TRUE}$
TRUE
%% Cell type:markdown id: tags:
# Notationen für Mengen: endliche Enumeration
* explizite Auflistung aller Elemente $\{a_1,\ldots,a_n\}$
* die Reihenfolge spielt keine Rolle:
%% Cell type:code id: tags:
``` prob
{2,5,3} = {2,3,5}
```
%% Output
$\mathit{TRUE}$
TRUE
%% Cell type:markdown id: tags:
Dies ist im Unterschied zu Tupeln und Listen, die oft mit runden und eckigen Klammern geschriben werden:
%% Cell type:code id: tags:
``` prob
(2,5,3) = (2,3,5)
```
%% Output
$\mathit{FALSE}$
FALSE
%% Cell type:code id: tags:
``` prob
[2,5,3] = [2,5,3]
```
%% Output
$\mathit{TRUE}$
TRUE
%% Cell type:markdown id: tags:
* Elemente können in der Enumeration mehrfach auftauchen:
%% Cell type:code id: tags:
``` prob
{2,5,3,2,5} = {2,3,5}
```
%% Output
$\mathit{TRUE}$
TRUE
%% Cell type:markdown id: tags:
# Vereinigung, Schnitt, Differenz
Drei wichtige Operationen auf Mengen sind wie folgt.
Vereinigung von Mengen $\cup$ :
* $z = x\cup y \Leftrightarrow \forall(a).(a\in z \Leftrightarrow (a\in x \vee a \in y))$
Schnitt von Mengen $\cap$:
* $z = x\cap y \Leftrightarrow \forall(a).(a\in z \Leftrightarrow (a\in x \wedge a \in y))$
Differenz von Mengen $\setminus$:
* $z = x \setminus y \Leftrightarrow \forall(a).(a\in z \Leftrightarrow (a\in x \wedge a \not\in y))$
%% Cell type:code id: tags:
``` prob
{2,3,5} ∪ {5,7}
```
%% Output
$\{2,3,5,7\}$
{2,3,5,7}
%% Cell type:code id: tags:
``` prob
{2,3,5}∩{5,7}
```
%% Output
$\{5\}$
{5}
%% Cell type:code id: tags:
``` prob
{2,3,5}−{5,7}
```
%% Output
$\{2,3\}$
{2,3}
%% Cell type:markdown id: tags:
# Notationen für Mengen: per Prädikat
Definition der Elemente durch ein Prädikat $\{a \mid P(a)\}$:
* $z = \{a \mid P(a)\} \Leftrightarrow \forall(a).(a\in z \equiv P(a))$
%% Cell type:code id: tags:
``` prob
{a | a>1 & a<6 & a≠4}
```
%% Output
$\{2,3,5\}$
{2,3,5}
%% Cell type:markdown id: tags:
Man kann damit auch unendliche Mengen darstellen:
%% Cell type:code id: tags:
``` prob
{a | a>10}
```
%% Output
$\{\mathit{a}\mid \mathit{a} > 10\}$
{a∣a > 10}
%% Cell type:code id: tags:
``` prob
{a | a mod 2 = 0} ∩ {2,3,5}
```
%% Output
$\{2\}$
{2}
%% Cell type:markdown id: tags:
Man kann damit auch die drei Mengenoperationen definieren:
* $x \cup y = \{a \mid a\in x \vee a\in y\}$
* $x \cap y = \{a \mid a\in x \wedge a\in y\}$
* $x \setminus y = \{a \mid a\in x \wedge a\not\in y\}$
%% Cell type:code id: tags:
``` prob
x = {2,3} & y = {2,5} & xy = {a| a∈x ∨ a∈y}
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{xy} = \{2,3,5\}$
* $\mathit{x} = \{2,3\}$
* $\mathit{y} = \{2,5\}$
TRUE
Solution:
xy = {2,3,5}
x = {2,3}
y = {2,5}
%% Cell type:code id: tags:
``` prob
x = {2,3} & y = {2,5} & xy = {a| a∈x ∧ a∈y}
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{xy} = \{2\}$
* $\mathit{x} = \{2,3\}$
* $\mathit{y} = \{2,5\}$
TRUE
Solution:
xy = {2}
x = {2,3}
y = {2,5}
%% Cell type:code id: tags:
``` prob
x = {2,3} & y = {2,5} & xy = {a| a∈x ∧ a∉y}
```
%% Output
$\mathit{TRUE}$
**Solution:**
* $\mathit{xy} = \{3\}$
* $\mathit{x} = \{2,3\}$
* $\mathit{y} = \{2,5\}$
TRUE
Solution:
xy = {3}
x = {2,3}
y = {2,5}
%% Cell type:markdown id: tags:
Als Kürzel führen wir auch die Notation $a..b$ für $\{x \mid x \geq a \wedge x \leq b\}$ ein.
%% Cell type:code id: tags:
``` prob
1..10
```
%% Output
$\{1,2,3,4,5,6,7,8,9,10\}$
{1,2,3,4,5,6,7,8,9,10}
%% Cell type:markdown id: tags:
# Ein Theorem
# Ein Theorem (Distributivgesetz 1)
Für alle Mengen $x$, $y$, $z$ gilt:
* $x \cup (y \cap z) = (x\cup y) \cap (x\cup z)$
<img src="./img/Venn.pdf" width="300">
%% Cell type:code id: tags:
``` prob
{2,3,55}∪({2,44,77}∩{2,44,66})
```
%% Output
$\{2,3,44,55\}$
{2,3,44,55}
%% Cell type:code id: tags:
``` prob
({2,3,55}∪{2,44,77})∩({2,3,55}∪{2,44,66})
```
%% Output
$\{2,3,44,55\}$
{2,3,44,55}
%% Cell type:markdown id: tags:
## Beweis von $x \cup (y \cap z) = (x\cup y) \cap (x\cup z)$
Lemmata:
1. $x \cup y = \{a \mid a\in x \vee a\in y\}$
2. $x \cap y = \{a \mid a\in x \wedge a\in y\}$
3. $a \in \{b \mid P(b)\} \equiv P(a)$
4. $\phi \vee (\psi \wedge \rho) \equiv (\phi \vee \psi) \wedge (\phi \vee \rho)$
Äquivalenzbeweis
1. $x \cup (y \cap z)$
2. (Lemma 1) $\Longleftrightarrow$ $\{a \mid a\in x \vee a\in (y \cap z)\}$
3. (Lemma 2) $\Longleftrightarrow$ $\{a \mid a\in x \vee a\in \{b \mid b\in y \wedge b\in z\} \}$
4. (Lemma 3) $\Longleftrightarrow$ $\{a \mid a\in x \vee (a\in y \wedge a\in z) \}$
5. (Lemma 4) $\Longleftrightarrow$ $\{a \mid (a\in x \vee a\in y) \wedge (a\in x \vee a\in z) \}$
6. (Lemma 3, $\Leftarrow$) $\Longleftrightarrow$ $\{a \mid a\in \{b \mid b\in x \vee b\in y\} \wedge a\in \{b \mid b\in x \vee b\in z\} \}$
7. (Lemma 1, $\Leftarrow$) $\Longleftrightarrow$ $\{a \mid a\in x \cup y \wedge a\in x \cup z) \}$
8. (Lemma 2, $\Leftarrow$) $(x\cup y) \cap (x\cup z)$
%% Cell type:markdown id: tags:
# Gesetze
Für alle Mengen $x$, $y$, $z$ gilt:
* $x \cup y = y \cup x$ (Kommutativ 1)
* $x \cap y = y \cap x$ (Kommutativ 2)
* $x \cup (y \cup z) = (x\cup y) \cup z$ (Assoziativ 1)
* $x \cap (y \cap z) = (x\cap y) \cap z$ (Assoziativ 2)
* $x \cup (y \cap z) = (x\cup y) \cap (x\cup z)$ (Distributiv 1, siehe oben)
* $x \cap (y \cup z) = (x\cap y) \cup (x\cap z)$ (Distributiv 2)
* $z \setminus (x \cup y) = (z\setminus x) \cap (z\setminus y)$ (De Morgan 1)
* $z \setminus (x \cap y) = (z\setminus x) \cup (z\setminus y)$ (De Morgan 2)
* $x \cup \emptyset = x$ (Leere Menge 1)
* $x \cap \emptyset = \emptyset$ (Leere Menge 2)
* $x \cap (z \setminus x) = \emptyset$ (Leere Menge 3)
%% Cell type:code id: tags:
``` prob
(1..10) \ ({2,4,6,8} ∪ {5,10}) // De Morgan 1 - linke Seite
```
%% Output
$\{1,3,7,9\}$
{1,3,7,9}
%% Cell type:code id: tags:
``` prob
(1..10) \ {2,4,6,8}
```
%% Output
$\{1,3,5,7,9,10\}$
{1,3,5,7,9,10}
%% Cell type:code id: tags:
``` prob
(1..10) \ {5,10}
```
%% Output
$\{1,2,3,4,6,7,8,9\}$
{1,2,3,4,6,7,8,9}
%% Cell type:code id: tags:
``` prob
((1..10) \ {2,4,6,8}) ∩ ((1..10) \ {5,10}) // De Morgan 1 - rechte Seite
```
%% Output
$\{1,3,7,9\}$
{1,3,7,9}
%% Cell type:markdown id: tags:
Gesetze von De Morgan: $Op1( x ~ Op2 ~ y)$ wird umgewandelt nach $Op1(x) ~ Op2' ~ Op1(y)$, wo Op2' der duale Operator von Op2 ist.
%% Cell type:code id: tags:
``` prob
```
......
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment