expression
.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.expression('a')
r2 = b.expression('b')
r1.is_equivalent(r2)
r1 = b.expression('a')
r2 = b.expression('a+a')
r1.is_equivalent(r2)
z = vcsn.context('lal_char, z')
r1 = z.expression('<42>a')
r2 = z.expression('<51>a')
r1.is_equivalent(r2)
r1 = z.expression('<42>a+<9>a')
r2 = z.expression('<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.expression('[abc]*').is_equivalent(q.expression('[abc]*'))
z.expression('<42>[abc]*').is_equivalent(q.expression('<51>[abc]*'))