CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
2
4 From Networks to Automata
3
4
It is known that the language of all encoded permutations of a TPN is
5
rational, and thus is it indeed possible to turn a TPN into an automaton.
6
The idea is to inspect all dispositions of tokens within the TPN and find
7
equivalence classes of these dispositions, for more details consult [3].
8
Adding a constraint, which limits the number of tokens at any time within
9
the TPN, is also considered in this chapter.
10
11
The algorithms featured in this chapter do not return the minimal automata
12
representing the input TPN as they are exactly visualising the equivalence
13
classes of the dispositions of the tokens in the TPN. The automaton can be
14
minimalised by choice, as it simplifies future computations involving the
15
automaton also is makes the automata more legible.
16
17
18
4.1 Functions
19
20
4.1-1 GraphToAut
21
22
GraphToAut( g, innode, outnode )  function
23
Returns: An automaton representing the input TPN.
24
25
GraphToAut turns an array represented directed graph, with a distinct input
26
node and a distinct output node, into the corresponding automaton, that
27
accepts the language build by the resulting rank encoded permutations of the
28
directed graph.
29
30
 Example 
31
gap> x:=Seqstacks(2,2);
32
[ [ 2 ], [ 3, 4 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ]
33
gap> aut:=GraphToAut(x,1,6);
34
< epsilon automaton on 4 letters with 64 states >
35
gap> aut:=MinimalAutomaton(aut);
36
< deterministic automaton on 3 letters with 3 states >
37
gap> Display(aut);
38
 | 1 2 3 
39
--------------
40
 a | 1 3 1 
41
 b | 3 3 3 
42
 c | 2 2 2 
43
Initial state: [ 1 ]
44
Accepting state: [ 1 ]
45
gap> 
46

47
48
 Example 
49
gap> x:=Parstacks(2,2);
50
[ [ 2, 4 ], [ 3, 6 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ]
51
gap> aut:=GraphToAut(x,1,6);
52
< epsilon automaton on 5 letters with 66 states >
53
gap> aut:=MinimalAutomaton(aut);
54
< deterministic automaton on 4 letters with 9 states >
55
gap> Display(aut);
56
 | 1 2 3 4 5 6 7 8 9 
57
--------------------------------
58
 a | 1 2 1 3 2 2 6 6 3 
59
 b | 3 2 3 3 4 3 6 9 3 
60
 c | 9 2 9 4 6 6 4 9 9 
61
 d | 8 2 8 7 5 5 7 8 8 
62
Initial state: [ 1 ]
63
Accepting state: [ 1 ]
64
gap> 
65

66
67
 Example 
68
gap> x:=BufferAndStack(3,2);
69
[ [ 2 .. 4 ], [ 5 ], [ 5 ], [ 5 ], [ 6, 7 ], [ 5 ], [ ] ]
70
gap> aut:=GraphToAut(x,1,7);
71
< epsilon automaton on 5 letters with 460 states >
72
gap> aut:=MinimalAutomaton(aut);
73
< deterministic automaton on 4 letters with 4 states >
74
gap> Display(aut);
75
 | 1 2 3 4 
76
-----------------
77
 a | 1 4 1 3 
78
 b | 3 4 3 3 
79
 c | 4 4 4 4 
80
 d | 2 2 2 2 
81
Initial state: [ 1 ]
82
Accepting state: [ 1 ]
83
gap> 
84

85
86
 Example 
87
gap> x:=[[2,3],[4],[5],[3,6],[6],[]];
88
[ [ 2, 3 ], [ 4 ], [ 5 ], [ 3, 6 ], [ 6 ], [ ] ]
89
gap> aut:=GraphToAut(x,1,6);
90
< epsilon automaton on 4 letters with 80 states >
91
gap> aut:=MinimalAutomaton(aut);
92
< deterministic automaton on 3 letters with 8 states >
93
gap> Display(aut);
94
 | 1 2 3 4 5 6 7 8 
95
-----------------------------
96
 a | 1 3 1 4 6 1 6 1 
97
 b | 3 8 3 4 4 6 6 6 
98
 c | 2 2 2 4 5 5 7 7 
99
Initial state: [ 1 ]
100
Accepting state: [ 1 ]
101
gap> 
102

103
104
The input TPN here is the first network described in Chapter 2..
105
106
4.1-2 ConstrainedGraphToAut
107
108
ConstrainedGraphToAut( g, innode, outnode, capacity )  function
109
Returns: An automaton representing the input TPN with bounded capacity.
110
111
ConstrainedGraphToAut builds an epsilon automaton based on the same idea as
112
GraphToAut, so it takes a list representation of a directed graph, a
113
designated input node and a distinct output node, but additionally there is
114
the constraint that there can be at most capacity tokens in the graph, at
115
any time.
116
117
 Example 
118
gap> x:=Seqstacks(2,2); 
119
[ [ 2 ], [ 3, 4 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ]
120
gap> aut:=ConstrainedGraphToAut(x,1,6,2);
121
< epsilon automaton on 6 letters with 21 states >
122
gap> aut:=MinimalAutomaton(aut); 
123
< deterministic automaton on 5 letters with 3 states >
124
gap> Display(aut); 
125
 | 1 2 3 
126
--------------
127
 a | 1 2 1 
128
 b | 3 2 3 
129
 c | 2 2 2 
130
 d | 2 2 2 
131
 e | 2 2 2 
132
Initial state: [ 1 ]
133
Accepting state: [ 1 ]
134
gap> 
135

136
137
 Example 
138
gap> x:=BufferAndStack(3,2); 
139
[ [ 2 .. 4 ], [ 5 ], [ 5 ], [ 5 ], [ 6, 7 ], [ 5 ], [ ] ]
140
gap> aut:=ConstrainedGraphToAut(x,1,6,3);
141
< epsilon automaton on 7 letters with 112 states >
142
gap> aut:=MinimalAutomaton(aut);
143
< deterministic automaton on 6 letters with 4 states >
144
gap> Display(aut);
145
 | 1 2 3 4 
146
-----------------
147
 a | 1 2 1 3 
148
 b | 3 2 3 3 
149
 c | 4 2 4 4 
150
 d | 2 2 2 2 
151
 e | 2 2 2 2 
152
 f | 2 2 2 2 
153
Initial state: [ 1 ]
154
Accepting state: [ 1 ]
155
gap> 
156

157
158
 Example 
159
gap> x:=[[2,3],[4],[5],[3,6],[6],[]]; 
160
[ [ 2, 3 ], [ 4 ], [ 5 ], [ 3, 6 ], [ 6 ], [ ] ]
161
gap> aut:=ConstrainedGraphToAut(x,1,6,3);
162
< epsilon automaton on 6 letters with 48 states >
163
gap> aut:=MinimalAutomaton(aut); 
164
< deterministic automaton on 5 letters with 8 states >
165
gap> Display(aut); 
166
 | 1 2 3 4 5 6 7 8 
167
-----------------------------
168
 a | 1 3 1 4 6 1 6 1 
169
 b | 3 8 3 4 4 6 6 6 
170
 c | 2 2 2 4 5 5 7 7 
171
 d | 4 4 4 4 4 4 4 4 
172
 e | 4 4 4 4 4 4 4 4 
173
Initial state: [ 1 ]
174
Accepting state: [ 1 ]
175
gap> 
176

177
178
179