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[1X10 [33X[0;0YMiscellaneous functions[133X[101X23[33X[0;0YThis temporary chapter is dedicated to miscellaneous functions that are4relevant to some specific ongoing research questions.[133X567[1X10.1 [33X[0;0YPermutation Inclusion Set[133X[101X89[33X[0;0YThis section is dedicated to the search of the set of permutations which lay10in between two permutations. Formally that is [22XI_π,ρ = {ρ : π ≤ ρ σ}[122X.[133X1112[1X10.1-1 InbetweenPermAutomaton[101X1314[29X[2XInbetweenPermAutomaton[102X( [3Xperm1[103X, [3Xperm2[103X ) [32X function15[6XReturns:[106X [33X[0;10YAn automaton which accepts the encoded permutations between [10Xperm1[110X16and [10Xperm2[110X where, [10Xperm2[110X is the subpermutation.[133X1718[33X[0;0Y[10XInbetweenPermAutomaton[110X creates the intersection language between the19language of all subpermutations of [10Xperm1[110X and the language of20superpermutations of [10Xperm2[110X.[133X2122[4X[32X Example [32X[104X23[4X[28X gap> InbetweenPermAutomaton([3,2,1,4,6,5],[1,2]);[128X[104X24[4X[28X < deterministic automaton on 3 letters with 8 states >[128X[104X25[4X[28X gap> Display(last);[128X[104X26[4X[28X | 1 2 3 4 5 6 7 8[128X[104X27[4X[28X -----------------------------[128X[104X28[4X[28X a | 2 2 1 1 6 3 2 6[128X[104X29[4X[28X b | 2 2 4 2 2 4 5 5[128X[104X30[4X[28X c | 2 2 2 2 2 2 2 7[128X[104X31[4X[28X Initial state: [ 8 ][128X[104X32[4X[28X Accepting states: [ 1, 3 ][128X[104X33[4X[28X gap> [128X[104X34[4X[32X[104X3536[1X10.1-2 InbetweenPermSet[101X3738[29X[2XInbetweenPermSet[102X( [3Xperm1[103X, [3Xperm2[103X ) [32X function39[6XReturns:[106X [33X[0;10YA list which contains the permutations between [10Xperm1[110X and [10Xperm2[110X40where, [10Xperm2[110X is the subpermutation.[133X4142[33X[0;0YUsing [10XInbetweenPermAutomaton[110X we create the set of all permutations laying43between the input permutations.[133X4445[4X[32X Example [32X[104X46[4X[25Xgap>[125X [27XInbetweenPermSet([3,2,1,4,6,5],[1,2]);[127X[104X47[4X[28X[ [ 1, 2 ], [ 1, 2, 3 ], [ 1, 3, 2 ], [ 2, 1, 3 ], [ 1, 2, 4, 3 ],[128X[104X48[4X[28X [ 2, 1, 3, 4 ], [ 2, 1, 4, 3 ], [ 3, 2, 1, 4 ], [ 2, 1, 3, 5, 4 ],[128X[104X49[4X[28X [ 3, 2, 1, 4, 5 ], [ 3, 2, 1, 5, 4 ], [ 3, 2, 1, 4, 6, 5 ] ][128X[104X50[4X[25Xgap>[125X [27X[127X[104X51[4X[32X[104X5253[1X10.1-3 IsSubPerm[101X5455[29X[2XIsSubPerm[102X( [3Xperm1[103X, [3Xperm2[103X ) [32X function56[6XReturns:[106X [33X[0;10Y[10Xtrue[110X if [10Xperm2[110X is a subpermutation of [10Xperm1[110X.[133X5758[33X[0;0YCreates the automaton accepting all subpermutations of [10Xperm1[110X of the same59rank or less, and checks whether the automaton accepts the rank encoding of60[10Xperm2[110X.[133X6162[4X[32X Example [32X[104X63[4X[25Xgap>[125X [27XIsSubPerm([2,4,6,8,1,3,5,7],[2,3,1]);[127X[104X64[4X[28Xtrue[128X[104X65[4X[25Xgap>[125X [27XIsSubPerm([2,4,6,8,1,3,5,7],[3,2,1]);[127X[104X66[4X[28Xfalse[128X[104X67[4X[25Xgap>[125X [27X[127X[104X68[4X[32X[104X697071[1X10.2 [33X[0;0YAutomaton Manipulation[133X[101X7273[1X10.2-1 LoopFreeAut[101X7475[29X[2XLoopFreeAut[102X( [3Xaut[103X ) [32X function76[6XReturns:[106X [33X[0;10YAn automaton without any loops of length 1.[133X7778[33X[0;0Y[10XLoopFreeAut[110X builds the subautomaton of [10Xaut[110X that does not contain any loops79of length 1, except for the sink state.[133X8081[4X[32X Example [32X[104X82[4X[25Xgap>[125X [27Xa:=Automaton("det",4,3,[[2,4,3,3],[4,4,1,4],[3,1,2,4]],[1],[2]);[127X[104X83[4X[28X< deterministic automaton on 3 letters with 4 states >[128X[104X84[4X[25Xgap>[125X [27XDisplay(a);[127X[104X85[4X[28X | 1 2 3 4[128X[104X86[4X[28X-----------------[128X[104X87[4X[28X a | 2 4 3 3[128X[104X88[4X[28X b | 4 4 1 4[128X[104X89[4X[28X c | 3 1 2 4[128X[104X90[4X[28XInitial state: [ 1 ][128X[104X91[4X[28XAccepting state: [ 2 ][128X[104X92[4X[25Xgap>[125X [27Xb:=LoopFreeAut(a);[127X[104X93[4X[28X< deterministic automaton on 3 letters with 5 states >[128X[104X94[4X[25Xgap>[125X [27XDisplay(b);[127X[104X95[4X[28X | 1 2 3 4 5[128X[104X96[4X[28X--------------------[128X[104X97[4X[28X a | 2 4 5 3 5[128X[104X98[4X[28X b | 4 4 1 5 5[128X[104X99[4X[28X c | 3 1 2 5 5[128X[104X100[4X[28XInitial state: [ 1 ][128X[104X101[4X[28XAccepting state: [ 2 ][128X[104X102[4X[25Xgap>[125X [27X[127X[104X103[4X[32X[104X104105[1X10.2-2 LoopVertexFreeAut[101X106107[29X[2XLoopVertexFreeAut[102X( [3Xaut[103X ) [32X function108[6XReturns:[106X [33X[0;10YAn automaton without any vertices that had loops of length 1.[133X109110[33X[0;0Y[10XLoopVertexFreeAut[110X builds the subautomaton that does not contain the vertices111and transitions of vertices in [10Xaut[110X that have loops of length 1. The function112minimalises and determinises the automaton before returning it, which might113change the numbering on the vertices, but the returned automaton is114isomorphic to the subautomaton of [10Xaut[110X.[133X115116[4X[32X Example [32X[104X117[4X[25Xgap>[125X [27Xa:=Automaton("det",4,3,[[2,4,3,3],[4,4,1,4],[3,1,2,4]],[1],[2]);[127X[104X118[4X[28X< deterministic automaton on 3 letters with 4 states >[128X[104X119[4X[25Xgap>[125X [27XDisplay(a);[127X[104X120[4X[28X | 1 2 3 4[128X[104X121[4X[28X-----------------[128X[104X122[4X[28X a | 2 4 3 3[128X[104X123[4X[28X b | 4 4 1 4[128X[104X124[4X[28X c | 3 1 2 4[128X[104X125[4X[28XInitial state: [ 1 ][128X[104X126[4X[28XAccepting state: [ 2 ][128X[104X127[4X[25Xgap>[125X [27Xb:=LoopVertexFreeAut(a);[127X[104X128[4X[28X< deterministic automaton on 3 letters with 3 states >[128X[104X129[4X[25Xgap>[125X [27XDisplay(b);[127X[104X130[4X[28X | 1 2 3[128X[104X131[4X[28X--------------[128X[104X132[4X[28X a | 2 2 1[128X[104X133[4X[28X b | 2 2 2[128X[104X134[4X[28X c | 3 2 2[128X[104X135[4X[28XInitial state: [ 3 ][128X[104X136[4X[28XAccepting state: [ 1 ][128X[104X137[4X[25Xgap>[125X [27X[127X[104X138[4X[32X[104X139140141142