Attachment '2014-01-vaucanson.py'
Download 1 # -*- coding: utf-8 -*-
2 # <nbformat>3.0</nbformat>
3
4 # <codecell>
5
6 import vcsn
7
8 # <codecell>
9
10 b = vcsn.context('lal_char(ab)_b'); b
11
12 # <codecell>
13
14 r = b.ratexp('a+b*+a'); r
15
16 # <codecell>
17
18 r+r*r
19
20 # <codecell>
21
22 r.standard().determinize().minimize().shortest(10)
23
24 # <codecell>
25
26 a = r.derived_term()
27
28 # <codecell>
29
30 a+a
31
32 # <codecell>
33
34 b = vcsn.context('lan_char(ab)_b')
35
36 # <codecell>
37
38 b.ratexp('(a+b)*').thompson().proper()
39
40 # <codecell>
41
42 z = vcsn.context('lal_char(ab)_z'); z
43
44 # <codecell>
45
46 rz=z.ratexp('[ab]*b(<2>[ab])*'); rz
47
48 # <codecell>
49
50 az =rz.derived_term(); az
51
52 # <codecell>
53
54 q = vcsn.context('lal_char(ab)_q'); q
55
56 # <codecell>
57
58 rq = q.ratexp('(<1/2>[ab])*<1/2>b[ab]*'); rq
59
60 # <codecell>
61
62 aq = rq.derived_term(); aq
63
64 # <codecell>
65
66 az&aq
67
68 # <codecell>
69
70 b = vcsn.context('lal_char(abc)_b')
71
72 # <codecell>
73
74 b
75
76 # <codecell>
77
78 a = b.ladybird(20).determinize()
79
80 # <codecell>
81
82 a.info()
83
84 # <codecell>
85
86 ctx = vcsn.context('lal_char(ab)_lat<q, r>')
87
88 # <codecell>
89
90 ctx
91
92 # <codecell>
93
94 ctx.ratexp('(<(1/2,.44)>a)*').derived_term().shortest(10)
95
96 # <codecell>
97
98 ctx = vcsn.context('lat<lal_char(ab),law_char(xyz)>_ratexpset<lal_char(uvw)_b>')
99
100 # <codecell>
101
102 ctx
103
104 # <codecell>
105
106 e = ctx.ratexp("<u*>'(a,xyz)'")
107
108 # <codecell>
109
110 e+e
111
112 # <codecell>
113
114 e.standard().info()
115
116 # <codecell>
117
118 b
119
120 # <codecell>
121
122 b = vcsn.context('lal_char(abc)_b'); b
123
124 # <codecell>
125
126 a = b.ratexp('[ab]*a[ab]').derived_term(); a
127
128 # <codecell>
129
130 print(a.format('dot'))
131
132 # <codecell>
133
134 a2 = vcsn.automaton('''digraph {
135 vcsn_context = "lal_char(abc)_ratexpset<lal_char(uv)_b>"
136 0 -> 1 [label="a,b"]
137 0->0 [label="<u*>a"]
138 I-> 0
139 1 -> F [label="<v>"]
140 }''')
141
142 # <codecell>
143
144 a2
145
146 # <codecell>
147
148 a2.ratexp()
149
150 # <codecell>
151
152 a2.shortest(10)
153
154 # <codecell>
155
156 a2.eval('aab')
157
158 # <codecell>
159
160 vcsn.context('law_char(0-9)_b')
161
162 # <codecell>
163
164 e = b.ratexp('[ab]*%abab'); e
165
166 # <codecell>
167
168 e.derived_term().determinize().minimize("signature").universal()
169
170 # <codecell>
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.