Represent regular languages and automata having more than 26 symbols in their alphabet

104 Views Asked by At

I'm working on regular languages and automata with arbitrary numbers of symbols for their alphabet (maybe more than 26.) So I'm showing the alphabet symbols by $a1, a2, ..., an$. For example a regular expression is generated in GAP like this: $"@Ua3Ua3a1Ua1Ua3a2Ua2"$ where $@$ means epsilon and $U$ means union. When I write the code depicted below, the generated automaton assumes the alphabet includes $a$ and numbers $1$ to $n$. (In this case $n=3$).

After loading the Automata package with LoadPackage("automata");, we have:

gap> w := "@Ua3Ua3a1Ua1Ua3a2Ua2";;
gap> r := RationalExpression(w);;
gap> Display(RatExpToAut(r));
   |  1  2  3  4  5  6
-----------------------
 1 |  2  3  3  2  3  3
 2 |  2  3  3  2  3  3
 3 |  5  3  3  3  3  3
 a |  3  3  3  3  4  1

Initial state:    [ 6 ]
Accepting states: [ 2, 5, 6 ]

How can I specify the alphabet in order to make it understand that for example $a1$ is a single symbol? If it's not possible in GAP, I appreciate alternative solutions using other softwares or programming languages.

1

There are 1 best solutions below

0
On BEST ANSWER

There is some issue either in the 'automata' package since RationalExpression does not behave as expected when considering large alphabets... Please consider putting an issue in https://github.com/gap-packages/automata

Independently of the way the issue will be fixed, it may be advisable to construct your regular expressions at a lower level, as in the following example

gap> @ := RatExpOnnLetters(30,[],[]);
@
gap> a1 := RatExpOnnLetters(30,[],[1]);
a1
gap> a5 := RatExpOnnLetters(30,[],[5]);
a5
gap> a25 := RatExpOnnLetters(30,[],[25]);
a25
gap> r := UnionRatExp(@,a1);
@Ua1
gap> r := UnionRatExp(r,StarRatExp(UnionRatExp(a5,ProductRatExp(a1,a25))));
@Ua1U(a5Ua1a25)*
gap> nfa := RatExpToNDAut(r);
< non deterministic automaton on 30 letters with 5 states >