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
67195be0
Commit
67195be0
authored
Apr 30, 2020
by
Michael Leuschel
Browse files
Options
Downloads
Patches
Plain Diff
add Grammar G2
parent
31390aa9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
info4/kapitel-1/Grammatiken.ipynb
+482
-68
482 additions, 68 deletions
info4/kapitel-1/Grammatiken.ipynb
with
482 additions
and
68 deletions
info4/kapitel-1/Grammatiken.ipynb
+
482
−
68
View file @
67195be0
...
@@ -161,25 +161,62 @@
...
@@ -161,25 +161,62 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
44
,
"execution_count":
75
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/markdown": [
"text/plain": [
"$\\newcommand{\\qdot}{\\mathord{\\mkern1mu\\cdot\\mkern1mu}}/*@symbolic*/ \\{\\mathit{u},\\mathit{v}\\mid\\exists(\\mathit{x},\\mathit{z},\\mathit{p},\\mathit{q})\\qdot(\\mathit{p} \\mapsto \\mathit{q} \\in \\{([S]\\mapsto []),([S]\\mapsto [a,\\mathit{S},b])\\} \\land \\mathit{u} = \\mathit{x} ⌒ \\mathit{p} ⌒ \\mathit{z} \\land \\mathit{v} = \\mathit{x} ⌒ \\mathit{q} ⌒ \\mathit{z})\\}$"
"Loaded machine: Grammatik"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
],
"source": [
"::load\n",
"MACHINE Grammatik\n",
"SETS ΣN = {a,b,c, S}\n",
"CONSTANTS Σ, N, P\n",
"ABSTRACT_CONSTANTS abl\n",
"PROPERTIES\n",
" Σ = {a,b,c} ∧\n",
" Σ ∩ N = {} ∧\n",
" Σ ∪ N = ΣN ∧\n",
" S ∈ N ∧\n",
" P ⊆ seq1(ΣN) × seq(ΣN) ∧\n",
" \n",
" // Die Beispiel Grammatik G1 von den Folien\n",
" P = { [S] ↦ [],\n",
" [S] ↦ [a,S,b]\n",
" }\n",
" \n",
" ∧ \n",
" abl = {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}\n",
"DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE\n",
"END"
]
},
{
"cell_type": "code",
"execution_count": 76,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"text/plain": [
"
/*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ⌒ p ⌒ z ∧ v = x ⌒ q ⌒ z)}
"
"
Machine constants set up using operation 0: $setup_constants()
"
]
]
},
},
"execution_count":
44
,
"execution_count":
76
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
":
let abl {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}
"
":
constants
"
]
]
},
},
{
{
...
@@ -604,67 +641,7 @@
...
@@ -604,67 +641,7 @@
}
}
],
],
"source": [
"source": [
"UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ]) /\\ seq(Σ)"
"UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ]) ∩ seq(Σ)"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Loaded machine: Grammatik"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"::load\n",
"MACHINE Grammatik\n",
"SETS ΣN = {a,b,c, S}\n",
"CONSTANTS Σ, N, P\n",
"ABSTRACT_CONSTANTS abl\n",
"PROPERTIES\n",
" Σ = {a,b,c} ∧\n",
" Σ ∩ N = {} ∧\n",
" Σ ∪ N = ΣN ∧\n",
" S ∈ N ∧\n",
" P ⊆ seq1(ΣN) × seq(ΣN) ∧\n",
" \n",
" // Die Beispiel Grammatik G1 von den Folien\n",
" P = { [S] ↦ [],\n",
" [S] ↦ [a,S,b]\n",
" }\n",
" \n",
" ∧ \n",
" abl = {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}\n",
"DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE\n",
"END"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Machine constants set up using operation 0: $setup_constants()"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":constants"
]
]
},
},
{
{
...
@@ -845,6 +822,443 @@
...
@@ -845,6 +822,443 @@
":dot expr_as_graph (\"abl\",SF <| abl |> SF)"
":dot expr_as_graph (\"abl\",SF <| abl |> SF)"
]
]
},
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Die Grammatik G2 können wir wie folgt umsetzen:"
]
},
{
"cell_type": "code",
"execution_count": 79,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Loaded machine: Grammatik2"
]
},
"execution_count": 79,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"::load\n",
"MACHINE Grammatik2\n",
"SETS ΣN = {a,b,c, S, B,C}\n",
"CONSTANTS Σ, N, P\n",
"ABSTRACT_CONSTANTS abl\n",
"PROPERTIES\n",
" Σ = {a,b,c} ∧\n",
" Σ ∩ N = {} ∧\n",
" Σ ∪ N = ΣN ∧\n",
" S ∈ N ∧\n",
" P ⊆ seq1(ΣN) × seq(ΣN) ∧\n",
" \n",
" // Die Beispiel Grammatik G1 von den Folien\n",
" P = { [S] ↦ [a,B,C],\n",
" [S] ↦ [a,S,B,C],\n",
" [C,B] ↦ [B,C],\n",
" [a,B] ↦ [a,b],\n",
" [b,B] ↦ [b,b],\n",
" [b,C] ↦ [b,c],\n",
" [c,C] ↦ [c,c]\n",
" }\n",
" \n",
" ∧ \n",
" abl = {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}\n",
"DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE\n",
"END"
]
},
{
"cell_type": "code",
"execution_count": 80,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Machine constants set up using operation 0: $setup_constants()"
]
},
"execution_count": 80,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":constants"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{[S],[a,\\mathit{b},c],[a,\\mathit{b},C],[a,\\mathit{S},\\mathit{B},C],[a,\\mathit{B},C],[a,\\mathit{a},\\mathit{b},\\mathit{c},\\mathit{B},C],[a,\\mathit{a},\\mathit{b},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{b},\\mathit{B},\\mathit{C},C],[a,\\mathit{a},\\mathit{B},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{B},\\mathit{B},\\mathit{C},C],[a,\\mathit{a},\\mathit{S},\\mathit{B},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{S},\\mathit{B},\\mathit{B},\\mathit{C},C],[a,\\mathit{a},\\mathit{a},\\mathit{S},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{B},\\mathit{C},C],[a,\\mathit{a},\\mathit{a},\\mathit{S},\\mathit{B},\\mathit{B},\\mathit{C},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{a},\\mathit{S},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{a},\\mathit{B},\\mathit{B},\\mathit{C},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{a},\\mathit{b},\\mathit{C},\\mathit{B},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{a},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{B},\\mathit{C},C],[a,\\mathit{a},\\mathit{a},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{a},\\mathit{a},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{C},\\mathit{B},C],[a,\\mathit{a},\\mathit{a},\\mathit{a},\\mathit{S},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{C},\\mathit{B},\\mathit{C},\\mathit{B},C]\\}$"
],
"text/plain": [
"{[S],[a,b,c],[a,b,C],[a,S,B,C],[a,B,C],[a,a,b,c,B,C],[a,a,b,C,B,C],[a,a,b,B,C,C],[a,a,B,C,B,C],[a,a,B,B,C,C],[a,a,S,B,C,B,C],[a,a,S,B,B,C,C],[a,a,a,S,B,C,B,B,C,C],[a,a,a,S,B,B,C,C,B,C],[a,a,a,S,B,C,B,C,B,C],[a,a,a,B,B,C,C,B,C],[a,a,a,b,C,B,C,B,C],[a,a,a,B,C,B,B,C,C],[a,a,a,B,C,B,C,B,C],[a,a,a,a,B,C,B,C,B,C,B,C],[a,a,a,a,S,B,C,B,C,B,C,B,C]}"
]
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":let SF UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ])"
]
},
{
"cell_type": "code",
"execution_count": 84,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{[a,\\mathit{b},c]\\}$"
],
"text/plain": [
"{[a,b,c]}"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"SF ∩ seq(Σ)"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Preference changed: DOT_DECOMPOSE_NODES = FALSE\n"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":pref DOT_DECOMPOSE_NODES=FALSE"
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.28.0 (20110509.1545)\n",
" -->\n",
"<!-- Title: state Pages: 1 -->\n",
"<svg width=\"1329pt\" height=\"404pt\"\n",
" viewBox=\"0.00 0.00 1329.00 404.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph1\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 400)\">\n",
"<title>state</title>\n",
"<polygon fill=\"white\" stroke=\"white\" points=\"-4,5 -4,-400 1326,-400 1326,5 -4,5\"/>\n",
"<!-- [a,a,a,B,C,B,C,B,C] -->\n",
"<g id=\"node1\" class=\"node\"><title>[a,a,a,B,C,B,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"1031.49,-126 904.511,-126 904.511,-90 1031.49,-90 1031.49,-126\"/>\n",
"<text text-anchor=\"middle\" x=\"968\" y=\"-103.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,B,C,B,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,B,C,B,B,C,C] -->\n",
"<g id=\"node3\" class=\"node\"><title>[a,a,a,B,C,B,B,C,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"1031.49,-36 904.511,-36 904.511,-0 1031.49,-0 1031.49,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"968\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,B,C,B,B,C,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,B,C,B,C,B,C]->[a,a,a,B,C,B,B,C,C] -->\n",
"<g id=\"edge2\" class=\"edge\"><title>[a,a,a,B,C,B,C,B,C]->[a,a,a,B,C,B,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M968,-89.614C968,-77.2403 968,-60.3686 968,-46.2198\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"971.5,-46.0504 968,-36.0504 964.5,-46.0504 971.5,-46.0504\"/>\n",
"<text text-anchor=\"middle\" x=\"976.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,a,b,C,B,C,B,C] -->\n",
"<g id=\"node5\" class=\"node\"><title>[a,a,a,b,C,B,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"1175.24,-36 1050.76,-36 1050.76,-0 1175.24,-0 1175.24,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"1113\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,b,C,B,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,B,C,B,C,B,C]->[a,a,a,b,C,B,C,B,C] -->\n",
"<g id=\"edge4\" class=\"edge\"><title>[a,a,a,B,C,B,C,B,C]->[a,a,a,b,C,B,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M996.302,-89.8238C1019.06,-76.0139 1051.2,-56.5033 1076,-41.4559\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"1078.04,-44.3132 1084.77,-36.1329 1074.4,-38.3291 1078.04,-44.3132\"/>\n",
"<text text-anchor=\"middle\" x=\"1062.55\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,a,B,B,C,C,B,C] -->\n",
"<g id=\"node7\" class=\"node\"><title>[a,a,a,B,B,C,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"1321.49,-36 1194.51,-36 1194.51,-0 1321.49,-0 1321.49,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"1258\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,B,B,C,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,B,C,B,C,B,C]->[a,a,a,B,B,C,C,B,C] -->\n",
"<g id=\"edge6\" class=\"edge\"><title>[a,a,a,B,C,B,C,B,C]->[a,a,a,B,B,C,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M1024.26,-89.9284C1072.28,-75.3554 1141.41,-54.379 1192.03,-39.0179\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"1193.34,-42.2771 1201.9,-36.0241 1191.31,-35.5787 1193.34,-42.2771\"/>\n",
"<text text-anchor=\"middle\" x=\"1147.55\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,a,S,B,C,B,C,B,C] -->\n",
"<g id=\"node8\" class=\"node\"><title>[a,a,a,S,B,C,B,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"716.45,-126 577.55,-126 577.55,-90 716.45,-90 716.45,-126\"/>\n",
"<text text-anchor=\"middle\" x=\"647\" y=\"-103.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,S,B,C,B,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,a,S,B,C,B,C,B,C,B,C] -->\n",
"<g id=\"node10\" class=\"node\"><title>[a,a,a,a,S,B,C,B,C,B,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"546.992,-36 373.008,-36 373.008,-0 546.992,-0 546.992,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"460\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,a,S,B,C,B,C,B,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,S,B,C,B,C,B,C]->[a,a,a,a,S,B,C,B,C,B,C,B,C] -->\n",
"<g id=\"edge8\" class=\"edge\"><title>[a,a,a,S,B,C,B,C,B,C]->[a,a,a,a,S,B,C,B,C,B,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M610.501,-89.8238C580.511,-75.7111 537.87,-55.6449 505.629,-40.4725\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"506.946,-37.224 496.407,-36.1329 503.965,-43.5578 506.946,-37.224\"/>\n",
"<text text-anchor=\"middle\" x=\"579.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,a,a,B,C,B,C,B,C,B,C] -->\n",
"<g id=\"node12\" class=\"node\"><title>[a,a,a,a,B,C,B,C,B,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"728.529,-36 565.471,-36 565.471,-0 728.529,-0 728.529,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"647\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,a,B,C,B,C,B,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,S,B,C,B,C,B,C]->[a,a,a,a,B,C,B,C,B,C,B,C] -->\n",
"<g id=\"edge10\" class=\"edge\"><title>[a,a,a,S,B,C,B,C,B,C]->[a,a,a,a,B,C,B,C,B,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M647,-89.614C647,-77.2403 647,-60.3686 647,-46.2198\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"650.5,-46.0504 647,-36.0504 643.5,-46.0504 650.5,-46.0504\"/>\n",
"<text text-anchor=\"middle\" x=\"655.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,a,S,B,B,C,C,B,C] -->\n",
"<g id=\"node14\" class=\"node\"><title>[a,a,a,S,B,B,C,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"354.45,-36 215.55,-36 215.55,-0 354.45,-0 354.45,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"285\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,S,B,B,C,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,S,B,C,B,C,B,C]->[a,a,a,S,B,B,C,C,B,C] -->\n",
"<g id=\"edge12\" class=\"edge\"><title>[a,a,a,S,B,C,B,C,B,C]->[a,a,a,S,B,B,C,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M577.631,-90.1368C516.733,-75.3329 428.176,-53.8051 364.449,-38.3135\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"364.986,-34.8422 354.442,-35.8809 363.332,-41.6441 364.986,-34.8422\"/>\n",
"<text text-anchor=\"middle\" x=\"507.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,a,S,B,C,B,B,C,C] -->\n",
"<g id=\"node16\" class=\"node\"><title>[a,a,a,S,B,C,B,B,C,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"885.45,-36 746.55,-36 746.55,-0 885.45,-0 885.45,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"816\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,a,S,B,C,B,B,C,C]</text>\n",
"</g>\n",
"<!-- [a,a,a,S,B,C,B,C,B,C]->[a,a,a,S,B,C,B,B,C,C] -->\n",
"<g id=\"edge14\" class=\"edge\"><title>[a,a,a,S,B,C,B,C,B,C]->[a,a,a,S,B,C,B,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M679.986,-89.8238C706.856,-75.8322 744.964,-55.9889 774.011,-40.8643\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"775.844,-43.8558 783.097,-36.1329 772.611,-37.647 775.844,-43.8558\"/>\n",
"<text text-anchor=\"middle\" x=\"755.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,S,B,B,C,C] -->\n",
"<g id=\"node17\" class=\"node\"><title>[a,a,S,B,B,C,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"880.41,-126 777.59,-126 777.59,-90 880.41,-90 880.41,-126\"/>\n",
"<text text-anchor=\"middle\" x=\"829\" y=\"-103.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,S,B,B,C,C]</text>\n",
"</g>\n",
"<!-- [a,a,S,B,B,C,C]->[a,a,a,B,C,B,B,C,C] -->\n",
"<g id=\"edge16\" class=\"edge\"><title>[a,a,S,B,B,C,C]->[a,a,a,B,C,B,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M856.131,-89.8238C877.848,-76.0745 908.492,-56.6744 932.217,-41.6541\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"934.361,-44.4392 940.938,-36.1329 930.617,-38.5248 934.361,-44.4392\"/>\n",
"<text text-anchor=\"middle\" x=\"919.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,S,B,B,C,C]->[a,a,a,S,B,C,B,B,C,C] -->\n",
"<g id=\"edge18\" class=\"edge\"><title>[a,a,S,B,B,C,C]->[a,a,a,S,B,C,B,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M826.432,-89.614C824.604,-77.2403 822.111,-60.3686 820.021,-46.2198\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"823.443,-45.4315 818.519,-36.0504 816.518,-46.4546 823.443,-45.4315\"/>\n",
"<text text-anchor=\"middle\" x=\"832.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,S,B,C,B,C] -->\n",
"<g id=\"node20\" class=\"node\"><title>[a,a,S,B,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"880.41,-216 777.59,-216 777.59,-180 880.41,-180 880.41,-216\"/>\n",
"<text text-anchor=\"middle\" x=\"829\" y=\"-193.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,S,B,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,S,B,C,B,C]->[a,a,a,B,C,B,C,B,C] -->\n",
"<g id=\"edge20\" class=\"edge\"><title>[a,a,S,B,C,B,C]->[a,a,a,B,C,B,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M856.131,-179.824C877.848,-166.075 908.492,-146.674 932.217,-131.654\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"934.361,-134.439 940.938,-126.133 930.617,-128.525 934.361,-134.439\"/>\n",
"<text text-anchor=\"middle\" x=\"919.553\" y=\"-148.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,S,B,C,B,C]->[a,a,a,S,B,C,B,C,B,C] -->\n",
"<g id=\"edge22\" class=\"edge\"><title>[a,a,S,B,C,B,C]->[a,a,a,S,B,C,B,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M793.477,-179.824C764.414,-165.772 723.144,-145.817 691.814,-130.668\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"692.96,-127.335 682.434,-126.133 689.913,-133.637 692.96,-127.335\"/>\n",
"<text text-anchor=\"middle\" x=\"763.553\" y=\"-148.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,S,B,C,B,C]->[a,a,S,B,B,C,C] -->\n",
"<g id=\"edge24\" class=\"edge\"><title>[a,a,S,B,C,B,C]->[a,a,S,B,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M829,-179.614C829,-167.24 829,-150.369 829,-136.22\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"832.5,-136.05 829,-126.05 825.5,-136.05 832.5,-136.05\"/>\n",
"<text text-anchor=\"middle\" x=\"837.553\" y=\"-148.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,B,B,C,C] -->\n",
"<g id=\"node24\" class=\"node\"><title>[a,a,B,B,C,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"91.9491,-126 0.0508791,-126 0.0508791,-90 91.9491,-90 91.9491,-126\"/>\n",
"<text text-anchor=\"middle\" x=\"46\" y=\"-103.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,B,B,C,C]</text>\n",
"</g>\n",
"<!-- [a,a,b,B,C,C] -->\n",
"<g id=\"node26\" class=\"node\"><title>[a,a,b,B,C,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"92.1953,-36 1.80466,-36 1.80466,-0 92.1953,-0 92.1953,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"47\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,b,B,C,C]</text>\n",
"</g>\n",
"<!-- [a,a,B,B,C,C]->[a,a,b,B,C,C] -->\n",
"<g id=\"edge26\" class=\"edge\"><title>[a,a,B,B,C,C]->[a,a,b,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M46.1976,-89.614C46.3382,-77.2403 46.5299,-60.3686 46.6907,-46.2198\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"50.1923,-46.0896 46.8062,-36.0504 43.1927,-46.01 50.1923,-46.0896\"/>\n",
"<text text-anchor=\"middle\" x=\"55.5526\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,B,C,B,C] -->\n",
"<g id=\"node27\" class=\"node\"><title>[a,a,B,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"200.949,-216 109.051,-216 109.051,-180 200.949,-180 200.949,-216\"/>\n",
"<text text-anchor=\"middle\" x=\"155\" y=\"-193.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,B,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,B,C,B,C]->[a,a,B,B,C,C] -->\n",
"<g id=\"edge28\" class=\"edge\"><title>[a,a,B,C,B,C]->[a,a,B,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M133.725,-179.824C117.07,-166.377 93.72,-147.526 75.2974,-132.653\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"77.2008,-129.691 67.2214,-126.133 72.8036,-135.138 77.2008,-129.691\"/>\n",
"<text text-anchor=\"middle\" x=\"119.553\" y=\"-148.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,b,C,B,C] -->\n",
"<g id=\"node30\" class=\"node\"><title>[a,a,b,C,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"200.195,-126 109.805,-126 109.805,-90 200.195,-90 200.195,-126\"/>\n",
"<text text-anchor=\"middle\" x=\"155\" y=\"-103.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,b,C,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,B,C,B,C]->[a,a,b,C,B,C] -->\n",
"<g id=\"edge30\" class=\"edge\"><title>[a,a,B,C,B,C]->[a,a,b,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M155,-179.614C155,-167.24 155,-150.369 155,-136.22\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"158.5,-136.05 155,-126.05 151.5,-136.05 158.5,-136.05\"/>\n",
"<text text-anchor=\"middle\" x=\"163.553\" y=\"-148.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,b,C,B,C]->[a,a,b,B,C,C] -->\n",
"<g id=\"edge32\" class=\"edge\"><title>[a,a,b,C,B,C]->[a,a,b,B,C,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M133.92,-89.8238C117.418,-76.3774 94.2822,-57.5263 76.0286,-42.6529\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"77.9899,-39.7363 68.0267,-36.1329 73.5682,-45.163 77.9899,-39.7363\"/>\n",
"<text text-anchor=\"middle\" x=\"119.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,a,b,c,B,C] -->\n",
"<g id=\"node33\" class=\"node\"><title>[a,a,b,c,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"197.353,-36 110.647,-36 110.647,-0 197.353,-0 197.353,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"154\" y=\"-13.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,a,b,c,B,C]</text>\n",
"</g>\n",
"<!-- [a,a,b,C,B,C]->[a,a,b,c,B,C] -->\n",
"<g id=\"edge34\" class=\"edge\"><title>[a,a,b,C,B,C]->[a,a,b,c,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M154.802,-89.614C154.662,-77.2403 154.47,-60.3686 154.309,-46.2198\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"157.807,-46.01 154.194,-36.0504 150.808,-46.0896 157.807,-46.01\"/>\n",
"<text text-anchor=\"middle\" x=\"163.553\" y=\"-58.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,B,C] -->\n",
"<g id=\"node34\" class=\"node\"><title>[a,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"962.406,-306 905.594,-306 905.594,-270 962.406,-270 962.406,-306\"/>\n",
"<text text-anchor=\"middle\" x=\"934\" y=\"-283.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,B,C]</text>\n",
"</g>\n",
"<!-- [a,b,C] -->\n",
"<g id=\"node36\" class=\"node\"><title>[a,b,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"1035.15,-216 980.845,-216 980.845,-180 1035.15,-180 1035.15,-216\"/>\n",
"<text text-anchor=\"middle\" x=\"1008\" y=\"-193.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,b,C]</text>\n",
"</g>\n",
"<!-- [a,B,C]->[a,b,C] -->\n",
"<g id=\"edge36\" class=\"edge\"><title>[a,B,C]->[a,b,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M948.62,-269.614C959.637,-256.512 974.895,-238.368 987.185,-223.753\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"989.905,-225.957 993.662,-216.05 984.547,-221.451 989.905,-225.957\"/>\n",
"<text text-anchor=\"middle\" x=\"986.553\" y=\"-238.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,b,c] -->\n",
"<g id=\"node41\" class=\"node\"><title>[a,b,c]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"1104,-126 1050,-126 1050,-90 1104,-90 1104,-126\"/>\n",
"<text text-anchor=\"middle\" x=\"1077\" y=\"-103.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,b,c]</text>\n",
"</g>\n",
"<!-- [a,b,C]->[a,b,c] -->\n",
"<g id=\"edge42\" class=\"edge\"><title>[a,b,C]->[a,b,c]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M1021.63,-179.614C1031.81,-166.634 1045.87,-148.704 1057.27,-134.16\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"1060.21,-136.079 1063.63,-126.05 1054.71,-131.76 1060.21,-136.079\"/>\n",
"<text text-anchor=\"middle\" x=\"1057.55\" y=\"-148.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,S,B,C] -->\n",
"<g id=\"node37\" class=\"node\"><title>[a,S,B,C]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"863.37,-306 794.63,-306 794.63,-270 863.37,-270 863.37,-306\"/>\n",
"<text text-anchor=\"middle\" x=\"829\" y=\"-283.8\" font-family=\"Times,serif\" font-size=\"14.00\">[a,S,B,C]</text>\n",
"</g>\n",
"<!-- [a,S,B,C]->[a,a,S,B,C,B,C] -->\n",
"<g id=\"edge38\" class=\"edge\"><title>[a,S,B,C]->[a,a,S,B,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M829,-269.614C829,-257.24 829,-240.369 829,-226.22\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"832.5,-226.05 829,-216.05 825.5,-226.05 832.5,-226.05\"/>\n",
"<text text-anchor=\"middle\" x=\"837.553\" y=\"-238.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [a,S,B,C]->[a,a,B,C,B,C] -->\n",
"<g id=\"edge40\" class=\"edge\"><title>[a,S,B,C]->[a,a,B,C,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M794.65,-282.515C685.626,-268.281 346.654,-224.023 211.481,-206.374\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"211.708,-202.874 201.339,-205.05 210.802,-209.816 211.708,-202.874\"/>\n",
"<text text-anchor=\"middle\" x=\"561.553\" y=\"-238.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [S] -->\n",
"<g id=\"node42\" class=\"node\"><title>[S]</title>\n",
"<polygon fill=\"#cae1ff\" stroke=\"#cae1ff\" points=\"916,-396 862,-396 862,-360 916,-360 916,-396\"/>\n",
"<text text-anchor=\"middle\" x=\"889\" y=\"-373.8\" font-family=\"Times,serif\" font-size=\"14.00\">[S]</text>\n",
"</g>\n",
"<!-- [S]->[a,B,C] -->\n",
"<g id=\"edge44\" class=\"edge\"><title>[S]->[a,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M897.891,-359.614C904.404,-346.876 913.355,-329.372 920.715,-314.979\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"923.844,-316.547 925.281,-306.05 917.612,-313.36 923.844,-316.547\"/>\n",
"<text text-anchor=\"middle\" x=\"924.553\" y=\"-328.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"<!-- [S]->[a,S,B,C] -->\n",
"<g id=\"edge46\" class=\"edge\"><title>[S]->[a,S,B,C]</title>\n",
"<path fill=\"none\" stroke=\"firebrick\" d=\"M877.146,-359.614C868.378,-346.755 856.299,-329.038 846.433,-314.568\"/>\n",
"<polygon fill=\"firebrick\" stroke=\"firebrick\" points=\"849.15,-312.341 840.625,-306.05 843.367,-316.284 849.15,-312.341\"/>\n",
"<text text-anchor=\"middle\" x=\"873.553\" y=\"-328.8\" font-family=\"Times,serif\" font-size=\"14.00\">abl</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<Dot visualization: expr_as_graph [SFSF={[S],[a,b,c],[a,b,C],[a,S,B,C],[a,B,C],[a,a,b,c,B,C],[a,a,b,C,B,C],[a,a,b,B,C,C],[a,a,B,C,B,C],[a,a,B,B,C,C],[a,a,S,B,C,B,C],[a,a,S,B,B,C,C],[a,a,a,S,B,C,B,B,C,C],[a,a,a,S,B,B,C,C,B,C],[a,a,a,S,B,C,B,C,B,C],[a,a,a,B,B,C,C,B,C],[a,a,a,b,C,B,C,B,C],[a,a,a,B,C,B,B,C,C],[a,a,a,B,C,B,C,B,C],[a,a,a,a,B,C,B,C,B,C,B,C],[a,a,a,a,S,B,C,B,C,B,C,B,C]}(\"abl\",SF<|abl|>SF)]>"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":dot expr_as_graph (\"abl\",SF <| abl |> SF)"
]
},
{
"cell_type": "code",
"execution_count": 87,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{[a,\\mathit{b},c],[a,\\mathit{a},\\mathit{b},\\mathit{b},\\mathit{c},c]\\}$"
],
"text/plain": [
"{[a,b,c],[a,a,b,b,c,c]}"
]
},
"execution_count": 87,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": null,
...
...
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Grammatiken
## Grammatiken
Dieses Notebook begleitet Teil 2 der Vorlesung 3.
Dieses Notebook begleitet Teil 2 der Vorlesung 3.
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Eine __Grammatik__ ist ein Quadrupel
Eine __Grammatik__ ist ein Quadrupel
$G = (
\S
igma , N, S, P)$, wobei
$G = (
\S
igma , N, S, P)$, wobei
*
$
\S
igma$ ein Alphabet (von so genannten __Terminalsymbolen__) ist,
*
$
\S
igma$ ein Alphabet (von so genannten __Terminalsymbolen__) ist,
*
$N$ eine endliche Menge (von so genannten __Nichtterminalen__) mit
*
$N$ eine endliche Menge (von so genannten __Nichtterminalen__) mit
$
\S
igma
\c
ap N =
\e
mptyset$,
$
\S
igma
\c
ap N =
\e
mptyset$,
*
$S
\i
n N$ das __Startsymbol__ und
*
$S
\i
n N$ das __Startsymbol__ und
*
$P
\s
ubseteq (N
\c
up
\S
igma)^+
\t
imes (N
\c
up
\S
igma)^{
\a
st}$ die
*
$P
\s
ubseteq (N
\c
up
\S
igma)^+
\t
imes (N
\c
up
\S
igma)^{
\a
st}$ die
endliche Menge der __Produktionen__ (Regeln).
endliche Menge der __Produktionen__ (Regeln).
Diese mathematische Definition setzen wir im Notebook folgendermaßen um.
Diese mathematische Definition setzen wir im Notebook folgendermaßen um.
Wir verwenden eine B Maschine um eine neue Basismenge an Symbolen (ΣN) einführen zu können.
Wir verwenden eine B Maschine um eine neue Basismenge an Symbolen (ΣN) einführen zu können.
Hier steht
```seq1(T)```
für die nicht leeren Folgen über T, also $T^+$ in der Notation des Skripts.
Hier steht
```seq1(T)```
für die nicht leeren Folgen über T, also $T^+$ in der Notation des Skripts.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
::load
::load
MACHINE Grammatik
MACHINE Grammatik
SETS ΣN = {a,b,c, S}
SETS ΣN = {a,b,c, S}
CONSTANTS Σ, N, P
CONSTANTS Σ, N, P
PROPERTIES
PROPERTIES
Σ = {a,b,c} ∧
Σ = {a,b,c} ∧
Σ ∩ N = {} ∧
Σ ∩ N = {} ∧
Σ ∪ N = ΣN ∧
Σ ∪ N = ΣN ∧
S ∈ N ∧
S ∈ N ∧
P ⊆ seq1(ΣN) × seq(ΣN) ∧
P ⊆ seq1(ΣN) × seq(ΣN) ∧
// Die Beispiel Grammatik G1 von den Folien
// Die Beispiel Grammatik G1 von den Folien
P = { [S] ↦ [],
P = { [S] ↦ [],
[S] ↦ [a,S,b]
[S] ↦ [a,S,b]
}
}
DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE
DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE
END
END
```
```
%% Output
%% Output
Loaded machine: Grammatik
Loaded machine: Grammatik
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:constants
:constants
```
```
%% Output
%% Output
Machine constants set up using operation 0: $setup_constants()
Machine constants set up using operation 0: $setup_constants()
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
[S] ↦ RHS ∈ P
[S] ↦ RHS ∈ P
```
```
%% Output
%% Output
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
**Solution:**
**Solution:**
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
* $\mathit{RHS} = []$
* $\mathit{RHS} = []$
TRUE
TRUE
Solution:
Solution:
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
RHS = []
RHS = []
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Mit dem relationalen Bild können wir alle Regeln mit der Folge S auf der rechten Seite finden:
Mit dem relationalen Bild können wir alle Regeln mit der Folge S auf der rechten Seite finden:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
P[{[S]}]
P[{[S]}]
```
```
%% Output
%% Output
$\{[],[a,\mathit{S},b]\}$
$\{[],[a,\mathit{S},b]\}$
{[],[a,S,b]}
{[],[a,S,b]}
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Definiere die __unmittelbare Ableitungsrelation__ bzgl. $G$ so
Definiere die __unmittelbare Ableitungsrelation__ bzgl. $G$ so
*
$u
\v
dash_{G} v
\L
ongleftrightarrow u = xpz, v = xqz$,
*
$u
\v
dash_{G} v
\L
ongleftrightarrow u = xpz, v = xqz$,
wobei $x,z
\i
n (N
\c
up
\S
igma)^{
\a
st}$ und $p
\r
ightarrow q$ eine Regel in $P$
wobei $x,z
\i
n (N
\c
up
\S
igma)^{
\a
st}$ und $p
\r
ightarrow q$ eine Regel in $P$
ist.
ist.
Im Notebook können wir dies so umsetzen, können aber leider nicht das Symbol $
\v
dash_G$ verwenden.
Im Notebook können wir dies so umsetzen, können aber leider nicht das Symbol $
\v
dash_G$ verwenden.
Aus $u
\v
dash_{G} v$ wird $u
\m
apsto v
\i
n abl$.
Aus $u
\v
dash_{G} v$ wird $u
\m
apsto v
\i
n abl$.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:let abl {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}
::load
MACHINE Grammatik
SETS ΣN = {a,b,c, S}
CONSTANTS Σ, N, P
ABSTRACT_CONSTANTS abl
PROPERTIES
Σ = {a,b,c} ∧
Σ ∩ N = {} ∧
Σ ∪ N = ΣN ∧
S ∈ N ∧
P ⊆ seq1(ΣN) × seq(ΣN) ∧
// Die Beispiel Grammatik G1 von den Folien
P = { [S] ↦ [],
[S] ↦ [a,S,b]
}
∧
abl = {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}
DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE
END
```
```
%% Output
%% Output
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}/*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} ⌒ \mathit{p} ⌒ \mathit{z} \land \mathit{v} = \mathit{x} ⌒ \mathit{q} ⌒ \mathit{z})\}$
Loaded machine: Grammatik
/*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ⌒ p ⌒ z ∧ v = x ⌒ q ⌒ z)}
%% Cell type:code id: tags:
```
prob
:constants
```
%% Output
Machine constants set up using operation 0: $setup_constants()
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
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 unendlich ist wird diese im Notebook symbolisch gehalten. Wir können aber prüfen ob Paare an Folgen in der Relation sind:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
[S] ↦ [a,S,b] ∈ abl
[S] ↦ [a,S,b] ∈ abl
```
```
%% Output
%% Output
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
**Solution:**
**Solution:**
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
TRUE
TRUE
Solution:
Solution:
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
[S] ↦ [a,b] ∈ abl
[S] ↦ [a,b] ∈ abl
```
```
%% Output
%% Output
$\mathit{FALSE}$
$\mathit{FALSE}$
FALSE
FALSE
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
[S] ↦ x : abl
[S] ↦ x : abl
```
```
%% Output
%% Output
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
**Solution:**
**Solution:**
* $\mathit{x} = []$
* $\mathit{x} = []$
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
TRUE
TRUE
Solution:
Solution:
x = []
x = []
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Mit dem relationalen Abbild können wir die Menge aller Umschreibungen berrechnen:
Mit dem relationalen Abbild können wir die Menge aller Umschreibungen berrechnen:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
abl[ {[S]} ]
abl[ {[S]} ]
```
```
%% Output
%% Output
$\{[],[a,\mathit{S},b]\}$
$\{[],[a,\mathit{S},b]\}$
{[],[a,S,b]}
{[],[a,S,b]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
abl[ {[a,S,b]} ]
abl[ {[a,S,b]} ]
```
```
%% Output
%% Output
$\{[a,b],[a,\mathit{a},\mathit{S},\mathit{b},b]\}$
$\{[a,b],[a,\mathit{a},\mathit{S},\mathit{b},b]\}$
{[a,b],[a,a,S,b,b]}
{[a,b],[a,a,S,b,b]}
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Durch mehrfache Anwendung bekommen wir die Ergebnisse von immer längeren Ableitungen:
Durch mehrfache Anwendung bekommen wir die Ergebnisse von immer längeren Ableitungen:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
abl[ abl[ {[S]} ] ]
abl[ abl[ {[S]} ] ]
```
```
%% Output
%% Output
$\{[a,b],[a,\mathit{a},\mathit{S},\mathit{b},b]\}$
$\{[a,b],[a,\mathit{a},\mathit{S},\mathit{b},b]\}$
{[a,b],[a,a,S,b,b]}
{[a,b],[a,a,S,b,b]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
abl[ abl[ abl[ {[S]} ] ] ]
abl[ abl[ abl[ {[S]} ] ] ]
```
```
%% Output
%% Output
$\{[a,\mathit{a},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b]\}$
$\{[a,\mathit{a},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b]\}$
{[a,a,b,b],[a,a,a,S,b,b,b]}
{[a,a,b,b],[a,a,a,S,b,b,b]}
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Durch $n$-malige Anwendung von $
\v
dash_{G}$ erhalten wir
Durch $n$-malige Anwendung von $
\v
dash_{G}$ erhalten wir
$
\v
dash_{G}^{n}$. Das heiß t:
$
\v
dash_{G}^{n}$. Das heiß t:
*
$u
\v
dash_{G}^{n} v
\L
ongleftrightarrow u = x_0
\v
dash_{G} x_1
*
$u
\v
dash_{G}^{n} v
\L
ongleftrightarrow u = x_0
\v
dash_{G} x_1
\v
dash_{G}
\c
dots
\v
dash_{G} x_n = v$
\v
dash_{G}
\c
dots
\v
dash_{G} x_n = v$
Im Notebook kann man für die n-malige Anwendung einer binären Relation den Operator
```iterate```
verwenden:
Im Notebook kann man für die n-malige Anwendung einer binären Relation den Operator
```iterate```
verwenden:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
[S] ↦ [a,b] ∈ iterate(abl,2)
[S] ↦ [a,b] ∈ iterate(abl,2)
```
```
%% Output
%% Output
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
$\newcommand{\qdot}{\mathord{\mkern1mu\cdot\mkern1mu}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\newcommand{\expn}{\mathbin{\widehat{\mkern1em}}}\mathit{TRUE}$
**Solution:**
**Solution:**
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
* $\mathit{abl} = /*@symbolic*/ \{\mathit{u},\mathit{v}\mid\exists(\mathit{x},\mathit{z},\mathit{p},\mathit{q})\qdot(\mathit{p} \mapsto \mathit{q} \in \{([S]\mapsto []),([S]\mapsto [a,\mathit{S},b])\} \land \mathit{u} = \mathit{x} \expn \mathit{p} \expn \mathit{z} \land \mathit{v} = \mathit{x} \expn \mathit{q} \expn \mathit{z})\}$
TRUE
TRUE
Solution:
Solution:
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
abl = /*@symbolic*/ {u,v∣∃(x,z,p,q)·(p ↦ q ∈ {([S]↦[]),([S]↦[a,S,b])} ∧ u = x ^ p ^ z ∧ v = x ^ q ^ z)}
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Die Menge $
\{
w
\m
id S
\v
dash_{G}^{n} w
\}
$ kann direkt mit dem relationalen Bild berechnet werden. Zum Beispiel für n = 0,1,2,3,4:
Die Menge $
\{
w
\m
id S
\v
dash_{G}^{n} w
\}
$ kann direkt mit dem relationalen Bild berechnet werden. Zum Beispiel für n = 0,1,2,3,4:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
iterate(abl,0)[ {[S]} ]
iterate(abl,0)[ {[S]} ]
```
```
%% Output
%% Output
$\{[S]\}$
$\{[S]\}$
{[S]}
{[S]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
iterate(abl,1)[ {[S]} ]
iterate(abl,1)[ {[S]} ]
```
```
%% Output
%% Output
$\{[],[a,\mathit{S},b]\}$
$\{[],[a,\mathit{S},b]\}$
{[],[a,S,b]}
{[],[a,S,b]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
iterate(abl,2)[ {[S]} ]
iterate(abl,2)[ {[S]} ]
```
```
%% Output
%% Output
$\{[a,b],[a,\mathit{a},\mathit{S},\mathit{b},b]\}$
$\{[a,b],[a,\mathit{a},\mathit{S},\mathit{b},b]\}$
{[a,b],[a,a,S,b,b]}
{[a,b],[a,a,S,b,b]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
iterate(abl,3)[ {[S]} ]
iterate(abl,3)[ {[S]} ]
```
```
%% Output
%% Output
$\{[a,\mathit{a},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b]\}$
$\{[a,\mathit{a},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b]\}$
{[a,a,b,b],[a,a,a,S,b,b,b]}
{[a,a,b,b],[a,a,a,S,b,b,b]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
iterate(abl,4)[ {[S]} ]
iterate(abl,4)[ {[S]} ]
```
```
%% Output
%% Output
$\{[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},\mathit{b},b]\}$
$\{[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},\mathit{b},b]\}$
{[a,a,a,b,b,b],[a,a,a,a,S,b,b,b,b]}
{[a,a,a,b,b,b],[a,a,a,a,S,b,b,b,b]}
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Die von der Grammatik $G$ erzeugte Sprache ist
Die von der Grammatik $G$ erzeugte Sprache ist
definiert als
definiert als
$L(G) =
\{
w
\i
n
\S
igma^
*
\m
id S
\v
dash_{G}^{
\a
st} w
\}
.$
$L(G) =
\{
w
\i
n
\S
igma^
*
\m
id S
\v
dash_{G}^{
\a
st} w
\}
.$
Bis zur Länge 4 gibt es folgende abgeleitenen Wörter über $
\S
igma
\c
up N$
Bis zur Länge 4 gibt es folgende abgeleitenen Wörter über $
\S
igma
\c
up N$
(auch Satzformen genannt):
(auch Satzformen genannt):
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ])
UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ])
```
```
%% Output
%% Output
$\{[],[a,b],[S],[a,\mathit{a},\mathit{b},b],[a,\mathit{S},b],[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{S},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},\mathit{b},b]\}$
$\{[],[a,b],[S],[a,\mathit{a},\mathit{b},b],[a,\mathit{S},b],[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{S},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},\mathit{b},b]\}$
{[],[a,b],[S],[a,a,b,b],[a,S,b],[a,a,a,b,b,b],[a,a,S,b,b],[a,a,a,S,b,b,b],[a,a,a,a,S,b,b,b,b]}
{[],[a,b],[S],[a,a,b,b],[a,S,b],[a,a,a,b,b,b],[a,a,S,b,b],[a,a,a,S,b,b,b],[a,a,a,a,S,b,b,b,b]}
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
Wenn wir mit $
\S
igma^
*
$ schneiden bekommen wir Wörter der von der Grammatik generierten Sprache:
Wenn wir mit $
\S
igma^
*
$ schneiden bekommen wir Wörter der von der Grammatik generierten Sprache:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ])
/\
seq(Σ)
UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ])
∩
seq(Σ)
```
```
%% Output
%% Output
$\{[],[a,b],[a,\mathit{a},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b]\}$
$\{[],[a,b],[a,\mathit{a},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b]\}$
{[],[a,b],[a,a,b,b],[a,a,a,b,b,b]}
{[],[a,b],[a,a,b,b],[a,a,a,b,b,b]}
%% Cell type:markdown id: tags:
Wir können die Ableitungsrelationen für alle Satzformen bis zu einer gegebenen Tiefe auch grafisch darstellen.
%% Cell type:code id: tags:
```
prob
:let SF UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ])
```
%% Output
$\{[],[a,b],[S],[a,\mathit{a},\mathit{b},b],[a,\mathit{S},b],[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{S},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},\mathit{b},b]\}$
{[],[a,b],[S],[a,a,b,b],[a,S,b],[a,a,a,b,b,b],[a,a,S,b,b],[a,a,a,S,b,b,b],[a,a,a,a,S,b,b,b,b]}
%% Cell type:code id: tags:
```
prob
:pref DOT_DECOMPOSE_NODES=FALSE
```
%% Output
Preference changed: DOT_DECOMPOSE_NODES = FALSE
%% Cell type:code id: tags:
```
prob
:dot expr_as_graph ("abl",SF <| abl |> SF)
```
%% Output
<Dot visualization: expr_as_graph [SFablSF={[],[a,b],[S],[a,a,b,b],[a,S,b],[a,a,a,b,b,b],[a,a,S,b,b],[a,a,a,S,b,b,b],[a,a,a,a,S,b,b,b,b]} & abl=uv#x,z,p,q.((p,q):{([S],[]),([S],[a,S,b])} & u=x^p^z & v=x^q^z)("abl",SF<|abl|>SF)]>
%% Cell type:markdown id: tags:
Die Grammatik G2 können wir wie folgt umsetzen:
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
::load
::load
MACHINE Grammatik
MACHINE Grammatik
2
SETS ΣN = {a,b,c, S}
SETS ΣN = {a,b,c, S
, B,C
}
CONSTANTS Σ, N, P
CONSTANTS Σ, N, P
ABSTRACT_CONSTANTS abl
ABSTRACT_CONSTANTS abl
PROPERTIES
PROPERTIES
Σ = {a,b,c} ∧
Σ = {a,b,c} ∧
Σ ∩ N = {} ∧
Σ ∩ N = {} ∧
Σ ∪ N = ΣN ∧
Σ ∪ N = ΣN ∧
S ∈ N ∧
S ∈ N ∧
P ⊆ seq1(ΣN) × seq(ΣN) ∧
P ⊆ seq1(ΣN) × seq(ΣN) ∧
// Die Beispiel Grammatik G1 von den Folien
// Die Beispiel Grammatik G1 von den Folien
P = { [S] ↦ [],
P = { [S] ↦ [a,B,C],
[S] ↦ [a,S,b]
[S] ↦ [a,S,B,C],
[C,B] ↦ [B,C],
[a,B] ↦ [a,b],
[b,B] ↦ [b,b],
[b,C] ↦ [b,c],
[c,C] ↦ [c,c]
}
}
∧
∧
abl = {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}
abl = {u,v | ∃(x,z,p,q).( p↦q ∈ P ∧ u = x^p^z ∧ v = x^q^z )}
DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE
DEFINITIONS SET_PREF_PP_SEQUENCES == TRUE
END
END
```
```
%% Output
%% Output
Loaded machine: Grammatik
Loaded machine: Grammatik
2
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:constants
:constants
```
```
%% Output
%% Output
Machine constants set up using operation 0: $setup_constants()
Machine constants set up using operation 0: $setup_constants()
%% Cell type:
markdown
id: tags:
%% Cell type:
code
id: tags:
Wir können die Ableitungsrelationen für alle Satzformen bis zu einer gegebenen Tiefe auch grafisch darstellen.
```
prob
:let SF UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ])
```
%% Output
$\{[S],[a,\mathit{b},c],[a,\mathit{b},C],[a,\mathit{S},\mathit{B},C],[a,\mathit{B},C],[a,\mathit{a},\mathit{b},\mathit{c},\mathit{B},C],[a,\mathit{a},\mathit{b},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{b},\mathit{B},\mathit{C},C],[a,\mathit{a},\mathit{B},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{B},\mathit{B},\mathit{C},C],[a,\mathit{a},\mathit{S},\mathit{B},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{S},\mathit{B},\mathit{B},\mathit{C},C],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{B},\mathit{C},\mathit{B},\mathit{B},\mathit{C},C],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{B},\mathit{B},\mathit{C},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{B},\mathit{C},\mathit{B},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{a},\mathit{B},\mathit{B},\mathit{C},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{a},\mathit{b},\mathit{C},\mathit{B},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{a},\mathit{B},\mathit{C},\mathit{B},\mathit{B},\mathit{C},C],[a,\mathit{a},\mathit{a},\mathit{B},\mathit{C},\mathit{B},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{B},\mathit{C},\mathit{B},\mathit{C},\mathit{B},\mathit{C},\mathit{B},C],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{S},\mathit{B},\mathit{C},\mathit{B},\mathit{C},\mathit{B},\mathit{C},\mathit{B},C]\}$
{[S],[a,b,c],[a,b,C],[a,S,B,C],[a,B,C],[a,a,b,c,B,C],[a,a,b,C,B,C],[a,a,b,B,C,C],[a,a,B,C,B,C],[a,a,B,B,C,C],[a,a,S,B,C,B,C],[a,a,S,B,B,C,C],[a,a,a,S,B,C,B,B,C,C],[a,a,a,S,B,B,C,C,B,C],[a,a,a,S,B,C,B,C,B,C],[a,a,a,B,B,C,C,B,C],[a,a,a,b,C,B,C,B,C],[a,a,a,B,C,B,B,C,C],[a,a,a,B,C,B,C,B,C],[a,a,a,a,B,C,B,C,B,C,B,C],[a,a,a,a,S,B,C,B,C,B,C,B,C]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:let SF UNION(i).(i:0..4|iterate(abl,i)[ {[S]} ]
)
SF ∩ seq(Σ
)
```
```
%% Output
%% Output
$\{[
],[a,b],[S],[a,\mathit{a},\mathit{b},b],[a,\mathit{S},b],[a,\mathit{a},\mathit{a},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{S},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},b],[a,\mathit{a},\mathit{a},\mathit{a},\mathit{S},\mathit{b},\mathit{b},\mathit{b},b
]\}$
$\{[
a,\mathit{b},c
]\}$
{[
],[a,b],[S],[a,a,b,b],[a,S,b],[a,a,a,b,b,b],[a,a,S,b,b],[a,a,a,S,b,b,b],[a,a,a,a,S,b,b,b,b
]}
{[
a,b,c
]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:pref DOT_DECOMPOSE_NODES=FALSE
:pref DOT_DECOMPOSE_NODES=FALSE
```
```
%% Output
%% Output
Preference changed: DOT_DECOMPOSE_NODES = FALSE
Preference changed: DOT_DECOMPOSE_NODES = FALSE
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:dot expr_as_graph ("abl",SF <| abl |> SF)
:dot expr_as_graph ("abl",SF <| abl |> SF)
```
```
%% Output
%% Output
<Dot visualization: expr_as_graph [SFablSF={[],[a,b],[S],[a,a,b,b],[a,S,b],[a,a,a,b,b,b],[a,a,S,b,b],[a,a,a,S,b,b,b],[a,a,a,a,S,b,b,b,b]} & abl=uv#x,z,p,q.((p,q):{([S],[]),([S],[a,S,b])} & u=x^p^z & v=x^q^z)("abl",SF<|abl|>SF)]>
<Dot visualization: expr_as_graph [SFSF={[S],[a,b,c],[a,b,C],[a,S,B,C],[a,B,C],[a,a,b,c,B,C],[a,a,b,C,B,C],[a,a,b,B,C,C],[a,a,B,C,B,C],[a,a,B,B,C,C],[a,a,S,B,C,B,C],[a,a,S,B,B,C,C],[a,a,a,S,B,C,B,B,C,C],[a,a,a,S,B,B,C,C,B,C],[a,a,a,S,B,C,B,C,B,C],[a,a,a,B,B,C,C,B,C],[a,a,a,b,C,B,C,B,C],[a,a,a,B,C,B,B,C,C],[a,a,a,B,C,B,C,B,C],[a,a,a,a,B,C,B,C,B,C,B,C],[a,a,a,a,S,B,C,B,C,B,C,B,C]}("abl",SF<|abl|>SF)]>
%% Cell type:code id: tags:
```
prob
```
%% Output
$\{[a,\mathit{b},c],[a,\mathit{a},\mathit{b},\mathit{b},\mathit{c},c]\}$
{[a,b,c],[a,a,b,b,c,c]}
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
```
```
...
...
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