Kernel: Python 3
expression
.is_equivalent
(exp
)
Whether this expression is equivalent to exp
, i.e., whether they accept the same words with the same weights.
Preconditions:
Both labelsets are free, or nullable of free
Both weightsets are either , or a field ().
Algorithm:
Compute the derived-term automaton of both expressions, and check whether the automata are equivalent.
See also:
Examples
In [1]:
In [2]:
False
In [3]:
True
In [4]:
False
In [5]:
True
Heterogeneous Comparisons
Note that rational expressions of different, but compatible, contexts, can be equivalent.
In [6]:
True
In [7]:
False