ratexp
.is_equivalent
(exp
)¶Whether this expression is equivalent to exp
, i.e., whether they accept the same words with the same weights.
Preconditions:
Algorithm:
See also:
import vcsn
b = vcsn.context('lal_char, b')
r1 = b.ratexp('a')
r2 = b.ratexp('b')
r1.is_equivalent(r2)
r1 = b.ratexp('a')
r2 = b.ratexp('a+a')
r1.is_equivalent(r2)
z = vcsn.context('lal_char, z')
r1 = z.ratexp('<42>a')
r2 = z.ratexp('<51>a')
r1.is_equivalent(r2)
r1 = z.ratexp('<42>a+<9>a')
r2 = z.ratexp('<51>a')
r1.is_equivalent(r2)
Note that rational expressions of different, but compatible, contexts, can be equivalent.
q = vcsn.context('lal_char, q')
z.ratexp('[abc]*').is_equivalent(q.ratexp('[abc]*'))
z.ratexp('<42>[abc]*').is_equivalent(q.ratexp('<51>[abc]*'))