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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
prob-teaching-notebooks
Commits
111f7a77
Commit
111f7a77
authored
4 years ago
by
Michael Leuschel
Browse files
Options
Downloads
Patches
Plain Diff
add execution trace
parent
9bed047e
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-3/PDA_nach_kfG.ipynb
+347
-14
347 additions, 14 deletions
info4/kapitel-3/PDA_nach_kfG.ipynb
with
347 additions
and
14 deletions
info4/kapitel-3/PDA_nach_kfG.ipynb
+
347
−
14
View file @
111f7a77
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
9
,
"execution_count":
16
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
"Loaded machine: PDA_to_CFG"
"Loaded machine: PDA_to_CFG"
]
]
},
},
"execution_count":
9
,
"execution_count":
16
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
"/* Translating a PDA to a CFG */\n",
"/* Translating a PDA to a CFG */\n",
"SETS\n",
"SETS\n",
" STATES = {z0,z1, symbol}; \n",
" STATES = {z0,z1, symbol}; \n",
" /* symbol: virtueller Zustand um S und andere Symbole in der Grammatik darzustellen */\n",
" SYMBOLS={a,b, A, BOT, lambda, S} /* BOT = # = bottom of stack*/\n",
" SYMBOLS={a,b, A, BOT, lambda, S} /* BOT = # = bottom of stack*/\n",
"DEFINITIONS\n",
"DEFINITIONS\n",
" CFG_Alphabet == (STATES*(SYMBOLS-{lambda})*STATES);\n",
" CFG_Alphabet == (STATES*(SYMBOLS-{lambda})*STATES);\n",
...
@@ -85,7 +86,7 @@
...
@@ -85,7 +86,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
0
,
"execution_count": 1
7
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -94,7 +95,7 @@
...
@@ -94,7 +95,7 @@
"Machine constants set up using operation 0: $setup_constants()"
"Machine constants set up using operation 0: $setup_constants()"
]
]
},
},
"execution_count": 1
0
,
"execution_count": 1
7
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -105,7 +106,7 @@
...
@@ -105,7 +106,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
1
,
"execution_count": 1
8
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -114,7 +115,7 @@
...
@@ -114,7 +115,7 @@
"Machine initialised using operation 1: $initialise_machine()"
"Machine initialised using operation 1: $initialise_machine()"
]
]
},
},
"execution_count": 1
1
,
"execution_count": 1
8
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -125,7 +126,30 @@
...
@@ -125,7 +126,30 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 12,
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"$\\{(\\mathit{z0}\\mapsto \\mathit{a}\\mapsto \\mathit{A}\\mapsto(\\mathit{z0}\\mapsto [A,A])),(\\mathit{z0}\\mapsto \\mathit{a}\\mapsto \\mathit{BOT}\\mapsto(\\mathit{z0}\\mapsto [A,BOT])),(\\mathit{z0}\\mapsto \\mathit{b}\\mapsto \\mathit{A}\\mapsto(\\mathit{z1}\\mapsto [])),(\\mathit{z1}\\mapsto \\mathit{b}\\mapsto \\mathit{A}\\mapsto(\\mathit{z1}\\mapsto [])),(\\mathit{z1}\\mapsto \\mathit{lambda}\\mapsto \\mathit{BOT}\\mapsto(\\mathit{z1}\\mapsto []))\\}$"
],
"text/plain": [
"{(z0↦a↦A↦(z0↦[A,A])),(z0↦a↦BOT↦(z0↦[A,BOT])),(z0↦b↦A↦(z1↦[])),(z1↦b↦A↦(z1↦[])),(z1↦lambda↦BOT↦(z1↦[]))}"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"delta"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -147,7 +171,7 @@
...
@@ -147,7 +171,7 @@
"<Animation function visualisation>"
"<Animation function visualisation>"
]
]
},
},
"execution_count": 1
2
,
"execution_count": 1
9
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -158,7 +182,7 @@
...
@@ -158,7 +182,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
13
,
"execution_count":
20
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -173,7 +197,86 @@
...
@@ -173,7 +197,86 @@
"ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])"
"ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])"
]
]
},
},
"execution_count": 13,
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":browse"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Executed operation: ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":exec ApplyRule RHS = [(z0|->BOT|->z1)]"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"<table style=\"font-family:monospace\"><tbody>\n",
"<tr>\n",
"<td style=\"padding:10px\">z0</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">BOT</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">z1</td>\n",
"</tr>\n",
"</tbody></table>"
],
"text/plain": [
"<Animation function visualisation>"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":show"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Machine: PDA_to_CFG\n",
"Sets: STATES, SYMBOLS\n",
"Constants: delta, Productions\n",
"Variables: cur\n",
"Operations: \n",
"ApplyRule((z0|->BOT|->z1),[(symbol|->a|->symbol),(z0|->A|->z0),(z0|->BOT|->z1)],[],[])\n",
"ApplyRule((z0|->BOT|->z1),[(symbol|->a|->symbol),(z0|->A|->z1),(z1|->BOT|->z1)],[],[])"
]
},
"execution_count": 23,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -184,16 +287,186 @@
...
@@ -184,16 +287,186 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
1
4,
"execution_count":
2
4,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
"text/plain": [
"text/plain": [
"Executed operation: ApplyRule((symbol|->
S
|->symbol),
[
(z0|->BOT|->z
0
)],[],[])"
"Executed operation: ApplyRule((
z0|->BOT|->z1),[(
symbol|->
a
|->symbol),(z0|->
A|->z1),(z1|->
BOT|->z
1
)],[],[])"
]
]
},
},
"execution_count": 14,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":exec ApplyRule RHS = [(symbol|->a|->symbol),(z0|->A|->z1),(z1|->BOT|->z1)]"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"<table style=\"font-family:monospace\"><tbody>\n",
"<tr>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">z0</td>\n",
"<td style=\"padding:10px\">z1</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">a</td>\n",
"<td style=\"padding:10px\">A</td>\n",
"<td style=\"padding:10px\">BOT</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">z1</td>\n",
"<td style=\"padding:10px\">z1</td>\n",
"</tr>\n",
"</tbody></table>"
],
"text/plain": [
"<Animation function visualisation>"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":show"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Machine: PDA_to_CFG\n",
"Sets: STATES, SYMBOLS\n",
"Constants: delta, Productions\n",
"Variables: cur\n",
"Operations: \n",
"ApplyRule((z0|->A|->z1),[(symbol|->b|->symbol)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])\n",
"ApplyRule((z0|->A|->z1),[(symbol|->a|->symbol),(z0|->A|->z0),(z0|->A|->z1)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])\n",
"ApplyRule((z0|->A|->z1),[(symbol|->a|->symbol),(z0|->A|->z1),(z1|->A|->z1)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":browse"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Executed operation: ApplyRule((z0|->A|->z1),[(symbol|->b|->symbol)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":exec ApplyRule RHS=[(symbol|->b|->symbol)]"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"<table style=\"font-family:monospace\"><tbody>\n",
"<tr>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">z1</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">a</td>\n",
"<td style=\"padding:10px\">b</td>\n",
"<td style=\"padding:10px\">BOT</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">z1</td>\n",
"</tr>\n",
"</tbody></table>"
],
"text/plain": [
"<Animation function visualisation>"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":show"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Machine: PDA_to_CFG\n",
"Sets: STATES, SYMBOLS\n",
"Constants: delta, Productions\n",
"Variables: cur\n",
"Operations: \n",
"ApplyRule((z1|->BOT|->z1),[],[(symbol|->a|->symbol),(symbol|->b|->symbol)],[])"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":browse"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Executed operation: ApplyRule((z1|->BOT|->z1),[],[(symbol|->a|->symbol),(symbol|->b|->symbol)],[])"
]
},
"execution_count": 31,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -202,6 +475,66 @@
...
@@ -202,6 +475,66 @@
":exec ApplyRule"
":exec ApplyRule"
]
]
},
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"<table style=\"font-family:monospace\"><tbody>\n",
"<tr>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">a</td>\n",
"<td style=\"padding:10px\">b</td>\n",
"</tr>\n",
"<tr>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"<td style=\"padding:10px\">symbol</td>\n",
"</tr>\n",
"</tbody></table>"
],
"text/plain": [
"<Animation function visualisation>"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":show"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Machine: PDA_to_CFG\n",
"Sets: STATES, SYMBOLS\n",
"Constants: delta, Productions\n",
"Variables: cur\n",
"Operations: "
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":browse"
]
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": null,
"execution_count": null,
...
...
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# PDA nach kfG
# PDA nach kfG
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
::load
::load
MACHINE PDA_to_CFG
MACHINE PDA_to_CFG
/* Translating a PDA to a CFG */
/* Translating a PDA to a CFG */
SETS
SETS
STATES = {z0,z1, symbol};
STATES = {z0,z1, symbol};
/* symbol: virtueller Zustand um S und andere Symbole in der Grammatik darzustellen */
SYMBOLS={a,b, A, BOT, lambda, S} /* BOT = # = bottom of stack*/
SYMBOLS={a,b, A, BOT, lambda, S} /* BOT = # = bottom of stack*/
DEFINITIONS
DEFINITIONS
CFG_Alphabet == (STATES*(SYMBOLS-{lambda})*STATES);
CFG_Alphabet == (STATES*(SYMBOLS-{lambda})*STATES);
Σ == {a,b};
Σ == {a,b};
Γ == {A,BOT};
Γ == {A,BOT};
ANIMATION_FUNCTION1 == {r,c,i| r=1 ∧ c∈dom(cur) ∧ i=prj1(STATES,SYMBOLS)(prj1(STATES*SYMBOLS,STATES)(cur(c)))};
ANIMATION_FUNCTION1 == {r,c,i| r=1 ∧ c∈dom(cur) ∧ i=prj1(STATES,SYMBOLS)(prj1(STATES*SYMBOLS,STATES)(cur(c)))};
ANIMATION_FUNCTION2 == {r,c,i| r=2 ∧ c∈dom(cur) ∧ i=prj2(STATES,SYMBOLS)(prj1(STATES*SYMBOLS,STATES)(cur(c)))};
ANIMATION_FUNCTION2 == {r,c,i| r=2 ∧ c∈dom(cur) ∧ i=prj2(STATES,SYMBOLS)(prj1(STATES*SYMBOLS,STATES)(cur(c)))};
ANIMATION_FUNCTION3 == {r,c,i| r=3 ∧ c∈dom(cur) ∧ i=prj2(STATES*SYMBOLS,STATES)(cur(c))};
ANIMATION_FUNCTION3 == {r,c,i| r=3 ∧ c∈dom(cur) ∧ i=prj2(STATES*SYMBOLS,STATES)(cur(c))};
ANIMATION_STR_JUSTIFY_LEFT == TRUE;
ANIMATION_STR_JUSTIFY_LEFT == TRUE;
SET_PREF_PP_SEQUENCES == TRUE;
SET_PREF_PP_SEQUENCES == TRUE;
PDA_STATES == (STATES-{symbol});
PDA_STATES == (STATES-{symbol});
SYMS(s) == IF (s=lambda) THEN [] ELSE [SYM(s)] END;
SYMS(s) == IF (s=lambda) THEN [] ELSE [SYM(s)] END;
SYM(s) == (symbol,s,symbol);
SYM(s) == (symbol,s,symbol);
TERMINALS == {x|∃t.(t∈Σ ∧ x=SYM(t))}
TERMINALS == {x|∃t.(t∈Σ ∧ x=SYM(t))}
CONSTANTS delta, Productions
CONSTANTS delta, Productions
PROPERTIES
PROPERTIES
/* A PDA accepting {a^mb^m| m≥1} ; Beispiel von Info 4 (Folie 95ff) */
/* A PDA accepting {a^mb^m| m≥1} ; Beispiel von Info 4 (Folie 95ff) */
delta = { (z0,a,BOT) ↦ (z0,[A,BOT]),
delta = { (z0,a,BOT) ↦ (z0,[A,BOT]),
(z0,a,A) ↦ (z0,[A,A]),
(z0,a,A) ↦ (z0,[A,A]),
(z0,b,A) ↦ (z1,[]),
(z0,b,A) ↦ (z1,[]),
(z1,lambda,BOT) ↦ (z1,[]),
(z1,lambda,BOT) ↦ (z1,[]),
(z1,b,A) ↦ (z1,[]) } ∧
(z1,b,A) ↦ (z1,[]) } ∧
Productions = /* Punkt 1 Folie 109 */
Productions = /* Punkt 1 Folie 109 */
{ lhs,rhs | ∃z.(z∈PDA_STATES ∧ lhs=SYM(S) ∧ rhs = [(z0,BOT,z)])}
{ lhs,rhs | ∃z.(z∈PDA_STATES ∧ lhs=SYM(S) ∧ rhs = [(z0,BOT,z)])}
∪
∪
/* Punkt 2 Folie 109 */
/* Punkt 2 Folie 109 */
{ lhs,rhs | ∃(z,a,A,z2).((z,a,A)↦(z2,[])∈delta ∧
{ lhs,rhs | ∃(z,a,A,z2).((z,a,A)↦(z2,[])∈delta ∧
lhs=(z,A,z2) ∧ rhs = SYMS(a)) }
lhs=(z,A,z2) ∧ rhs = SYMS(a)) }
∪
∪
/* Punkt 3 Folie 110 */
/* Punkt 3 Folie 110 */
{ lhs,rhs | ∃(z,a,A,B,z1,z2).((z,a,A)↦(z1,[B])∈delta ∧ z2∈PDA_STATES ∧
{ lhs,rhs | ∃(z,a,A,B,z1,z2).((z,a,A)↦(z1,[B])∈delta ∧ z2∈PDA_STATES ∧
lhs=(z,A,z2) ∧ rhs = SYMS(a)^[(z1,B,z2)]) }
lhs=(z,A,z2) ∧ rhs = SYMS(a)^[(z1,B,z2)]) }
∪
∪
/* Punkt 4 Folie 110 */
/* Punkt 4 Folie 110 */
{ lhs,rhs | ∃(z,a,A,B,C,z1,z2,z3).((z,a,A)↦(z1,[B,C])∈delta ∧
{ lhs,rhs | ∃(z,a,A,B,C,z1,z2,z3).((z,a,A)↦(z1,[B,C])∈delta ∧
z2∈PDA_STATES ∧ z3∈PDA_STATES ∧
z2∈PDA_STATES ∧ z3∈PDA_STATES ∧
lhs=(z,A,z3) ∧ rhs = SYMS(a)^[(z1,B,z2),(z2,C,z3)]) }
lhs=(z,A,z3) ∧ rhs = SYMS(a)^[(z1,B,z2),(z2,C,z3)]) }
VARIABLES cur
VARIABLES cur
INVARIANT
INVARIANT
cur ∈ seq(CFG_Alphabet)
cur ∈ seq(CFG_Alphabet)
INITIALISATION cur:=SYMS(S)
INITIALISATION cur:=SYMS(S)
OPERATIONS
OPERATIONS
ApplyRule(LHS,RHS,pre,post) = PRE LHS↦RHS ∈ Productions ∧
ApplyRule(LHS,RHS,pre,post) = PRE LHS↦RHS ∈ Productions ∧
cur = pre^[LHS]^post ∧
cur = pre^[LHS]^post ∧
ran(pre) ⊆ TERMINALS /* Links Ableitung */
ran(pre) ⊆ TERMINALS /* Links Ableitung */
THEN
THEN
cur := pre^RHS^post
cur := pre^RHS^post
END
END
END
END
```
```
%% Output
%% Output
Loaded machine: PDA_to_CFG
Loaded machine: PDA_to_CFG
%% 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
:init
:init
```
```
%% Output
%% Output
Machine initialised using operation 1: $initialise_machine()
Machine initialised using operation 1: $initialise_machine()
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
delta
```
%% Output
$\{(\mathit{z0}\mapsto \mathit{a}\mapsto \mathit{A}\mapsto(\mathit{z0}\mapsto [A,A])),(\mathit{z0}\mapsto \mathit{a}\mapsto \mathit{BOT}\mapsto(\mathit{z0}\mapsto [A,BOT])),(\mathit{z0}\mapsto \mathit{b}\mapsto \mathit{A}\mapsto(\mathit{z1}\mapsto [])),(\mathit{z1}\mapsto \mathit{b}\mapsto \mathit{A}\mapsto(\mathit{z1}\mapsto [])),(\mathit{z1}\mapsto \mathit{lambda}\mapsto \mathit{BOT}\mapsto(\mathit{z1}\mapsto []))\}$
{(z0↦a↦A↦(z0↦[A,A])),(z0↦a↦BOT↦(z0↦[A,BOT])),(z0↦b↦A↦(z1↦[])),(z1↦b↦A↦(z1↦[])),(z1↦lambda↦BOT↦(z1↦[]))}
%% Cell type:code id: tags:
```
prob
:show
:show
```
```
%% Output
%% Output
<table style="font-family:monospace"><tbody>
<table style="font-family:monospace"><tbody>
<tr>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">symbol</td>
</tr>
</tr>
<tr>
<tr>
<td style="padding:10px">S</td>
<td style="padding:10px">S</td>
</tr>
</tr>
<tr>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">symbol</td>
</tr>
</tr>
</tbody></table>
</tbody></table>
<Animation function visualisation>
<Animation function visualisation>
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:browse
:browse
```
```
%% Output
%% Output
Machine: PDA_to_CFG
Machine: PDA_to_CFG
Sets: STATES, SYMBOLS
Sets: STATES, SYMBOLS
Constants: delta, Productions
Constants: delta, Productions
Variables: cur
Variables: cur
Operations:
Operations:
ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z0)],[],[])
ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z0)],[],[])
ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])
ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
prob
```
prob
:exec ApplyRule RHS = [(z0|->BOT|->z1)]
```
%% Output
Executed operation: ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])
%% Cell type:code id: tags:
```
prob
:show
```
%% Output
<table style="font-family:monospace"><tbody>
<tr>
<td style="padding:10px">z0</td>
</tr>
<tr>
<td style="padding:10px">BOT</td>
</tr>
<tr>
<td style="padding:10px">z1</td>
</tr>
</tbody></table>
<Animation function visualisation>
%% Cell type:code id: tags:
```
prob
:browse
```
%% Output
Machine: PDA_to_CFG
Sets: STATES, SYMBOLS
Constants: delta, Productions
Variables: cur
Operations:
ApplyRule((z0|->BOT|->z1),[(symbol|->a|->symbol),(z0|->A|->z0),(z0|->BOT|->z1)],[],[])
ApplyRule((z0|->BOT|->z1),[(symbol|->a|->symbol),(z0|->A|->z1),(z1|->BOT|->z1)],[],[])
%% Cell type:code id: tags:
```
prob
:exec ApplyRule RHS = [(symbol|->a|->symbol),(z0|->A|->z1),(z1|->BOT|->z1)]
```
%% Output
Executed operation: ApplyRule((z0|->BOT|->z1),[(symbol|->a|->symbol),(z0|->A|->z1),(z1|->BOT|->z1)],[],[])
%% Cell type:code id: tags:
```
prob
:show
```
%% Output
<table style="font-family:monospace"><tbody>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">z0</td>
<td style="padding:10px">z1</td>
</tr>
<tr>
<td style="padding:10px">a</td>
<td style="padding:10px">A</td>
<td style="padding:10px">BOT</td>
</tr>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">z1</td>
<td style="padding:10px">z1</td>
</tr>
</tbody></table>
<Animation function visualisation>
%% Cell type:code id: tags:
```
prob
:browse
```
%% Output
Machine: PDA_to_CFG
Sets: STATES, SYMBOLS
Constants: delta, Productions
Variables: cur
Operations:
ApplyRule((z0|->A|->z1),[(symbol|->b|->symbol)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])
ApplyRule((z0|->A|->z1),[(symbol|->a|->symbol),(z0|->A|->z0),(z0|->A|->z1)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])
ApplyRule((z0|->A|->z1),[(symbol|->a|->symbol),(z0|->A|->z1),(z1|->A|->z1)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])
%% Cell type:code id: tags:
```
prob
:exec ApplyRule RHS=[(symbol|->b|->symbol)]
```
%% Output
Executed operation: ApplyRule((z0|->A|->z1),[(symbol|->b|->symbol)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])
%% Cell type:code id: tags:
```
prob
:show
```
%% Output
<table style="font-family:monospace"><tbody>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">symbol</td>
<td style="padding:10px">z1</td>
</tr>
<tr>
<td style="padding:10px">a</td>
<td style="padding:10px">b</td>
<td style="padding:10px">BOT</td>
</tr>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">symbol</td>
<td style="padding:10px">z1</td>
</tr>
</tbody></table>
<Animation function visualisation>
%% Cell type:code id: tags:
```
prob
:browse
```
%% Output
Machine: PDA_to_CFG
Sets: STATES, SYMBOLS
Constants: delta, Productions
Variables: cur
Operations:
ApplyRule((z1|->BOT|->z1),[],[(symbol|->a|->symbol),(symbol|->b|->symbol)],[])
%% Cell type:code id: tags:
```
prob
:exec ApplyRule
:exec ApplyRule
```
```
%% Output
%% Output
Executed operation: ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z0)],[],[])
Executed operation: ApplyRule((z1|->BOT|->z1),[],[(symbol|->a|->symbol),(symbol|->b|->symbol)],[])
%% Cell type:code id: tags:
```
prob
:show
```
%% Output
<table style="font-family:monospace"><tbody>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">symbol</td>
</tr>
<tr>
<td style="padding:10px">a</td>
<td style="padding:10px">b</td>
</tr>
<tr>
<td style="padding:10px">symbol</td>
<td style="padding:10px">symbol</td>
</tr>
</tbody></table>
<Animation function visualisation>
%% Cell type:code id: tags:
```
prob
:browse
```
%% Output
Machine: PDA_to_CFG
Sets: STATES, SYMBOLS
Constants: delta, Productions
Variables: cur
Operations:
%% 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