"Im folgenden werden wir uns damit befassen wie die verschiedenen Automatenmodelle in Verbinndung stehen und wie man sie ineinander übersetzt.\n",
"\n",
"Wie bereits aus der Vorlesung bekannt ist, akzeptieren DFAs reguläre, PDAs kontextfreie und Turingmaschienen $\\mathbb{L}_0$ Sprachen. Da die $REG\\subseteq CF \\subseteq \\mathbb{L}_0$ kann jeder DFA durch einen PDA und jeder PDA durch eine TM dargestellt werden. Folgende Maschiene demonstriert eine Möglichkeit dies zu tun:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Loaded machine: DFA_PDA_TM"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"MACHINE DFA_PDA_TM\n",
"/* B Modell einer 1-band Turing Maschine */\n",
"/* by Michael Leuschel, 2012 */\n",
"/* Akzeptiert die Sprache a^n b^n c^n (siehe Folien 14ff von folien-kapitel-5 */\n",
"Machine constants set up using operation 0: $setup_constants()"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":constants DFA=({a, b}, //Σ\n",
" {z0,z1,z2,z3}, //Z\n",
" {(z0,a)↦z1, (z0,b)↦z3,\n",
" (z1,a)↦z3, (z1,b)↦z2,\n",
" (z2,a)↦z2, (z2,b)↦z2,\n",
" (z3,a)↦z3, (z3,b)↦z3 }, //δ\n",
" z0, {z0, z2}) //z0, F"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"```\n",
":dot COMMAND [FORMULA]\n",
"```\n",
"\n",
"Execute and show a dot visualisation.\n",
"\n",
"The following dot visualisation commands are available:\n",
"\n",
"* `machine_hierarchy` - Machine Hierarchy: Shows the machine hierarchy of a classical B model\n",
"* `operations` - Operation Call Graph: Shows the call graph of a classical B model\n",
"* `event_hierarchy` - Event Hierarchy: Shows the event hierarchy of an Event-B model\n",
"* `state_space` - State Space: Show state space\n",
"* `state_space_sfdp` - State Space (Fast): Show state space (fast)\n",
"* `current_state` - Current State in State Space: Show current state and successors in state space\n",
"* `history` - Path to Current State: Show a path leading to current state\n",
"* `signature_merge` - Signature Merge: Show signature-merged reduced state space\n",
"* `dfa_merge` - DFA Merge: Show state space as deterministic automaton (DFA)\n",
"* `transition_diagram` - State Space Expression Projection...: Project state space onto expression values and show transition diagram\n",
"* `enable_graph` - Enable Graph: Show enabling graph of events\n",
"* `state_as_graph` - Current State as Graph: Show values in current state as a graph\n",
"* `custom_graph` - Customized Current State as Graph: Show values in current state as a graph using CUSTOM_GRAPH_EDGES\n",
"* `expr_as_graph` - (Relational) Expression as Graph...: Show (relational) expression value as a graph\n",
"* `formula_tree` - Custom Predicate/Expression Formula Tree...: Show predicate/expressions and sub-formulas as a tree\n",
"* `invariant` - Invariant Formula Tree: Show invariant as a formula tree\n",
"* `properties` - Properties Formula Tree: Show properties as a formula tree\n",
"* `assertions` - Assertions Formula Tree: Show assertions as a formula tree\n",
"* `deadlock` - Deadlock Formula Tree: Show deadlocking status as a formula tree\n",
"* `goal` - Goal Formula Tree: Show GOAL as a formula tree\n",
"* `dependence_graph` - Dependence Graph: Show dependence graph of events\n",
"* `variable_modification_graph` - Variable Read/Write Graph: Show variable modification by operations and reading in guards\n",
"* `definitions` - Definitions Graph: Show dependence graph of DEFINITIONS\n",
"* `predicate_dependency` - Predicate Dependency Graph...: Show dependence graph of conjuncts of a predicate\n",
"* `last_error` - Last Error Formula Tree: Show last error source as a formula tree\n"
],
"text/plain": [
":dot COMMAND [FORMULA]\n",
"Execute and show a dot visualisation.\n",
"\n",
"The following dot visualisation commands are available:\n",
"\n",
"* `machine_hierarchy` - Machine Hierarchy: Shows the machine hierarchy of a classical B model\n",
"* `operations` - Operation Call Graph: Shows the call graph of a classical B model\n",
"* `event_hierarchy` - Event Hierarchy: Shows the event hierarchy of an Event-B model\n",
"* `state_space` - State Space: Show state space\n",
"* `state_space_sfdp` - State Space (Fast): Show state space (fast)\n",
"* `current_state` - Current State in State Space: Show current state and successors in state space\n",
"* `history` - Path to Current State: Show a path leading to current state\n",
"* `signature_merge` - Signature Merge: Show signature-merged reduced state space\n",
"* `dfa_merge` - DFA Merge: Show state space as deterministic automaton (DFA)\n",
"* `transition_diagram` - State Space Expression Projection...: Project state space onto expression values and show transition diagram\n",
"* `enable_graph` - Enable Graph: Show enabling graph of events\n",
"* `state_as_graph` - Current State as Graph: Show values in current state as a graph\n",
"* `custom_graph` - Customized Current State as Graph: Show values in current state as a graph using CUSTOM_GRAPH_EDGES\n",
"* `expr_as_graph` - (Relational) Expression as Graph...: Show (relational) expression value as a graph\n",
"* `formula_tree` - Custom Predicate/Expression Formula Tree...: Show predicate/expressions and sub-formulas as a tree\n",
"* `invariant` - Invariant Formula Tree: Show invariant as a formula tree\n",
"* `properties` - Properties Formula Tree: Show properties as a formula tree\n",
"* `assertions` - Assertions Formula Tree: Show assertions as a formula tree\n",
"* `deadlock` - Deadlock Formula Tree: Show deadlocking status as a formula tree\n",
"* `goal` - Goal Formula Tree: Show GOAL as a formula tree\n",
"* `dependence_graph` - Dependence Graph: Show dependence graph of events\n",
"* `variable_modification_graph` - Variable Read/Write Graph: Show variable modification by operations and reading in guards\n",
"* `definitions` - Definitions Graph: Show dependence graph of DEFINITIONS\n",
"* `predicate_dependency` - Predicate Dependency Graph...: Show dependence graph of conjuncts of a predicate\n",
"* `last_error` - Last Error Formula Tree: Show last error source as a formula tree\n"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
":help dot"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "ProB 2",
"language": "prob",
"name": "prob2"
},
"language_info": {
"codemirror_mode": "prob2_jupyter_repl",
"file_extension": ".prob",
"mimetype": "text/x-prob2-jupyter-repl",
"name": "prob"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
%% Cell type:markdown id: tags:
# DFAs, PDAs und TM
Im folgenden werden wir uns damit befassen wie die verschiedenen Automatenmodelle in Verbinndung stehen und wie man sie ineinander übersetzt.
Wie bereits aus der Vorlesung bekannt ist, akzeptieren DFAs reguläre, PDAs kontextfreie und Turingmaschienen $\mathbb{L}_0$ Sprachen. Da die $REG\subseteq CF \subseteq \mathbb{L}_0$ kann jeder DFA durch einen PDA und jeder PDA durch eine TM dargestellt werden. Folgende Maschiene demonstriert eine Möglichkeit dies zu tun:
%% Cell type:code id: tags:
``` prob
MACHINE DFA_PDA_TM
/* B Modell einer 1-band Turing Maschine */
/* by Michael Leuschel, 2012 */
/* Akzeptiert die Sprache a^n b^n c^n (siehe Folien 14ff von folien-kapitel-5 */