Kernel: Python 3
expression.difference(exp)
expression % exp
Restricting an expression to the words not accepted by the second. In other words:
$$ (\mathsf{E} \% \mathsf{F})(u) = \begin{cases} \mathsf{E}(u) & \text{if $\mathsf{F}(u) \ne 0$} \ 0 & \text{otherwise} \end{cases} $$
Preconditions:
None
Caveat:
The name
differenceis wrong, and will certainly be changed in the future.If the second argument is not Boolean, because we determinize it, the process might loop for ever.
See also:
Examples
In the following example, we map every non empty word on to with the exception of words that are repetitions of or of .
In [1]:
Out[1]:
In [2]:
Out[2]:
The operator % is also supported in the syntax of rational expressions:
In [3]:
Out[3]: