Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
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
Project: cocalc-sagemath-dev-slelievre
Views: 4183461[1X4 [33X[0;0YFrom Networks to Automata[133X[101X23[33X[0;0YIt is known that the language of all encoded permutations of a TPN is4rational, and thus is it indeed possible to turn a TPN into an automaton.5The idea is to inspect all dispositions of tokens within the TPN and find6equivalence classes of these dispositions, for more details consult [3].7Adding a constraint, which limits the number of tokens at any time within8the TPN, is also considered in this chapter.[133X910[33X[0;0YThe algorithms featured in this chapter do not return the minimal automata11representing the input TPN as they are exactly visualising the equivalence12classes of the dispositions of the tokens in the TPN. The automaton can be13minimalised by choice, as it simplifies future computations involving the14automaton also is makes the automata more legible.[133X151617[1X4.1 [33X[0;0YFunctions[133X[101X1819[1X4.1-1 GraphToAut[101X2021[29X[2XGraphToAut[102X( [3Xg[103X, [3Xinnode[103X, [3Xoutnode[103X ) [32X function22[6XReturns:[106X [33X[0;10YAn automaton representing the input TPN.[133X2324[33X[0;0Y[10XGraphToAut[110X turns an array represented directed graph, with a distinct input25node and a distinct output node, into the corresponding automaton, that26accepts the language build by the resulting rank encoded permutations of the27directed graph.[133X2829[4X[32X Example [32X[104X30[4X[25Xgap>[125X [27Xx:=Seqstacks(2,2);[127X[104X31[4X[28X[ [ 2 ], [ 3, 4 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ][128X[104X32[4X[25Xgap>[125X [27Xaut:=GraphToAut(x,1,6);[127X[104X33[4X[28X< epsilon automaton on 4 letters with 64 states >[128X[104X34[4X[25Xgap>[125X [27Xaut:=MinimalAutomaton(aut);[127X[104X35[4X[28X< deterministic automaton on 3 letters with 3 states >[128X[104X36[4X[25Xgap>[125X [27XDisplay(aut);[127X[104X37[4X[28X | 1 2 3 [128X[104X38[4X[28X--------------[128X[104X39[4X[28X a | 1 3 1 [128X[104X40[4X[28X b | 3 3 3 [128X[104X41[4X[28X c | 2 2 2 [128X[104X42[4X[28XInitial state: [ 1 ][128X[104X43[4X[28XAccepting state: [ 1 ][128X[104X44[4X[25Xgap>[125X [27X[127X[104X45[4X[32X[104X4647[4X[32X Example [32X[104X48[4X[25Xgap>[125X [27Xx:=Parstacks(2,2);[127X[104X49[4X[28X[ [ 2, 4 ], [ 3, 6 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ][128X[104X50[4X[25Xgap>[125X [27Xaut:=GraphToAut(x,1,6);[127X[104X51[4X[28X< epsilon automaton on 5 letters with 66 states >[128X[104X52[4X[25Xgap>[125X [27Xaut:=MinimalAutomaton(aut);[127X[104X53[4X[28X< deterministic automaton on 4 letters with 9 states >[128X[104X54[4X[25Xgap>[125X [27XDisplay(aut);[127X[104X55[4X[28X | 1 2 3 4 5 6 7 8 9 [128X[104X56[4X[28X--------------------------------[128X[104X57[4X[28X a | 1 2 1 3 2 2 6 6 3 [128X[104X58[4X[28X b | 3 2 3 3 4 3 6 9 3 [128X[104X59[4X[28X c | 9 2 9 4 6 6 4 9 9 [128X[104X60[4X[28X d | 8 2 8 7 5 5 7 8 8 [128X[104X61[4X[28XInitial state: [ 1 ][128X[104X62[4X[28XAccepting state: [ 1 ][128X[104X63[4X[25Xgap>[125X [27X[127X[104X64[4X[32X[104X6566[4X[32X Example [32X[104X67[4X[25Xgap>[125X [27Xx:=BufferAndStack(3,2);[127X[104X68[4X[28X[ [ 2 .. 4 ], [ 5 ], [ 5 ], [ 5 ], [ 6, 7 ], [ 5 ], [ ] ][128X[104X69[4X[25Xgap>[125X [27Xaut:=GraphToAut(x,1,7);[127X[104X70[4X[28X< epsilon automaton on 5 letters with 460 states >[128X[104X71[4X[25Xgap>[125X [27Xaut:=MinimalAutomaton(aut);[127X[104X72[4X[28X< deterministic automaton on 4 letters with 4 states >[128X[104X73[4X[25Xgap>[125X [27XDisplay(aut);[127X[104X74[4X[28X | 1 2 3 4 [128X[104X75[4X[28X-----------------[128X[104X76[4X[28X a | 1 4 1 3 [128X[104X77[4X[28X b | 3 4 3 3 [128X[104X78[4X[28X c | 4 4 4 4 [128X[104X79[4X[28X d | 2 2 2 2 [128X[104X80[4X[28XInitial state: [ 1 ][128X[104X81[4X[28XAccepting state: [ 1 ][128X[104X82[4X[25Xgap>[125X [27X[127X[104X83[4X[32X[104X8485[4X[32X Example [32X[104X86[4X[25Xgap>[125X [27Xx:=[[2,3],[4],[5],[3,6],[6],[]];[127X[104X87[4X[28X[ [ 2, 3 ], [ 4 ], [ 5 ], [ 3, 6 ], [ 6 ], [ ] ][128X[104X88[4X[25Xgap>[125X [27Xaut:=GraphToAut(x,1,6);[127X[104X89[4X[28X< epsilon automaton on 4 letters with 80 states >[128X[104X90[4X[25Xgap>[125X [27Xaut:=MinimalAutomaton(aut);[127X[104X91[4X[28X< deterministic automaton on 3 letters with 8 states >[128X[104X92[4X[25Xgap>[125X [27XDisplay(aut);[127X[104X93[4X[28X | 1 2 3 4 5 6 7 8 [128X[104X94[4X[28X-----------------------------[128X[104X95[4X[28X a | 1 3 1 4 6 1 6 1 [128X[104X96[4X[28X b | 3 8 3 4 4 6 6 6 [128X[104X97[4X[28X c | 2 2 2 4 5 5 7 7 [128X[104X98[4X[28XInitial state: [ 1 ][128X[104X99[4X[28XAccepting state: [ 1 ][128X[104X100[4X[25Xgap>[125X [27X[127X[104X101[4X[32X[104X102103[33X[0;0YThe input TPN here is the first network described in Chapter [14X2.[114X.[133X104105[1X4.1-2 ConstrainedGraphToAut[101X106107[29X[2XConstrainedGraphToAut[102X( [3Xg[103X, [3Xinnode[103X, [3Xoutnode[103X, [3Xcapacity[103X ) [32X function108[6XReturns:[106X [33X[0;10YAn automaton representing the input TPN with bounded capacity.[133X109110[33X[0;0Y[10XConstrainedGraphToAut[110X builds an epsilon automaton based on the same idea as111[10XGraphToAut[110X, so it takes a list representation of a directed graph, a112designated input node and a distinct output node, but additionally there is113the constraint that there can be at most [10Xcapacity[110X tokens in the graph, at114any time.[133X115116[4X[32X Example [32X[104X117[4X[25Xgap>[125X [27Xx:=Seqstacks(2,2); [127X[104X118[4X[28X[ [ 2 ], [ 3, 4 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ][128X[104X119[4X[25Xgap>[125X [27Xaut:=ConstrainedGraphToAut(x,1,6,2);[127X[104X120[4X[28X< epsilon automaton on 6 letters with 21 states >[128X[104X121[4X[25Xgap>[125X [27Xaut:=MinimalAutomaton(aut); [127X[104X122[4X[28X< deterministic automaton on 5 letters with 3 states >[128X[104X123[4X[25Xgap>[125X [27XDisplay(aut); [127X[104X124[4X[28X | 1 2 3 [128X[104X125[4X[28X--------------[128X[104X126[4X[28X a | 1 2 1 [128X[104X127[4X[28X b | 3 2 3 [128X[104X128[4X[28X c | 2 2 2 [128X[104X129[4X[28X d | 2 2 2 [128X[104X130[4X[28X e | 2 2 2 [128X[104X131[4X[28XInitial state: [ 1 ][128X[104X132[4X[28XAccepting state: [ 1 ][128X[104X133[4X[25Xgap>[125X [27X[127X[104X134[4X[32X[104X135136[4X[32X Example [32X[104X137[4X[25Xgap>[125X [27Xx:=BufferAndStack(3,2); [127X[104X138[4X[28X[ [ 2 .. 4 ], [ 5 ], [ 5 ], [ 5 ], [ 6, 7 ], [ 5 ], [ ] ][128X[104X139[4X[25Xgap>[125X [27Xaut:=ConstrainedGraphToAut(x,1,6,3);[127X[104X140[4X[28X< epsilon automaton on 7 letters with 112 states >[128X[104X141[4X[25Xgap>[125X [27Xaut:=MinimalAutomaton(aut);[127X[104X142[4X[28X< deterministic automaton on 6 letters with 4 states >[128X[104X143[4X[25Xgap>[125X [27XDisplay(aut);[127X[104X144[4X[28X | 1 2 3 4 [128X[104X145[4X[28X-----------------[128X[104X146[4X[28X a | 1 2 1 3 [128X[104X147[4X[28X b | 3 2 3 3 [128X[104X148[4X[28X c | 4 2 4 4 [128X[104X149[4X[28X d | 2 2 2 2 [128X[104X150[4X[28X e | 2 2 2 2 [128X[104X151[4X[28X f | 2 2 2 2 [128X[104X152[4X[28XInitial state: [ 1 ][128X[104X153[4X[28XAccepting state: [ 1 ][128X[104X154[4X[25Xgap>[125X [27X[127X[104X155[4X[32X[104X156157[4X[32X Example [32X[104X158[4X[25Xgap>[125X [27Xx:=[[2,3],[4],[5],[3,6],[6],[]]; [127X[104X159[4X[28X[ [ 2, 3 ], [ 4 ], [ 5 ], [ 3, 6 ], [ 6 ], [ ] ][128X[104X160[4X[25Xgap>[125X [27Xaut:=ConstrainedGraphToAut(x,1,6,3);[127X[104X161[4X[28X< epsilon automaton on 6 letters with 48 states >[128X[104X162[4X[25Xgap>[125X [27Xaut:=MinimalAutomaton(aut); [127X[104X163[4X[28X< deterministic automaton on 5 letters with 8 states >[128X[104X164[4X[25Xgap>[125X [27XDisplay(aut); [127X[104X165[4X[28X | 1 2 3 4 5 6 7 8 [128X[104X166[4X[28X-----------------------------[128X[104X167[4X[28X a | 1 3 1 4 6 1 6 1 [128X[104X168[4X[28X b | 3 8 3 4 4 6 6 6 [128X[104X169[4X[28X c | 2 2 2 4 5 5 7 7 [128X[104X170[4X[28X d | 4 4 4 4 4 4 4 4 [128X[104X171[4X[28X e | 4 4 4 4 4 4 4 4 [128X[104X172[4X[28XInitial state: [ 1 ][128X[104X173[4X[28XAccepting state: [ 1 ][128X[104X174[4X[25Xgap>[125X [27X[127X[104X175[4X[32X[104X176177178179