############################################################################# ## #W aut-func.gi Manuel Delgado <mdelgado@fc.up.pt> #W Steve Linton <sal@dcs.st-and.ac.uk> if not aut!.type = "epsilon" then ## ## This file contains functions that perform operations on automata ## ## #Y Copyright (C) 2004, CMUP, Universidade do Porto, Portugal ## #############################################################################
BindGlobal("ComplementDA", da -> Automaton("det",da!.states, AlphabetOfAutomatonAsList(da), da!.transitions,
da!.initial, Difference([1..da!.states], da!.accepting)));
############################################################################# ## #F EpsilonToNFA(A) ## ## <A> is an automaton with epsilon-transitions. Returns an NFA ## recognizing the same language. ##
InstallGlobalFunction(EpsilonToNFA, functionn:=aut!states;
if not IsAutomatonObj(A) then
Error("The argument to EpsilonToNFA must be an automaton"); fi; if Length(arts then
Error(The to EpsilonToNFAbean'' automaton fi; if ;
((", 1 [], [] [java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 fi;
partmap[x] := p; end);
############################################################################# ## #F EpsilonCompactedAut(aut) ## ## Returns the compacted epsilon automaton. ##
tm := Listaut!.ransitions, t->
local n, parts, partmap, m, p, x, tm, r, i;
if not IsAutomatonObj(aut) then
Error("The argument to java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 24 fi if not aut!.type = "epsilon"then
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 7 fi;
n return Automaton("epsilon", Length(parts), AlphabetOfAutomatonAsList(aut), tm,
parts := (GraphStronglyConnectedComponents(aut.transitions[aut!.alphabet])); if Length(parts) = n then
Info(InfoAutomataSL,1,"Epsilon compacted ",aut!.states, ";
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 2
;
:]
notjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 35 for p; for in[ do
partmap[x] :ErrorThe to muste'automaton);
;
od;
iin 1a!.tates
p,-> Set(partmaptp}))java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
r =java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 for1.
=(,java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 36
od ;
Info(InfoAutomataSL,1,"Epsilon compactedjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
Automaton,(parts,(aut,tmjava.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
Set(partmap!states !- end);
############################################################################# ## #F ## ## EpsilonToNFASet(aut) ##
([]x-x aut.))java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
local#F EpsilonToNFABlist(aut)
if not IsAutomatonObj(aut) thenlocal index, eclos ,comb , newet, t, al;
Error("The argument to EpsilonToNFASet must fijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7 if aut!.ype ="psilon then
Error" to EpsilonToNFASet must be an 'epsilon' automaton"); fi;
eclos := List(aut!. [i[] ::=true; fori [..!.states
AddSet(eclos[i],i);
od;
comb =function(dig1dig2)
return List(dig1, x-> Union(dig2{x}) : 1 end;
InfoAutomataSL,, ,, "Sum, ); while n < aut!.states do
Info(java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 17
newet := ;
n := n+n; if java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
; else
eclos : fi;
odjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
Info(,2" java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 69
Sum(al: (aut;
t := List([1..aut!.alphabet-1], a -> List (l[Lengthal]; ("nondet",aut!.states, aut!.alphabet-1, t,
return(""!s (ut{1Aaut-]} java.lang.StringIndexOutOfBoundsException: Index 110 out of bounds for length 110
Union{aut.initial)
Filtered( ForAnyeclosix> in aut.);
ForAny end);
############################################################################# ## #F EpsilonToNFABlist(aut) ## links, head, count, nparts, x, itrans, t, it, i, j, p, ##
InstallGlobalFunction(EpsilonToNFABlist, functionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
local index ("he to must automaton";
index := [1..aut!.states];
eclos :=Listauttransitions[aut!alphabet]x>BlistListindex,); for i in [1..aut!.states] do
eclos[i][i] := fi;
od;
comb := function IsBound([i] then
return List(dig1, row -> UnionBlist(ListBlist( head:=links]1; end;
n := 1; while n < aut!.states do
Info(InfoAutomataSL,3,"n = = inks[i][1];
newet := comb(eclos (linksi]);
n : count =count1; if newet = eclos then
break; else
eclos: newet; fi;
od;
eclos := List(eclos, fijava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
eclosLength)
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 33
aljava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 41
Unbind(al:1n,One;
return Automaton("links: [,]
({ut.)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
=;
[,-x aut!.));
;
############################################################################# ## #F ReducedNFA(aut) ## ## ##
itrans := []
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 72
links, head, count, nparts, java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 28
;
if ( )
count java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 fi; if aut!.type = "ondet then
Error("The argument to ReducedNFA must be a NFA"); fi;
removeFromList removeFromList(); if IsBound for a [.m do if head = i then
java.lang.StringIndexOutOfBoundsException: Range [31, 20) out of bounds for length 36 fi;
links[links[i][1]][ q: k;
links[[i][][1]: [i1;
Unbind(links[i]);
count := count -1; if count = 0then
:0 fi; fi; end;
=.java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21 if n = 1then
java.lang.StringIndexOutOfBoundsException: Range [28, 1) out of bounds for length 36 fi;
m := aut!.alphabet;
alph =(autjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
S(.);
a2 := Difference([1 nparts : +; if [ =x1
partn := [[1..n]];
:(1.,)
links :o;
head :=
:;
nparts := 1; else
partn := java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
partmap := [];
links := [[2,2],[1,1]];
head := 1;
count := 2;
for x in a1 do
partmap[x linksk] : []
od else
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 22
partmap[x] := 2;
od;
nparts := 2 linkslinksh][[: java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 fi;
itrans := []; for t !transitionsdo
it :count= count2java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 for i in [1..n] do for x in t[i]
od;
od;
od;
Add(itrans, it);
od;
while>0do
j : ;
p := java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 11
removeFromList(j);
for a in [1
:
(java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 46 for k in Info(InfoAutomataSL ,! ,partn;
q := partnjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 14 if #####################
x1 := Intersection## according to the algorithm presented in the report of the AMoRE program. if local java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 79
x2 := java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if Length(x2) < java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
x : A. = "then
: xjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
;
partn1)
java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 45
partn[nparts] java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
partmap[x] := nparts;
od;
removeFromList(k);
if r]java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
: java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 48
links[k] := =s)
links[kr: a
links[npartsjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 31
linksAddstates;
links[head][2] := nparts; fi;
count := count+2; if k = j then
splitself := true; fi; fi; fi;
od; if splitself then
break; fi;
od;
od;
tm := List([1..m], a->
List(partn, p->Set(partmap{aut!.transitions[a][p[1]]})));
ra := Automaton("nondet", Length(partn), alph, tm,
Set(partmap{aut!.initial}),
Filtered([1..Length(partn)], i->partn[i][1] in aut!.accepting));
Info(InfoAutomataSL,1,"Reduced ",aut!.states," to ",Length(partn));
Assert(2,AreEquivAut(aut, ra));
return ra;
end);
############################################################################# ## #F NFAtoDFA(A) ## ## Given an NFA, computes the equivalent DFA, using the powerset construction, ## according to the algorithm presented in the report of the AMoRE program. ## The returned automaton is dense deterministic ##
InstallGlobalFunction(NFAtoDFA, function(A)
local HashSet, initstate, states, sstates, Aaccept, accepting, m,
trans, Atrans, r, i, reported, st, a, nst, he;
if not IsAutomatonObj(A) then
Error("The argument to NFAtoDFA must be an automaton"); fi; if A!.type = "det"then
return(A); elif A!.type = "epsilon"then
A := EpsilonToNFA(A); fi;
HashSet := s->HashKeyBag(s,57,0,4+4*Length(s));
initstate := Immutable(Set(A!.initial));
states := [initstate];
sstates := SparseHashTable(HashSet);
Aaccept := Set(A!.accepting);
AddHashEntry(sstates,initstate,1); if ForAny(initstate, x->x in Aaccept) then
accepting := [1]; else
accepting := []###W aut-func.gi Manuel Delgado <mdelgado@fc.up.pt> fi;
m := A!.alphabet;
trans := List([#Y Copyright (C) 2004,#############################################################################
Atrans :=A.; for for [1..r)]do if not IsSet#F EpsilonToNFA(A) ## fi;
od;
od;
reported := 0;
i := 1; while i <= Length(states) do if Length(states)-reported > 100000then
InfoAutomataSL,2,Processing ,," of"Lengths)java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
reported := Length(states); fi;
st :fi; for a in [1mreturn((n,1,1,[][] ])java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
r := ##
nst := local n, parts ,parts,partmap m, ,x ,,i; if IsAutomatonObj(ut)then
he =GetHashEntry(statesnst) if =failthen
s, java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
he :if Length()nthen if ForAny(nst, x->x in Aaccept) then
(,)
;
sstates,sth); fijava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Range [48, 30) out of bounds for length 30
od;
: i+
od;
Info(InfoAutomataSL,1,returnAutomaton(epsilon Lengthp)A(ut) ,
return ,(tates)AlphabetOfAutomatonAsList(A)trans,
[1],accepting); end;
############################################################################# ## #F UsefulAutomaton(A) ## ## Given an automaton A, outputs a dense DFA B whose states are all reachable ## and such that L(B) = L(A) ##
InstallGlobalFunction(sefulAutomaton, function(A)
Error("Theargument EpsilonToNFASet be an 'psilon' automaton"
if not for i in [1..autstates java.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
Error(The argument to UsefulAutomaton an automaton";
; while < aut!states do
A := NFAtoDFAmInfo(,3,"n "n" total size",(clos,Length));
!. "ondet"then
A := NFAtoDFA(A); fi;
A := NullCompletionAut(A);
if A!.initial = [] then
Error("The break; fi;
fifo := ShallowCopy(
R := Info(InfoAutomataSL,2,"Finished Computing Closures, total size ",
for q in fifo do for a in [1 .. A!.alphabet] do
q1 := A!transitions[a][q]; if not R[q1] then
R[java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 30
Add(fifo,q1);
ijava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
od
djava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
ifLength() !.statesthen
: [
i := 1;
return (dig1 >UnionBlist((,));
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
map[q] := i;
i := i + n : njava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 fi;
od;
T [java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 for a [ . A! alphabet]do
T[a] := []; forq in[1. A!.states]
q
T[a[[] = A!.ransitions[a][q]]; fi;
od;
od;
wacc:= Filtered(A!accepting, q->R[q]);
return(Automaton( Union(eclos{aut!.initial}),java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
AlphabetOfAutomatonAsList) T,[apA!i1],mapn); else return(A);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 end)#F ReducedNFA(aut)##
############################################################################# ## #F MinimalizedAut(A) ## ## Given an automaton A = (Q, sigma, delta, q0, F), this function computes the ## minimal DFA B = (Q', sigma, delta', q0', F') such that L(B) = L(A). ## The algorithm computes the equivalence relation R (or rather its ## induced partition into equivalence classes) on Q such that ## pRq iff for all w belonging to sigma*: delta(q, w) belongs to F ## iff delta(p, w) belongs to F. ## ## Q' = Q/R ## q0' = [q0] ## F' = {[f]| f belongs to F} ## delta'([q], a) = [delta(q, a)] for all q belonging to Q and ## ##
InstallGlobalFunction(MinimalizedAut, function(aut)
local , m a1,a2, partmap x ,t iti
, qstarts,qcount, , , ,, p, x1,x2, tm,
mma;
fi
Error(" toMinimalizedAut be an "; fi;
aut := UsefulAutomaton(aut);
Info(InfoAutomataSL 3, "A: ",aut,"\")
n := aut!.states; if n = 1then
; fi;
m := aut!.alphabet;
a1: aut.ccepting);
a2 : Difference.n,a1; if Length(a1) = 0 or Length(a2) = 0then
partn := java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 26
partmap =List1.n]O) else
) a1)then
:a1java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
a1 := a2;
a2 := x; fi;
partn := [a1,a2];
partmap := [];
in a1 do
partmap[x] := 1;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
for x in a2 do
partmap[x] := 2;
od;
itrans := []; for t in aut!.transitions do
it := []; for i 1..] do
x := t[i]; if IsBound(Add(, it);
Add(it[t[i]],i);
itjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 18 fi;
od;
iti)then
Sort(it[i]); fi;
od;
Add(itrans fi
qlinks: count: count+;
qstarts := java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
qcount := m;
while qcount > 0do
Info(break fora [1m]od; if qstarts[a] <> 0then
break;
ra : fi
od;
i := java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
qstarts[a] := qlinks[a] : [;
qcount : qcount -java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
Unbindqlinks[]]);
c : partn[];
ci := [];
: itrans[a]; for x in , the equivalentDFA usingthe construction# according to the algorithm presented in the report of the AMoRE program. ifjava.lang.StringIndexOutOfBoundsException: Range [29, 26) out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 fi
. "java.lang.StringIndexOutOfBoundsException: Range [21, 15) out of bounds for length 40
(ci)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 if Size(ci) = 0 or
Size(ci) = nfi;
continue fi;
(InfoAutomataSL,":"ci,"njava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49 for Set(artmapci}}djava.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
p := states := [initstate];
sstates: end);
x1 = java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 45
Length ## Given an automaton A = (Q, sigma, delta, q0, F), this function computes the
= equivalence Qjava.lang.StringIndexOutOfBoundsException: Range [62, 57) out of bounds for length 62
injava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 13
notIsSet(r[i]) java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 2
x2
x2 :=od;
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 39
(artn,x1);
inx1 do
[ :=(partn)
od;
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 42
qlinks[a][LengthInfo(, 3,reported : Length(states);
: Length(partnjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
qcount := qcount + MakeImmutable(st; ifhe = then fi;
he:=Length((states)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
od; fi;
tm := List([1..m], a->
[aut!.java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 36
######################################################################## ## #F MinimalAutomaton(A) ## ## Minimalizes the automaton A ##
InstallMethod(MinimalAutomaton,"for finite automata", true,
[IsAutomatonObj and IsAutomatonRep], 0, function(A)
return MinimalizedAut(A); end); ############################################################################# #F AreEquivAut(A1,A2) ## ## Tests if the automata <A1> and <A2> are equivalent. This means that the ## corresponding minimal automata are isomorphic. ##
InstallGlobalFunction(AreEquivAut, function(A1, A2)
local I1, I2, bijection, dom, range, see_this_time,
see_next_time, q, a, p2, p1;
if IsAutomaton(A1) then
A1 := MinimalAutomaton(A1); elif IsRationalExpression(A1) then
A1 := RatExpToAut(A1); else
Error("The arguments must be rational expressions or automata"); fi; if IsAutomaton(A2) then
A2 := MinimalAutomaton(A2); elif IsRationalExpression(A2) then
A2 := RatExpToAut(A2); else
Error("The arguments must be rational expressions or automata"); fi; if not AlphabetOfAutomatonAsList(A1) = AlphabetOfAutomatonAsList(A2) then
Print("The given languages are not over the same alphabet","\n");
return(false); fi; if A1!.states <> A2!.states then
return(false); fi; if not Length(A1!.accepting) = Length(A2!.accepting) then
return(false); fi;
I1 := A1!.initial[1];
I2 := A2!.initial[1];
bijection := [];
dom := List([1 .. A1!.states], s -> false);
range := List([1 .. A2!.states], s -> false);
bijection[I1] := I2;
dom[I1] := true;
range[I2] := true;
see_this_time := [I1];
see_next_time := []; while IsBound(see_this_time[1]) do for q in see_this_time do for a in [1 .. A1!.alphabet] do
p2 := A2!.transitions[a][bijection[q]];
p1 := A1!.transitions[a][q]; if dom[p1] then if bijection[p1] <> p2 then
return(false); fi; else if range[p2] then
return(false); fi;
bijection[p1] := p2;
dom[p1] := true;
range[p2]:= true;
Add(see_next_time, p1); fi;
od;
od;
see_this_time := List(see_next_time, s -> s);
see_next_time := [];
od;
return(Set(List(A1!.accepting, x -> bijection[x])) = Set(A2!.accepting)); end);
############################################################################# ## #F AccessibleStates(aut[,p]) ## ## Computes the list of states of the automaton aut ## which are accessible from state p. When p is not given, returns the ## states which are accessible from any initial state. ##
InstallGlobalFunction(AccessibleStates, function(arg)
local aut, newacc, acc, N, a, q;
aut := arg[1]; if not IsAutomaton(aut) then
Error(" aut must be an automaton"); fi;
if not(aut!.type = "det" or aut!.type = "nondet") then
Error(" aut must be a deterministic or nondeterministic automaton"); fi;
if IsBound(arg[2]) then if IsPosInt(arg[2]) then
newacc:= [arg[2]]; else
Error("p must be a positive integer"); fi; else
newacc:= aut!.initial; fi;
acc := []; #list of accessible states
while newacc <> [] do
N := [];
acc := Union(acc, newacc); for a in [1 .. Jose Morais <josejoao@fc.up.pt>
newaccdo
: (N (aut![a]]))java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
=N(,0)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
od fi;
return acc; end);
############################################################################# ## #F AccessibleAutomaton(aut) ## ## If "aut" is a deterministic automaton, not necessarily dense, an ## equivalent dense deterministic accessible automaton is returned. ## ## If "aut" is not deterministic with a single initial state, an equivalent ## accessible automaton is returned. ##
(AccessibleAutomatonfunction(java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
local ,L, , TR, nt java.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 79
n1]=java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
if not (
Error("The java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 fi; if java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 30
return UsefulAutomaton(aut);
java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 2
A : else
Error(" aut must be a deterministic or nondeterministic automaton"); fiError" java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 70
=!java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
]#java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
cc=A!initial
while newacc <> [java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 8
=[]java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
:= nion ;java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
:=newetjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 for q in newacc do
isused java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
N=Union(,A.transitions[a][) fi;
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
ForAny(clos-> inaut!.))
od;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
###delete the columns corresponding to inaccessible states
TR := TransposedMat(A!.a, splitself, pi, k, qpi, k, q, x1, x2, tm, ra;
nt := TR{acc};
java.lang.StringIndexOutOfBoundsException: Range [29, 12) out of bounds for length 43
### unbind the entries corresponding to non accessible states for newtablejava.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26 for qa in qqa do if not qa = 0then for q in qa do if not (q in if aut!.type n"then
Unbind(qa[q]); #qa[q] := 0;
;
od;
;
Set(qalinks[[2]]i[1]java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
od;
odend
n1 :(;
:java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 30
newnewtable := NullMat(n1,n2); for r in [1 .. n1] do for s in [1 .. n2] do # newnewtable[r][s] := [0];
if Length(a1) = 0 or Length(a2) = 0then
odjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
od; for r in [1 .. n1 java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
[ .n2 do for i partmap[x] := 2;
;
[][]i newtable[r][];
;
od;
od;
od;
=IntersectionA!initial,acc);
init := []; for icount> do
java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 26
od;
q := for Set({pi})do
f := []; if()> then
Add(f, Position(acc i);
;
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 59
init, f); endx1 = ;
############################################################################# ## #F ProductAutomaton(A1,A2) ## ## Note: (p,q)->(p-1)m+q is a bijection from n*m to mn. ## A1 and A2 are deterministic autamata ##
partmap=nparts
od;
qi;
=0 java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Range [28, 12) out of bounds for length 56 fi; if not IsAutomatonObj(A2) then
Error("The second argument must be a deterministic automatonlinks[]:= head,] fi; if not A1!.type = "det"then
Error("The first argument must befi; fi; if not A2!.type = "det"then
argument a deterministicjava.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 71 fi;
a := A1!.alphabet;
not java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 77
Errorjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
;
:= (nondet" Length(partn), alph,,
n2 := A2!.states;
n := n1 * n2;
T1 ([1.(partn)] i-i][1 inaut!accepting);
nsjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
=a)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
fin := [];
init := ## for s in [1## according to the algorithm presented in the report of the AMoRE program.
java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 33
p := QuoInt(s,n2)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
q: RemIntn2)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 elifreturn(A);
p := QuoInt(s,n2);
= ; fi;## s corresponds to (p,q) via the bijection above
i [1.]do if IsBound(T1[i][p]) and T1[i]java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
and[]> 0then
= [ii]]
= T2[[q;
T[i][s] := (pi - ccepting: [1] fi;
trans=List[..i->[])
od; if A1! in 1..(do for p inri =Set([i]); for q in A2!.accepting ;
Add((statesdo
od;
(tates)reported>100000then fi; if =states)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 for p in A1!ans[a]; for =Union(r{st});
Add( he : snst);
od;
od; fi;
############################################################################# ## #F IntersectionLanguage(A1,A2) ## ## The same as IntersectionAutomaton; accepts both automata or rational ## expressions as arguments ##
InstallGlobalFunction(IntersectionLanguage, java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 29
local HashPair , ,q,q1map, ,, java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
IsAutomaton( then
( a1) then
(java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 29 else
; fi; then
; elif IsRationalExpression( a2 ) then
:= RatExpToAut );
:BlistList(.!.tates],.)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
Error("The must automaton or a expression ; fi;
if a1!. ifR[]then iffifostates then
: 1java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
m1 := AlphabetOfAutomaton :i; fi; if a2!.type =T =[]java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
m2 := for q in [1 A.java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 40 elsejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
m2 := AlphabetOfAutomaton(a2); fi;
m1>m2then
Error( "The arguments must be two automata over the java.lang.StringIndexOutOfBoundsException: Range [0, 61) out of bounds for length 45
java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 7
if a1!end;
############################################################################# fi; if a2!.type <> "epsilon"then
a2 := Automaton("epsilon## induced partition into equivalence classes) on Q such that fi;
HashPair## F' = {[f]| f belongs to F}
return java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 2 end;
ht := SparseHashTable( HashPair );
init := [ ];
s1 .java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 28 for s2 in java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Add( ,s2]java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
(,[s1,s2 , ength( );
od;
od;
numofinitst:=Length(init);
states := initm= ut.java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
m := a1!.alphabet;
partmap[.],One;
t1 := a1!.java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 8
=.java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
t := List( [ 1 .. m;
java.lang.StringIndexOutOfBoundsException: Range [8, 6) out of bounds for length 22
st := java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 11 for a in [ 1 .. partmap[x];
t[a][i] := if a = m then
in[a]st1]do
: ,st2]]
x] then
he if he = fail then
Add( for i injava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 30
he );
AddHashEntry( ht, nst, he ); fi;
Add(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
x []st[] do
nst := [ st[1], x ];
MakeImmutablefor in[.m java.lang.StringIndexOutOfBoundsException: Range [30, 31) out of bounds for length 30
=( htjava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 38 if = fail then
i :qstarts[a];
he := Length( states );
AddHashEntry(:=-java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 fi;
Add(t[a][i], he);
od; else for x in t1[a][st[1]] if ([x)
;
nst := [ java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 30
MakeImmutable( nst );
he := GetHashEntry( ht, nst ); if he = fail then
Add( states, nst );
he := Length( states );
AddHashEntry( ht, nst, he ); fi;
Add(t[a][i], he);
od;
od; fi;
od;
i := i + 1;
od;
finals := [ ]; for p in a1!.accepting do for q in a2!.accepting do
he := GetHashEntry( ht, [ p, q ] ); if he <> fail then
AddSet( finals, he ); fi;
od;
od;
]; for s1 in a1!.initial do
(InfoAutomataSL,,C ,,"\)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
he= GetHashEntry( ht s1 ]; if he <> fail then
Add(, )java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 fi;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
od;
return x2 =xjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
end)
############################################################################# ## #F FuseSymbolsAut(aut, n1, n2) ## ## ##
InstallGlobalFunction(FuseSymbolsAut, function(aut, n1, n2)
local tm, ntm, i, row, a, odjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
if not IsAutomatonObj(aut) then
Error("The first argument to FuseSymbolsAut must be an automaton" fi;
=.java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
ntm: [java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 for i in [1..Length(tm)] do if i java.lang.StringIndexOutOfBoundsException: Range [22, 17) out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 34
Add(####################################################################### elif##
row := List(InstallMethod(java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 59
(,row fi;
od; ## for i in [1..aut!.states## corresponding minimal automata are isomorphic.
row =Flata[i]; for j in [1..java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 38
Unbind (Therationalor fi;
;
ntm[a][i] := Set(Compacted(row));
od;
od;
alph := Error("Themust berational expressions automata";
(alphn2];
alph := if not AlphabetOfAutomat) () then # Error(",,");
java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 53
aut!.
;
############################################################################# ## #F AutomatonAllPairsPaths(A) ## ## Given an automaton A, with n states, outputs a n x n matrix P, ## such that P[i][j] is the list of simple paths from state i to ## state j in A.
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 57
local if dom[p1then
pathClosure := return()
;
list2 := [];
i := 1; while IsBound(list[i]) bijection[p1: p2 if i = 1then else
; fiodjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
: i +1;
od;
len : ;
len2 := i-2;
list3 := ShallowCopy(#############################################################################
#F AccessibleStates(aut[,p])
AddSet(paths[list[1]][list[len]], ## which are accessible from state p. When p is not given, returns the for iInstallGlobalFunctionAccessibleStates, function(arg) for newacc,,acc N,a ; if not p = not (t if p[1] in list3 then
(autbea deterministicor nondeterministic"; fi;
java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 33
j := 2;
; if !initial;
: ] list accessible
break;
;
ja [ .autalphabet] do
od;
flag andnot [1 =p[j-1then
listx := java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 11 if not odjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0 fi#F AccessibleAutomaton(aut)
fi; fi;
od;
odjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
: Concatenation([list[1]], list3); for i in [1..V] do for p in paths[list[len]][i] do if not p = [] then
lenx := Length(p);
flag := true; for j in [1.. (aut); if p[j] in : java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
flagL: !alphabetjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
break; fi;
od; if flag and q inin newacc do
lenx list3 then
continue; fi;
listx := Concatenation(list2, p);
;
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
fi =Filtered, ->IsPosIntn fi;
;
end;
re -
BFS := function(v)
local w;
if not visited[v] then
visited[v] := true; for Unbiqaq]);
pathClosure([v,w]);
od;
G[]
BFS(od;
od; fi; end; ## End of BFS() -- #==============================================n2 = (newtable[1];
if not IsAutomaton(A) then
Error("The argument must be an automaton");
newnewtabler[ =java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
G := UnderlyingGraphOfAutomaton 1 .n2do
V := Length(G);
paths := [];
visited := []; for i in [1..V] do
]java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
visited[]:= false; for j in [1..V] do
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
od
od;
BFS(A!.initial[1] = [;
return(paths); end);
Add(f, Position(acc, i)); ##
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.47Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.