diff --git a/info4/kapitel-0/Mengentheorie.ipynb b/info4/kapitel-0/Mengentheorie.ipynb index 0ad8be7b980379b3d16a0a3adbf92f7acf3229d8..f09b27b59256c3fa628618b2a969093410373988 100644 --- a/info4/kapitel-0/Mengentheorie.ipynb +++ b/info4/kapitel-0/Mengentheorie.ipynb @@ -28,11 +28,12 @@ "source": [ "# Mengen\n", " \n", - "\n", "Fundamentale Idee der Mengentheorie: \n", - "* _\"The ability to regard any collection of objects as a single entity (i.e., as a set).\"_ (Keith Devlin. Joy of Sets.)\n", + "* _\"The ability to regard any collection of objects as a single entity (i.e., as a set).\"_ (Keith Devlin. Joy of Sets. Springer-Verlag.)\n", + "\n", + "* _\"Unter einer ‚Menge‘ verstehen wir jede Zusammenfassung M von bestimmten wohlunterschiedenen Objekten m unserer Anschauung oder unseres Denkens (welche die ‚Elemente‘ von M genannt werden) zu einem Ganzen.\"_ Georg Cantor (siehe [Textstelle als Bild in Wikipedia](https://de.wikipedia.org/wiki/Datei:Textstelle_mit_der_Mengendefinition_von_Georg_Cantor.png))\n", "\n", - "In der Regel gibt es eine Domäne an \"Objekten\" aus denen man Mengen bauen kann.\n", + "In der Regel gibt es eine Domäne an \"Objekten\" mit denen man Mengen bauen kann.\n", "Was genau diese Objekte sind interessiert uns in der Mengentheorie nicht.\n", "\n", "Fundamental sind diese beiden Symbole:\n", @@ -42,8 +43,14 @@ "\n", "\n", "$\\in$ und $\\not\\in$ sind Prädikate, verbunden durch die Eigenschaft:\n", - "* $\\forall(a,x).(a\\not\\in x \\Leftrightarrow \\neg(a \\in x))$\n", - "\n", + "* $\\forall(a,x).(a\\not\\in x \\Leftrightarrow \\neg(a \\in x))$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Die leere Menge und Gleichheit\n", "\n", "Eine besondere Menge ist die leere Menge $\\emptyset$.\n", "Sie hat keine Elemente:\n", @@ -101,7 +108,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -113,13 +120,13 @@ "TRUE" ] }, - "execution_count": 4, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "{1,2} = {1,2}" + "{1,2} = {2,1}" ] }, { @@ -159,7 +166,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Dies ist im Unterschied zu Tupeln und Listen, die oft mit runden und eckigen Klammern geschriben werden:" + "Dies ist im Unterschied zu Tupeln und Listen oder Folgen, die oft mit runden und eckigen Klammern geschriben werden:" ] }, { @@ -182,12 +189,12 @@ } ], "source": [ - "(2,5,3) = (2,3,5)" + "(2,5,3) = (2,3,5) // Vergleich von zwei Tripeln" ] }, { "cell_type": "code", - "execution_count": 162, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -199,13 +206,13 @@ "FALSE" ] }, - "execution_count": 162, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "[2,5,3] = [2,3,5]" + "[2,5,3] = [2,3,5] // Vergleich von zwei Folgen/Listen" ] }, { @@ -331,7 +338,8 @@ "source": [ "# Notationen für Mengen: per Prädikat\n", " \n", - "Definition der Elemente durch ein Prädikat $\\{a \\mid P(a)\\}$:\n", + "Man kann die Elemente einer Menge auch durch ein Prädikat beschreiben:$\\{a \\mid P(a)\\}$.\n", + "Es gilt:\n", "* $z = \\{a \\mid P(a)\\} \\Leftrightarrow \\forall(a).(a\\in z \\equiv P(a))$\n" ] }, @@ -362,7 +370,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Man kann damit auch unendliche Mengen darstellen:" + "Man kann mit dieser Schreibweise auch unendliche Mengen darstellen:" ] }, { @@ -415,7 +423,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Man kann damit auch die drei Mengenoperationen definieren:\n", + "Man kann mit dieser Schreibweise auch die drei Mengenoperationen definieren:\n", "\n", "* $x \\cup y = \\{a \\mid a\\in x \\vee a\\in y\\}$\n", "* $x \\cap y = \\{a \\mid a\\in x \\wedge a\\in y\\}$\n", @@ -615,13 +623,13 @@ "source": [ "## Beweis von $x \\cup (y \\cap z) = (x\\cup y) \\cap (x\\cup z)$\n", "\n", - "Lemmata:\n", + "Für den Beweis benötigen wir diese 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", + "Hier ist ein Äquivalenzbeweis (siehe vorherige Vorlesung): \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", @@ -636,7 +644,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Gesetze\n", + "# Gesetze für $\\cap$, $\\cup$ und $\\setminus$\n", "\n", "Für alle Mengen $x$, $y$, $z$ gilt:\n", "* $x \\cup y = y \\cup x$ (Kommutativ 1)\n", @@ -748,7 +756,19 @@ "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." + "Gesetze von De Morgan haben wir auch schon in der Aussagenlogik gesehen.\n", + "Auch hier haben diese die Form wo ein Ausdruck \n", + "* $Op1( x ~ Op2 ~ y)$\n", + "umgewandelt wird in einen Ausdruck\n", + "* $Op1(x) ~ Op2' ~ Op1(y)$\n", + "wo Op2' der duale Operator von Op2 ist." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Hier ein Beispiel für das letzte Gesetz:" ] }, { @@ -979,7 +999,8 @@ "source": [ "# SEND+MORE=MONEY\n", "\n", - "Klassisches arithmetisches Puzzle wo acht unterschiedliche Ziffern gefunden werden sollen die folgende Gleichung erfüllen:\n", + "Als Übung und Beispiel versuchen wir nun ein Problem zu lösen.\n", + "Es handelt sich um ein klassisches arithmetisches Puzzle wo acht unterschiedliche Ziffern gefunden werden sollen die folgende Gleichung erfüllen:\n", "\n", "| | | | | |\n", "|---|---|---|---|---|\n", @@ -1606,12 +1627,12 @@ "metadata": {}, "source": [ "# Potenzmenge\n", - "Die Menge aller Untermengen einer Menge $A$ schreiben wir als $\\pow(\\mathit{A}) $ oder auch als $2^{A}$." + "Die Menge aller Untermengen einer Menge $A$ schreiben wir als $ℙ(\\mathit{A}) $ oder auch als $2^{A}$." ] }, { "cell_type": "code", - "execution_count": 86, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -1623,18 +1644,18 @@ "{∅,{1},{1,2},{2}}" ] }, - "execution_count": 86, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "POW({1,2})" + "ℙ({1,2})" ] }, { "cell_type": "code", - "execution_count": 87, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -1646,41 +1667,47 @@ "{∅}" ] }, - "execution_count": 87, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "POW(∅)" + "ℙ(∅)" ] }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ - "$\\renewcommand{\\emptyset}{\\mathord\\varnothing}\\{\\emptyset,\\{1\\},\\{1,2\\},\\{1,3\\},\\{2\\},\\{1,2,3\\},\\{2,3\\},\\{3\\}\\}$" + "$\\newcommand{\\pow}{\\mathop{\\mathbb P\\hbox{}}\\nolimits}\\newcommand{\\upto}{\\mathbin{.\\mkern1mu.}}\\mathit{TRUE}$\n", + "\n", + "**Solution:**\n", + "* $\\mathit{x} = \\pow((1 \\upto 3))$" ], "text/plain": [ - "{∅,{1},{1,2},{1,3},{2},{1,2,3},{2,3},{3}}" + "TRUE\n", + "\n", + "Solution:\n", + "\tx = ℙ((1 ‥ 3))" ] }, - "execution_count": 88, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "POW(1..3)" + "ℙ(1..3)=x" ] }, { "cell_type": "code", - "execution_count": 98, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -1709,18 +1736,18 @@ "{3}\n" ] }, - "execution_count": 98, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ - ":table POW(1..3)" + ":table ℙ(1..3)" ] }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -1741,18 +1768,18 @@ "{{1}}\n" ] }, - "execution_count": 101, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ - ":table POW(POW({1}))" + ":table ℙ(ℙ({1}))" ] }, { "cell_type": "code", - "execution_count": 90, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -1764,18 +1791,18 @@ "8" ] }, - "execution_count": 90, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "card(POW(1..3))" + "card(ℙ(1..3))" ] }, { "cell_type": "code", - "execution_count": 91, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -1787,18 +1814,18 @@ "1024" ] }, - "execution_count": 91, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "card(POW(1..10))" + "card(ℙ(1..10))" ] }, { "cell_type": "code", - "execution_count": 92, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -1810,18 +1837,18 @@ "1267650600228229401496703205376" ] }, - "execution_count": 92, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "card(POW(1..100))" + "card(ℙ(1..100))" ] }, { "cell_type": "code", - "execution_count": 95, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -1833,18 +1860,18 @@ "340282366920938463463374607431768211456" ] }, - "execution_count": 95, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "card(POW(POW(1..7)))" + "card(ℙ(ℙ(1..7)))" ] }, { "cell_type": "code", - "execution_count": 96, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -1856,13 +1883,13 @@ "115792089237316195423570985008687907853269984665640564039457584007913129639936" ] }, - "execution_count": 96, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "card(POW(POW(POW(1..3))))" + "card(ℙ(ℙ(ℙ(1..3))))" ] }, { @@ -2429,7 +2456,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Das Kartesische Produkt stellt die Relation dar die immer wahr ist (für die angegebenen Basismengen). Als Graph ist dies der vollständige Graph über die Basismengen:" + "Das Kartesische Produkt stellt die Relation dar die immer wahr ist (für die angegebenen Basismengen). Als Graph ist dies der [vollständige Graph](https://de.wikipedia.org/wiki/Vollständiger_Graph) über die Basismengen:" ] }, { @@ -7318,6 +7345,15 @@ ":dot expr_as_graph (\"h+\",closure1(h))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + ":unlet h" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -8464,6 +8500,15 @@ "sub1 ∈ POW(1..3) --> POW(1..3)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + ":unlet sub1" + ] + }, { "cell_type": "code", "execution_count": 107, diff --git a/info4/kapitel-0/img/Venn.svg b/info4/kapitel-0/img/Venn.svg index 3d533c6bdee8851e00207af46923e6b364f427e1..648fc08975279e96e871c1d3308f38c65a4ca487 100644 --- a/info4/kapitel-0/img/Venn.svg +++ b/info4/kapitel-0/img/Venn.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xl="http://www.w3.org/1999/xlink" viewBox="194 -63 614 597" width="614" height="597"> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" version="1.1" viewBox="194 -63 614 597" width="614" height="597"> <defs> <font-face font-family="Helvetica Neue" font-size="20" panose-1="2 0 5 3 0 0 0 2 0 4" units-per-em="1000" underline-position="-100" underline-thickness="50" slope="0" x-height="517" cap-height="714" ascent="951.9958" descent="-212.99744" font-weight="400"> <font-face-src> @@ -9,9 +9,9 @@ </font-face> </defs> <metadata> Produced by OmniGraffle 7.15 - <dc:date>2017-03-16 10:54:24 +0000</dc:date> + <dc:date>2020-04-22 13:27:41 +0000</dc:date> </metadata> - <g id="Canvas_1" stroke-dasharray="none" fill="none" fill-opacity="1" stroke-opacity="1" stroke="none"> + <g id="Canvas_1" stroke="none" fill="none" fill-opacity="1" stroke-dasharray="none" stroke-opacity="1"> <title>Canvas 1</title> <rect fill="white" x="194" y="-63" width="614" height="597"/> <g id="Canvas_1: Layer 1"> @@ -31,12 +31,15 @@ </text> </g> <g id="Graphic_5"> - <circle cx="504" cy="132" r="194.000309992968" fill="#ffc0c0" fill-opacity=".17465753"/> + <circle cx="504" cy="132" r="194.000309992968" fill="#ffc0c0" fill-opacity=".37549024"/> <circle cx="504" cy="132" r="194.000309992968" stroke="black" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"/> <text transform="translate(353.8 120.22)" fill="black"> <tspan font-family="Helvetica Neue" font-size="20" font-weight="400" fill="black" x="145.02" y="19">x</tspan> </text> </g> + <g id="Graphic_7"> + <path d="M 423 311 L 423 348 C 430.9 440.5 454.6 449.75 502 496 C 549.4 449.75 573.1 440.5 581 348 L 581 311 C 549.4 320.25 545.45 324.875 502 329.5 C 458.55 324.875 454.6 320.25 423 311" fill="#ffc0c0" fill-opacity=".26253743"/> + </g> </g> </g> </svg>