ratexp.is_valid

Whether all the starred sub-expressions have a constant-term that admit a star value.

Postconditions:

  • ratexp.constant_term does not throw an exception.

See also:

Examples

In []:
import vcsn

In $\mathbb{B}$ all the values have a star-power, so expressions are always valid.

In []:
b = vcsn.context('lal_char(ab), b')
assert(b.ratexp('\e*').is_valid())

In $\mathbb{Z}$, $0$ is the only weight that admit a star.

In []:
z = vcsn.context('lal_char(ab), z')
assert(z.ratexp('(<0>\e)*').is_valid())
assert(not z.ratexp('(<1>\e)*').is_valid())
assert(not z.ratexp('(<42>\e)*').is_valid())

In $\mathbb{Q}$ (and $\mathbb{R}$), only weights $w$ such that $|w| < 1$ admit a star.

In []:
q = vcsn.context('lal_char(ab), q')
assert(q.ratexp('(<0>\e)*').is_valid())
assert(q.ratexp('(<99/100>\e)*').is_valid())
assert(q.ratexp('(<-99/100>\e)*').is_valid())

assert(not q.ratexp('(<101/100>\e)*').is_valid())
assert(not q.ratexp('(<-101/100>\e)*').is_valid())