Whether all the starred sub-expressions have a constant-term that admits a star value.
Postconditions:
See also:
The following funtion will help display the result of is_valid
.
import vcsn
from IPython.display import Latex
def valid(ctx, *rs):
eqs = []
for r in rs:
r = ctx.expression(r)
eqs.append(r'{0} &: \mathrm{{{1}}}'
.format(r.format('latex'),
"valid" if r.is_valid() else "invalid"))
return Latex(r'''\begin{{aligned}}
{0}
\end{{aligned}}'''.format(r'\\'.join(eqs)))
In $\mathbb{B}$ all the values have a star-power, so expressions are always valid.
b = vcsn.context('lal_char(ab), b')
valid(b, '\e*')
In $\mathbb{Z}$, $0$ is the only weight that admits a star.
z = vcsn.context('lal_char(ab), z')
valid(z, '(<0>\e)*', '(<1>\e)*', '(<42>\e)*')
In $\mathbb{Q}$ (and $\mathbb{R}$), only weights $w$ such that $|w| < 1$ admit a star.
q = vcsn.context('lal_char(ab), q')
valid(q, '(<1/2>\e)*', '(<99/100>\e)*', '(<-99/100>\e)*', '(<101/100>\e)*', '(<-101/100>\e)*')