forked from gap-packages/automata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEXAMPLES
29 lines (21 loc) · 837 Bytes
/
EXAMPLES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
********************************
*********** Automata ***********
To give an automaton to GAP use the function Automaton
gap> Automaton("det",3,2,[ [ 0, 3, 0 ], [ 2, 3, 0 ] ],[ 3 ],[ 1, 3 ]);;
A random function is also available
gap> x := RandomAutomaton("det",3,2);;Display(x);
| 1 2 3
--------------
a | 3
b | 2 3
Initial state: [ 3 ]
Accepting states: [ 1, 3 ]
Now using Print and String you obtain
gap> Print(String(x));
Automaton("det",3,"ab",[ [ 0, 3, 0 ], [ 2, 3, 0 ] ],[ 3 ],[ 1, 3 ]);;
and through the use of copy/paste and some small changes it is easy to give your favourite automaton to GAP.
********************************************
*********** Rational Expressions ***********
To give a rational expression to GAP use the function RationalExpression
gap> RationalExpression("aUba*","ab");
aUba*