Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
col_stack = []
def format(text: str, fmt: str) -> str:
last_col = "\u001b[0m" if len(col_stack) == 0 else col_stack[:-1]
col_stack.append(f"\u001b[{fmt}m")
value = f"\u001b[{fmt}m{text}{last_col}"
col_stack.pop()
return value
def head(text: str) -> str:
return format(text, "31;1;4")
def f(text: str) -> str:
return format(text, "32;1")
def infix_notation(query):
return f"""
{head("Präfix-Notation")}
Operatoren werden zwischen die Operanden gesetzt
(A + B)
(A v B)
"""
def praefix_notation(query):
return f"""
{head("Präfix-Notation")}
Operatoren werden vor die Operanden gesetzt
+ A B
v A B
"""
def aussage(query):
return f"""
{head("Aussagenlogik")}
- Prinzip der Zweiwertigkeit: Jede Aussage ist wahr oder falsch
- Prinzip vom ausgeschlossenen Widerspruch: Es gibt keine Aussage, die sowohl wahr als auch falsch ist.
→ Jede Aussage ist entweder wahr oder falsch.
"""
def signatur(q):
return f"""
{head("Signatur (Aussagenlogik)")}
abzählbare Menge von Aussagensymbolen
AS = {{ P0, ..., Pn }}
"""
def negation(q):
return f"""
{head("Negation (Junktor)")}
Beispiel: ¬A
Gesprochen: „nicht A“
A | ¬A
--------
W | F
F | W
"""
def implikation(q):
return f"""
{head("Implikation (Junktor)")}
Beispiel: A → B
Gesprochen: „wenn A dann B“
Äquivalent zu (¬A ∨ B)
A | B | A → B
--------------
W | W | W
W | F | F
F | W | W
F | F | W
"""
def disjunktion(q):
return f"""
{head("Disjunktion (Junktor)")}
Beispiel: A ∨ B
Gesprochen: „A oder B“
A | B | A ∧ B
--------------
W | W | W
W | F | W
F | W | W
F | F | F
"""
def konjunktion(q):
return f"""
{head("Konjunktion (Junktor)")}
Beispiel: A ∧ B
Gesprochen: „A und B“
A | B | A ∧ B
--------------
W | W | W
W | F | F
F | W | F
F | F | F
"""
def formel(q):
return f"""
{head("Formel (Aussagenlogik)")}
Formeln werden durch Kombination von Aussagensymbolen und Junktoren gebildet.
Die Menge aller aussagenlogischen Formeln über AS ist induktiv wie folgt definiert:
* 1. für jedes P ∈ AS ist P eine Formel
* wenn 𝜑 und ψ Formeln sind, dann sind auch
2. ¬𝜑
3. (𝜑 ∧ ψ)
4. (𝜑 ∨ ψ)
5. (𝜑 → ψ)
6. (𝜑 ↔ ψ)
Formeln.
Wir verwenden griechische Buchstaben (𝜑, ψ, ...) zur
Benennung von Formeln.
"""
def aussagensymbol(q):
return f"""
{head("Aussagensymbol (Aussagenlogik)")}
Atomare Formeln, die einen Wahrheitswert darstellen
AS = {f("{ A, B }")}
𝜑 = A ∧ B
.-----^-----^
'- Aussagensymbol
"""
keywords = [
(["infix", "Infixnotation", "Algebraische Notation"], infix_notation),
(["prefix", "präfix", "präfixnotation"], praefix_notation),
(["aussage"], aussage),
(["signatur"], signatur),
(["negation"], negation),
(["implikation"], implikation),
(["konjunktion"], konjunktion),
(["disjunktion"], disjunktion),
(["aussagensymbol"], aussagensymbol)
]