Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prob-teaching-notebooks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
prob-teaching-notebooks
Commits
c2711f4a
Commit
c2711f4a
authored
5 years ago
by
Michael Leuschel
Browse files
Options
Downloads
Patches
Plain Diff
add slides about proof and laws
parent
5b8e374f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
info4/kapitel-0/Mengentheorie.ipynb
+143
-1
143 additions, 1 deletion
info4/kapitel-0/Mengentheorie.ipynb
info4/kapitel-0/img/Venn.pdf
+0
-0
0 additions, 0 deletions
info4/kapitel-0/img/Venn.pdf
with
143 additions
and
1 deletion
info4/kapitel-0/Mengentheorie.ipynb
+
143
−
1
View file @
c2711f4a
...
...
@@ -545,7 +545,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Ein Theorem\n",
"# Ein Theorem
(Distributivgesetz 1)
\n",
"\n",
"Für alle Mengen $x$, $y$, $z$ gilt:\n",
"* $x \\cup (y \\cap z) = (x\\cup y) \\cap (x\\cup z)$\n",
...
...
@@ -599,6 +599,148 @@
"({2,3,55}∪{2,44,77})∩({2,3,55}∪{2,44,66})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Beweis von $x \\cup (y \\cap z) = (x\\cup y) \\cap (x\\cup z)$\n",
"\n",
"Lemmata:\n",
"1. $x \\cup y = \\{a \\mid a\\in x \\vee a\\in y\\}$\n",
"2. $x \\cap y = \\{a \\mid a\\in x \\wedge a\\in y\\}$\n",
"3. $a \\in \\{b \\mid P(b)\\} \\equiv P(a)$\n",
"4. $\\phi \\vee (\\psi \\wedge \\rho) \\equiv (\\phi \\vee \\psi) \\wedge (\\phi \\vee \\rho)$\n",
"\n",
"Ãquivalenzbeweis \n",
"1. $x \\cup (y \\cap z)$\n",
"2. (Lemma 1) $\\Longleftrightarrow$ $\\{a \\mid a\\in x \\vee a\\in (y \\cap z)\\}$ \n",
"3. (Lemma 2) $\\Longleftrightarrow$ $\\{a \\mid a\\in x \\vee a\\in \\{b \\mid b\\in y \\wedge b\\in z\\} \\}$ \n",
"4. (Lemma 3) $\\Longleftrightarrow$ $\\{a \\mid a\\in x \\vee (a\\in y \\wedge a\\in z) \\}$\n",
"5. (Lemma 4) $\\Longleftrightarrow$ $\\{a \\mid (a\\in x \\vee a\\in y) \\wedge (a\\in x \\vee a\\in z) \\}$\n",
"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\\} \\}$\n",
"7. (Lemma 1, $\\Leftarrow$) $\\Longleftrightarrow$ $\\{a \\mid a\\in x \\cup y \\wedge a\\in x \\cup z) \\}$\n",
"8. (Lemma 2, $\\Leftarrow$) $(x\\cup y) \\cap (x\\cup z)$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Gesetze\n",
"\n",
"Für alle Mengen $x$, $y$, $z$ gilt:\n",
"* $x \\cup y = y \\cup x$ (Kommutativ 1)\n",
"* $x \\cap y = y \\cap x$ (Kommutativ 2)\n",
"* $x \\cup (y \\cup z) = (x\\cup y) \\cup z$ (Assoziativ 1)\n",
"* $x \\cap (y \\cap z) = (x\\cap y) \\cap z$ (Assoziativ 2)\n",
"* $x \\cup (y \\cap z) = (x\\cup y) \\cap (x\\cup z)$ (Distributiv 1, siehe oben)\n",
"* $x \\cap (y \\cup z) = (x\\cap y) \\cup (x\\cap z)$ (Distributiv 2)\n",
"* $z \\setminus (x \\cup y) = (z\\setminus x) \\cap (z\\setminus y)$ (De Morgan 1)\n",
"* $z \\setminus (x \\cap y) = (z\\setminus x) \\cup (z\\setminus y)$ (De Morgan 2)\n",
"* $x \\cup \\emptyset = x$ (Leere Menge 1)\n",
"* $x \\cap \\emptyset = \\emptyset$ (Leere Menge 2)\n",
"* $x \\cap (z \\setminus x) = \\emptyset$ (Leere Menge 3)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{1,3,7,9\\}$"
],
"text/plain": [
"{1,3,7,9}"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(1..10) \\ ({2,4,6,8} ∪ {5,10}) // De Morgan 1 - linke Seite"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{1,3,5,7,9,10\\}$"
],
"text/plain": [
"{1,3,5,7,9,10}"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(1..10) \\ {2,4,6,8}"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{1,2,3,4,6,7,8,9\\}$"
],
"text/plain": [
"{1,2,3,4,6,7,8,9}"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(1..10) \\ {5,10}"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{1,3,7,9\\}$"
],
"text/plain": [
"{1,3,7,9}"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"((1..10) \\ {2,4,6,8}) ∩ ((1..10) \\ {5,10}) // De Morgan 1 - rechte Seite"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"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",
"execution_count": null,
...
...
%% 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
\i
n x$ wahr, wenn $a$ ein Element von $x$ ist
*
ist $a
\n
ot
\i
n x$ wahr, wenn $a$
**kein**
Element von $x$ ist.
$
\i
n$ und $
\n
ot
\i
n$ sind Prädikate, verbunden durch die Eigenschaft:
*
$
\f
orall(a,x).(a
\n
ot
\i
n x
\L
eftrightarrow
\n
eg(a
\i
n x))$
Eine besondere Menge ist die leere Menge $
\e
mptyset$.
Sie hat keine Elemente:
*
$z =
\e
mptyset
\L
eftrightarrow
\f
orall(a).(a
\n
ot
\i
n z)$
Zwei Mengen $x$ und $y$ sind gleich gdw wenn sie die gleichen Elemente haben:
*
$
\f
orall(x,y).(x=y
\L
eftrightarrow
\f
orall(a).(a
\i
n x
\L
eftrightarrow a
\i
n 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,
\l
dots,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 $
\c
up$ :
*
$z = x
\c
up y
\L
eftrightarrow
\f
orall(a).(a
\i
n z
\L
eftrightarrow (a
\i
n x
\v
ee a
\i
n y))$
Schnitt von Mengen $
\c
ap$:
*
$z = x
\c
ap y
\L
eftrightarrow
\f
orall(a).(a
\i
n z
\L
eftrightarrow (a
\i
n x
\w
edge a
\i
n y))$
Differenz von Mengen $
\s
etminus$:
*
$z = x
\s
etminus y
\L
eftrightarrow
\f
orall(a).(a
\i
n z
\L
eftrightarrow (a
\i
n x
\w
edge a
\n
ot
\i
n 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
\m
id P(a)
\}
$:
*
$z =
\{
a
\m
id P(a)
\}
\L
eftrightarrow
\f
orall(a).(a
\i
n z
\e
quiv 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
\c
up y =
\{
a
\m
id a
\i
n x
\v
ee a
\i
n y
\}
$
*
$x
\c
ap y =
\{
a
\m
id a
\i
n x
\w
edge a
\i
n y
\}
$
*
$x
\s
etminus y =
\{
a
\m
id a
\i
n x
\w
edge a
\n
ot
\i
n 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
\m
id x
\g
eq a
\w
edge x
\l
eq 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
\c
up (y
\c
ap z) = (x
\c
up y)
\c
ap (x
\c
up 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
\c
up y =
\{
a
\m
id a
\i
n x
\v
ee a
\i
n y
\}
$
2.
$x
\c
ap y =
\{
a
\m
id a
\i
n x
\w
edge a
\i
n y
\}
$
3.
$a
\i
n
\{
b
\m
id P(b)
\}
\e
quiv P(a)$
4.
$
\p
hi
\v
ee (
\p
si
\w
edge
\r
ho)
\e
quiv (
\p
hi
\v
ee
\p
si)
\w
edge (
\p
hi
\v
ee
\r
ho)$
Ãquivalenzbeweis
1.
$x
\c
up (y
\c
ap z)$
2.
(Lemma 1) $
\L
ongleftrightarrow$ $
\{
a
\m
id a
\i
n x
\v
ee a
\i
n (y
\c
ap z)
\}
$
3.
(Lemma 2) $
\L
ongleftrightarrow$ $
\{
a
\m
id a
\i
n x
\v
ee a
\i
n
\{
b
\m
id b
\i
n y
\w
edge b
\i
n z
\}
\}
$
4.
(Lemma 3) $
\L
ongleftrightarrow$ $
\{
a
\m
id a
\i
n x
\v
ee (a
\i
n y
\w
edge a
\i
n z)
\}
$
5.
(Lemma 4) $
\L
ongleftrightarrow$ $
\{
a
\m
id (a
\i
n x
\v
ee a
\i
n y)
\w
edge (a
\i
n x
\v
ee a
\i
n z)
\}
$
6.
(Lemma 3, $
\L
eftarrow$) $
\L
ongleftrightarrow$ $
\{
a
\m
id a
\i
n
\{
b
\m
id b
\i
n x
\v
ee b
\i
n y
\}
\w
edge a
\i
n
\{
b
\m
id b
\i
n x
\v
ee b
\i
n z
\}
\}
$
7.
(Lemma 1, $
\L
eftarrow$) $
\L
ongleftrightarrow$ $
\{
a
\m
id a
\i
n x
\c
up y
\w
edge a
\i
n x
\c
up z)
\}
$
8.
(Lemma 2, $
\L
eftarrow$) $(x
\c
up y)
\c
ap (x
\c
up z)$
%% Cell type:markdown id: tags:
# Gesetze
Für alle Mengen $x$, $y$, $z$ gilt:
*
$x
\c
up y = y
\c
up x$ (Kommutativ 1)
*
$x
\c
ap y = y
\c
ap x$ (Kommutativ 2)
*
$x
\c
up (y
\c
up z) = (x
\c
up y)
\c
up z$ (Assoziativ 1)
*
$x
\c
ap (y
\c
ap z) = (x
\c
ap y)
\c
ap z$ (Assoziativ 2)
*
$x
\c
up (y
\c
ap z) = (x
\c
up y)
\c
ap (x
\c
up z)$ (Distributiv 1, siehe oben)
*
$x
\c
ap (y
\c
up z) = (x
\c
ap y)
\c
up (x
\c
ap z)$ (Distributiv 2)
*
$z
\s
etminus (x
\c
up y) = (z
\s
etminus x)
\c
ap (z
\s
etminus y)$ (De Morgan 1)
*
$z
\s
etminus (x
\c
ap y) = (z
\s
etminus x)
\c
up (z
\s
etminus y)$ (De Morgan 2)
*
$x
\c
up
\e
mptyset = x$ (Leere Menge 1)
*
$x
\c
ap
\e
mptyset =
\e
mptyset$ (Leere Menge 2)
*
$x
\c
ap (z
\s
etminus x) =
\e
mptyset$ (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
```
...
...
This diff is collapsed.
Click to expand it.
info4/kapitel-0/img/Venn.pdf
0 → 100644
+
0
−
0
View file @
c2711f4a
File added
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment