Metatheory.jl
Metatheory.jl copied to clipboard
issue for ematching literals
Metatheory 1.3.3, SymbolicUtils 0.19.1
using SymbolicUtils
@syms x::Real
r = @rule exp(-1 * im * ~x) => cos(~x) - im*sin(~x)
gives
┌ Error: This shouldn't be printed. Report an issue for ematching literals
└ @ Metatheory.EMatchCompiler C:\Users\jaakkor2\.julia\packages\Metatheory\XcKKW\src\ematch_compiler.jl:206
┌ Error: This shouldn't be printed. Report an issue for ematching literals
└ @ Metatheory.EMatchCompiler C:\Users\jaakkor2\.julia\packages\Metatheory\XcKKW\src\ematch_compiler.jl:206
exp(-1 * im * ~x) => cos(~x) - im * sin(~x)
An earlier Issue about the rule at https://github.com/JuliaSymbolics/SymbolicUtils.jl/issues/289.
Seems it is an issue when building the pattern for the EGraphs backend. Will investigate ASAP.
Seems like complex literals -1 + 0im are not e-graph friendly at the moment.
Thanks for reporting this bug
@jaakkor2 is the rule working as you expected?
This works
r1 = @rule exp(im * ~x) => cos(~x) + im*sin(~x)
but this does not
r2 = @rule exp(-im * ~x) => cos(~x) - im*sin(~x)
as said in issue JuliaSymbolics/SymbolicUtils.jl#289.
Should have fixed the compilation bug. Not sure about the pattern matching against complex numbers. That requires a bit more investigation
Closing as the compilation bug was fixed more than two years ago.