Professional Documents
Culture Documents
Michael Leuschel
2017
1 / 96
Was ist Logik?
Quelle:
http://www.3sat.de/page/?source=/philosophie/159958/index.html:
2 / 96
Was ist Logik?
Quelle:
http://www.3sat.de/page/?source=/philosophie/159958/index.html:
2 / 96
Was ist Logik?
Quelle https://de.wikipedia.org/wiki/Logik:
3 / 96
Was ist Logik?
Quelle https://de.wikipedia.org/wiki/Logik:
vernnftiges Schlussfolgern, Denklehre
In der Logik wird die Struktur von Argumenten im Hinblick auf
ihre Gltigkeit untersucht, unabhngig vom Inhalt der
Aussagen
Traditionell ist die Logik ein Teil der Philosophie.
Seit dem 20. Jahrhundert versteht man unter Logik
berwiegend symbolische Logik, die auch als grundlegende
Strukturwissenschaft, z. B. innerhalb der Mathematik und der
theoretischen Informatik, behandelt wird.
3 / 96
Warum Logik studieren?
4 / 96
Warum Logik studieren?
4 / 96
Welche Logik studieren?
5 / 96
Welche Logik studieren?
Aussagenlogik
Prdikatenlogik der ersten Stufe (FOL)
Logik hherer Stufe (HOL)
eine temporale Logik
eine mehrwertige Logik oder gar Fuzzy Logik
Relevanzlogik, lineare Logik
eine nichtmonotone Logik
5 / 96
Aussagenlogik
6 / 96
Junktoren
7 / 96
Formale Definition einer Formel in Aussagenlogik
8 / 96
Prioritten
Alle Formeln in FA sind komplett geklammert. Wir erlauben
alternative Schreibweisen, mit weniger oder mehr Klammern.
Ist je nach Buch, Vorlesung, Formalismus unterschiedlich. In der B
Sprache (mit der diese Folien erstellt wurden) haben wir:
bindet am strksten : a b entspricht (a) b
danach kommt und ist links assoziativ:
a b c entspricht (a b) c
and haben die gleiche Prioritt und sind links assoziativ:
a b c entspricht (a b) c und
a b c entspricht (a b) c
danach kommt und ist links assoziativ:
a b c entspricht (a b) c
im Zweifel lieber Klammern setzen !
Beispiel: d a b c d entspricht ((d a) b) (c d).
9 / 96
Beispiel: d a b c d entspricht ((d a) b) (c d).
=
true
d
<=>
false
d <=> a
=
false
a
or =
true true
d <=> a or b b
=>
true
& =
true true
c&d c
=
true
d
10 / 96
Hardware Schaltung
11 / 96
Hardware Schaltung als Aussagenlogik Formel
12 / 96
Interpretationen
13 / 96
Interpretation fr Formeln
gegeben eine Interpretation i A {FALSE , TRUE }
man kann damit den Wahrheitswert jeder Formel die
Aussagen in A benutzt berechnen:
man berechnet den Wahrheitswert der Aussagen in mit i
man berechnet den Wahrheitswert von immer grsseren
Unterformeln mit den Wahrheitstabellen der Junktoren
Beispiel: gegeben i = {p 7 TRUE , q 7 FALSE } ist
i(p q) = TRUE , basierend auf der Tabelle fr die
Disjunktion:
p q pq
FALSE FALSE FALSE
FALSE TRUE TRUE
TRUE FALSE TRUE
TRUE TRUE TRUE
14 / 96
Wahrheitstabellen
p q p pq pq pq pq
FALSE FALSE TRUE FALSE FALSE TRUE TRUE
FALSE TRUE TRUE FALSE TRUE TRUE FALSE
TRUE FALSE FALSE FALSE TRUE FALSE FALSE
TRUE TRUE FALSE TRUE TRUE TRUE TRUE
15 / 96
Modelle
p p p p p (p) p p
FALSE TRUE TRUE FALSE TRUE
TRUE FALSE TRUE FALSE FALSE
16 / 96
Beispiel
= p (q r )
p q r phi
FALSE FALSE FALSE FALSE
FALSE FALSE TRUE FALSE
FALSE TRUE FALSE FALSE
FALSE TRUE TRUE TRUE
TRUE FALSE FALSE TRUE
TRUE FALSE TRUE TRUE
TRUE TRUE FALSE TRUE
TRUE TRUE TRUE TRUE
17 / 96
Goldene Regel
p q pq pq p (p q p) q
FALSE FALSE FALSE TRUE FALSE TRUE
FALSE TRUE FALSE TRUE TRUE TRUE
TRUE FALSE FALSE FALSE TRUE TRUE
TRUE TRUE TRUE TRUE TRUE TRUE
18 / 96
Modelle fr Hardware Beispiel
Frage: kann die Ausgabe e wahr werden?
Entspricht der Frage: ist folgende Formel erfllbar:
d (a b) e (c d ) e
Dies sind all Modelle von :
a b c d e
FALSE TRUE TRUE TRUE TRUE
TRUE FALSE TRUE TRUE TRUE
TRUE TRUE TRUE TRUE TRUE
19 / 96
Modell fr Hardware Beispiel
Dies ist ein Modell von d (a b) e (c d ) e als
Formelbaum:
=
true
d
=
false
a
<=> or
true true
d <=> (a or b) a or b
=
true
b
<=> =
&
true true
true
e <=> (c & d) e
=
true
= &
c
true true
e c&d
=
true
d
20 / 96
quivalenz von Formeln
Zwei Formeln sind quivalent gdw sie die selben Modelle haben.
p q pq p (q) (p) q
FALSE FALSE TRUE TRUE TRUE
FALSE TRUE TRUE FALSE TRUE
TRUE FALSE FALSE TRUE FALSE
TRUE TRUE TRUE TRUE TRUE
21 / 96
Wichtige quivalenzen
22 / 96
Kontraposition
p q pq q p
FALSE FALSE TRUE TRUE
FALSE TRUE TRUE TRUE
TRUE FALSE FALSE FALSE
TRUE TRUE TRUE TRUE
23 / 96
Logisches Schlieen von Formeln
Wenn p q gilt, dann ist p eine logische Konsequenz
(Schlussfolgerung) von p q.
Wir schreiben dies als p q |= p
Formal bedeutet dies, dass alle Modelle von q p auch
Modelle von p sind.
Die Tabelle zeigt, dass p q |= p q. Die Formeln sind
nicht quivalent.
p q pq pq
FALSE FALSE TRUE TRUE
FALSE TRUE FALSE TRUE
TRUE FALSE FALSE FALSE
TRUE TRUE TRUE TRUE
24 / 96
Wichtige logische Schlussfolgerungen
25 / 96
Smullyan - Einfaches Puzzle
26 / 96
Smullyan - Einfaches Puzzle
27 / 96
Smullyan - Tiger und Prinzessin Puzzle (3)
28 / 96
Smullyan - Tiger und Prinzessin Puzzle (3) - Lsung
Entweder sagen beide Zettel die Wahrheit oder beide sind
falsch
= Z1 Z2
Tr 1: Es ist ein Tiger hinter dieser Tr oder eine Prinzessin
hinter der anderen Tr
Z 1 = T1 (T2 )
Tr 2: Hinter der anderen Tr befindet sich eine Prinzessin
Z 2 = (T1 )
|= T 1 T 2 (man kann beide Tren aufmachen)
T1 T2 Z1 Z2 Phi
FALSE FALSE TRUE TRUE TRUE
FALSE TRUE FALSE TRUE FALSE
TRUE FALSE TRUE FALSE FALSE
TRUE TRUE TRUE FALSE FALSE
29 / 96
Smullyan - Tiger und Prinzessin Puzzle (6)
30 / 96
Smullyan - Tiger und Prinzessin Puzzle (6) - Lsung
Zettel 1 (2) sagt die Wahrheit gdw eine Prinzessin (Tiger)
hinter der Tr ist
= Z1 (T1 ) Z2 T2
Tr 1: Whle eine der beiden Tren; es macht keinen
Unterschied
Z 1 = T1 T2
Tr 2: Hinter der anderen Tr befindet sich eine Prinzessin
Z 2 = (T1 )
|= T 1 T 2 (Tr 2 aufmachen)
T1 T2 Z1 Z2 Phi
FALSE FALSE TRUE TRUE FALSE
FALSE TRUE FALSE TRUE FALSE
TRUE FALSE FALSE FALSE TRUE
TRUE TRUE TRUE FALSE FALSE
31 / 96
Deduktiver Beweis
1 1
2 2
3 ...
4 k
wo immer gilt 1 ...i |= i+1 .
Wir haben per Transitivitt von |=, dass 1 |= k .
32 / 96
Deduktiver Beweis (Beispiel)
33 / 96
quivalenzbeweis
Hier schreiben wir in der Regeln in folgender Form:
1 1
2 2
3 ...
4 k
wo immer gilt i i+1 .
Wir haben per Transitivitt von , dass 1 k .
Kleines Beispiel, beweise, dass b a a b:
1 b a
2 b a (Regel: )
3 b a (Regel: ))
4 a b (Kommutativitt von )
34 / 96
Beweis durch Widerspruch
35 / 96
Smullyan Arthur York - Inspektor Craig Puzzle
36 / 96
Smullyan Puzzle: Lsung
Aussage YR ist wahr wenn Arthur York ein Ritter ist,
Aussage Schuldig ist wahr wenn der Angeklagte Arthur York
ist,
Aussage AR ist wahr wenn der Angeklagte ein Ritter ist.
Wir wissen auch (1 ) Schuldig YR AR
Angeklagter: Arthur York once claimed that I was a knave
(2 ): AR YR (AR)
Craig: Are you by any chance Arthur York? Angeklagter: Yes
(3 ): AR Schuldig
Die Konjunktion = 1 2 3 dieser Formeln hat nur zwei
Modelle, wir haben |= Schuldig :
YR Schuldig AR
FALSE FALSE FALSE
TRUE FALSE FALSE
37 / 96
Smullyan Puzzle: Lsung
(1 ) Schuldig YR AR
(2 ): AR YR (AR)
(3 ): AR Schuldig
Die Konjunktion hat nur zwei Modelle, wir haben |= Schuldig :
39 / 96
Smullyan Puzzle: Beweis durch Widerspruch im Detail
1 ( ) |=
2 Schuldig YR AR
3 AR YR (AR)
4 AR Schuldig
5 Schuldig (Nehmen wir an der Angeklagte ist Arthur York)
6 Aus 4 und 5 (und Regel 1) folgt: AR (der Angeklagte ist ein Ritter)
7 Aus 6 und 3, folgt durch die Modus Ponens Regel dass:
(YR AR) (Arthur York once claimed that I was a knave)
8 Aus 7 und 6 folgt: YR (Arthur York ist ein Schurke)
9 Aus 2 und 5 folgt: YR AR,
10 Aus 9 und 8 folgt: AR (der Angeklagte ist ein Schurke)
11 Die Aussagen 6 und 10 sind im Widerspruch, der Angeklagte
ist nicht schuldig.
40 / 96
Modell in der formalen Sprache Event-B
41 / 96
Beweisobligation (Proof Obligation auf Englisch)
Dies ist die aus dem Modell generierte Beweisobligation:
1 2 3 |= Schuldig :
Der Beweis auf der nchste Folie ist sehr hnlich zu unserem
Beweis, man sieht, dass AR und AR abgeleitet wurden.
42 / 96
Beweis in der formalen Sprache Event-B
43 / 96
Graph-Frbung
Gegeben zwei Farben (Rot und Grn) sollen die Knoten in
folgendem Graphen g so eingefrbt werden, dass Nachbarn
unterschiedliche Farben haben:
"c"
gg
"b"
gg
"a"
ar br cr ag bg cg
FALSE TRUE FALSE TRUE FALSE TRUE
TRUE FALSE TRUE FALSE TRUE FALSE
45 / 96
Modell fr Graph-Frbung
Dies ist ein Modell von (ar (br )) (ag (bg )) (br
(cr )) (bg (cg )) ar (ag ) br (bg ) cr (cg )
als Formelbaum:
=
= false
true br
cr
not
not true
false not(br)
=
not(cr)
false
br
=
true
ar
=>
true =>
br => not(cr) true
ar => not(br)
=
true
bg
=
= not true
false not false
=> bg
cg true not(bg)
true
not(cg) bg => not(cg) =>
true
& ag => not(bg)
true
=
false
ag
<=>
true =
ar <=> not(ag) true <=>
cr true
<=> br <=> not(bg)
true =
cr <=> not(cg) false
not
br
true
not(ag)
=
true
ar
=
false not
ag false
not not(bg)
true
not(cg)
=
true
bg
=
false
cg
46 / 96
Auf zur Prdikatenlogik und Mengentheorie
47 / 96
Frbung mit Prdikatenlogik - 60 Knoten, 400 Kanten
Man kann auch versuchen die minimale Anzahl an Farben zu finden:
34
custom
12
custom 52
custom 27
custom custom
custom
custom custom
custom custom
custom custom
22 custom
custom custom custom custom
custom custom
custom custom 31
custom
custom custom custom
custom custom custom
custom custom
57 custom 20 custom custom
custom
custom 39 custom
custom custom
custom 21 custom
custom custom custom
custom 25
custom custom custom custom
custom 30custom custom
custom custom
8 custom custom
customcustom custom custom40 custom
custom
custom custom
custom custom custom
custom custom
custom custom custom custom 56 custom
29 custom custom custom 18
custom
custom custom
custom custom
custom custom custom
custom 58 custom
custom
custom
custom
custom custom
custom custom 26 custom custom customcustom custom custom
custom custom custom custom
custom custom custom custom
custom custom custom
custom
customcustom custom custom custom custom
custom custom
custom
custom
custom custom
customcustom customcustom
custom custom custom
custom custom custom 38
custom custom custom 50
custom custom custom
3 custom 43 custom custom 44 custom 1
custom custom
custom custom
custom custom customcustom
custom
custom customcustom
custom custom custom
custom custom custom custom
custom custom
custom custom custom custom custom custom
custom custom custom custom custom custom
17 customcustom
custom custom custom
51 custom
custom custom custom custom custom custom
custom
custom custom 42
custom custom custom custom
7 11 custom custom custom custom custom custom custom
36 custom
custom custom customcustom
custom custom
custom custom custom custom
custom custom custom
custom custom
custom
custom custom custom
custom custom custom custom custom
custom custom custom16 4 custom custom
custom 28 custom custom
customcustom custom custom custom
custom custom 48
custom custom custom custom custom custom
custom custom custom
custom
19 custom
custom custom custom customcustomcustom
custom custom
custom custom custom custom custom custom custom
custom custom
custom
custom
custom custom
24 custom custom custom 37
custom custom custom custom
custom custom custom
custom custom custom
customcustom custom custom
custom custom
custom custom custom 2 53 custom
custom custom
custom custom custom 49 custom custom customcustom
60 custom
custom
custom 41
custom
6 custom custom
custom custom custom
custom custom customcustom
custom custom
custom 35
custom custom custom
custom custom custom custom custom
custom customcustom custom
47
custom custom custom
custom
custom custom 23
custom customcustom custom custom
custom
custom custom custom custom
15 custom
10 custom custom 33
custom customcustomcustom
custom custom
custom 55
custom custom custom custom custom
custom 59 custom custom
custom
custom custom
custom custom
46 custom
custom 45
custom custom custom
custom custom custom
custom custom
custom
custom
32 13 54
custom custom
custom custom
14 custom
custom
custom custom
custom
custom custom
custom
5
48 / 96
Frbung mit Prdikatenlogik - Lsung mit ProB
Man kann auch versuchen die minimale Anzahl an Farben zu finden:
34
custom
12
custom 52
custom 27
custom custom
custom
custom custom
custom custom
custom custom
22 custom
custom custom custom custom
custom custom
custom custom 31
custom
custom custom custom
custom custom custom
custom custom
57 custom 20 custom custom
custom
custom 39 custom
custom custom
custom 21 custom
custom custom custom
custom 25
custom custom custom custom
custom 30custom custom
custom custom
8 custom custom
customcustom custom custom40 custom
custom
custom custom
custom custom custom
custom custom
custom custom custom custom 56 custom
29 custom custom custom 18
custom
custom custom
custom custom
custom custom custom
custom 58 custom
custom
custom
custom
custom custom
custom custom 26 custom custom customcustom custom custom
custom custom custom custom
custom custom custom custom
custom custom custom
custom
customcustom custom custom custom custom
custom custom
custom
custom
custom custom
customcustom customcustom
custom custom custom
custom custom custom 38
custom custom custom 50
custom custom custom
3 custom 43 custom custom 44 custom 1
custom custom
custom custom
custom custom customcustom
custom
custom customcustom
custom custom custom
custom custom custom custom
custom custom
custom custom custom custom custom custom
custom custom custom custom custom custom
17 customcustom
custom custom custom
51 custom
custom custom custom custom custom custom
custom
custom custom 42
custom custom custom custom
7 11 custom custom custom custom custom custom custom
36 custom
custom custom customcustom
custom custom
custom custom custom custom
custom custom custom
custom custom
custom
custom custom custom
custom custom custom custom custom
custom custom custom16 4 custom custom
custom 28 custom custom
customcustom custom custom custom
custom custom 48
custom custom custom custom custom custom
custom custom custom
custom
19 custom
custom custom custom customcustomcustom
custom custom
custom custom custom custom custom custom custom
custom custom
custom
custom
custom custom
24 custom custom custom 37
custom custom custom custom
custom custom custom
custom custom custom
customcustom custom custom
custom custom
custom custom custom 2 53 custom
custom custom
custom custom custom 49 custom custom customcustom
60 custom
custom
custom 41
custom
6 custom custom
custom custom custom
custom custom customcustom
custom custom
custom 35
custom custom custom
custom custom custom custom custom
custom customcustom custom
47
custom custom custom
custom
custom custom 23
custom customcustom custom custom
custom
custom custom custom custom
15 custom
10 custom custom 33
custom customcustomcustom
custom custom
custom 55
custom custom custom custom custom
custom 59 custom custom
custom
custom custom
custom custom
46 custom
custom 45
custom custom custom
custom custom custom
custom custom
custom
custom
32 13 54
custom custom
custom custom
14 custom
custom
custom custom
custom
custom custom
custom
5
49 / 96
Aristoteles: Anfnge der Logik
50 / 96
Aristoteles: Anfnge der Logik
50 / 96
Prdikatenlogik
51 / 96
Prdikate
52 / 96
Prdikate
LT 5(x) x < 5 ist ein unres Prdikat, fr jeden mglichen
Wert von x knnen wir bestimmen ob das Prdikat wahr oder
falsch ist, grafisch :
7 6 5 4 3 2 1
FALSE TRUE
54 / 96
Quantoren
Es gibt zwei Quantoren:
den Existenzquantor
x.P, bedeutet, dass es ein Objekt o gibt, so dass wenn man x
durch o in P ersetzt die Formel wahr ist
den Allquantor
x.P bedeutet dass die Formel P fr alle mglichen
Ersetzungen von x durch ein Objekt o wahr ist
x.x < 5 ist eine geschlossene Formel (aka eine Aussage). Mit
der Standardinterpretation von < und 5 ist diese Formel wahr;
eine Lsung ist x = 4.
x.x < 5 ist auch eine geschlossene Formel. Mit der
Standardinterpretation von < und 5 ist diese Formel falsch.
Ein Gegenbeispiel ist x = 5.
55 / 96
Logische quivalenz, Schlussfolgerung
Zwei Formeln und sind quivalent gdw sie die selben Modelle
haben. Wir schreiben dies als .
Eine Formel ist eine logische Schlussfolgerung von , wenn alle
Modelle von auch Modelle von sind. Wir schreiben dies als
|= .
Dies ist die gleiche Definition wie bei Aussagenlogik, nur das
Konzept der Modelle ist komplizierter:
eine Menge an Objekten muss ausgewhlt werden
die Konstanten und Funktionen mssen den Objekten
zugeordnet werden
die Prdikate mssen Objekte auf Wahrheitswerte abbilden;
Aussagen sind ein Spezialfall von Prdikaten.
(manchmal sind bestimmte Symbole vordefiniert, wie <, +
oder 5)
56 / 96
Quantoren: Gesetze
57 / 96
Quantoren: Gesetze
1 x.P x.P
x.(x > 0 x < 0) x.(x > 0 x < 0)
x.(x 0 x 0)
2 x.P x.P
3 x.(y .P) y .(x.P)
x.(y .(x y x > y )) y .(x.(x y x > y ))
4 x.(y .P) 6 y .(x.P)
x.(y .(y > x)) 6 y .(x.(y > x)
5 x.(y .P) y .(x.P)
58 / 96
Funktionen, Terme und Formeln
59 / 96
Syntax der Prdikatenlogik
60 / 96
Werkzeuge fr Logik
SAT Solver: Erfllbarkeit von Aussagenlogik prfen (miniSAT,
glucose, lingeling, Sat4j,...)
SMT Solver: Erfllbarkeit von Prdikatenlogik mit Theorien
(Bit-Vektoren,...): Z3 von Microsoft
Beweiser: Atelier-B, Rodin, Isabelle, Coq, Vampire,...
Model-Finder, Constraint Solver: ProB, Alloy, IDP, ...
Programmiersprache: Prolog
Hardware Verifikation
schwere Probleme lsen (Eclipse/Linux Abhngigkeiten,...)
Software Verifikation, Fehler finden (NullPointer Exception,
Overflows), Windows Driver Verification (SLAM2,...)
Stellwerkprfung (Prover Technologies, ...)
Datenvalidierung (ProB bei Siemens, Alstom, Thales; Paris L1)
Software Entwicklung (AtelierB, Paris L14, L1, ....: seit 1999
kein einziger Bug !)
61 / 96
Andere Logiken
62 / 96
Zusammenfassung Logik
63 / 96
Mengen
64 / 96
Vereinigung, Schnitt, Differenz
65 / 96
Notationen fr Mengen: endliche Enumeration
66 / 96
Notationen fr Mengen: per Prdikat
67 / 96
Ein Theorem
Fr alle Mengen x, y , z gilt:
x (y z) = (x y ) (x z)
Beispiel:
{2, 3, 5} ({2, 4, 7} {2, 4, 6}) = {2, 3, 4, 5}
({2, 3, 5} {2, 4, 7}) ({2, 3, 5} {2, 4, 6}) = {2, 3, 4, 5}
y z
68 / 96
Beweis von x (y z) = (x y ) (x z)
Lemmata:
1 x y = {a | a x a y }
2 x y = {a | a x a y }
3 a {b | P(b)} P(a)
4 ( ) ( ) ( )
quivalenzbeweis
1 x (y z)
2 (Lemma 1) {a | a x a (y z)}
3 (Lemma 2) {a | a x a {b | b y b z}}
4 (Lemma 3) {a | a x (a y a z)}
5 (Lemma 4) {a | (a x a y ) (a x a z)}
6 (Lemma 3, )
{a | a {b | b x b y } a {b | b x b z}}
7 (Lemma 1, ) {a | a x y a x z)}
8 (Lemma 2, ) (x y ) (x z)
69 / 96
Gesetze
Fr alle Mengen x, y , z gilt:
x y = y x (Kommutativ 1)
x y = y x (Kommutativ 2)
x (y z) = (x y ) z (Assoziativ 1)
x (y z) = (x y ) z (Assoziativ 2)
x (y z) = (x y ) (x z) (Distributiv 1)
x (y z) = (x y ) (x z) (Distributiv 2)
z \ (x y ) = (z \ x) (z \ y ) (De Morgan 1)
z \ (x y ) = (z \ x) (z \ y ) (De Morgan 2)
x = x (Leere Menge 1)
x = (Leere Menge 2)
x (z \ x) = (Leere Menge 3)
70 / 96
Kardinalitt
71 / 96
SEND+MORE=MONEY
S E N D
+ M O R E
= M O N E Y
72 / 96
SEND+MORE=MONEY - Formal
73 / 96
SEND+MORE=MONEY - Lsung
9 5 6 7
+ 1 0 8 5
= 1 0 6 5 2
74 / 96
Mengen von Mengen
75 / 96
Mengen von Mengen: leere Menge
6= {}
card () = 0
card ({}) = 1
{}
6
{} =
6
76 / 96
Potenzmenge
Die Menge aller Untermengen einer Menge A schreiben wir als
P(A) oder auch als 2A .
10 8 6
h h h
5 4 3
2 7 5 4 2 1 6 3
h d d d d d d d
1 FALSE TRUE
78 / 96
Unre Relationen
79 / 96
Kartesisches Produkt und Paare
Das kartesische Produkt x y zweier Mengen x und y ist
definiert als {(a, b) | a x b y }.
(a, b) steht hier fr ein geordnetes Paar, d.h.
(1 7 2) 6= (2 7 1). Wir schreiben manchmal auch a 7 b
anstatt (a, b).
(1..2) (4..5) = {(1 7 4), (1 7 5), (2 7 4), (2 7 5)}
(1..2) {4} = {(1 7 4), (2 7 4)}
(1..2) =
(1..2) BOOL = {(1 7 FALSE ), (1 7 TRUE ), (2 7
FALSE ), (2 7 TRUE )}
(1..3) (1..3) = {(1 7 1), (1 7 2), (1 7 3), (2 7 1), (2 7
2), (2 7 3), (3 7 1), (3 7 2), (3 7 3)}
card ((1..10) (1..10)) = 100
{1} {2} = 6 {2} {1} (Nichtkommutativitt)
A B = (A = B = ).
80 / 96
Binre Relationen
Eine binre Relation ber x und y ist eine Untermenge des
kartesischen Produkts x y zweier Mengen. Die Mengen x
und y knnen identisch sein.
10 8 6
h h h
5 4 3
2 7 5 4 2 1 6 3
h d d d d d d d
1 FALSE TRUE
82 / 96
Definitions- und Wertebereich
let h = {x, y |x 1..10 y = x/2 x mod 2 = 0} {(2 7
1), (4 7 2), (6 7 3), (8 7 4), (10 7 5)}
let div = {x, y |x 1..7 y = bool (x mod 3 = 0)}
Definitionsbereich (Domain): dom(r ) = {a | b.((a, b) r )}
dom(h) = {2, 4, 6, 8, 10}
dom(div ) = {1, 2, 3, 4, 5, 6, 7}
Wertebereich (Range): ran(r ) = {b | a.((a, b) r )}
ran(h) = {1, 2, 3, 4, 5}.
10 8 6
h h h
5 4 3
2 7 5 4 2 1 6 3
h d d d d d d d
83 / 96 1 FALSE TRUE
Relationales Abbild und Umkehrrelation
Abbild: r [A] = {b | a.((a, b) r a A)}
h[{8, 9, 10}] = {4, 5}
div [{3, 6}] = {TRUE }.
Umkehrrelation: r 1 = {(b, a) | (a, b) r }
h1 = {(1 7 2), (2 7 4), (3 7 6), (4 7 8), (5 7 10)}
(div 1 )[{TRUE }] = {3, 6}.
10 8 6
h h h
5 4 3
2 7 5 4 2 1 6 3
h d d d d d d d
1 FALSE TRUE
84 / 96
Binre Relationen - Verknpfung
wir knnen Relationen r1 und r2 mit dem Operator ;
verknpfen: (r1 ; r2 ) = {(a, c) | b.((a, b) r1 (b, c) r2 )}.
({(1 7 2), (2 7 3)}; {(2 7 4), (2 7 8)}) = {(1 7 4), (1 7
8)}.
Man kann eine Relation auch mit sich selber verknpfen wenn
Werte- und Definitionsbereich kompatibel sind. Beispiel h=
{(2 7 1), (4 7 2), (6 7 3), (8 7 4), (10 7 5)} und h2 = (h; h):
10 8 6
h h h
5 4 3
h 8 4
2
h2 h2
h
2 1
1
85 / 96
Transitive Hlle
r1 = r
r k = (r k1 ; r ) = (r ; r k1 )
r+ = i
S
i>0 r
Beispiel h= {(2 7 1), (4 7 2), (6 7 3), (8 7 4), (10 7 5)} und
h2 = (h; h), h3 = (h2 ; h):
10 8 6
10 8 6
5 4 hth 3
5 4 3
hth hth
h
8 4 hth 2
2 8
h2 h2 hth
h h3
1 2 1 1 1
86 / 96
Transitive Hlle: Beispiel
Abgenderte strikte Untermengenrelation fr P(1..3):
{x, y |y P(1..3) x y card (x) = card (y ) 1} = {( 7
{1}), ( 7 {2}), ( 7 {3}), ({1} 7 {1, 2}), ({1} 7
{1, 3}), ({1, 2} 7 {1, 2, 3}), ({1, 3} 7 {1, 2, 3}), ({2} 7
{1, 2}), ({2} 7 {2, 3}), ({2, 3} 7 {1, 2, 3}), ({3} 7
{1, 3}), ({3} 7 {2, 3})}.
{}
{}
sub1 sub1 sub1
sub sub sub
{3} {1} {2}
{2} sub {3} sub {1} sub
{1,2,3} {1,2,3}
87 / 96
Transitive und Reflexive Hlle
Gegeben eine Relation r von A nach A
r 0 = {(a, a) | a A}
r k = (r k1 ; r ) = (r ; r k1 )
r = i0 r i
S
1 1 rs
r rs
2 rs 2 rs
r rs
3 3 rs
88 / 96
Funktionen
{}
{1,2,3}
89 / 96
Funktionen
Eine Funktion F von A nach B ist
eine Relation von A nach B (also eine Untermenge von
A B), so dass
a.(a A b.((a, b) F ))
(a, b, c).(((a, b) F (a, c) F ) b = c)
Beispiel: let F = {x, y |x P(1..2) y = card (x)} {( 7
0), ({1} 7 1), ({1, 2} 7 2), ({2} 7 1)}
wir schreiben F P(1..2) N
bei Funktionen kann man anstatt (a, b) F auch F (a) = b
schreiben, F ({1, 2}) = 2
F F F F
1 2 0
90 / 96
Folgen
91 / 96
Folgen vs Mengen
92 / 96
Folgen mathematisch gesehen
Eine Folgen G von A Elementen der Lnge n ist
eine Funktion von 1..n nach A
let G = [22, 22, 33] {(1 7 22), (2 7 22), (3 7 33)}
wir schreiben G seq(N) oder aber auch G A (mehr dazu
spter)
das n-te Element einer Folge G ist einfach G (n), zum Beispiel
G (2) = 22
die Lnge einer Folge ist einfach die Kardinalitt der
unterliegenden Relation
3 2 1
G G G
33 22
93 / 96
Zusammenfassung Mengentheorie
94 / 96
Lernziele
95 / 96
Nach dem Sinn das Wort, und dann vom Wort zum Sinn
96 / 96