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
6 Finite regular languages
3
4
This chapter describes some functions to deal with finite regular languages.
5
6
7
6.1 Dealing with finite regular languages
8
9
6.1-1 IsFiniteRegularLanguage
10
11
IsFiniteRegularLanguage( L )  function
12
13
L is an automaton or a rational expression. This function tests whether its
14
argument represents a finite language or not.
15
16
 Example 
17
gap> RandomRatExp(2);
18
b*(aU@)
19
gap> IsFiniteRegularLanguage(last);
20
false
21
gap> RandomRatExp(2);
22
aUbU@
23
gap> IsFiniteRegularLanguage(last);
24
true
25

26
27
6.1-2 FiniteRegularLanguageToListOfWords
28
29
FiniteRegularLanguageToListOfWords( L )  function
30
31
L is an automaton or a rational expression. This function outputs the
32
recognized language as a list of words.
33
34
 Example 
35
gap> r:=RationalExpression("aaUx(aUb)"); 
36
aaUx(aUb)
37
gap>  FiniteRegularLanguageToListOfWords(r);
38
[ "aa", "xa", "xb" ]
39

40
41
6.1-3 ListOfWordsToAutomaton
42
43
ListOfWordsToAutomaton( alph, L )  function
44
45
Given an alphabet alph (a list) and a list of words L (a list of lists),
46
outputs an automaton that recognizes the given list of words.
47
48
 Example 
49
gap> ListOfWordsToAutomaton("ab",["aaa","bba",""]);
50
< deterministic automaton on 2 letters with 6 states >
51
gap> FAtoRatExp(last);
52
(bbUaa)aU@
53

54
55
56