"Machine constants set up using operation 0: $setup_constants()"
]
},
"execution_count": 2,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -85,7 +85,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [
{
...
...
@@ -103,7 +103,7 @@
"\tRHS = []"
]
},
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -121,7 +121,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"outputs": [
{
...
...
@@ -133,7 +133,7 @@
"{[],[a,S,b]}"
]
},
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -159,7 +159,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"metadata": {},
"outputs": [
{
...
...
@@ -168,7 +168,7 @@
"Loaded machine: Grammatik"
]
},
"execution_count": 5,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -199,7 +199,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"outputs": [
{
...
...
@@ -208,7 +208,7 @@
"Machine constants set up using operation 0: $setup_constants()"
]
},
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -221,12 +221,35 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Da diese Relation unendlich ist wird diese im Notebook symbolisch gehalten. Wir können aber prüfen ob Paare an Folgen in der Relation sind:"
"Da diese Relation ```abl``` unendlich ist wird diese im Notebook symbolisch gehalten. Wir können aber prüfen ob Paare an Folgen in der Relation sind:"
"* $G$ ist eine __Typ-1-Grammatik__ (bzw. __kontextsensitiv__ bzw. _nichtverkürzend_ oder __monoton__), falls für alle Regeln $p \\rightarrow q$ in\n",
" $P$ gilt: $|p| \\leq |q|$.\n",
" \n",
"* Eine Typ-1-Grammatik $G$ ist __vom Typ 2__ (bzw. ___kontextfrei__), falls für alle Regeln $p \\rightarrow q$ in $P$ gilt: $p \\in N$.\n",
"* Eine Typ-1-Grammatik $G$ ist __vom Typ 2__ (bzw. __kontextfrei__), falls für alle Regeln $p \\rightarrow q$ in $P$ gilt: $p \\in N$.\n",
" \n",
"* Eine Typ-2-Grammatik $G$ ist __vom Typ 3__ (bzw. __regulär__ bzw. __rechtslinear__), falls f\"ur\n",
"* Eine Typ-2-Grammatik $G$ ist __vom Typ 3__ (bzw. __regulär__ bzw. __rechtslinear__), falls für\n",
" alle Regeln $p \\rightarrow q$ in $P$ gilt: $p \\in N$ und $q \\in \\Sigma \\cup \\Sigma N$.\n",
"\n",
"Eine Sprache $A \\subseteq \\Sigma^*$ ist genau dann vom Typ $i \\in\n",
Anmerkung: im Skript wird nicht zwischen einem Nicht-Terminal Symbol und einer Folge der Länge 1 bestehend aus einem Nicht-Terminal unterschieden.
Deshalb steht im Skript $p\in N$. Im Notebook sind $p$ und die Folge bestehend aus einem $p$ (geschrieben als [p]) von einem unterschiedlichen Typ. Die wortwörtliche Übersetzung von $p\in N$ führt zu einem Typfehler.
%% Cell type:code id: tags:
``` prob
∀(p,q).( p↦q ∈ P ⇒ p ∈ N)
```
%% Output
:eval: Computation not completed: Type mismatch: Expected POW(seq(ΣN)), but was POW(ΣN) in 'N'
%% Cell type:markdown id: tags:
Die Grammatik $G_2$ ist also vom Typ 1 aber nicht vom Typ 2 oder 3.
Wir werden aber in der nächsten Woche eine Sonderregelung für das leere Wort erlauben, damit auch Grammatiken vom Typ 1,2 oder 3 das leere Wort in ihrer Sprache generieren können.
%% Cell type:markdown id: tags:
### Chomsky-Hierarchie
Die __Chomsky-Hierarchie__ besteht aus den vier Sprachklassen:
* $\mathfrak{L}_i = \{L(G) \Longleftrightarrow \mbox{$G$ ist Typ-$i$-Grammatik} \}$,
wobei $i \in \{0,1,2,3\}$.
Übliche Bezeichnungen:
* $\mathfrak{L}_0$ ist die Klasse aller Sprachen, die durch eine
Grammatik erzeugt werden können;
* $\mathfrak{L}_1 = CS$ ist die __Klasse der kontextsensitiven Sprachen__;
* $\mathfrak{L}_2 = CF$ ist die __Klasse der kontextfreien Sprachen__;
* $\mathfrak{L}_3 = REG$ ist die __Klasse der regulären Sprachen__.